Bug 1377098 - Don't dismiss restart notifications r=rstrong

Since the restart itself will clear the restart notification if
it's successful, there's no need to actually dismiss it even on
the main action being executed. Accordingly, this patch changes
it to pass the "dismiss" field to the main action, which will
cause the main action to simply degrade the doorhanger to a
badge.

MozReview-Commit-ID: 5FKTTihIoe4

--HG--
extra : rebase_source : ec9bc2b961bd1c2ec08580d95f0fec06a7f2b437
This commit is contained in:
Doug Thayer 2017-06-29 11:39:02 -07:00
Родитель a0a02343a4
Коммит 906343ceef
1 изменённых файлов: 6 добавлений и 4 удалений

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

@ -78,7 +78,7 @@ var UpdateListener = {
win.openURL(manualUpdateUrl);
},
showUpdateNotification(type, dismissed, mainAction, beforeShowDoorhanger) {
showUpdateNotification(type, mainActionDismiss, dismissed, mainAction, beforeShowDoorhanger) {
let action = {
callback(win, fromDoorhanger) {
if (fromDoorhanger) {
@ -87,7 +87,8 @@ var UpdateListener = {
Services.telemetry.getHistogramById("UPDATE_NOTIFICATION_MAIN_ACTION_MENU").add(type);
}
mainAction(win);
}
},
dismiss: mainActionDismiss,
};
let secondaryAction = {
@ -109,11 +110,11 @@ var UpdateListener = {
},
showRestartNotification(dismissed) {
this.showUpdateNotification("restart", dismissed, () => this.requestRestart());
this.showUpdateNotification("restart", true, dismissed, () => this.requestRestart());
},
showUpdateAvailableNotification(update, dismissed) {
this.showUpdateNotification("available", dismissed, () => {
this.showUpdateNotification("available", false, dismissed, () => {
let updateService = Cc["@mozilla.org/updates/update-service;1"]
.getService(Ci.nsIApplicationUpdateService);
updateService.downloadUpdate(update, true);
@ -122,6 +123,7 @@ var UpdateListener = {
showManualUpdateNotification(update, dismissed) {
this.showUpdateNotification("manual",
false,
dismissed,
win => this.openManualUpdateUrl(win),
doc => this.replaceReleaseNotes(doc, update, "updateManualWhatsNew"));