Fix connection error when opening popup
This commit is contained in:
parent
66647f69f6
commit
1700ebb114
|
@ -18,11 +18,13 @@ const getTabInfo = async () => {
|
|||
const tabUrl = browser.tabs.sendMessage(tab.id, { message: "getTabUrl" });
|
||||
const selectedText = browser.tabs.sendMessage(tab.id, { message: "getSelectedText" });
|
||||
const isEnabledOnPage = browser.tabs.sendMessage(tab.id, { message: "getEnabled" });
|
||||
|
||||
const tabInfo = await Promise.all([tabUrl, selectedText, isEnabledOnPage]);
|
||||
return {
|
||||
isConnected: true,
|
||||
url: await tabUrl,
|
||||
selectedText: await selectedText,
|
||||
isEnabledOnPage: await isEnabledOnPage
|
||||
url: tabInfo[0],
|
||||
selectedText: tabInfo[1],
|
||||
isEnabledOnPage: tabInfo[2]
|
||||
};
|
||||
} catch (e) {
|
||||
return { isConnected: false, url: "", selectedText: "", isEnabledOnPage: false };
|
||||
|
|
Loading…
Reference in a new issue