Bug 1513681 - part4 : remove the logic about setting globally blocked in PermissionUI. r=daleharvey
authorAlastor Wu <alwu@mozilla.com>
Fri, 04 Jan 2019 18:36:20 +0000
changeset 509727 9378c3b5ad2dc2d50774b6dc93164dda712da17d
parent 509726 239ede916b0dc40a234c097fef5fecb8beb25c30
child 509728 86afca3f41ac522e120c22cc1b4c55ab86c83fe5
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [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) {