[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. c2ae31249445ab2fcf33
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. c2ae31249445ab2fcf3325b9e323c99ad5ec3aba |
Date: |
Thu, 14 Oct 2010 16:56:57 +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 c2ae31249445ab2fcf3325b9e323c99ad5ec3aba (commit)
from 7da1d906f4057c897c1ccb220402d450292644f9 (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=c2ae31249445ab2fcf3325b9e323c99ad5ec3aba
commit c2ae31249445ab2fcf3325b9e323c99ad5ec3aba
Author: Sandro Santilli <address@hidden>
Date: Thu Oct 14 18:56:27 2010 +0200
Test that arrayToXML scans the array using length and checking properties
from 0 to length-1, fix that case. Arguments is still broken.
diff --git a/libcore/ExternalInterface.cpp b/libcore/ExternalInterface.cpp
index 0427fb4..fac2eef 100644
--- a/libcore/ExternalInterface.cpp
+++ b/libcore/ExternalInterface.cpp
@@ -160,17 +160,30 @@ ExternalInterface::arrayToXML(as_object *obj)
// GNASH_REPORT_FUNCTION;
std::stringstream ss;
if (obj == 0) {
- //log_error("Need a valid AS Object!");
+ // callers should check (we might just abort here)
+ log_error("Need a valid AS Object!");
return ss.str();
}
VM& vm = getVM(*obj);
+ string_table& st = vm.getStringTable();
ss << "<array>";
- PropsSerializer props(vm);
- obj->visitProperties<IsEnumerable>(props);
- ss << props.getXML();
-
+
+ // This is an ActionScript-like implementation, which is why it looks
+ // like poor C++.
+ const int length = toInt(getMember(*obj, NSV::PROP_LENGTH), vm);
+ int i = 0;
+ while (i < length) {
+ std::ostringstream s;
+ s << i;
+ as_value el = getMember(*obj, st.find(s.str()));
+ ss << "<property id=\"" << i << "\">"
+ << toXML(el)
+ << "</property>";
+ ++i;
+ }
+
ss << "</array>";
return ss.str();
diff --git a/testsuite/actionscript.all/ExternalInterface.as
b/testsuite/actionscript.all/ExternalInterface.as
index e21dbed..e0e6943 100644
--- a/testsuite/actionscript.all/ExternalInterface.as
+++ b/testsuite/actionscript.all/ExternalInterface.as
@@ -157,9 +157,6 @@ nc = Mouse;
// A native object
no = new XML;
-// An Array
-a = [ 12, 34, "tr", 1, 2, 3, 4 ];
-
// Try instantiating.
r = new EI;
// You get an object
@@ -205,11 +202,19 @@ check_equals (xml, '<object></object>');
xml = EI._objectToXML(6);
check_equals (xml, '<object></object>');
-xml = EI._arrayToXML(a);
-check_equals (xml, '<array><property
id="0"><number>12</number></property><property
id="1"><number>34</number></property><property
id="2"><string>tr</string></property><property
id="3"><number>1</number></property><property
id="4"><number>2</number></property><property
id="5"><number>3</number></property><property
id="6"><number>4</number></property></array>');
-
-xml = EI._argumentsToXML(a, 0);
-check_equals (xml,
'<arguments><number>34</number><string>tr</string><number>1</number><number>2</number><number>3</number><number>4</number></arguments>');
+// An Array
+anArray = [ 12, "tr", 1 ];
+anArray.length = 4;
+
+xml = EI._arrayToXML(anArray);
+check_equals (xml,
+'<array><property id="0"><number>12</number></property><property
id="1"><string>tr</string></property><property
id="2"><number>1</number></property><property
id="3"><undefined/></property></array>'
+);
+
+xml = EI._argumentsToXML(anArray, 0);
+xcheck_equals (xml,
+'<arguments><string>tr</string><number>1</number><undefined/></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:
libcore/ExternalInterface.cpp | 23 ++++++++++++++++++-----
testsuite/actionscript.all/ExternalInterface.as | 21 +++++++++++++--------
2 files changed, 31 insertions(+), 13 deletions(-)
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, master, updated. c2ae31249445ab2fcf3325b9e323c99ad5ec3aba,
Sandro Santilli <=