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 e4caac40bb90dc83ab950f47f4609b065ff58444..83d7de948593aa0b71d18ddd26a9c523fb6da4bd 100644 |
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp |
@@ -295,7 +295,6 @@ |
bool isHTML = responseIsHTML(); |
if ((m_response.isHTTP() && !responseIsXML() && !isHTML) |
|| (isHTML && m_responseTypeCode == ResponseTypeDefault) |
- || !getExecutionContext() |
|| getExecutionContext()->isWorkerGlobalScope()) { |
m_responseDocument = nullptr; |
return; |
@@ -411,7 +410,7 @@ |
{ |
// FIXME: Need to trigger or update the timeout Timer here, if needed. http://webkit.org/b/98156 |
// XHR2 spec, 4.7.3. "This implies that the timeout attribute can be set while fetching is in progress. If that occurs it will still be measured relative to the start of fetching." |
- if (getExecutionContext() && getExecutionContext()->isDocument() && !m_async) { |
+ if (getExecutionContext()->isDocument() && !m_async) { |
exceptionState.throwDOMException(InvalidAccessError, "Timeouts cannot be set for synchronous requests made from a document."); |
return; |
} |
@@ -436,7 +435,7 @@ |
// Newer functionality is not available to synchronous requests in window contexts, as a spec-mandated |
// attempt to discourage synchronous XHR use. responseType is one such piece of functionality. |
- if (getExecutionContext() && getExecutionContext()->isDocument() && !m_async) { |
+ if (!m_async && getExecutionContext()->isDocument()) { |
exceptionState.throwDOMException(InvalidAccessError, "The response type cannot be changed for synchronous requests made from a document."); |
return; |
} |
@@ -557,9 +556,6 @@ |
void XMLHttpRequest::open(const AtomicString& method, const String& urlString, ExceptionState& exceptionState) |
{ |
- if (!getExecutionContext()) |
- return; |
- |
KURL url(getExecutionContext()->completeURL(urlString)); |
if (!validateOpenArguments(method, url, exceptionState)) |
return; |
@@ -569,9 +565,6 @@ |
void XMLHttpRequest::open(const AtomicString& method, const String& urlString, bool async, const String& username, const String& password, ExceptionState& exceptionState) |
{ |
- if (!getExecutionContext()) |
- return; |
- |
KURL url(getExecutionContext()->completeURL(urlString)); |
if (!validateOpenArguments(method, url, exceptionState)) |
return; |
@@ -649,11 +642,8 @@ |
bool XMLHttpRequest::initSend(ExceptionState& exceptionState) |
{ |
- if (!getExecutionContext()) { |
- handleNetworkError(); |
- throwForLoadFailureIfNeeded(exceptionState, "Document is already detached."); |
+ if (!getExecutionContext()) |
return false; |
- } |
if (m_state != kOpened || m_loader) { |
exceptionState.throwDOMException(InvalidStateError, "The object's state must be OPENED."); |
@@ -886,7 +876,7 @@ |
} |
DCHECK(getExecutionContext()); |
- ExecutionContext& executionContext = *getExecutionContext(); |
+ ExecutionContext& executionContext = *this->getExecutionContext(); |
// The presence of upload event listeners forces us to use preflighting because POSTing to an URL that does not |
// permit cross origin requests should look exactly like POSTing to an URL that does not respond at all. |
@@ -1514,7 +1504,7 @@ |
changeState(kDone); |
- if (!getExecutionContext() || !getExecutionContext()->isDocument() || !document() || !document()->frame() || !document()->frame()->page()) |
+ if (!getExecutionContext()->isDocument() || !document() || !document()->frame() || !document()->frame()->page()) |
return; |
if (status() >= 200 && status() < 300) { |