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

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: test updated 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
« no previous file with comments | « extensions/browser/service_worker_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « extensions/browser/service_worker_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698