blob: 5a59e5b85cbb768361e833b46e266da5f369a715 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script src="resources/break-on-exception-tests.js"></script>
<script>
TestPage.allowUncaughtExceptions = true;
function test()
{
WI.debuggerManager.allExceptionsBreakpoint.disabled = false;
let suite = InspectorTest.createAsyncSuite("BreakOnAnyException");
function addTestCase({name, description, expression}) {
suite.addTestCase({
name, description,
test(resolve, reject) {
InspectorTest.evaluateInPage(expression);
WI.debuggerManager.singleFireEventListener(WI.DebuggerManager.Event.Paused, (event) => {
let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
InspectorTest.expectThat(targetData.pauseReason === "exception", "Should pause for exception.");
let callFrame = WI.debuggerManager.activeCallFrame;
let name = callFrame.functionName || "<anonymous>";
let location = callFrame.sourceCodeLocation;
let line = location.lineNumber + 1;
let column = location.columnNumber + 1;
InspectorTest.log(`PAUSE AT ${name}:${line}:${column}`);
WI.debuggerManager.resume().then(resolve, reject);
});
}
});
}
addTestCase({
name: "BreakOnAnyException.UncaughtExceptionBasic",
description: "Break on an uncaught exception thrown in a function.",
expression: "setTimeout(doThrow)",
});
addTestCase({
name: "BreakOnAnyException.UncaughtExceptionInFinally",
description: "Break on an uncaught exception thrown in a finally block.",
expression: "setTimeout(testFinally)",
});
addTestCase({
name: "BreakOnAnyException.UncaughtExceptionThruNativeCode",
description: "Break on an uncaught exception thrown thru native code (Map.prototype.forEach).",
expression: "setTimeout(testThrowingThruNativeCode)",
});
addTestCase({
name: "BreakOnAnyException.CaughtException",
description: "Break on a caught exception.",
expression: `setTimeout(() => { testCatch(); })`,
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
<p>Checking pause locations when pausing on all exceptions.</p>
</body>
</html>