Skip to content

Commit

Permalink
Constructed FormData object should not contain entries for the Image …
Browse files Browse the repository at this point in the history
…Button submitter by default

https://bugs.webkit.org/show_bug.cgi?id=274214

Reviewed by Chris Dumez.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

In 249999@main, WebKit patched the issue for other input types while left out
`ImageInput`, this is to extend similar solution to `image` input.

Originally, when the activedSumbit flag is set for a image input, its value
is appeneded to a FormData. In the case of form submission in event handler,
we include this when build FormData, while we shouldn't. This removes the following
flag.

Original Patch Credits: Andreu Botella (andreu@andreubotella.com) in bug 234069

* Source/WebCore/html/ImageInputType.cpp:
(WebCore::ImageInputType::handleDOMActivateEvent):
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/form-submission-0/constructing-form-data-set-expected.txt:

Canonical link: https://commits.webkit.org/278944@main
  • Loading branch information
Ahmad Saleem authored and cdumez committed May 18, 2024
1 parent 48e9bda commit 69eafe9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ PASS "formData" IDL attribute should have entries for form-associated elements i
PASS Entries added to "formData" IDL attribute should be submitted.
PASS Entries added to the "formdata" IDL attribute shouldn't be newline normalized in the resulting FormData
PASS The constructed FormData object should not contain an entry for the submit button that was used to submit the form.
FAIL The constructed FormData object should not contain an entry for the image submit button that was used to submit the form. assert_false: expected false got true
PASS The constructed FormData object should not contain an entry for the image submit button that was used to submit the form.

3 changes: 0 additions & 3 deletions Source/WebCore/html/ImageInputType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ void ImageInputType::handleDOMActivateEvent(Event& event)

Ref<HTMLFormElement> protectedForm(*protectedElement->form());

protectedElement->setActivatedSubmit(true);

m_clickLocation = IntPoint();
if (event.underlyingEvent()) {
Event& underlyingEvent = *event.underlyingEvent();
Expand All @@ -103,7 +101,6 @@ void ImageInputType::handleDOMActivateEvent(Event& event)
if (auto currentForm = protectedElement->form())
currentForm->submitIfPossible(&event, element()); // Event handlers can run.

protectedElement->setActivatedSubmit(false);
event.setDefaultHandled();
}

Expand Down

0 comments on commit 69eafe9

Please sign in to comment.