mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-06 20:11:38 +08:00
Test resources should act as minimal repro cases: they should be as small and simple as possible, without any unnecessary code that distracts from what’s important. This patch applies that thinking to the existing test resources, with only a few exceptions for 1) descriptive <title>s and 2) the mandatory license headers. This came up during review of [1]. [1]: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107525 Change-Id: I1081bb06129d2b6ce98daf1349d20b2bf2fd9401 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2116445 Reviewed-by: Changhao Han <changhaohan@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org>
36 lines
1020 B
HTML
36 lines
1020 B
HTML
<!--
|
|
Copyright 2020 The Chromium Authors. All rights reserved.
|
|
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>
|