Bug 1494796 - fix verify test r=jdescottes
authoryulia <ystartsev@mozilla.com>
Fri, 14 Jun 2019 20:34:04 +0000
changeset 478975 ec5d586ced75a5025968374b15e5e7d2dfd2b333
parent 478974 67445d8e4d054549a4fbda274d54b7f1d4a48bf0
child 478976 ae4f5a5b9febd67246deceeb18438d6c15ead307
push id88004
push userystartsev@mozilla.com
push dateFri, 14 Jun 2019 22:34:23 +0000
treeherderautoland@ae4f5a5b9feb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes
bugs1494796
milestone69.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 1494796 - fix verify test r=jdescottes Differential Revision: https://phabricator.services.mozilla.com/D34981
devtools/client/debugger/test/mochitest/browser_dbg-navigation.js
devtools/shared/client/thread-client.js
--- a/devtools/client/debugger/test/mochitest/browser_dbg-navigation.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-navigation.js
@@ -23,36 +23,48 @@ add_task(async function() {
   const {
     selectors: { getSelectedSource, getIsPaused, getCurrentThread },
     getState
   } = dbg;
 
   invokeInTab("firstCall");
   await waitForPaused(dbg);
 
+  await waitForRequestsToSettle(dbg);
   await navigate(dbg, "doc-scripts.html", "simple1.js");
   await selectSource(dbg, "simple1");
   await addBreakpoint(dbg, "simple1.js", 4);
   invokeInTab("main");
   await waitForPaused(dbg);
   await waitForLoadedSource(dbg, "simple1");
   toggleScopes(dbg);
 
   assertPausedLocation(dbg);
   is(countSources(dbg), 5, "5 sources are loaded.");
 
+  await waitForRequestsToSettle(dbg);
+  // this test is intermittent without this
+  let onBreakpoint = waitForDispatch(dbg, "SET_BREAKPOINT");
   await navigate(dbg, "doc-scripts.html", ...sources);
+  await onBreakpoint
   is(countSources(dbg), 5, "5 sources are loaded.");
   ok(!getIsPaused(getCurrentThread()), "Is not paused");
 
+  await waitForRequestsToSettle(dbg);
+  // this test is intermittent without this
+  onBreakpoint = waitForDispatch(dbg, "SET_BREAKPOINT");
   await navigate(dbg, "doc-scripts.html", ...sources);
+  await onBreakpoint
   is(countSources(dbg), 5, "5 sources are loaded.");
 
   // Test that the current select source persists across reloads
   await selectSource(dbg, "long.js");
+
   await waitForRequestsToSettle(dbg);
-
+  // this test is intermittent without this
+  onBreakpoint = waitForDispatch(dbg, "SET_BREAKPOINT");
   await reload(dbg, "long.js");
+  await onBreakpoint
   await waitForSelectedSource(dbg, "long.js");
 
   await waitForRequestsToSettle(dbg);
   ok(getSelectedSource().url.includes("long.js"), "Selected source is long.js");
 });
--- a/devtools/shared/client/thread-client.js
+++ b/devtools/shared/client/thread-client.js
@@ -190,18 +190,25 @@ class ThreadClient extends FrontClassWit
    */
   _doInterrupt(when) {
     return super.interrupt(when);
   }
 
   /**
    * Request the loaded sources for the current thread.
    */
-  getSources() {
-    return super.sources();
+  async getSources() {
+    let sources = [];
+    try {
+      ({sources} = await super.sources());
+    } catch (e) {
+      // we may have closed the connection
+      console.log(`getSources failed. Connection may have closed: ${e}`);
+    }
+    return { sources };
   }
 
   /**
    * Request frames from the callstack for the current thread.
    *
    * @param start integer
    *        The number of the youngest stack frame to return (the youngest
    *        frame is 0).