Closed Bug 1919323 Opened 5 months ago Closed 3 months ago

Add support for optional-only permissions

Categories

(WebExtensions :: General, enhancement, P2)

enhancement

Tracking

(firefox134 fixed)

RESOLVED FIXED
134 Branch
Tracking Status
firefox134 --- fixed

People

(Reporter: zombie, Assigned: robwu)

References

Details

(Keywords: dev-doc-complete, Whiteboard: [addons-jira])

Attachments

(1 file)

We need a way to support trial/experimental APIs, and our approach will be a permission which can only be requested at at runtime, not as part of initial install.

Blocks: 1917799
Severity: -- → N/A
Priority: -- → P2

As discussed with Tom, I'm going to implement this, starting with the trialML permission for bug 1917799. The final string for that is at https://mozilla-hub.atlassian.net/browse/WEBEXT-1994

Assignee: nobody → rob
Blocks: 1917000
Status: NEW → ASSIGNED

This patch adds the OptionalOnlyPermission type of permission, with
trialML as an example.

More context for the permission string is at bug 1932463. My patch contains the same string already; in case the patch here cannot be approved in time (by tomorrow), then the other patch needs to land first because string freeze starts on Friday.

See Also: → 1932463
Pushed by rob@robwu.nl: https://hg.mozilla.org/integration/autoland/rev/ec3ab1444cd6 Add OptionalOnlyPermission r=zombie,fluent-reviewers,android-reviewers
Keywords: dev-doc-needed
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 134 Branch

We normally don't include a description in the manifest documentation for optional permissions. However, all other permissions are referenced from the relevant API documentation. As this one isn't (unless there's a documentation request I've missed), should we include a comment about its purpose or rely on that from some other source? Also, is this valid for MV2 and MV3?

Flags: needinfo?(rob)

The purpose of this documentation request is to document that the concept of optional-only permissions exist. An optional-only permission is a permission that can only be listed in optional_permissions in the manifest.json file, but not in permissions. This means that the permission cannot be granted at install time, and the extension developer needs to check for permission availability via permissions.contains() and request the permission via permissions.request(). Another special aspect is that the permissions.request() call can only take one permission when requesting an optional-only permission (ordinarily, permissions.request() takes multiple).

As for concrete examples - that is a tougher question. All APIs with optional-only permissions are still behind a flag.

The patch here introduces the "trialML" permission. We should not document this one yet, since the feature is still in development.

Bug 1917000 adds the "userScripts" permission. This one is optional-only in Firefox, but a regular permission in Chrome (with its own special API constraints).

The userScripts API itself is behind a pref too, and not officially released yet. I'm considering to already document it since Chrome has an implementation of the API (with some missing parts - I am documenting the differences and handing that over to Simeon since he is already familiar with the API).

Flags: needinfo?(rob)
Duplicate of this bug: 1932463

Documentation changes in PR Optional-only permissions #36988.

A reminder that documentation changes are awaiting to be reviewed Optional-only permissions #36988

Flags: needinfo?(rob)

The PR was already reviewed, approved and merged last month. Changing dev-doc-needed to dev-doc-complete to reflect that.

Flags: needinfo?(rob)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: