summaryrefslogtreecommitdiffstats
path: root/extensions/shell
diff options
context:
space:
mode:
authorrdevlin.cronin <rdevlin.cronin@chromium.org>2015-09-10 12:21:45 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-10 19:23:52 +0000
commitf5863da15d5c40c66873d36fd403ac96b8172828 (patch)
tree788f6e9191453fb11e0c5b8110dceaa56c7c7045 /extensions/shell
parent73d92c7c8328979eb489a8af59b8d61940a296c6 (diff)
downloadchromium_src-f5863da15d5c40c66873d36fd403ac96b8172828.zip
chromium_src-f5863da15d5c40c66873d36fd403ac96b8172828.tar.gz
chromium_src-f5863da15d5c40c66873d36fd403ac96b8172828.tar.bz2
Don't Allow Service Workers for Unloaded Extensions
Extensions are interesting, in that they can be unloaded and reloaded, and their state should be the same after this (especially since it can happen on every browser start/stop). Any service workers that an extension has should not be running during the time that the extension is not loaded, but on reload, these workers should be put in place again, and should maintain their cache. For this, check if the extension is loaded in AllowServiceWorkers(), and stop any running service workers when the extension is unloaded. BUG=519326 TBR=kinuko@chromium.org (small changes to misc content/ files) Review URL: https://codereview.chromium.org/1313213002 Cr-Commit-Position: refs/heads/master@{#348208}
Diffstat (limited to 'extensions/shell')
-rw-r--r--extensions/shell/browser/shell_extension_system.cc6
-rw-r--r--extensions/shell/browser/shell_extension_system.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/extensions/shell/browser/shell_extension_system.cc b/extensions/shell/browser/shell_extension_system.cc
index 7031452..0457491 100644
--- a/extensions/shell/browser/shell_extension_system.cc
+++ b/extensions/shell/browser/shell_extension_system.cc
@@ -21,6 +21,7 @@
#include "extensions/browser/null_app_sorting.h"
#include "extensions/browser/quota_service.h"
#include "extensions/browser/runtime_data.h"
+#include "extensions/browser/service_worker_manager.h"
#include "extensions/common/constants.h"
#include "extensions/common/file_util.h"
@@ -98,6 +99,7 @@ void ShellExtensionSystem::Shutdown() {
}
void ShellExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
+ service_worker_manager_.reset(new ServiceWorkerManager(browser_context_));
runtime_data_.reset(
new RuntimeData(ExtensionRegistry::Get(browser_context_)));
quota_service_.reset(new QuotaService);
@@ -116,6 +118,10 @@ ManagementPolicy* ShellExtensionSystem::management_policy() {
return nullptr;
}
+ServiceWorkerManager* ShellExtensionSystem::service_worker_manager() {
+ return service_worker_manager_.get();
+}
+
SharedUserScriptMaster* ShellExtensionSystem::shared_user_script_master() {
return nullptr;
}
diff --git a/extensions/shell/browser/shell_extension_system.h b/extensions/shell/browser/shell_extension_system.h
index 29d2982..f042f2d 100644
--- a/extensions/shell/browser/shell_extension_system.h
+++ b/extensions/shell/browser/shell_extension_system.h
@@ -47,6 +47,7 @@ class ShellExtensionSystem : public ExtensionSystem {
ExtensionService* extension_service() override;
RuntimeData* runtime_data() override;
ManagementPolicy* management_policy() override;
+ ServiceWorkerManager* service_worker_manager() override;
SharedUserScriptMaster* shared_user_script_master() override;
StateStore* state_store() override;
StateStore* rules_store() override;
@@ -72,6 +73,7 @@ class ShellExtensionSystem : public ExtensionSystem {
// Data to be accessed on the IO thread. Must outlive process_manager_.
scoped_refptr<InfoMap> info_map_;
+ scoped_ptr<ServiceWorkerManager> service_worker_manager_;
scoped_ptr<RuntimeData> runtime_data_;
scoped_ptr<QuotaService> quota_service_;
scoped_ptr<AppSorting> app_sorting_;