Bug 1527203 Part 4 - Add test for hitting breakpoints early in a worker's execution.
authorBrian Hackett <bhackett1024@gmail.com>
Tue, 12 Feb 2019 13:06:43 -1000
changeset 519516 389de12c8724caec91d6905c7465a21ab64d3fb8
parent 519515 e5f0800182aef34737ce0793a31939ec12a47ae3
child 519517 f5580a62e4e64030319bda7dec10bff4bc1d38c2
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)
bugs1527203
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 1527203 Part 4 - Add test for hitting breakpoints early in a worker's execution.
devtools/client/debugger/new/test/mochitest/browser.ini
devtools/client/debugger/new/test/mochitest/browser_dbg-windowless-workers-early-breakpoint.js
devtools/client/debugger/new/test/mochitest/examples/doc-windowless-workers-early-breakpoint.html
devtools/client/debugger/new/test/mochitest/examples/simple-worker.js
--- a/devtools/client/debugger/new/test/mochitest/browser.ini
+++ b/devtools/client/debugger/new/test/mochitest/browser.ini
@@ -648,16 +648,17 @@ support-files =
   examples/simple3.js
   examples/frames.js
   examples/pause-points.js
   examples/script-mutate.js
   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
 
 [browser_dbg-asm.js]
 [browser_dbg-async-stepping.js]
 [browser_dbg-sourcemapped-breakpoint-console.js]
 skip-if = (os == "win" && ccov) # Bug 1453549
@@ -765,10 +766,11 @@ skip-if = os == "win"
 [browser_dbg-tabs-pretty-print.js]
 [browser_dbg-tabs-without-urls.js]
 [browser_dbg-toggling-tools.js]
 [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]
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/new/test/mochitest/browser_dbg-windowless-workers-early-breakpoint.js
@@ -0,0 +1,30 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Test that breakpoints at worker startup are hit when using windowless workers.
+add_task(async function() {
+  const dbg = await initDebugger("doc-windowless-workers-early-breakpoint.html", "simple-worker.js");
+
+  const workerSource = findSource(dbg, "simple-worker.js");
+
+  await addBreakpoint(dbg, workerSource, 1);
+  invokeInTab("startWorker");
+  await waitForPaused(dbg, "simple-worker.js");
+
+  // We should be paused at the first line of simple-worker.js
+  assertPausedAtSourceAndLine(dbg, workerSource.id, 1);
+  await removeBreakpoint(dbg, workerSource.id, 1);
+  await resume(dbg);
+
+  // Make sure that suspending activity in the worker when attaching does not
+  // interfere with sending messages to the worker.
+  await addBreakpoint(dbg, workerSource, 10);
+  invokeInTab("startWorkerWithMessage");
+  await waitForPaused(dbg, "simple-worker.js");
+
+  // We should be paused in the message listener in simple-worker.js
+  assertPausedAtSourceAndLine(dbg, workerSource.id, 10);
+  await removeBreakpoint(dbg, workerSource.id, 10);
+});
new file mode 100644
--- /dev/null
+++ b/devtools/client/debugger/new/test/mochitest/examples/doc-windowless-workers-early-breakpoint.html
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+
+<script>
+startWorker();
+
+function startWorker() {
+  new Worker("simple-worker.js");
+}
+function startWorkerWithMessage() {
+  var w = new Worker("simple-worker.js");
+  w.postMessage({yo: 'yo'})
+}
+</script>
+
+<body>
+Hello World!
+</body>
+</html>
--- a/devtools/client/debugger/new/test/mochitest/examples/simple-worker.js
+++ b/devtools/client/debugger/new/test/mochitest/examples/simple-worker.js
@@ -3,9 +3,9 @@ function timer() {
   var n = ++count;
   console.log("WORKER SAYS HELLO! " + n);
 }
 
 setInterval(timer, 1000);
 
 self.onmessage = () => {
   console.log('hi')
-}
\ No newline at end of file
+}