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

Unified Diff: third_party/WebKit/Source/core/loader/FrameFetchContext.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
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
index 30d22655ac34043a79a7b0e020b46aef1e801c76..deac274149acfa38012d9fc6eb6883dbdd71305d 100644
--- a/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameFetchContext.cpp
@@ -594,6 +594,21 @@ ResourceRequestBlockedReason FrameFetchContext::canRequestInternal(Resource::Typ
bool FrameFetchContext::isControlledByServiceWorker() const
{
ASSERT(m_documentLoader || frame()->loader().documentLoader());
Yoav Weiss 2016/09/21 15:13:09 I think you'd need to rebase as this is already DC
jww 2016/09/21 16:38:12 Done.
+
+ // Service workers are bypassed by suborigins (see
+ // https://w3c.github.io/webappsec-suborigins/). Since service worker
+ // controllers are assigned based on physical origin, without knowledge of
+ // whether the context is in a suborigin, it is necessary to explicitly
+ // bypass service workers on a per-request basis. Additionally, it is
+ // necessary to explicitly return |false| here so that it is clear that the
+ // SW will be bypassed. In particular, this is important for
+ // ResourceFetcher::getCacheIdentifier(), which will return the SW's cache
+ // if the context's isControlledByServiceWorker() returns |true|, and thus
+ // will returned cached resources from the service worker. That would have
+ // the effect of not bypassing the SW.
+ if (getSecurityOrigin() && getSecurityOrigin()->hasSuborigin())
+ return false;
+
if (m_documentLoader)
return frame()->loader().client()->isControlledByServiceWorker(*m_documentLoader);
// m_documentLoader is null while loading resources from an HTML import.
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698