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 265682 4ffd34ccca5d9c49d0f4d710cdba811dd81147ca
parent 265681 cdebefc5da888b7d9802bf5f44dd773e99e07377
child 265683 0b450b40bed31d774317f40914c5f4cdfcc115ab
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast, test-only
bugs1155172
milestone39.0a2
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)
     {