blob: 9e6ff3f7b4f5cb28281c38e733b67f258ed00c92 [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
<script src="resources/breakpoint.js"></script>
<script>
function runBreakpointWithCondition()
{
// The debugger should hit a breakpoint inside the breakpointWithCondition call.
breakpointWithCondition(1, 2);
// If we get here it means that the debugger was disconnected and the execution continued as usual.
log("PASS: Test did not crash after debugger disconnected.");
testRunner.notifyDone();
}
// This function is called by the breakpoint condition.
function disconnect()
{
log("Closing the inspector.");
window.internals.closeDummyInspectorFrontend();
// Throwing an exception will make the debugger execute some code using a dead context.
// Test passes if the debugger is not crashing.
throw new Error();
}
function test()
{
InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
{
if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
ProtocolTest.log("Found breakpoint.js");
var breakpoint = {
location: {
scriptId: messageObject.params.scriptId,
lineNumber: 8,
columnNumber: 0
},
options: {
condition: "disconnect()"
}
};
InspectorProtocol.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorProtocol.checkForError);
InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "runBreakpointWithCondition()"});
}
}
InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
{
ProtocolTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
ProtocolTest.completeTest();
}
InspectorProtocol.sendCommand("Debugger.enable", {});
InspectorProtocol.sendCommand("Debugger.setBreakpointsActive", {active: true});
}
</script>
</head>
<body onload="runTest()">
<p>Debugger.setBreakpoint with an action that throws an exception should not pause the debugger.</p>
</body>
</html>