From b514e9b5e5daad4c93ebc5fea384501439d9a91a Mon Sep 17 00:00:00 2001 From: ACTCD <101378590+ACTCD@users.noreply.github.com> Date: Tue, 30 Jan 2024 18:24:19 +0800 Subject: [PATCH] fix: ensure async function finish before window closes --- src/ext/action-popup/App.svelte | 15 +++++++-------- src/ext/shared/utils.js | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/ext/action-popup/App.svelte b/src/ext/action-popup/App.svelte index 511bd6fd..09bfe195 100644 --- a/src/ext/action-popup/App.svelte +++ b/src/ext/action-popup/App.svelte @@ -484,6 +484,11 @@ } }); + async function gotoExtensionPage() { + await openExtensionPage(); + window.close(); + } + /** * Temporary settings page entrance for beta test (iOS) * @todo new permanent button will be added via popup refactoring @@ -524,7 +529,7 @@ {/if} {#if showBetaNews && platform !== "macos"}
- NEW: is + NEW: is now available on iOS! {#if !inactive && platform === "macos"} diff --git a/src/ext/shared/utils.js b/src/ext/shared/utils.js index 8f82fc96..208030e5 100644 --- a/src/ext/shared/utils.js +++ b/src/ext/shared/utils.js @@ -373,8 +373,8 @@ export async function openExtensionPage() { const tabs = await browser.tabs.query({ url }); const tab = tabs.find((e) => e.url.startsWith(url)); if (!tab) return browser.tabs.create({ url }); - browser.tabs.update(tab.id, { active: true }); - browser.windows.update(tab.windowId, { focused: true }); + await browser.tabs.update(tab.id, { active: true }); + await browser.windows.update(tab.windowId, { focused: true }); } /**