Index: Source/core/xml/XMLHttpRequest.cpp |
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp |
index c0cbccdf858e8a621e52182c9d9d443af359848a..fb251ca68baa9724331f36e96ad6d5bb695c740d 100644 |
--- a/Source/core/xml/XMLHttpRequest.cpp |
+++ b/Source/core/xml/XMLHttpRequest.cpp |
@@ -794,11 +794,14 @@ void XMLHttpRequest::createRequest(ExceptionState& exceptionState) |
// added after the request is started. |
m_uploadEventsAllowed = m_sameOriginRequest || uploadEvents || !isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders); |
+ ASSERT(executionContext()); |
+ ExecutionContext& executionContext = *this->executionContext(); |
+ |
ResourceRequest request(m_url); |
request.setHTTPMethod(m_method); |
request.setTargetType(ResourceRequest::TargetIsXHR); |
- InspectorInstrumentation::willLoadXHR(executionContext(), this, this, m_method, m_url, m_async, m_requestEntityBody ? m_requestEntityBody->deepCopy() : nullptr, m_requestHeaders, m_includeCredentials); |
+ InspectorInstrumentation::willLoadXHR(&executionContext, this, this, m_method, m_url, m_async, m_requestEntityBody ? m_requestEntityBody->deepCopy() : nullptr, m_requestHeaders, m_includeCredentials); |
if (m_requestEntityBody) { |
ASSERT(m_method != "GET"); |
@@ -817,7 +820,7 @@ void XMLHttpRequest::createRequest(ExceptionState& exceptionState) |
options.crossOriginRequestPolicy = UseAccessControl; |
options.securityOrigin = securityOrigin(); |
options.initiator = FetchInitiatorTypeNames::xmlhttprequest; |
- options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypassMainWorld(executionContext()) ? DoNotEnforceContentSecurityPolicy : EnforceConnectSrcDirective; |
+ options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypassMainWorld(&executionContext) ? DoNotEnforceContentSecurityPolicy : EnforceConnectSrcDirective; |
// TODO(tsepez): Specify TreatAsActiveContent per http://crbug.com/305303. |
options.mixedContentBlockingTreatment = TreatAsPassiveContent; |
options.timeoutMilliseconds = m_timeoutMilliseconds; |
@@ -834,7 +837,7 @@ void XMLHttpRequest::createRequest(ExceptionState& exceptionState) |
// FIXME: Maybe we need to be able to send XMLHttpRequests from onunload, <http://bugs.webkit.org/show_bug.cgi?id=10904>. |
// FIXME: Maybe create() can return null for other reasons too? |
ASSERT(!m_loader); |
- m_loader = ThreadableLoader::create(executionContext(), this, request, options); |
+ m_loader = ThreadableLoader::create(executionContext, this, request, options); |
if (m_loader) { |
// Neither this object nor the JavaScript wrapper should be deleted while |
// a request is in progress because we need to keep the listeners alive, |
@@ -842,7 +845,7 @@ void XMLHttpRequest::createRequest(ExceptionState& exceptionState) |
setPendingActivity(this); |
} |
} else { |
- ThreadableLoader::loadResourceSynchronously(executionContext(), request, *this, options); |
+ ThreadableLoader::loadResourceSynchronously(executionContext, request, *this, options); |
} |
if (!m_exceptionCode && m_error) |