Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(991)

Unified Diff: Source/core/html/HTMLFormElement.cpp

Issue 177683004: Don't delay submit in onsubmit event handler (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated to latest master Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLFormElement.cpp
diff --git a/Source/core/html/HTMLFormElement.cpp b/Source/core/html/HTMLFormElement.cpp
index b887dd8b5e6c42eb2cefe51e87d34b7f55f2bffc..672c01d35bdf8ceaa8cec5435d2f454d7ca59180 100644
--- a/Source/core/html/HTMLFormElement.cpp
+++ b/Source/core/html/HTMLFormElement.cpp
@@ -301,11 +301,12 @@ bool HTMLFormElement::prepareForSubmission(Event* event)
RefPtr<FormState> formState = FormState::create(this, controlNamesAndValues, &document(), NotSubmittedByJavaScript);
frame->loader().client()->dispatchWillSendSubmitEvent(formState.release());
+ // Set flag before submission as dispatchEvent could trigger another event
+ m_isSubmittingOrPreparingForSubmission = false;
+
if (dispatchEvent(Event::createCancelableBubble(EventTypeNames::submit)))
m_shouldSubmit = true;
- m_isSubmittingOrPreparingForSubmission = false;
-
if (m_shouldSubmit)
submit(event, true, true, NotSubmittedByJavaScript);

Powered by Google App Engine
This is Rietveld 408576698