tor-browser

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

browser_dbg-blackbox-original.js (1519B)


      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 // This source map does not have source contents, so it's fetched separately
      6 
      7 "use strict";
      8 
      9 add_task(async function () {
     10  await pushPref("devtools.debugger.map-scopes-enabled", true);
     11  // NOTE: the CORS call makes the test run times inconsistent
     12  const dbg = await initDebugger(
     13    "doc-sourcemaps3.html",
     14    "bundle.js",
     15    "sorted.js",
     16    "test.js"
     17  );
     18 
     19  const sortedSrc = findSource(dbg, "sorted.js");
     20  await selectSource(dbg, sortedSrc);
     21  await clickElement(dbg, "blackbox");
     22  await waitForDispatch(dbg.store, "BLACKBOX_WHOLE_SOURCES");
     23 
     24  const sourceTab = findElementWithSelector(dbg, ".source-tab.active");
     25  ok(
     26    sourceTab.querySelector(".dbg-img-blackBox"),
     27    "Source tab has a blackbox icon"
     28  );
     29 
     30  const treeItem = findElementWithSelector(dbg, ".tree-node.focused");
     31  ok(
     32    treeItem.querySelector(".dbg-img-blackBox"),
     33    "Source tree item has a blackbox icon"
     34  );
     35 
     36  // breakpoint at line 38 in sorted
     37  await addBreakpoint(dbg, sortedSrc, 38);
     38  // invoke test
     39  invokeInTab("test");
     40  // should not pause
     41  assertNotPaused(dbg);
     42 
     43  // unblackbox
     44  await clickElement(dbg, "blackbox");
     45  await waitForDispatch(dbg.store, "UNBLACKBOX_WHOLE_SOURCES");
     46 
     47  // click on test
     48  invokeInTab("test");
     49  // should pause
     50  await waitForPaused(dbg);
     51 
     52  ok(true, "blackbox works");
     53 });