Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #2990, avoid Invalid tab ID when an active tab is closed
Browse files Browse the repository at this point in the history
The code always tries to make the icon not-active, but one case when it tries is when the tab has been closed
  • Loading branch information
ianb committed Jun 8, 2017
1 parent 03cd7be commit 7d1731a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions addon/webextension/background/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,14 @@ this.main = (function() {
if ((!hasSeenOnboarding) && !active) {
path = "icons/icon-starred-32.svg";
}
browser.browserAction.setIcon({path, tabId});
browser.browserAction.setIcon({path, tabId}).catch((error) => {
// FIXME: use errorCode
if (error.message && /Invalid tab ID/.test(error.message)) {
// This is a normal exception that we can ignore
} else {
catcher.unhandled(error);
}
});
}

function toggleSelector(tab) {
Expand Down Expand Up @@ -228,7 +235,7 @@ this.main = (function() {
});

communication.register("closeSelector", (sender) => {
setIconActive(false, sender.tab.id)
setIconActive(false, sender.tab.id);
});

catcher.watchPromise(communication.sendToBootstrap("getOldDeviceInfo").then((deviceInfo) => {
Expand Down

0 comments on commit 7d1731a

Please sign in to comment.