achicu@adobe.com | ff17040 | 2013-11-12 15:41:55 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
commit-queue@webkit.org | 0c88cda | 2015-08-06 21:17:03 +0000 | [diff] [blame] | 3 | <script src="../../http/tests/inspector/resources/protocol-test.js"></script> |
achicu@adobe.com | ff17040 | 2013-11-12 15:41:55 +0000 | [diff] [blame] | 4 | <script src="resources/breakpoint.js"></script> |
| 5 | <script> |
| 6 | function 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. |
| 16 | function 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 | |
| 25 | function test() |
| 26 | { |
commit-queue@webkit.org | 6a3d0dc | 2015-08-11 18:28:31 +0000 | [diff] [blame] | 27 | InspectorProtocol.eventHandler["Debugger.scriptParsed"] = function(messageObject) |
achicu@adobe.com | ff17040 | 2013-11-12 15:41:55 +0000 | [diff] [blame] | 28 | { |
| 29 | if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) { |
commit-queue@webkit.org | 6a3d0dc | 2015-08-11 18:28:31 +0000 | [diff] [blame] | 30 | ProtocolTest.log("Found breakpoint.js"); |
achicu@adobe.com | ff17040 | 2013-11-12 15:41:55 +0000 | [diff] [blame] | 31 | 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.org | 6a3d0dc | 2015-08-11 18:28:31 +0000 | [diff] [blame] | 41 | InspectorProtocol.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorProtocol.checkForError); |
| 42 | InspectorProtocol.sendCommand("Runtime.evaluate", {expression: "runBreakpointWithCondition()"}); |
achicu@adobe.com | ff17040 | 2013-11-12 15:41:55 +0000 | [diff] [blame] | 43 | } |
| 44 | } |
| 45 | |
commit-queue@webkit.org | 6a3d0dc | 2015-08-11 18:28:31 +0000 | [diff] [blame] | 46 | InspectorProtocol.eventHandler["Debugger.paused"] = function(messageObject) |
achicu@adobe.com | ff17040 | 2013-11-12 15:41:55 +0000 | [diff] [blame] | 47 | { |
commit-queue@webkit.org | 6a3d0dc | 2015-08-11 18:28:31 +0000 | [diff] [blame] | 48 | ProtocolTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\""); |
| 49 | ProtocolTest.completeTest(); |
achicu@adobe.com | ff17040 | 2013-11-12 15:41:55 +0000 | [diff] [blame] | 50 | } |
| 51 | |
commit-queue@webkit.org | 6a3d0dc | 2015-08-11 18:28:31 +0000 | [diff] [blame] | 52 | InspectorProtocol.sendCommand("Debugger.enable", {}); |
joepeck@webkit.org | 349364ee | 2016-04-15 17:18:12 +0000 | [diff] [blame] | 53 | InspectorProtocol.sendCommand("Debugger.setBreakpointsActive", {active: true}); |
achicu@adobe.com | ff17040 | 2013-11-12 15:41:55 +0000 | [diff] [blame] | 54 | } |
| 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> |