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

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

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: Move API change to another patch and address comments Created 3 years, 5 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: content/browser/service_worker/service_worker_context_request_handler.cc
diff --git a/content/browser/service_worker/service_worker_context_request_handler.cc b/content/browser/service_worker/service_worker_context_request_handler.cc
index 13b0f6b9b3963a429b1ab5d68347da5e0577a546..7b88ab4713c2037d35dbbf5530e591ea80b444cf 100644
--- a/content/browser/service_worker/service_worker_context_request_handler.cc
+++ b/content/browser/service_worker/service_worker_context_request_handler.cc
@@ -210,7 +210,13 @@ net::URLRequestJob* ServiceWorkerContextRequestHandler::MaybeCreateJobImpl(
int extra_load_flags = 0;
base::TimeDelta time_since_last_check =
base::Time::Now() - registration->last_update_check();
- if (time_since_last_check > kServiceWorkerScriptMaxCacheAge ||
+ bool should_bypass_cache =
+ (is_main_script && registration->update_via_cache() !=
+ blink::WebServiceWorkerUpdateViaCache::kAll) ||
+ registration->update_via_cache() ==
+ blink::WebServiceWorkerUpdateViaCache::kNone;
+ if (should_bypass_cache ||
+ time_since_last_check > kServiceWorkerScriptMaxCacheAge ||
version_->force_bypass_cache_for_scripts()) {
extra_load_flags = net::LOAD_BYPASS_CACHE;
}

Powered by Google App Engine
This is Rietveld 408576698