Index: Source/core/html/HTMLFormElement.cpp |
diff --git a/Source/core/html/HTMLFormElement.cpp b/Source/core/html/HTMLFormElement.cpp |
index 7e5a7859d87924d3238f3ac9ad3b22a6f35a131a..c24d0926c9bee5372d4314696cfa538fbe36a2fd 100644 |
--- a/Source/core/html/HTMLFormElement.cpp |
+++ b/Source/core/html/HTMLFormElement.cpp |
@@ -303,11 +303,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); |