-
Notifications
You must be signed in to change notification settings - Fork 72
Description
Introduction
This was briefly discussed in TPAC2023 and TPAC2024. Extension action popups want to know the tabId of the tab associated to the current popup to apply actions like scripting.executeScript(), and to know which tab the extension was granted activeTab permission for.
Currently, the activeTab (tabs.query({ currentWindow: true, active: true })) is used as a guess by the extension for the associated tab id. However this is conceptually different and not guaranteed to be the same as the associated tab id.
API design
Introducing a browser.tabs.TAB_ID_ASSOCIATED constant, as proposed in the 2025-11-10 TPAC2025 meeting.
Getting the actual id could be achieve by calling browser.tabs.get(browser.tabs.TAB_ID_ASSOCIATED). This also has the benefit of being potentially supported in other extension contexts like devPanels and sidebars.
Notes
Previously a direct property browser.action.associatedTabId has been proposed. See previous discussion here:
#316