Title: [92910] branches/safari-534.51-branch
- Revision
- 92910
- Author
- [email protected]
- Date
- 2011-08-11 21:08:38 -0700 (Thu, 11 Aug 2011)
Log Message
Merge r87863.
Modified Paths
Added Paths
Diff
Modified: branches/safari-534.51-branch/LayoutTests/ChangeLog (92909 => 92910)
--- branches/safari-534.51-branch/LayoutTests/ChangeLog 2011-08-12 03:41:48 UTC (rev 92909)
+++ branches/safari-534.51-branch/LayoutTests/ChangeLog 2011-08-12 04:08:38 UTC (rev 92910)
@@ -1,3 +1,18 @@
+2011-08-11 Lucas Forschler <[email protected]>
+
+ Merged 87863
+
+ 2011-06-01 Abhishek Arya <[email protected]>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Tests setting document.body to non body elements, elements in other
+ documents.
+ https://bugs.webkit.org/show_bug.cgi?id=60831
+
+ * fast/dom/document-set-body-expected.txt: Added.
+ * fast/dom/document-set-body.html: Added.
+
2011-08-09 Gavin Barraclough <[email protected]>
Reviewed by nobody.
Copied: branches/safari-534.51-branch/LayoutTests/fast/dom/document-set-body-expected.txt (from rev 87863, trunk/LayoutTests/fast/dom/document-set-body-expected.txt) (0 => 92910)
--- branches/safari-534.51-branch/LayoutTests/fast/dom/document-set-body-expected.txt (rev 0)
+++ branches/safari-534.51-branch/LayoutTests/fast/dom/document-set-body-expected.txt 2011-08-12 04:08:38 UTC (rev 92910)
@@ -0,0 +1,11 @@
+Tests setting document.body
+
+PASS document1.body = iframe1 threw exception Error: HIERARCHY_REQUEST_ERR: DOM Exception 3.
+PASS iframe1.parentNode is document.body
+PASS document1.body = document1.createElement('iframe') threw exception Error: HIERARCHY_REQUEST_ERR: DOM Exception 3.
+PASS document1.body != document.body is true
+PASS document1.body is body1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Copied: branches/safari-534.51-branch/LayoutTests/fast/dom/document-set-body.html (from rev 87863, trunk/LayoutTests/fast/dom/document-set-body.html) (0 => 92910)
--- branches/safari-534.51-branch/LayoutTests/fast/dom/document-set-body.html (rev 0)
+++ branches/safari-534.51-branch/LayoutTests/fast/dom/document-set-body.html 2011-08-12 04:08:38 UTC (rev 92910)
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p>Tests setting document.body</p>
+<div id="console"></div>
+<script>
+iframe1 = document.createElement('iframe');
+document.body.appendChild(iframe1);
+document1 = iframe1.contentDocument.implementation.createHTMLDocument("document");
+
+shouldThrow("document1.body = iframe1", "'Error: HIERARCHY_REQUEST_ERR: DOM Exception 3'");
+shouldBe("iframe1.parentNode", "document.body");
+
+shouldThrow("document1.body = document1.createElement('iframe')", "'Error: HIERARCHY_REQUEST_ERR: DOM Exception 3'");
+
+document1.body = document.body;
+shouldBeTrue("document1.body != document.body");
+
+body1 = document1.createElement('body');
+document1.body = body1;
+shouldBe("document1.body", "body1")
+
+var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Modified: branches/safari-534.51-branch/Source/WebCore/ChangeLog (92909 => 92910)
--- branches/safari-534.51-branch/Source/WebCore/ChangeLog 2011-08-12 03:41:48 UTC (rev 92909)
+++ branches/safari-534.51-branch/Source/WebCore/ChangeLog 2011-08-12 04:08:38 UTC (rev 92910)
@@ -1,3 +1,22 @@
+2011-08-11 Lucas Forschler <[email protected]>
+
+ Merged 87863
+
+ 2011-06-01 Abhishek Arya <[email protected]>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Fix setting of document.body
+ https://bugs.webkit.org/show_bug.cgi?id=60831
+
+ 1. Only allowing setting to an element if it has a body tag.
+ 2. If element is from another document, import it.
+
+ Test: fast/dom/document-set-body.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::setBody):
+
2011-08-09 Gavin Barraclough <[email protected]>
Reviewed by nobody.
Modified: branches/safari-534.51-branch/Source/WebCore/dom/Document.cpp (92909 => 92910)
--- branches/safari-534.51-branch/Source/WebCore/dom/Document.cpp 2011-08-12 03:41:48 UTC (rev 92909)
+++ branches/safari-534.51-branch/Source/WebCore/dom/Document.cpp 2011-08-12 04:08:38 UTC (rev 92910)
@@ -2016,11 +2016,21 @@
void Document::setBody(PassRefPtr<HTMLElement> newBody, ExceptionCode& ec)
{
- if (!newBody || !documentElement()) {
+ ec = 0;
+
+ if (!newBody || !documentElement() || !newBody->hasTagName(bodyTag)) {
ec = HIERARCHY_REQUEST_ERR;
return;
}
+ if (newBody->document() && newBody->document() != this) {
+ RefPtr<Node> node = importNode(newBody.get(), true, ec);
+ if (ec)
+ return;
+
+ newBody = toHTMLElement(node.get());
+ }
+
HTMLElement* b = body();
if (!b)
documentElement()->appendChild(newBody, ec);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes