|
1 Cu.import("resource://webapprt/modules/WebappRT.jsm"); |
|
2 let { AllPossiblePermissions } = |
|
3 Cu.import("resource://gre/modules/PermissionsInstaller.jsm", {}); |
|
4 let { AppsUtils } = Cu.import("resource://gre/modules/AppsUtils.jsm", {}); |
|
5 let { DOMApplicationRegistry } = |
|
6 Cu.import("resource://gre/modules/Webapps.jsm", {}); |
|
7 |
|
8 function test() { |
|
9 waitForExplicitFinish(); |
|
10 |
|
11 loadWebapp("noperm.webapp", undefined, function onLoad() { |
|
12 let app = WebappRT.config.app; |
|
13 |
|
14 // Check that the app is non privileged. |
|
15 is(AppsUtils.getAppManifestStatus(app.manifest), Ci.nsIPrincipal.APP_STATUS_INSTALLED, "The app is not privileged"); |
|
16 |
|
17 // Check that the app principal has the correct appId. |
|
18 let principal = document.getElementById("content").contentDocument.defaultView.document.nodePrincipal; |
|
19 is(DOMApplicationRegistry.getAppLocalIdByManifestURL(app.manifestURL), principal.appId, "Principal app ID correct"); |
|
20 |
|
21 // Check if all the permissions of the app are unknown. |
|
22 for (let permName of AllPossiblePermissions) { |
|
23 // Get the value for the permission. |
|
24 let permValue = Services.perms.testExactPermissionFromPrincipal(principal, permName); |
|
25 |
|
26 is(permValue, Ci.nsIPermissionManager.UNKNOWN_ACTION, "Permission " + permName + " unknown."); |
|
27 } |
|
28 |
|
29 finish(); |
|
30 }); |
|
31 } |