fix(browser): skip extension click events without an active tab

This commit is contained in:
Luke Parker 2026-11-17 05:03:35 +10:00
parent d5e398d782
commit df2b0586b9
2 changed files with 4 additions and 4 deletions

View file

@ -895,7 +895,7 @@ export function createBrowserPane(input: {
if (!existing) opening.defer(() => { if (page(binding, tabID) === tab) dispatchBinding(binding, { type: "tab.closed", tabID }) })
dispatchBinding(binding, { type: "tab.focused", tabID })
await tab.execute({ action: { type: "navigate", tabID, url }, files: [] }, signal, origin)
await tab.execute({ action: { type: "navigate", tabID, url }, files: [] }, signal, origin)
refresh(binding, tabID, tab)
opening.move()
@ -997,7 +997,7 @@ export function createBrowserPane(input: {
const target = acquire(action.tabID)
if (!target) throw new Error("Browser tab is unavailable. Call browser.tabs.list({}) and use an existing tabID.")
const result = await target.execute(command, signal, origin)
const result = await target.execute(command, signal, origin)
refresh(binding, action.tabID, target)
return result

View file

@ -258,10 +258,10 @@ export function createActions(input: {
return true
}
if (tab && privateFile(tab.url)) return true
if (!tab || privateFile(tab.url)) return true
const manifest = input.manifest(extension)
const name = manifest.version === 2 ? "browserAction" : "action"
const info = tab && tabInfo(tab, manifest.permissions.includes("activeTab") || reveals(manifest, tab.url))
const info = tabInfo(tab, manifest.permissions.includes("activeTab") || reveals(manifest, tab.url))
input.emit(`${name}.onClicked`, [info], extension.id)
return true