Bug 1056179 - WebRTC global indicator fails to open the sharing doorhanger if there's another notification before it, r=gavin.

This commit is contained in:
Florian Quèze 2014-09-24 12:21:57 +02:00
parent f7887f142c
commit 057d1a7a28
2 changed files with 37 additions and 8 deletions

View File

@ -229,5 +229,30 @@ let tests = [
this.notification.remove();
},
onHidden: function() { }
},
// A first dismissed notification shouldn't stop _update from showing a second notification
{ id: "Test#12",
run: function () {
this.notifyObj1 = new BasicNotification(this.id);
this.notifyObj1.id += "_1";
this.notifyObj1.anchorID = "default-notification-icon";
this.notifyObj1.options.dismissed = true;
this.notification1 = showNotification(this.notifyObj1);
this.notifyObj2 = new BasicNotification(this.id);
this.notifyObj2.id += "_2";
this.notifyObj2.anchorID = "geo-notification-icon";
this.notifyObj2.options.dismissed = true;
this.notification2 = showNotification(this.notifyObj2);
this.notification2.dismissed = false;
PopupNotifications._update();
},
onShown: function (popup) {
checkPopup(popup, this.notifyObj2);
this.notification1.remove();
this.notification2.remove();
},
onHidden: function(popup) { }
}
];

View File

@ -681,10 +681,15 @@ PopupNotifications.prototype = {
notifications = this._currentNotifications;
let haveNotifications = notifications.length > 0;
if (haveNotifications) {
// Only show the notifications that have the passed-in anchor (or the
// first notification's anchor, if none was passed in). Other
// notifications will be shown once these are dismissed.
anchorElement = anchor || notifications[0].anchorElement;
// Filter out notifications that have been dismissed.
notificationsToShow = notifications.filter(function (n) {
return !n.dismissed && !n.options.neverShow;
});
// If no anchor has been passed in, use the anchor of the first
// showable notification.
if (!anchorElement && notificationsToShow.length)
anchorElement = notificationsToShow[0].anchorElement;
if (useIconBox) {
this._showIcons(notifications);
@ -693,10 +698,9 @@ PopupNotifications.prototype = {
this._updateAnchorIcon(notifications, anchorElement);
}
// Also filter out notifications that have been dismissed.
notificationsToShow = notifications.filter(function (n) {
return !n.dismissed && n.anchorElement == anchorElement &&
!n.options.neverShow;
// Also filter out notifications that are for a different anchor.
notificationsToShow = notificationsToShow.filter(function (n) {
return n.anchorElement == anchorElement;
});
}