From 2db6971cbeffcdf24c42936fbae3c596f1bbecf0 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Mon, 9 Mar 2015 12:28:03 +0000 Subject: Inject content scripts on install/upgrade only. We should not inject content scripts on chrome upgrades. --- background_scripts/main.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'background_scripts') 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] -- cgit v1.2.3