Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Simulator does not recognize the "mobilenetwork" permission #711

Open
reinvented opened this issue Jul 11, 2013 · 1 comment
Open

Simulator does not recognize the "mobilenetwork" permission #711

reinvented opened this issue Jul 11, 2013 · 1 comment
Labels

Comments

@reinvented
Copy link

  • Firefox OS Simulator 4.0 (installed when it was released today)
  • Mac OS X 10.8.3
  • Firefox 22.0.

Reporting an issue discussed at some length in mozilla.dev.webapps

Trying to run an app that requests the "mobilenetwork" permission:

https://github.com/reinvented/getcellid/tree/mobilenetwork/www

The manifest.webapp looks, in part, like this:

"type": "privileged",
"permissions": {
    "mobilenetwork": { "description":"Obtain information from the device about cell ID." },
    "systemXHR": { "description":"Update OpenCellID.org using data connection." },
    "geolocation": { "description":"Obtain geolocation from the device GPS." }
}

The Simulator reports an error:

Unknown permission 'mobilenetwork'.

Trying (without really knowing what I'm doing) to diagnose, I find that it is resources/r2d2b2g/lib/validator.js that does the validation of the manifest.

This script loads the list of valid permissions from resource://gre/modules/PermissionsTable.jsm

When I open that URI in Firefox, the "mobilenetwork" permission is not listed.

However, in the file included with the Simulator extension:

resources/r2d2b2g/data/mac64/B2G.app/Contents/MacOS/modules/PermissionsTable.jsm

the "mobilenetwork" permission is listed.

Opening the URI resource://gre/modules/ in Firefox I see:

Index of jar:file:///Applications/Firefox.app/Contents/MacOS/omni.ja!/modules/

at the top of the page, which makes me think that perhaps the validator.js is getting its PermissionsTable.jsm from the wrong place?

@mykmelez
Copy link
Contributor

@reinvented Thanks for the detailed and comprehensive bug report!

When @rpl initially implemented manifest validation, in #323, he pushed the manifest from Firefox to B2G for validation using B2G's PermissionsTable.jsm, which knows about the "mobilenetwork" permission. But @ochameau later changed the validator to use Firefox's version of that file in order to simplify the validation flow, and it looks like that's the cause of this bug.

I'm not sure what the best solution is. We could switch back to validating in B2G, which would solve this problem at the cost of re-complicating the validation flow. Or perhaps we could load B2G's PermissionsTable.jsm in Firefox somehow (f.e. by generating a file: URL to it and then loading it via Cu.import).

@ochameau What do you think?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants