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

Unified Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp

Issue 2738303005: Move suborigin/serviceworker processing to ResourceFetcher::prepareRequest()
Patch Set: Rebase Created 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
index a5eae6c5bf861db7dc1fd4028a4489e01506f60b..cd48a31c02413e147a276c978be6ce4912ae7be6 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcher.cpp
@@ -508,6 +508,16 @@ ResourceFetcher::PrepareRequestResult ResourceFetcher::prepareRequest(
if (!request.url().isValid())
return Abort;
+ // Resource requests from suborigins should not be intercepted by the service
+ // worker of the physical origin. This has the effect that, for now,
+ // suborigins do not work with service workers. See
+ // https://w3c.github.io/webappsec-suborigins/.
+ SecurityOrigin* sourceOrigin = context().getSecurityOrigin();
+ if (sourceOrigin && sourceOrigin->hasSuborigin()) {
+ resourceRequest.setServiceWorkerMode(
+ WebURLRequest::ServiceWorkerMode::None);
+ }
+
resourceRequest.setAllowStoredCredentials(
request.options().allowCredentials == AllowStoredCredentials);
return Continue;
@@ -1249,14 +1259,6 @@ bool ResourceFetcher::startLoad(Resource* resource) {
// crbug.com/632580
resource->setResourceRequest(request);
- // Resource requests from suborigins should not be intercepted by the service
- // worker of the physical origin. This has the effect that, for now,
- // suborigins do not work with service workers. See
- // https://w3c.github.io/webappsec-suborigins/.
- SecurityOrigin* sourceOrigin = context().getSecurityOrigin();
- if (sourceOrigin && sourceOrigin->hasSuborigin())
- request.setServiceWorkerMode(WebURLRequest::ServiceWorkerMode::None);
-
ResourceLoader* loader = ResourceLoader::create(this, resource);
if (resource->shouldBlockLoadEvent())
m_loaders.insert(loader);
@@ -1264,7 +1266,7 @@ bool ResourceFetcher::startLoad(Resource* resource) {
m_nonBlockingLoaders.insert(loader);
storePerformanceTimingInitiatorInformation(resource);
- resource->setFetcherSecurityOrigin(sourceOrigin);
+ resource->setFetcherSecurityOrigin(context().getSecurityOrigin());
loader->activateCacheAwareLoadingIfNeeded(request);
loader->start(request);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698