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> |
| 6 |
| 7 var p; |
| 8 |
| 9 function createPromise() |
| 10 { |
| 11 p = Promise.reject(new Error("Handled error")); |
| 12 } |
| 13 |
| 14 function handlePromiseRejection() |
| 15 { |
| 16 p.catch(function() {}); |
| 17 } |
| 18 |
| 19 function test() |
| 20 { |
| 21 InspectorTest.consoleModel.addEventListener(WebInspector.ConsoleModel.Events
.MessageAdded, messageAdded); |
| 22 |
| 23 InspectorTest.addResult("Creating promise"); |
| 24 InspectorTest.evaluateInPageWithTimeout("createPromise()"); |
| 25 |
| 26 function messageAdded(event) |
| 27 { |
| 28 InspectorTest.addResult(""); |
| 29 InspectorTest.addResult("Message added: " + event.data.level + " " + eve
nt.data.type); |
| 30 InspectorTest.addResult("errors: " + InspectorTest.consoleModel.errors()
); |
| 31 InspectorTest.addResult("revokedErrors: " + InspectorTest.consoleModel.r
evokedErrors()); |
| 32 |
| 33 if (event.data.level === WebInspector.ConsoleMessage.MessageLevel.Error)
{ |
| 34 InspectorTest.dumpConsoleMessagesIgnoreErrorStackFrames(false, true)
; |
| 35 InspectorTest.addResult(""); |
| 36 InspectorTest.addResult("Handling promise"); |
| 37 InspectorTest.evaluateInPageWithTimeout("handlePromiseRejection()"); |
| 38 } |
| 39 |
| 40 if (event.data.level === WebInspector.ConsoleMessage.MessageLevel.Revoke
dError) { |
| 41 InspectorTest.dumpConsoleMessagesIgnoreErrorStackFrames(false, true)
; |
| 42 InspectorTest.completeTest(); |
| 43 } |
| 44 } |
| 45 } |
| 46 |
| 47 </script> |
| 48 </head> |
| 49 |
| 50 <body onload="runTest()"> |
| 51 <p>Tests that console revokes lazily handled promise rejections.</p> |
| 52 |
| 53 </body> |
| 54 </html> |
OLD | NEW |