From 877d8b19e0944cc94ab2585dcf545142cbc7e506 Mon Sep 17 00:00:00 2001 From: tophf Date: Wed, 28 Jun 2017 15:48:13 +0300 Subject: [PATCH] set default icon (shown before webNavigation API kicks in) --- background.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/background.js b/background.js index 7b9daa43..4a9bb27b 100644 --- a/background.js +++ b/background.js @@ -47,6 +47,11 @@ if ('commands' in chrome) { chrome.commands.onCommand.addListener(command => browserCommands[command]()); } +// ************************************************************************* +// set the default icon displayed after a tab is created until webNavigation kicks in +prefs.subscribe(() => updateIcon({id: undefined}, {}), ['iconset']); +updateIcon({id: undefined}, {}); + // ************************************************************************* { const onInstall = ({reason}) => { @@ -272,7 +277,7 @@ function updateIcon(tab, styles) { // TODO: add Edge preferred sizes: 20, 25, 30, 40 }, }, () => { - if (chrome.runtime.lastError) { + if (chrome.runtime.lastError || tab.id === undefined) { return; } // Vivaldi bug workaround: setBadgeText must follow setBadgeBackgroundColor