Bug 1445261 - Change promiseTopicObserved with TestUtils.topicObserved for one occurrence r?johannh
Removed the promiseTopicObserved function declaration from head.js.
MozReview-Commit-ID: 9Oyd29fi9ef
--- a/browser/base/content/test/popupNotifications/browser_popupNotification_no_anchors.js
+++ b/browser/base/content/test/popupNotifications/browser_popupNotification_no_anchors.js
@@ -162,17 +162,17 @@ var tests = [
async run() {
for (let persistent of [false, true]) {
// Start editing the URL, ensuring that the awesomebar popup is hidden.
gURLBar.select();
EventUtils.sendString("*");
EventUtils.synthesizeKey("KEY_Backspace");
// Trying to show a notification should display nothing.
- let notShowing = promiseTopicObserved("PopupNotifications-updateNotShowing");
+ let notShowing = TestUtils.topicObserved("PopupNotifications-updateNotShowing");
this.notifyObj = new BasicNotification(this.id);
this.notifyObj.anchorID = "geo-notification-icon";
this.notifyObj.addOptions({ persistent });
this.notification = showNotification(this.notifyObj);
await notShowing;
// Reverting the URL should show the notification.
let shown = waitForNotificationPanel();
--- a/browser/base/content/test/popupNotifications/head.js
+++ b/browser/base/content/test/popupNotifications/head.js
@@ -1,34 +1,14 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
/**
- * Allows waiting for an observer notification once.
- *
- * @param topic
- * Notification topic to observe.
- *
- * @return {Promise}
- * @resolves The array [subject, data] from the observed notification.
- * @rejects Never.
- */
-function promiseTopicObserved(topic) {
- return new Promise(resolve => {
- info("Waiting for observer topic " + topic);
- Services.obs.addObserver(function PTO_observe(obsSubject, obsTopic, obsData) {
- Services.obs.removeObserver(PTO_observe, obsTopic);
- resolve([obsSubject, obsData]);
- }, topic);
- });
-}
-
-/**
* Called after opening a new window or switching windows, this will wait until
* we are sure that an attempt to display a notification will not fail.
*/
async function waitForWindowReadyForPopupNotifications(win) {
// These are the same checks that PopupNotifications.jsm makes before it
// allows a notification to open.
await BrowserTestUtils.waitForCondition(
() => win.gBrowser.selectedBrowser.docShellIsActive,