| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/console-test.js"></script> | 4 <script src="../../../http/tests/inspector/console-test.js"></script> |
| 5 <script src="../../../http/tests/inspector/debugger-test.js"></script> | 5 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| 6 <script> | 6 <script> |
| 7 | 7 |
| 8 function testFunction() | 8 function testFunction() |
| 9 { | 9 { |
| 10 console.clear(); | 10 console.clear(); |
| 11 debugger; | 11 debugger; |
| 12 } | 12 } |
| 13 | 13 |
| 14 function runPromises(source) | 14 function runPromises() |
| 15 { | 15 { |
| 16 Promise.reject(new Error(source + ".err1")) | 16 var reject; |
| 17 .then() | 17 var p = new Promise(function(res, rej) { |
| 18 .then() | 18 reject = rej; |
| 19 .then(); // Last is unhandled. | 19 }); |
| 20 p.catch(function p_catch() { |
| 21 throwDOMException(); |
| 22 }); |
| 23 reject(new Error("FAIL: Should not be printed to console")); |
| 24 } |
| 20 | 25 |
| 21 var reject | 26 function throwDOMException() |
| 22 var m0 = new Promise(function(res, rej) { reject = rej; }); | 27 { |
| 23 var m1 = m0.then(function() {}); | 28 var a = document.createElement("div"); |
| 24 var m2 = m0.then(function() {}); | 29 var b = document.createElement("div"); |
| 25 var m3 = m0.then(function() {}); | 30 a.removeChild(b); |
| 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 } | 31 } |
| 36 | 32 |
| 37 function runPromisesFromInspector() | 33 function runPromisesFromInspector() |
| 38 { | 34 { |
| 39 // setTimeout to cut off VM call frames from the stack trace. | 35 // setTimeout to cut off VM call frames from the stack trace. |
| 40 setTimeout(function timeout() { | 36 setTimeout(function timeout() { |
| 41 runPromises("inspector") | 37 runPromises() |
| 42 }, 0); | 38 }, 0); |
| 43 } | 39 } |
| 44 | 40 |
| 45 function test() | 41 function test() |
| 46 { | 42 { |
| 47 InspectorTest.setQuiet(true); | 43 InspectorTest.setQuiet(true); |
| 48 InspectorTest.startDebuggerTest(step1); | 44 InspectorTest.startDebuggerTest(step1); |
| 49 | 45 |
| 50 function step1() | 46 function step1() |
| 51 { | 47 { |
| 52 InspectorTest.addConsoleViewSniffer(addMessage, true); | 48 InspectorTest.addConsoleViewSniffer(addMessage, true); |
| 53 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause); | 49 InspectorTest.runTestFunctionAndWaitUntilPaused(didPause); |
| 54 } | 50 } |
| 55 | 51 |
| 56 function didPause(callFrames, reason, breakpointIds, asyncStackTrace) | 52 function didPause(callFrames, reason, breakpointIds, asyncStackTrace) |
| 57 { | 53 { |
| 58 InspectorTest.evaluateInPage("runPromisesFromInspector()", resumeExecuti
on); | 54 InspectorTest.evaluateInPage("runPromisesFromInspector()", resumeExecuti
on); |
| 59 } | 55 } |
| 60 | 56 |
| 61 function resumeExecution() | 57 function resumeExecution() |
| 62 { | 58 { |
| 63 InspectorTest.resumeExecution(); | 59 InspectorTest.resumeExecution(); |
| 64 } | 60 } |
| 65 | 61 |
| 66 var count = 0; | |
| 67 function addMessage(uiMessage) | 62 function addMessage(uiMessage) |
| 68 { | 63 { |
| 69 if (uiMessage.toString().indexOf("inspector.err") !== -1) | 64 InspectorTest.expandConsoleMessages(dump); |
| 70 ++count; | |
| 71 if (count === 2) | |
| 72 InspectorTest.expandConsoleMessages(dump); | |
| 73 } | 65 } |
| 74 | 66 |
| 75 function dump() | 67 function dump() |
| 76 { | 68 { |
| 77 InspectorTest.dumpConsoleMessages(false, false, InspectorTest.textConten
tWithLineBreaks); | 69 InspectorTest.dumpConsoleMessages(false, false, InspectorTest.textConten
tWithLineBreaks); |
| 78 InspectorTest.completeTest(); | 70 InspectorTest.completeTest(); |
| 79 } | 71 } |
| 80 } | 72 } |
| 81 | 73 |
| 82 </script> | 74 </script> |
| 83 </head> | 75 </head> |
| 84 | 76 |
| 85 <body onload="runTest()"> | 77 <body onload="runTest()"> |
| 86 <p> | 78 <p> |
| 87 Tests uncaught promise rejections fired during pause. | 79 Tests unhandled promise that was rejected with a DOM exception. |
| 88 </p> | 80 </p> |
| 89 | 81 |
| 90 </body> | 82 </body> |
| 91 </html> | 83 </html> |
| OLD | NEW |