Title: [289615] trunk
- Revision
- 289615
- Author
- [email protected]
- Date
- 2022-02-11 02:52:38 -0800 (Fri, 11 Feb 2022)
Log Message
Clicking on an <input type="image"> will submit the form with null submitter
https://bugs.webkit.org/show_bug.cgi?id=236324
LayoutTests/imported/w3c:
Add a test to make sure that when the form is submitted through an <input type="image">
control, the `submitter` field of the submit event is that control.
Patch by Andreu Botella <[email protected]> on 2022-02-11
Reviewed by Carlos Garcia Campos.
* web-platform-tests/html/semantics/forms/form-submission-0/form-submission-algorithm-expected.txt:
* web-platform-tests/html/semantics/forms/form-submission-0/form-submission-algorithm.html:
Source/WebCore:
Patch by Andreu Botella <[email protected]> on 2022-02-11
Reviewed by Carlos Garcia Campos.
If you submit a form by clicking on an <input type="image"> control, the control will be in
the form's entry list, but the submitter field in the submit event will be null. This is
wrong per the spec, and caused because the call to `HTMLFormElement::submitIfPossible()` in
`ImageInputType::handleDOMActivateEvent()` calls it with one argument, rather than passing
the element as the submitter.
Tests: imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-submission-algorithm.html
* html/ImageInputType.cpp:
(WebCore::ImageInputType::handleDOMActivateEvent):
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (289614 => 289615)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-11 10:14:36 UTC (rev 289614)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-11 10:52:38 UTC (rev 289615)
@@ -1,3 +1,16 @@
+2022-02-11 Andreu Botella <[email protected]>
+
+ Clicking on an <input type="image"> will submit the form with null submitter
+ https://bugs.webkit.org/show_bug.cgi?id=236324
+
+ Add a test to make sure that when the form is submitted through an <input type="image">
+ control, the `submitter` field of the submit event is that control.
+
+ Reviewed by Carlos Garcia Campos.
+
+ * web-platform-tests/html/semantics/forms/form-submission-0/form-submission-algorithm-expected.txt:
+ * web-platform-tests/html/semantics/forms/form-submission-0/form-submission-algorithm.html:
+
2022-02-11 Youenn Fablet <[email protected]>
Add support to query camera and microphone permissions
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-submission-algorithm-expected.txt (289614 => 289615)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-submission-algorithm-expected.txt 2022-02-11 10:14:36 UTC (rev 289614)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-submission-algorithm-expected.txt 2022-02-11 10:52:38 UTC (rev 289615)
@@ -9,11 +9,13 @@
+
PASS If constructing entry list flag of form is true, then return
PASS If firing submission events flag of form is true, then return
PASS If form's firing submission events is true, then return; 'invalid' event
PASS If form's firing submission events is true, then return; 'submit' event
PASS firing an event named submit; clicking a submit button
+PASS firing an event named submit; clicking an image button
PASS firing an event named submit; form.requestSubmit()
PASS firing an event named submit; form.requestSubmit(null)
PASS firing an event named submit; form.requestSubmit(submitter)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-submission-algorithm.html (289614 => 289615)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-submission-algorithm.html 2022-02-11 10:14:36 UTC (rev 289614)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-submission-algorithm.html 2022-02-11 10:52:38 UTC (rev 289615)
@@ -84,6 +84,20 @@
}, 'firing an event named submit; clicking a submit button');
promise_test(async () => {
+ let form = populateForm('<input type=image name=n1>');
+ let iframe = form.previousSibling;
+ let submitter = form.querySelector('input[type=image]');
+ let event;
+ form.addEventListener('submit', e => { event = e; });
+ submitter.click();
+ await loadPromise(iframe);
+ assert_true(event.bubbles);
+ assert_true(event.cancelable);
+ assert_equals(event.submitter, submitter);
+ assert_true(event instanceof SubmitEvent);
+}, 'firing an event named submit; clicking an image button');
+
+promise_test(async () => {
let form = populateForm('');
let iframe = form.previousSibling;
let event;
Modified: trunk/Source/WebCore/ChangeLog (289614 => 289615)
--- trunk/Source/WebCore/ChangeLog 2022-02-11 10:14:36 UTC (rev 289614)
+++ trunk/Source/WebCore/ChangeLog 2022-02-11 10:52:38 UTC (rev 289615)
@@ -1,3 +1,21 @@
+2022-02-11 Andreu Botella <[email protected]>
+
+ Clicking on an <input type="image"> will submit the form with null submitter
+ https://bugs.webkit.org/show_bug.cgi?id=236324
+
+ Reviewed by Carlos Garcia Campos.
+
+ If you submit a form by clicking on an <input type="image"> control, the control will be in
+ the form's entry list, but the submitter field in the submit event will be null. This is
+ wrong per the spec, and caused because the call to `HTMLFormElement::submitIfPossible()` in
+ `ImageInputType::handleDOMActivateEvent()` calls it with one argument, rather than passing
+ the element as the submitter.
+
+ Tests: imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/form-submission-algorithm.html
+
+ * html/ImageInputType.cpp:
+ (WebCore::ImageInputType::handleDOMActivateEvent):
+
2022-02-11 Youenn Fablet <[email protected]>
Add support to query camera and microphone permissions
Modified: trunk/Source/WebCore/html/ImageInputType.cpp (289614 => 289615)
--- trunk/Source/WebCore/html/ImageInputType.cpp 2022-02-11 10:14:36 UTC (rev 289614)
+++ trunk/Source/WebCore/html/ImageInputType.cpp 2022-02-11 10:52:38 UTC (rev 289615)
@@ -104,7 +104,7 @@
protectedElement->document().updateLayoutIgnorePendingStylesheets();
if (auto currentForm = protectedElement->form())
- currentForm->submitIfPossible(&event); // Event handlers can run.
+ currentForm->submitIfPossible(&event, element()); // Event handlers can run.
protectedElement->setActivatedSubmit(false);
event.setDefaultHandled();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes