mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1100876 - Add showOnlyOnce to MozBehavior dict. r=mhenretty, r=smaug
There are some notifications that we know we don't want to resend. For instance, Voicemail notifications are some, since everytime the network will be ready it will notify us of the status, so we don't have to resend it on reboot. We add a 'showOnlyOnce' key in the MozBehavior dict for this usecase.
This commit is contained in:
parent
7f8189c9d4
commit
1903e36586
@ -54,6 +54,11 @@ ChromeNotifications.prototype = {
|
||||
} catch(e) {
|
||||
behavior = undefined;
|
||||
}
|
||||
|
||||
if (behavior && behavior.showOnlyOnce === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
appNotifier.showAppNotification(
|
||||
notification.icon,
|
||||
notification.title,
|
||||
|
@ -86,6 +86,35 @@
|
||||
});
|
||||
},
|
||||
|
||||
function (done) {
|
||||
info("Sending one non-resendable notification");
|
||||
var behavior = {
|
||||
showOnlyOnce: true
|
||||
};
|
||||
var notif = new Notification("title", { mozbehavior: behavior });
|
||||
ok(notif, "Notification object is valid");
|
||||
notifications.push(notif);
|
||||
|
||||
var promise = Notification.get();
|
||||
promise.then(function (notifications) {
|
||||
is(notifications.length, 1, "one notification has been sent");
|
||||
done();
|
||||
});
|
||||
},
|
||||
|
||||
function (done) {
|
||||
info("Trying to resend non-resendable notification");
|
||||
var notif = notifications.pop();
|
||||
notif.onclose = function() {
|
||||
done();
|
||||
};
|
||||
|
||||
navigator.mozChromeNotifications.mozResendAllNotifications(function(number) {
|
||||
is(number, 0, "One notification not resent");
|
||||
notif.close();
|
||||
});
|
||||
},
|
||||
|
||||
function (done) {
|
||||
info("Sending two notifications, closing one");
|
||||
var notif1 = new Notification("title1");
|
||||
|
@ -72,6 +72,7 @@ dictionary GetNotificationOptions {
|
||||
dictionary NotificationBehavior {
|
||||
boolean noscreen = false;
|
||||
boolean noclear = false;
|
||||
boolean showOnlyOnce = false;
|
||||
DOMString soundFile = "";
|
||||
sequence<unsigned long> vibrationPattern;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user