tor-browser

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

browser_dbg-pause-ux.js (1757B)


      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 "use strict";
      6 
      7 add_task(async function () {
      8  const dbg = await initDebugger("doc-scripts.html");
      9 
     10  // Make sure that we can set a breakpoint on a line out of the
     11  // viewport, and that pausing there scrolls the editor to it.
     12  const longSrc = findSource(dbg, "long.js");
     13  await selectSource(dbg, "long.js");
     14  await addBreakpoint(dbg, longSrc, 66);
     15  invokeInTab("testModel");
     16  await waitForPaused(dbg, "long.js");
     17  // Some spurious scroll may happen late related to text content
     18  await waitForScrolling(dbg);
     19 
     20  ok(isScrolledPositionVisible(dbg, 66), "The paused line is visible");
     21 
     22  info("1. adding a breakpoint should not scroll the editor");
     23  await scrollEditorIntoView(dbg, 1, 0);
     24  await addBreakpoint(dbg, longSrc, 11);
     25  ok(isScrolledPositionVisible(dbg, 1), "scroll position");
     26 
     27  info("2. searching should jump to the match");
     28  pressKey(dbg, "fileSearch");
     29  type(dbg, "check");
     30 
     31  await waitFor(
     32    () => getSearchSelection(dbg).text == "check",
     33    "Wait for actual selection in CodeMirror"
     34  );
     35  is(
     36    getSearchSelection(dbg).line,
     37    26,
     38    "The line of first check occurence in long.js is selected (this is one-based)"
     39  );
     40  // The column is the end of "check", so after 'k'
     41  is(
     42    getSearchSelection(dbg).column,
     43    51,
     44    "The column of first check occurence in long.js is selected (this is zero-based)"
     45  );
     46 
     47  ok(
     48    !isScrolledPositionVisible(dbg, 66),
     49    "The paused line is no longer visible"
     50  );
     51  ok(
     52    isScrolledPositionVisible(dbg, 26),
     53    "The line with the text match is now visible"
     54  );
     55 });