Bug 1574130 - Updated ControlCenter.jsm to use SitePermissions principal methods. r=johannh
authorPaul Zuehlcke <pzuhlcke@mozilla.com>
Tue, 20 Aug 2019 12:14:32 +0000
changeset 488953 fbccacbaaf80f5d7b05a82ea358959e0881fbb34
parent 488952 b9fd5bee949b442926cc7574e5283ddb171fb8b6
child 488954 39c8d7cbd4d468f73607d2c82905dd0bb135735c
child 489000 88fe9a3d452222f26b277be43dea1e61e9c7a5e6
push id93045
push userpzuhlcke@mozilla.com
push dateTue, 20 Aug 2019 12:42:25 +0000
treeherderautoland@fbccacbaaf80 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1574130
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1574130 - Updated ControlCenter.jsm to use SitePermissions principal methods. r=johannh Differential Revision: https://phabricator.services.mozilla.com/D42474
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/ControlCenter.jsm
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/ControlCenter.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/ControlCenter.jsm
@@ -95,33 +95,45 @@ var ControlCenter = {
         await loadPage(HTTPS_PAGE);
         await openIdentityPopup(true);
       },
     },
 
     singlePermission: {
       selectors: ["#navigator-toolbox", "#identity-popup"],
       async applyConfig() {
-        let uri = Services.io.newURI(PERMISSIONS_PAGE);
-        SitePermissions.set(uri, "camera", SitePermissions.ALLOW);
+        let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
+          PERMISSIONS_PAGE
+        );
+        SitePermissions.setForPrincipal(
+          principal,
+          "camera",
+          SitePermissions.ALLOW
+        );
 
         await loadPage(PERMISSIONS_PAGE);
         await openIdentityPopup();
       },
     },
 
     allPermissions: {
       selectors: ["#navigator-toolbox", "#identity-popup"],
       async applyConfig() {
         // TODO: (Bug 1330601) Rewrite this to consider temporary (TAB) permission states.
         // There are 2 possible non-default permission states, so we alternate between them.
         let states = [SitePermissions.ALLOW, SitePermissions.BLOCK];
-        let uri = Services.io.newURI(PERMISSIONS_PAGE);
+        let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
+          PERMISSIONS_PAGE
+        );
         SitePermissions.listPermissions().forEach(function(permission, index) {
-          SitePermissions.set(uri, permission, states[index % 2]);
+          SitePermissions.setForPrincipal(
+            principal,
+            permission,
+            states[index % 2]
+          );
         });
 
         await loadPage(PERMISSIONS_PAGE);
         await openIdentityPopup();
       },
     },
 
     mixed: {