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

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp

Issue 2343053002: Service worker bypass for resource requests from suborigins (Closed)
Patch Set: More nits from falken Created 4 years, 3 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: third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
index 5ff0d0d3861a31c60532f733a76016d704734229..f1e4e28f0305003bfa5358121f0388d2476a9067 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -1032,6 +1032,14 @@ bool ResourceFetcher::startLoad(Resource* resource)
ResourceRequest request(resource->resourceRequest());
willSendRequest(resource->identifier(), request, ResourceResponse(), resource->options());
+ // 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.setSkipServiceWorker(WebURLRequest::SkipServiceWorker::All);
+
ResourceLoader* loader = ResourceLoader::create(this, resource);
if (resource->shouldBlockLoadEvent())
m_loaders.add(loader);
@@ -1039,7 +1047,7 @@ bool ResourceFetcher::startLoad(Resource* resource)
m_nonBlockingLoaders.add(loader);
storeResourceTimingInitiatorInformation(resource);
- resource->setFetcherSecurityOrigin(context().getSecurityOrigin());
+ resource->setFetcherSecurityOrigin(sourceOrigin);
loader->start(request, context().loadingTaskRunner(), context().defersLoading());
return true;
}

Powered by Google App Engine
This is Rietveld 408576698