/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ /** * Make sure that pausing on exceptions works. */ const TAB_URL = EXAMPLE_URL + "doc_pause-exceptions.html"; var gTab, gPanel, gDebugger; var gFrames, gVariables, gPrefs, gOptions; function test() { requestLongerTimeout(2); let options = { source: TAB_URL, line: 1 }; initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { gTab = aTab; gPanel = aPanel; gDebugger = gPanel.panelWin; gFrames = gDebugger.DebuggerView.StackFrames; gVariables = gDebugger.DebuggerView.Variables; gPrefs = gDebugger.Prefs; gOptions = gDebugger.DebuggerView.Options; is(gPrefs.pauseOnExceptions, false, "The pause-on-exceptions pref should be disabled by default."); isnot(gOptions._pauseOnExceptionsItem.getAttribute("checked"), "true", "The pause-on-exceptions menu item should not be checked."); testPauseOnExceptionsDisabled() .then(enablePauseOnExceptions) .then(disableIgnoreCaughtExceptions) .then(testPauseOnExceptionsEnabled) .then(disablePauseOnExceptions) .then(enableIgnoreCaughtExceptions) .then(() => closeDebuggerAndFinish(gPanel)) .then(null, aError => { ok(false, "Got an error: " + aError.message + "\n" + aError.stack); }); }); } function testPauseOnExceptionsDisabled() { let finished = waitForCaretAndScopes(gPanel, 26).then(() => { info("Testing disabled pause-on-exceptions."); is(gDebugger.gThreadClient.state, "paused", "Should only be getting stack frames while paused (1)."); ok(isCaretPos(gPanel, 26), "Should be paused on the debugger statement (1)."); let innerScope = gVariables.getScopeAtIndex(0); let innerNodes = innerScope.target.querySelector(".variables-view-element-details").childNodes; is(gFrames.itemCount, 1, "Should have one frame."); is(gVariables._store.length, 4, "Should have four scopes."); is(innerNodes[0].querySelector(".name").getAttribute("value"), "this", "Should have the right property name for 'this'."); is(innerNodes[0].querySelector(".value").getAttribute("value"), "