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

Unified Diff: third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp

Issue 2507773002: XMLHttpRequest: check if 'loadstart' handler cancelled send(). (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/onloadstart-abort.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/xmlhttprequest/onloadstart-abort.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698