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