Commit 73798565 authored by morrita@google.com's avatar morrita@google.com
Browse files

ShadowRoot shouldn't be adopted by any Document.

https://bugs.webkit.org/show_bug.cgi?id=84127

Reviewed by Dimitri Glazkov.

Source/WebCore:

ShadowRoot cannot cannot be removed from its host, which means
ShadowRoot cannot be adopted by any Document directly because the
adoptNode() tries to remove it from its parent but it doesn't make
sense for ShadowRoot.

This change adds a guard to check such a case.

Test: fast/dom/shadow/adopt-node-with-shadow-root.html

* dom/Document.cpp:
(WebCore::Document::adoptNode):

LayoutTests:

* fast/dom/shadow/adopt-node-with-shadow-root-expected.txt: Added.
* fast/dom/shadow/adopt-node-with-shadow-root.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114481 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6cff29fa
2012-04-17 MORITA Hajime <morrita@google.com>
ShadowRoot shouldn't be adopted by any Document.
https://bugs.webkit.org/show_bug.cgi?id=84127
Reviewed by Dimitri Glazkov.
* fast/dom/shadow/adopt-node-with-shadow-root-expected.txt: Added.
* fast/dom/shadow/adopt-node-with-shadow-root.html: Added.
2012-04-17 Jer Noble <jer.noble@apple.com>
 
REGRESSION (r114406-r114417): media/video-playing-and-pause.html failing on Lion Release (WebKit2 Tests)
PASS successfullyParsed is true
TEST COMPLETE
PASS document.adoptNode(shadow) threw exception Error: HIERARCHY_REQUEST_ERR: DOM Exception 3.
<!DOCTYPE html>
<html>
<head>
<script src="../../js/resources/js-test-pre.js"></script>
</head>
<body>
<div id="console"></div>
<object data="data:image/svg+xml;base64,PFNWR1Rlc3RDYXNlIGlkPSJzIj4=" id="root" onload="test()"/>
<script>
function test() {
var foreignDocument = document.getElementById('root').contentDocument;
shadow = new WebKitShadowRoot(foreignDocument.getElementById('s'));
shouldThrow("document.adoptNode(shadow)");
location.reload();
}
</script>
<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
2012-04-17 MORITA Hajime <morrita@google.com>
ShadowRoot shouldn't be adopted by any Document.
https://bugs.webkit.org/show_bug.cgi?id=84127
Reviewed by Dimitri Glazkov.
ShadowRoot cannot cannot be removed from its host, which means
ShadowRoot cannot be adopted by any Document directly because the
adoptNode() tries to remove it from its parent but it doesn't make
sense for ShadowRoot.
This change adds a guard to check such a case.
Test: fast/dom/shadow/adopt-node-with-shadow-root.html
* dom/Document.cpp:
(WebCore::Document::adoptNode):
2012-04-17 John Bauman <jbauman@chromium.org>
 
[chromium] Ensure RateLimiter waits for Swapbuffers completion
......@@ -978,6 +978,12 @@ PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec)
break;
}
default:
if (source->isShadowRoot()) {
// ShadowRoot cannot disconnect itself from the host node.
ec = HIERARCHY_REQUEST_ERR;
return 0;
}
// FIXME: What about <frame> and <object>?
if (source->hasTagName(iframeTag)) {
HTMLIFrameElement* iframe = static_cast<HTMLIFrameElement*>(source.get());
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment