Title: [131709] trunk
Revision
131709
Author
morr...@google.com
Date
2012-10-18 00:08:58 -0700 (Thu, 18 Oct 2012)

Log Message

Assertion failure at TreeScopeAdopter::moveNodeToNewDocument()
https://bugs.webkit.org/show_bug.cgi?id=99510

Reviewed by Kent Tamura.

Source/WebCore:

Shadow DOM notification call didn't have checks for mutation detection.
This change adds such checks.

Test: fast/forms/textarea/textarea-autofocus-removal-while-focusing-with-style.html

* dom/ContainerNodeAlgorithms.cpp:
(WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument):
(WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument):

LayoutTests:

* fast/forms/textarea/textarea-autofocus-removal-while-focusing-with-style-expected.txt: Added.
* fast/forms/textarea/textarea-autofocus-removal-while-focusing-with-style.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (131708 => 131709)


--- trunk/LayoutTests/ChangeLog	2012-10-18 07:05:45 UTC (rev 131708)
+++ trunk/LayoutTests/ChangeLog	2012-10-18 07:08:58 UTC (rev 131709)
@@ -1,3 +1,13 @@
+2012-10-18  MORITA Hajime  <morr...@google.com>
+
+        Assertion failure at TreeScopeAdopter::moveNodeToNewDocument()
+        https://bugs.webkit.org/show_bug.cgi?id=99510
+
+        Reviewed by Kent Tamura.
+
+        * fast/forms/textarea/textarea-autofocus-removal-while-focusing-with-style-expected.txt: Added.
+        * fast/forms/textarea/textarea-autofocus-removal-while-focusing-with-style.html: Added.
+
 2012-10-18  Zan Dobersek  <zandober...@gmail.com>
 
         Unreviewed GTK gardening.

Added: trunk/LayoutTests/fast/forms/textarea/textarea-autofocus-removal-while-focusing-with-style-expected.txt (0 => 131709)


--- trunk/LayoutTests/fast/forms/textarea/textarea-autofocus-removal-while-focusing-with-style-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/textarea/textarea-autofocus-removal-while-focusing-with-style-expected.txt	2012-10-18 07:08:58 UTC (rev 131709)
@@ -0,0 +1 @@
+PASS unless crash.

Added: trunk/LayoutTests/fast/forms/textarea/textarea-autofocus-removal-while-focusing-with-style.html (0 => 131709)


--- trunk/LayoutTests/fast/forms/textarea/textarea-autofocus-removal-while-focusing-with-style.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/textarea/textarea-autofocus-removal-while-focusing-with-style.html	2012-10-18 07:08:58 UTC (rev 131709)
@@ -0,0 +1,20 @@
+<head>
+<style> </style>
+</head>
+<body>
+<script>
+testRunner.dumpAsText();
+testRunner.waitUntilDone();
+var docElement = document.documentElement;
+textArea = document.createElement("textarea");
+textArea.setAttribute("autofocus", "");
+textArea.appendChild(document.head);
+textArea.addEventListener("DOMFocusIn", function () { docElement.innerHTML = ""; }, false);
+docElement.appendChild(textArea);
+document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html", null).adoptNode(textArea);
+window.setTimeout(function() {
+    document.body.innerHTML = "PASS unless crash.";
+    testRunner.notifyDone();
+}, 0);
+</script>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (131708 => 131709)


--- trunk/Source/WebCore/ChangeLog	2012-10-18 07:05:45 UTC (rev 131708)
+++ trunk/Source/WebCore/ChangeLog	2012-10-18 07:08:58 UTC (rev 131709)
@@ -1,3 +1,19 @@
+2012-10-18  MORITA Hajime  <morr...@google.com>
+
+        Assertion failure at TreeScopeAdopter::moveNodeToNewDocument()
+        https://bugs.webkit.org/show_bug.cgi?id=99510
+
+        Reviewed by Kent Tamura.
+
+        Shadow DOM notification call didn't have checks for mutation detection.
+        This change adds such checks.
+
+        Test: fast/forms/textarea/textarea-autofocus-removal-while-focusing-with-style.html
+
+        * dom/ContainerNodeAlgorithms.cpp:
+        (WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoDocument):
+        (WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromDocument):
+
 2012-10-17  Kentaro Hara  <hara...@chromium.org>
 
         Unreviewed. Rebaselined run-bindings-tests.

Modified: trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp (131708 => 131709)


--- trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp	2012-10-18 07:05:45 UTC (rev 131708)
+++ trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp	2012-10-18 07:08:58 UTC (rev 131709)
@@ -48,8 +48,10 @@
 
     if (ElementShadow* shadow = toElement(node)->shadow()) {
         ShadowRootVector roots(shadow);
-        for (size_t i = 0; i < roots.size(); ++i)
-            notifyNodeInsertedIntoDocument(roots[i].get());
+        for (size_t i = 0; i < roots.size(); ++i) {
+            if (node->inDocument() && roots[i]->host() == node)
+                notifyNodeInsertedIntoDocument(roots[i].get());
+        }
     }
 }
 
@@ -83,8 +85,10 @@
 
     if (ElementShadow* shadow = toElement(node)->shadow()) {
         ShadowRootVector roots(shadow);
-        for (size_t i = 0; i < roots.size(); ++i)
-            notifyNodeRemovedFromDocument(roots[i].get());
+        for (size_t i = 0; i < roots.size(); ++i) {
+            if (!node->inDocument() && roots[i]->host() == node)
+                notifyNodeRemovedFromDocument(roots[i].get());
+        }
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to