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

Unified Diff: content/browser/service_worker/service_worker_controllee_request_handler.cc

Issue 1280133002: Set skip_service_worker in ServiceWorkerControlleeRequestHandler only for subresource requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add .h file. fix comment Created 5 years, 4 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 | « content/browser/service_worker/service_worker_controllee_request_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_controllee_request_handler.cc
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler.cc b/content/browser/service_worker/service_worker_controllee_request_handler.cc
index a8af415c1c55e750fffe72b5243be9f3263d34f5..3977e3cf3913af6ebd83809cd4f19ad762a0476b 100644
--- a/content/browser/service_worker/service_worker_controllee_request_handler.cc
+++ b/content/browser/service_worker/service_worker_controllee_request_handler.cc
@@ -86,11 +86,8 @@ net::URLRequestJob* ServiceWorkerControlleeRequestHandler::MaybeCreateJob(
// We've come here by restart, we already have original request and it
// tells we should fallback to network. (Case B-c)
- // Once the request was fallbacked to the network, skip-service-worker flag
- // must be set and the request shoud not go to the service worker.
if ((job_.get() && job_->ShouldFallbackToNetwork()) || skip_service_worker_) {
- skip_service_worker_ = true;
- job_ = NULL;
+ FallbackToNetwork();
return NULL;
}
@@ -112,7 +109,7 @@ net::URLRequestJob* ServiceWorkerControlleeRequestHandler::MaybeCreateJob(
// If we know we can fallback to network at this point (in case
// the storage lookup returned immediately), just return NULL here to
// fallback to network.
- job_ = NULL;
+ FallbackToNetwork();
return NULL;
}
@@ -276,4 +273,13 @@ void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() {
job_->ForwardToServiceWorker();
}
+void ServiceWorkerControlleeRequestHandler::FallbackToNetwork() {
+ // Once a subresource request was fallbacked to the network, we set
+ // |skip_service_worker_| because the request should not go to the service
+ // worker.
+ if (!is_main_resource_load_)
+ skip_service_worker_ = true;
+ job_ = NULL;
+}
+
} // namespace content
« no previous file with comments | « content/browser/service_worker/service_worker_controllee_request_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698