Bug 1445261 - Change promiseTopicObserved with TestUtils.topicObserved for one occurrence r=johannh
authorAlex <alexandersonone@gmail.com>
Fri, 18 May 2018 09:16:48 -0700
changeset 419868 71dbe00b841a50fb59e89322b5b78376550fccc8
parent 419867 f6726096117ef65460349028631a91a2df6595a7
child 419869 ff2ef4fe0c6c907e7692c1e92bd1601e2295c468
push id64457
push usersfoster@mozilla.com
push dateFri, 25 May 2018 16:36:10 +0000
treeherderautoland@71dbe00b841a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1445261
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1445261 - Change promiseTopicObserved with TestUtils.topicObserved for one occurrence r=johannh Removed the promiseTopicObserved function declaration from head.js. MozReview-Commit-ID: 9Oyd29fi9ef
browser/base/content/test/popupNotifications/browser_popupNotification_no_anchors.js
browser/base/content/test/popupNotifications/head.js
--- 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,