CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/08/24 10:05:58
Modified files: . : ChangeLog server : as_environment.cpp sprite_instance.cpp testsuite/actionscript.all: MovieClip.as delete.as getvariable.as Log message: * testsuite/actionscript.all/MovieClip.as: test that '_root' and '_level0' can be accessed as members of a movieclip, while 'this' cannot. * testsuite/actionscript.all/delete.as: add TODO request for testing variable access by path * testsuite/actionscript.all/getvariable.as: add test for accessing slash-based paths starting with 'this' * server/sprite_instance.cpp (get_member): don't consider 'this' as a member. * server/as_environment.cpp (find_object_{slash,dot}syntax): handle paths starting with 'this'. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4091&r2=1.4092 http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.cpp?cvsroot=gnash&r1=1.82&r2=1.83 http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.311&r2=1.312 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/MovieClip.as?cvsroot=gnash&r1=1.80&r2=1.81 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/delete.as?cvsroot=gnash&r1=1.10&r2=1.11 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/getvariable.as?cvsroot=gnash&r1=1.13&r2=1.14 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4091 retrieving revision 1.4092 diff -u -b -r1.4091 -r1.4092 --- ChangeLog 24 Aug 2007 07:36:25 -0000 1.4091 +++ ChangeLog 24 Aug 2007 10:05:57 -0000 1.4092 @@ -1,3 +1,17 @@ +2007-08-24 Sandro Santilli <[EMAIL PROTECTED]> + + * testsuite/actionscript.all/MovieClip.as: test that '_root' and + '_level0' can be accessed as members of a movieclip, while 'this' + cannot. + * testsuite/actionscript.all/delete.as: add TODO request for testing + variable access by path + * testsuite/actionscript.all/getvariable.as: add test for accessing + slash-based paths starting with 'this' + * server/sprite_instance.cpp (get_member): don't consider 'this' as + a member. + * server/as_environment.cpp (find_object_{slash,dot}syntax): handle + paths starting with 'this'. + 2007-08-24 Zou Lunkai <[EMAIL PROTECTED]> * testsuite/misc-ming.all/DefineEditTextVariableNameTest2.c: add a new Index: server/as_environment.cpp =================================================================== RCS file: /sources/gnash/gnash/server/as_environment.cpp,v retrieving revision 1.82 retrieving revision 1.83 diff -u -b -r1.82 -r1.83 --- server/as_environment.cpp 11 Jul 2007 00:16:38 -0000 1.82 +++ server/as_environment.cpp 24 Aug 2007 10:05:57 -0000 1.83 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: as_environment.cpp,v 1.82 2007/07/11 00:16:38 strk Exp $ */ +/* $Id: as_environment.cpp,v 1.83 2007/08/24 10:05:57 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -219,6 +219,7 @@ return ret.second; } + // TODO: try 'this' ? Add a testcase for it ! // Try _global return VM::get().getGlobal()->delProperty(varname).second; @@ -664,7 +665,8 @@ // TODO: make sure sprite_instances know about ".." if ( ! env->get_member(subpart.c_str(), &tmp) ) { - // Try _global, but only at first iteration... + // Try this and _global, but only at first iteration... + if ( depth > 0 ) { IF_VERBOSE_ASCODING_ERRORS( @@ -674,7 +676,11 @@ return NULL; } - if ( ! VM::get().getGlobal()->get_member(subpart.c_str(), &tmp) ) + if ( subpart == "this" ) + { + tmp.set_as_object(m_target); + } + else if ( ! VM::get().getGlobal()->get_member(subpart.c_str(), &tmp) ) { IF_VERBOSE_ASCODING_ERRORS( log_aserror(_("Element '%s' of variable '%s' not found in object %p nor in _global (dotsyntax)"), @@ -811,7 +817,8 @@ // TODO: make sure sprite_instances know about ".." if ( ! env->get_member(subpart.c_str(), &tmp) ) { - // Try _global, but only at first iteration... + // Try this and _global, but only at first iteration... + if ( depth > 0 ) { IF_VERBOSE_ASCODING_ERRORS( @@ -821,7 +828,12 @@ return NULL; } - if ( ! VM::get().getGlobal()->get_member(subpart.c_str(), &tmp) ) + if ( subpart == "this" ) + { + tmp.set_as_object(m_target); + } + + else if ( ! VM::get().getGlobal()->get_member(subpart.c_str(), &tmp) ) { IF_VERBOSE_ASCODING_ERRORS( log_aserror(_("Element '%s' of variable '%s' not found in object %p nor in _global (slashsyntax)"), Index: server/sprite_instance.cpp =================================================================== RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v retrieving revision 1.311 retrieving revision 1.312 diff -u -b -r1.311 -r1.312 --- server/sprite_instance.cpp 23 Aug 2007 16:50:56 -0000 1.311 +++ server/sprite_instance.cpp 24 Aug 2007 10:05:57 -0000 1.312 @@ -1777,6 +1777,10 @@ bool sprite_instance::get_member(const std::string& name, as_value* val) { // FIXME: use addProperty interface for these !! + // TODO: or at least have a character:: protected method take + // care of these ? + // Duplicates code in character::get_relative_target_common too.. + // if ( name == "_root" ) { // TODO: handle lockroot @@ -1797,11 +1801,13 @@ return false; } } +#if 0 // see MovieClip.as if ( name == "this" ) { val->set_as_object( this ); return true; } +#endif // Try variables. if ( m_as_environment.get_member(name, val) ) Index: testsuite/actionscript.all/MovieClip.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/actionscript.all/MovieClip.as,v retrieving revision 1.80 retrieving revision 1.81 diff -u -b -r1.80 -r1.81 --- testsuite/actionscript.all/MovieClip.as 22 Aug 2007 14:29:29 -0000 1.80 +++ testsuite/actionscript.all/MovieClip.as 24 Aug 2007 10:05:58 -0000 1.81 @@ -20,7 +20,7 @@ // compile this test case with Ming makeswf, and then // execute it like this gnash -1 -r 0 -v out.swf -rcsid="$Id: MovieClip.as,v 1.80 2007/08/22 14:29:29 strk Exp $"; +rcsid="$Id: MovieClip.as,v 1.81 2007/08/24 10:05:58 strk Exp $"; #include "check.as" @@ -40,6 +40,9 @@ check_equals(typeof(this), 'movieclip'); check_equals(typeof(_parent), 'undefined'); check_equals(_root, this); +check_equals(typeof(this['_root']), 'movieclip'); +check_equals(typeof(this['_level0']), 'movieclip'); +check_equals(typeof(this['this']), 'undefined'); // Check inheritance check(MovieClip); Index: testsuite/actionscript.all/delete.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/actionscript.all/delete.as,v retrieving revision 1.10 retrieving revision 1.11 diff -u -b -r1.10 -r1.11 --- testsuite/actionscript.all/delete.as 24 Apr 2007 20:38:26 -0000 1.10 +++ testsuite/actionscript.all/delete.as 24 Aug 2007 10:05:58 -0000 1.11 @@ -1,4 +1,4 @@ -rcsid="$Id: delete.as,v 1.10 2007/04/24 20:38:26 strk Exp $"; +rcsid="$Id: delete.as,v 1.11 2007/08/24 10:05:58 strk Exp $"; #include "check.as" @@ -71,3 +71,6 @@ check(!delete unexistent.a); // TODO: try other malformed ActionDelete calls + +// TODO: test deletion of variables referenced by path (slash-based or dot-based) +// make sure to test use of 'this' here too ! Index: testsuite/actionscript.all/getvariable.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/actionscript.all/getvariable.as,v retrieving revision 1.13 retrieving revision 1.14 diff -u -b -r1.13 -r1.14 --- testsuite/actionscript.all/getvariable.as 1 Jul 2007 10:54:42 -0000 1.13 +++ testsuite/actionscript.all/getvariable.as 24 Aug 2007 10:05:58 -0000 1.14 @@ -19,7 +19,7 @@ // compile this test case with Ming makeswf, and then // execute it like this gnash -1 -r 0 -v out.swf -rcsid="$Id: getvariable.as,v 1.13 2007/07/01 10:54:42 bjacques Exp $"; +rcsid="$Id: getvariable.as,v 1.14 2007/08/24 10:05:58 strk Exp $"; #include "check.as" @@ -281,6 +281,20 @@ check_equals(objmemb, 3); //----------------------------------------------------------------------- +// Check 'this/:member' access (and deletion) +//----------------------------------------------------------------------- + +var memb = 6; +asm { + push 'thismemb' + push 'this/:memb' + getvariable + setvariable +}; +check_equals(memb, 6); +check_equals(thismemb, 6); + +//----------------------------------------------------------------------- // Check 'invalid/name' access // ('invalid/name' used as a variable name) //----------------------------------------------------------------------- _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit