Add preventative assert in SVGTRefElement
authorpdr@google.com <pdr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Jun 2012 02:36:06 +0000 (02:36 +0000)
committerpdr@google.com <pdr@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Jun 2012 02:36:06 +0000 (02:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90203

Reviewed by Abhishek Arya.

SVGTRefElement::detachTarget() adds a pending resource via addPendingResource.
Due to some recent bugs in this area, an assert is being added to prevent
users from calling detachTarget when not in a document. Doing
so would create a bug such as in WK90042.

This assert will not fire currently because detachTarget is only called after
a DOMNodeRemovedFromDocumentEvent event fires, which only comes from
dispatchChildRemovalEvents when the node is in a document.

* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefElement::detachTarget):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121508 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/svg/SVGTRefElement.cpp

index 7dd7f52..52a0b72 100644 (file)
@@ -1,3 +1,22 @@
+2012-06-28  Philip Rogers  <pdr@google.com>
+
+        Add preventative assert in SVGTRefElement
+        https://bugs.webkit.org/show_bug.cgi?id=90203
+
+        Reviewed by Abhishek Arya.
+
+        SVGTRefElement::detachTarget() adds a pending resource via addPendingResource.
+        Due to some recent bugs in this area, an assert is being added to prevent
+        users from calling detachTarget when not in a document. Doing
+        so would create a bug such as in WK90042.
+
+        This assert will not fire currently because detachTarget is only called after
+        a DOMNodeRemovedFromDocumentEvent event fires, which only comes from
+        dispatchChildRemovalEvents when the node is in a document.
+
+        * svg/SVGTRefElement.cpp:
+        (WebCore::SVGTRefElement::detachTarget):
+
 2012-06-28  Bruno de Oliveira Abinader  <bruno.abinader@basyskom.com>
 
         [Qt] Remove unnecessary AffineTransform calls
index 97bc43d..61de7c8 100644 (file)
@@ -185,6 +185,8 @@ void SVGTRefElement::detachTarget()
     if (container)
         container->setTextContent(emptyContent, ignore);
 
+    ASSERT(inDocument());
+
     // Mark the referenced ID as pending.
     String id;
     SVGURIReference::targetElementFromIRIString(href(), document(), &id);