Skip to content

Commit

Permalink
Eliminate spurious uncaught exception
Browse files Browse the repository at this point in the history
  • Loading branch information
raxod502 committed Nov 11, 2022
1 parent 7afd4cc commit b35a7c7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions extension/background.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
// chrome.action for Chrome, browser.browserAction for Firefox
(chrome.action || browser.browserAction).onClicked.addListener(() => {
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) =>
chrome.tabs.sendMessage(tabs[0].id, { event: "hypercastInit" })
);
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
try {
chrome.tabs.sendMessage(tabs[0].id, { event: "hypercastInit" });
} catch (err) {
console.error(
"User clicked extension icon but content script was not active"
);
}
});
});

0 comments on commit b35a7c7

Please sign in to comment.