gnash-commit
[Top][All Lists]
Advanced

[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: Wed, 26 Sep 2007 14:44:16 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/09/26 14:44:16

Modified files:
        .              : ChangeLog 
        server         : as_value.cpp 
        testsuite/actionscript.all: Function.as Inheritance.as Object.as 
                                    toString_valueOf.as 

Log message:
                * server/as_value.cpp (equals): in SWF5, functions are
                  considered null types for what concerns equality.
                * testsuite/actionscript.all/: Function.as,
                  Inheritance.as, Object.as, toString_valueOf.as:
                  new successes.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4424&r2=1.4425
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.76&r2=1.77
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Function.as?cvsroot=gnash&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Inheritance.as?cvsroot=gnash&r1=1.41&r2=1.42
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Object.as?cvsroot=gnash&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/toString_valueOf.as?cvsroot=gnash&r1=1.14&r2=1.15

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4424
retrieving revision 1.4425
diff -u -b -r1.4424 -r1.4425
--- ChangeLog   26 Sep 2007 12:54:17 -0000      1.4424
+++ ChangeLog   26 Sep 2007 14:44:15 -0000      1.4425
@@ -1,5 +1,13 @@
 2007-09-26 Sandro Santilli <address@hidden>
 
+       * server/as_value.cpp (equals): in SWF5, functions are
+         considered null types for what concerns equality.
+       * testsuite/actionscript.all/: Function.as,
+         Inheritance.as, Object.as, toString_valueOf.as: 
+         new successes.
+
+2007-09-26 Sandro Santilli <address@hidden>
+
        * server/as_environment.cpp (dump_global_registers): better
          presentation for global registers.
 

Index: server/as_value.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.cpp,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -b -r1.76 -r1.77
--- server/as_value.cpp 23 Sep 2007 08:48:17 -0000      1.76
+++ server/as_value.cpp 26 Sep 2007 14:44:16 -0000      1.77
@@ -680,10 +680,25 @@
     log_debug("equals(%s, %s) called [%d]", to_debug_string().c_str(), 
v.to_debug_string().c_str(), count++);
 #endif
 
+    int SWFVersion = env.get_version();
+
     bool this_nulltype = (m_type == UNDEFINED || m_type == NULLTYPE);
     bool v_nulltype = (v.get_type() == UNDEFINED || v.get_type() == NULLTYPE);
+
+    // It seems like functions are considered the same as a NULL type
+    // in SWF5 (and I hope below, didn't check)
+    //
+    if ( SWFVersion < 6 )
+    {
+        if ( m_type == AS_FUNCTION ) this_nulltype = true;
+        if ( v.m_type == AS_FUNCTION ) v_nulltype = true;
+    }
+
     if (this_nulltype || v_nulltype)
     {
+#ifdef GNASH_DEBUG_EQUALITY
+       log_debug(" on of the two things is undefined or null");
+#endif
         return this_nulltype == v_nulltype;
     }
 
@@ -696,7 +711,7 @@
 
     // 16. If Type(x) is Number and Type(y) is String,
     //    return the result of the comparison x == ToNumber(y).
-    else if (m_type == NUMBER && v.m_type == STRING)
+    if (m_type == NUMBER && v.m_type == STRING)
     {
        double n = v.to_number(&env); // no need for the env actually
        if ( ! isfinite(n) ) return false;
@@ -705,7 +720,7 @@
 
     // 17. If Type(x) is String and Type(y) is Number,
     //     return the result of the comparison ToNumber(x) == y.
-    else if (v.m_type == NUMBER && m_type == STRING)
+    if (v.m_type == NUMBER && m_type == STRING)
     {
        double n = to_number(&env); // no need for the env actually
        if ( ! isfinite(n) ) return false;
@@ -713,20 +728,20 @@
     }
 
     // 18. If Type(x) is Boolean, return the result of the comparison 
ToNumber(x) == y.
-    else if (m_type == BOOLEAN)
+    if (m_type == BOOLEAN)
     {
         return as_value(to_number(&env)).equals(v, env); // m_boolean_value == 
v.to_bool();
     }
 
     // 19. If Type(y) is Boolean, return the result of the comparison x == 
ToNumber(y).
-    else if (v.m_type == BOOLEAN)
+    if (v.m_type == BOOLEAN)
     {
         return as_value(v.to_number(&env)).equals(*this, env); 
     }
 
     // 20. If Type(x) is either String or Number and Type(y) is Object,
     //     return the result of the comparison x == ToPrimitive(y).
-    else if ( (m_type == STRING || m_type == NUMBER ) && ( v.is_object() ) ) 
// v.m_type == OBJECT || v.m_type == AS_FUNCTION ) )
+    if ( (m_type == STRING || m_type == NUMBER ) && ( v.is_object() ) ) // 
v.m_type == OBJECT || v.m_type == AS_FUNCTION ) )
     {
         // convert this value to a primitive and recurse
         as_value v2 = v.to_primitive(env); 
@@ -742,7 +757,7 @@
 
     // 21. If Type(x) is Object and Type(y) is either String or Number,
     //    return the result of the comparison ToPrimitive(x) == y.
-    else if ( (v.m_type == STRING || v.m_type == NUMBER ) && ( is_object() ) ) 
// m_type == OBJECT || m_type == AS_FUNCTION ) )
+    if ( (v.m_type == STRING || v.m_type == NUMBER ) && ( is_object() ) ) // 
m_type == OBJECT || m_type == AS_FUNCTION ) )
     {
         // convert this value to a primitive and recurse
         as_value v2 = to_primitive(env); 

Index: testsuite/actionscript.all/Function.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Function.as,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- testsuite/actionscript.all/Function.as      11 Sep 2007 05:46:31 -0000      
1.55
+++ testsuite/actionscript.all/Function.as      26 Sep 2007 14:44:16 -0000      
1.56
@@ -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: Function.as,v 1.55 2007/09/11 05:46:31 zoulunkai Exp $";
+rcsid="$Id: Function.as,v 1.56 2007/09/26 14:44:16 strk Exp $";
 
 #include "check.as"
 
@@ -38,8 +38,14 @@
 #if OUTPUT_VERSION >=6 
  check (getThisName != undefined);
 #else
- // this might be due to forced numerical comparison
- xcheck_equals (getThisName, undefined);
+ // this might be due to forced string comparison ?
+ check_equals (getThisName, undefined);
+ check_equals (getThisName, null);
+ check (getThisName != 0);
+ check (getThisName != 1);
+ check (! isNaN(getThisName) );
+ check (getThisName != "");
+ check (getThisName != "[type Function]");
 #endif
 check_equals ( typeof(getThisName), "function" );
 

Index: testsuite/actionscript.all/Inheritance.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Inheritance.as,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -b -r1.41 -r1.42
--- testsuite/actionscript.all/Inheritance.as   12 Sep 2007 17:15:11 -0000      
1.41
+++ testsuite/actionscript.all/Inheritance.as   26 Sep 2007 14:44:16 -0000      
1.42
@@ -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: Inheritance.as,v 1.41 2007/09/12 17:15:11 strk Exp $";
+rcsid="$Id: Inheritance.as,v 1.42 2007/09/26 14:44:16 strk Exp $";
 
 #include "check.as"
 
@@ -133,7 +133,7 @@
 #if OUTPUT_VERSION > 5
 check_equals(o1.__constructor__, TypeChanger);
 #else
-xcheck_equals(o1.__constructor__, TypeChanger);
+check_equals(o1.__constructor__, TypeChanger);
 #endif
 check(o1 instanceof TypeChanger);
 check(o1 instanceof Object);

Index: testsuite/actionscript.all/Object.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Object.as,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- testsuite/actionscript.all/Object.as        2 Sep 2007 00:12:48 -0000       
1.33
+++ testsuite/actionscript.all/Object.as        26 Sep 2007 14:44:16 -0000      
1.34
@@ -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: Object.as,v 1.33 2007/09/02 00:12:48 strk Exp $";
+rcsid="$Id: Object.as,v 1.34 2007/09/26 14:44:16 strk Exp $";
 
 #include "check.as"
 
@@ -51,7 +51,11 @@
  check(!Object.prototype.hasOwnProperty("__proto__"));
 #endif 
 
-xcheck_equals(Object.prototype.registerClass, undefined);
+#if OUTPUT_VERSION < 6
+ check_equals(Object.prototype.registerClass, undefined);
+#else
+ xcheck_equals(Object.prototype.registerClass, undefined);
+#endif
 
 #if OUTPUT_VERSION > 5
 
@@ -127,7 +131,7 @@
 
 #if OUTPUT_VERSION == 5
 // Gnash fails on swf5 but succeeds on swf6,7,8
-xcheck(obj.__constructor__ == Object);
+check(obj.__constructor__ == Object);
 #else
 check(obj.__constructor__ == Object);
 #endif

Index: testsuite/actionscript.all/toString_valueOf.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/toString_valueOf.as,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- testsuite/actionscript.all/toString_valueOf.as      11 Sep 2007 05:58:54 
-0000      1.14
+++ testsuite/actionscript.all/toString_valueOf.as      26 Sep 2007 14:44:16 
-0000      1.15
@@ -71,8 +71,8 @@
   check_equals(typeof(Object.prototype['valueOf']), 'function');
   // this is true because Function object in swf5 does not 
   // support toString and valueOf.
-  xcheck_equals(Object.prototype.toString, undefined);
-  xcheck_equals(Object.prototype.valueOf,  undefined);
+  check_equals(Object.prototype.toString, undefined);
+  check_equals(Object.prototype.valueOf,  undefined);
 #endif
 
 obj = new Object();
@@ -96,11 +96,11 @@
   check(obj.valueOf != Object.prototype.valueOf);
 #else
   // this is true only in swf5 (any function is equal to any other in SWF5)
-  xcheck(obj.toString == undefined);
-  xcheck(obj.valueOf == undefined);
-  xcheck(obj.toString == obj.valueOf);
-  xcheck(Object.prototype.toString == undefined);
-  xcheck(Object.prototype.valueOf == undefined);
+  check(obj.toString == undefined);
+  check(obj.valueOf == undefined);
+  check(obj.toString == obj.valueOf);
+  check(Object.prototype.toString == undefined);
+  check(Object.prototype.valueOf == undefined);
 #endif
 x = obj.toString();
 y = obj.valueOf();
@@ -122,8 +122,8 @@
   check(Number.prototype.valueOf != Object.prototype.valueOf);
 #else
   // this is true only in swf5
-  xcheck(Number.prototype.toString == undefined);
-  xcheck(Number.prototype.valueOf == undefined);
+  check(Number.prototype.toString == undefined);
+  check(Number.prototype.valueOf == undefined);
 #endif
 
 
@@ -162,8 +162,8 @@
   check(String.prototype.valueOf != Object.prototype.valueOf);
 #else
   // this is true only in swf5
-  xcheck(String.prototype.toString == undefined);
-  xcheck(String.prototype.valueOf == undefined);
+  check(String.prototype.toString == undefined);
+  check(String.prototype.valueOf == undefined);
 #endif
 
 str1 = new String("10");
@@ -314,11 +314,14 @@
 xcheck(typeof(Button.prototype.valueOf) == 'function' );
 
 // For Buttons, this true from swf5~swf8!
-xcheck(Button.prototype.toString == Object.prototype.toString);
-xcheck(Button.prototype.valueOf == Object.prototype.valueOf);
-#if OUTPUT_VERSION == 5
-check_equals(Button.prototype.toString, undefined);
-check_equals(Button.prototype.valueOf, undefined);
+#if OUTPUT_VERSION < 6
+ check(Button.prototype.toString == Object.prototype.toString);
+ check(Button.prototype.valueOf == Object.prototype.valueOf);
+ check_equals(Button.prototype.toString, undefined);
+ check_equals(Button.prototype.valueOf, undefined);
+#else
+ xcheck(Button.prototype.toString == Object.prototype.toString);
+ xcheck(Button.prototype.valueOf == Object.prototype.valueOf);
 #endif
 
 btn1 = new Button();
@@ -342,8 +345,8 @@
   check(Boolean.prototype.toString != Object.prototype.toString);
   check(Boolean.prototype.valueOf != Object.prototype.valueOf);
 #else
-  xcheck(Boolean.prototype.toString == undefined);
-  xcheck(Boolean.prototype.valueOf == undefined);
+  check(Boolean.prototype.toString == undefined);
+  check(Boolean.prototype.valueOf == undefined);
 #endif
 
 b1 = new Boolean(false);
@@ -370,8 +373,8 @@
   check(Date.prototype.toString != Object.prototype.toString);
   check(Date.prototype.valueOf != Object.prototype.valueOf);
 #else
-  xcheck(Date.prototype.toString == undefined);
-  xcheck(Date.prototype.valueOf == undefined);
+  check(Date.prototype.toString == undefined);
+  check(Date.prototype.valueOf == undefined);
 #endif
 
 d1 = new Date(0);
@@ -409,7 +412,7 @@
   check(!Array.prototype.hasOwnProperty('valueOf'));
   check(Array.prototype.toString != Object.prototype.toString);
 #else
-  xcheck(Array.prototype.toString == undefined);
+  check(Array.prototype.toString == undefined);
 #endif
 
 check(Array.prototype.valueOf == Object.prototype.valueOf);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]