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. release_0_8_9_final-


From: Bastiaan Jacques
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-2134-g8753d58
Date: Thu, 12 Jun 2014 09:16:09 +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  8753d58170ed40da84d14163da9d92ab5841e8b5 (commit)
       via  05553ba133695c45223dcc504945a9de211d6087 (commit)
      from  fb38a90ab0fd40661786c41a8ed92dab696a1192 (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=8753d58170ed40da84d14163da9d92ab5841e8b5


commit 8753d58170ed40da84d14163da9d92ab5841e8b5
Author: Bastiaan Jacques <address@hidden>
Date:   Thu Jun 12 11:11:30 2014 +0200

    Remove recursion check.
    
    Since 0e2df5a73c it is impossible for an AS-created tree of
    XMLNodes to reference a single node more than once.

diff --git a/libcore/asobj/XMLNode_as.cpp b/libcore/asobj/XMLNode_as.cpp
index f078c7e..6b3f43a 100644
--- a/libcore/asobj/XMLNode_as.cpp
+++ b/libcore/asobj/XMLNode_as.cpp
@@ -83,8 +83,7 @@ XMLNode_as::XMLNode_as(Global_as& gl)
     _parent(nullptr),
     _attributes(new as_object(gl)),
     _childNodes(nullptr),
-    _type(Element),
-    _gcMarkInProgress(false)
+    _type(Element)
 {
 }
 
@@ -97,8 +96,7 @@ XMLNode_as::XMLNode_as(const XMLNode_as& tpl, bool deep)
     _childNodes(nullptr),
     _name(tpl._name),
     _value(tpl._value),
-    _type(tpl._type),
-    _gcMarkInProgress(false)
+    _type(tpl._type)
 {
     // only clone children if in deep mode
     if (deep) {
@@ -492,10 +490,6 @@ XMLNode_as::setReachable()
     // If there is a parent, make sure its object is reachable. This goes
     // up towards the root node of tree without marking the XMLNode
     // resources (which would cause infinite recursion).
-    if ( _gcMarkInProgress ) return;
-
-    GCMarkGuard markGuard(this);
-
     if (_parent && _parent->_object) _parent->_object->setReachable();
 
        // Mark children
diff --git a/libcore/asobj/XMLNode_as.h b/libcore/asobj/XMLNode_as.h
index 320419a..f62d78e 100644
--- a/libcore/asobj/XMLNode_as.h
+++ b/libcore/asobj/XMLNode_as.h
@@ -268,26 +268,6 @@ private:
 
     static void stringify(const XMLNode_as& xml, std::ostream& xmlout,
             bool encode);
-
-    /// Is GC mark scan in progress ? 
-    //
-    /// Used to guard against infinite loops
-    ///
-    bool _gcMarkInProgress;
-
-    /// Class to prevent infinite loops
-    //
-    /// could probably be replaced with a templated class taking an
-    /// object and two values to toggle between.
-    /// See also FrameGuard, TargetGuard and PoolGuard
-    class GCMarkGuard {
-        XMLNode_as* _x;
-    public:
-        GCMarkGuard(XMLNode_as* x): _x(x) { _x->_gcMarkInProgress = true; }
-        ~GCMarkGuard() { _x->_gcMarkInProgress = false; }
-    };
-    friend class GCMarkGuard;
-
 };
 
 // Initialize the global XMLNode class

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


commit 05553ba133695c45223dcc504945a9de211d6087
Author: Bastiaan Jacques <address@hidden>
Date:   Thu Jun 12 11:07:24 2014 +0200

    Savannah #40440: ignore attempts to move an XMLNode to a position
    among its descendants.

diff --git a/libcore/asobj/XMLNode_as.cpp b/libcore/asobj/XMLNode_as.cpp
index e8155af..f078c7e 100644
--- a/libcore/asobj/XMLNode_as.cpp
+++ b/libcore/asobj/XMLNode_as.cpp
@@ -229,6 +229,20 @@ XMLNode_as::appendChild(XMLNode_as* node)
     updateChildNodes();
 }
 
+bool
+XMLNode_as::descendsFrom(XMLNode_as* node) const
+{
+    if (node == this) {
+        return true;
+    }
+    XMLNode_as* parent = getParent();
+    if (parent) {
+        return parent->descendsFrom(node);
+    }
+
+    return false;
+}
+
 void
 XMLNode_as::insertBefore(XMLNode_as* newnode, XMLNode_as* pos)
 {
@@ -624,6 +638,14 @@ xmlnode_appendChild(const fn_call& fn)
                return as_value();
        }
 
+    if (ptr->descendsFrom(node)) {
+        IF_VERBOSE_ASCODING_ERRORS(
+        log_aserror(_("XMLNode.appendChild(): attempted to move a node to "
+            "among its own descendants."));
+        );
+        return as_value();
+    }
+
     XMLNode_as* parent = node->getParent();
     if (parent) {
         parent->removeChild(node);
@@ -684,6 +706,14 @@ xmlnode_insertBefore(const fn_call& fn)
                return as_value();
        }
 
+    if (pos->descendsFrom(newnode)) {
+        IF_VERBOSE_ASCODING_ERRORS(
+        log_aserror(_("XMLNode.insertBefore(): attempted to move a node to "
+            "among its own descendants."));
+        );
+        return as_value();
+    }
+
     ptr->insertBefore(newnode, pos);
     return as_value();
     
diff --git a/libcore/asobj/XMLNode_as.h b/libcore/asobj/XMLNode_as.h
index 45c7254..320419a 100644
--- a/libcore/asobj/XMLNode_as.h
+++ b/libcore/asobj/XMLNode_as.h
@@ -113,6 +113,9 @@ public:
         return _namespaceURI;
     }
 
+    /// Returns true if 'this' descends from the specified node.
+    bool descendsFrom(XMLNode_as* node) const;
+
     ///  Returns true if the specified node has child nodes; otherwise,
     ///  returns false.
     bool hasChildNodes() const;
diff --git a/testsuite/actionscript.all/XMLNode.as 
b/testsuite/actionscript.all/XMLNode.as
index 33d28de..dd92e21 100644
--- a/testsuite/actionscript.all/XMLNode.as
+++ b/testsuite/actionscript.all/XMLNode.as
@@ -422,4 +422,51 @@ xl2 = new XML('<t></t>');
 xl1.appendChild(xl2);
 xl2.appendChild(xl1);
 
-check_totals(182);
+check_equals(xl2.parentNode, xl1);
+check_equals(xl1.parentNode, null); // Nothing happened.
+
+doc = new XML('<t></t>');
+parent = doc.createElement("parent");
+child = doc.createElement("child");
+parent.appendChild(child);
+doc.appendChild(parent);
+
+check_equals(doc.toString(), "<t /><parent><child /></parent>");
+
+child.appendChild(parent);
+check_equals(doc.toString(), "<t /><parent><child /></parent>");
+check_equals(child.hasChildNodes(), false);
+
+sibling = doc.createElement("sibling");
+parent.insertBefore(sibling, child);
+check_equals(doc.toString(), "<t /><parent><sibling /><child /></parent>");
+doc.insertBefore(sibling, parent); // Should move sibling
+check_equals(doc.toString(), "<t /><sibling /><parent><child /></parent>");
+parent.appendChild(sibling);
+check_equals(doc.toString(), "<t /><parent><child /><sibling /></parent>");
+parent.appendChild(parent);
+check_equals(doc.toString(), "<t /><parent><child /><sibling /></parent>");
+child.appendChild(parent);
+check_equals(doc.toString(), "<t /><parent><child /><sibling /></parent>");
+grandchild = doc.createElement("grandchild");
+child.appendChild(grandchild);
+check_equals(doc.toString(), "<t /><parent><child><grandchild 
/></child><sibling /></parent>");
+child.appendChild(parent);
+check_equals(doc.toString(), "<t /><parent><child><grandchild 
/></child><sibling /></parent>");
+child.insertBefore(child, parent);
+check_equals(doc.toString(), "<t /><parent><child><grandchild 
/></child><sibling /></parent>");
+grandchild.appendChild(parent);
+check_equals(doc.toString(), "<t /><parent><child><grandchild 
/></child><sibling /></parent>");
+grandchild.insertBefore(grandchild, parent);
+check_equals(doc.toString(), "<t /><parent><child><grandchild 
/></child><sibling /></parent>");
+grandchild.insertBefore(grandchild, child);
+check_equals(doc.toString(), "<t /><parent><child><grandchild 
/></child><sibling /></parent>");
+
+doc1 = new XML("<t />");
+doc1.appendChild(parent);
+check_equals(doc1.toString(), "<t /><parent><child><grandchild 
/></child><sibling /></parent>");
+check_equals(doc.toString(), "<t />");
+doc1.appendChild(child);
+check_equals(doc1.toString(), "<t /><parent><sibling 
/></parent><child><grandchild /></child>");
+
+check_totals(201);

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

Summary of changes:
 libcore/asobj/XMLNode_as.cpp          |   40 +++++++++++++++++++++-----
 libcore/asobj/XMLNode_as.h            |   23 ++-------------
 testsuite/actionscript.all/XMLNode.as |   49 ++++++++++++++++++++++++++++++++-
 3 files changed, 83 insertions(+), 29 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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