Bug 1155172 - Intermittent browser_webconsole_notifications.js. r=past, a=test-only
authorPatrick Brosset <pbrosset@mozilla.com>
Mon, 20 Apr 2015 11:53:03 +0200
changeset 260212 52322e98f739
parent 260211 8f9c08f19f6a
child 260213 650ed1bb5a04
push id721
push userjlund@mozilla.com
push date2015-04-21 23:03 +0000
treeherdermozilla-release@d27c9211ebb3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast, test-only
bugs1155172
milestone38.0
Bug 1155172 - Intermittent browser_webconsole_notifications.js. r=past, a=test-only
browser/devtools/webconsole/test/browser_webconsole_notifications.js
--- a/browser/devtools/webconsole/test/browser_webconsole_notifications.js
+++ b/browser/devtools/webconsole/test/browser_webconsole_notifications.js
@@ -3,24 +3,24 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 const TEST_URI = "data:text/html;charset=utf-8,<p>Web Console test for notifications";
 
 let test = asyncTest(function* () {
   yield loadTab(TEST_URI);
 
-  let gotEvents = waitForEvents();
-
-  let hud = yield openConsole();
+  let consoleOpened = promise.defer();
+  let gotEvents = waitForEvents(consoleOpened.promise);
+  let hud = yield openConsole().then(() => consoleOpened.resolve());
 
   yield gotEvents;
 });
 
-function waitForEvents() {
+function waitForEvents(onConsoleOpened) {
   let deferred = promise.defer();
 
   function webConsoleCreated(aID)
   {
     Services.obs.removeObserver(observer, "web-console-created");
     ok(HUDService.getHudReferenceById(aID), "We have a hud reference");
     content.wrappedJSObject.console.log("adding a log message");
   }
@@ -32,17 +32,17 @@ function waitForEvents() {
     executeSoon(deferred.resolve);
   }
 
   function webConsoleMessage(aID, aNodeID)
   {
     Services.obs.removeObserver(observer, "web-console-message-created");
     ok(aID, "we have a console ID");
     is(typeof aNodeID, "string", "message node id is a string");
-    executeSoon(closeConsole);
+    onConsoleOpened.then(closeConsole);
   }
 
   let observer = {
 
     QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
 
     observe: function observe(aSubject, aTopic, aData)
     {