From 1700ebb114dc065d938cbeb3a65e7fea08dd3595 Mon Sep 17 00:00:00 2001 From: sienori Date: Thu, 22 Aug 2019 15:09:29 +0900 Subject: [PATCH] Fix connection error when opening popup --- src/popup/components/PopupPage.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/popup/components/PopupPage.js b/src/popup/components/PopupPage.js index 83c4370..e852c44 100644 --- a/src/popup/components/PopupPage.js +++ b/src/popup/components/PopupPage.js @@ -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 };