gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp testsu...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp testsu...
Date: Tue, 06 Mar 2007 15:14:52 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/03/06 15:14:52

Modified files:
        .              : ChangeLog 
        server/vm      : ASHandlers.cpp 
        testsuite/misc-mtasc.all: function.as 

Log message:
                * server/vm/ASHandlers.cpp (ActionCallMethod): when method name
                  is undefined, we must use the provided object's constructor.
                * testsuite/misc-mtasc.all/function.as: add (failing) test for
                  'this' pointer being correctly set on ActionCallMethod.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2552&r2=1.2553
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.53&r2=1.54
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-mtasc.all/function.as?cvsroot=gnash&r1=1.4&r2=1.5

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2552
retrieving revision 1.2553
diff -u -b -r1.2552 -r1.2553
--- ChangeLog   6 Mar 2007 14:56:33 -0000       1.2552
+++ ChangeLog   6 Mar 2007 15:14:51 -0000       1.2553
@@ -1,3 +1,10 @@
+2007-03-06 Sandro Santilli <address@hidden>
+
+       * server/vm/ASHandlers.cpp (ActionCallMethod): when method name
+         is undefined, we must use the provided object's constructor.
+       * testsuite/misc-mtasc.all/function.as: add (failing) test for
+         'this' pointer being correctly set on ActionCallMethod.
+
 2007-03-06 Ann Barcomb <address@hidden>
 
        * server/asobj/xmlsocket.cpp: convert init_member to new

Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -b -r1.53 -r1.54
--- server/vm/ASHandlers.cpp    6 Mar 2007 14:57:06 -0000       1.53
+++ server/vm/ASHandlers.cpp    6 Mar 2007 15:14:52 -0000       1.54
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: ASHandlers.cpp,v 1.53 2007/03/06 14:57:06 strk Exp $ */
+/* $Id: ASHandlers.cpp,v 1.54 2007/03/06 15:14:52 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -2635,21 +2635,34 @@
        );
 
        as_value method_val;
-       as_object *obj = obj_value.to_object(); // for this_ptr
+       as_object* obj = obj_value.to_object(); // for this_ptr, but should 
probably not be used that wayobject
        if ( method_name.is_undefined() )
        {
                method_val = obj_value;
                if ( ! method_val.is_function() )
                {
+                       // TODO: all this crap should go into an 
as_object::getConstructor instead
+                       as_value ctor;
+                       if ( ! obj->get_member("constructor", &ctor) )
+                       {
                        IF_VERBOSE_ASCODING_ERRORS(
-                       log_aserror("ActionCallMethod: "
-                               "Tried to invoke an %s value as method.",
-                               obj_value.typeOf());
+                               log_aserror("ActionCallMethod: object has no 
constructor");
                        );
                        env.drop(nargs+2);
-                       env.top(0).set_undefined(); // should we push an object 
anyway ?
+                               env.top(0).set_undefined();
                        return;
                }
+                       if ( ! ctor.is_function() )
+                       {
+                               IF_VERBOSE_ASCODING_ERRORS(
+                               log_aserror("ActionCallMethod: object 
constructor is not a function");
+                               );
+                               env.drop(nargs+2);
+                               env.top(0).set_undefined(); 
+                               return;
+                       }
+                       method_val = ctor;
+               }
        }
        else
        {

Index: testsuite/misc-mtasc.all/function.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/misc-mtasc.all/function.as,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- testsuite/misc-mtasc.all/function.as        6 Mar 2007 12:26:53 -0000       
1.4
+++ testsuite/misc-mtasc.all/function.as        6 Mar 2007 15:14:52 -0000       
1.5
@@ -5,14 +5,22 @@
        function Test()
        {
                _root.check_equals(typeof(super), 'object');
-               super(); // how can we invoke an object here !?
+
+               // This seems to trigger an ActionCallMethod(undefined, super).
+               // It is expected that the VM fetches super.constructor and 
calls
+               // that instead.
+               super();
        }
 
        static function main(mc)
        {
                var myTest = new Test;
                // odd enough, if we output an SWF7 movie, this fails
-               // with the reference player too !x
-               _root.xcheck_equals(myTest.TestClassCtorCalled, 'called');
+               // with the reference player too !
+               _root.check_equals(myTest.TestClassCtorCalled, 'called');
+
+               // This checks that the 'this' pointer is properly set
+               // (and shows it's NOT properly set with Gnash)
+               
_root.xcheck_equals(typeof(myTest.__proto__.TestClassCtorCalled), 'undefined');
        }
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]