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

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: change useCache to updateViaCache Created 3 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: 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 364e41f751beaf928cc93d5cc3605488c981ab52..611dee845e3acfa6b98f89b3adc912aaf96b18b0 100644
--- a/content/browser/service_worker/service_worker_context_request_handler.cc
+++ b/content/browser/service_worker/service_worker_context_request_handler.cc
@@ -209,7 +209,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 no_update_via_cache =
nhiroki 2017/06/21 15:04:59 |no_update_via_cache| sounds a bit confusing. How
yuryu 2017/07/20 10:15:12 Done.
+ (is_main_script && registration->update_via_cache() !=
+ blink::WebServiceWorkerUpdateViaCache::kAll) ||
+ (!is_main_script && registration->update_via_cache() ==
nhiroki 2017/06/21 15:04:59 |!is_main_script| would be unnecessary.
yuryu 2017/07/20 10:15:12 I intended to reflect the spec, where algorithms f
+ blink::WebServiceWorkerUpdateViaCache::kNone);
+ if (no_update_via_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