簡體   English   中英

特權應用將無法在Firefox OS Simulator中運行

[英]Privileged App won't run in Firefox OS Simulator

我目前正在開發用於Firefox OS的第一個應用程序,並且由於沒有真正的硬件,因此正在使用模擬器進行開發。
對於我的應用程序,我需要redirects權限(用於OAuth),因此需要獲得特權。
只要我不向應用程序清單添加"type": "privileged" ,我的應用程序-或實際完成的部分-都可以正常工作。 如果這樣做,我的整個JS代碼將不再運行(包括作為事件偵聽器的簡單操作)。 我已經使用Aurora中的App-Manager的FFOS 1.2和1.3模擬器測試了此行為,並且dev-tools上沒有輸出。
你能幫助我嗎?

這是清單:

{  
  "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"  
}

這對我有用。

  "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"
    }   
  }

我認為您的問題不在於清單。 您是否在HTML中內聯運行任何腳本? 由於違反CSP,它可能會失敗。 將所有js移至外部js庫,並使用自調用函數(function(){})()或諸如window.init之類的東西來加載並運行內聯代碼。 看一下Firefox OS樣板,了解使用自調用功能的示例。 https://github.com/robnyman/Firefox-OS-Boilerplate-App

感謝您的答復!

我在Javascript中輸入錯誤,但是沒有顯示在調試控制台中,甚至沒有加載文件。 我必須重命名它,然后控制台給了我錯誤,所以我可以修復它。 現在,即使使用舊名稱,文件也會再次加載...奇怪,但是可以。
我不明白為什么模擬器控制台與普通控制台不同,但顯然是這樣,因為后者為我提供了更多的信息和警告。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM