| 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 worker; | |
| 8 | |
| 9 function createPromise() | |
| 10 { | |
| 11 worker = new Worker("resources/worker-with-defer-handled-promise.js"); | |
| 12 } | |
| 13 | |
| 14 function handlePromiseRejection() | |
| 15 { | |
| 16 worker.postMessage(""); | |
| 17 } | |
| 18 | |
| 19 function test() | |
| 20 { | |
| 21 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.MessageAdded, messageAdded); | |
| 22 WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleMo
del.Events.MessageUpdated, messageUpdated); | |
| 23 | |
| 24 InspectorTest.addResult("Creating worker with promise"); | |
| 25 InspectorTest.evaluateInPageWithTimeout("createPromise()"); | |
| 26 | |
| 27 function messageAdded(event) | |
| 28 { | |
| 29 InspectorTest.addResult(""); | |
| 30 InspectorTest.addResult("Message added: " + event.data.level + " " + eve
nt.data.type); | |
| 31 var counter = WebInspector.Main.WarningErrorCounter._instanceForTest; | |
| 32 for (var counter of counter._counters) | |
| 33 InspectorTest.addResult(" " + counter.title); | |
| 34 | |
| 35 if (event.data.level === WebInspector.ConsoleMessage.MessageLevel.Error)
{ | |
| 36 InspectorTest.dumpConsoleClassesBrief(); | |
| 37 InspectorTest.addResult(""); | |
| 38 InspectorTest.addResult("Handling promise"); | |
| 39 InspectorTest.evaluateInPageWithTimeout("handlePromiseRejection()"); | |
| 40 } | |
| 41 } | |
| 42 | |
| 43 function messageUpdated() | |
| 44 { | |
| 45 InspectorTest.dumpConsoleClassesBrief(); | |
| 46 InspectorTest.completeTest(); | |
| 47 } | |
| 48 } | |
| 49 | |
| 50 </script> | |
| 51 </head> | |
| 52 | |
| 53 <body onload="runTest()"> | |
| 54 <p>Tests that console revokes lazily handled promise rejections.</p> | |
| 55 | |
| 56 </body> | |
| 57 </html> | |
| OLD | NEW |