diff --git a/background/background.js b/background/background.js index 826a2481..5598d7ac 100644 --- a/background/background.js +++ b/background/background.js @@ -4,7 +4,7 @@ global handleCssTransitionBug detectSloppyRegexps global openEditor global styleViaAPI global loadScript -global usercss styleManager db msg +global usercss styleManager db msg navigatorUtil */ 'use strict'; @@ -140,7 +140,12 @@ prefs.subscribe(['iconset'], () => styles: {}, })); -chrome.navigator. +navigatorUtil.onUrlChange(({url, tabId, frameId}) => { + if (frameId === 0) { + tabIcons.delete(tabId); + updateIcon({tab: {id: tabId, url}}); + } +}); // ************************************************************************* chrome.runtime.onInstalled.addListener(({reason}) => { diff --git a/background/navigator-util.js b/background/navigator-util.js index 568527c1..ea233aca 100644 --- a/background/navigator-util.js +++ b/background/navigator-util.js @@ -1,10 +1,10 @@ +/* global promisify */ 'use strict'; const navigatorUtil = (() => { const handler = { urlChange: null }; - let listeners; const tabGet = promisify(chrome.tabs.get.bind(chrome.tabs)); return extendNative({onUrlChange}); @@ -21,15 +21,18 @@ const navigatorUtil = (() => { chrome.webNavigation.onCommitted.addListener(data => fixNTPUrl(data) - .then(() => executeCallbacks(handler.urlChange, data, 'committed')); + .then(() => executeCallbacks(handler.urlChange, data, 'committed')) + ); chrome.webNavigation.onHistoryStateUpdated.addListener(data => fixNTPUrl(data) - .then(() => executeCallbacks(handler.urlChange, data, 'historyStateUpdated')); + .then(() => executeCallbacks(handler.urlChange, data, 'historyStateUpdated')) + ); chrome.webNavigation.onReferenceFragmentUpdated.addListener(data => fixNTPUrl(data) - .then(() => executeCallbacks(handler.urlChange, data, 'referenceFragmentUpdated')); + .then(() => executeCallbacks(handler.urlChange, data, 'referenceFragmentUpdated')) + ); } function fixNTPUrl(data) { diff --git a/background/style-via-api.js b/background/style-via-api.js index e895e6be..459b238a 100644 --- a/background/style-via-api.js +++ b/background/style-via-api.js @@ -1,4 +1,4 @@ -/* global getStyles API_METHODS */ +/* global getStyles API_METHODS styleManager */ 'use strict'; API_METHODS.styleViaAPI = !CHROME && (() => { @@ -45,6 +45,7 @@ API_METHODS.styleViaAPI = !CHROME && (() => { return styleManager.getSectionsByUrl(url, filter).then(sections => { const tasks = []; for (const section of Object.values(sections)) { + const styleId = section.id; const code = section.code; if (!code) { delete frameStyles[styleId]; diff --git a/background/update.js b/background/update.js index ceb604ac..e63bf4a8 100644 --- a/background/update.js +++ b/background/update.js @@ -2,7 +2,7 @@ global getStyles saveStyle styleSectionsEqual global calcStyleDigest cachedStyles getStyleWithNoCode global usercss semverCompare -global API_METHODS +global API_METHODS styleManager */ 'use strict';