Skip to content
Permalink
Browse files
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.


Canonical link: https://commits.webkit.org/113715@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@127580 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
omo committed Sep 5, 2012
1 parent f3936ba commit e7f51d3c64ecaea0943158bc71f4a26f6363cc52
Showing 7 changed files with 76 additions and 0 deletions.
@@ -1,3 +1,13 @@
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()
@@ -0,0 +1,10 @@
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

@@ -0,0 +1,16 @@
<!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>
@@ -1,3 +1,27 @@
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 @@ class ShadowRoot : public DocumentFragment, public TreeScope, public DoublyLinke
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);

0 comments on commit e7f51d3

Please sign in to comment.