Use nsPermissionManager to manage WebExtensions permissions

RESOLVED WONTFIX

Status

()

Toolkit
WebExtensions: Untriaged
RESOLVED WONTFIX
2 years ago
2 years ago

People

(Reporter: robwu, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

2 years ago
I propose to reuse nsPermissionManager to managing addon permissions, because:

- It avoids duplication of permission checking logic for APIs that are implemented on the web platform, e.g.:
  - geolocation
  - audioCapture, videoCapture (for media device access)
- It becomes trivial to implement the optional permissions API (bug 1197420).
- It allows us to have one single UI to manage website and add-on permissions.

Motivation:
While working on bug 1197451, I added a permission check based on the addonId of the SubjectPrincipal(). This did not work in content scripts because apparently the addon ID is only saved in the extra principals of the ExpandedPrincipal. The next obvious step is to add a method HasAddonPermission to the principal that also checks the extra principals, but adding such a method felt weird because permission checking is not addon-specific, but widely used on the web platform (e.g. bug 1105827).
And indeed, nsPermissionManager::CommonTestPermission does exactly what I need...

Updated

2 years ago
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → WONTFIX

Comment 1

2 years ago
I think this has been talked about, but if anyone could provide some detail about why its won't fixed, that would provide a useful record for future people who propose this.
You need to log in before you can comment on or make changes to this bug.