[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/as_value.cpp testsuite/a...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/as_value.cpp testsuite/a... |
Date: |
Thu, 26 Apr 2007 09:53:01 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/04/26 09:53:01
Modified files:
. : ChangeLog
server : as_value.cpp
testsuite/actionscript.all: Function.as
Log message:
* server/as_value.cpp (equals): don't abort on
object==movieclip !
* testsuite/actionscript.all/Function.as: add more tests 'this'
reference in 'with' and 'function' scope (see bug #19704).
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2998&r2=1.2999
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Function.as?cvsroot=gnash&r1=1.39&r2=1.40
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2998
retrieving revision 1.2999
diff -u -b -r1.2998 -r1.2999
--- ChangeLog 26 Apr 2007 07:00:29 -0000 1.2998
+++ ChangeLog 26 Apr 2007 09:53:00 -0000 1.2999
@@ -1,5 +1,11 @@
2007-04-26 Sandro Santilli <address@hidden>
+ * server/as_value.cpp (equals): don't abort on object==movieclip !
+ * testsuite/actionscript.all/Function.as: add more tests 'this'
+ reference in 'with' and 'function' scope (see bug #19704).
+
+2007-04-26 Sandro Santilli <address@hidden>
+
* server/array.h, server/as_environment.cpp, server/as_function.h,
server/as_object.cpp, server/as_object.h, server/character.cpp,
server/character.h, server/edit_text_character.cpp,
Index: server/as_value.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- server/as_value.cpp 19 Apr 2007 18:58:45 -0000 1.44
+++ server/as_value.cpp 26 Apr 2007 09:53:01 -0000 1.45
@@ -633,7 +633,11 @@
return this_nulltype == v_nulltype;
}
+ bool obj_or_func = (m_type == OBJECT || m_type == AS_FUNCTION);
+ bool v_obj_or_func = (v.m_type == OBJECT || v.m_type == AS_FUNCTION);
+
/// Compare to same type
+ if ( obj_or_func && v_obj_or_func ) return equalsSameType(v);
if ( m_type == v.m_type ) return equalsSameType(v);
else if (m_type == STRING)
@@ -653,7 +657,16 @@
else if (m_type == BOOLEAN)
{
return m_boolean_value == v.to_bool();
+ }
+ else if (m_type == MOVIECLIP || v.m_type == MOVIECLIP)
+ {
+ // if both are movieclips they should be compared by same value
+ // (see top of this function).
+ // In any other case we always return false.
+ // TODO: check if it's allowed that the primitive value
+ // of an object is a movieclip (maybe with an ActionScript
hack...)
+ return false;
}
else if (is_object())
Index: testsuite/actionscript.all/Function.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Function.as,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- testsuite/actionscript.all/Function.as 21 Mar 2007 14:37:20 -0000
1.39
+++ testsuite/actionscript.all/Function.as 26 Apr 2007 09:53:01 -0000
1.40
@@ -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: Function.as,v 1.39 2007/03/21 14:37:20 strk Exp $";
+rcsid="$Id: Function.as,v 1.40 2007/04/26 09:53:01 strk Exp $";
#include "check.as"
@@ -581,3 +581,61 @@
check_equals(myMail.to, undefined);
check_equals(myMail.message, undefined);
#endif
+
+//-----------------------------------------------------
+// Test the 'this' reference
+//-----------------------------------------------------
+
+getThis = function() { return this; };
+
+check_equals(getThis(), this);
+
+o = new Object;
+o.getThis = getThis;
+check_equals(o.getThis(), o);
+
+o.sub = new Object;
+o.sub.getThis = getThis;
+
+ret = o.sub.getThis();
+check_equals(typeof(ret), 'object');
+check_equals(ret, o.sub);
+
+
+with(o) {
+ with(sub) {
+ ret = getThis();
+ check_equals(typeof(ret), 'object');
+ check_equals(ret, o.sub);
+ }
+
+ ret = getThis();
+ check_equals(typeof(ret), 'object');
+ check_equals(ret, o);
+
+ ret = sub.getThis();
+ check_equals(typeof(ret), 'object');
+ check_equals(ret, sub);
+}
+
+check(delete o.sub.getThis);
+
+with(o) {
+ with (sub) {
+ ret = getThis();
+ check_equals(typeof(ret), 'object');
+ xcheck_equals(getThis(), o);
+ }
+}
+
+function testInFunctionContext(o)
+{
+ with(o) {
+ // see bug #19704
+ ret = getThis();
+ xcheck_equals(typeof(ret), 'object');
+ xcheck_equals(ret, o);
+ }
+}
+
+testInFunctionContext(o);