emoving call to displayBrowserActionBadge in messagehandler and updating badge.js

This commit is contained in:
Aishat Akinyemi 2019-10-18 16:11:22 +01:00
parent 0ce57b01ab
commit e04a7b36cb
2 changed files with 3 additions and 8 deletions

View file

@ -1,8 +1,8 @@
const MAJOR_VERSIONS = ["2.3.0", "2.4.0"]; const MAJOR_VERSIONS = ["2.3.0", "2.4.0"];
const badge = { const badge = {
async init() { async init() {
const currentWindow = await browser.windows.getCurrent(); const showVersionIndicator = await browser.windows.getCurrent();
this.displayBrowserActionBadge(currentWindow.incognito); this.displayBrowserActionBadge(showVersionIndicator);
}, },
disableAddon(tabId) { disableAddon(tabId) {
@ -16,7 +16,7 @@ const badge = {
browser.browserAction.setBadgeBackgroundColor({color: color}); browser.browserAction.setBadgeBackgroundColor({color: color});
browser.browserAction.setBadgeText({text: text}); browser.browserAction.setBadgeText({text: text});
} }
if(action==="remove") { if(action==="showVersionIndicator") {
const ActionBadgesClickedStorage = await browser.storage.local.get({browserActionBadgesClicked: []}); const ActionBadgesClickedStorage = await browser.storage.local.get({browserActionBadgesClicked: []});
if (MAJOR_VERSIONS.indexOf(extensionInfo.version) > -1 && if (MAJOR_VERSIONS.indexOf(extensionInfo.version) > -1 &&
ActionBadgesClickedStorage.browserActionBadgesClicked.indexOf(extensionInfo.version) < 0) { ActionBadgesClickedStorage.browserActionBadgesClicked.indexOf(extensionInfo.version) < 0) {

View file

@ -177,11 +177,6 @@ const messageHandler = {
async onFocusChangedCallback(windowId) { async onFocusChangedCallback(windowId) {
assignManager.removeContextMenu(); assignManager.removeContextMenu();
// browserAction loses background color in new windows ...
// https://bugzil.la/1314674
// https://github.com/mozilla/testpilot-containers/issues/608
// ... so re-call displayBrowserActionBadge on window changes
badge.displayBrowserActionBadge("remove");
browser.tabs.query({active: true, windowId}).then((tabs) => { browser.tabs.query({active: true, windowId}).then((tabs) => {
if (tabs && tabs[0]) { if (tabs && tabs[0]) {
assignManager.calculateContextMenu(tabs[0]); assignManager.calculateContextMenu(tabs[0]);