Closed Bug 1285406 Opened 8 years ago Closed 8 years ago

Use nsPermissionManager to manage WebExtensions permissions

Categories

(WebExtensions :: Untriaged, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: robwu, Unassigned)

Details

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...
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
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.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.