Bug 1073790 - Use "storage" perm instead of "indexedDB-unlimited". r=myk
authorMarco Castelluccio <mar.castelluccio@studenti.unina.it>
Tue, 06 Jan 2015 11:19:00 +0100
changeset 235330 854a6dbbd5e4cce6798d20dbaa0a3e6835b6b36e
parent 235329 a185d1c79df9f53255915f113d2d11c26b32a7cf
child 235331 368f0748e882be78773e35586cea61614bccf72e
push id358
push usermleibovic@mozilla.com
push dateWed, 07 Jan 2015 20:03:22 +0000
reviewersmyk
bugs1073790
milestone37.0a1
Bug 1073790 - Use "storage" perm instead of "indexedDB-unlimited". r=myk
webapprt/test/chrome/browser_webperm.js
--- a/webapprt/test/chrome/browser_webperm.js
+++ b/webapprt/test/chrome/browser_webperm.js
@@ -1,36 +1,66 @@
 Cu.import("resource://webapprt/modules/WebappRT.jsm");
 let { AppsUtils } = Cu.import("resource://gre/modules/AppsUtils.jsm", {});
 let { DOMApplicationRegistry } =
   Cu.import("resource://gre/modules/Webapps.jsm", {});
-let { PermissionsTable, PermissionsReverseTable } =
+let { PermissionsTable } =
   Cu.import("resource://gre/modules/PermissionsTable.jsm", {});
 
 function test() {
   waitForExplicitFinish();
 
   loadWebapp("webperm.webapp", undefined, function onLoad() {
     let app = WebappRT.config.app;
 
     // Check that the app is non privileged.
     is(AppsUtils.getAppManifestStatus(app.manifest), Ci.nsIPrincipal.APP_STATUS_INSTALLED, "The app is not privileged");
 
     // Check that the app principal has the correct appId.
     let principal = document.getElementById("content").contentDocument.defaultView.document.nodePrincipal;
     is(DOMApplicationRegistry.getAppLocalIdByManifestURL(app.manifestURL), principal.appId, "Principal app ID correct");
 
-    let perms = [ "indexedDB-unlimited", "geolocation",
-                  "camera", "alarms", "tcp-socket", "network-events",
-                  "webapps-manage", "desktop-notification" ];
+    let perms = [
+    {
+      manifestName: "storage",
+      permName: "indexedDB",
+    },
+    {
+      manifestName: "geolocation",
+      permName: "geolocation",
+    },
+    {
+      manifestName: "camera",
+      permName: "camera",
+    },
+    {
+      manifestName: "alarms",
+      permName: "alarms",
+    },
+    {
+      manifestName: "tcp-socket",
+      permName: "tcp-socket",
+    },
+    {
+      manifestName: "network-events",
+      permName: "network-events",
+    },
+    {
+      manifestName: "webapps-manage",
+      permName: "webapps-manage",
+    },
+    {
+      manifestName: "desktop-notification",
+      permName: "desktop-notification",
+    },
+    ];
 
-    for (let permName of perms) {
+    for (let perm of perms) {
       // Get the values for all the permission.
-      let permValue = Services.perms.testExactPermissionFromPrincipal(principal, permName);
+      let permValue = Services.perms.testExactPermissionFromPrincipal(principal, perm.permName);
 
       // Check if the app has the permission as specified in the PermissionsTable.jsm file.
-      let realPerm = PermissionsReverseTable[permName];
-      is(permValue, PermissionsTable[realPerm]["app"], "Permission " + permName + " correctly set.");
+      is(permValue, PermissionsTable[perm.manifestName]["app"], "Permission " + perm.permName + " correctly set.");
     }
 
     finish();
   });
 }