blob: 285d7cc74e730695a2c744f983a1e3fd7278f371 [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
<script src="resources/exception.js"></script>
<script>
function test()
{
function testFunction() {
// This function runs in the second inspector window. We can use this one to debug the first inspector.
InspectorProtocol.sendCommand("Debugger.enable", {});
InspectorProtocol.sendCommand("Debugger.setBreakpointsActive", {active: true});
InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, function(responseObject) {
InspectorProtocol.checkForError(responseObject);
ProtocolTest.log("Debugger.setPauseOnExceptions - all");
// Trigger an exception in the main inspector.
InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "setTimeout(function() { throw new Error('PASS: Expected exception') }, 0);"});
});
InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
{
ProtocolTest.log("PASS: Paused!");
InspectorProtocol.sendCommand("Debugger.resume", {});
}
InspectorProtocol.eventHandler["Debugger.resumed"] = function(messageObject)
{
ProtocolTest.log("PASS: Resumed!");
// Revert Debugger.setPauseOnExceptions as it can have an impact on the following tests.
InspectorProtocol.sendCommand("Debugger.setPauseOnExceptions", {state: "none"}, function(responseObject) {
ProtocolTest.completeTest();
});
}
};
window.log = ProtocolTest.log.bind(InspectorProtocol);
window.closeTest = function()
{
window.internals.closeDummyInspectorFrontend();
ProtocolTest.completeTest();
}
var secondInspectorFrontend = window.internals.openDummyInspectorFrontend("InspectorProtocolStub.html");
secondInspectorFrontend.addEventListener("load", function(event) {
secondInspectorFrontend.postMessage("(" + testFunction.toString() +")();", "*");
});
}
</script>
</head>
<body onload="runTest()">
<p>Checking that the inspector code can be debugged using a second inspector window.</p>
</body>
</html>