browser_dbg-breakpoint-skipping.js (2289B)
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 /* 6 * Tests toggling the skip pausing button and 7 * invoking functions without pausing. 8 */ 9 10 "use strict"; 11 12 add_task(async function () { 13 const dbg = await initDebugger("doc-scripts.html"); 14 await selectSource(dbg, "simple3.js"); 15 16 info("Adding a breakpoint should remove the skipped pausing state"); 17 await skipPausing(dbg); 18 await waitForState(dbg, () => dbg.selectors.getSkipPausing()); 19 await addBreakpointViaGutter(dbg, 2); 20 await waitForState(dbg, () => !dbg.selectors.getSkipPausing()); 21 invokeInTab("simple"); 22 await waitForPaused(dbg); 23 ok(true, "The breakpoint has been hit after a breakpoint was created"); 24 await resume(dbg); 25 26 info("Toggling off breakpoint should not remove the skipped pausing state"); 27 await skipPausing(dbg); 28 ok(dbg.selectors.getSkipPausing()); 29 await removeBreakpointViaGutter(dbg, 2); 30 ok(dbg.selectors.getSkipPausing()); 31 32 info("Toggling on breakpoint should remove the skipped pausing state"); 33 await addBreakpointViaGutter(dbg, 2); 34 await waitForState(dbg, () => !dbg.selectors.getSkipPausing()); 35 invokeInTab("simple"); 36 await waitForPaused(dbg); 37 ok(true, "The breakpoint has been hit after the breakpoint was re-enabled"); 38 await resume(dbg); 39 40 info("Disabling a breakpoint should not remove the skipped pausing state"); 41 await skipPausing(dbg); 42 await disableBreakpoint(dbg, 0); 43 ok(dbg.selectors.getSkipPausing()); 44 invokeInTab("simple"); 45 assertNotPaused(dbg); 46 47 info("Skip pausing should not be reset on page reload"); 48 await reload(dbg); 49 ok(dbg.selectors.getSkipPausing()); 50 }); 51 52 function skipPausing(dbg) { 53 clickElementWithSelector(dbg, ".command-bar-skip-pausing"); 54 return waitForState(dbg, () => dbg.selectors.getSkipPausing()); 55 } 56 57 function toggleBreakpoint(dbg, index) { 58 const breakpoints = findAllElements(dbg, "breakpointItems"); 59 const bp = breakpoints[index]; 60 const input = bp.querySelector("input"); 61 input.click(); 62 } 63 64 async function disableBreakpoint(dbg, index) { 65 const disabled = waitForDispatch(dbg.store, "SET_BREAKPOINT"); 66 toggleBreakpoint(dbg, index); 67 await disabled; 68 }