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

Unified Diff: Source/core/xml/XMLHttpRequest.cpp

Issue 490083002: [XHR] Move the code to clear variables to internalAbort() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed assertion Created 6 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XMLHttpRequest.cpp
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp
index 6ea48fd8bfa15a6bd129c4f07c4c1af5890b0188..4c3ed00af0b0d8fc825eb7487b814ffb73d3bc7e 100644
--- a/Source/core/xml/XMLHttpRequest.cpp
+++ b/Source/core/xml/XMLHttpRequest.cpp
@@ -545,12 +545,6 @@ void XMLHttpRequest::open(const AtomicString& method, const KURL& url, bool asyn
m_error = false;
m_uploadComplete = false;
- // clear stuff from possible previous load
- clearResponse();
- clearRequest();
-
- ASSERT(m_state == UNSENT);
-
if (!isValidHTTPToken(method)) {
exceptionState.throwDOMException(SyntaxError, "'" + method + "' is not a valid HTTP method.");
return;
@@ -898,11 +892,6 @@ void XMLHttpRequest::abort()
if (!internalAbort())
return;
- clearResponse();
-
- // Clear headers as required by the spec
- m_requestHeaders.clear();
-
if (!((m_state <= OPENED && !sendFlag) || m_state == DONE)) {
ASSERT(!m_loader);
handleRequestError(0, EventTypeNames::abort, receivedLength, expectedLength);
@@ -935,6 +924,9 @@ bool XMLHttpRequest::internalAbort()
m_responseStream->error(DOMException::create(!m_async && m_exceptionCode ? m_exceptionCode : AbortError, "XMLHttpRequest::abort"));
}
+ clearResponse();
+ clearRequest();
+
if (!m_loader)
return true;
@@ -990,14 +982,6 @@ void XMLHttpRequest::clearRequest()
m_requestHeaders.clear();
}
-void XMLHttpRequest::handleDidFailGeneric()
sof 2014/08/21 21:12:44 Remove the method from the class declaration also?
tyoshino (SeeGerritForStatus) 2014/08/22 04:26:57 Done.
-{
- clearResponse();
- clearRequest();
-
- m_error = true;
-}
-
void XMLHttpRequest::dispatchProgressEvent(const AtomicString& type, long long receivedLength, long long expectedLength)
{
bool lengthComputable = expectedLength > 0 && receivedLength <= expectedLength;
@@ -1026,7 +1010,6 @@ void XMLHttpRequest::handleNetworkError()
if (!internalAbort())
return;
- handleDidFailGeneric();
handleRequestError(NetworkError, EventTypeNames::error, receivedLength, expectedLength);
}
@@ -1038,7 +1021,9 @@ void XMLHttpRequest::handleDidCancel()
long long expectedLength = m_response.expectedContentLength();
long long receivedLength = m_receivedLength;
- handleDidFailGeneric();
+ if (!internalAbort())
+ return;
+
handleRequestError(AbortError, EventTypeNames::abort, receivedLength, expectedLength);
}
@@ -1458,7 +1443,6 @@ void XMLHttpRequest::handleDidTimeout()
if (!internalAbort())
return;
- handleDidFailGeneric();
handleRequestError(TimeoutError, EventTypeNames::timeout, receivedLength, expectedLength);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698