gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] [SCM] Gnash branch, master, updated. 6d8de5bb11616820641f


From: Sandro Santilli
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. 6d8de5bb11616820641f6d9bd105ff6a8a28eaec
Date: Thu, 14 Oct 2010 18:28:50 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  6d8de5bb11616820641f6d9bd105ff6a8a28eaec (commit)
       via  f5a473236dd8d1b20b72758b88ae18b3f69053a9 (commit)
      from  3883534a606e06fa70b5d73fb59fb46ee8caf221 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=6d8de5bb11616820641f6d9bd105ff6a8a28eaec


commit 6d8de5bb11616820641f6d9bd105ff6a8a28eaec
Author: Sandro Santilli <address@hidden>
Date:   Thu Oct 14 20:28:36 2010 +0200

    Test the _objectToXML can take any number of arguments

diff --git a/testsuite/actionscript.all/ExternalInterface.as 
b/testsuite/actionscript.all/ExternalInterface.as
index e295a8e..9d7c6be 100644
--- a/testsuite/actionscript.all/ExternalInterface.as
+++ b/testsuite/actionscript.all/ExternalInterface.as
@@ -193,6 +193,9 @@ check_equals (xml, '<object></object>');
 xml = EI._objectToXML(o);
 check_equals (xml, '<object><property 
id="a"><number>1</number></property><property 
id="b"><string>string</string></property></object>');
 
+xml = EI._objectToXML(o, 1, 2, 3);
+xcheck_equals (xml, '<object><property 
id="a"><number>1</number></property><property 
id="b"><string>string</string></property></object>');
+
 xml = EI._objectToXML(undefined);
 check_equals (xml, '<object></object>');
 
@@ -202,6 +205,9 @@ check_equals (xml, '<object></object>');
 xml = EI._objectToXML(6);
 check_equals (xml, '<object></object>');
 
+xml = EI._objectToXML();
+xcheck_equals (xml, '<object></object>');
+
 // An Array
 anArray = [ 12, "tr", 1 ];
 anArray.length = 4;
@@ -293,6 +299,6 @@ xcheck_equals (typeOf(val), 'object');
 #elif OUTPUT_VERSION < 8 // }{
        check_totals(49);
 #else // SWF8+ }{
-       check_totals(97);
+       check_totals(99);
 # endif // }
 

http://git.savannah.gnu.org/cgit//commit/?id=f5a473236dd8d1b20b72758b88ae18b3f69053a9


commit f5a473236dd8d1b20b72758b88ae18b3f69053a9
Author: Sandro Santilli <address@hidden>
Date:   Thu Oct 14 20:21:19 2010 +0200

    Fix implementation of ExternalInterface._argumentsToXML

diff --git a/libcore/asobj/flash/external/ExternalInterface_as.cpp 
b/libcore/asobj/flash/external/ExternalInterface_as.cpp
index 036ad23..af9d46a 100644
--- a/libcore/asobj/flash/external/ExternalInterface_as.cpp
+++ b/libcore/asobj/flash/external/ExternalInterface_as.cpp
@@ -418,30 +418,28 @@ externalinterface_uArgumentsToXML(const fn_call& fn)
 
     std::stringstream ss;
     
-    if (fn.nargs == 2) {
-        std::vector<as_value> args;
-        if (fn.arg(0).is_object()) {
-            as_object *obj = toObject(fn.arg(0), getVM(fn));
-            VM& vm = getVM(*obj);    
-            PropsSerializer props(vm);
-            obj->visitProperties<IsEnumerable>(props);
-            if (!props.success()) {
-                log_error("Could not serialize object");
-                return false;
-            }
-            args = props.getArgs();
-            // For some reason the pp drops the first element of the array,
-            // so we do too.
-            args.erase(args.begin());
-        } else {
-            for (size_t i=0; i<fn.nargs; i++) {
-                args.push_back(fn.arg(i));
+    std::vector<as_value> args;
+    VM& vm = getVM(fn);
+    string_table& st = vm.getStringTable();
+
+    if (fn.nargs) {
+        // This is an ActionScript-like implementation, which is why it looks
+        // like poor C++.
+        as_object* obj = fn.arg(0).to_object(vm);
+        if ( obj ) {
+            const int length = toInt(getMember(*obj, NSV::PROP_LENGTH), vm);
+            int i = 1;
+            while (i < length) {
+                std::ostringstream s;
+                s << i;
+                as_value el = getMember(*obj, st.find(s.str()));
+                args.push_back(el);
+                ++i;
             }
         }
-        return ExternalInterface::argumentsToXML(args);
     }
-    
-    return as_value();
+
+    return ExternalInterface::argumentsToXML(args);
 }
 
 as_value
diff --git a/testsuite/actionscript.all/ExternalInterface.as 
b/testsuite/actionscript.all/ExternalInterface.as
index ff9d290..e295a8e 100644
--- a/testsuite/actionscript.all/ExternalInterface.as
+++ b/testsuite/actionscript.all/ExternalInterface.as
@@ -212,17 +212,17 @@ check_equals (xml,
 );
 
 xml = EI._argumentsToXML(anArray);
-xcheck_equals (xml, 
+check_equals (xml, 
 '<arguments><string>tr</string><number>1</number><undefined/></arguments>'
 );
 xml = EI._argumentsToXML();
-xcheck_equals (xml, '<arguments></arguments>');
+check_equals (xml, '<arguments></arguments>');
 xml = EI._argumentsToXML(['single']);
-xcheck_equals (xml, '<arguments></arguments>');
+check_equals (xml, '<arguments></arguments>');
 xml = EI._argumentsToXML('one');
-xcheck_equals (xml, '<arguments><undefined/><undefined/></arguments>');
+check_equals (xml, '<arguments><undefined/><undefined/></arguments>');
 xml = EI._argumentsToXML(1,2,3);
-xcheck_equals (xml, '<arguments></arguments>');
+check_equals (xml, '<arguments></arguments>');
 
 // xml = EI._toXML(o);
 // if (xml == '<object><property id="a"><number>1</number></property><property 
id="b"><string>string</string></property></object>') {

-----------------------------------------------------------------------

Summary of changes:
 .../asobj/flash/external/ExternalInterface_as.cpp  |   40 +++++++++----------
 testsuite/actionscript.all/ExternalInterface.as    |   18 ++++++---
 2 files changed, 31 insertions(+), 27 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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