[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp test...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp test... |
Date: |
Fri, 11 Jan 2008 11:42:45 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 08/01/11 11:42:44
Modified files:
. : ChangeLog
server : sprite_instance.cpp
testsuite/actionscript.all: MovieClip.as
Log message:
Fix the MovieClip.meth() method to invoke toLowerString on first
argument.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5377&r2=1.5378
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.438&r2=1.439
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/MovieClip.as?cvsroot=gnash&r1=1.112&r2=1.113
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5377
retrieving revision 1.5378
diff -u -b -r1.5377 -r1.5378
--- ChangeLog 11 Jan 2008 11:08:49 -0000 1.5377
+++ ChangeLog 11 Jan 2008 11:42:43 -0000 1.5378
@@ -1,5 +1,12 @@
2008-01-11 Sandro Santilli <address@hidden>
+ * server/sprite_instance.cpp: fix the MovieClip.meth() method
+ to invoke toLowerString on first argument.
+ * testsuite/actionscript.all/MovieClip.as: test that meth()
+ should invoke toLowerString on first argument.
+
+2008-01-11 Sandro Santilli <address@hidden>
+
* server/asobj/LoadVars.cpp: rewrite the whole class.
* testsuite/actionscript.all/LoadVars.as: no more failures for SWF6+
(the remaining ones are for availability of the LoadVars in SWF5,
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.438
retrieving revision 1.439
diff -u -b -r1.438 -r1.439
--- server/sprite_instance.cpp 11 Jan 2008 00:01:34 -0000 1.438
+++ server/sprite_instance.cpp 11 Jan 2008 11:42:44 -0000 1.439
@@ -886,11 +886,25 @@
{
boost::intrusive_ptr<sprite_instance> sprite =
ensureType<sprite_instance>(fn.this_ptr);
- if ( ! fn.nargs ) return as_value(0);
- as_value& v = fn.arg(0);
- if ( ! v.is_string() ) return as_value(0);
- std::string s = v.to_string();
- boost::to_lower(s);
+ if ( ! fn.nargs ) return as_value(0); // optimization ...
+
+ as_value v = fn.arg(0);
+ boost::intrusive_ptr<as_object> o = v.to_object();
+ if ( ! o )
+ {
+ log_debug("meth(%s): first argument doesn't cast to object",
v.to_debug_string().c_str());
+ return as_value(0);
+ }
+
+ string_table& st = sprite->getVM().getStringTable();
+ as_value lc = o->callMethod(st.find(PROPNAME("toLowerCase")));
+
+ log_debug("after call to toLowerCase with arg %s we got %s",
v.to_debug_string().c_str(), lc.to_debug_string().c_str());
+
+ //if ( ! v.is_string() ) return as_value(0);
+ std::string s = lc.to_string();
+
+ //boost::to_lower(s);
if ( s == "get" ) return as_value(1);
if ( s == "post" ) return as_value(2);
return as_value(0);
Index: testsuite/actionscript.all/MovieClip.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/MovieClip.as,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -b -r1.112 -r1.113
--- testsuite/actionscript.all/MovieClip.as 8 Jan 2008 10:36:57 -0000
1.112
+++ testsuite/actionscript.all/MovieClip.as 11 Jan 2008 11:42:44 -0000
1.113
@@ -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.112 2008/01/08 10:36:57 strk Exp $";
+rcsid="$Id: MovieClip.as,v 1.113 2008/01/11 11:42:44 strk Exp $";
#include "check.as"
@@ -1308,6 +1308,11 @@
check_equals(typeof(ret), 'number');
check_equals(ret, 0);
+Number.prototype.toLowerCase = function() { return "post"; };
+ret = _root.meth(1);
+check_equals(typeof(ret), 'number');
+check_equals(ret, 2);
+
ret = _root.meth('post');
check_equals(typeof(ret), 'number');
check_equals(ret, 2);
@@ -1337,17 +1342,22 @@
check_equals(typeof(ret), 'number');
check_equals(ret, 0);
+o.toLowerCase = function() { return "get"; };
+ret = _root.meth(o);
+check_equals(typeof(ret), 'number');
+check_equals(ret, 1);
+
#if OUTPUT_VERSION < 6
- check_totals(185); // SWF5
+ check_totals(189); // SWF5
#else
#if OUTPUT_VERSION < 7
- check_totals(581); // SWF6
+ check_totals(585); // SWF6
#else
#if OUTPUT_VERSION < 8
- check_totals(598); // SWF7
+ check_totals(602); // SWF7
#else
- check_totals(599); // SWF8+
+ check_totals(603); // SWF8+
#endif
#endif
#endif