|
Packit |
f0b94e |
/* Any copyright is dedicated to the Public Domain.
|
|
Packit |
f0b94e |
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
Packit |
f0b94e |
|
|
Packit |
f0b94e |
// Tests pending breakpoints when reloading
|
|
Packit |
f0b94e |
|
|
Packit |
f0b94e |
// Utilities for interacting with the editor
|
|
Packit |
f0b94e |
function clickGutter(dbg, line) {
|
|
Packit |
f0b94e |
clickElement(dbg, "gutter", line);
|
|
Packit |
f0b94e |
}
|
|
Packit |
f0b94e |
|
|
Packit |
f0b94e |
function getLineEl(dbg, line) {
|
|
Packit |
f0b94e |
const lines = dbg.win.document.querySelectorAll(".CodeMirror-code > div");
|
|
Packit |
f0b94e |
return lines[line - 1];
|
|
Packit |
f0b94e |
}
|
|
Packit |
f0b94e |
|
|
Packit |
f0b94e |
function addBreakpoint(dbg, line) {
|
|
Packit |
f0b94e |
clickGutter(dbg, line);
|
|
Packit |
f0b94e |
return waitForDispatch(dbg, "ADD_BREAKPOINT");
|
|
Packit |
f0b94e |
}
|
|
Packit |
f0b94e |
|
|
Packit |
f0b94e |
function assertEditorBreakpoint(dbg, line) {
|
|
Packit |
f0b94e |
const exists = !!getLineEl(dbg, line).querySelector(".new-breakpoint");
|
|
Packit |
f0b94e |
ok(exists, `Breakpoint exists on line ${line}`);
|
|
Packit |
f0b94e |
}
|
|
Packit |
f0b94e |
|
|
Packit |
f0b94e |
add_task(async function() {
|
|
Packit |
f0b94e |
requestLongerTimeout(3);
|
|
Packit |
f0b94e |
|
|
Packit |
f0b94e |
const dbg = await initDebugger("doc-scripts.html");
|
|
Packit |
f0b94e |
const { selectors: { getBreakpoints, getBreakpoint }, getState } = dbg;
|
|
Packit |
f0b94e |
const source = findSource(dbg, "simple1.js");
|
|
Packit |
f0b94e |
|
|
Packit |
f0b94e |
await selectSource(dbg, source.url);
|
|
Packit |
f0b94e |
await addBreakpoint(dbg, 5);
|
|
Packit |
f0b94e |
await addBreakpoint(dbg, 4);
|
|
Packit |
f0b94e |
|
|
Packit |
f0b94e |
const syncedBps = waitForDispatch(dbg, "SYNC_BREAKPOINT", 2);
|
|
Packit |
f0b94e |
await reload(dbg, "simple1");
|
|
Packit |
f0b94e |
await waitForSelectedSource(dbg);
|
|
Packit |
f0b94e |
await syncedBps;
|
|
Packit |
f0b94e |
|
|
Packit |
f0b94e |
assertEditorBreakpoint(dbg, 4);
|
|
Packit |
f0b94e |
assertEditorBreakpoint(dbg, 5);
|
|
Packit |
f0b94e |
});
|