Commit 3fb96f93 authored by morrita@google.com's avatar morrita@google.com

ShadowRoot.cloneNode() must always throw a DATA_CLONE_ERR exception.

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

Reviewed by Kentaro Hara.

Source/WebCore:

This change implement ShadowRoot::cloneNode() which throws an exception.
This also adds an overloaded version cloneNode() to ShadowRoot.idl
which is enabled only for JavaScript instead of changing the
signature of Node::cloneNode().

Note that changing the existing signature can break GObject bindings
compatibility.

Test: fast/dom/shadow/shadowroot-clonenode.html

* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::cloneNode):
(WebCore):
* dom/ShadowRoot.h:
(ShadowRoot):
* dom/ShadowRoot.idl:

LayoutTests:

* fast/dom/shadow/shadowroot-clonenode-expected.txt: Added.
* fast/dom/shadow/shadowroot-clonenode.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127580 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent e0e01c89
2012-09-05 MORITA Hajime <morrita@google.com>
ShadowRoot.cloneNode() must always throw a DATA_CLONE_ERR exception.
https://bugs.webkit.org/show_bug.cgi?id=91704
Reviewed by Kentaro Hara.
* fast/dom/shadow/shadowroot-clonenode-expected.txt: Added.
* fast/dom/shadow/shadowroot-clonenode.html: Added.
2012-09-05 Christophe Dumez <christophe.dumez@intel.com>
WKTR doesn't implement dumpWillCacheResponse()
Calling ShadowRoot.cloneNode() should throw a DATA_CLONE_ERR exception.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS shadowRoot.cloneNode() threw exception Error: DATA_CLONE_ERR: DOM Exception 25.
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE>
<html>
<script src="../../js/resources/js-test-pre.js"></script>
<script src="resources/polyfill.js"></script>
<pre id="console"></pre>
<script>
description('Calling ShadowRoot.cloneNode() should throw a DATA_CLONE_ERR exception.');
var host = document.createElement('div');
var shadowRoot = new WebKitShadowRoot(host);
shouldThrow('shadowRoot.cloneNode()', '"Error: DATA_CLONE_ERR: DOM Exception 25"');
</script>
<script src="../../js/resources/js-test-post.js"></script>
</html>
2012-09-05 MORITA Hajime <morrita@google.com>
ShadowRoot.cloneNode() must always throw a DATA_CLONE_ERR exception.
https://bugs.webkit.org/show_bug.cgi?id=91704
Reviewed by Kentaro Hara.
This change implement ShadowRoot::cloneNode() which throws an exception.
This also adds an overloaded version cloneNode() to ShadowRoot.idl
which is enabled only for JavaScript instead of changing the
signature of Node::cloneNode().
Note that changing the existing signature can break GObject bindings
compatibility.
Test: fast/dom/shadow/shadowroot-clonenode.html
* dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::cloneNode):
(WebCore):
* dom/ShadowRoot.h:
(ShadowRoot):
* dom/ShadowRoot.idl:
2012-09-05 Simon Hausmann <simon.hausmann@nokia.com>
[Qt] Unreviewed trivial build fix: Use DOMAllInOne.cpp only if we have xslt available.
......@@ -145,6 +145,17 @@ PassRefPtr<Node> ShadowRoot::cloneNode(bool)
return 0;
}
PassRefPtr<Node> ShadowRoot::cloneNode(bool deep, ExceptionCode& ec)
{
RefPtr<Node> clone = cloneNode(deep);
if (!clone) {
ec = DATA_CLONE_ERR;
return 0;
}
return clone;
}
String ShadowRoot::innerHTML() const
{
return createMarkup(this, ChildrenOnly);
......
......@@ -93,6 +93,8 @@ public:
ShadowRootType type() const { return m_type; }
#endif
PassRefPtr<Node> cloneNode(bool, ExceptionCode&);
private:
explicit ShadowRoot(Document*);
virtual ~ShadowRoot();
......
......@@ -39,6 +39,9 @@ module core {
attribute [TreatNullAs=NullString] DOMString innerHTML
setter raises(DOMException);
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
Node cloneNode(in [Optional=DefaultIsUndefined] boolean deep) raises(DOMException);
#endif
DOMSelection getSelection();
Element getElementById(in [Optional=DefaultIsUndefined] DOMString elementId);
NodeList getElementsByClassName(in [Optional=DefaultIsUndefined] DOMString className);
......
Markdown is supported
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