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>
8 function testFunction()
14 function runPromises(source
)
16 Promise
.reject(new Error(source
+ ".err1"))
19 .then(); // Last is unhandled.
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() {});
30 m4
= m3
.then(function() {}); // Unhandled.
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")
47 InspectorTest
.setQuiet(true);
48 InspectorTest
.startDebuggerTest(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();
67 function addMessage(uiMessage
)
69 if (uiMessage
.toString().indexOf("inspector.err") !== -1)
72 InspectorTest
.expandConsoleMessages(dump
);
77 InspectorTest
.dumpConsoleMessagesIgnoreErrorStackFrames();
78 InspectorTest
.completeTest();
85 <body onload=
"runTest()">
87 Tests uncaught promise rejections fired during pause.