Open Bug 1875475 Opened 10 months ago Updated 6 days ago

[meta] Implement userScripts API in MV3

Categories

(WebExtensions :: General, enhancement, P2)

enhancement

Tracking

(Not tracked)

People

(Reporter: robwu, Unassigned)

References

(Depends on 8 open bugs)

Details

(Keywords: meta, Whiteboard: [wecg][addons-jira])

This is about implementing the userScripts API, as designed in the WECG at https://github.com/w3c/webextensions/issues/279 .

Not to be confused with the current userScripts API in Firefox that is tied to the user_scripts key from bug 1437098. This older API called "userScripts" is MV2-only because its design is incompatible with non-persistent background pages. Additional notes about differences: https://github.com/mdn/browser-compat-data/issues/21922#issuecomment-1892148953

Currently, the way that user script managers would use the API to run scripts in the main world is to use the userScripts API to have a world without scripts being restricted by the CSP. To enable that, we need to support the ability to exempt script nodes inserted by the "user script" world from the CSP (bug 1446231).

Depends on: 1446231

The capability to directly run scripts in the MAIN world is part of bug 1736575.

Depends on: 1736575
See Also: → 1445909
See Also: → 1516478
See Also: → 1587494
See Also: → 1892669

Before we can enable any implementation of the userScripts API by default, we need a way for users to opt in to userScripts functionality. We have a top-level generic bug on file for that at bug 1787179.

The implementation of the userScripts API can be sequenced as follows:

Depends on: 1787179
Depends on: 1911833
Depends on: 1911834
Depends on: 1911835
Depends on: 1911836
Summary: Implement userScripts API in MV3 → [meta] Implement userScripts API in MV3
Depends on: 1917000
No longer depends on: 1787179
Depends on: 1930776
Depends on: 1931545
Depends on: 1931548
Depends on: 1931554
Depends on: 1931556

To people who are following this bug: as called out before in comment 3, we want an opt-in before this feature can be enabled by default.

The implementation of the API is progressing and will be available for testing soon, behind a flag.

The opt-in will take form of an optional-only feature permission (bug 1917000). The UX is described at https://bugzilla.mozilla.org/show_bug.cgi?id=1917000#c1 (with screenshots in the comments that follow it). The implementation of this UX is tracked at bug 1931545 and bug 1931548 (desktop) and bug 1931554 and bug 1931556 (mobile).

You need to log in before you can comment on or make changes to this bug.