Backed out 3 changesets (bug 1551758) for causing wpt failures on form-submission-algorithm.html. CLOSED TREE

Backed out changeset 7f73f8d6d3b1 (bug 1551758)
Backed out changeset 295015e6e79b (bug 1551758)
Backed out changeset 6ffaf0da08d9 (bug 1551758)
This commit is contained in:
Arthur Iakab
2019-11-20 18:05:34 +02:00
parent 57f00ebc7f
commit b3340c2de9
7 changed files with 113 additions and 113 deletions

View File

@@ -2906,11 +2906,16 @@ nsresult HTMLInputElement::MaybeSubmitForm(nsPresContext* aPresContext) {
WidgetMouseEvent event(true, eMouseClick, nullptr, WidgetMouseEvent::eReal);
nsEventStatus status = nsEventStatus_eIgnore;
presShell->HandleDOMEventWithTarget(submitContent, &event, &status);
} else if (!mForm->ImplicitSubmissionIsDisabled()) {
} else if (!mForm->ImplicitSubmissionIsDisabled() &&
mForm->SubmissionCanProceed(nullptr)) {
// TODO: removing this code and have the submit event sent by the form,
// bug 592124.
// If there's only one text control, just submit the form
// Hold strong ref across the event
RefPtr<mozilla::dom::HTMLFormElement> form(mForm);
form->MaybeSubmit(nullptr);
RefPtr<mozilla::dom::HTMLFormElement> form = mForm;
InternalFormEvent event(true, eFormSubmit);
nsEventStatus status = nsEventStatus_eIgnore;
presShell->HandleDOMEventWithTarget(form, &event, &status);
}
return NS_OK;
@@ -4150,14 +4155,27 @@ nsresult HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
case NS_FORM_INPUT_SUBMIT:
case NS_FORM_INPUT_IMAGE:
if (mForm) {
// Hold a strong ref while dispatching
RefPtr<mozilla::dom::HTMLFormElement> form(mForm);
if (mType == NS_FORM_INPUT_RESET) {
form->MaybeReset(this);
} else {
form->MaybeSubmit(this);
InternalFormEvent event(true, (mType == NS_FORM_INPUT_RESET)
? eFormReset
: eFormSubmit);
event.mOriginator = this;
nsEventStatus status = nsEventStatus_eIgnore;
RefPtr<PresShell> presShell =
aVisitor.mPresContext->GetPresShell();
// If |PresShell::Destroy| has been called due to
// handling the event the pres context will return a null
// pres shell. See bug 125624.
// TODO: removing this code and have the submit event sent by the
// form, see bug 592124.
if (presShell && (event.mMessage != eFormSubmit ||
mForm->SubmissionCanProceed(this))) {
// Hold a strong ref while dispatching
RefPtr<mozilla::dom::HTMLFormElement> form(mForm);
presShell->HandleDOMEventWithTarget(form, &event, &status);
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
}
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
}
break;