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

Unified Diff: extensions/browser/service_worker_manager.cc

Issue 1432823003: Add a test to cover service worker update codepath when extension is updated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use set_force_update_on_page_load() + git cl format Created 5 years, 1 month 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: extensions/browser/service_worker_manager.cc
diff --git a/extensions/browser/service_worker_manager.cc b/extensions/browser/service_worker_manager.cc
index 16167d4e3d9cfa31b25e5602c9fbb32d4b68f1b3..e85e9c8e3e6ecb130f0ec0c0d3da3a81239842d5 100644
--- a/extensions/browser/service_worker_manager.cc
+++ b/extensions/browser/service_worker_manager.cc
@@ -48,4 +48,18 @@ void ServiceWorkerManager::OnExtensionUninstalled(
->DeleteForOrigin(extension->url(), base::Bind(&EmptySuccessCallback));
}
+void ServiceWorkerManager::OnExtensionWillBeInstalled(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ bool is_update,
+ bool from_ephemeral,
+ const std::string& old_name) {
+ if (is_update) {
Devlin 2015/11/11 17:10:29 nit: A brief comment saying why we do this would p
lazyboy 2015/11/11 22:34:03 Done.
+ content::BrowserContext::GetStoragePartitionForSite(browser_context_,
+ extension->url())
+ ->GetServiceWorkerContext()
+ ->SetForceUpdateOnPageLoadForOrigin(extension->url());
+ }
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698