Title: [169230] branches/safari-537.77-branch

Diff

Modified: branches/safari-537.77-branch/LayoutTests/ChangeLog (169229 => 169230)


--- branches/safari-537.77-branch/LayoutTests/ChangeLog	2014-05-22 23:57:46 UTC (rev 169229)
+++ branches/safari-537.77-branch/LayoutTests/ChangeLog	2014-05-23 00:02:19 UTC (rev 169230)
@@ -1,3 +1,21 @@
+2014-05-22  Dana Burkart  <[email protected]>
+
+        Merge r169007
+
+        2014-05-17  Maciej Stachowiak  <[email protected]>
+
+                Don't attempt to update id or name for nodes that are already removed
+                https://bugs.webkit.org/show_bug.cgi?id=133041
+
+                Reviewed by Sam Weinig.
+                
+                Test originally by Dan Bates.
+
+                * fast/dom/remove-element-with-id-that-was-inserted-on-DOMNodeRemoved-expected.txt: Added.
+                * fast/dom/remove-element-with-id-that-was-inserted-on-DOMNodeRemoved.html: Added.
+                * fast/dom/remove-element-with-name-that-was-inserted-on-DOMNodeRemoved-expected.txt: Added.
+                * fast/dom/remove-element-with-name-that-was-inserted-on-DOMNodeRemoved.html: Added.
+
 2014-05-22  Lucas Forschler  <[email protected]>
 
         Merge r168915

Copied: branches/safari-537.77-branch/LayoutTests/fast/dom/remove-element-with-id-that-was-inserted-on-DOMNodeRemoved-expected.txt (from rev 169007, trunk/LayoutTests/fast/dom/remove-element-with-id-that-was-inserted-on-DOMNodeRemoved-expected.txt) (0 => 169230)


--- branches/safari-537.77-branch/LayoutTests/fast/dom/remove-element-with-id-that-was-inserted-on-DOMNodeRemoved-expected.txt	                        (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/fast/dom/remove-element-with-id-that-was-inserted-on-DOMNodeRemoved-expected.txt	2014-05-23 00:02:19 UTC (rev 169230)
@@ -0,0 +1 @@
+PASS, removed element, with HTML attribute id, which was inserted on event DOMNodeRemoved.

Copied: branches/safari-537.77-branch/LayoutTests/fast/dom/remove-element-with-id-that-was-inserted-on-DOMNodeRemoved.html (from rev 169007, trunk/LayoutTests/fast/dom/remove-element-with-id-that-was-inserted-on-DOMNodeRemoved.html) (0 => 169230)


--- branches/safari-537.77-branch/LayoutTests/fast/dom/remove-element-with-id-that-was-inserted-on-DOMNodeRemoved.html	                        (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/fast/dom/remove-element-with-id-that-was-inserted-on-DOMNodeRemoved.html	2014-05-23 00:02:19 UTC (rev 169230)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head></head> <!-- This element isn't necessary, but makes it straightforward to reason about the test when debugging it. -->
+<body id="declarativeBody"></body>
+<!-- Notice a <script> is only executed once. -->
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+var savedDocumentElement;
+function appendBodyElementToSavedDocument()
+{
+    document.removeEventListener("DOMNodeRemoved", appendBodyElementToSavedDocument, false);
+    savedDocumentElement.appendChild(document.createElement("body")).id = "programmaticBody";
+}
+
+function insertSavedDocument()
+{
+    document.appendChild(savedDocumentElement); // Will execute <script id="script2">.
+}
+
+savedDocumentElement = document.documentElement;
+document.addEventListener("DOMNodeRemoved", appendBodyElementToSavedDocument, false);
+document.removeChild(savedDocumentElement); // Prevents <script id="script2"> from running since it won't be in the document when we fall off the end of this <script>.
+window.setTimeout(insertSavedDocument, 0);
+</script>
+<!-- This must be in its own <script> so that we execute it (for the first time) when we re-insert it into the document in insertSavedDocument(). -->
+<script id="script2">
+document.write("PASS, removed element, with HTML attribute id, which was inserted on event DOMNodeRemoved."); // Destroys the entire document, including <body id="declarativeBody"> and <body id="programmaticBody">.
+</script>
+</html>

Copied: branches/safari-537.77-branch/LayoutTests/fast/dom/remove-element-with-name-that-was-inserted-on-DOMNodeRemoved-expected.txt (from rev 169007, trunk/LayoutTests/fast/dom/remove-element-with-name-that-was-inserted-on-DOMNodeRemoved-expected.txt) (0 => 169230)


--- branches/safari-537.77-branch/LayoutTests/fast/dom/remove-element-with-name-that-was-inserted-on-DOMNodeRemoved-expected.txt	                        (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/fast/dom/remove-element-with-name-that-was-inserted-on-DOMNodeRemoved-expected.txt	2014-05-23 00:02:19 UTC (rev 169230)
@@ -0,0 +1 @@
+PASS, removed element, with HTML attribute name, which was inserted on event DOMNodeRemoved.

Copied: branches/safari-537.77-branch/LayoutTests/fast/dom/remove-element-with-name-that-was-inserted-on-DOMNodeRemoved.html (from rev 169007, trunk/LayoutTests/fast/dom/remove-element-with-name-that-was-inserted-on-DOMNodeRemoved.html) (0 => 169230)


--- branches/safari-537.77-branch/LayoutTests/fast/dom/remove-element-with-name-that-was-inserted-on-DOMNodeRemoved.html	                        (rev 0)
+++ branches/safari-537.77-branch/LayoutTests/fast/dom/remove-element-with-name-that-was-inserted-on-DOMNodeRemoved.html	2014-05-23 00:02:19 UTC (rev 169230)
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html>
+<head></head> <!-- This element isn't necessary, but makes it straightforward to reason about the test when debugging it. -->
+<body data-debug-name="declarativeBody"></body> <!-- This element isn't necessary, but makes it straightforward to reason about the test when debugging it. -->
+<!-- Notice a <script> is only executed once. -->
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+var savedDocumentElement;
+function appendBodyElementToSavedDocument()
+{
+    document.removeEventListener("DOMNodeRemoved", appendBodyElementToSavedDocument, false);
+    savedDocumentElement.appendChild(document.createElement("body")).setAttribute("data-debug-name", "programmaticBody");
+}
+
+function insertSavedDocument()
+{
+    document.appendChild(savedDocumentElement); // Will execute <script id="script2">.
+}
+
+savedDocumentElement = document.documentElement;
+document.addEventListener("DOMNodeRemoved", appendBodyElementToSavedDocument, false);
+document.removeChild(savedDocumentElement); // Prevents <script id="script2"> from running since it won't be in the document when we fall off the end of this <script>.
+window.setTimeout(insertSavedDocument, 0);
+</script>
+<!-- This must be in its own <script> so that we execute it (for the first time) when we re-insert it into the document in insertSavedDocument(). -->
+<script id="script2">
+// [1] The array |elements| will either have the form {..., <body id="declarativeBody">, ...} or {..., <body id="declarativeBody">, ..., <body id="programmaticBody">, ...}.
+// The former will cause an assertion failure when we execute [2].
+var elements = document.querySelectorAll("*");
+for (var i = 0; i < elements.length; ++i)
+    elements[i].setAttribute("name", elements[i].nodeName);
+
+// [2] Destroy the entire document, including <body data-debug-name="declarativeBody"> and <body data-debug-name="programmaticBody">. Moving the
+// following line to its own <script> and altering the execution time of this page (say, by stepping through code in a WebCore debug session)
+// tends to affect the result of |elements| (see remark [1]).
+document.write("PASS, removed element, with HTML attribute name, which was inserted on event DOMNodeRemoved.");
+</script>
+</html>

Modified: branches/safari-537.77-branch/Source/WebCore/ChangeLog (169229 => 169230)


--- branches/safari-537.77-branch/Source/WebCore/ChangeLog	2014-05-22 23:57:46 UTC (rev 169229)
+++ branches/safari-537.77-branch/Source/WebCore/ChangeLog	2014-05-23 00:02:19 UTC (rev 169230)
@@ -66,6 +66,24 @@
 
 2014-05-22  Dana Burkart  <[email protected]>
 
+        Merge r169007
+
+    2014-05-17  Maciej Stachowiak  <[email protected]>
+
+            Don't attempt to update id or name for nodes that are already removed
+            https://bugs.webkit.org/show_bug.cgi?id=133041
+
+            Reviewed by Sam Weinig.
+
+            Tests: fast/dom/remove-element-with-id-that-was-inserted-on-DOMNodeRemoved.html
+                   fast/dom/remove-element-with-name-that-was-inserted-on-DOMNodeRemoved.html
+
+            * dom/Element.cpp:
+            (WebCore::Element::removedFrom): Skip updating ids and names for an element not
+            in a treescope, as we already do for elements not in a document.
+
+2014-05-22  Dana Burkart  <[email protected]>
+
         Merge r167856
 
     2014-04-27  Darin Adler  <[email protected]>

Modified: branches/safari-537.77-branch/Source/WebCore/dom/Element.cpp (169229 => 169230)


--- branches/safari-537.77-branch/Source/WebCore/dom/Element.cpp	2014-05-22 23:57:46 UTC (rev 169229)
+++ branches/safari-537.77-branch/Source/WebCore/dom/Element.cpp	2014-05-23 00:02:19 UTC (rev 169230)
@@ -1387,7 +1387,7 @@
     if (insertionPoint->isInTreeScope()) {
         TreeScope* oldScope = insertionPoint->treeScope();
         HTMLDocument* oldDocument = inDocument() && oldScope->documentScope()->isHTMLDocument() ? toHTMLDocument(oldScope->documentScope()) : 0;
-        if (oldScope != treeScope())
+        if (oldScope != treeScope() || !isInTreeScope())
             oldScope = 0;
 
         const AtomicString& idValue = getIdAttribute();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to