CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/12/24 14:00:31
Modified files: . : ChangeLog server : as_object.cpp as_object.h server/asobj : MovieClipLoader.cpp testsuite/actionscript.all: MovieClipLoader.as Log message: dispatch MovieClipLoader events to all listeners, not just self. Fixes bug #21881. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5251&r2=1.5252 http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.88&r2=1.89 http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.h?cvsroot=gnash&r1=1.89&r2=1.90 http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/MovieClipLoader.cpp?cvsroot=gnash&r1=1.40&r2=1.41 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/MovieClipLoader.as?cvsroot=gnash&r1=1.8&r2=1.9 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.5251 retrieving revision 1.5252 diff -u -b -r1.5251 -r1.5252 --- ChangeLog 24 Dec 2007 10:08:31 -0000 1.5251 +++ ChangeLog 24 Dec 2007 14:00:30 -0000 1.5252 @@ -1,5 +1,13 @@ 2007-12-24 Sandro Santilli <[EMAIL PROTECTED]> + * server/as_object.{cpp,h}: callMethod with 4 args.. + * server/asobj/MovieClipLoader.cpp: dispatch events to all listeners, + not just self. Fixes bug #21881. + * testsuite/actionscript.all/MovieClipLoader.as: test that a + MovieClipLoader instance is a listener of self. + +2007-12-24 Sandro Santilli <[EMAIL PROTECTED]> + * server/sprite_instance.cpp (get_member): use get_root() to evaluate the _root member. This is to get relative url rather then absolute, more correct in swf6 and should be easier to handle _lockroot for Index: server/as_object.cpp =================================================================== RCS file: /sources/gnash/gnash/server/as_object.cpp,v retrieving revision 1.88 retrieving revision 1.89 diff -u -b -r1.88 -r1.89 --- server/as_object.cpp 20 Dec 2007 14:28:50 -0000 1.88 +++ server/as_object.cpp 24 Dec 2007 14:00:30 -0000 1.89 @@ -997,6 +997,41 @@ return ret; } +as_value +as_object::callMethod(string_table::key methodName, + const as_value& arg0, const as_value& arg1, + const as_value& arg2, const as_value& arg3) +{ + as_value ret; + as_value method; + + if (! get_member(methodName, &method)) + { + return ret; + } + + as_environment env; + +#ifndef NDEBUG + size_t origStackSize = env.stack_size(); +#endif + + env.push(arg3); + env.push(arg2); + env.push(arg1); + env.push(arg0); + + ret = call_method(method, &env, this, 4, env.stack_size()-1); + + env.drop(4); + +#ifndef NDEBUG + assert(origStackSize == env.stack_size()); +#endif + + return ret; +} + as_object* as_object::get_path_element(string_table::key key) { Index: server/as_object.h =================================================================== RCS file: /sources/gnash/gnash/server/as_object.h,v retrieving revision 1.89 retrieving revision 1.90 diff -u -b -r1.89 -r1.90 --- server/as_object.h 21 Dec 2007 17:18:45 -0000 1.89 +++ server/as_object.h 24 Dec 2007 14:00:30 -0000 1.90 @@ -527,6 +527,7 @@ as_value callMethod(string_table::key name, const as_value& arg0); as_value callMethod(string_table::key name, const as_value& arg0, const as_value& arg1); as_value callMethod(string_table::key name, const as_value& arg0, const as_value& arg1, const as_value& arg2); + as_value callMethod(string_table::key name, const as_value& arg0, const as_value& arg1, const as_value& arg2, const as_value& arg3); /// Delete a property of this object, unless protected from deletion. // Index: server/asobj/MovieClipLoader.cpp =================================================================== RCS file: /sources/gnash/gnash/server/asobj/MovieClipLoader.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -u -b -r1.40 -r1.41 --- server/asobj/MovieClipLoader.cpp 21 Dec 2007 02:27:52 -0000 1.40 +++ server/asobj/MovieClipLoader.cpp 24 Dec 2007 14:00:31 -0000 1.41 @@ -165,7 +165,9 @@ _mcl.bytes_loaded = 0; _mcl.bytes_total = 0; - set_member(NSV::PROP_uLISTENERS, new as_array_object()); + as_array_object* ar = new as_array_object(); + ar->push(this); + set_member(NSV::PROP_uLISTENERS, ar); } MovieClipLoader::~MovieClipLoader() @@ -195,27 +197,35 @@ string_table& st = _vm.getStringTable(); + as_value targetVal(&target); + log_debug("Target is %s", targetVal.to_debug_string().c_str()); + bool ret = target.loadMovie(url); if ( ! ret ) { // TODO: find semantic of last argument - callMethod(st.find("onLoadError"), as_value(&target), as_value("Failed to load movie or jpeg"), as_value(0)); + as_value met("onLoadError"); + as_value arg1("Failed to load movie or jpeg"); + as_value arg2(0); + callMethod(NSV::PROP_BROADCAST_MESSAGE, met, targetVal, arg1, arg2); return false; } // Dispatch onLoadStart - callMethod(st.find("onLoadStart"), as_value(&target)); + callMethod(NSV::PROP_BROADCAST_MESSAGE, as_value("onLoadStart"), targetVal); // Dispatch onLoadProgress struct mcl *mcl_data = getProgress(&target); // the callback since we're done loading the file mcl_data->bytes_loaded = target.get_bytes_loaded(); mcl_data->bytes_total = target.get_bytes_total(); - callMethod(st.find("onLoadProgress"), as_value(&target), mcl_data->bytes_loaded, mcl_data->bytes_total); + callMethod(NSV::PROP_BROADCAST_MESSAGE, as_value("onLoadProgress"), targetVal, + mcl_data->bytes_loaded, mcl_data->bytes_total); // Dispatch onLoadComplete - callMethod(st.find("onLoadComplete"), as_value(&target), as_value(0)); // TODO: find semantic of last arg + callMethod(NSV::PROP_BROADCAST_MESSAGE, as_value("onLoadComplete"), targetVal, + as_value(0)); // TODO: find semantic of last arg /// This event must be dispatched when actions /// in first frame of loaded clip have been executed. @@ -227,7 +237,7 @@ /// TODO: check if we need to place it before calling /// this function though... /// - callMethod(st.find("onLoadInit"), as_value(&target)); + callMethod(NSV::PROP_BROADCAST_MESSAGE, as_value("onLoadInit"), targetVal); return true; } Index: testsuite/actionscript.all/MovieClipLoader.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/actionscript.all/MovieClipLoader.as,v retrieving revision 1.8 retrieving revision 1.9 diff -u -b -r1.8 -r1.9 --- testsuite/actionscript.all/MovieClipLoader.as 23 Dec 2007 22:24:51 -0000 1.8 +++ testsuite/actionscript.all/MovieClipLoader.as 24 Dec 2007 14:00:31 -0000 1.9 @@ -21,7 +21,7 @@ // compile this test case with Ming makeswf, and then // execute it like this gnash -1 -r 0 -v out.swf -rcsid="$Id: MovieClipLoader.as,v 1.8 2007/12/23 22:24:51 strk Exp $"; +rcsid="$Id: MovieClipLoader.as,v 1.9 2007/12/24 14:00:31 strk Exp $"; #include "check.as" @@ -64,6 +64,8 @@ check_equals(typeOf(mcl._listeners), 'object'); check(mcl.hasOwnProperty('_listeners')); +check_equals(mcl._listeners.length, 1); +check_equals(mcl._listeners[0], mcl); MovieClipLoader.prototype.bm = MovieClipLoader.prototype.broadcastMessage; MovieClipLoader.prototype.broadcastMessage = function(arg1, arg2, arg3, arg4) @@ -271,7 +273,7 @@ // subtract the number of progress callback runs reported when playing from the totals to get the correct number // BUT MAKE SURE nextTestOrEnd CONTAINS THE CORRECT testsPerProgressCallback INFO !! // - expected.totals = 57; + expected.totals = 59; // gnash doesn't call onLoadInit if the data at the url is not an SWF or JPG // (or whatever else can become a movie_instance), while the PP does. // So in this testcase, the attempt to load vars.txt is invalid for Gnash _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit