Skip to content

Move activeTabpermission information to a new concept page - #45263

Open
rebloor wants to merge 7 commits into
mdn:mainfrom
rebloor:Issue-40942-activeTab-concept-page
Open

Move activeTabpermission information to a new concept page#45263
rebloor wants to merge 7 commits into
mdn:mainfrom
rebloor:Issue-40942-activeTab-concept-page

Conversation

@rebloor

@rebloor rebloor commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Description

This change moves all information about the activeTab permission to a new concepts page (placed after the content and background script articles). It also adds an example illustrating how to use activeTab. All references to activeTab should now link back to the concept page.

Motivation

This change increases the visibility of information about activeTab, given its significance to web extension development.

Additional details

  • The extension example's manifest doesn't include the browser_specific_settings.gecko add-on ID and data_collection_permissions.
  • The Firefox 63 change to enable activeTab when activating a context menu item from the tab bar is no longer mentioned in the body text (given the change occurred 8 years ago); however, it is detailed in the tables identifying differences between the browsers.
  • We don't seem to be certain whether permission names should be enclosed quotes or not. As the quotes are part of the manifest structure, I've removed them in these changes.

Related issues and pull requests

Fiyes #40942

@rebloor
rebloor requested review from Rob--W and bacharakis August 20, 2026 17:36
@rebloor rebloor self-assigned this Aug 20, 2026
@rebloor
rebloor requested review from a team as code owners August 20, 2026 17:36
@rebloor rebloor added the Content:WebExt WebExtensions docs label Aug 20, 2026
@rebloor
rebloor requested review from pepelsbey and removed request for a team August 20, 2026 17:36
@github-actions github-actions Bot added Content:Firefox Content in the Mozilla/Firefox subtree size/m [PR only] 51-500 LoC changed labels Aug 20, 2026
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor
Preview URLs (31 pages)
External URLs (7)

URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/activeTab_permission
Title: activeTab permission


URL: /en-US/docs/Mozilla/Add-ons/WebExtensions/Chrome_incompatibilities
Title: Chrome incompatibilities


URL: /en-US/docs/Mozilla/Firefox/Releases/63
Title: Firefox 63 release notes for developers


URL: /en-US/docs/Mozilla/Firefox/Releases/126
Title: Firefox 126 release notes for developers

(comment last updated: 2026-08-29 17:51:02)

Comment thread files/en-us/mozilla/add-ons/webextensions/activetab_permission/index.md Outdated
- selecting an extension's context menu item.
- activating a keyboard shortcut defined by the extension with the {{WebExtAPIRef("commands")}} API.
- clicking a button on a page bundled with the extension.
- clicking an extension suggestion in the address bar (omnibox) (from Firefox 142).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For each of these actions, can we list the event that is triggered, and from each event also point to the activeTab documentation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


The point at which access ends varies by browser [browser_compatibility](#browser_compatibility).

## Example

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have samples from our repo that we can link in this article? If not then I can submit a PR to attach an example with the tab context menu, as an example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Table of all examples requesting activetab permission added.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering why the macro wasn't used, which auto-generates the listing of examples based on examples.json in the repo. Is it because activeTab is a permission and not fitting in the javascript_apis definition?

I suppose that a manual listing is better than no listing for now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rob--W yes, as I understand it, example.json only provides for listing JavaScript APIs using javascript_apis. This appears to be supported by the changes suggested in Add JSON schema and validation for examples.json#641. I presume that when this was originally set up, the assumption was that there would be a one-to-one between API and permission (where needed).

rebloor and others added 3 commits August 24, 2026 05:45
Co-authored-by: Rob Wu <rob@robwu.nl>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@rebloor
rebloor requested a review from Rob--W August 24, 2026 17:25
Comment thread files/en-us/mozilla/add-ons/webextensions/activetab_permission/index.md Outdated
Comment thread files/en-us/mozilla/add-ons/webextensions/activetab_permission/index.md Outdated

The point at which access ends varies by browser [browser_compatibility](#browser_compatibility).

## Example

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering why the macro wasn't used, which auto-generates the listing of examples based on examples.json in the repo. Is it because activeTab is a permission and not fitting in the javascript_apis definition?

I suppose that a manual listing is better than no listing for now.

<tbody>
<tr>
<td>
<a href="https://github.com/mdn/webextensions-examples/apply-css/"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these links are broken.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>
</td>
<td>
A context menu click on a link unlocks the page so the link can be

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unlock -> unlocks access to?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

### Other differences

- **Permission prompts**: Firefox and Chrome grant an extension's requested host permissions on installation, so `activeTab` avoids an install-time warning. Safari, by contrast, defaults host permissions to "ask", and prompts the user the first time the extension tries to access a site, offering **Allow for One Day** or **Always Allow**. Using `activeTab` avoids this prompt, as Safari treats the user's interaction with the extension as the grant.
- **Manifest V2 and V3**: `activeTab` works the same way in both manifest versions in all browsers. In Manifest V3, the {{WebExtAPIRef("scripting")}} API replaces {{WebExtAPIRef("tabs.executeScript()")}} and {{WebExtAPIRef("tabs.insertCSS()")}}, and the `"scripting"` permission is needed alongside `activeTab`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually... Firefox's MV2 was more permissive than MV3 with regards to activeTab, see https://bugzilla.mozilla.org/show_bug.cgi?id=1839200#c3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added note


The listener is passed the command's name. This matches the name given to the command in its [manifest.json entry](/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/commands).

If the extension has the [`activeTab` permission](/en-US/docs/Mozilla/Add-ons/WebExtensions/activeTab_permission), activating a command's keyboard shortcut is a user action that grants it temporary access to the active tab.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that the link here is formatted with "permission" inside the brackets. But across the PR I see that "activeTab" is the only label of the link, with "permission" after the link (not linkified). Unless you have a particular reason otherwise, could you put "permission" next to activeTab (so that both terms become the link), across the whole PR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread files/en-us/mozilla/add-ons/webextensions/api/menus/contexttype/index.md Outdated
Comment thread files/en-us/mozilla/add-ons/webextensions/activetab_permission/index.md Outdated

## Browser compatibility

Firefox, Safari, and Chromium-based browsers, including Chrome and Edge, support `activeTab`. However, when it's granted, what it enables, and when it's revoked vary.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where to mention it, but the way that Firefox grants activeTab differs from Chrome:

  • Firefox grants access to the active tab only.
  • Chrome grants access to host permissions derived from the tab's URL.

Chrome's logic unlocks potentially more access than Firefox:

  • another tab with the same origin can be scripted in Chrome, not in Firefox.
  • an extension script (e.g. background script, popup panel's script, etc) can make a cross-origin request to the URL in Chrome, not in Firefox.
  • the cookies API requires host permissions to access cookies for specific domains. Chrome allows that, Firefox does not.
  • this list is not exhaustive.

Safari matches Firefox's behavior, see this discussion on activeTab behavior and also Safari's mentions: https://github.com/w3c/webextensions/blob/main/_minutes/2026-04-09-london-f2f.md#pr-799-add-browserpermissionscanaccess-proposal

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I've added it under the capabilities granted section. I'm not sure whether the discussion link was simply FYI, but I haven't included it: I couldn't see that it would quickly provide a reader with any obvious or helpful additional information.

| Capability | Chrome | Firefox | Safari |
| ----------------------------------------------------------------------------------- | ------------------------------------ | ----------------------------------------------------- | -------------- |
| Programmatic script and stylesheet injection | Yes | Yes | Yes |
| Privileged {{WebExtAPIRef("tabs.Tab")}} properties (`url`, `title`, `favIconUrl`) | Yes | Yes | Yes |

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From @Rob--W Privileged to sensitive. Please check across the patch to see if you need to do it in more places.

And maybe also include without requiring the "tabs" permission for clarity?

And also make sure to mention the activeTab permission in the three fields at the tabs.Tab type: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab#faviconurl

Co-authored-by: Rob Wu <rob@robwu.nl>
| Capability | Chrome | Firefox | Safari |
| ----------------------------------------------------------------------------------- | ------------------------------------ | ----------------------------------------------------- | -------------- |
| Programmatic script and stylesheet injection | Yes | Yes | Yes |
| Sensitive {{WebExtAPIRef("tabs.Tab")}} properties (`url`, `title`, `favIconUrl`) | Yes | Yes | Yes |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[mdn-linter] reported by reviewdog 🐶

Suggested change
| Sensitive {{WebExtAPIRef("tabs.Tab")}} properties (`url`, `title`, `favIconUrl`) | Yes | Yes | Yes |
| Sensitive {{WebExtAPIRef("tabs.Tab")}} properties (`url`, `title`, `favIconUrl`) | Yes | Yes | Yes |

@rebloor
rebloor requested a review from Rob--W August 29, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:Firefox Content in the Mozilla/Firefox subtree Content:WebExt WebExtensions docs size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants