Bug 1479335 - Remove permissions close button r=nhnt11

Differential Revision: https://phabricator.services.mozilla.com/D16264

--HG--
extra : moz-landing-system : lando
This commit is contained in:
ui.manish 2019-02-24 09:58:15 +00:00
Родитель ab3eee7b52
Коммит 4d1af398d9
8 изменённых файлов: 7 добавлений и 35 удалений

Просмотреть файл

@ -280,7 +280,7 @@ var gPluginHandler = {
let options = {
dismissed: !showNow,
hideClose: !Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton"),
hideClose: true,
persistent: showNow,
eventCallback: this._clickToPlayNotificationEventCallback,
primaryPlugin: primaryPluginPermission,

Просмотреть файл

@ -6819,7 +6819,7 @@ var IndexedDBPromptHelper = {
browser, topic, message, this._notificationIcon, mainAction, secondaryActions,
{
persistent: true,
hideClose: !Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton"),
hideClose: true,
});
},
};

Просмотреть файл

@ -215,27 +215,6 @@ var tests = [
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() {

Просмотреть файл

@ -413,7 +413,7 @@ var PermissionPromptPrototype = {
}
// 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

Просмотреть файл

@ -488,7 +488,7 @@ function prompt(aBrowser, aRequest) {
let options = {
name: getHostOrExtensionName(uri),
persistent: true,
hideClose: !Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton"),
hideClose: true,
eventCallback(aTopic, aNewBrowser) {
if (aTopic == "swapping")
return true;

Просмотреть файл

@ -1422,10 +1422,6 @@ 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

Просмотреть файл

@ -1016,7 +1016,7 @@ LoginManagerPrompter.prototype = {
timeout: Date.now() + 10000,
persistWhileVisible: true,
passwordNotificationType: type,
hideClose: !Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton"),
hideClose: true,
eventCallback(topic) {
switch (topic) {
case "showing":

Просмотреть файл

@ -826,11 +826,8 @@ PopupNotifications.prototype = {
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);