Inconsistency in browser.action
: windowId
key and enable()
/disable()
arguments
#463
Labels
implemented: firefox
Implemented in Firefox
inconsistency
Inconsistent behavior across browsers
proposal
Proposal for a change or new feature
supportive: chrome
Supportive from Chrome
supportive: safari
Supportive from Safari
There is an inconsistency in the
browser.action
APIs with thewindowId
key. Currently, this key is only supported in Firefox but is slated for future implementation in Safari. This feature is essential for extensions aiming to synchronize action customizations across all tabs within a specific window.In Firefox, the
windowId
key allows extensions to uniformly apply action states to all tabs within a designated window.In Firefox's existing API design, the options dictionary should specify either a
tabId
or awindowId
. This approach ensures that action states are applied on either a per-tab or per-window basis. Safari plans to adopt this behavior.Contrastingly, the
enable()
anddisable()
methods currently only accept atabId
as an argument:Proposed Changes
To harmonize these APIs, I propose adopting
windowId
in all action methods to match Firefox's existing behavior. Additionally, a newsetEnabled()
method is proposed. This method would accept an options dictionary that can includetabId
,windowId
, andenabled
keys.This new method offers a consistent way to manage action enabled states across both tabs and windows. The existing
enable()
anddisable()
methods would be deprecated until removed in a future manifest version.Alternate Solution
An alternative to introducing
setEnabled()
would be to update the existingenable()
anddisable()
methods. These methods could accept an options dictionary, in addition to the currenttabId
argument:This alternative also maintains backward compatibility while providing the flexibility to manage action enabled states across different tabs and windows.
Compatibility Considerations
This proposal aims to extend existing APIs in a backward-compatible manner. Nevertheless, the introduction of the
windowId
key and an options dictionary inenable()
anddisable()
could cause exceptions in older browsers. The introduction ofsetEnabled()
offers the advantage of being feature-detectable from JavaScript. Developers would be strongly advised to test compatibility.The text was updated successfully, but these errors were encountered: