finally blocks should not set the exception stack trace when re-throwing the exception.
[WebKit-https.git] / LayoutTests / inspector / debugger / break-on-uncaught-exception-window-onerror.html
1 <!doctype html>
2 <html>
3 <head>
4 <script type="text/javascript" src="../../http/tests/inspector/inspector-test.js"></script>
5 <script type="text/javascript" src="./resources/break-on-exception-tests.js"></script>
6 <script>
7 window.onerror = function(e) {
8     console.log("window.onerror: " + e);
9     console.log("DONE");
10 }
11
12 function test() {
13     function doExceptionTest(testName, exceptionBreakType, resumeAction)
14     {
15         var pauses = 0;
16         var index = 0;
17
18         function runTestCase(test) {
19             InspectorTest.evaluateInPage("setTimeout(" + test + ", 50)");
20         }
21
22         WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, function(event) {
23             var scriptObject = event.data.script;
24             if (!/break-on-exception-tests\.js$/.test(scriptObject.url))
25                 return;
26
27             if (exceptionBreakType == 'AllExceptions')
28                 WebInspector.debuggerManager.allExceptionsBreakpoint.disabled = false;
29             else
30                 WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint.disabled = false;
31
32             runTestCase(testName);
33         });
34
35         WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange, function(event) {
36             var callFrame = WebInspector.debuggerManager.activeCallFrame;
37             if (callFrame) {
38                 // Pausing.
39                 InspectorTest.assert(WebInspector.debuggerManager.pauseReason == "exception");
40
41                 var funcName = callFrame.functionName || "<anonymous>";
42                 var location = callFrame.sourceCodeLocation;
43                 var line = location.lineNumber + 1;
44                 var column = location.columnNumber + 1;
45
46                 InspectorTest.log("PAUSE #" + (++pauses) + " AT: " + funcName + ":" + line + ":" + column);
47                 WebInspector.debuggerManager.resume();
48
49             } else {
50                 // Resuming.
51                 if (resumeAction == 'FinishOnResume')
52                     InspectorTest.completeTest();
53             }
54         });
55
56         // This is a signal mechanism for the web process to tell us that the test is done.
57         // The web process fires the signal by doing console.log("DONE").
58         WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded, function(event) {
59             var message = event.data.message;
60             if (!message.parameters || message.parameters.length !== 1)
61                 return;
62             if (message.parameters[0].type !== "string" || message.parameters[0].description !== "DONE")
63                 return;
64             InspectorTest.completeTest();
65         });
66
67         InspectorTest.reloadPage();
68     }
69
70     doExceptionTest('doThrow', 'UncaughtExceptions', 'IgnoreResume');
71 }
72 </script>
73 </head>
74 <body onload="runTest()">
75     <p>Checking pause locations when pausing on uncaught exceptions.</p>
76 </body>
77 </html>