3 <script src=
"../../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../../../http/tests/inspector/debugger-test.js"></script>
7 function createPromise()
10 var p
= new Promise(function(resolve
, reject
) {
11 result
.resolve
= resolve
;
12 result
.reject
= reject
;
18 function testFunction()
20 var resolved
= createPromise();
21 var caught
= createPromise();
22 var uncaught
= createPromise();
25 .then(function c1() {})
26 .then(function c2() {})
27 .catch(function c3() {});
29 .then(function f1() {})
30 .then(function f2() {})
31 .then(function f3() {}); // Last is uncaught.
33 resolved
.resolve(42); // Should not pause.
34 caught
.reject(new Error("caught"));
35 uncaught
.reject(new Error("uncaught"));
40 InspectorTest
.setQuiet(true);
41 InspectorTest
.startDebuggerTest(step1
);
43 function waitUntilPausedNTimes(count
, callback
)
48 InspectorTest
.waitUntilPausedAndDumpStackAndResume(inner
);
57 InspectorTest
.DebuggerAgent
.setPauseOnExceptions(WebInspector
.DebuggerModel
.PauseOnExceptionsState
.PauseOnUncaughtExceptions
);
58 InspectorTest
.showScriptSource("debugger-pause-on-promise-rejection.html", step2
);
63 InspectorTest
.addResult("=== Pausing only on uncaught exceptions ===");
64 InspectorTest
.runTestFunction();
65 waitUntilPausedNTimes(1, step3
);
70 InspectorTest
.DebuggerAgent
.setPauseOnExceptions(WebInspector
.DebuggerModel
.PauseOnExceptionsState
.PauseOnAllExceptions
);
71 InspectorTest
.addResult("\n=== Pausing on all exceptions ===");
72 InspectorTest
.runTestFunction();
73 waitUntilPausedNTimes(2, step4
);
78 InspectorTest
.DebuggerAgent
.setPauseOnExceptions(WebInspector
.DebuggerModel
.PauseOnExceptionsState
.DontPauseOnExceptions
);
79 InspectorTest
.completeDebuggerTest();
86 <body onload=
"runTest()">
88 Tests that pause on promise rejection works.