Bug 1046828 - [Notifications API] We should never send the "show" event using system messages at a reboot. r=mhenretty

This commit is contained in:
Julien Wajsberg 2014-08-06 03:45:00 -04:00
Родитель 77fe533a05
Коммит 6b9eff1884
2 изменённых файлов: 40 добавлений и 29 удалений

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

@ -136,20 +136,25 @@ let AlertsHelper = {
}); });
} catch (e) { } catch (e) {
// we get an exception if the app is not launched yet // we get an exception if the app is not launched yet
gSystemMessenger.sendMessage(kNotificationSystemMessageName, { if (detail.type !== kDesktopNotificationShow) {
clicked: (detail.type === kDesktopNotificationClick), // excluding the 'show' event: there is no reason a unlaunched app
title: listener.title, // would want to be notified that a notification is shown. This
body: listener.text, // happens when a notification is still displayed at reboot time.
imageURL: listener.imageURL, gSystemMessenger.sendMessage(kNotificationSystemMessageName, {
lang: listener.lang, clicked: (detail.type === kDesktopNotificationClick),
dir: listener.dir, title: listener.title,
id: listener.id, body: listener.text,
tag: listener.tag, imageURL: listener.imageURL,
timestamp: listener.timestamp lang: listener.lang,
}, dir: listener.dir,
Services.io.newURI(listener.target, null, null), id: listener.id,
Services.io.newURI(listener.manifestURL, null, null) tag: listener.tag,
); timestamp: listener.timestamp
},
Services.io.newURI(listener.target, null, null),
Services.io.newURI(listener.manifestURL, null, null)
);
}
} }
} }

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

@ -42,6 +42,7 @@ const kMessageAppNotificationReturn = "app-notification-return";
const kMessageAlertNotificationSend = "alert-notification-send"; const kMessageAlertNotificationSend = "alert-notification-send";
const kMessageAlertNotificationClose = "alert-notification-close"; const kMessageAlertNotificationClose = "alert-notification-close";
const kTopicAlertShow = "alertshow";
const kTopicAlertFinished = "alertfinished"; const kTopicAlertFinished = "alertfinished";
const kTopicAlertClickCallback = "alertclickcallback"; const kTopicAlertClickCallback = "alertclickcallback";
@ -136,21 +137,26 @@ AlertsService.prototype = {
// notification via a system message containing the title/text/icon of // notification via a system message containing the title/text/icon of
// the notification so the app get a change to react. // the notification so the app get a change to react.
if (data.target) { if (data.target) {
gSystemMessenger.sendMessage(kNotificationSystemMessageName, { if (topic !== kTopicAlertShow) {
clicked: (topic === kTopicAlertClickCallback), // excluding the 'show' event: there is no reason a unlaunched app
title: listener.title, // would want to be notified that a notification is shown. This
body: listener.text, // happens when a notification is still displayed at reboot time.
imageURL: listener.imageURL, gSystemMessenger.sendMessage(kNotificationSystemMessageName, {
lang: listener.lang, clicked: (topic === kTopicAlertClickCallback),
dir: listener.dir, title: listener.title,
id: listener.id, body: listener.text,
tag: listener.tag, imageURL: listener.imageURL,
dbId: listener.dbId, lang: listener.lang,
timestamp: listener.timestamp dir: listener.dir,
}, id: listener.id,
Services.io.newURI(data.target, null, null), tag: listener.tag,
Services.io.newURI(listener.manifestURL, null, null) dbId: listener.dbId,
); timestamp: listener.timestamp
},
Services.io.newURI(data.target, null, null),
Services.io.newURI(listener.manifestURL, null, null)
);
}
} }
} }