diff --git a/devtools/client/debugger/src/main.js b/devtools/client/debugger/src/main.js index 033f8e38327c..66bd5afddb43 100644 --- a/devtools/client/debugger/src/main.js +++ b/devtools/client/debugger/src/main.js @@ -61,10 +61,10 @@ function setPauseOnDebuggerStatement() { } function setPauseOnExceptions() { - const { pauseOnExceptions, pauseOnCaughtException } = prefs; + const { pauseOnExceptions, pauseOnCaughtExceptions } = prefs; return firefox.clientCommands.pauseOnExceptions( pauseOnExceptions, - pauseOnCaughtException + pauseOnCaughtExceptions ); } diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-pause-exceptions.js b/devtools/client/debugger/test/mochitest/browser_dbg-pause-exceptions.js index 18193bba5745..ffc1bdea28b2 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg-pause-exceptions.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg-pause-exceptions.js @@ -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(() => {}); }