PermissionsTable.jsm: expandPermissions: Unknown Permission: request-sync

RESOLVED FIXED in mozilla38

Status

()

defect
RESOLVED FIXED
4 years ago
2 months ago

People

(Reporter: jrburke, Assigned: fabrice)

Tracking

Trunk
mozilla38
x86
macOS
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Reporter

Description

4 years ago
I am trying to use the Request Sync API, at navigator.sync, introduced in bug 1018320. 

I am under the impression I need to set the "request-sync": {} in the "permissions" section of my app's manifest.webapp in order to get the mozSetMessageHander('request-sync') listeners to work.

I am trying this as part of the converting the gaia email app to use this API for email syncing, bug 1098289.

However, when I try to push the app with this manifest modification via the WebIDE to the phone, I see this error in the logcat:

W/GeckoConsole( 3301): [JavaScript Error: "PermissionsTable.jsm: expandPermissions: Unknown Permission: request-sync" {file: "resource://gre/modules/PermissionsTable.jsm" line: 559}]
I/Gecko   ( 3301): PermissionsTable.jsm: expandPermissions: Unknown Permission: request-sync

Looking in PermissionsTable.jsm, it does not look like a request-sync entry exists.
Reporter

Comment 1

4 years ago
This also might need to be done for the "requestsync-manager" permission.
Assignee

Comment 2

4 years ago
Right, it's missing... Can you add it or do you want me to do it?
Reporter

Comment 3

4 years ago
I'm not set up at the moment to create a patch, and a bit unclear on the right settings or if there are tests that should be done for it. If the change is just adding this:

"request-sync": {
  app: DENY_ACTION,
  trusted: DENY_ACTION,
  privileged: DENY_ACTION,
  certified: ALLOW_ACTION
},
"requestsync-manager": {
  app: DENY_ACTION,
  trusted: DENY_ACTION,
  privileged: DENY_ACTION,
  certified: ALLOW_ACTION
},

and tests are not required, I will prep to get the latest and attach a patch file to this bug. However, I will likely need someone else to land it, have not done that for gecko code yet. So, if it is less time for you to just do the change, feel free to take it.
> "request-sync": {
>   app: DENY_ACTION,
>   trusted: DENY_ACTION,
>   privileged: DENY_ACTION,
>   certified: ALLOW_ACTION
> },

This should not needed. RequestSync API doesn't do this kind of permission check.
https://hg.mozilla.org/mozilla-central/rev/d381f880f7fe
Assignee: nobody → fabrice
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Reporter

Comment 7

4 years ago
(In reply to Andrea Marchesini (:baku) from comment #5)
> This should not needed. RequestSync API doesn't do this kind of permission
> check.

While navigator.sync works without asking for that permission, as far as calling the .register, .registrations(), etc, it is my understanding that the mozSetMessageHandler callbacks for 'request-sync' will not work without a permission like this, similar to how alarms work. Perhaps I have that incorrect though.
Assignee

Comment 8

4 years ago
(In reply to Andrea Marchesini (:baku) from comment #5)
> > "request-sync": {
> >   app: DENY_ACTION,
> >   trusted: DENY_ACTION,
> >   privileged: DENY_ACTION,
> >   certified: ALLOW_ACTION
> > },
> 
> This should not needed. RequestSync API doesn't do this kind of permission
> check.

Correct. Note that I only added the requestsync-manager one.

(In reply to James Burke [:jrburke] from comment #7)
> (In reply to Andrea Marchesini (:baku) from comment #5)
> > This should not needed. RequestSync API doesn't do this kind of permission
> > check.
> 
> While navigator.sync works without asking for that permission, as far as
> calling the .register, .registrations(), etc, it is my understanding that
> the mozSetMessageHandler callbacks for 'request-sync' will not work without
> a permission like this, similar to how alarms work. Perhaps I have that
> incorrect though.

The request-sync message does not need any permission to be delivered, as stated in https://mxr.mozilla.org/mozilla-central/source/dom/messages/SystemMessagePermissionsChecker.jsm#87
Reporter

Comment 9

4 years ago
Something else is not connected then, I am not getting navigator.mozSetMessageHandler('request-sync') calls/app starts. I filed bug 1128220 for that issue, it contains a small test case.
Component: DOM → DOM: Core & HTML
Product: Core → Core
You need to log in before you can comment on or make changes to this bug.