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

Unified Diff: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp

Issue 2105503002: Skip foreign fetch when the skipServiceWorker flag is set on a request. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix resource loading Created 4 years, 6 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/loader/DocumentThreadableLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
index a366b38b3696fee964b23fdc6283b8508601b4c8..fce33b053886377d9478c2a7d7a5be8b02706e13 100644
--- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -97,7 +97,7 @@ private:
// No-CORS requests are allowed for all these contexts, and plugin contexts with
// private permission when we set skipServiceWorker flag in PepperURLLoaderHost.
-bool IsNoCORSAllowedContext(WebURLRequest::RequestContext context, bool skipServiceWorker)
+bool IsNoCORSAllowedContext(WebURLRequest::RequestContext context, WebURLRequest::SkipServiceWorker skipServiceWorker)
{
switch (context) {
case WebURLRequest::RequestContextAudio:
@@ -108,7 +108,7 @@ bool IsNoCORSAllowedContext(WebURLRequest::RequestContext context, bool skipServ
case WebURLRequest::RequestContextScript:
return true;
case WebURLRequest::RequestContextPlugin:
- return skipServiceWorker;
+ return skipServiceWorker == WebURLRequest::SkipServiceWorker::All;
default:
return false;
}
@@ -238,10 +238,10 @@ void DocumentThreadableLoader::start(const ResourceRequest& request)
// We assume that ServiceWorker is skipped for sync requests and unsupported
// protocol requests by content/ code.
- if (m_async && !request.skipServiceWorker() && SchemeRegistry::shouldTreatURLSchemeAsAllowingServiceWorkers(request.url().protocol()) && m_document->fetcher()->isControlledByServiceWorker()) {
+ if (m_async && request.skipServiceWorker() == WebURLRequest::SkipServiceWorker::None && SchemeRegistry::shouldTreatURLSchemeAsAllowingServiceWorkers(request.url().protocol()) && m_document->fetcher()->isControlledByServiceWorker()) {
if (newRequest.fetchRequestMode() == WebURLRequest::FetchRequestModeCORS || newRequest.fetchRequestMode() == WebURLRequest::FetchRequestModeCORSWithForcedPreflight) {
m_fallbackRequestForServiceWorker = ResourceRequest(request);
- m_fallbackRequestForServiceWorker.setSkipServiceWorker(true);
+ m_fallbackRequestForServiceWorker.setSkipServiceWorker(WebURLRequest::SkipServiceWorker::Controlling);
horo 2016/06/28 12:10:02 |m_fallbackRequestForServiceWorker| is used when a
Marijn Kruisselbrink 2016/06/28 17:06:13 Actually that is precisely the case where I don't
horo 2016/06/29 04:06:14 Ah got it. Please write comments about it and that
Marijn Kruisselbrink 2016/06/29 17:12:15 Done
}
loadRequest(newRequest, m_resourceLoaderOptions);
// |this| may be dead here.
@@ -829,7 +829,7 @@ void DocumentThreadableLoader::loadActualRequest()
// controlled by a SW when the preflight request was sent, a new SW may be
// controlling the page now by calling clients.claim(). We should not send
// the actual request to the SW. https://crbug.com/604583
- actualRequest.setSkipServiceWorker(true);
+ actualRequest.setSkipServiceWorker(WebURLRequest::SkipServiceWorker::All);
loadRequest(actualRequest, actualOptions);
// |this| may be dead here in async mode.

Powered by Google App Engine
This is Rietveld 408576698