Bug 1464461 - fix talos failure; r=nchevobbe
authoryulia <ystartsev@mozilla.com>
Tue, 03 Jul 2018 15:33:38 +0200
changeset 424831 dc54472ca3bf
parent 424830 ea3556925d99
child 424832 30bdb22bbe5a
push id65865
push userystartsev@mozilla.com
push dateTue, 03 Jul 2018 13:51:00 +0000
treeherderautoland@dc54472ca3bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnchevobbe
bugs1464461
milestone63.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 1464461 - fix talos failure; r=nchevobbe 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();