Title: [127580] trunk
Revision
127580
Author
morr...@google.com
Date
2012-09-05 05:09:07 -0700 (Wed, 05 Sep 2012)

Log Message

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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (127579 => 127580)


--- trunk/LayoutTests/ChangeLog	2012-09-05 11:53:40 UTC (rev 127579)
+++ trunk/LayoutTests/ChangeLog	2012-09-05 12:09:07 UTC (rev 127580)
@@ -1,3 +1,13 @@
+2012-09-05  MORITA Hajime  <morr...@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.du...@intel.com>
 
         WKTR doesn't implement dumpWillCacheResponse()

Added: trunk/LayoutTests/fast/dom/shadow/shadowroot-clonenode-expected.txt (0 => 127580)


--- trunk/LayoutTests/fast/dom/shadow/shadowroot-clonenode-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadowroot-clonenode-expected.txt	2012-09-05 12:09:07 UTC (rev 127580)
@@ -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
+

Added: trunk/LayoutTests/fast/dom/shadow/shadowroot-clonenode.html (0 => 127580)


--- trunk/LayoutTests/fast/dom/shadow/shadowroot-clonenode.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/shadowroot-clonenode.html	2012-09-05 12:09:07 UTC (rev 127580)
@@ -0,0 +1,16 @@
+<!DOCTYPE>
+<html>
+<script src=""
+<script src=""
+
+<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=""
+</html>

Modified: trunk/Source/WebCore/ChangeLog (127579 => 127580)


--- trunk/Source/WebCore/ChangeLog	2012-09-05 11:53:40 UTC (rev 127579)
+++ trunk/Source/WebCore/ChangeLog	2012-09-05 12:09:07 UTC (rev 127580)
@@ -1,3 +1,27 @@
+2012-09-05  MORITA Hajime  <morr...@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.hausm...@nokia.com>
 
         [Qt] Unreviewed trivial build fix: Use DOMAllInOne.cpp only if we have xslt available.

Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (127579 => 127580)


--- trunk/Source/WebCore/dom/ShadowRoot.cpp	2012-09-05 11:53:40 UTC (rev 127579)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp	2012-09-05 12:09:07 UTC (rev 127580)
@@ -145,6 +145,17 @@
     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);

Modified: trunk/Source/WebCore/dom/ShadowRoot.h (127579 => 127580)


--- trunk/Source/WebCore/dom/ShadowRoot.h	2012-09-05 11:53:40 UTC (rev 127579)
+++ trunk/Source/WebCore/dom/ShadowRoot.h	2012-09-05 12:09:07 UTC (rev 127580)
@@ -93,6 +93,8 @@
     ShadowRootType type() const { return m_type; }
 #endif
 
+    PassRefPtr<Node> cloneNode(bool, ExceptionCode&);
+
 private:
     explicit ShadowRoot(Document*);
     virtual ~ShadowRoot();

Modified: trunk/Source/WebCore/dom/ShadowRoot.idl (127579 => 127580)


--- trunk/Source/WebCore/dom/ShadowRoot.idl	2012-09-05 11:53:40 UTC (rev 127579)
+++ trunk/Source/WebCore/dom/ShadowRoot.idl	2012-09-05 12:09:07 UTC (rev 127580)
@@ -39,6 +39,9 @@
         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);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to