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

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

Issue 204983007: Make ThreadableLoader class to use references (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added asserts Created 6 years, 9 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
Index: Source/core/xml/XMLHttpRequest.cpp
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp
index b480b02a31bea4fa37041ed06c444ee527bd5d26..fda4f2dae82c98ab64c7a8e9c0fe51f157795322 100644
--- a/Source/core/xml/XMLHttpRequest.cpp
+++ b/Source/core/xml/XMLHttpRequest.cpp
@@ -792,11 +792,12 @@ void XMLHttpRequest::createRequest(ExceptionState& exceptionState)
// added after the request is started.
m_uploadEventsAllowed = m_sameOriginRequest || uploadEvents || !isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders);
+ ExecutionContext* executionContextLocal = executionContext();
Inactive 2014/03/31 17:43:26 Same comment about naming / local variable.
maheshkk 2014/03/31 20:46:49 Done.
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(executionContextLocal, 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");
@@ -815,7 +816,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(executionContextLocal) ? DoNotEnforceContentSecurityPolicy : EnforceConnectSrcDirective;
// TODO(tsepez): Specify TreatAsActiveContent per http://crbug.com/305303.
options.mixedContentBlockingTreatment = TreatAsPassiveContent;
options.timeoutMilliseconds = m_timeoutMilliseconds;
@@ -832,7 +833,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(*executionContextLocal, 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,
@@ -840,7 +841,7 @@ void XMLHttpRequest::createRequest(ExceptionState& exceptionState)
setPendingActivity(this);
}
} else {
- ThreadableLoader::loadResourceSynchronously(executionContext(), request, *this, options);
+ ThreadableLoader::loadResourceSynchronously(*executionContextLocal, request, *this, options);
}
if (!m_exceptionCode && m_error)

Powered by Google App Engine
This is Rietveld 408576698