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. 1072f2a5e84feea7301b


From: Sandro Santilli
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. 1072f2a5e84feea7301bc072af8ad19a263e650e
Date: Fri, 15 Oct 2010 19:30:13 +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  1072f2a5e84feea7301bc072af8ad19a263e650e (commit)
       via  8dee7c06be4105b3dec25ce4c742cb3051cb67f1 (commit)
      from  1ad30624a91837d461cc196e552ecc3330e9f2e3 (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=1072f2a5e84feea7301bc072af8ad19a263e650e


commit 1072f2a5e84feea7301bc072af8ad19a263e650e
Author: Sandro Santilli <address@hidden>
Date:   Fri Oct 15 21:29:02 2010 +0200

    Deprecate enumeratePropertyKey version taking as_environment and provide 
one taking a vector of ObjectURI instead. Also change signature of the function 
scanning all properties for the purpose of building up string/string pairs to 
return string/as_value instead (this latter should probably also be deprecated)

diff --git a/libcore/DisplayObject.h b/libcore/DisplayObject.h
index 254d850..1ee0a9c 100644
--- a/libcore/DisplayObject.h
+++ b/libcore/DisplayObject.h
@@ -247,7 +247,7 @@ public:
     ///
     /// The default implementation adds nothing
     ///
-    virtual void enumerateNonProperties(as_environment&) const {}
+    virtual void enumerateNonProperties(std::vector<ObjectURI>&) const {}
 
     /// \brief
     /// Return the parent of this DisplayObject, or NULL if
diff --git a/libcore/MovieClip.cpp b/libcore/MovieClip.cpp
index 1210caf..3084231 100644
--- a/libcore/MovieClip.cpp
+++ b/libcore/MovieClip.cpp
@@ -2038,12 +2038,12 @@ MovieClip::isEnabled() const
 
 class EnumerateVisitor {
 
-    as_environment& _env;
+    std::vector<ObjectURI>& _dst;
 
 public:
-    explicit EnumerateVisitor(as_environment& env)
+    explicit EnumerateVisitor(std::vector<ObjectURI>& dst)
         :
-        _env(env)
+        _dst(dst)
     {}
 
     void operator() (DisplayObject* ch) {
@@ -2059,15 +2059,14 @@ public:
         
         // Referenceable DisplayObject always have an object.
         assert(getObject(ch));
-        string_table& st = getStringTable(*getObject(ch));
-        _env.push(name.toString(st));
+        _dst.push_back(name);
     }
 };
 
 void
-MovieClip::enumerateNonProperties(as_environment& env) const
+MovieClip::enumerateNonProperties(std::vector<ObjectURI>& uris) const
 {
-    EnumerateVisitor visitor(env);
+    EnumerateVisitor visitor(uris);
     _displayList.visitAll(visitor);
 }
 
diff --git a/libcore/MovieClip.h b/libcore/MovieClip.h
index 4e22903..390f17e 100644
--- a/libcore/MovieClip.h
+++ b/libcore/MovieClip.h
@@ -572,9 +572,9 @@ public:
 
     /// Enumerate child DisplayObjects
     //
-    /// See as_object::enumerateNonProperties(as_environment&) for more info.
+    /// See DisplayObject::enumerateNonProperties for more info.
     ///
-    virtual void enumerateNonProperties(as_environment&) const;
+    void enumerateNonProperties(std::vector<ObjectURI>&) const;
 
     /// Delete DisplayObjects removed from the stage
     /// from the display lists
diff --git a/libcore/PropertyList.cpp b/libcore/PropertyList.cpp
index 90ab76a..5f60283 100644
--- a/libcore/PropertyList.cpp
+++ b/libcore/PropertyList.cpp
@@ -210,6 +210,26 @@ PropertyList::enumerateKeys(as_environment& env, 
PropertyTracker& donelist)
 }
 
 void
+PropertyList::enumerateKeys(std::vector<ObjectURI>& uris, PropertyTracker& 
donelist)
+    const
+{
+       string_table& st = getStringTable(_owner);
+
+    // We should enumerate in order of creation, not lexicographically.
+       for (const_iterator i = _props.begin(),
+            ie = _props.end(); i != ie; ++i) {
+
+               if (i->getFlags().get_dont_enum()) continue;
+
+        const ObjectURI& uri = i->uri();
+
+               if (donelist.insert(uri).second) {
+                       uris.push_back(uri);
+               }
+       }
+}
+
+void
 PropertyList::dump()
 {
     ObjectURI::Logger l(getStringTable(_owner));
diff --git a/libcore/PropertyList.h b/libcore/PropertyList.h
index 6717ee5..2bf97a7 100644
--- a/libcore/PropertyList.h
+++ b/libcore/PropertyList.h
@@ -21,6 +21,7 @@
 
 #include <set> 
 #include <map> 
+#include <vector> 
 #include <string> // for use within map 
 #include <cassert> // for inlines
 #include <utility> // for std::pair
@@ -154,6 +155,7 @@ public:
     /// @param donelist     Don't enumerate properties in donelist.
     ///                     Enumerated properties are added to donelist.
     void enumerateKeys(as_environment& env, PropertyTracker& donelist) const;
+    void enumerateKeys(std::vector<ObjectURI>& uris, PropertyTracker& 
donelist) const;
 
     /// Set the value of a property, creating a new one if it doesn't exist.
     //
diff --git a/libcore/as_object.cpp b/libcore/as_object.cpp
index 55f8835..89445c9 100644
--- a/libcore/as_object.cpp
+++ b/libcore/as_object.cpp
@@ -270,7 +270,7 @@ public:
 
     bool accept(const ObjectURI& uri, const as_value& val) {
         _to.push_front(std::make_pair(_st.value(getName(uri)),
-                                      val.to_string(_version)));
+                                      val));
         return true;
     }
 
@@ -918,12 +918,23 @@ as_object::copyProperties(const as_object& o)
 void
 as_object::enumeratePropertyKeys(as_environment& env) const
 {
+    typedef std::vector<ObjectURI> URIs;
+    URIs uris;
+    enumeratePropertyKeys(uris);
+    string_table& st = getVM(*this).getStringTable();
+    for (URIs::const_iterator i=uris.begin(), e=uris.end();
+            i!=e; ++i)
+    {
+        env.push(i->toString(st));
+    }
+}
 
-    assert(env.top(0).is_undefined());
-
+void
+as_object::enumeratePropertyKeys(std::vector<ObjectURI>& uris) const
+{
     // Hack to handle MovieClips.
     if (displayObject()) {
-        displayObject()->enumerateNonProperties(env);
+        displayObject()->enumerateNonProperties(uris);
     }
 
     // this set will keep track of visited objects,
@@ -934,7 +945,7 @@ as_object::enumeratePropertyKeys(as_environment& env) const
        
     const as_object* current(this);
     while (current && visited.insert(current).second) {
-        current->_members.enumerateKeys(env, doneList);
+        current->_members.enumerateKeys(uris, doneList);
         current = current->get_prototype();
     }
 }
@@ -1017,7 +1028,7 @@ getURLEncodedVars(as_object& o, std::string& data)
     for (as_object::SortedPropertyList::const_iterator i=props.begin(),
             e=props.end(); i!=e; ++i) {
         std::string name = i->first;
-        std::string value = i->second;
+        std::string value = i->second.to_string();
         if (!name.empty() && name[0] == '$') continue; // see bug #22006
         URL::encode(value);
 
diff --git a/libcore/as_object.h b/libcore/as_object.h
index 5892843..d48c544 100644
--- a/libcore/as_object.h
+++ b/libcore/as_object.h
@@ -174,7 +174,7 @@ class as_object : public GcResource, boost::noncopyable
 
 public:
     
-    typedef std::pair<std::string, std::string> KeyValuePair;
+    typedef std::pair<std::string, as_value> KeyValuePair;
 
     /// This is used to hold an intermediate copy of an as_object's properties.
     //
@@ -434,8 +434,13 @@ public:
     /// implementation will keep track of visited object to avoid infinite
     /// loops in the prototype chain.  NOTE: the MM player just chokes in
     /// this case.
+    ///
+    /// @deprecate use the version taking vector<ObjectURI>
+    ///
     void enumeratePropertyKeys(as_environment& env) const;
 
+    void enumeratePropertyKeys(std::vector<ObjectURI>& uris) const;
+
     /// Add a watch trigger, overriding any other defined for same name.
     //
     /// @param uri      property identifier
@@ -916,7 +921,7 @@ isNativeType(as_object* obj, T*& relay)
 /// Enumerate all non-hidden properties to the passed container
 //
 /// NB: it is likely that this call will change the object, as accessing
-/// propertyproperty  values may call getter-setters.
+/// property values may call getter-setters.
 //
 /// The enumeration recurses through the prototype chain. This implementation
 /// will keep track of visited object to avoid infinite loops in the
diff --git a/libcore/asobj/LoadVars_as.cpp b/libcore/asobj/LoadVars_as.cpp
index 2db475d..1bd5029 100644
--- a/libcore/asobj/LoadVars_as.cpp
+++ b/libcore/asobj/LoadVars_as.cpp
@@ -132,6 +132,8 @@ loadvars_tostring(const fn_call& fn)
     as_object* global = &getGlobal(*ptr);
     std::ostringstream o;
     
+    int ver = getSWFVersion(*global);
+
     // LoadVars.toString() calls _global.escape().
        for (VarMap::const_iterator it=vars.begin(), itEnd=vars.end();
                        it != itEnd; ++it) {
@@ -140,7 +142,7 @@ loadvars_tostring(const fn_call& fn)
         const std::string& var = 
             callMethod(global, NSV::PROP_ESCAPE, it->first).to_string();
         const std::string& val = 
-            callMethod(global, NSV::PROP_ESCAPE, it->second).to_string();
+            callMethod(global, NSV::PROP_ESCAPE, 
it->second.to_string(ver)).to_string();
         o << var << "=" << val;
        }
     return as_value(o.str()); 
diff --git a/libcore/asobj/XMLNode_as.cpp b/libcore/asobj/XMLNode_as.cpp
index 9596ba6..f40ed91 100644
--- a/libcore/asobj/XMLNode_as.cpp
+++ b/libcore/asobj/XMLNode_as.cpp
@@ -44,12 +44,14 @@ namespace gnash {
 
 // Function Prototypes
 namespace {
+    typedef std::pair<std::string, std::string> StringPair;
+    typedef std::vector<StringPair> StringPairs;
     void enumerateAttributes(const XMLNode_as& node,
-            as_object::SortedPropertyList& attributes);
-    bool prefixMatches(const as_object::SortedPropertyList::value_type& val,
+            StringPairs& attributes);
+    bool prefixMatches(const StringPairs::value_type& val,
             const std::string& prefix);
     bool namespaceMatches(
-            const as_object::SortedPropertyList::value_type& val,
+            const StringPairs::value_type& val,
             const std::string& ns);    
 
     as_value xmlnode_new(const fn_call& fn);
@@ -299,8 +301,8 @@ bool
 XMLNode_as::getPrefixForNamespace(const std::string& ns, std::string& prefix)
 {
     XMLNode_as* node = this;
-    as_object::SortedPropertyList::const_iterator it; 
-    as_object::SortedPropertyList attrs;
+    StringPairs::const_iterator it; 
+    StringPairs attrs;
     
     while (node) {
         enumerateAttributes(*node, attrs);
@@ -336,8 +338,8 @@ void
 XMLNode_as::getNamespaceForPrefix(const std::string& prefix, std::string& ns)
 {
     XMLNode_as* node = this;
-    as_object::SortedPropertyList::const_iterator it; 
-    as_object::SortedPropertyList attrs;
+    StringPairs::const_iterator it; 
+    StringPairs attrs;
     
     while (node) {
 
@@ -411,11 +413,11 @@ XMLNode_as::stringify(const XMLNode_as& xml, 
std::ostream& xmlout, bool encode)
         xmlout << "<" << nodeName;
     
         // Process the attributes, if any
-        as_object::SortedPropertyList attrs;
+        StringPairs attrs;
         enumerateAttributes(xml, attrs);
         if (!attrs.empty()) {
 
-            for (as_object::SortedPropertyList::iterator i = 
+            for (StringPairs::iterator i = 
                     attrs.begin(), e = attrs.end(); i != e; ++i) { 
                 escapeXML(i->second);
                 xmlout << " " << i->first << "=\"" << i->second << "\"";
@@ -993,12 +995,19 @@ xmlnode_childNodes(const fn_call& fn)
 
 void
 enumerateAttributes(const XMLNode_as& node,
-        as_object::SortedPropertyList& attrs)
+        StringPairs& pairs)
 {
-    attrs.clear();
+    pairs.clear();
+
     as_object* obj = node.getAttributes();
     if (obj) {
+        as_object::SortedPropertyList attrs;
         enumerateProperties(*obj, attrs);
+        for (as_object::SortedPropertyList::const_iterator i=attrs.begin(), 
+                e=attrs.end(); i!=e; ++i)
+        {
+            pairs.push_back(std::make_pair(i->first, i->second.to_string()));
+        }
     }
 
 }
@@ -1006,7 +1015,7 @@ enumerateAttributes(const XMLNode_as& node,
 /// Return true if this attribute is a namespace specifier and the
 /// namespace matches.
 bool
-namespaceMatches(const as_object::SortedPropertyList::value_type& val,
+namespaceMatches(const StringPairs::value_type& val,
         const std::string& ns)
 {
     StringNoCaseEqual noCaseCompare;
@@ -1016,7 +1025,7 @@ namespaceMatches(const 
as_object::SortedPropertyList::value_type& val,
 
 
 bool
-prefixMatches(const as_object::SortedPropertyList::value_type& val,
+prefixMatches(const StringPairs::value_type& val,
         const std::string& prefix)
 {
     const std::string& name = val.first;

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


commit 8dee7c06be4105b3dec25ce4c742cb3051cb67f1
Author: Sandro Santilli <address@hidden>
Date:   Thu Oct 14 20:58:25 2010 +0200

    Instanciate the native object (XML) closer to where it's checked

diff --git a/testsuite/actionscript.all/ExternalInterface.as 
b/testsuite/actionscript.all/ExternalInterface.as
index d9ce042..cf1d301 100644
--- a/testsuite/actionscript.all/ExternalInterface.as
+++ b/testsuite/actionscript.all/ExternalInterface.as
@@ -154,9 +154,6 @@ oc.b = oc.a;
 // A native class
 nc = Mouse;
 
-// A native object
-no = new XML;
-
 // Try instantiating.
 r = new EI;
 // You get an object
@@ -247,6 +244,9 @@ check_equals (xml, '<arguments></arguments>');
 xml = EI._toXML(123.456);
 check_equals (xml , "<number>123.456</number>");
 
+// A native object
+no = new XML;
+
 xml = EI._objectToXML(no);
 xcheck_equals (xml, '<object><property 
id="namespaceURI"><null/></property><property 
id="localName"><null/></property><property 
id="prefix"><null/></property><property 
id="previousSibling"><null/></property><property 
id="parentNode"><null/></property><property 
id="nodeValue"><null/></property><property 
id="nodeType"><number>1</number></property><property 
id="nodeName"><null/></property><property 
id="nextSibling"><null/></property><property 
id="lastChild"><null/></property><property 
id="firstChild"><null/></property><property 
id="childNodes"><array></array></property><property 
id="attributes"><null/></property><property 
id="getPrefixForNamespace"><null/></property><property 
id="getNamespaceForPrefix"><null/></property><property 
id="toString"><null/></property><property 
id="hasChildNodes"><null/></property><property 
id="appendChild"><null/></property><property 
id="insertBefore"><null/></property><property 
id="removeNode"><null/></property><property 
id="cloneNode"><null/></property><property 
id="xmlDecl"><undefined/></property><property 
id="status"><number>0</number></property><property 
id="loaded"><undefined/></property><property 
id="ignoreWhite"><false/></property><property 
id="docTypeDecl"><undefined/></property><property 
id="contentType"><string>application/x-www-form-urlencoded</string></property><property
 id="addRequestHeader"><null/></property><property 
id="getBytesTotal"><null/></property><property 
id="getBytesLoaded"><null/></property><property 
id="onData"><null/></property><property id="onLoad"><null/></property><property 
id="sendAndLoad"><null/></property><property 
id="send"><null/></property><property id="load"><null/></property><property 
id="parseXML"><null/></property><property 
id="createTextNode"><null/></property><property 
id="createElement"><null/></property></object>');
 

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

Summary of changes:
 libcore/DisplayObject.h                         |    2 +-
 libcore/MovieClip.cpp                           |   13 ++++----
 libcore/MovieClip.h                             |    4 +-
 libcore/PropertyList.cpp                        |   20 +++++++++++++
 libcore/PropertyList.h                          |    2 +
 libcore/as_object.cpp                           |   23 +++++++++++----
 libcore/as_object.h                             |    9 ++++-
 libcore/asobj/LoadVars_as.cpp                   |    4 ++-
 libcore/asobj/XMLNode_as.cpp                    |   35 ++++++++++++++--------
 testsuite/actionscript.all/ExternalInterface.as |    6 ++--
 10 files changed, 83 insertions(+), 35 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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