From 33ca510058a66d59ce3a2ddb540686ca4f2fb0e6 Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Mon, 1 Apr 2019 07:48:39 -0600 Subject: [PATCH] Bug 1529867 - Wait for worker source, r=jlast. Differential Revision: https://phabricator.services.mozilla.com/D25612 --HG-- extra : rebase_source : 940a415ade4c80a9fa884375749e2f4c9cc2cbf0 --- .../new/test/mochitest/browser_dbg-windowless-workers.js | 2 ++ devtools/client/debugger/new/test/mochitest/helpers.js | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/devtools/client/debugger/new/test/mochitest/browser_dbg-windowless-workers.js b/devtools/client/debugger/new/test/mochitest/browser_dbg-windowless-workers.js index 359250676975..de7ff6eb1803 100644 --- a/devtools/client/debugger/new/test/mochitest/browser_dbg-windowless-workers.js +++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-windowless-workers.js @@ -43,6 +43,8 @@ add_task(async function() { const worker2Thread = workers[1].actor; const mainThreadSource = findSource(dbg, "doc-windowless-workers.html"); + + await waitForSource(dbg, "simple-worker.js"); const workerSource = findSource(dbg, "simple-worker.js"); info("Test pausing in the main thread"); diff --git a/devtools/client/debugger/new/test/mochitest/helpers.js b/devtools/client/debugger/new/test/mochitest/helpers.js index 2340c352db92..eafa6234fe16 100644 --- a/devtools/client/debugger/new/test/mochitest/helpers.js +++ b/devtools/client/debugger/new/test/mochitest/helpers.js @@ -192,10 +192,7 @@ async function waitForSources(dbg, ...sources) { function waitForSource(dbg, url) { return waitForState( dbg, - state => { - const sources = dbg.selectors.getSources(state); - return Object.values(sources).find(s => (s.url || "").includes(url)); - }, + state => findSource(dbg, url, { silent: true }), "source exists" ); }