69 lines
2.4 KiB
HTML
69 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
|
|
<script src="resources/exception.js"></script>
|
|
<script>
|
|
function test()
|
|
{
|
|
let expectPause = false;
|
|
let testIndex = 0;
|
|
let statementsWithUncaughtExceptions = [
|
|
"({}).a.b.c.d;",
|
|
"exceptionBasic();",
|
|
"exceptionDOM();",
|
|
"exceptionInHostFunction();",
|
|
"throwString();",
|
|
"throwParam({x:1});",
|
|
"throwParam(new Error('error message'));"
|
|
];
|
|
|
|
function triggerNextUncaughtException()
|
|
{
|
|
// Evaluate statement and expect to pause.
|
|
if (testIndex < statementsWithUncaughtExceptions.length) {
|
|
var statement = statementsWithUncaughtExceptions[testIndex++];
|
|
InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { " + statement + " }, 0);"});
|
|
return;
|
|
}
|
|
|
|
// Done evaluating statements to pause. Evaluate some more we do not expect to pause.
|
|
ProtocolTest.log("PASS - paused for each uncaught exception");
|
|
ProtocolTest.completeTest();
|
|
}
|
|
|
|
InspectorProtocol.sendCommand("Debugger.enable", {});
|
|
InspectorProtocol.sendCommand("Debugger.setBreakpointsActive", {active: true});
|
|
InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "uncaught"}, function(responseObject) {
|
|
InspectorProtocol.checkForError(responseObject);
|
|
expectPause = true;
|
|
triggerNextUncaughtException();
|
|
});
|
|
|
|
InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
|
|
{
|
|
if (!expectPause) {
|
|
ProtocolTest.log("FAIL - debugger paused when we did not expect to");
|
|
ProtocolTest.completeTest();
|
|
return;
|
|
}
|
|
|
|
ProtocolTest.log("[" + testIndex + "] Testing statement '" + statementsWithUncaughtExceptions[testIndex - 1] + "'");
|
|
ProtocolTest.log("[" + testIndex + "] Paused and about to step");
|
|
InspectorProtocol.sendCommand("Debugger.stepOver", {});
|
|
}
|
|
|
|
InspectorProtocol.eventHandler["Debugger.resumed"] = function(messageObject)
|
|
{
|
|
ProtocolTest.log("[" + testIndex + "] Resumed");
|
|
triggerNextUncaughtException();
|
|
}
|
|
}
|
|
</script>
|
|
</head>
|
|
<body onload="runTest()">
|
|
<p>Regression test for https://bugs.webkit.org/show_bug.cgi?id=133182</p>
|
|
<p>Stepping after breaking on uncaught exceptions should not crash.</p>
|
|
</body>
|
|
</html>
|