blob: 617ed623a7694b5ebd71a156e62a415c83956604 [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector-protocol/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()
{
InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
{
if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
InspectorTest.log("Found breakpoint.js");
var breakpoint = {
location: {
scriptId: messageObject.params.scriptId,
lineNumber: 8,
columnNumber: 0
},
options: {
condition: "disconnect()"
}
};
InspectorTest.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorTest.checkForError);
InspectorTest.sendCommand("Runtime.evaluate", {expression: "runBreakpointWithCondition()"});
}
}
InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
{
InspectorTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
InspectorTest.completeTest();
}
InspectorTest.sendCommand("Debugger.enable", {});
}
</script>
</head>
<body onload="runTest()">
<p>Debugger.setBreakpoint with an action that throws an exception should not pause the debugger.</p>
</body>
</html>