Bug 1513681 - part4 : remove the logic about setting globally blocked in PermissionUI. r=daleharvey
☠☠ backed out by 0c02d1f0db78 ☠ ☠
authoralwu <alwu@mozilla.com>
Fri, 28 Dec 2018 22:24:13 +0000
changeset 452107 6f52b229d9537e4ecd5eba6a8f93dff55c0e0852
parent 452106 79a78732c3ac2b91eee4378ba630da3090cccd2e
child 452108 d24ddb803761f36c05030455c1144bcce9f2a5b2
push id75321
push useralwu@mozilla.com
push dateSat, 29 Dec 2018 00:24:14 +0000
treeherderautoland@d24ddb803761 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaleharvey
bugs1513681
milestone66.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 1513681 - part4 : remove the logic about setting globally blocked in PermissionUI. r=daleharvey We've handle showing the blocking icon in patch2, so we don't need to set block permission in PermissionUI. Differential Revision: https://phabricator.services.mozilla.com/D14797
browser/modules/PermissionUI.jsm
browser/modules/SitePermissions.jsm
--- a/browser/modules/PermissionUI.jsm
+++ b/browser/modules/PermissionUI.jsm
@@ -301,29 +301,16 @@ var PermissionPromptPrototype = {
       // 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);
 
       if (state == SitePermissions.BLOCK) {
-        // If the request is blocked by a global setting then we record
-        // a flag that lasts for the duration of the current page load
-        // to notify the user that the permission has been blocked.
-        // Currently only applies to autoplay-media
-        if (state == SitePermissions.getDefault(this.permissionKey) &&
-            SitePermissions.showGloballyBlocked(this.permissionKey)) {
-          SitePermissions.set(this.principal.URI,
-                              this.permissionKey,
-                              state,
-                              SitePermissions.SCOPE_GLOBAL,
-                              this.browser);
-        }
-
         this.cancel();
         return;
       }
 
       if (state == SitePermissions.ALLOW) {
         this.allow();
         return;
       }
@@ -335,18 +322,16 @@ var PermissionPromptPrototype = {
     } else if (this.permissionKey) {
       // If we're reading a permission which already has a temporary value,
       // see if we can use the temporary value.
       let {state} = SitePermissions.get(null,
                                         this.permissionKey,
                                         this.browser);
 
       if (state == SitePermissions.BLOCK) {
-        // TODO: Add support for showGloballyBlocked
-
         this.cancel();
         return;
       }
     }
 
     let chromeWin = this.browser.ownerGlobal;
     if (!chromeWin.PopupNotifications) {
       this.cancel();
--- a/browser/modules/SitePermissions.jsm
+++ b/browser/modules/SitePermissions.jsm
@@ -429,33 +429,16 @@ var SitePermissions = {
     if (permissionID in gPermissionObject &&
         gPermissionObject[permissionID].getDefault)
       return gPermissionObject[permissionID].getDefault();
 
     // Otherwise try to get the default preference for that permission.
     return this._defaultPrefBranch.getIntPref(permissionID, this.UNKNOWN);
   },
 
-  /**
-   * Return whether the browser should notify the user if a permission was
-   * globally blocked due to a preference.
-   *
-   * @param {string} permissionID
-   *        The ID to get the state for.
-   *
-   * @return boolean Whether to show notification for globally blocked permissions.
-   */
-  showGloballyBlocked(permissionID) {
-    if (permissionID in gPermissionObject &&
-        gPermissionObject[permissionID].showGloballyBlocked)
-      return gPermissionObject[permissionID].showGloballyBlocked;
-
-    return false;
-  },
-
   /*
    * Return whether SitePermissions is permitted to store a TEMPORARY ALLOW
    * state for a particular permission.
    *
    * @param {string} permissionID
    *        The ID to get the state for.
    *
    * @return boolean Whether storing TEMPORARY ALLOW is permitted.
@@ -758,17 +741,16 @@ var gPermissionObject = {
    *    Array of permission states to be exposed to the user.
    *    Defaults to ALLOW, BLOCK and the default state (see getDefault).
    *    The PROMPT_HIDE state is deliberately excluded from "plugin:flash" since we
    *    don't want to expose a "Hide Prompt" button to the user through pageinfo.
    */
 
   "autoplay-media": {
     exactHostMatch: true,
-    showGloballyBlocked: true,
     permitTemporaryAllow: true,
     notifyWhenTemporaryPermissionChanged: true,
     getDefault() {
       let state = Services.prefs.getIntPref("media.autoplay.default",
                                             Ci.nsIAutoplay.PROMPT);
       if (state == Ci.nsIAutoplay.ALLOWED) {
         return SitePermissions.ALLOW;
       } if (state == Ci.nsIAutoplay.BLOCKED) {