Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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", {});
8 function test() {
9 waitForExplicitFinish();
11 loadWebapp("noperm.webapp", undefined, function onLoad() {
12 let app = WebappRT.config.app;
14 // Check that the app is non privileged.
15 is(AppsUtils.getAppManifestStatus(app.manifest), Ci.nsIPrincipal.APP_STATUS_INSTALLED, "The app is not privileged");
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");
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);
26 is(permValue, Ci.nsIPermissionManager.UNKNOWN_ACTION, "Permission " + permName + " unknown.");
27 }
29 finish();
30 });
31 }