Title: [250764] trunk
- Revision
- 250764
- Author
- [email protected]
- Date
- 2019-10-04 20:02:58 -0700 (Fri, 04 Oct 2019)
Log Message
Change "InvalidStateError" to "NotSupportedError" for attachShadow()
https://bugs.webkit.org/show_bug.cgi?id=197948
Reviewed by Wenson Hsieh.
LayoutTests/imported/w3c:
Rebaselined the tests.
* web-platform-tests/shadow-dom/Element-interface-attachShadow-custom-element-expected.txt:
* web-platform-tests/shadow-dom/Element-interface-attachShadow-expected.txt:
Source/WebCore:
Match the latest spec. See https://github.com/whatwg/dom/pull/761
* dom/Element.cpp:
(WebCore::Element::attachShadow): Throw NotSupportedError when there is already a shadow tree.
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (250763 => 250764)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2019-10-05 02:52:42 UTC (rev 250763)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2019-10-05 03:02:58 UTC (rev 250764)
@@ -1,3 +1,15 @@
+2019-10-04 Ryosuke Niwa <[email protected]>
+
+ Change "InvalidStateError" to "NotSupportedError" for attachShadow()
+ https://bugs.webkit.org/show_bug.cgi?id=197948
+
+ Reviewed by Wenson Hsieh.
+
+ Rebaselined the tests.
+
+ * web-platform-tests/shadow-dom/Element-interface-attachShadow-custom-element-expected.txt:
+ * web-platform-tests/shadow-dom/Element-interface-attachShadow-expected.txt:
+
2019-10-04 Joonghun Park <[email protected]>
Negative radii in radial gradients should be rejected.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/Element-interface-attachShadow-custom-element-expected.txt (250763 => 250764)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/Element-interface-attachShadow-custom-element-expected.txt 2019-10-05 02:52:42 UTC (rev 250763)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/Element-interface-attachShadow-custom-element-expected.txt 2019-10-05 03:02:58 UTC (rev 250764)
@@ -1,12 +1,12 @@
PASS Element.attachShadow must create an instance of ShadowRoot for autonomous custom elements
PASS Element.attachShadow must create an instance of ShadowRoot for undefined autonomous custom elements
-FAIL Element.attachShadow for an autonomous custom element with disabledFeatures=["shadow"] should throw a NotSupportedError assert_throws: No definition, host function "() => {
- element.attachShadow({mode: 'closed'});
- }" threw object "InvalidStateError: The object is in an invalid state." that is not a DOMException NotSupportedError: property "code" is equal to 11, expected 9
-FAIL Element.attachShadow for a customized built-in element with disabledFeatures=["shadow"] should throw a NotSupportedError assert_throws: No definition, host. function "() => {
- element.attachShadow({mode: 'closed'});
- }" threw object "InvalidStateError: The object is in an invalid state." that is not a DOMException NotSupportedError: property "code" is equal to 11, expected 9
+FAIL Element.attachShadow for an autonomous custom element with disabledFeatures=["shadow"] should throw a NotSupportedError assert_throws: Definition, not a host function "() => {
+ document.createElement('shadow-disabled-element').attachShadow({mode: 'closed'});
+ }" did not throw
+FAIL Element.attachShadow for a customized built-in element with disabledFeatures=["shadow"] should throw a NotSupportedError assert_throws: Definition, not a host function "() => {
+ h2.attachShadow({mode: 'closed'});
+ }" did not throw
PASS Element.attachShadow for a custom element with disabledFeatures=["SHADOW"] should not throw a NotSupportedError
PASS Element.attachShadow must throw a NotSupportedError for customized built-in elements
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/Element-interface-attachShadow-expected.txt (250763 => 250764)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/Element-interface-attachShadow-expected.txt 2019-10-05 02:52:42 UTC (rev 250763)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/Element-interface-attachShadow-expected.txt 2019-10-05 03:02:58 UTC (rev 250764)
@@ -3,10 +3,6 @@
PASS Nodes other than Element should not have attachShadow
PASS Element.attachShadow must throw a TypeError if mode is not "open" or "closed"
PASS Element.attachShadow must create an instance of ShadowRoot
-FAIL Element.attachShadow must throw a NotSupportedError if the context object already hosts a shadow tree assert_throws: Calling attachShadow({mode: "open"}) twice on the same element must throw function "function () {
- var div = document.createElement('div');
- div.attachShadow({mode: "open"});
- div.attachShadow({mode: "open"});
- }" threw object "InvalidStateError: The object is in an invalid state." ("InvalidStateError") expected object "[object Object]" ("NotSupportedError")
+PASS Element.attachShadow must throw a NotSupportedError if the context object already hosts a shadow tree
PASS Element.attachShadow must throw a NotSupportedError for non-safelisted elements
Modified: trunk/Source/WebCore/ChangeLog (250763 => 250764)
--- trunk/Source/WebCore/ChangeLog 2019-10-05 02:52:42 UTC (rev 250763)
+++ trunk/Source/WebCore/ChangeLog 2019-10-05 03:02:58 UTC (rev 250764)
@@ -1,3 +1,15 @@
+2019-10-04 Ryosuke Niwa <[email protected]>
+
+ Change "InvalidStateError" to "NotSupportedError" for attachShadow()
+ https://bugs.webkit.org/show_bug.cgi?id=197948
+
+ Reviewed by Wenson Hsieh.
+
+ Match the latest spec. See https://github.com/whatwg/dom/pull/761
+
+ * dom/Element.cpp:
+ (WebCore::Element::attachShadow): Throw NotSupportedError when there is already a shadow tree.
+
2019-10-04 Chris Dumez <[email protected]>
Allow pages using EventSource to enter the back/forward cache
Modified: trunk/Source/WebCore/dom/Element.cpp (250763 => 250764)
--- trunk/Source/WebCore/dom/Element.cpp 2019-10-05 02:52:42 UTC (rev 250763)
+++ trunk/Source/WebCore/dom/Element.cpp 2019-10-05 03:02:58 UTC (rev 250764)
@@ -2317,7 +2317,7 @@
if (!canAttachAuthorShadowRoot(*this))
return Exception { NotSupportedError };
if (shadowRoot())
- return Exception { InvalidStateError };
+ return Exception { NotSupportedError };
if (init.mode == ShadowRootMode::UserAgent)
return Exception { TypeError };
auto shadow = ShadowRoot::create(document(), init.mode);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes