Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,36 @@ browser-compat: webextensions.api.action.isEnabled
sidebar: addonsidebar
---

Returns `true` if the browser action is enabled.
Returns `true` if the browser action is enabled. Returns the global status if the `details` parameter is omitted or empty, or all its properties are empty.

> [!NOTE]
> This API is available in Manifest V3 or higher.

This is an asynchronous function that returns a [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).

## Syntax

```js-nolint
let gettingIsEnabled = browser.action.isEnabled(
details // object
details // optional object or integer
)
```

### Parameters

- `details`
- : `object`. An object optionally containing the `tabId` or `windowId` to check.
- `details` {{optional_inline}}
- : `integer` or `object`. An an `integer` it defines the ID of a tab to check. As an `object` it contains:
- `tabId` {{optional_inline}}
- : `integer`. ID of a tab to check.
- `windowId` {{optional_inline}}
- : `integer`. ID of a window to check.

<!---->
If `windowId` and `tabId` are supplied, the function fails.

- If windowId and tabId are both supplied, the function fails.
- If windowId and tabId are both omitted, the global enabled/disabled status is returned.
> [!NOTE]
> Chrome only support the `details` as an `integer`, the ID of a tab to check.

### Return value

A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that will be fulfilled with `true` if the extension's browser action is enabled, and `false` otherwise.
A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) fulfilled with `true` if the extension's browser action is enabled, and `false` otherwise.

## Examples

Expand All @@ -49,7 +47,7 @@ browser.action.isEnabled({}).then((result) => {
});
```

Check the state of the currently active tab:
Check the state of the active tab:

```js
async function enabledInActiveTab() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,30 @@ browser-compat: webextensions.api.browserAction.isEnabled
sidebar: addonsidebar
---

Returns `true` if the browser action is enabled.

This is an asynchronous function that returns a [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
Returns `true` if the browser action is enabled. Returns the global status if the `details` parameter is omitted or empty, or all its properties are empty.

## Syntax

```js-nolint
let gettingIsEnabled = browser.browserAction.isEnabled(
details // object
details // optional object or integer
)
```

### Parameters

- `details`
- : `object`. An object optionally containing the `tabId` or `windowId` to check.
- `details` {{optional_inline}}
- : `integer` or `object`. An an `integer` it defines the ID of a tab to check. As an `object` it contains:
- `tabId` {{optional_inline}}
- : `integer`. ID of a tab to check.
- `windowId` {{optional_inline}}
- : `integer`. ID of a window to check.

<!---->

- If windowId and tabId are both supplied, the function fails.
- If windowId and tabId are both omitted, the global enabled/disabled status is returned.
If `windowId` and `tabId` are supplied, the function fails.

### Return value

A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that will be fulfilled with `true` if the extension's browser action is enabled, and `false` otherwise.
A [`Promise`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) fulfilled with `true` if the extension's browser action is enabled, and `false` otherwise.

## Examples

Expand All @@ -46,7 +41,7 @@ browser.browserAction.isEnabled({}).then((result) => {
});
```

Check the state of the currently active tab:
Check the state of the active tab:

```js
async function enabledInActiveTab() {
Expand Down
1 change: 1 addition & 0 deletions files/en-us/mozilla/firefox/releases/149/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Firefox 149 is the current [Beta version of Firefox](https://www.firefox.com/en-

## Changes for add-on developers

- Adds support for `tabId` as a top-level parameter in {{WebExtAPIRef("action.isEnabled")}} and {{WebExtAPIRef("browserAction.isEnabled")}}. This change provides for compatibility with the Chrome implementation of `action.isEnabled`. ([Firefox bug 2013477](https://bugzil.la/2013477))
- A user gesture is no longer required for {{WebExtAPIRef("action.openPopup")}} and {{WebExtAPIRef("browserAction.openPopup")}} to open a popup. This feature was available behind the `extensions.openPopupWithoutUserGesture.enabled` preference from Firefox 108. This change aligns Firefox's behavior with Chrome and Safari. ([Firefox bug 1799344](https://bugzil.la/1799344))

<!-- ### Removals -->
Expand Down
62 changes: 31 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
},
"devDependencies": {
"@apideck/better-ajv-errors": "^0.3.6",
"@mdn/fred": "2.2.1",
"@mdn/fred": "2.3.0",
"@octokit/rest": "^22.0.1",
"ajv": "^8.18.0",
"ajv-formats": "^3.0.1",
Expand Down
Loading