tor-browser

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

browser_dbg-scrolling-with-search.js (1446B)


      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 // Tests that while doing a file search, if the debugger pauses
      6 // the source should scroll correctly to the paused location.
      7 
      8 "use strict";
      9 
     10 add_task(async function () {
     11  const dbg = await initDebugger("doc-scripts.html", "long.js", "simple1.js");
     12 
     13  const longSrc = findSource(dbg, "long.js");
     14  await selectSource(dbg, "long.js");
     15  await addBreakpoint(dbg, longSrc, 9);
     16 
     17  info("Searching should jump to the match");
     18  pressKey(dbg, "fileSearch");
     19  type(dbg, "candidate");
     20 
     21  await waitFor(
     22    () => getSearchSelection(dbg).text == "candidate",
     23    "Wait for actual selection in CodeMirror"
     24  );
     25  await waitForSelectedLocation(dbg, 50, 53);
     26 
     27  is(
     28    getSearchSelection(dbg).line,
     29    49,
     30    `The line of first check occurence in long.js is selected`
     31  );
     32  ok(
     33    isScrolledPositionVisible(dbg, 49),
     34    "The search selection line is visible"
     35  );
     36 
     37  info("Switch to a different source");
     38  await selectSource(dbg, "simple1.js");
     39 
     40  info("Trigger a pause which should switch back to long.js");
     41  invokeInTab("testModel");
     42 
     43  await waitForPaused(dbg, "long.js");
     44  await waitForScrolling(dbg);
     45 
     46  await assertPausedAtSourceAndLine(dbg, longSrc.id, 9);
     47  ok(isScrolledPositionVisible(dbg, 9), "The paused line is visible");
     48 });