Bug 1206133 - Fix browser_bug553455.js such that it does not make invalid assumptions about how panels work and refactored from callbacks to Tasks and Promises. r=rhelmer

MozReview-Commit-ID: 79bsQGDVz19

--HG--
extra : rebase_source : ffcbd0e5f35563c3e0c6067c71ce89a2279b225e
This commit is contained in:
Kirk Steuber 2016-09-06 11:04:06 -07:00
parent 2b313fc731
commit 45b3026e70
3 changed files with 874 additions and 854 deletions

View File

@ -132,6 +132,7 @@ support-files =
!/toolkit/mozapps/extensions/test/xpinstall/restartless-unsigned.xpi
!/toolkit/mozapps/extensions/test/xpinstall/restartless.xpi
!/toolkit/mozapps/extensions/test/xpinstall/theme.xpi
!/toolkit/mozapps/extensions/test/xpinstall/slowinstall.sjs
[browser_aboutAccounts.js]
skip-if = os == "linux" # Bug 958026

File diff suppressed because it is too large Load Diff

View File

@ -804,6 +804,7 @@ PopupNotifications.prototype = {
});
if (!notificationsToShow.length)
return;
let notificationIds = notificationsToShow.map(n => n.id);
this._refreshPanel(notificationsToShow);
@ -811,6 +812,12 @@ PopupNotifications.prototype = {
notificationsToShow.forEach(function (n) {
this._fireCallback(n, NOTIFICATION_EVENT_SHOWN);
}, this);
// Let tests know that the panel was updated and what notifications it was
// updated with so that tests can wait for the correct notifications to be
// added.
let event = new this.window.CustomEvent("PanelUpdated",
{"detail": notificationIds});
this.panel.dispatchEvent(event);
return;
}
@ -869,9 +876,12 @@ PopupNotifications.prototype = {
notificationsToShow.forEach(function (n) {
this._fireCallback(n, NOTIFICATION_EVENT_SHOWN);
}, this);
// This notification is used by tests to know when all the processing
// These notifications are used by tests to know when all the processing
// required to display the panel has happened.
this.panel.dispatchEvent(new this.window.CustomEvent("Shown"));
let event = new this.window.CustomEvent("PanelUpdated",
{"detail": notificationIds});
this.panel.dispatchEvent(event);
};
this._popupshownListener = this._popupshownListener.bind(this);
target.addEventListener("popupshown", this._popupshownListener, true);