set default icon (shown before webNavigation API kicks in)

This commit is contained in:
tophf 2017-06-28 15:48:13 +03:00
parent ece3822891
commit 877d8b19e0

View File

@ -47,6 +47,11 @@ if ('commands' in chrome) {
chrome.commands.onCommand.addListener(command => browserCommands[command]()); 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}) => { const onInstall = ({reason}) => {
@ -272,7 +277,7 @@ function updateIcon(tab, styles) {
// TODO: add Edge preferred sizes: 20, 25, 30, 40 // TODO: add Edge preferred sizes: 20, 25, 30, 40
}, },
}, () => { }, () => {
if (chrome.runtime.lastError) { if (chrome.runtime.lastError || tab.id === undefined) {
return; return;
} }
// Vivaldi bug workaround: setBadgeText must follow setBadgeBackgroundColor // Vivaldi bug workaround: setBadgeText must follow setBadgeBackgroundColor