Bug 1464461 - Fix talos failure; r=nchevobbe a=ritu l10n=ritu
authoryulia <ystartsev@mozilla.com>
Tue, 03 Jul 2018 15:33:38 +0200
changeset 478198 42473b21092f
parent 478197 433e33451a43
child 478199 94800a168d2c
push id9569
push usercsabou@mozilla.com
push dateThu, 02 Aug 2018 11:13:39 +0000
treeherdermozilla-beta@42473b21092f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe, ritu
bugs1464461
milestone62.0
Bug 1464461 - Fix talos failure; r=nchevobbe a=ritu l10n=ritu MozReview-Commit-ID: 9v9lRZjzacs
testing/talos/talos/tests/devtools/addon/content/tests/webconsole/objectexpand.js
--- a/testing/talos/talos/tests/devtools/addon/content/tests/webconsole/objectexpand.js
+++ b/testing/talos/talos/tests/devtools/addon/content/tests/webconsole/objectexpand.js
@@ -10,24 +10,24 @@ const { openToolbox, closeToolboxAndLog,
 module.exports = async function() {
   let tab = await testSetup(SIMPLE_URL);
 
   let messageManager = tab.linkedBrowser.messageManager;
   let toolbox = await openToolbox("webconsole");
   let webconsole = toolbox.getPanel("webconsole");
 
   // Resolve once the first message is received.
-  let onMessageReceived = new Promise(resolve => {
-    function receiveMessages(messages) {
-      for (let m of messages) {
-        resolve(m);
-      }
+  const waitForDirMessage = async () => {
+    let message = webconsole.hud.ui.outputNode.querySelector(".dir.message");
+    if (message) {
+      return message;
     }
-    webconsole.hud.ui.once("new-messages", receiveMessages);
-  });
+    await new Promise(res => setTimeout(res, 50));
+    return waitForDirMessage();
+  };
 
   // Load a frame script using a data URI so we can do logs
   // from the page.
   messageManager.loadFrameScript("data:,(" + encodeURIComponent(
     `function () {
       addMessageListener("do-dir", function () {
         content.console.dir(Array.from({length:333}).reduce((res, _, i)=> {
           res["item_" + i] = "alphanum-indexed-" + i;
@@ -38,18 +38,18 @@ module.exports = async function() {
       });
     }`
   ) + ")()", true);
 
   let test = runTest("console.objectexpand");
   // Kick off the logging
   messageManager.sendAsyncMessage("do-dir");
 
-  await onMessageReceived;
-  const tree = webconsole.hud.ui.outputNode.querySelector(".dir.message .tree");
+  const message = await waitForDirMessage();
+  const tree = message.querySelector(".tree");
 
   // The tree can be collapsed since the properties are fetched asynchronously.
   if (tree.querySelectorAll(".node").length === 1) {
     // If this is the case, we wait for the properties to be fetched and displayed.
     await new Promise(resolve => {
       const observer = new (getBrowserWindow().MutationObserver)(mutations => {
         resolve(mutations);
         observer.disconnect();