Index: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
index 05b63335d2f0e5735d28299f77abdd2d72aa2559..2777ed0d05d888388aea3e52fcc39856c2748243 100644 |
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
@@ -941,10 +941,18 @@ void XMLHttpRequest::createRequest(PassRefPtr<EncodedFormData> httpBody, |
InspectorInstrumentation::asyncTaskScheduled( |
&executionContext, "XMLHttpRequest.send", this, true); |
dispatchProgressEvent(EventTypeNames::loadstart, 0, 0); |
+ // Event handler could have invalidated this send operation, |
+ // (re)setting the send flag and/or initiating another send |
+ // operation; leave quietly if so. |
+ if (!m_sendFlag || m_loader) |
+ return; |
if (httpBody && m_upload) { |
uploadEvents = m_upload->hasEventListeners(); |
m_upload->dispatchEvent( |
ProgressEvent::create(EventTypeNames::loadstart, false, 0, 0)); |
+ // See above. |
+ if (!m_sendFlag || m_loader) |
+ return; |
} |
} |