89 lines
3.1 KiB
HTML
89 lines
3.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
|
|
<script src="resources/break-on-exception-tests.js"></script>
|
|
<script src="resources/breakpoint-options-utilities.js"></script>
|
|
<script>
|
|
TestPage.allowUncaughtExceptions = true;
|
|
|
|
function triggerException() {
|
|
try {
|
|
throw "TestError";
|
|
} catch { }
|
|
|
|
TestPage.dispatchEventToFrontend("TestPage-exception");
|
|
}
|
|
|
|
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(); })`,
|
|
});
|
|
|
|
InspectorTest.BreakpointOptions.addTestCases(suite, {
|
|
createBreakpoint() {
|
|
WI.debuggerManager.allExceptionsBreakpoint.disabled = false;
|
|
return WI.debuggerManager.allExceptionsBreakpoint;
|
|
},
|
|
triggerBreakpoint() {
|
|
return Promise.all([
|
|
InspectorTest.evaluateInPage(`triggerException()`),
|
|
InspectorTest.awaitEvent("TestPage-exception"),
|
|
]);
|
|
},
|
|
});
|
|
|
|
suite.runTestCasesAndFinish();
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="runTest()">
|
|
<p>Checking pause locations when pausing on all exceptions.</p>
|
|
</body>
|
|
</html>
|