Modified: trunk/LayoutTests/imported/w3c/ChangeLog (294162 => 294163)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-05-13 17:21:06 UTC (rev 294162)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-05-13 17:25:12 UTC (rev 294163)
@@ -1,3 +1,13 @@
+2022-05-13 Ziran Sun <[email protected]>
+
+ input.showPicker() should throw when input is readonly/disabled
+ https://bugs.webkit.org/show_bug.cgi?id=240302
+
+ Reviewed by Tim Nguyen.
+
+ * web-platform-tests/html/semantics/forms/the-input-element/show-picker-disabled-readonly-expected.txt: Added.
+ * web-platform-tests/html/semantics/forms/the-input-element/show-picker-disabled-readonly.html: Added.
+
2022-05-13 Tim Nguyen <[email protected]>
Clean up some html/semantics/forms/ test expectations
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/show-picker-disabled-readonly-expected.txt (294162 => 294163)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/show-picker-disabled-readonly-expected.txt 2022-05-13 17:21:06 UTC (rev 294162)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/show-picker-disabled-readonly-expected.txt 2022-05-13 17:25:12 UTC (rev 294163)
@@ -1,46 +1,46 @@
-FAIL input[type=button] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=checkbox] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=color] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=date] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=datetime-local] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=email] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=file] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=hidden] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=image] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=month] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=number] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=password] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=radio] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=range] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=reset] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=search] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=submit] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=tel] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=text] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=time] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=url] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=week] showPicker() throws when disabled assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-PASS input[type=button] showPicker() doesn't throw when readonly
-PASS input[type=checkbox] showPicker() doesn't throw when readonly
-PASS input[type=color] showPicker() doesn't throw when readonly
-FAIL input[type=date] showPicker() throws when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=datetime-local] showPicker() throws when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=email] showPicker() throws when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-PASS input[type=file] showPicker() doesn't throw when readonly
-PASS input[type=hidden] showPicker() doesn't throw when readonly
-PASS input[type=image] showPicker() doesn't throw when readonly
-FAIL input[type=month] showPicker() throws when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=number] showPicker() throws when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=password] showPicker() throws when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-PASS input[type=radio] showPicker() doesn't throw when readonly
-PASS input[type=range] showPicker() doesn't throw when readonly
-PASS input[type=reset] showPicker() doesn't throw when readonly
-FAIL input[type=search] showPicker() throws when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-PASS input[type=submit] showPicker() doesn't throw when readonly
-FAIL input[type=tel] showPicker() throws when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=text] showPicker() throws when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=time] showPicker() throws when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=url] showPicker() throws when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
-FAIL input[type=week] showPicker() throws when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "NotAllowedError: Input showPicker() requires a user gesture." that is not a DOMException InvalidStateError: property "code" is equal to 0, expected 11
+PASS input[type=button] showPicker() throws when disabled
+PASS input[type=checkbox] showPicker() throws when disabled
+PASS input[type=color] showPicker() throws when disabled
+PASS input[type=date] showPicker() throws when disabled
+PASS input[type=datetime-local] showPicker() throws when disabled
+PASS input[type=email] showPicker() throws when disabled
+PASS input[type=file] showPicker() throws when disabled
+PASS input[type=hidden] showPicker() throws when disabled
+PASS input[type=image] showPicker() throws when disabled
+PASS input[type=month] showPicker() throws when disabled
+PASS input[type=number] showPicker() throws when disabled
+PASS input[type=password] showPicker() throws when disabled
+PASS input[type=radio] showPicker() throws when disabled
+PASS input[type=range] showPicker() throws when disabled
+PASS input[type=reset] showPicker() throws when disabled
+PASS input[type=search] showPicker() throws when disabled
+PASS input[type=submit] showPicker() throws when disabled
+PASS input[type=tel] showPicker() throws when disabled
+PASS input[type=text] showPicker() throws when disabled
+PASS input[type=time] showPicker() throws when disabled
+PASS input[type=url] showPicker() throws when disabled
+PASS input[type=week] showPicker() throws when disabled
+FAIL input[type=button] showPicker() doesn't throw when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "InvalidStateError: Input showPicker() cannot be used on immutable controls." that is not a DOMException NotAllowedError: property "code" is equal to 11, expected 0
+FAIL input[type=checkbox] showPicker() doesn't throw when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "InvalidStateError: Input showPicker() cannot be used on immutable controls." that is not a DOMException NotAllowedError: property "code" is equal to 11, expected 0
+FAIL input[type=color] showPicker() doesn't throw when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "InvalidStateError: Input showPicker() cannot be used on immutable controls." that is not a DOMException NotAllowedError: property "code" is equal to 11, expected 0
+PASS input[type=date] showPicker() throws when readonly
+PASS input[type=datetime-local] showPicker() throws when readonly
+PASS input[type=email] showPicker() throws when readonly
+FAIL input[type=file] showPicker() doesn't throw when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "InvalidStateError: Input showPicker() cannot be used on immutable controls." that is not a DOMException NotAllowedError: property "code" is equal to 11, expected 0
+FAIL input[type=hidden] showPicker() doesn't throw when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "InvalidStateError: Input showPicker() cannot be used on immutable controls." that is not a DOMException NotAllowedError: property "code" is equal to 11, expected 0
+FAIL input[type=image] showPicker() doesn't throw when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "InvalidStateError: Input showPicker() cannot be used on immutable controls." that is not a DOMException NotAllowedError: property "code" is equal to 11, expected 0
+PASS input[type=month] showPicker() throws when readonly
+PASS input[type=number] showPicker() throws when readonly
+PASS input[type=password] showPicker() throws when readonly
+FAIL input[type=radio] showPicker() doesn't throw when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "InvalidStateError: Input showPicker() cannot be used on immutable controls." that is not a DOMException NotAllowedError: property "code" is equal to 11, expected 0
+FAIL input[type=range] showPicker() doesn't throw when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "InvalidStateError: Input showPicker() cannot be used on immutable controls." that is not a DOMException NotAllowedError: property "code" is equal to 11, expected 0
+FAIL input[type=reset] showPicker() doesn't throw when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "InvalidStateError: Input showPicker() cannot be used on immutable controls." that is not a DOMException NotAllowedError: property "code" is equal to 11, expected 0
+PASS input[type=search] showPicker() throws when readonly
+FAIL input[type=submit] showPicker() doesn't throw when readonly assert_throws_dom: function "() => { input.showPicker(); }" threw object "InvalidStateError: Input showPicker() cannot be used on immutable controls." that is not a DOMException NotAllowedError: property "code" is equal to 11, expected 0
+PASS input[type=tel] showPicker() throws when readonly
+PASS input[type=text] showPicker() throws when readonly
+PASS input[type=time] showPicker() throws when readonly
+PASS input[type=url] showPicker() throws when readonly
+PASS input[type=week] showPicker() throws when readonly
Modified: trunk/Source/WebCore/ChangeLog (294162 => 294163)
--- trunk/Source/WebCore/ChangeLog 2022-05-13 17:21:06 UTC (rev 294162)
+++ trunk/Source/WebCore/ChangeLog 2022-05-13 17:25:12 UTC (rev 294163)
@@ -1,3 +1,17 @@
+2022-05-13 Ziran Sun <[email protected]>
+
+ input.showPicker() should throw when input is readonly/disabled
+ https://bugs.webkit.org/show_bug.cgi?id=240302
+
+ Reviewed by Tim Nguyen.
+
+ When input is readonly or disabled, input.showPicker() should throw InvalidStateError.
+
+ Test: imported/w3c/web-platform-tests/html/semantics/forms/the-input-element/show-picker-disabled-readonly.html
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::showPicker):
+
2022-05-13 Michael Catanzaro <[email protected]>
-Wreturn-type warning in PathOperation.cpp
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (294162 => 294163)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2022-05-13 17:21:06 UTC (rev 294162)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2022-05-13 17:25:12 UTC (rev 294163)
@@ -1242,7 +1242,10 @@
auto* frame = document().frame();
if (!frame)
return { };
-
+
+ if (isDisabledOrReadOnly())
+ return Exception { InvalidStateError, "Input showPicker() cannot be used on immutable controls."_s };
+
// In cross-origin iframes it should throw a "SecurityError" DOMException except on file and color. In same-origin iframes it should work fine.
// https://github.com/whatwg/html/issues/6909#issuecomment-917138991
if (!m_inputType->allowsShowPickerAcrossFrames()) {