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); |