Bug 1532362 - Lookup sources by actor URL instead of source URL, r=lsmyth.
☠☠ backed out by da8c06756fcc ☠ ☠
authorBrian Hackett <bhackett1024@gmail.com>
Mon, 04 Mar 2019 10:03:20 -1000
changeset 520791 a52dffe6d7beee0a0ad9dca59ab504593018d00d
parent 520790 eeeed2bd887078a1b26a3f349d9cd0558b19074e
child 520792 43963f700a1e06a01d46158177dccd3c3987c9c0
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,13 @@
+/* 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 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) {