CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/09/18 07:35:02
Modified files: . : ChangeLog server : array.cpp array.h testsuite/actionscript.all: array.as Log message: * server/array.{cpp,h}: Implement enumerateNonProperties(). Still not 100% correct but fixes youtube controls positioning (bug #20469). * testsuite/actionscript.all/array.as: tests for enumeration of array properties. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4338&r2=1.4339 http://cvs.savannah.gnu.org/viewcvs/gnash/server/array.cpp?cvsroot=gnash&r1=1.78&r2=1.79 http://cvs.savannah.gnu.org/viewcvs/gnash/server/array.h?cvsroot=gnash&r1=1.35&r2=1.36 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/array.as?cvsroot=gnash&r1=1.33&r2=1.34 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4338 retrieving revision 1.4339 diff -u -b -r1.4338 -r1.4339 --- ChangeLog 18 Sep 2007 06:27:34 -0000 1.4338 +++ ChangeLog 18 Sep 2007 07:35:01 -0000 1.4339 @@ -1,5 +1,13 @@ 2007-09-18 Sandro Santilli <[EMAIL PROTECTED]> + * server/array.{cpp,h}: Implement enumerateNonProperties(). + Still not 100% correct but fixes youtube controls positioning + (bug #20469). + * testsuite/actionscript.all/array.as: tests for enumeration + of array properties. + +2007-09-18 Sandro Santilli <[EMAIL PROTECTED]> + * testsuite/misc-swfc.all/movieclip_destruction_test1.sc: Add visual traces of actions while being executed; add comment about other finding. Index: server/array.cpp =================================================================== RCS file: /sources/gnash/gnash/server/array.cpp,v retrieving revision 1.78 retrieving revision 1.79 diff -u -b -r1.78 -r1.79 --- server/array.cpp 16 Sep 2007 16:48:13 -0000 1.78 +++ server/array.cpp 18 Sep 2007 07:35:02 -0000 1.79 @@ -1473,6 +1473,19 @@ glob.init_member("Array", ar.get()); } +void +as_array_object::enumerateNonProperties(as_environment& env) const +{ + // TODO: only actually defined elements should be pushed on the env + // but we currently have no way to distinguish between defined + // and non-defined elements + for (unsigned int i=0; i<size(); ++i) + { + // here should be something like, if ( isDefined(i) ) ... + env.push(as_value(i)); + } +} + #ifdef GNASH_USE_GC void as_array_object::markReachableResources() const Index: server/array.h =================================================================== RCS file: /sources/gnash/gnash/server/array.h,v retrieving revision 1.35 retrieving revision 1.36 diff -u -b -r1.35 -r1.36 --- server/array.h 16 Sep 2007 16:48:13 -0000 1.35 +++ server/array.h 18 Sep 2007 07:35:02 -0000 1.36 @@ -296,6 +296,12 @@ virtual void set_member(string_table::key name, const as_value& val ); + /// Enumerate elements + // + /// See as_object::enumerateNonProperties(as_environment&) for more info. + /// + virtual void enumerateNonProperties(as_environment&) const; + protected: #ifdef GNASH_USE_GC Index: testsuite/actionscript.all/array.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/actionscript.all/array.as,v retrieving revision 1.33 retrieving revision 1.34 diff -u -b -r1.33 -r1.34 --- testsuite/actionscript.all/array.as 1 Sep 2007 01:59:33 -0000 1.33 +++ testsuite/actionscript.all/array.as 18 Sep 2007 07:35:02 -0000 1.34 @@ -18,7 +18,7 @@ // Initial test written by Mike Carlson -rcsid="$Id: array.as,v 1.33 2007/09/01 01:59:33 strk Exp $"; +rcsid="$Id: array.as,v 1.34 2007/09/18 07:35:02 strk Exp $"; #include "check.as" @@ -922,3 +922,33 @@ #endif // OUTPUT_VERSION > 6 +//------------------------------------------------------- +// Test array enumeration +//------------------------------------------------------ + +b = ["a","b","c"]; +out = {len:0}; for (var i in b) { out[i] = 1; out['len']++; } +check_equals(out['len'], 3); +check_equals(out[0], 1); +check_equals(out[1], 1); +check_equals(out[2], 1); + +b = []; +out = {len:0}; for (var i in b) { out[i] = 1; out['len']++; } +check_equals(out['len'], 0); + +// Changing length doesn't trigger enumeration of undefined values +b.length = 100; +out = {len:0}; for (var i in b) { out[i] = 1; out['len']++; } +xcheck_equals(out['len'], 0); + +b[1] = undefined; +out = {len:0}; for (var i in b) { out[i] = 1; out['len']++; } +xcheck_equals(out['len'], 1); +check_equals(out[1], 1); + +b[0] = undefined; +out = {len:0}; for (var i in b) { out[i] = 1; out['len']++; } +xcheck_equals(out['len'], 2); +check_equals(out[1], 1); +check_equals(out[0], 1); _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit