tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_dbg-windowless-workers-early-breakpoint.js (1564B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
      4 
      5 // Test that breakpoints at worker startup are hit when using windowless workers.
      6 
      7 "use strict";
      8 
      9 add_task(async function () {
     10  const dbg = await initDebugger(
     11    "doc-windowless-workers-early-breakpoint.html",
     12    "simple-worker.js"
     13  );
     14 
     15  const workerSource = findSource(dbg, "simple-worker.js");
     16 
     17  await selectSource(dbg, "simple-worker.js");
     18  await waitForSelectedSource(dbg, "simple-worker.js");
     19  await addBreakpoint(dbg, workerSource, 1);
     20  invokeInTab("startWorker");
     21  await waitForPaused(dbg, "simple-worker.js");
     22 
     23  // We should be paused at the first line of simple-worker.js
     24  await assertPausedAtSourceAndLine(dbg, workerSource.id, 1);
     25  // We have to remove the first breakpoint, set on the first worker.
     26  // All the workers use the same source.
     27  // The first worker is loaded on the html page load.
     28  await removeBreakpoint(dbg, workerSource.id, 1, 13);
     29  await resume(dbg);
     30 
     31  // Make sure that suspending activity in the worker when attaching does not
     32  // interfere with sending messages to the worker.
     33  await addBreakpoint(dbg, workerSource, 10);
     34  invokeInTab("startWorkerWithMessage");
     35  await waitForPaused(dbg, "simple-worker.js");
     36 
     37  // We should be paused in the message listener in simple-worker.js
     38  await assertPausedAtSourceAndLine(dbg, workerSource.id, 10);
     39  await removeBreakpoint(dbg, workerSource.id, 10, 3);
     40 });