Skip to content

Proposal: browser.tabs.TAB_ID_ASSOCIATED #903

@carlosjeurissen

Description

@carlosjeurissen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triage: chromeChrome needs to assess this issue for the first timeneeds-triage: firefoxFirefox needs to assess this issue for the first timeneeds-triage: safariSafari needs to assess this issue for the first timeproposalProposal for a change or new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions