Bug 1532362 - Lookup sources by actor URL instead of source URL, r=lsmyth.
authorBrian Hackett <bhackett1024@gmail.com>
Thu, 07 Mar 2019 06:41:25 -1000
changeset 520798 a8c07059ab926e6c1d7ee415d8406a9ff3331878
parent 520797 289dadcfedfb819f01a33612f6dfa225c0a5ffee
child 520799 6ce854f480d62475419081de730a80166d4946f4
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsmyth
bugs1532362
milestone67.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 1532362 - Lookup sources by actor URL instead of source URL, r=lsmyth.
devtools/client/debugger/new/test/mochitest/browser.ini
devtools/client/debugger/new/test/mochitest/browser_dbg-sourceURL-breakpoint.js
devtools/client/debugger/new/test/mochitest/examples/doc-sourceURL-breakpoint.html
devtools/server/actors/utils/TabSources.js
--- a/devtools/client/debugger/new/test/mochitest/browser.ini
+++ b/devtools/client/debugger/new/test/mochitest/browser.ini
@@ -652,16 +652,17 @@ support-files =
   examples/script-switching-02.js
   examples/script-switching-01.js
   examples/times2.js
   examples/doc-windowless-workers.html
   examples/doc-windowless-workers-early-breakpoint.html
   examples/simple-worker.js
   examples/doc-event-handler.html
   examples/doc-eval-throw.html
+  examples/doc-sourceURL-breakpoint.html
 
 [browser_dbg-asm.js]
 [browser_dbg-async-stepping.js]
 [browser_dbg-sourcemapped-breakpoint-console.js]
 skip-if = (os == "win" && ccov) # Bug 1453549
 [browser_dbg-xhr-breakpoints.js]
 [browser_dbg-xhr-run-to-completion.js]
 [browser_dbg-scroll-run-to-completion.js]
@@ -769,8 +770,9 @@ skip-if = os == "win"
 [browser_dbg-react-app.js]
 skip-if = os == "win"
 [browser_dbg-wasm-sourcemaps.js]
 skip-if = true
 [browser_dbg-windowless-workers.js]
 [browser_dbg-windowless-workers-early-breakpoint.js]
 [browser_dbg-event-handler.js]
 [browser_dbg-eval-throw.js]
+[browser_dbg-sourceURL-breakpoint.js]
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-sourceURL-breakpoint.js
@@ -0,0 +1,14 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Test that breakpoints are hit in eval'ed sources with a sourceURL property.
+add_task(async function() {
+  const dbg = await initDebugger("doc-sourceURL-breakpoint.html", "my-foo.js");
+  await selectSource(dbg, "my-foo.js");
+  await addBreakpoint(dbg, "my-foo.js", 2);
+
+  invokeInTab("foo");
+  await waitForPaused(dbg);
+
+  ok(true, "paused at breakpoint");
+});
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/new/test/mochitest/examples/doc-sourceURL-breakpoint.html
@@ -0,0 +1,9 @@
+<body>
+<script>
+var script = `function foo() {
+               console.log('called foo');
+             }
+             //# sourceURL=my-foo.js`;
+eval(script);
+</script>
+</body>
--- a/devtools/server/actors/utils/TabSources.js
+++ b/devtools/server/actors/utils/TabSources.js
@@ -168,18 +168,18 @@ TabSources.prototype = {
       return this.getOrCreateSourceActor(source);
     }
     return null;
   },
 
   getSourceActorsByURL: function(url) {
     const rv = [];
     if (url) {
-      for (const [source, actor] of this._sourceActors) {
-        if (source.url === url) {
+      for (const [, actor] of this._sourceActors) {
+        if (actor.url === url) {
           rv.push(actor);
         }
       }
     }
     return rv;
   },
 
   getSourceActorById(actorId) {