简体   繁体   中英

Privileged App won't run in Firefox OS Simulator

I'm currently working on my first app for Firefox OS and I'm using the Simulator for developing as I have no real hardware.
For my app I need the redirects permission (for using OAuth) and therefore it needs to be privileged.
My app - or the parts that are actually done yet - are working fine, as long as I don't add "type": "privileged" to the app's manifest. If I do, my whole JS-Code won't run anymore (including simple things as event listeners). I've tested the behaviour with both the FFOS 1.2 and 1.3 Simulators from the App-Manager in Aurora and there's no output on the dev-tools.
Can you help me?

Here's the manifest:

{  
  "default_locale": "en",  
  "description": "Feed the Reader is a free and open-source RSS-Reader. It works as a standalone app and with Feedly, The Old Reader and Tiny Tiny RSS as well.",  
  "developer": {  
    "name": "Philipp Trommler",  
    "url": ""  
  },  
  "icons": {  
    "16": "/icons/ftr_16.png",  
    "32": "/icons/ftr_32.png",  
    "48": "/icons/ftr_48.png",  
    "60": "/icons/ftr_60.png",  
    "64": "/icons/ftr_64.png",  
    "128": "/icons/ftr_128.png"  
  },  
  "launch_path": "/app.html",  
  "name": "Feed the Reader",  
  "permissions": {  
    "browser": {  
      "description": "Used for OAuth authentication."  
    },  
    "systemXHR": {  
      "description": "Used for asynchronous loading."  
    }  
  },  
  "redirects": [  
    {"from": "http://localhost",  
     "to": "/redirects.html"}  
  ],  
  "type": "privileged",  
  "version": "1.0"  
}

this works for me.

  "type": "privileged",
  "permissions": {
    "storage": {
      "description": "Required to store podcast audio files and images."
    },
    "systemXHR": {
      "description": "Required to download podcasts."
    },
    "contacts": {
      "description": "Required for autocompletion in the share screen",
      "access": "readcreate"
    }   
  }

I do not think your issue is with the manifest. Are you running any script inline in the HTML? It is probably failing due to CSP Violations. Move all your js to external js lib and use self-invoking function (function(){})() or something like window.init to load up and run the code you were doing inline. Take a look at the Firefox OS Boilerplate for an example of using the self-invoking function. https://github.com/robnyman/Firefox-OS-Boilerplate-App

Thanks for the replies!

I had a typo in my Javascript, but instead of showing up in debugging console, the file wasn't even loaded. I had to rename it, then the console gave me the error, so I could fix it. Now the file is loaded again, even with it's old name... Strange, but OK.
I don't understand why the simulator console is different from the normal one but obviously it is, because the latter gives me much more informations and warnings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM