tor-browser

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

browser_dbg-preview-multiple-threads.js (1513B)


      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 previewing variables with the same name in different threads (Bug 1954182)
      6 
      7 "use strict";
      8 
      9 add_task(async function () {
     10  const dbg = await initDebugger("doc-preview-multiple-threads.html");
     11 
     12  invokeInTab("fn1");
     13  await waitForPaused(dbg);
     14  info("Preview data in the first worker");
     15  await assertPreviews(dbg, [
     16    {
     17      line: 1,
     18      column: 16,
     19      header: "Object",
     20      fields: [["prop", "true"]],
     21      expression: "data",
     22    },
     23  ]);
     24 
     25  // find the currently paused thread
     26  const allThreads = [...findAllElements(dbg, "threadsPaneItems")];
     27  const firstWorkerThreadIndex = allThreads.findIndex(thread =>
     28    thread.classList.contains("paused")
     29  );
     30 
     31  info("Preview data in the second worker");
     32  invokeInTab("fn2");
     33  await waitForSelectedLocation(dbg, 5);
     34  await assertPreviews(dbg, [
     35    {
     36      line: 1,
     37      column: 16,
     38      header: "Object",
     39      fields: [["prop", "false"]],
     40      expression: "data",
     41    },
     42  ]);
     43 
     44  info("Switch back to the first worker thread and preview data again");
     45  clickElement(dbg, "threadsPaneItem", firstWorkerThreadIndex + 1);
     46  await waitForSelectedLocation(dbg, 3);
     47  await assertPreviews(dbg, [
     48    {
     49      line: 1,
     50      column: 16,
     51      header: "Object",
     52      fields: [["prop", "true"]],
     53      expression: "data",
     54    },
     55  ]);
     56 });