Title: [160748] trunk
Revision
160748
Author
[email protected]
Date
2013-12-17 20:32:23 -0800 (Tue, 17 Dec 2013)

Log Message

ASSERT setting pseudoID with registered DOMSubtreeModified listener
https://bugs.webkit.org/show_bug.cgi?id=125900

Reviewed by Ryosuke Niwa.

Source/WebCore:

Test: fast/dom/attribute-set-before-element-in-tree.html

* dom/Node.cpp:
(WebCore::Node::dispatchSubtreeModifiedEvent): Return early if the node does not have a
    parent and does not have a DOMSubtreeModified listener.

LayoutTests:

* fast/dom/attribute-set-before-element-in-tree-expected.txt: Added.
* fast/dom/attribute-set-before-element-in-tree.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (160747 => 160748)


--- trunk/LayoutTests/ChangeLog	2013-12-18 04:18:02 UTC (rev 160747)
+++ trunk/LayoutTests/ChangeLog	2013-12-18 04:32:23 UTC (rev 160748)
@@ -1,3 +1,13 @@
+2013-12-17  Eric Carlson  <[email protected]>
+
+        ASSERT setting pseudoID with registered DOMSubtreeModified listener
+        https://bugs.webkit.org/show_bug.cgi?id=125900
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/dom/attribute-set-before-element-in-tree-expected.txt: Added.
+        * fast/dom/attribute-set-before-element-in-tree.html: Added.
+
 2013-12-17  Jer Noble  <[email protected]>
 
         [MSE] Update duration after appending samples, per spec.

Added: trunk/LayoutTests/fast/dom/attribute-set-before-element-in-tree-expected.txt (0 => 160748)


--- trunk/LayoutTests/fast/dom/attribute-set-before-element-in-tree-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/attribute-set-before-element-in-tree-expected.txt	2013-12-18 04:32:23 UTC (rev 160748)
@@ -0,0 +1,10 @@
+Test MutationObserver not dispatched for a parentless element with no listeners
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Test passed, no crash.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/attribute-set-before-element-in-tree.html (0 => 160748)


--- trunk/LayoutTests/fast/dom/attribute-set-before-element-in-tree.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/attribute-set-before-element-in-tree.html	2013-12-18 04:32:23 UTC (rev 160748)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src=""
+        <script>
+            window.jsTestIsAsync = true;
+
+            function test()
+            {
+                description("Test MutationObserver not dispatched for a parentless element with no listeners");
+
+                document.body.addEventListener('DOMSubtreeModified', function(){ }, true);
+                
+                // HTMLKeygenElement creates a <select> element, which sets its 'pseudo' attribute
+                // in the constructor.
+                var keygen = document.createElement('keygen');
+                setTimeout(finish, 0);
+            }
+
+            function finish()
+            {
+                testPassed("Test passed, no crash.");
+                finishJSTest();
+            }
+
+        </script>
+    </head>
+    <body _onload_="test()">
+        <script src=""
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (160747 => 160748)


--- trunk/Source/WebCore/ChangeLog	2013-12-18 04:18:02 UTC (rev 160747)
+++ trunk/Source/WebCore/ChangeLog	2013-12-18 04:32:23 UTC (rev 160748)
@@ -1,3 +1,16 @@
+2013-12-17  Eric Carlson  <[email protected]>
+
+        ASSERT setting pseudoID with registered DOMSubtreeModified listener
+        https://bugs.webkit.org/show_bug.cgi?id=125900
+
+        Reviewed by Ryosuke Niwa.
+
+        Test: fast/dom/attribute-set-before-element-in-tree.html
+
+        * dom/Node.cpp:
+        (WebCore::Node::dispatchSubtreeModifiedEvent): Return early if the node does not have a
+            parent and does not have a DOMSubtreeModified listener.
+
 2013-12-17  Ryosuke Niwa  <[email protected]>
 
         Remove dead code for reflected attributes from audio, video, and track elements

Modified: trunk/Source/WebCore/dom/Node.cpp (160747 => 160748)


--- trunk/Source/WebCore/dom/Node.cpp	2013-12-18 04:18:02 UTC (rev 160747)
+++ trunk/Source/WebCore/dom/Node.cpp	2013-12-18 04:32:23 UTC (rev 160748)
@@ -2045,8 +2045,11 @@
 
     if (!document().hasListenerType(Document::DOMSUBTREEMODIFIED_LISTENER))
         return;
+    const AtomicString& subtreeModifiedEventName = eventNames().DOMSubtreeModifiedEvent;
+    if (!parentNode() && !hasEventListeners(subtreeModifiedEventName))
+        return;
 
-    dispatchScopedEvent(MutationEvent::create(eventNames().DOMSubtreeModifiedEvent, true));
+    dispatchScopedEvent(MutationEvent::create(subtreeModifiedEventName, true));
 }
 
 bool Node::dispatchDOMActivateEvent(int detail, PassRefPtr<Event> underlyingEvent)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to