tor-browser

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

browser_dbg-breakpoints-duplicate-functions.js (1291B)


      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 to make sure we do not accidentally slide the breakpoint up to the first
      6 // function with the same name in the file.
      7 // TODO: Likely to remove this test when removing the breakpoint sliding functionality
      8 
      9 "use strict";
     10 
     11 add_task(async function () {
     12  const dbg = await initDebugger(
     13    "doc-duplicate-functions.html",
     14    "doc-duplicate-functions.html"
     15  );
     16  let source = findSource(dbg, "doc-duplicate-functions.html");
     17 
     18  await selectSource(dbg, source);
     19  await addBreakpoint(dbg, source, 21);
     20 
     21  await reload(dbg, "doc-duplicate-functions.html");
     22 
     23  await waitForState(dbg, () => dbg.selectors.getBreakpointCount() == 1);
     24 
     25  const firstBreakpoint = dbg.selectors.getBreakpointsList()[0];
     26  is(firstBreakpoint.location.line, 21, "Breakpoint is on line 21");
     27 
     28  // Make sure the breakpoint set on line 19 gets hit
     29  await invokeInTab("b");
     30  invokeInTab("func");
     31  await waitForPaused(dbg);
     32 
     33  source = findSource(dbg, "doc-duplicate-functions.html");
     34  await assertPausedAtSourceAndLine(dbg, source.id, 21);
     35  await assertBreakpoint(dbg, 21);
     36 
     37  await resume(dbg);
     38 });