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

Side by Side Diff: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp

Issue 2415373002: Loading: bulk style errors fix in core/loader (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/FormSubmission.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013, Intel Corporation 3 * Copyright (C) 2013, Intel Corporation
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // represents the fetch request mode, and |credentialsRequested| represents 240 // represents the fetch request mode, and |credentialsRequested| represents
241 // the fetch credentials mode. So we set those flags here so that we can see 241 // the fetch credentials mode. So we set those flags here so that we can see
242 // the correct request mode and credentials mode in the service worker's 242 // the correct request mode and credentials mode in the service worker's
243 // fetch event handler. 243 // fetch event handler.
244 switch (m_options.crossOriginRequestPolicy) { 244 switch (m_options.crossOriginRequestPolicy) {
245 case DenyCrossOriginRequests: 245 case DenyCrossOriginRequests:
246 newRequest.setFetchRequestMode( 246 newRequest.setFetchRequestMode(
247 WebURLRequest::FetchRequestModeSameOrigin); 247 WebURLRequest::FetchRequestModeSameOrigin);
248 break; 248 break;
249 case UseAccessControl: 249 case UseAccessControl:
250 if (m_options.preflightPolicy == ForcePreflight) 250 if (m_options.preflightPolicy == ForcePreflight) {
251 newRequest.setFetchRequestMode( 251 newRequest.setFetchRequestMode(
252 WebURLRequest::FetchRequestModeCORSWithForcedPreflight); 252 WebURLRequest::FetchRequestModeCORSWithForcedPreflight);
253 else 253 } else {
254 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORS); 254 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeCORS);
255 }
255 break; 256 break;
256 case AllowCrossOriginRequests: 257 case AllowCrossOriginRequests:
257 SECURITY_CHECK(IsNoCORSAllowedContext(m_requestContext, 258 SECURITY_CHECK(IsNoCORSAllowedContext(m_requestContext,
258 request.skipServiceWorker())); 259 request.skipServiceWorker()));
259 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeNoCORS); 260 newRequest.setFetchRequestMode(WebURLRequest::FetchRequestModeNoCORS);
260 break; 261 break;
261 } 262 }
262 if (m_resourceLoaderOptions.allowCredentials == AllowStoredCredentials) 263 if (m_resourceLoaderOptions.allowCredentials == AllowStoredCredentials) {
263 newRequest.setFetchCredentialsMode( 264 newRequest.setFetchCredentialsMode(
264 WebURLRequest::FetchCredentialsModeInclude); 265 WebURLRequest::FetchCredentialsModeInclude);
265 else 266 } else {
266 newRequest.setFetchCredentialsMode( 267 newRequest.setFetchCredentialsMode(
267 WebURLRequest::FetchCredentialsModeSameOrigin); 268 WebURLRequest::FetchCredentialsModeSameOrigin);
269 }
268 } 270 }
269 271
270 // We assume that ServiceWorker is skipped for sync requests and unsupported 272 // We assume that ServiceWorker is skipped for sync requests and unsupported
271 // protocol requests by content/ code. 273 // protocol requests by content/ code.
272 if (m_async && 274 if (m_async &&
273 request.skipServiceWorker() == WebURLRequest::SkipServiceWorker::None && 275 request.skipServiceWorker() == WebURLRequest::SkipServiceWorker::None &&
274 SchemeRegistry::shouldTreatURLSchemeAsAllowingServiceWorkers( 276 SchemeRegistry::shouldTreatURLSchemeAsAllowingServiceWorkers(
275 request.url().protocol()) && 277 request.url().protocol()) &&
276 m_document->fetcher()->isControlledByServiceWorker()) { 278 m_document->fetcher()->isControlledByServiceWorker()) {
277 if (newRequest.fetchRequestMode() == WebURLRequest::FetchRequestModeCORS || 279 if (newRequest.fetchRequestMode() == WebURLRequest::FetchRequestModeCORS ||
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 ThreadableLoaderClient* client = m_client; 536 ThreadableLoaderClient* client = m_client;
535 clear(); 537 clear();
536 client->didFailRedirectCheck(); 538 client->didFailRedirectCheck();
537 539
538 return false; 540 return false;
539 } 541 }
540 542
541 // Allow same origin requests to continue after allowing clients to audit the 543 // Allow same origin requests to continue after allowing clients to audit the
542 // redirect. 544 // redirect.
543 if (isAllowedRedirect(request.url())) { 545 if (isAllowedRedirect(request.url())) {
544 if (m_client->isDocumentThreadableLoaderClient()) 546 if (m_client->isDocumentThreadableLoaderClient()) {
545 return static_cast<DocumentThreadableLoaderClient*>(m_client) 547 return static_cast<DocumentThreadableLoaderClient*>(m_client)
546 ->willFollowRedirect(request, redirectResponse); 548 ->willFollowRedirect(request, redirectResponse);
549 }
547 return true; 550 return true;
548 } 551 }
549 552
550 if (m_corsRedirectLimit <= 0) { 553 if (m_corsRedirectLimit <= 0) {
551 ThreadableLoaderClient* client = m_client; 554 ThreadableLoaderClient* client = m_client;
552 clear(); 555 clear();
553 client->didFailRedirectCheck(); 556 client->didFailRedirectCheck();
554 return false; 557 return false;
555 } 558 }
556 559
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 DCHECK(m_sameOriginRequest || requestURL.pass().isEmpty()); 982 DCHECK(m_sameOriginRequest || requestURL.pass().isEmpty());
980 983
981 // Update resourceLoaderOptions with enforced values. 984 // Update resourceLoaderOptions with enforced values.
982 if (m_forceDoNotAllowStoredCredentials) 985 if (m_forceDoNotAllowStoredCredentials)
983 resourceLoaderOptions.allowCredentials = DoNotAllowStoredCredentials; 986 resourceLoaderOptions.allowCredentials = DoNotAllowStoredCredentials;
984 resourceLoaderOptions.securityOrigin = m_securityOrigin; 987 resourceLoaderOptions.securityOrigin = m_securityOrigin;
985 if (m_async) { 988 if (m_async) {
986 if (!m_actualRequest.isNull()) 989 if (!m_actualRequest.isNull())
987 resourceLoaderOptions.dataBufferingPolicy = BufferData; 990 resourceLoaderOptions.dataBufferingPolicy = BufferData;
988 991
989 if (m_options.timeoutMilliseconds > 0) 992 if (m_options.timeoutMilliseconds > 0) {
990 m_timeoutTimer.startOneShot(m_options.timeoutMilliseconds / 1000.0, 993 m_timeoutTimer.startOneShot(m_options.timeoutMilliseconds / 1000.0,
991 BLINK_FROM_HERE); 994 BLINK_FROM_HERE);
995 }
992 996
993 FetchRequest newRequest(request, m_options.initiator, 997 FetchRequest newRequest(request, m_options.initiator,
994 resourceLoaderOptions); 998 resourceLoaderOptions);
995 if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests) 999 if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests)
996 newRequest.setOriginRestriction(FetchRequest::NoOriginRestriction); 1000 newRequest.setOriginRestriction(FetchRequest::NoOriginRestriction);
997 DCHECK(!resource()); 1001 DCHECK(!resource());
998 1002
999 if (request.requestContext() == WebURLRequest::RequestContextVideo || 1003 if (request.requestContext() == WebURLRequest::RequestContextVideo ||
1000 request.requestContext() == WebURLRequest::RequestContextAudio) 1004 request.requestContext() == WebURLRequest::RequestContextAudio)
1001 setResource(RawResource::fetchMedia(newRequest, document().fetcher())); 1005 setResource(RawResource::fetchMedia(newRequest, document().fetcher()));
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 } 1126 }
1123 1127
1124 DEFINE_TRACE(DocumentThreadableLoader) { 1128 DEFINE_TRACE(DocumentThreadableLoader) {
1125 visitor->trace(m_resource); 1129 visitor->trace(m_resource);
1126 visitor->trace(m_document); 1130 visitor->trace(m_document);
1127 ThreadableLoader::trace(visitor); 1131 ThreadableLoader::trace(visitor);
1128 RawResourceClient::trace(visitor); 1132 RawResourceClient::trace(visitor);
1129 } 1133 }
1130 1134
1131 } // namespace blink 1135 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/loader/FormSubmission.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698