OLD | NEW |
(Empty) | |
| 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> |
| 7 |
| 8 function testFunction() |
| 9 { |
| 10 console.clear(); |
| 11 debugger; |
| 12 } |
| 13 |
| 14 function runPromises(source) |
| 15 { |
| 16 Promise.reject(new Error(source + ".err1")) |
| 17 .then() |
| 18 .then() |
| 19 .then(); // Last is unhandled. |
| 20 |
| 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")); |
| 35 } |
| 36 |
| 37 function test() |
| 38 { |
| 39 InspectorTest.setQuiet(true); |
| 40 InspectorTest.startDebuggerTest(step1); |
| 41 |
| 42 function step1() |
| 43 { |
| 44 InspectorTest.addConsoleViewSniffer(addMessage, true); |
| 45 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause); |
| 46 } |
| 47 |
| 48 function didPause(callFrames, reason, breakpointIds, asyncStackTrace) |
| 49 { |
| 50 InspectorTest.evaluateInPage("runPromises('inspector')", resumeExecution
); |
| 51 } |
| 52 |
| 53 function resumeExecution() |
| 54 { |
| 55 InspectorTest.resumeExecution(); |
| 56 } |
| 57 |
| 58 var count = 0; |
| 59 function addMessage(uiMessage) |
| 60 { |
| 61 if (uiMessage.toString().indexOf("inspector.err") !== -1) |
| 62 ++count; |
| 63 if (count === 2) |
| 64 InspectorTest.expandConsoleMessages(dump); |
| 65 } |
| 66 |
| 67 function dump() |
| 68 { |
| 69 InspectorTest.dumpConsoleMessages(false, false, InspectorTest.textConten
tWithLineBreaks); |
| 70 InspectorTest.completeTest(); |
| 71 } |
| 72 } |
| 73 |
| 74 </script> |
| 75 </head> |
| 76 |
| 77 <body onload="runTest()"> |
| 78 <p> |
| 79 Tests uncaught promise rejections fired during pause. |
| 80 </p> |
| 81 |
| 82 </body> |
| 83 </html> |
OLD | NEW |