Bug 1719872 - Dialog submission triggered by form.submit() in click handler of submit button should not be deferred; r=smaug

Per https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submit-dialog,
dialog submission won't run https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#planned-navigation
and the steps are synchronous.

Differential Revision: https://phabricator.services.mozilla.com/D119667
This commit is contained in:
Edgar Chen
2021-07-12 19:39:25 +00:00
parent 4f3074f3e2
commit 2d359ed0fc
2 changed files with 37 additions and 8 deletions

View File

@@ -665,14 +665,6 @@ nsresult HTMLFormElement::DoSubmit(Event* aEvent) {
mSubmitPopupState = PopupBlocker::openAbused;
}
if (mDeferSubmission) {
// we are in an event handler, JS submitted so we have to
// defer this submission. let's remember it and return
// without submitting
mPendingSubmission = std::move(submission);
return NS_OK;
}
//
// perform the submission
//
@@ -695,6 +687,15 @@ nsresult HTMLFormElement::DoSubmit(Event* aEvent) {
submission->GetAsDialogSubmission()) {
return SubmitDialog(dialogSubmission);
}
if (mDeferSubmission) {
// we are in an event handler, JS submitted so we have to
// defer this submission. let's remember it and return
// without submitting
mPendingSubmission = std::move(submission);
return NS_OK;
}
return SubmitSubmission(submission.get());
}