Backed out changeset 8c7ac177290e (bug 1479335) for ES Lint fialure. CLOSED TREE

This commit is contained in:
Razvan Maries 2019-02-24 12:17:38 +02:00
Родитель 4d1af398d9
Коммит 7a5c7bab52
8 изменённых файлов: 35 добавлений и 7 удалений

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

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

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

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

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

@ -215,6 +215,27 @@ 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 = true;
options.hideClose = !Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton");
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: true,
hideClose: !Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton"),
eventCallback(aTopic, aNewBrowser) {
if (aTopic == "swapping")
return true;

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

@ -1422,6 +1422,10 @@ 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: true,
hideClose: !Services.prefs.getBoolPref("privacy.permissionPrompts.showCloseButton"),
eventCallback(topic) {
switch (topic) {
case "showing":

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

@ -826,8 +826,11 @@ PopupNotifications.prototype = {
popupnotification.setAttribute("id", popupnotificationID);
popupnotification.setAttribute("popupid", n.id);
popupnotification.setAttribute("oncommand", "PopupNotifications._onCommand(event);");
popupnotification.setAttribute("closebuttoncommand", `PopupNotifications._dismiss(event, ${TELEMETRY_STAT_DISMISSAL_CLOSE_BUTTON});`);
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});`);
}
if (n.mainAction) {
popupnotification.setAttribute("buttonlabel", n.mainAction.label);
popupnotification.setAttribute("buttonaccesskey", n.mainAction.accessKey);