Title: [145660] branches/safari-536.30-branch

Diff

Modified: branches/safari-536.30-branch/LayoutTests/ChangeLog (145659 => 145660)


--- branches/safari-536.30-branch/LayoutTests/ChangeLog	2013-03-13 01:28:32 UTC (rev 145659)
+++ branches/safari-536.30-branch/LayoutTests/ChangeLog	2013-03-13 01:31:11 UTC (rev 145660)
@@ -1,5 +1,23 @@
 2013-03-12  Lucas Forschler  <[email protected]>
 
+        Merge r140101
+
+    2013-01-17  Rafael Weinstein  <[email protected]>
+
+            Ensure the parser adopts foster-parented children into the document of their parent.
+            https://bugs.webkit.org/show_bug.cgi?id=107023
+
+            Reviewed by Adam Barth.
+
+            This patch adopts the child into the parent's document after foster parenting to prevent a child from ending up in the tree with the wrong document.
+
+            * fast/parser/foster-parent-adopted-expected.txt: Added.
+            * fast/parser/foster-parent-adopted.html: Added.
+            * fast/parser/foster-parent-adopted2-expected.txt: Added.
+            * fast/parser/foster-parent-adopted2.html: Added.
+
+2013-03-12  Lucas Forschler  <[email protected]>
+
         Merge r140069
 
     2013-01-17  Abhishek Arya  <[email protected]>

Copied: branches/safari-536.30-branch/LayoutTests/fast/parser/foster-parent-adopted-expected.txt (from rev 140101, trunk/LayoutTests/fast/parser/foster-parent-adopted-expected.txt) (0 => 145660)


--- branches/safari-536.30-branch/LayoutTests/fast/parser/foster-parent-adopted-expected.txt	                        (rev 0)
+++ branches/safari-536.30-branch/LayoutTests/fast/parser/foster-parent-adopted-expected.txt	2013-03-13 01:31:11 UTC (rev 145660)
@@ -0,0 +1,3 @@
+This tests that when nodes are foster-parented after being adopted into another document, they are adopted back into the ownerDocument of their foster parent.
+
+PASS.

Copied: branches/safari-536.30-branch/LayoutTests/fast/parser/foster-parent-adopted.html (from rev 140101, trunk/LayoutTests/fast/parser/foster-parent-adopted.html) (0 => 145660)


--- branches/safari-536.30-branch/LayoutTests/fast/parser/foster-parent-adopted.html	                        (rev 0)
+++ branches/safari-536.30-branch/LayoutTests/fast/parser/foster-parent-adopted.html	2013-03-13 01:31:11 UTC (rev 145660)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+  <body>
+      <p>This tests that when nodes are foster-parented after being adopted into another document,
+          they are adopted back into the ownerDocument of their foster parent. </p>
+      <table>
+          <tr>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+var tr = document.querySelector('tr');
+var doc = document.implementation.createHTMLDocument();
+doc.adoptNode(tr);
+</script>
+              <div></div>
+          </tr>
+      </table>
+<script>
+var div = document.querySelector('div');
+if (div.ownerDocument === div.parentNode.ownerDocument)
+    document.body.appendChild(document.createTextNode('PASS.'));
+</script>
+    </body>
+</html>
\ No newline at end of file

Copied: branches/safari-536.30-branch/LayoutTests/fast/parser/foster-parent-adopted2-expected.txt (from rev 140101, trunk/LayoutTests/fast/parser/foster-parent-adopted2-expected.txt) (0 => 145660)


--- branches/safari-536.30-branch/LayoutTests/fast/parser/foster-parent-adopted2-expected.txt	                        (rev 0)
+++ branches/safari-536.30-branch/LayoutTests/fast/parser/foster-parent-adopted2-expected.txt	2013-03-13 01:31:11 UTC (rev 145660)
@@ -0,0 +1,3 @@
+This tests that when nodes are foster-parented after being adopted into another document, they are adopted back into the ownerDocument of their foster parent.
+
+PASS.

Copied: branches/safari-536.30-branch/LayoutTests/fast/parser/foster-parent-adopted2.html (from rev 140101, trunk/LayoutTests/fast/parser/foster-parent-adopted2.html) (0 => 145660)


--- branches/safari-536.30-branch/LayoutTests/fast/parser/foster-parent-adopted2.html	                        (rev 0)
+++ branches/safari-536.30-branch/LayoutTests/fast/parser/foster-parent-adopted2.html	2013-03-13 01:31:11 UTC (rev 145660)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+  <body>
+      <p>This tests that when nodes are foster-parented after being adopted into another document,
+          they are adopted back into the ownerDocument of their foster parent. </p>
+      <table>
+          <tr>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+var doc = document.implementation.createHTMLDocument();
+var div = document.createElement('div');
+doc.adoptNode(div);
+div.appendChild(document.querySelector('table'))
+</script>
+              <div id=fosterChild></div>
+          </tr>
+      </table>
+<script>
+var fosterChild = div.querySelector('#fosterChild');
+if (fosterChild.ownerDocument === fosterChild.parentNode.ownerDocument)
+    document.body.appendChild(document.createTextNode('PASS.'));
+</script>
+    </body>
+</html>
\ No newline at end of file

Modified: branches/safari-536.30-branch/Source/WebCore/ChangeLog (145659 => 145660)


--- branches/safari-536.30-branch/Source/WebCore/ChangeLog	2013-03-13 01:28:32 UTC (rev 145659)
+++ branches/safari-536.30-branch/Source/WebCore/ChangeLog	2013-03-13 01:31:11 UTC (rev 145660)
@@ -1,5 +1,23 @@
 2013-03-12  Lucas Forschler  <[email protected]>
 
+        Merge r140101
+
+    2013-01-17  Rafael Weinstein  <[email protected]>
+
+            Ensure the parser adopts foster-parented children into the document of their parent.
+            https://bugs.webkit.org/show_bug.cgi?id=107023
+
+            Reviewed by Adam Barth.
+
+            Tests: fast/parser/foster-parent-adopted.html
+                   fast/parser/foster-parent-adopted2.html
+
+            * html/parser/HTMLConstructionSite.cpp:
+            (WebCore::HTMLConstructionSite::insertTextNode):
+            (WebCore::HTMLConstructionSite::fosterParent):
+
+2013-03-12  Lucas Forschler  <[email protected]>
+
         Merge r140069
 
     2013-01-17  Abhishek Arya  <[email protected]>

Modified: branches/safari-536.30-branch/Source/WebCore/html/parser/HTMLConstructionSite.cpp (145659 => 145660)


--- branches/safari-536.30-branch/Source/WebCore/html/parser/HTMLConstructionSite.cpp	2013-03-13 01:28:32 UTC (rev 145659)
+++ branches/safari-536.30-branch/Source/WebCore/html/parser/HTMLConstructionSite.cpp	2013-03-13 01:31:11 UTC (rev 145660)
@@ -392,6 +392,10 @@
         currentPosition += textNode->length();
         ASSERT(currentPosition <= characters.length());
         task.child = textNode.release();
+
+        if (task.parent->document() != task.child->document())
+            task.parent->document()->adoptNode(task.child, ASSERT_NO_EXCEPTION);
+
         executeTask(task);
     }
 }
@@ -516,6 +520,10 @@
     findFosterSite(task);
     task.child = node;
     ASSERT(task.parent);
+
+    if (task.parent->document() != task.child->document())
+        task.parent->document()->adoptNode(task.child, ASSERT_NO_EXCEPTION);
+
     m_attachmentQueue.append(task);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to