Open Bug 1589896 Opened 5 years ago Updated 2 years ago

geolocation permission doesn't work when pref permissions.default.geo is non-zero

Categories

(WebExtensions :: General, defect, P3)

defect

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: robwu, Assigned: robwu, NeedInfo)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(1 file)

I was looking into integrating the "notifications" permission in the permission manager (bug 1589693), and looked at our existing "geolocation" permission, since it has similar characteristics.

Upon reviewing the relevant code, it is obvious that the implementation has a flaw. It seems that the intention is to only add the permission if the user did not explicitly set it (e.g. to deny) (testPermission("geo") === Services.perms.UNKNOWN_ACTION).
However, when the permissions.default.geo preference is set, then that value is returned instead of UNKNOWN_ACTION, and the logic falls apart (i.e. permission is not added).

In order to fix this, we need to either be able to read the permission (ignoring the default pref branch), or be able to add a preference that overrides the default, but can be overridden by the user's explicit choice. The advantage of a system like the latter is that when the user resets the pref's value, that the extension permission is used as a fallback instead of the browser's default (which would happen anyway when the extension or browser is restarted).

I would recommend just skipping the default pref check for WebExtension principals. That seems easiest to me, if I'm not missing something.

I'm working on a patch where I change testPermission's implementation by replacing Services.perms.testPermissionFromPrincipal with Services.perms.getPermissionObject . This will achieve the desired effect, while the usual permission management logic is still consistent with regular http(s) web pages.

Assignee: nobody → rob
Status: NEW → ASSIGNED
See Also: → 1591056

The priority flag is not set for this bug.
:jimm, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jmathies)
Flags: needinfo?(jmathies)
Priority: -- → P3

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:robwu, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(rob)
Has Regression Range: --- → yes
Keywords: regression
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: