blob: 7498da73c0481bea9c5bb6a4ab0dd2b280c92b7c [file] [log] [blame]
<!--
Copyright 2020 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<script type="module">
const promisePreventDefault = Promise.reject(new Error('e'));
window.onunhandledrejection = function(evt) {
console.log('onunhandledrejection1');
evt.preventDefault();
};
window.onrejectionhandled = function(evt) {
console.log('onrejectionhandled1');
setTimeout(runSecondPromiseRejection, 0);
};
setTimeout(() => {
promisePreventDefault.then(function(){}, function(){});
}, 10);
function runSecondPromiseRejection() {
const rejectedPromise = Promise.reject(new Error('e'));
window.onunhandledrejection = function(evt) {
console.log('onunhandledrejection2');
setTimeout(() => {
rejectedPromise.then(function(){}, function(){});
}, 10)
};
window.onrejectionhandled = function(evt) {
console.log('onrejectionhandled2');
};
}
</script>