OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../inspector/inspector-test.js"></script> |
| 4 <script src="../inspector/console-test.js"></script> |
| 5 <script> |
| 6 if (window.testRunner) { |
| 7 testRunner.waitUntilDone(); |
| 8 testRunner.dumpAsText(); |
| 9 } |
| 10 |
| 11 function setupPromise1() |
| 12 { |
| 13 var p = Promise.reject(new Error('e')); |
| 14 window.onunhandledrejection = function(evt) { |
| 15 console.log("onunhandledrejection1"); |
| 16 evt.preventDefault(); |
| 17 setTimeout(function() { |
| 18 p.then(function(){}, function(){}); |
| 19 }, 10); |
| 20 }; |
| 21 window.onrejectionhandled = function(evt) { |
| 22 console.log("onrejectionhandled1"); |
| 23 setTimeout(setupPromise2, 0); |
| 24 }; |
| 25 } |
| 26 |
| 27 function setupPromise2() |
| 28 { |
| 29 var p = Promise.reject(new Error('e')); |
| 30 window.onunhandledrejection = function(evt) { |
| 31 console.log("onunhandledrejection2"); |
| 32 setTimeout(function() { |
| 33 p.then(function(){}, function(){}); |
| 34 }, 10); |
| 35 }; |
| 36 window.onrejectionhandled = function(evt) { |
| 37 console.log("onrejectionhandled2"); |
| 38 setTimeout(startTest, 0); |
| 39 }; |
| 40 function startTest() |
| 41 { |
| 42 if (window.testRunner) |
| 43 testRunner.showWebInspector(); |
| 44 runTest(); |
| 45 } |
| 46 } |
| 47 |
| 48 function test() |
| 49 { |
| 50 InspectorTest.expandConsoleMessages(); |
| 51 InspectorTest.addResult("----console messages start----"); |
| 52 InspectorTest.dumpConsoleMessages(); |
| 53 InspectorTest.addResult("----console messages end----"); |
| 54 InspectorTest.completeTest(); |
| 55 } |
| 56 </script> |
| 57 </head> |
| 58 <body onload="setupPromise1()"> |
| 59 <p> |
| 60 Tests that evt.preventDefault() in window.onunhandledrejection suppresses consol
e output. |
| 61 </p> |
| 62 </body> |
| 63 </html> |
OLD | NEW |