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..2198eb8355fb89a288e53a3b5b524f87468058eb 100644 |
--- a/extensions/browser/service_worker_manager.cc |
+++ b/extensions/browser/service_worker_manager.cc |
@@ -48,4 +48,20 @@ 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) { |
+ // TODO(lazyboy): This is racy because this relies on DeleteForOrigin() to |
lazyboy
2015/11/10 00:45:44
How can we fix this?
Or, is there any guarantee th
Devlin
2015/11/10 16:59:50
Hmm... I would hope that it wouldn't be racy, beca
|
+ // finish before updated extension (re)registers the service worker. |
+ content::BrowserContext::GetStoragePartitionForSite(browser_context_, |
+ extension->url()) |
+ ->GetServiceWorkerContext() |
+ ->DeleteForOrigin(extension->url(), base::Bind(&EmptySuccessCallback)); |
Devlin
2015/11/10 16:59:50
(Sorry if this was just a placeholder and I'm sayi
lazyboy
2015/11/11 00:56:27
I've changed this to eventually call ServiceWorker
|
+ } |
+} |
+ |
} // namespace extensions |