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 <link rel="help" href="https://html.spec.whatwg.org/#runtime-script-errors"> |
| 6 <link rel="help" href="https://html.spec.whatwg.org/#unhandled-promise-rejection
s"> |
| 7 <script> |
| 8 'use strict'; |
| 9 setup({ |
| 10 allow_uncaught_exception: true |
| 11 }); |
| 12 async_test(function(t) { |
| 13 var e = new Error('e'); |
| 14 var e2 = new Error('e2'); |
| 15 |
| 16 window.onerror = function (msg, url, line, col, error) { |
| 17 t.step(function() { |
| 18 assert_equals(msg, 'Uncaught Error: e2'); |
| 19 assert_equals(error, e2); |
| 20 }); |
| 21 t.done(); |
| 22 }; |
| 23 |
| 24 window.onrejectionhandled = function() { |
| 25 // This should cause onerror |
| 26 throw e2; |
| 27 }; |
| 28 |
| 29 var p = Promise.reject(e); |
| 30 setTimeout(t.step_func(function() { |
| 31 // This will cause onrejectionhandled |
| 32 p.catch(function() {}); |
| 33 }), 1); |
| 34 }, 'Throwing inside an unhandledrejection handler invokes the error handler.'); |
| 35 </script> |
OLD | NEW |