Bug 1930687 - [devtools] Fix the restoring of pause on caught exception when opening DevTools. r=devtools-reviewers,nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D228686
This commit is contained in:
Alexandre Poirot 2024-11-13 09:49:32 +00:00
parent 40c90a3a09
commit e495a2afea
2 changed files with 33 additions and 2 deletions

View File

@ -61,10 +61,10 @@ function setPauseOnDebuggerStatement() {
}
function setPauseOnExceptions() {
const { pauseOnExceptions, pauseOnCaughtException } = prefs;
const { pauseOnExceptions, pauseOnCaughtExceptions } = prefs;
return firefox.clientCommands.pauseOnExceptions(
pauseOnExceptions,
pauseOnCaughtException
pauseOnCaughtExceptions
);
}

View File

@ -133,6 +133,37 @@ add_task(async function () {
await resume(dbg);
});
add_task(async function testSettingAppliedOnStartup() {
let dbg = await initDebugger("doc-exceptions.html", "exceptions.js");
await togglePauseOnExceptions(dbg, true, true);
await dbg.toolbox.closeToolbox();
// Do not use `initDebugger` as it resets all settings
const toolbox = await openNewTabAndToolbox(
EXAMPLE_URL + "doc-exceptions.html",
"jsdebugger"
);
dbg = createDebuggerContext(toolbox);
await waitForSource(dbg, "exceptions.js");
const pauseOnCaughtExceptionCheckbox = findElementWithSelector(
dbg,
".breakpoints-exceptions-caught input"
);
ok(pauseOnCaughtExceptionCheckbox.checked, "The settings is visualy enabled");
uncaughtException();
await waitForPaused(dbg);
await assertPausedAtSourceAndLine(
dbg,
findSource(dbg, "exceptions.js").id,
2
);
});
function uncaughtException() {
return invokeInTab("uncaughtException").catch(() => {});
}