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