Bug 1497348 - Wait for the inspector to be ready after reload; r=yzen
authorPatrick Brosset <pbrosset@mozilla.com>
Thu, 18 Oct 2018 07:57:02 +0000
changeset 500363 125e5170ef3a92d25ad95cf14df1cc564a4e0a52
parent 500362 d3dc7831efa89c4a464ba2aeb4252ce984185cfb
child 500364 d522a86504a76831e59348784c25e81162fe540a
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyzen
bugs1497348
milestone64.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 1497348 - Wait for the inspector to be ready after reload; r=yzen Depends on D8974 Differential Revision: https://phabricator.services.mozilla.com/D8980
devtools/client/framework/test/browser_toolbox_window_reload_target.js
--- a/devtools/client/framework/test/browser_toolbox_window_reload_target.js
+++ b/devtools/client/framework/test/browser_toolbox_window_reload_target.js
@@ -60,19 +60,16 @@ add_task(async function() {
     await testOneTool(toolbox, toolID);
   }
 
   info("Switch back to docked mode");
   await toolbox.switchHost(Toolbox.HostType.BOTTOM);
 
   gBrowser.selectedBrowser.messageManager.removeMessageListener("devtools:test:load", reloadCounter);
 
-  // If we finish too early, the inspector breaks promises.
-  await toolbox.getPanel("inspector").once("new-root");
-
   await toolbox.destroy();
   gBrowser.removeCurrentTab();
 });
 
 async function testOneTool(toolbox, toolID) {
   info(`Select tool ${toolID}`);
   await toolbox.selectTool(toolID);
 
@@ -83,19 +80,24 @@ async function testOneTool(toolbox, tool
 }
 
 function testReload(shortcut, toolbox, toolID) {
   info(`Reload with ${shortcut}`);
 
   const mm = gBrowser.selectedBrowser.messageManager;
 
   return new Promise(resolve => {
+    // The inspector needs some special care.
+    const toolUpdated = toolID === "inspector"
+      ? toolbox.getPanel("inspector").once("new-root")
+      : Promise.resolve();
+
     const complete = () => {
       mm.removeMessageListener("devtools:test:load", complete);
-      resolve();
+      toolUpdated.then(resolve);
     };
     mm.addMessageListener("devtools:test:load", complete);
 
     toolbox.win.focus();
     synthesizeKeyShortcut(L10N.getStr(shortcut), toolbox.win);
     reloadsSent++;
   });
 }