Bug 588353 - Allow showing popup notifications that don't show popups [r=gavin a=gavin]

Augment PopupNotifications to take neverShow option that results in no popups getting shown for the notification.

--HG--
extra : rebase_source : eeef617d40eb222685aa3c1445eb3d34464513d2
This commit is contained in:
Edward Lee 2010-08-18 02:49:34 -07:00
Родитель d264c4231a
Коммит 17066d3e8d
2 изменённых файлов: 17 добавлений и 3 удалений

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

@ -446,6 +446,19 @@ var tests = [
this.box.parentNode.removeChild(this.box);
}
},
// Test that popupnotifications without popups have anchor icons shown
{ // Test #15
run: function() {
let notifyObj = new basicNotification();
notifyObj.anchorID = "geo-notification-icon";
notifyObj.options = {neverShow: true};
showNotification(notifyObj);
},
updateNotShowing: function() {
isnot(document.getElementById("geo-notification-icon").boxObject.width, 0,
"geo anchor should be visible");
}
},
];
function showNotification(notifyObj) {

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

@ -189,6 +189,8 @@ PopupNotifications.prototype = {
* dismissed: Whether the notification should be added as a dismissed
* notification. Dismissed notifications can be activated
* by clicking on their anchorElement.
* neverShow: Indicate that no popup should be shown for this
* notification. Useful for just showing the anchor icon.
* @returns the Notification object corresponding to the added notification.
*/
show: function PopupNotifications_show(browser, id, message, anchorID,
@ -201,8 +203,6 @@ PopupNotifications.prototype = {
throw "PopupNotifications_show: invalid browser";
if (!id)
throw "PopupNotifications_show: invalid ID";
if (!message)
throw "PopupNotifications_show: invalid message";
if (mainAction && isInvalidAction(mainAction))
throw "PopupNotifications_show: invalid mainAction";
if (secondaryActions && secondaryActions.some(isInvalidAction))
@ -398,7 +398,8 @@ PopupNotifications.prototype = {
// Also filter out notifications that have been dismissed.
notificationsToShow = this._currentNotifications.filter(function (n) {
return !n.dismissed && n.anchorElement == anchorElement;
return !n.dismissed && n.anchorElement == anchorElement &&
!n.options.neverShow;
});
}