From f86a6489ef87ab9d7803972d38aead51cfa06776 Mon Sep 17 00:00:00 2001 From: tophf Date: Thu, 16 Mar 2017 13:17:42 +0300 Subject: [PATCH] Always try CS reinjection (safe since we ping first) --- background.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/background.js b/background.js index 63d0924a..bea7653b 100644 --- a/background.js +++ b/background.js @@ -205,19 +205,9 @@ chrome.storage.local.get('version', prefs => { } }); -// after the extension was enabled or just installed -// reason = 'update' is needed becase our listener processes only 'update' events -injectContentScripts({reason: 'update'}); +injectContentScripts(); -// after an actual update -chrome.runtime.onInstalled.addListener(injectContentScripts); - -function injectContentScripts({reason, previousVersion, id} = {}) { - // reason: install, update, chrome_update, shared_module_update - // the "install" case is ignored because it was already handled by explicit invocation of this function - if (!/update/.test(reason)) { - return; - } +function injectContentScripts() { const contentScripts = chrome.app.getDetails().content_scripts; for (let cs of contentScripts) { cs.matches = cs.matches.map(m => m == '' ? m : wildcardAsRegExp(m));