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

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

Issue 301243015: Refactor ThreadableLoaderOptions for readability (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 7 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 | « Source/core/workers/WorkerScriptLoader.cpp ('k') | Source/platform/CrossThreadCopier.h » ('j') | 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 a60f006e62f9df73f7c3665f4f391ec5fc78247d..c5dc7ecd89f824d6864760a8b58c8f4ed9100648 100644
--- a/Source/core/xml/XMLHttpRequest.cpp
+++ b/Source/core/xml/XMLHttpRequest.cpp
@@ -836,18 +836,19 @@ void XMLHttpRequest::createRequest(ExceptionState& exceptionState)
request.addHTTPHeaderFields(m_requestHeaders);
ThreadableLoaderOptions options;
- options.sniffContent = DoNotSniffContent;
options.preflightPolicy = uploadEvents ? ForcePreflight : ConsiderPreflight;
- options.allowCredentials = (m_sameOriginRequest || m_includeCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials;
- options.credentialsRequested = m_includeCredentials ? ClientRequestedCredentials : ClientDidNotRequestCredentials;
options.crossOriginRequestPolicy = UseAccessControl;
- options.securityOrigin = securityOrigin();
options.initiator = FetchInitiatorTypeNames::xmlhttprequest;
options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypassMainWorld(&executionContext) ? DoNotEnforceContentSecurityPolicy : EnforceConnectSrcDirective;
- // TODO(tsepez): Specify TreatAsActiveContent per http://crbug.com/305303.
- options.mixedContentBlockingTreatment = TreatAsPassiveContent;
options.timeoutMilliseconds = m_timeoutMilliseconds;
+ ResourceLoaderOptions resourceLoaderOptions;
+ resourceLoaderOptions.allowCredentials = (m_sameOriginRequest || m_includeCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials;
+ resourceLoaderOptions.credentialsRequested = m_includeCredentials ? ClientRequestedCredentials : ClientDidNotRequestCredentials;
+ resourceLoaderOptions.securityOrigin = securityOrigin();
+ // TODO(tsepez): Specify TreatAsActiveContent per http://crbug.com/305303.
+ resourceLoaderOptions.mixedContentBlockingTreatment = TreatAsPassiveContent;
+
m_exceptionCode = 0;
m_error = false;
@@ -860,7 +861,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, resourceLoaderOptions);
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,
@@ -868,7 +869,7 @@ void XMLHttpRequest::createRequest(ExceptionState& exceptionState)
setPendingActivity(this);
}
} else {
- ThreadableLoader::loadResourceSynchronously(executionContext, request, *this, options);
+ ThreadableLoader::loadResourceSynchronously(executionContext, request, *this, options, resourceLoaderOptions);
}
if (!m_exceptionCode && m_error)
« no previous file with comments | « Source/core/workers/WorkerScriptLoader.cpp ('k') | Source/platform/CrossThreadCopier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698