blob: 7457bbb648b272c21fb948eb3174c9ed2404c8d0 [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
<script src="resources/breakpoint.js"></script>
<script>
// Put this here instead of on <body onload> to prevent an extra Debugger.scriptParsed event.
window.onload = runTest;
function test()
{
// This test setting 2 breakpoints in DFG compiled functions: one inlined,
// and one not inlined.
InspectorProtocol.sendCommand("Debugger.enable", {});
InspectorProtocol.sendCommand("Debugger.setBreakpointsActive", {active: true});
var dfgNonInlinedBreakpointId = null;
var dfgInlinedBreakpointId = null;
var scriptIdentifier = 0;
var startLine = 0;
InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
{
if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
ProtocolTest.log("Found breakpoint.js");
scriptIdentifier = messageObject.params.scriptId;
startLine = messageObject.params.startLine;
InspectorProtocol.sendCommand("Runtime.evaluate", {
expression: "dfgWithoutInline(); dfgWithInline();"
}, function(responseObject) {
ProtocolTest.log("dfg functions warmed up\n");
var location1 = {scriptId: scriptIdentifier, lineNumber: 22, columnNumber: 0};
InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location1}, function(responseObject) {
InspectorProtocol.checkForError(responseObject);
ProtocolTest.log("Breakpoint set in notInlineable()");
dfgNonInlinedBreakpointId = responseObject.result.breakpointId;
var location2 = {scriptId: scriptIdentifier, lineNumber: 28, columnNumber: 0};
InspectorProtocol.sendCommand("Debugger.setBreakpoint", {location: location2}, function(responseObject) {
InspectorProtocol.checkForError(responseObject);
ProtocolTest.log("Breakpoint set in inlineable()\n");
dfgInlinedBreakpointId = responseObject.result.breakpointId;
InspectorProtocol.sendCommand("Runtime.evaluate", {
expression: "dfgWithoutInline(); dfgWithInline();"
});
});
});
});
}
}
var breakpointsHit = 0;
InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
{
var breakpointId = null;
breakpointsHit++;
ProtocolTest.log("Hit Breakpoint " + breakpointsHit + "!");
if (breakpointsHit == 1)
breakpointId = dfgNonInlinedBreakpointId;
else if (breakpointsHit == 2)
breakpointId = dfgInlinedBreakpointId;
else
ProtocolTest.log("Unexpected breakpoint");
InspectorProtocol.sendCommand("Debugger.removeBreakpoint", {"breakpointId": breakpointId}, function(responseObject) {
ProtocolTest.log("Removed Breakpoint " + breakpointsHit + "!");
InspectorProtocol.sendCommand("Debugger.resume");
});
}
InspectorProtocol.eventHandler["Debugger.resumed"] = function(messageObject)
{
if (breakpointsHit < 2)
return;
ProtocolTest.assert(breakpointsHit == 2);
ProtocolTest.log("PASS");
ProtocolTest.completeTest();
}
}
</script>
</head>
<body>
<p>Debugger.setBreakpoint in DFG compiled functions.</p>
</body>
</html>