Changeset 284660 in webkit
- Timestamp:
- Oct 21, 2021 5:46:04 PM (9 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/forms/remove-form-inside-formdata-event-expected.txt (added)
-
LayoutTests/fast/forms/remove-form-inside-formdata-event.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/HTMLFormElement.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r284659 r284660 1 2021-10-21 Chris Dumez <cdumez@apple.com> 2 3 Form submission should be cancelled if the form gets detached from inside the formdata event handler 4 https://bugs.webkit.org/show_bug.cgi?id=232114 5 6 Reviewed by Alex Christensen. 7 8 Add layout test coverage. 9 10 * fast/forms/remove-form-inside-formdata-event-expected.txt: Added. 11 * fast/forms/remove-form-inside-formdata-event.html: Added. 12 1 13 2021-10-21 Eric Hutchison <ehutchison@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r284656 r284660 1 2021-10-21 Chris Dumez <cdumez@apple.com> 2 3 Form submission should be cancelled if the form gets detached from inside the formdata event handler 4 https://bugs.webkit.org/show_bug.cgi?id=232114 5 6 Reviewed by Alex Christensen. 7 8 Per the HTML specification [1], form submission should abort if the form cannot navigate (which is true 9 when the form is detached). The algorithm in the specification does the check twice, once at the very 10 beginning (Step 1 in the spec), and again after calling the "constructing the entry list" algorithm 11 (step 9 in the spec). The reason we need to do the check again is that the "constructing the entry list" 12 algorithm fires the "formdata" event and may thus run JavaScript and the JS can detach the form element. 13 14 In HTMLFormElement::submit(), we were doing only the "form is connected" check only at the beginning 15 of the function and failing to do so after constructing the FormSubmission object (which ends up constructing 16 the entry list). This patch fixes that. 17 18 [1] https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-form-submit 19 20 Test: fast/forms/remove-form-inside-formdata-event.html 21 22 * html/HTMLFormElement.cpp: 23 (WebCore::HTMLFormElement::submit): 24 1 25 2021-10-21 Chris Dumez <cdumez@apple.com> 2 26 -
trunk/Source/WebCore/html/HTMLFormElement.cpp
r284656 r284660 403 403 auto shouldLockHistory = processingUserGesture ? LockHistory::No : LockHistory::Yes; 404 404 auto formSubmission = FormSubmission::create(*this, submitter, m_attributes, event, shouldLockHistory, trigger); 405 406 if (!isConnected()) 407 return; 408 405 409 if (m_plannedFormSubmission) 406 410 m_plannedFormSubmission->cancel();
Note: See TracChangeset
for help on using the changeset viewer.