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

Unified Diff: branches/chromium/1599/Source/core/xml/XMLHttpRequest.cpp

Issue 26341006: Revert 159004 "Merge 158146 "[XHR] Abort method execution when m..." (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 7 years, 2 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
« no previous file with comments | « branches/chromium/1599/Source/core/xml/XMLHttpRequest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: branches/chromium/1599/Source/core/xml/XMLHttpRequest.cpp
===================================================================
--- branches/chromium/1599/Source/core/xml/XMLHttpRequest.cpp (revision 159086)
+++ branches/chromium/1599/Source/core/xml/XMLHttpRequest.cpp (working copy)
@@ -450,9 +450,7 @@
void XMLHttpRequest::open(const String& method, const KURL& url, bool async, ExceptionState& es)
{
- if (!internalAbort())
- return;
-
+ internalAbort();
State previousState = m_state;
m_state = UNSENT;
m_error = false;
@@ -785,8 +783,7 @@
bool sendFlag = m_loader;
- if (!internalAbort())
- return;
+ internalAbort();
clearResponseBuffers();
@@ -809,7 +806,7 @@
}
}
-bool XMLHttpRequest::internalAbort()
+void XMLHttpRequest::internalAbort()
{
bool hadLoader = m_loader;
@@ -818,20 +815,9 @@
// FIXME: when we add the support for multi-part XHR, we will have to think be careful with this initialization.
m_receivedLength = 0;
- if (hadLoader)
- // Cancelling the ThreadableLoader m_loader may result in calling
- // window.onload synchronously. If such an onload handler contains
- // open() call on the same XMLHttpRequest object, reentry happens. If
- // m_loader is left to be non 0, internalAbort() call for the inner
- // open() makes an extra dropProtection() call (when we're back to the
- // outer open(), we'll call dropProtection()). To avoid that, clears
- // m_loader before calling cancel.
- //
- // If, window.onload contains open() and send(), m_loader will be set to
- // non 0 value. So, we cannot continue the outer open(). In such case,
- // just abort the outer open() by returning false.
- RefPtr<ThreadableLoader> loader = m_loader.release();
- loader->cancel();
+ if (hadLoader) {
+ m_loader->cancel();
+ m_loader = 0;
}
m_decoder = 0;
@@ -840,8 +826,6 @@
if (hadLoader)
dropProtectionSoon();
-
- return !m_loader;
}
void XMLHttpRequest::clearResponse()
@@ -1202,8 +1186,7 @@
{
// internalAbort() calls dropProtection(), which may release the last reference.
RefPtr<XMLHttpRequest> protect(this);
- if (!internalAbort())
- return;
+ internalAbort();
clearResponse();
clearRequest();
« no previous file with comments | « branches/chromium/1599/Source/core/xml/XMLHttpRequest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698