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


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp
Date: Thu, 01 Mar 2007 20:34:36 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/03/01 20:34:36

Modified files:
        .              : ChangeLog 
        server/vm      : ASHandlers.cpp 

Log message:
        This one fixes the newly added MTASC testcase.
                * server/vm/ASHandlers.cpp (ActionNewMethod):
                  Use object parameter as *the* function if method name is      
                                                                                
                 undefined; check that the constructor is actually a function;
                  (ActionNew) check that the constructor is actually a function;
                  (constructor_object) assert that the constructor is a 
function.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2509&r2=1.2510
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.44&r2=1.45

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2509
retrieving revision 1.2510
diff -u -b -r1.2509 -r1.2510
--- ChangeLog   1 Mar 2007 17:20:40 -0000       1.2509
+++ ChangeLog   1 Mar 2007 20:34:36 -0000       1.2510
@@ -1,5 +1,10 @@
 2007-03-01 Sandro Santilli <address@hidden>
 
+       * server/vm/ASHandlers.cpp (ActionNewMethod):
+         Use object parameter as *the* function if method name is
+         undefined; check that the constructor is actually a function;
+         (ActionNew) check that the constructor is actually a function;
+         (constructor_object) assert that the constructor is a function.
        * testsuite/misc-mtasc.all/inheritance.as:
          Add test provided by P T Withington for debugging
          problems with OpenLaszlo foundation classes.

Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- server/vm/ASHandlers.cpp    28 Feb 2007 23:58:26 -0000      1.44
+++ server/vm/ASHandlers.cpp    1 Mar 2007 20:34:36 -0000       1.45
@@ -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.44 2007/02/28 23:58:26 strk Exp $ */
+/* $Id: ASHandlers.cpp,v 1.45 2007/03/01 20:34:36 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -150,6 +150,13 @@
             call_method(constructor, &env, new_obj_ptr.get(), nargs, 
first_arg_index);
         }
     }
+    else
+    {
+           // callers should make sure constructor is a function !
+           // Actually, we should change this function interface
+           // to take an as_function directly... (TODO)
+           assert(0);
+    }
     
     return new_obj;
 }
@@ -2207,6 +2214,15 @@
        thread.ensureStack(nargs); // previous 2 entries popped
 
        as_value constructor = thread.getVariable(classname); 
+       if ( ! constructor.is_function() )
+       {
+               IF_VERBOSE_MALFORMED_SWF(
+               log_swferror("ActionNew: "
+                       "constructor parameter is NOT a function");
+               );
+               env.drop(nargs);
+               env.push(as_value()); // should we push an object anyway ?
+       }
 
        as_value new_obj = construct_object(constructor, env, nargs,
                env.get_top_index());
@@ -2670,7 +2686,7 @@
 
        thread.ensureStack(3); // method, object, nargs
 
-       as_value method_name = env.pop().to_string();
+       as_value method_name = env.pop();
        as_value obj_val = env.pop();
        unsigned nargs = unsigned(env.pop().to_number());
 
@@ -2684,29 +2700,48 @@
                        "On ActionNewMethod: "
                        "no object found on stack on ActionMethod");
                env.drop(nargs);
+               env.push(as_value());
                return;
        }
 
        as_value method_val;
+       if ( method_name.is_undefined() )
+       {
+               method_val = obj_val;
+               if ( ! method_val.is_function() )
+               {
+                       IF_VERBOSE_MALFORMED_SWF(
+                       log_swferror("ActionNewMethod: "
+                               "method name is undefined, "
+                               "and object is not a function");
+                       );
+                       env.drop(nargs);
+                       env.push(as_value()); // should we push an object 
anyway ?
+                       return;
+               }
+       }
+       else
+       {
        string method_string = method_name.to_std_string();
-       //if ( ! obj->get_member(method_name.to_tu_stringi(), &method_val) )
        if ( ! thread.getObjectMember(*obj, method_string, method_val) )
        {
-               // SWF integrity check 
-               log_warning(
-                       "On ActionNewMethod: "
+                       IF_VERBOSE_MALFORMED_SWF(
+                       log_swferror("ActionNewMethod: "
                        "can't find method %s of object %s",
                        method_name.to_string(), obj_val.to_string());
+                       );
                env.drop(nargs);
+                       env.push(as_value()); // should we push an object 
anyway ?
                return;
        }
+       }
 
        // Construct the object
        as_value new_obj = construct_object(method_val, env, nargs,
                        env.get_top_index());
 
-       log_msg("%s.%s( [%d args] ) returned %s", obj_val.to_string(),
-               method_name.to_string(), nargs, new_obj.to_string());
+       //log_msg("%s( [%d args] ) returned %s", method_val.to_string(),
+       //      nargs, new_obj.to_string());
 
 
        env.drop(nargs);




reply via email to

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