aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2015-03-09 12:28:03 +0000
committerStephen Blott2015-03-09 12:28:03 +0000
commit2db6971cbeffcdf24c42936fbae3c596f1bbecf0 (patch)
tree8f5fa85f5361f0869374ed8338768f83dffd75d7
parentf407fe2feba1ffa4ac3fdd50e431ac51b8ec630f (diff)
downloadvimium-2db6971cbeffcdf24c42936fbae3c596f1bbecf0.tar.bz2
Inject content scripts on install/upgrade only.
We should not inject content scripts on chrome upgrades.
-rw-r--r--background_scripts/main.coffee4
1 files changed, 3 insertions, 1 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 4ab88019..b390fe1c 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -2,7 +2,9 @@ root = exports ? window
# The browser may have tabs already open. We inject the content scripts immediately so that they work straight
# away.
-chrome.runtime.onInstalled.addListener ->
+chrome.runtime.onInstalled.addListener ({ reason }) ->
+ # See https://developer.chrome.com/extensions/runtime#event-onInstalled
+ return if reason in [ "chrome_update", "shared_module_update" ]
manifest = chrome.runtime.getManifest()
# Content scripts loaded on every page should be in the same group. We assume it is the first.
contentScripts = manifest.content_scripts[0]