Bug 1521540 - Replace Frame.source form with Frame.actor. r=lsmyth
authorJason Laster <jlaster@mozilla.com>
Wed, 23 Jan 2019 18:05:08 -0500
changeset 515546 e3f2ecc94174c91bc2e1cabc92fe396989c278d3
parent 515545 c418bc9e3fcef85a4de1b775e73dd4d08d0bd465
child 515547 34940391fb5b3c635495d14128ad9f3596e8e01e
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsmyth
bugs1521540
milestone66.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 1521540 - Replace Frame.source form with Frame.actor. r=lsmyth Tags: Differential Revision: https://phabricator.services.mozilla.com/D17439
devtools/client/debugger/new/src/client/firefox/create.js
devtools/server/actors/frame.js
devtools/server/actors/thread.js
devtools/server/tests/unit/head_dbg.js
devtools/server/tests/unit/test_blackboxing-01.js
devtools/server/tests/unit/test_blackboxing-03.js
devtools/server/tests/unit/test_blackboxing-05.js
devtools/server/tests/unit/test_breakpoint-01.js
devtools/server/tests/unit/test_breakpoint-02.js
devtools/server/tests/unit/test_breakpoint-03.js
devtools/server/tests/unit/test_breakpoint-04.js
devtools/server/tests/unit/test_breakpoint-05.js
devtools/server/tests/unit/test_breakpoint-06.js
devtools/server/tests/unit/test_breakpoint-07.js
devtools/server/tests/unit/test_breakpoint-08.js
devtools/server/tests/unit/test_breakpoint-09.js
devtools/server/tests/unit/test_breakpoint-10.js
devtools/server/tests/unit/test_breakpoint-11.js
devtools/server/tests/unit/test_breakpoint-12.js
devtools/server/tests/unit/test_breakpoint-13.js
devtools/server/tests/unit/test_breakpoint-14.js
devtools/server/tests/unit/test_breakpoint-15.js
devtools/server/tests/unit/test_breakpoint-16.js
devtools/server/tests/unit/test_breakpoint-17.js
devtools/server/tests/unit/test_breakpoint-18.js
devtools/server/tests/unit/test_breakpoint-21.js
devtools/server/tests/unit/test_breakpoint-22.js
devtools/server/tests/unit/test_conditional_breakpoint-01.js
devtools/server/tests/unit/test_conditional_breakpoint-02.js
devtools/server/tests/unit/test_conditional_breakpoint-03.js
devtools/server/tests/unit/test_frameactor_wasm-01.js
devtools/server/tests/unit/test_setBreakpoint-at-the-beginning-of-a-line.js
devtools/server/tests/unit/test_setBreakpoint-at-the-beginning-of-a-minified-fn.js
devtools/server/tests/unit/test_setBreakpoint-at-the-end-of-a-line.js
devtools/server/tests/unit/test_setBreakpoint-at-the-end-of-a-minified-fn.js
devtools/server/tests/unit/test_setBreakpoint-on-column-in-gcd-script.js
devtools/server/tests/unit/test_setBreakpoint-on-column.js
devtools/server/tests/unit/test_setBreakpoint-on-line-in-gcd-script.js
devtools/server/tests/unit/test_setBreakpoint-on-line-with-multiple-offsets.js
devtools/server/tests/unit/test_setBreakpoint-on-line-with-multiple-statements.js
devtools/server/tests/unit/test_setBreakpoint-on-line-with-no-offsets-in-gcd-script.js
devtools/server/tests/unit/test_setBreakpoint-on-line-with-no-offsets.js
devtools/server/tests/unit/test_setBreakpoint-on-line.js
devtools/server/tests/unit/test_stepping-08.js
--- a/devtools/client/debugger/new/src/client/firefox/create.js
+++ b/devtools/client/debugger/new/src/client/firefox/create.js
@@ -21,18 +21,20 @@ export function createFrame(frame: Frame
   }
   let title;
   if (frame.type == "call") {
     const c = frame.callee;
     title = c.name || c.userDisplayName || c.displayName;
   } else {
     title = `(${frame.type})`;
   }
+
+  // NOTE: Firefox 66 switched from where.source to where.actor
   const location = {
-    sourceId: frame.where.source.actor,
+    sourceId: frame.where.source ? frame.where.source.actor : frame.where.actor,
     line: frame.where.line,
     column: frame.where.column
   };
 
   return {
     id: frame.actor,
     displayName: title,
     location,
--- a/devtools/server/actors/frame.js
+++ b/devtools/server/actors/frame.js
@@ -94,17 +94,17 @@ const FrameActor = ActorClassWithSpec(fr
       form.this = createValueGrip(this.frame.this, threadActor._pausePool,
         threadActor.objectGrip);
     }
 
     form.arguments = this._args();
     if (this.frame.script) {
       const generatedLocation = this.threadActor.sources.getFrameLocation(this.frame);
       form.where = {
-        source: generatedLocation.generatedSourceActor.form(),
+        actor: generatedLocation.generatedSourceActor.actorID,
         line: generatedLocation.generatedLine,
         column: generatedLocation.generatedColumn,
       };
     }
 
     if (!this.frame.older) {
       form.oldest = true;
     }
--- a/devtools/server/actors/thread.js
+++ b/devtools/server/actors/thread.js
@@ -478,17 +478,17 @@ const ThreadActor = ActorClassWithSpec(t
 
       if (!generatedSourceActor) {
         // If the frame location is in a source that not pass the 'allowSource'
         // check and thus has no actor, we do not bother pausing.
         return undefined;
       }
 
       packet.frame.where = {
-        source: generatedSourceActor.form(),
+        actor: generatedSourceActor.actorID,
         line: generatedLine,
         column: generatedColumn,
       };
       const pkt = onPacket(packet);
 
       this.conn.send(pkt);
     } catch (error) {
       reportError(error);
@@ -1186,29 +1186,27 @@ const ThreadActor = ActorClassWithSpec(t
     for (; frame && (!count || i < (start + count)); i++, frame = frame.older) {
       const form = this._createFrameActor(frame).form();
       form.depth = i;
 
       let frameItem = null;
 
       const frameSourceActor = this.sources.createSourceActor(frame.script.source);
       if (frameSourceActor) {
-        const sourceForm = frameSourceActor.form();
         form.where = {
-          source: sourceForm,
+          actor: frameSourceActor.actorID,
           line: form.where.line,
           column: form.where.column,
         };
-        form.source = sourceForm;
         frameItem = form;
       }
       frames.push(frameItem);
     }
 
-    // Filter null values because sourcemapping may have failed.
+    // Filter null values because createSourceActor can be falsey
     return { frames: frames.filter(x => !!x) };
   },
 
   onReleaseMany: function(request) {
     if (!request.actors) {
       return { error: "missingParameter",
                message: "no actors were specified" };
     }
--- a/devtools/server/tests/unit/head_dbg.js
+++ b/devtools/server/tests/unit/head_dbg.js
@@ -799,29 +799,36 @@ function getSourceContent(sourceClient) 
 
 /**
  * Get a source at the specified url.
  *
  * @param ThreadClient threadClient
  * @param string url
  * @returns Promise<SourceClient>
  */
-function getSource(threadClient, url) {
-  const deferred = defer();
-  threadClient.getSources((res) => {
-    const source = res.sources.filter(function(s) {
-      return s.url === url;
-    });
-    if (source.length) {
-      deferred.resolve(threadClient.source(source[0]));
-    } else {
-      deferred.reject(new Error("source not found"));
-    }
-  });
-  return deferred.promise;
+async function getSource(threadClient, url) {
+  const {sources} = await threadClient.getSources();
+  const source = sources.find((s) => s.url === url);
+
+  if (source) {
+    return threadClient.source(source);
+  }
+
+  throw new Error("source not found");
+}
+
+async function getSourceById(threadClient, id) {
+  const { sources } = await threadClient.getSources();
+  const form = sources.find(source => source.actor == id);
+  return threadClient.source(form);
+}
+
+async function getSourceFormById(threadClient, id) {
+  const { sources } = await threadClient.getSources();
+  return sources.find(source => source.actor == id);
 }
 
 /**
  * Do a reload which clears the thread debugger
  *
  * @param TabFront tabFront
  * @returns Promise<response>
  */
--- a/devtools/server/tests/unit/test_blackboxing-01.js
+++ b/devtools/server/tests/unit/test_blackboxing-01.js
@@ -25,74 +25,82 @@ function run_test() {
   do_test_pending();
 }
 
 const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
 const SOURCE_URL = "http://example.com/source.js";
 
 const testBlackBox = async function() {
   const packet = await executeOnNextTickAndWaitForPause(evalCode, gClient);
-  const source = gThreadClient.source(packet.frame.where.source);
+  const bpSource = await getSourceById(
+    gThreadClient,
+    packet.frame.where.actor
+  );
 
-  await setBreakpoint(source, {
-    line: 2,
-  });
+  await setBreakpoint(bpSource, { line: 2 });
   await resume(gThreadClient);
 
-  const { sources } = await getSources(gThreadClient);
-  const sourceClient = gThreadClient.source(
-    sources.filter(s => s.url == BLACK_BOXED_URL)[0]
-  );
+  const sourceClient = await getSource(gThreadClient, BLACK_BOXED_URL);
 
   Assert.ok(!sourceClient.isBlackBoxed,
             "By default the source is not black boxed.");
 
   // Test that we can step into `doStuff` when we are not black boxed.
   await runTest(
-    function onSteppedLocation(location) {
-      Assert.equal(location.source.url, BLACK_BOXED_URL);
+    async function onSteppedLocation(location) {
+      const source = await getSourceFormById(gThreadClient, location.actor);
+      Assert.equal(source.url, BLACK_BOXED_URL);
       Assert.equal(location.line, 2);
     },
-    function onDebuggerStatementFrames(frames) {
-      Assert.ok(!frames.some(f => f.where.source.isBlackBoxed));
+    async function onDebuggerStatementFrames(frames) {
+      for (const frame of frames) {
+        const source = await getSourceFormById(gThreadClient, frame.where.actor);
+        Assert.ok(!source.isBlackBoxed);
+      }
     }
   );
 
   await blackBox(sourceClient);
   Assert.ok(sourceClient.isBlackBoxed);
 
   // Test that we step through `doStuff` when we are black boxed and its frame
   // doesn't show up.
   await runTest(
-    function onSteppedLocation(location) {
-      Assert.equal(location.source.url, SOURCE_URL);
+    async function onSteppedLocation(location) {
+      const source = await getSourceFormById(gThreadClient, location.actor);
+      Assert.equal(source.url, SOURCE_URL);
       Assert.equal(location.line, 4);
     },
-    function onDebuggerStatementFrames(frames) {
-      for (const f of frames) {
-        if (f.where.source.url == BLACK_BOXED_URL) {
-          Assert.ok(f.where.source.isBlackBoxed);
+    async function onDebuggerStatementFrames(frames) {
+      for (const frame of frames) {
+        const source = await getSourceFormById(gThreadClient, frame.where.actor);
+        if (source.url == BLACK_BOXED_URL) {
+          Assert.ok(source.isBlackBoxed);
         } else {
-          Assert.ok(!f.where.source.isBlackBoxed);
+          Assert.ok(!source.isBlackBoxed);
         }
       }
     }
   );
 
   await unBlackBox(sourceClient);
   Assert.ok(!sourceClient.isBlackBoxed);
 
   // Test that we can step into `doStuff` again.
   await runTest(
-    function onSteppedLocation(location) {
-      Assert.equal(location.source.url, BLACK_BOXED_URL);
+    async function onSteppedLocation(location) {
+      const source = await getSourceFormById(gThreadClient, location.actor);
+      Assert.equal(source.url, BLACK_BOXED_URL);
       Assert.equal(location.line, 2);
     },
-    function onDebuggerStatementFrames(frames) {
-      Assert.ok(!frames.some(f => f.where.source.isBlackBoxed));
+    async function onDebuggerStatementFrames(frames) {
+      for (const frame of frames) {
+        const source = await getSourceFormById(gThreadClient, frame.where.actor);
+        Assert.ok(!source.isBlackBoxed);
+      }
     }
   );
 
   finishClient(gClient);
 };
 
 function evalCode() {
   /* eslint-disable */
@@ -127,23 +135,23 @@ function evalCode() {
 const runTest = async function(onSteppedLocation, onDebuggerStatementFrames) {
   let packet = await executeOnNextTickAndWaitForPause(gDebuggee.runTest,
                                                       gClient);
   Assert.equal(packet.why.type, "breakpoint");
 
   await stepIn(gClient, gThreadClient);
 
   const location = await getCurrentLocation();
-  onSteppedLocation(location);
+  await onSteppedLocation(location);
 
   packet = await resumeAndWaitForPause(gClient, gThreadClient);
   Assert.equal(packet.why.type, "debuggerStatement");
 
   const { frames } = await getFrames(gThreadClient, 0, 100);
-  onDebuggerStatementFrames(frames);
+  await onDebuggerStatementFrames(frames);
 
   return resume(gThreadClient);
 };
 
 const getCurrentLocation = async function() {
   const response = await getFrames(gThreadClient, 0, 1);
   return response.frames[0].where;
 };
--- a/devtools/server/tests/unit/test_blackboxing-03.js
+++ b/devtools/server/tests/unit/test_blackboxing-03.js
@@ -26,24 +26,22 @@ function run_test() {
   });
   do_test_pending();
 }
 
 const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
 const SOURCE_URL = "http://example.com/source.js";
 
 function test_black_box() {
-  gClient.addOneTimeListener("paused", function(event, packet) {
-    const source = gThreadClient.source(packet.frame.where.source);
-    source.setBreakpoint({
-      line: 4,
-    }).then(function([response, bpClient]) {
-      gBpClient = bpClient;
-      gThreadClient.resume(test_black_box_dbg_statement);
-    });
+  gClient.addOneTimeListener("paused", async function(event, packet) {
+    const source = await getSourceById(gThreadClient, packet.frame.where.actor);
+    const [, bpClient] = await source.setBreakpoint({ line: 4 });
+    gBpClient = bpClient;
+    await gThreadClient.resume();
+    test_black_box_dbg_statement();
   });
 
   /* eslint-disable no-multi-spaces, no-undef */
   Cu.evalInSandbox(
     "" + function doStuff(k) { // line 1
       debugger;                // line 2 - Break here
       k(100);                  // line 3
     },                         // line 4
@@ -68,29 +66,27 @@ function test_black_box() {
     1
   );
   /* eslint-enable no-multi-spaces, no-undef */
 }
 
 function test_black_box_dbg_statement() {
   gThreadClient.getSources(async function({error, sources}) {
     Assert.ok(!error, "Should not get an error: " + error);
-    const sourceClient = gThreadClient.source(
-      sources.filter(s => s.url == BLACK_BOXED_URL)[0]
-    );
+    const sourceClient = await getSource(gThreadClient, BLACK_BOXED_URL);
 
     await blackBox(sourceClient);
 
-    gClient.addOneTimeListener("paused", function(event, packet) {
+    gThreadClient.addOneTimeListener("paused", async function(event, packet) {
       Assert.equal(packet.why.type, "breakpoint",
                    "We should pass over the debugger statement.");
-      gBpClient.remove(function({error}) {
-        Assert.ok(!error, "Should not get an error: " + error);
-        gThreadClient.resume(test_unblack_box_dbg_statement.bind(null, sourceClient));
-      });
+
+      await gBpClient.remove();
+      await gThreadClient.resume();
+      await test_unblack_box_dbg_statement(sourceClient);
     });
     gDebuggee.runTest();
   });
 }
 
 async function test_unblack_box_dbg_statement(sourceClient) {
   await unBlackBox(sourceClient);
 
--- a/devtools/server/tests/unit/test_blackboxing-05.js
+++ b/devtools/server/tests/unit/test_blackboxing-05.js
@@ -66,24 +66,23 @@ function test_black_box() {
     1
   );
   /* eslint-enable no-multi-spaces, no-unreachable, no-undef */
 }
 
 function test_black_box_exception() {
   gThreadClient.getSources(async function({error, sources}) {
     Assert.ok(!error, "Should not get an error: " + error);
-    const sourceClient = gThreadClient.source(
-      sources.filter(s => s.url == BLACK_BOXED_URL)[0]
-    );
-
+    const sourceClient = await getSource(gThreadClient, BLACK_BOXED_URL);
     await blackBox(sourceClient);
     gThreadClient.pauseOnExceptions(true);
 
-    gClient.addOneTimeListener("paused", function(event, packet) {
-      Assert.equal(packet.frame.where.source.url, SOURCE_URL,
+    gClient.addOneTimeListener("paused", async function(event, packet) {
+      const source = await getSourceById(gThreadClient, packet.frame.where.actor);
+
+      Assert.equal(source.url, SOURCE_URL,
                    "We shouldn't pause while in the black boxed source.");
       finishClient(gClient);
     });
 
     gThreadClient.resume();
   });
 }
--- a/devtools/server/tests/unit/test_breakpoint-01.js
+++ b/devtools/server/tests/unit/test_breakpoint-01.js
@@ -3,50 +3,49 @@
 /* eslint-disable no-shadow, max-nested-callbacks */
 
 "use strict";
 
 /**
  * Check basic breakpoint functionality.
  */
 
-add_task(threadClientTest(({ threadClient, debuggee }) => {
-  return new Promise(resolve => {
-    threadClient.addOneTimeListener("paused", function(event, packet) {
-      const source = threadClient.source(packet.frame.where.source);
-      const location = {
-        line: debuggee.line0 + 3,
-      };
+add_task(threadClientTest(async ({ threadClient, debuggee }) => {
+  (async () => {
+    info("Wait for the debugger statement to be hit");
+    let packet = await waitForPause(threadClient);
+    const source = await getSourceById(
+      threadClient,
+      packet.frame.where.actor
+    );
 
-      source.setBreakpoint(location).then(function([response, bpClient]) {
-        threadClient.addOneTimeListener("paused", function(event, packet) {
-          // Check the return value.
-          Assert.equal(packet.type, "paused");
-          Assert.equal(packet.frame.where.source.actor, source.actor);
-          Assert.equal(packet.frame.where.line, location.line);
-          Assert.equal(packet.why.type, "breakpoint");
-          Assert.equal(packet.why.actors[0], bpClient.actor);
-          // Check that the breakpoint worked.
-          Assert.equal(debuggee.a, 1);
-          Assert.equal(debuggee.b, undefined);
+    const location = { line: debuggee.line0 + 3 };
+
+    const [, bpClient] = await source.setBreakpoint(location);
+
+    await threadClient.resume();
+    packet = await waitForPause(threadClient);
 
-          // Remove the breakpoint.
-          bpClient.remove(function(response) {
-            threadClient.resume(resolve);
-          });
-        });
+    info("Paused at the breakpoint");
+    Assert.equal(packet.type, "paused");
+    Assert.equal(packet.frame.where.actor, source.actor);
+    Assert.equal(packet.frame.where.line, location.line);
+    Assert.equal(packet.why.type, "breakpoint");
+    Assert.equal(packet.why.actors[0], bpClient.actor);
 
-        // Continue until the breakpoint is hit.
-        threadClient.resume();
-      });
-    });
+    info("Check that the breakpoint worked.");
+    Assert.equal(debuggee.a, 1);
+    Assert.equal(debuggee.b, undefined);
 
-    /* eslint-disable */
-    Cu.evalInSandbox(
-      "var line0 = Error().lineNumber;\n" +
-      "debugger;\n" +   // line0 + 1
-      "var a = 1;\n" +  // line0 + 2
-      "var b = 2;\n",   // line0 + 3
-      debuggee
-    );
-    /* eslint-enable */
-  });
+    await bpClient.remove();
+    await threadClient.resume();
+  })();
+
+  /* eslint-disable */
+  Cu.evalInSandbox(
+    "var line0 = Error().lineNumber;\n" +
+    "debugger;\n" +   // line0 + 1
+    "var a = 1;\n" +  // line0 + 2
+    "var b = 2;\n",   // line0 + 3
+     debuggee
+  );
+  /* eslint-enable */
 }));
--- a/devtools/server/tests/unit/test_breakpoint-02.js
+++ b/devtools/server/tests/unit/test_breakpoint-02.js
@@ -4,29 +4,32 @@
 
 "use strict";
 
 /**
  * Check that setting breakpoints when the debuggee is running works.
  */
 
 add_task(threadClientTest(({ threadClient, debuggee }) => {
-  return new Promise(resolve => {
-    threadClient.addOneTimeListener("paused", function(event, packet) {
+  return new Promise((resolve) => {
+    threadClient.addOneTimeListener("paused", async function(event, packet) {
       const location = { line: debuggee.line0 + 3 };
+      const source = await getSourceById(
+        threadClient,
+        packet.frame.where.actor
+      );
 
       threadClient.resume();
 
       // Setting the breakpoint later should interrupt the debuggee.
       threadClient.addOneTimeListener("paused", function(event, packet) {
         Assert.equal(packet.type, "paused");
         Assert.equal(packet.why.type, "interrupted");
       });
 
-      const source = threadClient.source(packet.frame.where.source);
       source.setBreakpoint(location).then(function() {
         executeSoon(resolve);
       }, function(response) {
         // Eval scripts don't stick around long enough for the breakpoint to be set,
         // so just make sure we got the expected response from the actor.
         Assert.notEqual(response.error, "noScript");
 
         executeSoon(resolve);
--- a/devtools/server/tests/unit/test_breakpoint-03.js
+++ b/devtools/server/tests/unit/test_breakpoint-03.js
@@ -19,32 +19,34 @@ var test_no_skip_breakpoint = async func
   Assert.equal(bpClient.location.line, debuggee.line0 + 3);
   await bpClient.remove();
 };
 
 add_task(threadClientTest(({ threadClient, debuggee }) => {
   return new Promise(resolve => {
     threadClient.addOneTimeListener("paused", async function(event, packet) {
       const location = { line: debuggee.line0 + 3 };
-      const source = threadClient.source(packet.frame.where.source);
-
+      const source = await getSourceById(
+        threadClient,
+        packet.frame.where.actor
+      );
       // First, make sure that we can disable sliding with the
       // `noSliding` option.
       await test_no_skip_breakpoint(source, location, debuggee);
 
       // Now make sure that the breakpoint properly slides forward one line.
       const [response, bpClient] = await source.setBreakpoint(location);
       Assert.ok(!!response.actualLocation);
       Assert.equal(response.actualLocation.source.actor, source.actor);
       Assert.equal(response.actualLocation.line, location.line + 1);
 
       threadClient.addOneTimeListener("paused", function(event, packet) {
         // Check the return value.
         Assert.equal(packet.type, "paused");
-        Assert.equal(packet.frame.where.source.actor, source.actor);
+        Assert.equal(packet.frame.where.actor, source.actor);
         Assert.equal(packet.frame.where.line, location.line + 1);
         Assert.equal(packet.why.type, "breakpoint");
         Assert.equal(packet.why.actors[0], bpClient.actor);
         // Check that the breakpoint worked.
         Assert.equal(debuggee.a, 1);
         Assert.equal(debuggee.b, undefined);
 
         // Remove the breakpoint.
--- a/devtools/server/tests/unit/test_breakpoint-04.js
+++ b/devtools/server/tests/unit/test_breakpoint-04.js
@@ -5,28 +5,31 @@
 "use strict";
 
 /**
  * Check that setting a breakpoint in a line in a child script works.
  */
 
 add_task(threadClientTest(({ threadClient, debuggee }) => {
   return new Promise(resolve => {
-    threadClient.addOneTimeListener("paused", function(event, packet) {
-      const source = threadClient.source(packet.frame.where.source);
+    threadClient.addOneTimeListener("paused", async function(event, packet) {
+      const source = await getSourceById(
+        threadClient,
+        packet.frame.where.actor
+      );
       const location = { line: debuggee.line0 + 3 };
 
       source.setBreakpoint(location).then(function([response, bpClient]) {
         // actualLocation is not returned when breakpoints don't skip forward.
         Assert.equal(response.actualLocation, undefined);
 
         threadClient.addOneTimeListener("paused", function(event, packet) {
           // Check the return value.
           Assert.equal(packet.type, "paused");
-          Assert.equal(packet.frame.where.source.actor, source.actor);
+          Assert.equal(packet.frame.where.actor, source.actor);
           Assert.equal(packet.frame.where.line, location.line);
           Assert.equal(packet.why.type, "breakpoint");
           Assert.equal(packet.why.actors[0], bpClient.actor);
           // Check that the breakpoint worked.
           Assert.equal(debuggee.a, 1);
           Assert.equal(debuggee.b, undefined);
 
           // Remove the breakpoint.
--- a/devtools/server/tests/unit/test_breakpoint-05.js
+++ b/devtools/server/tests/unit/test_breakpoint-05.js
@@ -6,29 +6,32 @@
 
 /**
  * Check that setting a breakpoint in a line without code in a child script
  * will skip forward.
  */
 
 add_task(threadClientTest(({ threadClient, debuggee }) => {
   return new Promise(resolve => {
-    threadClient.addOneTimeListener("paused", function(event, packet) {
-      const source = threadClient.source(packet.frame.where.source);
+    threadClient.addOneTimeListener("paused", async function(event, packet) {
+      const source = await getSourceById(
+        threadClient,
+        packet.frame.where.actor
+      );
       const location = { line: debuggee.line0 + 3 };
 
       source.setBreakpoint(location).then(function([response, bpClient]) {
         // Check that the breakpoint has properly skipped forward one line.
         Assert.equal(response.actualLocation.source.actor, source.actor);
         Assert.equal(response.actualLocation.line, location.line + 1);
 
         threadClient.addOneTimeListener("paused", function(event, packet) {
           // Check the return value.
           Assert.equal(packet.type, "paused");
-          Assert.equal(packet.frame.where.source.actor, source.actor);
+          Assert.equal(packet.frame.where.actor, source.actor);
           Assert.equal(packet.frame.where.line, location.line + 1);
           Assert.equal(packet.why.type, "breakpoint");
           Assert.equal(packet.why.actors[0], bpClient.actor);
           // Check that the breakpoint worked.
           Assert.equal(debuggee.a, 1);
           Assert.equal(debuggee.b, undefined);
 
           // Remove the breakpoint.
--- a/devtools/server/tests/unit/test_breakpoint-06.js
+++ b/devtools/server/tests/unit/test_breakpoint-06.js
@@ -6,29 +6,32 @@
 
 /**
  * Check that setting a breakpoint in a line without code in a deeply-nested
  * child script will skip forward.
  */
 
 add_task(threadClientTest(({ threadClient, debuggee }) => {
   return new Promise(resolve => {
-    threadClient.addOneTimeListener("paused", function(event, packet) {
-      const source = threadClient.source(packet.frame.where.source);
+    threadClient.addOneTimeListener("paused", async function(event, packet) {
+      const source = await getSourceById(
+        threadClient,
+        packet.frame.where.actor
+      );
       const location = { line: debuggee.line0 + 5 };
 
       source.setBreakpoint(location).then(function([response, bpClient]) {
         // Check that the breakpoint has properly skipped forward one line.
         Assert.equal(response.actualLocation.source.actor, source.actor);
         Assert.equal(response.actualLocation.line, location.line + 1);
 
         threadClient.addOneTimeListener("paused", function(event, packet) {
           // Check the return value.
           Assert.equal(packet.type, "paused");
-          Assert.equal(packet.frame.where.source.actor, source.actor);
+          Assert.equal(packet.frame.where.actor, source.actor);
           Assert.equal(packet.frame.where.line, location.line + 1);
           Assert.equal(packet.why.type, "breakpoint");
           Assert.equal(packet.why.actors[0], bpClient.actor);
           // Check that the breakpoint worked.
           Assert.equal(debuggee.a, 1);
           Assert.equal(debuggee.b, undefined);
 
           // Remove the breakpoint.
--- a/devtools/server/tests/unit/test_breakpoint-07.js
+++ b/devtools/server/tests/unit/test_breakpoint-07.js
@@ -6,29 +6,32 @@
 
 /**
  * Check that setting a breakpoint in a line without code in the second child
  * script will skip forward.
  */
 
 add_task(threadClientTest(({ threadClient, debuggee }) => {
   return new Promise(resolve => {
-    threadClient.addOneTimeListener("paused", function(event, packet) {
-      const source = threadClient.source(packet.frame.where.source);
+    threadClient.addOneTimeListener("paused", async function(event, packet) {
+      const source = await getSourceById(
+        threadClient,
+        packet.frame.where.actor
+      );
       const location = { line: debuggee.line0 + 6 };
 
       source.setBreakpoint(location).then(function([response, bpClient]) {
         // Check that the breakpoint has properly skipped forward one line.
         Assert.equal(response.actualLocation.source.actor, source.actor);
         Assert.equal(response.actualLocation.line, location.line + 1);
 
         threadClient.addOneTimeListener("paused", function(event, packet) {
           // Check the return value.
           Assert.equal(packet.type, "paused");
-          Assert.equal(packet.frame.where.source.actor, source.actor);
+          Assert.equal(packet.frame.where.actor, source.actor);
           Assert.equal(packet.frame.where.line, location.line + 1);
           Assert.equal(packet.why.type, "breakpoint");
           Assert.equal(packet.why.actors[0], bpClient.actor);
           // Check that the breakpoint worked.
           Assert.equal(debuggee.a, 1);
           Assert.equal(debuggee.b, undefined);
 
           // Remove the breakpoint.
--- a/devtools/server/tests/unit/test_breakpoint-08.js
+++ b/devtools/server/tests/unit/test_breakpoint-08.js
@@ -8,52 +8,53 @@
  * Check that setting a breakpoint in a line without code in a child script
  * will skip forward, in a file with two scripts.
  */
 
 add_task(threadClientTest(({ threadClient, debuggee }) => {
   return new Promise(resolve => {
     threadClient.addOneTimeListener("paused", function(event, packet) {
       threadClient.eval(packet.frame.actor, "foo", function(response) {
-        threadClient.addOneTimeListener("paused", function(event, packet) {
+        threadClient.addOneTimeListener("paused", async function(event, packet) {
           const obj = threadClient.pauseGrip(packet.why.frameFinished.return);
-          obj.getDefinitionSite(runWithBreakpoint);
+          const site = await obj.getDefinitionSite();
+
+          const location = { line: debuggee.line0 + 3 };
+          const source = await getSourceById(
+            threadClient,
+            site.source.actor
+          );
+
+          source.setBreakpoint(location).then(function([response, bpClient]) {
+            // Check that the breakpoint has properly skipped forward one line.
+            Assert.equal(response.actualLocation.source.actor, source.actor);
+            Assert.equal(response.actualLocation.line, location.line + 1);
+
+            threadClient.addOneTimeListener("paused", function(event, packet) {
+              // Check the return value.
+              Assert.equal(packet.type, "paused");
+              Assert.equal(packet.frame.where.actor, source.actor);
+              Assert.equal(packet.frame.where.line, location.line + 1);
+              Assert.equal(packet.why.type, "breakpoint");
+              Assert.equal(packet.why.actors[0], bpClient.actor);
+              // Check that the breakpoint worked.
+              Assert.equal(debuggee.a, 1);
+              Assert.equal(debuggee.b, undefined);
+
+              // Remove the breakpoint.
+              bpClient.remove(function(response) {
+                threadClient.resume(resolve);
+              });
+            });
+
+            // Continue until the breakpoint is hit.
+            threadClient.resume();
+          });
         });
       });
-
-      function runWithBreakpoint(packet) {
-        const source = threadClient.source(packet.source);
-        const location = { line: debuggee.line0 + 3 };
-
-        source.setBreakpoint(location).then(function([response, bpClient]) {
-          // Check that the breakpoint has properly skipped forward one line.
-          Assert.equal(response.actualLocation.source.actor, source.actor);
-          Assert.equal(response.actualLocation.line, location.line + 1);
-
-          threadClient.addOneTimeListener("paused", function(event, packet) {
-            // Check the return value.
-            Assert.equal(packet.type, "paused");
-            Assert.equal(packet.frame.where.source.actor, source.actor);
-            Assert.equal(packet.frame.where.line, location.line + 1);
-            Assert.equal(packet.why.type, "breakpoint");
-            Assert.equal(packet.why.actors[0], bpClient.actor);
-            // Check that the breakpoint worked.
-            Assert.equal(debuggee.a, 1);
-            Assert.equal(debuggee.b, undefined);
-
-            // Remove the breakpoint.
-            bpClient.remove(function(response) {
-              threadClient.resume(resolve);
-            });
-          });
-
-          // Continue until the breakpoint is hit.
-          threadClient.resume();
-        });
-      }
     });
 
     /* eslint-disable */
     Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
                      "function foo() {\n" + // line0 + 1
                      "  this.a = 1;\n" +    // line0 + 2
                      "  // A comment.\n" +  // line0 + 3
                      "  this.b = 2;\n" +    // line0 + 4
--- a/devtools/server/tests/unit/test_breakpoint-09.js
+++ b/devtools/server/tests/unit/test_breakpoint-09.js
@@ -6,25 +6,28 @@
 
 /**
  * Check that removing a breakpoint works.
  */
 
 add_task(threadClientTest(({ threadClient, debuggee }) => {
   return new Promise(resolve => {
     let done = false;
-    threadClient.addOneTimeListener("paused", function(event, packet) {
-      const source = threadClient.source(packet.frame.where.source);
+    threadClient.addOneTimeListener("paused", async function(event, packet) {
+      const source = await getSourceById(
+        threadClient,
+        packet.frame.where.actor
+      );
       const location = { line: debuggee.line0 + 2 };
 
       source.setBreakpoint(location).then(function([response, bpClient]) {
         threadClient.addOneTimeListener("paused", function(event, packet) {
           // Check the return value.
           Assert.equal(packet.type, "paused");
-          Assert.equal(packet.frame.where.source.actor, source.actor);
+          Assert.equal(packet.frame.where.actor, source.actor);
           Assert.equal(packet.frame.where.line, location.line);
           Assert.equal(packet.why.type, "breakpoint");
           Assert.equal(packet.why.actors[0], bpClient.actor);
           // Check that the breakpoint worked.
           Assert.equal(debuggee.a, undefined);
 
           // Remove the breakpoint.
           bpClient.remove(function(response) {
--- a/devtools/server/tests/unit/test_breakpoint-10.js
+++ b/devtools/server/tests/unit/test_breakpoint-10.js
@@ -6,18 +6,21 @@
 
 /**
  * Check that setting a breakpoint in a line with multiple entry points
  * triggers no matter which entry point we reach.
  */
 
 add_task(threadClientTest(({ threadClient, debuggee }) => {
   return new Promise(resolve => {
-    threadClient.addOneTimeListener("paused", function(event, packet) {
-      const source = threadClient.source(packet.frame.where.source);
+    threadClient.addOneTimeListener("paused", async function(event, packet) {
+      const source = await getSourceById(
+        threadClient,
+        packet.frame.where.actor
+      );
       const location = { line: debuggee.line0 + 3 };
 
       source.setBreakpoint(location).then(function([response, bpClient]) {
         // actualLocation is not returned when breakpoints don't skip forward.
         Assert.equal(response.actualLocation, undefined);
 
         threadClient.addOneTimeListener("paused", function(event, packet) {
           // Check the return value.
--- a/devtools/server/tests/unit/test_breakpoint-11.js
+++ b/devtools/server/tests/unit/test_breakpoint-11.js
@@ -6,18 +6,21 @@
 
 /**
  * Make sure that setting a breakpoint in a line with bytecodes in multiple
  * scripts, sets the breakpoint in all of them (bug 793214).
  */
 
 add_task(threadClientTest(({ threadClient, debuggee }) => {
   return new Promise(resolve => {
-    threadClient.addOneTimeListener("paused", function(event, packet) {
-      const source = threadClient.source(packet.frame.where.source);
+    threadClient.addOneTimeListener("paused", async function(event, packet) {
+      const source = await getSourceById(
+        threadClient,
+        packet.frame.where.actor
+      );
       const location = { line: debuggee.line0 + 2 };
 
       source.setBreakpoint(location).then(function([response, bpClient]) {
         // actualLocation is not returned when breakpoints don't skip forward.
         Assert.equal(response.actualLocation, undefined);
 
         threadClient.addOneTimeListener("paused", function(event, packet) {
           // Check the return value.
--- a/devtools/server/tests/unit/test_breakpoint-12.js
+++ b/devtools/server/tests/unit/test_breakpoint-12.js
@@ -10,18 +10,21 @@
  */
 
 const NUM_BREAKPOINTS = 10;
 var gBpActor;
 var gCount;
 
 add_task(threadClientTest(({ threadClient, debuggee }) => {
   return new Promise(resolve => {
-    threadClient.addOneTimeListener("paused", function(event, packet) {
-      const source = threadClient.source(packet.frame.where.source);
+    threadClient.addOneTimeListener("paused", async function(event, packet) {
+      const source = await getSourceById(
+        threadClient,
+        packet.frame.where.actor
+      );
       const location = { line: debuggee.line0 + 3};
 
       source.setBreakpoint(location).then(function([response, bpClient]) {
         // Check that the breakpoint has properly skipped forward one line.
         Assert.equal(response.actualLocation.source.actor, source.actor);
         Assert.equal(response.actualLocation.line, location.line + 1);
         gBpActor = response.actor;
 
@@ -57,17 +60,17 @@ add_task(threadClientTest(({ threadClien
           return;
         }
 
         // After setting all the breakpoints, check that only one has effectively
         // remained.
         threadClient.addOneTimeListener("paused", function(event, packet) {
           // Check the return value.
           Assert.equal(packet.type, "paused");
-          Assert.equal(packet.frame.where.source.actor, source.actor);
+          Assert.equal(packet.frame.where.actor, source.actor);
           Assert.equal(packet.frame.where.line, location.line + 1);
           Assert.equal(packet.why.type, "breakpoint");
           Assert.equal(packet.why.actors[0], bpClient.actor);
           // Check that the breakpoint worked.
           Assert.equal(debuggee.a, 1);
           Assert.equal(debuggee.b, undefined);
 
           threadClient.addOneTimeListener("paused", function(event, packet) {
--- a/devtools/server/tests/unit/test_breakpoint-13.js
+++ b/devtools/server/tests/unit/test_breakpoint-13.js
@@ -6,18 +6,21 @@
 
 /**
  * Check that execution doesn't pause twice while stepping, when encountering
  * either a breakpoint or a debugger statement.
  */
 
 add_task(threadClientTest(({ threadClient, debuggee }) => {
   return new Promise(resolve => {
-    threadClient.addOneTimeListener("paused", function(event, packet) {
-      const source = threadClient.source(packet.frame.where.source);
+    threadClient.addOneTimeListener("paused", async function(event, packet) {
+      const source = await getSourceById(
+        threadClient,
+        packet.frame.where.actor
+      );
       const location = { line: debuggee.line0 + 2 };
 
       source.setBreakpoint(location).then(async function([response, bpClient]) {
         const testCallbacks = [
           function(packet) {
             // Check that the stepping worked.
             Assert.equal(packet.frame.where.line, debuggee.line0 + 5);
             Assert.equal(packet.why.type, "resumeLimit");
--- a/devtools/server/tests/unit/test_breakpoint-14.js
+++ b/devtools/server/tests/unit/test_breakpoint-14.js
@@ -6,18 +6,21 @@
 
 /**
  * Check that a breakpoint or a debugger statement cause execution to pause even
  * in a stepped-over function.
  */
 
 add_task(threadClientTest(({ threadClient, debuggee }) => {
   return new Promise(resolve => {
-    threadClient.addOneTimeListener("paused", function(event, packet) {
-      const source = threadClient.source(packet.frame.where.source);
+    threadClient.addOneTimeListener("paused", async function(event, packet) {
+      const source = await getSourceById(
+        threadClient,
+        packet.frame.where.actor
+      );
       const location = { line: debuggee.line0 + 2 };
 
       source.setBreakpoint(location).then(async function([response, bpClient]) {
         const testCallbacks = [
           function(packet) {
             // Check that the stepping worked.
             Assert.equal(packet.frame.where.line, debuggee.line0 + 5);
             Assert.equal(packet.why.type, "resumeLimit");
--- a/devtools/server/tests/unit/test_breakpoint-15.js
+++ b/devtools/server/tests/unit/test_breakpoint-15.js
@@ -24,17 +24,20 @@ function run_test() {
   });
   do_test_pending();
 }
 
 const SOURCE_URL = "http://example.com/source.js";
 
 const testSameBreakpoint = async function() {
   const packet = await executeOnNextTickAndWaitForPause(evalCode, gClient);
-  const source = gThreadClient.source(packet.frame.where.source);
+  const source = await getSourceById(
+    gThreadClient,
+    packet.frame.where.actor
+  );
 
   // Whole line
   const wholeLineLocation = {
     line: 2,
   };
 
   let [, firstBpClient] = await setBreakpoint(source, wholeLineLocation);
   let [, secondBpClient] = await setBreakpoint(source, wholeLineLocation);
--- a/devtools/server/tests/unit/test_breakpoint-16.js
+++ b/devtools/server/tests/unit/test_breakpoint-16.js
@@ -6,30 +6,33 @@
 
 /**
  * Check that we can set breakpoints in columns, not just lines.
  */
 
 add_task(threadClientTest(({ threadClient, debuggee, client }) => {
   return new Promise(resolve => {
     // Debugger statement
-    client.addOneTimeListener("paused", function(event, packet) {
-      const source = threadClient.source(packet.frame.where.source);
+    client.addOneTimeListener("paused", async function(event, packet) {
+      const source = await getSourceById(
+        threadClient,
+        packet.frame.where.actor
+      );
       const location = {
         line: debuggee.line0 + 1,
         column: 55,
       };
       let timesBreakpointHit = 0;
 
       source.setBreakpoint(location).then(function([response, bpClient]) {
         threadClient.addListener("paused", function onPaused(event, packet) {
           Assert.equal(packet.type, "paused");
           Assert.equal(packet.why.type, "breakpoint");
           Assert.equal(packet.why.actors[0], bpClient.actor);
-          Assert.equal(packet.frame.where.source.actor, source.actor);
+          Assert.equal(packet.frame.where.actor, source.actor);
           Assert.equal(packet.frame.where.line, location.line);
           Assert.equal(packet.frame.where.column, location.column);
 
           Assert.equal(debuggee.acc, timesBreakpointHit);
           Assert.equal(packet.frame.environment.bindings.variables.i.value,
                        timesBreakpointHit);
 
           if (++timesBreakpointHit === 3) {
--- a/devtools/server/tests/unit/test_breakpoint-17.js
+++ b/devtools/server/tests/unit/test_breakpoint-17.js
@@ -37,19 +37,22 @@ add_task(threadClientTest(({ threadClien
       resolve();
     });
 
     Cu.evalInSandbox(code, debuggee, "1.8", "http://example.com/", 1);
   });
 }));
 
 function set_breakpoints(packet, threadClient) {
-  return new Promise(resolve => {
+  return new Promise(async resolve => {
     let first, second;
-    const source = threadClient.source(packet.frame.where.source);
+    const source = await getSourceById(
+      threadClient,
+      packet.frame.where.actor
+    );
 
     source.setBreakpoint(firstLocation).then(function([{ actualLocation },
                                                        breakpointClient]) {
       Assert.ok(!actualLocation, "Should not get an actualLocation");
       first = breakpointClient;
 
       source.setBreakpoint(secondLocation).then(function([{ actualLocation },
                                                           breakpointClient]) {
--- a/devtools/server/tests/unit/test_breakpoint-18.js
+++ b/devtools/server/tests/unit/test_breakpoint-18.js
@@ -39,18 +39,21 @@ add_task(threadClientTest(({ threadClien
       "1.8",
       "http://example.com/",
       1
     );
   });
 }));
 
 function setBreakpoint(packet, threadClient, client) {
-  return new Promise(resolve => {
-    const source = threadClient.source(packet.frame.where.source);
+  return new Promise(async resolve => {
+    const source = await getSourceById(
+      threadClient,
+      packet.frame.where.actor
+    );
     client.addOneTimeListener("resumed", resolve);
 
     source.setBreakpoint({ line: 2 }).then(() => {
       threadClient.resume();
     });
   });
 }
 
--- a/devtools/server/tests/unit/test_breakpoint-21.js
+++ b/devtools/server/tests/unit/test_breakpoint-21.js
@@ -12,30 +12,33 @@
 add_task(threadClientTest(async ({ threadClient, debuggee, client }) => {
   // Populate the `ScriptStore` so that we only test that the script
   // is added through `onNewScript`
   await getSources(threadClient);
 
   let packet = await executeOnNextTickAndWaitForPause(() => {
     evalCode(debuggee);
   }, client);
-  const source = threadClient.source(packet.frame.where.source);
+  const source = await getSourceById(
+      threadClient,
+      packet.frame.where.actor
+    );
   const location = {
     line: debuggee.line0 + 8,
   };
 
   const [res, bpClient] = await setBreakpoint(source, location);
   ok(!res.error);
 
   await resume(threadClient);
   packet = await waitForPause(client);
   Assert.equal(packet.type, "paused");
   Assert.equal(packet.why.type, "breakpoint");
   Assert.equal(packet.why.actors[0], bpClient.actor);
-  Assert.equal(packet.frame.where.source.actor, source.actor);
+  Assert.equal(packet.frame.where.actor, source.actor);
   Assert.equal(packet.frame.where.line, location.line);
 
   await resume(threadClient);
 }));
 
 /* eslint-disable */
 function evalCode(debuggee) {
   // Start a new script
--- a/devtools/server/tests/unit/test_breakpoint-22.js
+++ b/devtools/server/tests/unit/test_breakpoint-22.js
@@ -11,17 +11,21 @@
 add_task(threadClientTest(async ({ threadClient, debuggee, client }) => {
   // Populate the `ScriptStore` so that we only test that the script
   // is added through `onNewScript`
   await getSources(threadClient);
 
   const packet = await executeOnNextTickAndWaitForPause(() => {
     evalCode(debuggee);
   }, client);
-  const source = threadClient.source(packet.frame.where.source);
+  const source = await getSourceById(
+    threadClient,
+    packet.frame.where.actor
+  );
+
   const location = {
     line: debuggee.line0 + 2,
   };
 
   const [res ] = await setBreakpoint(source, location);
   ok(!res.error);
 
   const location2 = {
--- a/devtools/server/tests/unit/test_conditional_breakpoint-01.js
+++ b/devtools/server/tests/unit/test_conditional_breakpoint-01.js
@@ -22,18 +22,21 @@ function run_test() {
                              gThreadClient = threadClient;
                              test_simple_breakpoint();
                            });
   });
   do_test_pending();
 }
 
 function test_simple_breakpoint() {
-  gThreadClient.addOneTimeListener("paused", function(event, packet) {
-    const source = gThreadClient.source(packet.frame.where.source);
+  gThreadClient.addOneTimeListener("paused", async function(event, packet) {
+    const source = await getSourceById(
+      gThreadClient,
+      packet.frame.where.actor
+    );
     source.setBreakpoint({
       line: 3,
       condition: "a === 1",
     }).then(function([response, bpClient]) {
       gThreadClient.addOneTimeListener("paused", function(event, packet) {
         // Check the return value.
         Assert.equal(packet.why.type, "breakpoint");
         Assert.equal(packet.frame.where.line, 3);
--- a/devtools/server/tests/unit/test_conditional_breakpoint-02.js
+++ b/devtools/server/tests/unit/test_conditional_breakpoint-02.js
@@ -22,18 +22,21 @@ function run_test() {
                              gThreadClient = threadClient;
                              test_simple_breakpoint();
                            });
   });
   do_test_pending();
 }
 
 function test_simple_breakpoint() {
-  gThreadClient.addOneTimeListener("paused", function(event, packet) {
-    const source = gThreadClient.source(packet.frame.where.source);
+  gThreadClient.addOneTimeListener("paused", async function(event, packet) {
+    const source = await getSourceById(
+      gThreadClient,
+      packet.frame.where.actor
+    );
     source.setBreakpoint({
       line: 3,
       condition: "a === 2",
     }).then(function([response, bpClient]) {
       gThreadClient.addOneTimeListener("paused", function(event, packet) {
         // Check the return value.
         Assert.equal(packet.why.type, "debuggerStatement");
         Assert.equal(packet.frame.where.line, 4);
--- a/devtools/server/tests/unit/test_conditional_breakpoint-03.js
+++ b/devtools/server/tests/unit/test_conditional_breakpoint-03.js
@@ -22,18 +22,21 @@ function run_test() {
                              gThreadClient = threadClient;
                              test_simple_breakpoint();
                            });
   });
   do_test_pending();
 }
 
 function test_simple_breakpoint() {
-  gThreadClient.addOneTimeListener("paused", function(event, packet) {
-    const source = gThreadClient.source(packet.frame.where.source);
+  gThreadClient.addOneTimeListener("paused", async function(event, packet) {
+    const source = await getSourceById(
+      gThreadClient,
+      packet.frame.where.actor
+    );
     source.setBreakpoint({
       line: 3,
       condition: "throw new Error()",
     }).then(function([response, bpClient]) {
       gThreadClient.addOneTimeListener("paused", function(event, packet) {
         // Check the return value.
         Assert.equal(packet.why.type, "breakpointConditionThrown");
         Assert.equal(packet.frame.where.line, 3);
--- a/devtools/server/tests/unit/test_frameactor_wasm-01.js
+++ b/devtools/server/tests/unit/test_frameactor_wasm-01.js
@@ -39,27 +39,28 @@ function run_test() {
         });
       });
   });
   do_test_pending();
 }
 
 function test_pause_frame() {
   gThreadClient.addOneTimeListener("paused", function(event, packet) {
-    gThreadClient.getFrames(0, null, function(frameResponse) {
+    gThreadClient.getFrames(0, null, async function(frameResponse) {
       Assert.equal(frameResponse.frames.length, 4);
 
       const wasmFrame = frameResponse.frames[1];
       Assert.equal(wasmFrame.type, "wasmcall");
       Assert.equal(wasmFrame.this, undefined);
 
       const location = wasmFrame.where;
+      const source = await getSourceById(gThreadClient, location.actor);
       Assert.equal(location.line > 0, true);
       Assert.equal(location.column > 0, true);
-      Assert.equal(/^wasm:(?:[^:]*:)*?[0-9a-f]{16}$/.test(location.source.url), true);
+      Assert.equal(/^wasm:(?:[^:]*:)*?[0-9a-f]{16}$/.test(source.url), true);
 
       finishClient(gClient);
     });
   });
 
   /* eslint-disable comma-spacing, max-len */
   gDebuggee.eval("(" + function() {
     // WebAssembly bytecode was generated by running:
--- a/devtools/server/tests/unit/test_setBreakpoint-at-the-beginning-of-a-line.js
+++ b/devtools/server/tests/unit/test_setBreakpoint-at-the-beginning-of-a-line.js
@@ -23,20 +23,19 @@ add_task(threadClientTest(async ({ threa
 
   Assert.equal(packet.type, "paused");
   const why = packet.why;
   Assert.equal(why.type, "breakpoint");
   Assert.equal(why.actors.length, 1);
   Assert.equal(why.actors[0], breakpointClient.actor);
 
   const frame = packet.frame;
-  const where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
-  Assert.equal(where.line, location.line);
-  Assert.equal(where.column, 6);
+  Assert.equal(frame.where.actor, source.actor);
+  Assert.equal(frame.where.line, location.line);
+  Assert.equal(frame.where.column, 6);
 
   const variables = frame.environment.bindings.variables;
   Assert.equal(variables.a.value.type, "undefined");
   Assert.equal(variables.b.value.type, "undefined");
   Assert.equal(variables.c.value.type, "undefined");
 
   await resume(threadClient);
 }, { doNotRunWorker: true }));
--- a/devtools/server/tests/unit/test_setBreakpoint-at-the-beginning-of-a-minified-fn.js
+++ b/devtools/server/tests/unit/test_setBreakpoint-at-the-beginning-of-a-minified-fn.js
@@ -26,17 +26,17 @@ add_task(threadClientTest(async ({ threa
   Assert.equal(packet.type, "paused");
   const why = packet.why;
   Assert.equal(why.type, "breakpoint");
   Assert.equal(why.actors.length, 1);
   Assert.equal(why.actors[0], breakpointClient.actor);
 
   const frame = packet.frame;
   const where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
+  Assert.equal(where.actor, source.actor);
   Assert.equal(where.line, location.line);
   Assert.equal(where.column, 52);
 
   const variables = frame.environment.bindings.variables;
   Assert.equal(variables.a.value.type, "undefined");
   Assert.equal(variables.b.value.type, "undefined");
   Assert.equal(variables.c.value.type, "undefined");
 
--- a/devtools/server/tests/unit/test_setBreakpoint-at-the-end-of-a-line.js
+++ b/devtools/server/tests/unit/test_setBreakpoint-at-the-end-of-a-line.js
@@ -24,17 +24,17 @@ add_task(threadClientTest(async ({ threa
   Assert.equal(packet.type, "paused");
   const why = packet.why;
   Assert.equal(why.type, "breakpoint");
   Assert.equal(why.actors.length, 1);
   Assert.equal(why.actors[0], breakpointClient.actor);
 
   const frame = packet.frame;
   const where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
+  Assert.equal(where.actor, source.actor);
   Assert.equal(where.line, location.line);
   Assert.equal(where.column, 28);
 
   const variables = frame.environment.bindings.variables;
   Assert.equal(variables.a.value, 1);
   Assert.equal(variables.b.value, 2);
   Assert.equal(variables.c.value.type, "undefined");
 
--- a/devtools/server/tests/unit/test_setBreakpoint-at-the-end-of-a-minified-fn.js
+++ b/devtools/server/tests/unit/test_setBreakpoint-at-the-end-of-a-minified-fn.js
@@ -26,17 +26,17 @@ add_task(threadClientTest(async ({ threa
   Assert.equal(packet.type, "paused");
   const why = packet.why;
   Assert.equal(why.type, "breakpoint");
   Assert.equal(why.actors.length, 1);
   Assert.equal(why.actors[0], breakpointClient.actor);
 
   const frame = packet.frame;
   const where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
+  Assert.equal(where.actor, source.actor);
   Assert.equal(where.line, location.line);
   Assert.equal(where.column, 81);
 
   const variables = frame.environment.bindings.variables;
   Assert.equal(variables.a.value, 1);
   Assert.equal(variables.b.value, 2);
   Assert.equal(variables.c.value, 3);
 
--- a/devtools/server/tests/unit/test_setBreakpoint-on-column-in-gcd-script.js
+++ b/devtools/server/tests/unit/test_setBreakpoint-on-column-in-gcd-script.js
@@ -22,17 +22,17 @@ add_task(threadClientTest(async ({ threa
   }, client);
   Assert.equal(packet.type, "paused");
   const why = packet.why;
   Assert.equal(why.type, "breakpoint");
   Assert.equal(why.actors.length, 1);
   Assert.equal(why.actors[0], breakpointClient.actor);
   const frame = packet.frame;
   const where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
+  Assert.equal(where.actor, source.actor);
   Assert.equal(where.line, location.line);
   Assert.equal(where.column, location.column);
   const variables = frame.environment.bindings.variables;
   Assert.equal(variables.a.value, 1);
   Assert.equal(variables.b.value.type, "undefined");
   Assert.equal(variables.c.value.type, "undefined");
   await resume(threadClient);
 }, { doNotRunWorker: true }));
--- a/devtools/server/tests/unit/test_setBreakpoint-on-column.js
+++ b/devtools/server/tests/unit/test_setBreakpoint-on-column.js
@@ -18,17 +18,17 @@ add_task(threadClientTest(async ({ threa
   }, client);
   Assert.equal(packet.type, "paused");
   const why = packet.why;
   Assert.equal(why.type, "breakpoint");
   Assert.equal(why.actors.length, 1);
   Assert.equal(why.actors[0], breakpointClient.actor);
   const frame = packet.frame;
   const where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
+  Assert.equal(where.actor, source.actor);
   Assert.equal(where.line, location.line);
   Assert.equal(where.column, location.column);
   const variables = frame.environment.bindings.variables;
   Assert.equal(variables.a.value, 1);
   Assert.equal(variables.b.value.type, "undefined");
   Assert.equal(variables.c.value.type, "undefined");
 
   await resume(threadClient);
--- a/devtools/server/tests/unit/test_setBreakpoint-on-line-in-gcd-script.js
+++ b/devtools/server/tests/unit/test_setBreakpoint-on-line-in-gcd-script.js
@@ -22,16 +22,16 @@ add_task(threadClientTest(async ({ threa
   }, client);
   Assert.equal(packet.type, "paused");
   const why = packet.why;
   Assert.equal(why.type, "breakpoint");
   Assert.equal(why.actors.length, 1);
   Assert.equal(why.actors[0], breakpointClient.actor);
   const frame = packet.frame;
   const where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
+  Assert.equal(where.actor, source.actor);
   Assert.equal(where.line, location.line);
   const variables = frame.environment.bindings.variables;
   Assert.equal(variables.a.value, 1);
   Assert.equal(variables.b.value.type, "undefined");
   Assert.equal(variables.c.value.type, "undefined");
   await resume(threadClient);
 }, { doNotRunWorker: true }));
--- a/devtools/server/tests/unit/test_setBreakpoint-on-line-with-multiple-offsets.js
+++ b/devtools/server/tests/unit/test_setBreakpoint-on-line-with-multiple-offsets.js
@@ -18,30 +18,31 @@ add_task(threadClientTest(async ({ threa
   }, client);
   Assert.equal(packet.type, "paused");
   let why = packet.why;
   Assert.equal(why.type, "breakpoint");
   Assert.equal(why.actors.length, 1);
   Assert.equal(why.actors[0], breakpointClient.actor);
   let frame = packet.frame;
   let where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
+  Assert.equal(where.actor, source.actor);
   Assert.equal(where.line, location.line);
   let variables = frame.environment.bindings.variables;
   Assert.equal(variables.i.value.type, "undefined");
 
-  packet = await executeOnNextTickAndWaitForPause(function() {
-    resume(threadClient);
-  }, client);
+  packet = await executeOnNextTickAndWaitForPause(
+    () => resume(threadClient),
+    client
+  );
   Assert.equal(packet.type, "paused");
   why = packet.why;
   Assert.equal(why.type, "breakpoint");
   Assert.equal(why.actors.length, 1);
   Assert.equal(why.actors[0], breakpointClient.actor);
   frame = packet.frame;
   where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
+  Assert.equal(where.actor, source.actor);
   Assert.equal(where.line, location.line);
   variables = frame.environment.bindings.variables;
   Assert.equal(variables.i.value, 0);
 
   await resume(threadClient);
 }, { doNotRunWorker: true }));
--- a/devtools/server/tests/unit/test_setBreakpoint-on-line-with-multiple-statements.js
+++ b/devtools/server/tests/unit/test_setBreakpoint-on-line-with-multiple-statements.js
@@ -18,17 +18,17 @@ add_task(threadClientTest(async ({ threa
   }, client);
   Assert.equal(packet.type, "paused");
   const why = packet.why;
   Assert.equal(why.type, "breakpoint");
   Assert.equal(why.actors.length, 1);
   Assert.equal(why.actors[0], breakpointClient.actor);
   const frame = packet.frame;
   const where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
+  Assert.equal(where.actor, source.actor);
   Assert.equal(where.line, location.line);
   const variables = frame.environment.bindings.variables;
   Assert.equal(variables.a.value.type, "undefined");
   Assert.equal(variables.b.value.type, "undefined");
   Assert.equal(variables.c.value.type, "undefined");
 
   await resume(threadClient);
 }, { doNotRunWorker: true }));
--- a/devtools/server/tests/unit/test_setBreakpoint-on-line-with-no-offsets-in-gcd-script.js
+++ b/devtools/server/tests/unit/test_setBreakpoint-on-line-with-no-offsets-in-gcd-script.js
@@ -22,16 +22,16 @@ add_task(threadClientTest(async ({ threa
   }, client);
   Assert.equal(packet.type, "paused");
   const why = packet.why;
   Assert.equal(why.type, "breakpoint");
   Assert.equal(why.actors.length, 1);
   Assert.equal(why.actors[0], breakpointClient.actor);
   const frame = packet.frame;
   const where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
+  Assert.equal(where.actor, source.actor);
   Assert.equal(where.line, 8);
   const variables = frame.environment.bindings.variables;
   Assert.equal(variables.a.value, 1);
   Assert.equal(variables.c.value.type, "undefined");
 
   await resume(threadClient);
 }, { doNotRunWorker: true }));
--- a/devtools/server/tests/unit/test_setBreakpoint-on-line-with-no-offsets.js
+++ b/devtools/server/tests/unit/test_setBreakpoint-on-line-with-no-offsets.js
@@ -20,16 +20,16 @@ add_task(threadClientTest(async ({ threa
   }, client);
   Assert.equal(packet.type, "paused");
   const why = packet.why;
   Assert.equal(why.type, "breakpoint");
   Assert.equal(why.actors.length, 1);
   Assert.equal(why.actors[0], breakpointClient.actor);
   const frame = packet.frame;
   const where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
+  Assert.equal(where.actor, source.actor);
   Assert.equal(where.line, actualLocation.line);
   const variables = frame.environment.bindings.variables;
   Assert.equal(variables.a.value, 1);
   Assert.equal(variables.c.value.type, "undefined");
 
   await resume(threadClient);
 }, { doNotRunWorker: true }));
--- a/devtools/server/tests/unit/test_setBreakpoint-on-line.js
+++ b/devtools/server/tests/unit/test_setBreakpoint-on-line.js
@@ -18,17 +18,17 @@ add_task(threadClientTest(async ({ threa
   }, client);
   Assert.equal(packet.type, "paused");
   const why = packet.why;
   Assert.equal(why.type, "breakpoint");
   Assert.equal(why.actors.length, 1);
   Assert.equal(why.actors[0], breakpointClient.actor);
   const frame = packet.frame;
   const where = frame.where;
-  Assert.equal(where.source.actor, source.actor);
+  Assert.equal(where.actor, source.actor);
   Assert.equal(where.line, location.line);
   const variables = frame.environment.bindings.variables;
   Assert.equal(variables.a.value, 1);
   Assert.equal(variables.b.value.type, "undefined");
   Assert.equal(variables.c.value.type, "undefined");
 
   await resume(threadClient);
 }, { doNotRunWorker: true }));
--- a/devtools/server/tests/unit/test_stepping-08.js
+++ b/devtools/server/tests/unit/test_stepping-08.js
@@ -9,17 +9,20 @@
 
 add_task(threadClientTest(async ({ threadClient, debuggee, client }) => {
   dumpn("Evaluating test code and waiting for first debugger statement");
   const dbgStmt = await executeOnNextTickAndWaitForPause(
     () => evaluateTestCode(debuggee), client);
   equal(dbgStmt.frame.where.line, 3, "Should be at debugger statement on line 3");
 
   dumpn("Setting breakpoint in innerFunction");
-  const source = threadClient.source(dbgStmt.frame.where.source);
+  const source = await getSourceById(
+    threadClient,
+    dbgStmt.frame.where.actor
+  );
   await source.setBreakpoint({ line: 7 });
 
   dumpn("Step in to innerFunction");
   const step1 = await stepIn(client, threadClient);
   equal(step1.frame.where.line, 7);
 
   dumpn("Step out of innerFunction");
   const step2 = await stepOut(client, threadClient);