OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> |
| 3 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> |
| 5 <script> |
| 6 'use strict'; |
| 7 async_test(function(t) { |
| 8 var e = new Error('e'); |
| 9 var p = Promise.reject(e); |
| 10 |
| 11 window.onunhandledrejection = function(evt) { |
| 12 t.step(function() { |
| 13 assert_equals(evt.promise, p); |
| 14 assert_equals(evt.reason, e); |
| 15 }); |
| 16 setTimeout(function() { |
| 17 var unreached = t.unreached_func('promise should not be fulfilled'); |
| 18 p.then(unreached, function(reason) { |
| 19 t.step(function() { |
| 20 assert_equals(reason, e); |
| 21 }); |
| 22 }); |
| 23 }, 10); |
| 24 evt.preventDefault(); |
| 25 }; |
| 26 |
| 27 window.onrejectionhandled = function(evt) { |
| 28 t.step(function() { |
| 29 assert_equals(evt.promise, p); |
| 30 assert_equals(evt.reason, e); |
| 31 }); |
| 32 setTimeout(function() { |
| 33 if (window.internals) { |
| 34 t.step(function() { |
| 35 assert_equals(internals.consoleMessageArgumentCounts(document).length,
0); |
| 36 }); |
| 37 } |
| 38 t.done(); |
| 39 }, 10); |
| 40 }; |
| 41 }, 'evt.preventDefault() should suppress console output.'); |
| 42 </script> |
OLD | NEW |