de6c84cb995a3363f7406531354e6a0c023969c9
[WebKit-https.git] / LayoutTests / inspector-protocol / debugger / breakpoint-action-with-exception.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector-protocol/resources/protocol-test.js"></script>
4 <script src="resources/breakpoint.js"></script>
5 <script>
6 function test()
7 {
8     InspectorTest.eventHandler["Debugger.scriptParsed"] = function(messageObject)
9     {
10         if (/resources\/breakpoint\.js$/.test(messageObject.params.url)) {
11             InspectorTest.log("Found breakpoint.js");
12
13             var breakpoint = {
14                 location: {
15                     scriptId: messageObject.params.scriptId,
16                     lineNumber: 8,
17                     columnNumber: 0
18                 },
19                 options: {
20                     autoContinue: true,
21                     actions: [
22                         {type: "evaluate", data: "this.will.cause.exception"}
23                     ]
24                 }
25             };
26             InspectorTest.sendCommand("Debugger.setBreakpoint", breakpoint, InspectorTest.checkForError);
27             InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "all"}, InspectorTest.checkForError);
28             InspectorTest.sendCommand("Runtime.evaluate", {expression: "breakpointWithCondition(1,2)"}, function(messageObject) {
29                 InspectorTest.checkForError(messageObject);
30                 InspectorTest.log("PASS: Breakpoint action executed, but the exception did not cause the debugger to pause.")
31                 completeTest();
32             });
33         }
34     }
35
36     InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
37     {
38         InspectorTest.log("FAIL: Paused in debugger: reason = \"" + messageObject.params.reason + "\"");
39         completeTest();
40     }
41
42     function completeTest()
43     {
44         // Reset the pauseOnException state before ending the test.
45         InspectorTest.sendCommand("Debugger.setPauseOnExceptions", {state: "none"});
46         InspectorTest.completeTest();
47     }
48
49     InspectorTest.sendCommand("Debugger.enable", {});
50     InspectorTest.sendCommand("Debugger.setBreakpointsActive", {active: true}, function(messageObject) {
51         InspectorTest.checkForError(messageObject);
52         InspectorTest.log("Breakpoints Enabled");
53     });
54 }
55 </script>
56 </head>
57 <body onload="runTest()">
58 <p>The debugger should not pause on exceptions thrown while executing the breakpoint actions.</p>
59 </body>
60 </html>