Make clear if an API is available from content scripts or not

NEW
Unassigned

Status

Developer Documentation
Add-ons
9 months ago
9 months ago

People

(Reporter: fabrice, Unassigned)

Tracking

Details

(Reporter)

Description

9 months ago
The list of APIs usable from content scripts is documented at https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts#WebExtension_APIs, but when just looking for a given API this information is lost.

For instance, https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/tabs only talks about required permissions, but not about the restriction to background pages.

Ideally we would have more documentation bits (could be some kind of badge) alongside each extension api.
I'm not sure about this. Almost all (at least 90% of) WebExtension APIs are unavailable in content scripts. So I think noting, next to each API, whether it is available has a pretty poor signal to noise ratio.

It's better, I think, just to assume (and document) that the APIs are not available, with a few exceptions (primarily messaging, i18n, and storage). Everyone working with content scripts is going to have to read https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts at some point, and as you say, the supported APIs are listed there.
You need to log in before you can comment on or make changes to this bug.