Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

  • This WPT test may be referenced by the following Test IDs:
    • /html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-attached-in-event.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
setup({
allow_uncaught_exception: true
});
async_test(function(t) {
var e = new Error('e');
var p = Promise.reject(e);
window.onunhandledrejection = function(evt) {
t.step(function() {
assert_equals(evt.promise, p);
assert_equals(evt.reason, e);
});
var unreached = t.unreached_func('promise should not be fulfilled');
p.then(unreached, function(reason) {
t.step(function() {
assert_equals(reason, e);
});
t.step_timeout(function() { t.done(); }, 10);
});
};
window.onrejectionhandled = t.unreached_func('rejectionhandled event should not be invoked');
}, 'Attaching a handler in unhandledrejection should not trigger rejectionhandled.');
</script>