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_true(evt.cancelable); |
| 14 assert_equals(evt.promise, p); |
| 15 assert_equals(evt.reason, e); |
| 16 }); |
| 17 setTimeout(function() { |
| 18 var unreached = t.unreached_func('promise should not be fulfilled'); |
| 19 p.then(unreached, function(reason) { |
| 20 t.step(function() { |
| 21 assert_equals(reason, e); |
| 22 }); |
| 23 }); |
| 24 }, 10); |
| 25 evt.preventDefault(); |
| 26 }; |
| 27 |
| 28 window.onrejectionhandled = function(evt) { |
| 29 t.step(function() { |
| 30 assert_false(evt.cancelable); |
| 31 assert_equals(evt.promise, p); |
| 32 assert_equals(evt.reason, e); |
| 33 }); |
| 34 setTimeout(function() { |
| 35 if (window.internals) { |
| 36 t.step(function() { |
| 37 assert_equals(internals.consoleMessageArgumentCounts(document).length,
0); |
| 38 }); |
| 39 } |
| 40 t.done(); |
| 41 }, 10); |
| 42 }; |
| 43 }, 'evt.preventDefault() should suppress console output.'); |
| 44 </script> |
OLD | NEW |