Closed Bug 1128065 Opened 7 years ago Closed 7 years ago

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

Categories

(Core :: DOM: Core & HTML, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38

People

(Reporter: jrburke, Assigned: fabrice)

References

Details

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.
This also might need to be done for the "requestsync-manager" permission.
Right, it's missing... Can you add it or do you want me to do it?
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
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
(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.
(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
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
You need to log in before you can comment on or make changes to this bug.