diff --git a/background/background.js b/background/background.js index 47261b53..2a76f8ed 100644 --- a/background/background.js +++ b/background/background.js @@ -30,14 +30,21 @@ chrome.runtime.onMessage.addListener(onRuntimeMessage); listener('styleReplaceAll', data)); } -chrome.contextMenus.onClicked.addListener((info, tab) => - contextMenus[info.menuItemId].click(info, tab)); +if (chrome.contextMenus) { + chrome.contextMenus.onClicked.addListener((info, tab) => + contextMenus[info.menuItemId].click(info, tab)); +} -if ('commands' in chrome) { +if (chrome.commands) { // Not available in Firefox - https://bugzilla.mozilla.org/show_bug.cgi?id=1240350 chrome.commands.onCommand.addListener(command => browserCommands[command]()); } +if (!chrome.browserAction || + !['setIcon', 'setBadgeBackgroundColor', 'setBadgeText'].every(name => chrome.browserAction[name])) { + window.updateIcon = () => {}; +} + // ************************************************************************* // set the default icon displayed after a tab is created until webNavigation kicks in prefs.subscribe(['iconset'], () => updateIcon({id: undefined}, {})); @@ -108,7 +115,7 @@ contextMenus = Object.assign({ } }); -{ +if (chrome.contextMenus) { const createContextMenus = (ids = Object.keys(contextMenus)) => { for (const id of ids) { const item = Object.assign({id}, contextMenus[id]); diff --git a/edit.html b/edit.html index 36393b74..c13e3c75 100644 --- a/edit.html +++ b/edit.html @@ -1,6 +1,7 @@ - + +