Bug 1444132 - Prevent race in browser_net_view_source-debugger.js if the stack button is lazily created. r=jryans
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 17 Jul 2018 10:49:53 -0700
changeset 826068 3ba0fd5c1def88163a1b2feb73e8db88e701ae2f
parent 826067 50e7a79bb869fb67c9d69e1a228106d9a10ecab9
child 826069 3baa0a93d12d224aa844d7116d53f64bc66ad004
push id118238
push userbmo:mh+mozilla@glandium.org
push dateThu, 02 Aug 2018 22:02:22 +0000
reviewersjryans
bugs1444132
milestone63.0a1
Bug 1444132 - Prevent race in browser_net_view_source-debugger.js if the stack button is lazily created. r=jryans MozReview-Commit-ID: 6nM786CYyp7
devtools/client/netmonitor/test/browser_net_view-source-debugger.js
--- a/devtools/client/netmonitor/test/browser_net_view-source-debugger.js
+++ b/devtools/client/netmonitor/test/browser_net_view-source-debugger.js
@@ -24,23 +24,25 @@ add_task(async function() {
   const { document, store, windowRequire } = monitor.panelWin;
   const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
   store.dispatch(Actions.batchEnable(false));
 
   // Execute requests.
   await performRequests(monitor, tab, 2);
 
   info("Clicking stack-trace tab and waiting for stack-trace panel to open");
-  const wait = waitForDOM(document, "#stack-trace-panel .frame-link", 5);
+  const waitForTab = waitForDOM(document, "#stack-trace-tab");
   // Click on the first request
   EventUtils.sendMouseEvent({ type: "mousedown" },
     document.querySelector(".request-list-item"));
+  await waitForTab;
+  const waitForPanel = waitForDOM(document, "#stack-trace-panel .frame-link", 5);
   // Open the stack-trace tab for that request
   document.getElementById("stack-trace-tab").click();
-  await wait;
+  await waitForPanel;
 
   const frameLinkNode = document.querySelector(".frame-link");
   await checkClickOnNode(toolbox, frameLinkNode);
 
   await teardown(monitor);
 });
 
 /**