gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r10099: Test property enumeration. G


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r10099: Test property enumeration. Gnash is wrong. LoadVars.toString() (and similar
Date: Sat, 25 Oct 2008 18:13:26 +0200
User-agent: Bazaar (1.5)

------------------------------------------------------------
revno: 10099
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Sat 2008-10-25 18:13:26 +0200
message:
  Test property enumeration. Gnash is wrong. LoadVars.toString() (and similar
  methods) rely on this.
  
  Add comment to FsCommand2 opcode.
modified:
  libcore/vm/ASHandlers.cpp
  testsuite/actionscript.all/enumerate.as
=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2008-10-25 10:38:32 +0000
+++ b/libcore/vm/ASHandlers.cpp 2008-10-25 16:13:26 +0000
@@ -1474,6 +1474,9 @@
     }
 }
 
+/// FsCommand2 is not part of the Flash spec. It belongs to
+/// Flash Lite (from 1.1 onwards) and is used to control
+/// devices (backlight, vibrate etc).
 void
 SWFHandlers::ActionFscommand2(ActionExec& thread)
 {
@@ -1486,7 +1489,6 @@
     as_environment& env = thread.env;
 
     unsigned int off=0;
-
     
     const unsigned int nargs = env.top(off++).to_int();
 
@@ -1521,8 +1523,6 @@
     
     as_environment& env = thread.env;
 
-    
-
     int max = env.top(0).to_int();
 
     if (max < 1) max = 1;
@@ -1837,8 +1837,6 @@
         // No need to return - it works a bit.
     }
 
-    
-
     const std::string s = env.top(0).to_string();
     
     std::string::const_iterator it = s.begin(), e = s.end();
@@ -1865,8 +1863,6 @@
         // No need to return.
     }
 
-    
-
     // Cut to uint16, as characters above 65535 'wrap around'
     const boost::uint16_t i = static_cast<boost::uint16_t> 
(env.top(0).to_int());
     

=== modified file 'testsuite/actionscript.all/enumerate.as'
--- a/testsuite/actionscript.all/enumerate.as   2008-03-11 19:31:46 +0000
+++ b/testsuite/actionscript.all/enumerate.as   2008-10-25 16:13:26 +0000
@@ -98,5 +98,58 @@
   delete recorder;
 }
 
+enumerateObj = function(object) {
+   list = ""; 
+    for (el in o) {
+        list += el + ",";
+    }
+    return list;
+};
+
+/// Try different enumerations.
+{
+    list = "";
+    o = {};
+
+    o.a = 3;
+    check_equals(enumerateObj(o), "a,");
+
+    o.b = "string";
+    check_equals(enumerateObj(o), "b,a,");
+
+    o["el"] = 5;
+    check_equals(enumerateObj(o), "el,b,a,");
+    
+    o[8] = new Date();
+    check_equals(enumerateObj(o), "8,el,b,a,");
+    
+    o.b = 8;
+    check_equals(enumerateObj(o), "8,el,b,a,");
+
+    delete o.b;
+    check_equals(enumerateObj(o), "8,el,a,");
+
+    o.b = "string again";
+    xcheck_equals(enumerateObj(o), "b,8,el,a,");
+
+    r = o.u;
+    xcheck_equals(enumerateObj(o), "b,8,el,a,");
+
+    t = {};
+    o[t] = 9;
+    xcheck_equals(enumerateObj(o), "[object Object],b,8,el,a,");
+
+    delete o["8"];
+    xcheck_equals(enumerateObj(o), "[object Object],b,el,a,");
+
+    o.c = Object.prototype.toString;
+    xcheck_equals(enumerateObj(o), "c,[object Object],b,el,a,");
+    
+
+}
+totals(29);
+#else
+totals(0);
 #endif  // OUTPUT_VERSION > 5
-totals();
+
+


reply via email to

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