Bug 1479335 - Remove permissions close button r=nhnt11
☠☠ backed out by acd0d09cec46 ☠ ☠
authorui.manish <1991manish.kumar@gmail.com>
Sun, 24 Feb 2019 09:58:15 +0000
changeset 460785 8c7ac177290e77f95adbbaa99787c193e47f3d82
parent 460784 cfdb566ecbb8003d11536c2e0c8aa20d8945884f
child 460786 acd0d09cec46fd3e9f2cabcbafcaee7f31e179ae
push id35603
push userdluca@mozilla.com
push dateMon, 25 Feb 2019 01:46:40 +0000
treeherdermozilla-central@3a2ced4fbd98 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnhnt11
bugs1479335
milestone67.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 1479335 - Remove permissions close button r=nhnt11 Differential Revision: https://phabricator.services.mozilla.com/D16264
browser/base/content/browser-plugins.js
browser/base/content/browser.js
browser/base/content/test/popupNotifications/browser_popupNotification_2.js
browser/modules/PermissionUI.jsm
browser/modules/webrtcUI.jsm
modules/libpref/init/all.js
toolkit/components/passwordmgr/LoginManagerPrompter.jsm
toolkit/modules/PopupNotifications.jsm
--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -275,17 +275,17 @@ var gPluginHandler = {
     if (plugins.length == 1) {
       let pluginInfo = plugins[0];
       let isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(window);
 
       let active = pluginInfo.fallbackType == Ci.nsIObjectLoadingContent.PLUGIN_ACTIVE;
 
       let options = {
         dismissed: !showNow,
-        hideClose: !Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton"),
+        hideClose: true,
         persistent: showNow,
         eventCallback: this._clickToPlayNotificationEventCallback,
         primaryPlugin: primaryPluginPermission,
         popupIconClass: "plugin-icon",
         extraAttr: active ? "active" : "inactive",
         pluginData,
         principal,
       };
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6814,17 +6814,17 @@ var IndexedDBPromptHelper = {
         },
       },
     ];
 
     PopupNotifications.show(
       browser, topic, message, this._notificationIcon, mainAction, secondaryActions,
       {
         persistent: true,
-        hideClose: !Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton"),
+        hideClose: true,
       });
   },
 };
 
 var CanvasPermissionPromptHelper = {
   _permissionsPrompt: "canvas-permissions-prompt",
   _permissionsPromptHideDoorHanger: "canvas-permissions-prompt-hide-doorhanger",
   _notificationIcon: "canvas-notification-icon",
--- a/browser/base/content/test/popupNotifications/browser_popupNotification_2.js
+++ b/browser/base/content/test/popupNotifications/browser_popupNotification_2.js
@@ -210,37 +210,16 @@ var tests = [
     },
     onHidden(popup) {
       ok(this.notifyObj.dismissalCallbackTriggered, "dismissal callback triggered");
       this.notification.remove();
       ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
       ok(!this.notifyObj.secondaryActionClicked, "secondary action not clicked");
     },
   },
-  // Test that notification close button calls secondary action instead of
-  // dismissal callback if privacy.permissionPrompts.showCloseButton is set.
-  { id: "Test#10",
-    run() {
-      Services.prefs.setBoolPref("privacy.permissionPrompts.showCloseButton", true);
-      this.notifyObj = new BasicNotification(this.id);
-      this.notification = showNotification(this.notifyObj);
-    },
-    onShown(popup) {
-      checkPopup(popup, this.notifyObj);
-      let notification = popup.children[0];
-      EventUtils.synthesizeMouseAtCenter(notification.closebutton, {});
-    },
-    onHidden(popup) {
-      ok(!this.notifyObj.dismissalCallbackTriggered, "dismissal callback not triggered");
-      ok(this.notifyObj.secondaryActionClicked, "secondary action clicked");
-      Services.prefs.clearUserPref("privacy.permissionPrompts.showCloseButton");
-      this.notification.remove();
-      ok(this.notifyObj.removedCallbackTriggered, "removed callback triggered");
-    },
-  },
   // Test notification when chrome is hidden
   { id: "Test#11",
     run() {
       window.locationbar.visible = false;
       this.notifyObj = new BasicNotification(this.id);
       this.notification = showNotification(this.notifyObj);
     },
     onShown(popup) {
--- a/browser/modules/PermissionUI.jsm
+++ b/browser/modules/PermissionUI.jsm
@@ -408,17 +408,17 @@ var PermissionPromptPrototype = {
 
     let options = this.popupOptions;
 
     if (!options.hasOwnProperty("displayURI") || options.displayURI) {
       options.displayURI = this.principal.URI;
     }
     // Permission prompts are always persistent; the close button is controlled by a pref.
     options.persistent = true;
-    options.hideClose = !Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton");
+    options.hideClose = true;
     options.eventCallback = (topic) => {
       // When the docshell of the browser is aboout to be swapped to another one,
       // the "swapping" event is called. Returning true causes the notification
       // to be moved to the new browser.
       if (topic == "swapping") {
         return true;
       }
       // The prompt has been shown, notify the PermissionUI.
--- a/browser/modules/webrtcUI.jsm
+++ b/browser/modules/webrtcUI.jsm
@@ -483,17 +483,17 @@ function prompt(aBrowser, aRequest) {
     },
   ];
 
   let productName = gBrandBundle.GetStringFromName("brandShortName");
 
   let options = {
     name: getHostOrExtensionName(uri),
     persistent: true,
-    hideClose: !Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton"),
+    hideClose: true,
     eventCallback(aTopic, aNewBrowser) {
       if (aTopic == "swapping")
         return true;
 
       let doc = this.browser.ownerDocument;
 
       // Clean-up video streams of screensharing previews.
       if ((aTopic == "dismissed" || aTopic == "removed") &&
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1417,20 +1417,16 @@ pref("privacy.restrict3rdpartystorage.us
 // users try to restore all popups, which is the most visible
 // option in our UI at the time of writing.
 // We will invisibly drop any popups from a page that has already
 // opened more than this number of popups.
 pref("privacy.popups.maxReported", 100);
 
 // send "do not track" HTTP header, disabled by default
 pref("privacy.donottrackheader.enabled",    false);
-// If true, close button will be shown on permission prompts
-// and for all PopupNotifications, the secondary action of
-// the popup will be called when the popup is dismissed.
-pref("privacy.permissionPrompts.showCloseButton", false);
 // Enforce tracking protection in all modes
 pref("privacy.trackingprotection.enabled",  false);
 // Enforce tracking protection in Private Browsing mode
 pref("privacy.trackingprotection.pbmode.enabled",  true);
 // First Party Isolation (double keying), disabled by default
 pref("privacy.firstparty.isolate",                        false);
 // If false, two windows in the same domain with different first party domains
 // (top level URLs) can access resources through window.opener.
--- a/toolkit/components/passwordmgr/LoginManagerPrompter.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerPrompter.jsm
@@ -1011,17 +1011,17 @@ LoginManagerPrompter.prototype = {
       promptMsg,
       "password-notification-icon",
       mainAction,
       secondaryActions,
       Object.assign({
         timeout: Date.now() + 10000,
         persistWhileVisible: true,
         passwordNotificationType: type,
-        hideClose: !Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton"),
+        hideClose: true,
         eventCallback(topic) {
           switch (topic) {
             case "showing":
               currentNotification = this;
               chromeDoc.getElementById("password-notification-password")
                        .removeAttribute("focused");
               chromeDoc.getElementById("password-notification-username")
                        .removeAttribute("focused");
--- a/toolkit/modules/PopupNotifications.jsm
+++ b/toolkit/modules/PopupNotifications.jsm
@@ -821,21 +821,18 @@ PopupNotifications.prototype = {
           ("secondEnd" in desc)) {
         popupnotification.setAttribute("secondname", desc.secondName);
         popupnotification.setAttribute("secondendlabel", desc.secondEnd);
       }
 
       popupnotification.setAttribute("id", popupnotificationID);
       popupnotification.setAttribute("popupid", n.id);
       popupnotification.setAttribute("oncommand", "PopupNotifications._onCommand(event);");
-      if (Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton")) {
-        popupnotification.setAttribute("closebuttoncommand", "PopupNotifications._onButtonEvent(event, '" + n.options.escAction + "', 'esc-press');");
-      } else {
-        popupnotification.setAttribute("closebuttoncommand", `PopupNotifications._dismiss(event, ${TELEMETRY_STAT_DISMISSAL_CLOSE_BUTTON});`);
-      }
+      popupnotification.setAttribute("closebuttoncommand", `PopupNotifications._dismiss(event, ${TELEMETRY_STAT_DISMISSAL_CLOSE_BUTTON});`);
+      
       if (n.mainAction) {
         popupnotification.setAttribute("buttonlabel", n.mainAction.label);
         popupnotification.setAttribute("buttonaccesskey", n.mainAction.accessKey);
         popupnotification.toggleAttribute("buttonhighlight", !n.mainAction.disableHighlight);
         popupnotification.setAttribute("buttoncommand", "PopupNotifications._onButtonEvent(event, 'buttoncommand');");
         popupnotification.setAttribute("dropmarkerpopupshown", "PopupNotifications._onButtonEvent(event, 'dropmarkerpopupshown');");
         popupnotification.setAttribute("learnmoreclick", "PopupNotifications._onButtonEvent(event, 'learnmoreclick');");
         popupnotification.setAttribute("menucommand", "PopupNotifications._onMenuCommand(event);");