gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/asobj/xml.cpp server/aso...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/asobj/xml.cpp server/aso...
Date: Tue, 02 Oct 2007 13:17:30 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/10/02 13:17:30

Modified files:
        .              : ChangeLog 
        server/asobj   : xml.cpp xml.h 
        testsuite/actionscript.all: XML.as XMLNode.as 

Log message:
                * server/asobj/xml.{cpp,h}: get environment passed for events
                  invocation purposes.
                * testsuite/actionscript.all/: XML.as, XMLNode.as: use check.as
                  instead of dejagnu.as, add check_totals.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4499&r2=1.4500
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.cpp?cvsroot=gnash&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/xml.h?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/XML.as?cvsroot=gnash&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/XMLNode.as?cvsroot=gnash&r1=1.14&r2=1.15

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4499
retrieving revision 1.4500
diff -u -b -r1.4499 -r1.4500
--- ChangeLog   2 Oct 2007 12:52:48 -0000       1.4499
+++ ChangeLog   2 Oct 2007 13:17:29 -0000       1.4500
@@ -1,5 +1,10 @@
 2007-10-02 Sandro Santilli <address@hidden>
 
+
+       * server/asobj/xml.{cpp,h}: get environment passed for events
+         invocation purposes.
+       * testsuite/actionscript.all/: XML.as, XMLNode.as: use check.as
+         instead of dejagnu.as, add check_totals.
        * server/array.cpp (as_value_custom call operator): use the
          environment passed to us, not a newly created one.
 

Index: server/asobj/xml.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xml.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- server/asobj/xml.cpp        24 Sep 2007 12:34:50 -0000      1.48
+++ server/asobj/xml.cpp        2 Oct 2007 13:17:29 -0000       1.49
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-/* $Id: xml.cpp,v 1.48 2007/09/24 12:34:50 strk Exp $ */
+/* $Id: xml.cpp,v 1.49 2007/10/02 13:17:29 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -190,7 +190,7 @@
 }
 
 void
-XML::onLoadEvent(bool success)
+XML::onLoadEvent(bool success, as_environment& env)
 {
     // Do the events that (appear to) happen as the movie
     // loads.  frame1 tags and actions are executed (even
@@ -212,13 +212,19 @@
     if ( method.is_undefined() ) return;
     if ( ! method.is_function() ) return;
 
-    as_environment env; // how to set target here ??
+#ifndef NDEBUG
+    size_t prevStackSize = env.stack_size();
+#endif
     env.push(as_value(success));
     call_method(method, &env, this, 1, env.stack_size()-1);
+    env.drop(1);
+#ifndef NDEBUG
+    assert( prevStackSize == env.stack_size());
+#endif
 }
 
 void
-XML::onCloseEvent()
+XML::onCloseEvent(as_environment& env)
 {
     // Do the events that (appear to) happen as the movie
     // loads.  frame1 tags and actions are executed (even
@@ -240,7 +246,6 @@
     if ( method.is_undefined() ) return;
     if ( ! method.is_function() ) return;
 
-    as_environment env; // how to set target here ??
     call_method(method, &env, this, 0, 0);
 }
 
@@ -393,7 +398,7 @@
 // This reads in an XML file from disk and parses into into a memory resident
 // tree which can be walked through later.
 bool
-XML::load(const URL& url)
+XML::load(const URL& url, as_environment& env)
 {
     GNASH_REPORT_FUNCTION;
   
@@ -406,7 +411,7 @@
     if ( ! str.get() ) 
     {
         log_error(_("Can't load XML file: %s (security?)"), url.str().c_str());
-        onLoadEvent(false);
+        onLoadEvent(false, env);
         return false;
     }
 
@@ -423,7 +428,7 @@
         _doc = 0;
         log_error(_("Can't read XML file %s (stream error %d)"), 
url.str().c_str(), str->get_error());
         _loaded = 0;
-        onLoadEvent(false);
+        onLoadEvent(false, env);
         return false;
     }
 
@@ -434,7 +439,7 @@
         xmlErrorPtr err = xmlGetLastError();
         log_error(_("Can't read XML file %s (%s)"), url.str().c_str(), 
err->message);
         _loaded = 0;
-        onLoadEvent(false);
+        onLoadEvent(false, env);
         return false;
     }
 
@@ -447,7 +452,7 @@
     xmlMemoryDump();
     _loaded = ret ? 1 : 0;
 
-    onLoadEvent(ret);
+    onLoadEvent(ret, env);
 
     return ret;
 }
@@ -531,7 +536,7 @@
 
     // Set the argument to the function event handler based on whether the load
     // was successful or failed.
-    ret = xml_obj->load(url);
+    ret = xml_obj->load(url, fn.env());
     rv = ret;
 
     if (ret == false) {

Index: server/asobj/xml.h
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/xml.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/asobj/xml.h  16 Sep 2007 16:48:14 -0000      1.18
+++ server/asobj/xml.h  2 Oct 2007 13:17:30 -0000       1.19
@@ -120,7 +120,14 @@
 
     // Loads a document (specified by
     // the XML object) from a URL.
-    bool load(const URL& url);
+    //
+    // @param url
+    // 
+    // @param env
+    //         The environment to use for calling event hadlers
+    // TODO: what about 'this' pointer?
+    //
+    bool load(const URL& url, as_environment& env);
 
     // An event handler that returns a
     bool onLoad();
@@ -197,10 +204,10 @@
     Status      _status;       
 
     /// Trigger the onLoad event, if any
-    void onLoadEvent(bool success);
+    void onLoadEvent(bool success, as_environment& env);
 
     /// Trigger the onClose event, if any
-    void onCloseEvent();
+    void onCloseEvent(as_environment& env);
   
     /// Initialize an XMLNode from an xmlNodePtr
     //

Index: testsuite/actionscript.all/XML.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/XML.as,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- testsuite/actionscript.all/XML.as   29 Sep 2007 16:22:58 -0000      1.39
+++ testsuite/actionscript.all/XML.as   2 Oct 2007 13:17:30 -0000       1.40
@@ -20,9 +20,10 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: XML.as,v 1.39 2007/09/29 16:22:58 strk Exp $";
+rcsid="$Id: XML.as,v 1.40 2007/10/02 13:17:30 strk Exp $";
 
-#include "dejagnu.as"
+#include "check.as"
+//#include "dejagnu.as"
 #include "utils.as"
 
 var existtests = true;
@@ -753,5 +754,14 @@
 check_equals(myxml2.toString(), "<X1> t </X1>"); 
 
 // We're done
-//totals();
-totals();
+#if OUTPUT_VERSION < 6
+ // NOTE: tests inside onLoad are not counted here as onLoad handler
+ //       should execute later !
+ //       Gnash fails executing onLoad immediately
+ xcheck_totals(228);
+#else
+ // NOTE: tests inside onLoad are not counted here as onLoad handler
+ //       should execute later !
+ //       Gnash fails executing onLoad immediately
+ xcheck_totals(291);
+#endif

Index: testsuite/actionscript.all/XMLNode.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/XMLNode.as,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- testsuite/actionscript.all/XMLNode.as       29 Sep 2007 16:22:58 -0000      
1.14
+++ testsuite/actionscript.all/XMLNode.as       2 Oct 2007 13:17:30 -0000       
1.15
@@ -20,9 +20,10 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: XMLNode.as,v 1.14 2007/09/29 16:22:58 strk Exp $";
+rcsid="$Id: XMLNode.as,v 1.15 2007/10/02 13:17:30 strk Exp $";
 
-#include "dejagnu.as"
+#include "check.as"
+//#include "dejagnu.as"
 
 var doc = new XML();
 
@@ -109,5 +110,4 @@
 // }
 
 
-totals();
-totals();
+check_totals(27);




reply via email to

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