简体   繁体   English

特权应用将无法在Firefox OS Simulator中运行

[英]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. 我目前正在开发用于Firefox OS的第一个应用程序,并且由于没有真正的硬件,因此正在使用模拟器进行开发。
For my app I need the redirects permission (for using OAuth) and therefore it needs to be privileged. 对于我的应用程序,我需要redirects权限(用于OAuth),因此需要获得特权。
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. 只要我不向应用程序清单添加"type": "privileged" ,我的应用程序-或实际完成的部分-都可以正常工作。 If I do, my whole JS-Code won't run anymore (including simple things as event listeners). 如果这样做,我的整个JS代码将不再运行(包括作为事件侦听器的简单操作)。 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. 我已经使用Aurora中的App-Manager的FFOS 1.2和1.3模拟器测试了此行为,并且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? 您是否在HTML中内联运行任何脚本? It is probably failing due to CSP Violations. 由于违反CSP,它可能会失败。 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. 将所有js移至外部js库,并使用自调用函数(function(){})()或诸如window.init之类的东西来加载并运行内联代码。 Take a look at the Firefox OS Boilerplate for an example of using the self-invoking function. 看一下Firefox OS样板,了解使用自调用功能的示例。 https://github.com/robnyman/Firefox-OS-Boilerplate-App 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. 我在Javascript中输入错误,但是没有显示在调试控制台中,甚至没有加载文件。 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. 我不明白为什么模拟器控制台与普通控制台不同,但显然是这样,因为后者为我提供了更多的信息和警告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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