Bug 1330467 - part 5. Access permissions by principal in PermissionUI.jsm; r=johannh
authorLiang-Heng Chen <xeonchen@gmail.com>
Wed, 08 May 2019 09:03:06 +0000
changeset 532212 6ac44130d2bb05cc6cadb5cd642bbe7fe90ca08a
parent 532211 f939c61e051fd2891a79bf1981b018dc454e9b77
child 532213 35d96a4ff6592595d15e470fde508f62d5f6fb1e
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1330467
milestone68.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 1330467 - part 5. Access permissions by principal in PermissionUI.jsm; r=johannh Differential Revision: https://phabricator.services.mozilla.com/D19926
browser/modules/PermissionUI.jsm
--- a/browser/modules/PermissionUI.jsm
+++ b/browser/modules/PermissionUI.jsm
@@ -359,19 +359,19 @@ var PermissionPromptPrototype = {
       return;
     }
 
     if (this.usePermissionManager &&
         this.permissionKey) {
       // If we're reading and setting permissions, then we need
       // to check to see if we already have a permission setting
       // for this particular principal.
-      let {state} = SitePermissions.get(requestingURI,
-                                        this.permissionKey,
-                                        this.browser);
+      let {state} = SitePermissions.getForPrincipal(this.principal,
+                                                    this.permissionKey,
+                                                    this.browser);
 
       if (state == SitePermissions.BLOCK) {
         // If this block was done based on a global user setting, we want to show
         // a post prompt to give the user some more granular control without
         // annoying them too much.
         if (this.postPromptEnabled &&
             SitePermissions.getDefault(this.permissionKey) == SitePermissions.BLOCK) {
           this.postPrompt();
@@ -434,29 +434,29 @@ var PermissionPromptPrototype = {
             if ((state && state.checkboxChecked && state.source != "esc-press") ||
                 promptAction.scope == SitePermissions.SCOPE_PERSISTENT) {
               // Permanently store permission.
               let scope = SitePermissions.SCOPE_PERSISTENT;
               // Only remember permission for session if in PB mode.
               if (PrivateBrowsingUtils.isBrowserPrivate(this.browser)) {
                 scope = SitePermissions.SCOPE_SESSION;
               }
-              SitePermissions.set(this.principal.URI,
-                                  this.permissionKey,
-                                  promptAction.action,
-                                  scope);
+              SitePermissions.setForPrincipal(this.principal,
+                                              this.permissionKey,
+                                              promptAction.action,
+                                              scope);
             } else if (promptAction.action == SitePermissions.BLOCK) {
               // Temporarily store BLOCK permissions only
               // SitePermissions does not consider subframes when storing temporary
               // permissions on a tab, thus storing ALLOW could be exploited.
-              SitePermissions.set(this.principal.URI,
-                                  this.permissionKey,
-                                  promptAction.action,
-                                  SitePermissions.SCOPE_TEMPORARY,
-                                  this.browser);
+              SitePermissions.setForPrincipal(this.principal,
+                                              this.permissionKey,
+                                              promptAction.action,
+                                              SitePermissions.SCOPE_TEMPORARY,
+                                              this.browser);
             }
 
             // Grant permission if action is ALLOW.
             // Record buttonAction for telemetry.
             if (promptAction.action == SitePermissions.ALLOW) {
               this._buttonAction = "accept";
               this.allow();
             } else {