tor-browser

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

browser_dbg-debug-line.js (1875B)


      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 ensures zombie debug lines do not persist
      6 // https://github.com/firefox-devtools/debugger/issues/7755
      7 
      8 "use strict";
      9 
     10 add_task(async function () {
     11  // Load test files
     12  const dbg = await initDebugger("doc-sources.html");
     13  await waitForSources(dbg, "simple1.js", "simple2.js");
     14 
     15  // Add breakpoint to debug-line-2
     16  await selectSource(dbg, "simple2.js");
     17  await addBreakpoint(dbg, "simple2.js", 5);
     18 
     19  // Trigger the breakpoint ane ensure we're paused
     20  invokeInTab("main");
     21  await waitForPaused(dbg);
     22 
     23  // Scroll element into view
     24  findElement(dbg, "frame", 2).focus();
     25 
     26  let pausedLocation = findElementWithSelector(dbg, ".paused-location");
     27  ok(
     28    pausedLocation.classList.contains("first-column"),
     29    "This paused caret is displayed as the first element in the line"
     30  );
     31 
     32  // Click the call stack to get to debugger-line-1
     33  const dispatched = waitForDispatch(dbg.store, "ADD_INLINE_PREVIEW");
     34  await clickElement(dbg, "frame", 2);
     35  await dispatched;
     36  await waitForRequestsToSettle(dbg);
     37  await waitForSelectedSource(dbg, "simple1.js");
     38  await waitForSelectedLocation(dbg, 4, 19);
     39 
     40  pausedLocation = findElementWithSelector(dbg, ".paused-location");
     41  ok(
     42    !pausedLocation.classList.contains("first-column"),
     43    "This paused caret is no longer displayed as the first element in the line"
     44  );
     45 
     46  // Resume, which ends all pausing and would trigger the problem
     47  await resume(dbg);
     48 
     49  // Select the source that had the initial debug line
     50  await selectSource(dbg, "simple2.js");
     51 
     52  info("Ensuring there's no zombie debug line");
     53  is(
     54    findAllElements(dbg, "pausedLine").length,
     55    0,
     56    "Debug line no longer exists!"
     57  );
     58 });