Skip to content

Commit

Permalink
fix: open a new tab if script source tab is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
tophf committed Nov 1, 2024
1 parent f0c6629 commit 8c28fa4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/background/utils/tab-redirector.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ addPublicCommands({
cache.put(`confirm-${confirmKey}`, { incognito, url, from, tabId, fs, ff: FIREFOX });
const confirmUrl = CONFIRM_URL_BASE + confirmKey;
const { [kWindowId]: windowId } = canReplaceCurTab
? await browser.tabs.update(tabId, { url: confirmUrl })
: await commands.TabOpen({ url: confirmUrl, active: !!active }, { tab });
// The tab may have been closed already, in which case we'll open a new tab
&& await browser.tabs.update(tabId, { url: confirmUrl }).catch(noop)
|| await commands.TabOpen({ url: confirmUrl, active: !!active }, { tab });
if (active && windowId !== tab[kWindowId]) {
await browserWindows?.update(windowId, { focused: true });
}
Expand Down

0 comments on commit 8c28fa4

Please sign in to comment.