Changeset 202893 in webkit
- Timestamp:
- Jul 6, 2016, 9:14:28 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/dom/document-set-body-expected.txt (modified) (1 diff)
-
LayoutTests/fast/dom/document-set-body-null-expected.txt (added)
-
LayoutTests/fast/dom/document-set-body-null.html (added)
-
LayoutTests/fast/dom/document-set-body.html (modified) (2 diffs)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/Document.body-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Document.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r202887 r202893 1 2016-07-06 Chris Dumez <cdumez@apple.com> 2 3 Align Document.body setter with the HTML specification 4 https://bugs.webkit.org/show_bug.cgi?id=159490 5 6 Reviewed by Alex Christensen. 7 8 Update existing test that was setting a document's body to another frame's body 9 as it was expecting the body element to get cloned rather than adopted / transferred. 10 11 * fast/dom/document-set-body-expected.txt: 12 * fast/dom/document-set-body.html: 13 1 14 2016-07-06 Brent Fulgham <bfulgham@apple.com> 2 15 -
trunk/LayoutTests/fast/dom/document-set-body-expected.txt
r134435 r202893 1 Tests setting document.body 1 Tests setting document.body to another frame's body 2 2 3 3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". 4 4 5 5 6 PASS document1.body = iframe1 threw exception Error: HierarchyRequestError: DOM Exception 3.7 PASS iframe1.parentNode is document.body8 PASS document 1.body = document1.createElement('iframe') threw exception Error: HierarchyRequestError: DOM Exception 3.9 PASS document 1.body != document.body is true10 PASS document1.body is body16 PASS document1.body is not null 7 PASS document2.body is null 8 PASS document2.body = document1.body did not throw exception. 9 PASS document2.body is not null 10 PASS document1.body is null 11 11 PASS successfullyParsed is true 12 12 13 13 TEST COMPLETE 14 14 -
trunk/LayoutTests/fast/dom/document-set-body.html
r155265 r202893 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">1 <!DOCTYPE html> 2 2 <html> 3 3 <head> … … 5 5 </head> 6 6 <body> 7 <iframe id="testFrame1" srcdoc="<html><body></body></html>"></iframe> 8 <iframe id="testFrame2" srcdoc="<html></html>"></iframe> 7 9 <script> 8 description("Tests setting document.body ");10 description("Tests setting document.body to another frame's body"); 9 11 10 iframe1 = document.createElement('iframe'); 11 document.body.appendChild(iframe1); 12 document1 = iframe1.contentDocument.implementation.createHTMLDocument("document"); 12 var document1 = document.getElementById("testFrame1").contentDocument; 13 var document2 = document.getElementById("testFrame2").contentDocument; 14 if (document2.body) 15 document2.documentElement.removeChild(document2.body); 13 16 14 should Throw("document1.body = iframe1", "'Error: HierarchyRequestError: DOM Exception 3'");15 shouldBe ("iframe1.parentNode", "document.body");17 shouldNotBe("document1.body", "null"); 18 shouldBeNull("document2.body"); 16 19 17 should Throw("document1.body = document1.createElement('iframe')", "'Error: HierarchyRequestError: DOM Exception 3'");20 shouldNotThrow("document2.body = document1.body"); 18 21 19 document1.body = document.body;20 shouldBe True("document1.body != document.body");22 shouldNotBe("document2.body", "null"); 23 shouldBeNull("document1.body"); 21 24 22 body1 = document1.createElement('body');23 document1.body = body1;24 shouldBe("document1.body", "body1")25 25 </script> 26 26 <script src="../../resources/js-test-post.js"></script> -
trunk/LayoutTests/imported/w3c/ChangeLog
r202881 r202893 1 2016-07-06 Chris Dumez <cdumez@apple.com> 2 3 Align Document.body setter with the HTML specification 4 https://bugs.webkit.org/show_bug.cgi?id=159490 5 6 Reviewed by Alex Christensen. 7 8 Rebaseline existing W3C test now that one more check is passing. 9 10 * web-platform-tests/html/dom/documents/dom-tree-accessors/Document.body-expected.txt: 11 1 12 2016-07-06 Chris Dumez <cdumez@apple.com> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/documents/dom-tree-accessors/Document.body-expected.txt
r202881 r202893 21 21 PASS Setting document.body when there's no root element. 22 22 PASS Setting document.body to a new body element. 23 FAIL Setting document.body to a new frameset element. HierarchyRequestError: DOM Exception 3 23 PASS Setting document.body to a new frameset element. 24 24 -
trunk/Source/WebCore/ChangeLog
r202892 r202893 1 2016-07-06 Chris Dumez <cdumez@apple.com> 2 3 Align Document.body setter with the HTML specification 4 https://bugs.webkit.org/show_bug.cgi?id=159490 5 6 Reviewed by Alex Christensen. 7 8 Align Document.body setter with the HTML specification: 9 - https://html.spec.whatwg.org/multipage/dom.html#dom-document-body 10 11 In particular, the following web-exposed changes were made: 12 - It is now possible to set document.body to a frameset element. 13 - We no longer call importNode() on the passed in body. Therefore, 14 if the body comes from another document, its will be adopted / 15 transferred rather than cloned. 16 17 Both changes match the behavior of Firefox and Chrome. 18 19 No new tests, updated / rebaselined existing tests. 20 21 * dom/Document.cpp: 22 (WebCore::Document::setBodyOrFrameset): 23 1 24 2016-07-06 Brady Eidson <beidson@apple.com> 2 25 -
trunk/Source/WebCore/dom/Document.cpp
r202881 r202893 2625 2625 void Document::setBodyOrFrameset(RefPtr<HTMLElement>&& newBody, ExceptionCode& ec) 2626 2626 { 2627 // FIXME: This does not support setting a <frameset> Element, only a <body>. This does 2628 // not match the HTML specification: 2629 // https://html.spec.whatwg.org/multipage/dom.html#dom-document-body 2630 if (!newBody || !documentElement() || !newBody->hasTagName(bodyTag)) { 2627 if (!is<HTMLBodyElement>(newBody.get()) && !is<HTMLFrameSetElement>(newBody.get())) { 2631 2628 ec = HIERARCHY_REQUEST_ERR; 2632 2629 return; 2633 2630 } 2634 2631 2635 if (&newBody->document() != this) { 2636 ec = 0; 2637 RefPtr<Node> node = importNode(*newBody, true, ec); 2638 if (ec) 2639 return; 2640 2641 newBody = downcast<HTMLElement>(node.get()); 2642 } 2643 2644 if (auto* body = bodyOrFrameset()) 2645 documentElement()->replaceChild(*newBody, *body, ec); 2646 else 2647 documentElement()->appendChild(*newBody, ec); 2632 auto* currentBody = bodyOrFrameset(); 2633 if (newBody == currentBody) 2634 return; 2635 2636 if (currentBody) { 2637 documentElement()->replaceChild(*newBody, *currentBody, ec); 2638 return; 2639 } 2640 2641 if (!documentElement()) { 2642 ec = HIERARCHY_REQUEST_ERR; 2643 return; 2644 } 2645 2646 documentElement()->appendChild(*newBody, ec); 2648 2647 } 2649 2648
Note:
See TracChangeset
for help on using the changeset viewer.