[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. 7da1d906f4057c897c1c
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. 7da1d906f4057c897c1ccb220402d450292644f9 |
Date: |
Thu, 14 Oct 2010 16:34:18 +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 7da1d906f4057c897c1ccb220402d450292644f9 (commit)
from cd355522902bd457486043a4e4f491e9532e8c17 (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=7da1d906f4057c897c1ccb220402d450292644f9
commit 7da1d906f4057c897c1ccb220402d450292644f9
Author: Sandro Santilli <address@hidden>
Date: Thu Oct 14 18:33:49 2010 +0200
Add support in PropSerializer for returning XML of properties in revere
order. Fixes a test in actionscript.all/ExternalInterface.as
diff --git a/libcore/ExternalInterface.cpp b/libcore/ExternalInterface.cpp
index 9d4813b..0427fb4 100644
--- a/libcore/ExternalInterface.cpp
+++ b/libcore/ExternalInterface.cpp
@@ -58,14 +58,10 @@ class PropsSerializer : public AbstractPropertyVisitor
public:
PropsSerializer(VM& vm)
- : _st(vm.getStringTable()),
- _error(false)
+ : _st(vm.getStringTable())
{ /* do nothing */}
- bool success() const { return !_error; }
-
bool accept(const ObjectURI& uri, const as_value& val) {
- if (_error) return true;
const string_table::key key = getName(uri);
@@ -80,23 +76,43 @@ public:
// log_debug(" serializing property %s", id);
- _xml << "<property id=\"" << id << "\">";
- _xml << ExternalInterface::toXML(val);
- _xml << "</property>";
+ std::stringstream xml;
+ xml << "<property id=\"" << id << "\">";
+ xml << ExternalInterface::toXML(val);
+ xml << "</property>";
- _noprops.push_back(val);
+ _propsxml.push_back(xml.str());
return true;
}
- std::string getXML() { return _xml.str(); };
- std::vector<as_value> getArgs() { return _noprops; };
+ std::string getReverseXML() {
+ typedef std::vector<std::string> Strings;
+ std::stringstream xml;
+ for (Strings::const_reverse_iterator
+ i=_propsxml.rbegin(), e=_propsxml.rend();
+ i != e; ++i)
+ {
+ xml << *i;
+ }
+ return xml.str();
+ };
+
+ std::string getXML() {
+ typedef std::vector<std::string> Strings;
+ std::stringstream xml;
+ for (Strings::const_iterator
+ i=_propsxml.begin(), e=_propsxml.end();
+ i != e; ++i)
+ {
+ xml << *i;
+ }
+ return xml.str();
+ };
private:
string_table& _st;
- mutable bool _error;
- std::stringstream _xml;
- std::vector<as_value> _noprops;
+ std::vector<std::string> _propsxml;
};
}
@@ -131,11 +147,7 @@ ExternalInterface::objectToXML(as_object *obj)
// Get all the properties
PropsSerializer props(vm);
obj->visitProperties<IsEnumerable>(props);
- if (!props.success()) {
- log_error("Could not serialize object");
- } else {
- std::vector<as_value> properties = props.getArgs();
- }
+ ss << props.getReverseXML();
ss << "</object>";
return ss.str();
@@ -157,9 +169,6 @@ ExternalInterface::arrayToXML(as_object *obj)
ss << "<array>";
PropsSerializer props(vm);
obj->visitProperties<IsEnumerable>(props);
- if (!props.success()) {
- log_error("Could not serialize object");
- }
ss << props.getXML();
ss << "</array>";
diff --git a/testsuite/actionscript.all/ExternalInterface.as
b/testsuite/actionscript.all/ExternalInterface.as
index 6ae0cbd..e21dbed 100644
--- a/testsuite/actionscript.all/ExternalInterface.as
+++ b/testsuite/actionscript.all/ExternalInterface.as
@@ -194,7 +194,7 @@ xml = EI._objectToXML(nc);
check_equals (xml, '<object></object>');
xml = EI._objectToXML(o);
-xcheck_equals (xml, '<object><property
id="a"><number>1</number></property><property
id="b"><string>string</string></property></object>');
+check_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>');
-----------------------------------------------------------------------
Summary of changes:
libcore/ExternalInterface.cpp | 53 +++++++++++++---------
testsuite/actionscript.all/ExternalInterface.as | 2 +-
2 files changed, 32 insertions(+), 23 deletions(-)
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, master, updated. 7da1d906f4057c897c1ccb220402d450292644f9,
Sandro Santilli <=