blob: 9e6ff3f7b4f5cb28281c38e733b67f258ed00c92 [file] [log] [blame]
achicu@adobe.comff170402013-11-12 15:41:55 +00001<html>
2<head>
commit-queue@webkit.org0c88cda2015-08-06 21:17:03 +00003<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
achicu@adobe.comff170402013-11-12 15:41:55 +00004<script src="resources/breakpoint.js"></script>
5<script>
6function runBreakpointWithCondition()
7{
8 // The debugger should hit a breakpoint inside the breakpointWithCondition call.
9 breakpointWithCondition(1, 2);
10 // If we get here it means that the debugger was disconnected and the execution continued as usual.
11 log("PASS: Test did not crash after debugger disconnected.");
12 testRunner.notifyDone();
13}
14
15// This function is called by the breakpoint condition.
16function disconnect()
17{
18 log("Closing the inspector.");
19 window.internals.closeDummyInspectorFrontend();
20 // Throwing an exception will make the debugger execute some code using a dead context.
21 // Test passes if the debugger is not crashing.
22 throw new Error();
23}
24
25function test()
26{
commit-queue@webkit.org6a3d0dc2015-08-11 18:28:31 +000027 InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject)
achicu@adobe.comff170402013-11-12 15:41:55 +000028 {
29 if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
commit-queue@webkit.org6a3d0dc2015-08-11 18:28:31 +000030 ProtocolTest.log("Found breakpoint.js");
achicu@adobe.comff170402013-11-12 15:41:55 +000031 var breakpoint = {
32 location: {
33 scriptId: messageObject.params.scriptId,
34 lineNumber: 8,
35 columnNumber: 0
36 },
37 options: {
38 condition: "disconnect()"
39 }
40 };
commit-queue@webkit.org6a3d0dc2015-08-11 18:28:31 +000041 InspectorProtocol.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorProtocol.checkForError);
42 InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "runBreakpointWithCondition()"});
achicu@adobe.comff170402013-11-12 15:41:55 +000043 }
44 }
45
commit-queue@webkit.org6a3d0dc2015-08-11 18:28:31 +000046 InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject)
achicu@adobe.comff170402013-11-12 15:41:55 +000047 {
commit-queue@webkit.org6a3d0dc2015-08-11 18:28:31 +000048 ProtocolTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
49 ProtocolTest.completeTest();
achicu@adobe.comff170402013-11-12 15:41:55 +000050 }
51
commit-queue@webkit.org6a3d0dc2015-08-11 18:28:31 +000052 InspectorProtocol.sendCommand("Debugger.enable", {});
joepeck@webkit.org349364ee2016-04-15 17:18:12 +000053 InspectorProtocol.sendCommand("Debugger.setBreakpointsActive", {active: true});
achicu@adobe.comff170402013-11-12 15:41:55 +000054}
55</script>
56</head>
57<body onload="runTest()">
58<p>Debugger.setBreakpoint with an action that throws an exception should not pause the debugger.</p>
59</body>
60</html>