diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 453772a9674bfda487ff680f11735d4989eafdf4..3a695e25e2f928e7d29008a23b2365a0a1e693e9 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,13 @@ +2012-09-05 MORITA Hajime + + 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 WKTR doesn't implement dumpWillCacheResponse() diff --git a/LayoutTests/fast/dom/shadow/shadowroot-clonenode-expected.txt b/LayoutTests/fast/dom/shadow/shadowroot-clonenode-expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..6398b887636c2ccf118ff687fe37b267e4a7c61a --- /dev/null +++ b/LayoutTests/fast/dom/shadow/shadowroot-clonenode-expected.txt @@ -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 + diff --git a/LayoutTests/fast/dom/shadow/shadowroot-clonenode.html b/LayoutTests/fast/dom/shadow/shadowroot-clonenode.html new file mode 100644 index 0000000000000000000000000000000000000000..8f29d373f8c965baa511f6e2268b934b3251d7d3 --- /dev/null +++ b/LayoutTests/fast/dom/shadow/shadowroot-clonenode.html @@ -0,0 +1,16 @@ + + + + + +

+
+
+
+
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 7d2221cc733770c312d587717cfee0e5c47ce6eb..274d39d8ec06b31297c3cbf8c032824e13d6f220 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2012-09-05  MORITA Hajime  
+
+        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  
 
         [Qt] Unreviewed trivial build fix: Use DOMAllInOne.cpp only if we have xslt available.
diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp
index 5daf7641e4a8a0f5ca438317a7f266633e6e2265..6b73068c71cc52663077e10b5d5b75989fa2d50c 100644
--- a/Source/WebCore/dom/ShadowRoot.cpp
+++ b/Source/WebCore/dom/ShadowRoot.cpp
@@ -145,6 +145,17 @@ PassRefPtr ShadowRoot::cloneNode(bool)
     return 0;
 }
 
+PassRefPtr ShadowRoot::cloneNode(bool deep, ExceptionCode& ec)
+{
+    RefPtr clone = cloneNode(deep);
+    if (!clone) {
+        ec = DATA_CLONE_ERR;
+        return 0;
+    }
+
+    return clone;
+}
+
 String ShadowRoot::innerHTML() const
 {
     return createMarkup(this, ChildrenOnly);
diff --git a/Source/WebCore/dom/ShadowRoot.h b/Source/WebCore/dom/ShadowRoot.h
index d9b425c6083b17af8826e61642781f5525075250..6f7009d091c6979dbbddeb56362833fe4cbd6593 100644
--- a/Source/WebCore/dom/ShadowRoot.h
+++ b/Source/WebCore/dom/ShadowRoot.h
@@ -93,6 +93,8 @@ public:
     ShadowRootType type() const { return m_type; }
 #endif
 
+    PassRefPtr cloneNode(bool, ExceptionCode&);
+
 private:
     explicit ShadowRoot(Document*);
     virtual ~ShadowRoot();
diff --git a/Source/WebCore/dom/ShadowRoot.idl b/Source/WebCore/dom/ShadowRoot.idl
index c04c3e15d50e6c84748a53b63f126fa2a38b244f..9e9932349865aec2307d7268caf75564177b0234 100644
--- a/Source/WebCore/dom/ShadowRoot.idl
+++ b/Source/WebCore/dom/ShadowRoot.idl
@@ -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);