Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger / debugger-uncaught-promise-on-pause.html
bloba97a2bcc795dcdefcad9d2797d1e884f1a9fc3e4
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/console-test.js"></script>
5 <script src="../../../http/tests/inspector/debugger-test.js"></script>
6 <script>
8 function testFunction()
10 console.clear();
11 debugger;
14 function runPromises(source)
16 Promise.reject(new Error(source + ".err1"))
17 .then()
18 .then()
19 .then(); // Last is unhandled.
21 var reject
22 var m0 = new Promise(function(res, rej) { reject = rej; });
23 var m1 = m0.then(function() {});
24 var m2 = m0.then(function() {});
25 var m3 = m0.then(function() {});
26 var m4 = 0;
27 m0.catch(function() {
28 m2.catch(function() {
29 m1.catch(function() {
30 m4 = m3.then(function() {}); // Unhandled.
31 });
32 });
33 });
34 reject(new Error(source + ".err2"));
37 function runPromisesFromInspector()
39 // setTimeout to cut off VM call frames from the stack trace.
40 setTimeout(function timeout() {
41 runPromises("inspector")
42 }, 0);
45 function test()
47 InspectorTest.setQuiet(true);
48 InspectorTest.startDebuggerTest(step1);
50 function step1()
52 InspectorTest.addConsoleViewSniffer(addMessage, true);
53 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause);
56 function didPause(callFrames, reason, breakpointIds, asyncStackTrace)
58 InspectorTest.evaluateInPage("runPromisesFromInspector()", resumeExecution);
61 function resumeExecution()
63 InspectorTest.resumeExecution();
66 var count = 0;
67 function addMessage(uiMessage)
69 if (uiMessage.toString().indexOf("inspector.err") !== -1)
70 ++count;
71 if (count === 2)
72 InspectorTest.expandConsoleMessages(dump);
75 function dump()
77 InspectorTest.dumpConsoleMessagesIgnoreErrorStackFrames();
78 InspectorTest.completeTest();
82 </script>
83 </head>
85 <body onload="runTest()">
86 <p>
87 Tests uncaught promise rejections fired during pause.
88 </p>
90 </body>
91 </html>