[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/as_function.cpp testsuit...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/as_function.cpp testsuit... |
Date: |
Sun, 31 Dec 2006 14:44:54 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 06/12/31 14:44:53
Modified files:
. : ChangeLog
server : as_function.cpp
testsuite/actionscript.all: Inheritance.as
Log message:
* server/as_function.cpp: allow Function construction
using 'new'
* testsuite/actionscript.all/Inheritance.as: don't expect
'new Function' to fail. Fix for SWF<6
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2025&r2=1.2026
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_function.cpp?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Inheritance.as?cvsroot=gnash&r1=1.11&r2=1.12
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2025
retrieving revision 1.2026
diff -u -b -r1.2025 -r1.2026
--- ChangeLog 31 Dec 2006 14:02:36 -0000 1.2025
+++ ChangeLog 31 Dec 2006 14:44:53 -0000 1.2026
@@ -1,5 +1,9 @@
2006-12-31 Sandro Santilli <address@hidden>
+ * server/as_function.cpp: allow Function construction
+ using 'new'
+ * testsuite/actionscript.all/Inheritance.as: don't expect
+ 'new Function' to fail. Fix for SWF<6
* server/vm/ActionExec.{h,cpp}: simplified constructor for
function calls.
* server/swf_function.{h,cpp}: updated calls to ActionExec
Index: server/as_function.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_function.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- server/as_function.cpp 21 Dec 2006 11:34:49 -0000 1.13
+++ server/as_function.cpp 31 Dec 2006 14:44:53 -0000 1.14
@@ -46,7 +46,7 @@
void function_apply(const fn_call& fn);
void function_call(const fn_call& fn);
static as_object* getFunctionPrototype();
-static void do_nothing(const fn_call& fn);
+static void function_ctor(const fn_call& fn);
/*
* This function returns the singleton
@@ -86,12 +86,13 @@
}
static void
-do_nothing(const fn_call& fn)
+function_ctor(const fn_call& fn)
{
- log_msg("User tried to invoke new Function()");
+ boost::intrusive_ptr<as_object> func = new
as_object(getFunctionPrototype());
+ //log_msg("User tried to invoke new Function()");
if ( fn.result )
{
- fn.result->set_undefined();
+ fn.result->set_as_object(func.get());
}
}
@@ -139,7 +140,7 @@
// Make sure the prototype is always alive
// (static boost::intrusive_ptr<> should ensure this)
static boost::intrusive_ptr<as_function> func=new builtin_function(
- do_nothing, // function constructor doesn't do anything
+ function_ctor, // function constructor doesn't do anything
getFunctionPrototype() // exported interface
);
Index: testsuite/actionscript.all/Inheritance.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Inheritance.as,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- testsuite/actionscript.all/Inheritance.as 31 Dec 2006 13:59:21 -0000
1.11
+++ testsuite/actionscript.all/Inheritance.as 31 Dec 2006 14:44:53 -0000
1.12
@@ -20,12 +20,14 @@
// compile this test case with Ming makeswf, and then
// execute it like this gnash -1 -r 0 -v out.swf
-rcsid="$Id: Inheritance.as,v 1.11 2006/12/31 13:59:21 strk Exp $";
+rcsid="$Id: Inheritance.as,v 1.12 2006/12/31 14:44:53 strk Exp $";
#include "check.as"
// Function.apply is Function.__proto__.apply
-check (Function.apply != undefined);
+#if OUTPUT_VERSION > 5
+check (typeof(Function.apply) != undefined);
+#endif
check (Function.apply == Function.__proto__.apply);
// Confirm '__proto__' and 'prototype' members
@@ -39,13 +41,15 @@
// functionObject '__proto__' is a reference to
// it's constructor's 'prototype' member.
-xcheck (functionObject.__proto__ == Function.prototype);
-xcheck (functionObject.__proto__.constructor == Function);
+check_equals (functionObject.__proto__, Function.prototype);
+check_equals (functionObject.__proto__.constructor, Function);
// functionObject.apply should be functionObject.__proto__.apply
-xcheck (functionObject.apply != undefined);
-xcheck (functionObject.apply == Function.prototype.apply);
+#if OUTPUT_VERSION > 5
+check (functionObject.apply != undefined);
+check (functionObject.apply == Function.prototype.apply);
check (functionObject.apply == functionObject.__proto__.apply);
+#endif
// functionObject is an Object, not functionObject Function,
// so it doesn't have functionObject 'prototype' member
@@ -60,8 +64,11 @@
check (userFunc.apply == Function.prototype.apply);
// Override the inherited apply() method
+#if OUTPUT_VERSION > 5
+// Function.apply was introduced in SWF6
userFunc.apply = function() {};
check (userFunc.apply != Function.prototype.apply);
+#endif
// Define the Ball constructor
@@ -108,6 +115,7 @@
// Test the 'super' keyword
//------------------------------------------------
+#if OUTPUT_VERSION > 5
function BaseClass() {}
BaseClass.prototype.sayHello = function () {
return "Hello from BaseClass";
@@ -123,6 +131,7 @@
var derived = new DerivedClass();
var greeting = derived.saySuperHello();
xcheck_equals(greeting, "Hello from BaseClass");
+#endif // OUTPUT_VERSION > 5
check_equals(super, undefined);
//------------------------------------------------
@@ -140,9 +149,11 @@
var sobj1 = new SubObj1();
check_equals(sobj1.__proto__.constructor, SubObj1);
+#if OUTPUT_VERSION > 5
check(SubObj1 instanceOf Function);
check(Function instanceOf Object);
check(SubObj1 instanceOf Object);
+#endif
// inheritance chain is NOT subobj1,SubObj1,Function,Object, as the
// above might suggest...
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/as_function.cpp testsuit...,
Sandro Santilli <=