Title: [141143] branches/chromium/1364
- Revision
- 141143
- Author
- [email protected]
- Date
- 2013-01-29 12:37:36 -0800 (Tue, 29 Jan 2013)
Log Message
Merge 140101
BUG=170381
Review URL: https://codereview.chromium.org/12088052
Modified Paths
Added Paths
Diff
Copied: branches/chromium/1364/LayoutTests/fast/parser/foster-parent-adopted-expected.txt (from rev 140101, trunk/LayoutTests/fast/parser/foster-parent-adopted-expected.txt) (0 => 141143)
--- branches/chromium/1364/LayoutTests/fast/parser/foster-parent-adopted-expected.txt (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/parser/foster-parent-adopted-expected.txt 2013-01-29 20:37:36 UTC (rev 141143)
@@ -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/chromium/1364/LayoutTests/fast/parser/foster-parent-adopted.html (from rev 140101, trunk/LayoutTests/fast/parser/foster-parent-adopted.html) (0 => 141143)
--- branches/chromium/1364/LayoutTests/fast/parser/foster-parent-adopted.html (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/parser/foster-parent-adopted.html 2013-01-29 20:37:36 UTC (rev 141143)
@@ -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/chromium/1364/LayoutTests/fast/parser/foster-parent-adopted2-expected.txt (from rev 140101, trunk/LayoutTests/fast/parser/foster-parent-adopted2-expected.txt) (0 => 141143)
--- branches/chromium/1364/LayoutTests/fast/parser/foster-parent-adopted2-expected.txt (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/parser/foster-parent-adopted2-expected.txt 2013-01-29 20:37:36 UTC (rev 141143)
@@ -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/chromium/1364/LayoutTests/fast/parser/foster-parent-adopted2.html (from rev 140101, trunk/LayoutTests/fast/parser/foster-parent-adopted2.html) (0 => 141143)
--- branches/chromium/1364/LayoutTests/fast/parser/foster-parent-adopted2.html (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/parser/foster-parent-adopted2.html 2013-01-29 20:37:36 UTC (rev 141143)
@@ -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/chromium/1364/Source/WebCore/html/parser/HTMLConstructionSite.cpp (141142 => 141143)
--- branches/chromium/1364/Source/WebCore/html/parser/HTMLConstructionSite.cpp 2013-01-29 20:32:51 UTC (rev 141142)
+++ branches/chromium/1364/Source/WebCore/html/parser/HTMLConstructionSite.cpp 2013-01-29 20:37:36 UTC (rev 141143)
@@ -391,6 +391,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);
}
}
@@ -522,6 +526,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