diff options
Diffstat (limited to 'Base/res')
-rw-r--r-- | Base/res/html/misc/unhandledpromisetest.html | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Base/res/html/misc/unhandledpromisetest.html b/Base/res/html/misc/unhandledpromisetest.html new file mode 100644 index 0000000000..3838ff17dc --- /dev/null +++ b/Base/res/html/misc/unhandledpromisetest.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<html> +<head> + <title>Unhandled Promise rejection with no [[ScriptOrModule]] for the current execution context</title> +</head> +<body> + <button onclick=" + Promise.reject(new Error('Success!')); + window.timer = setTimeout(() => { + const element = document.createElement('p'); + element.innerText = 'Did not receieve unhandledrejection event in 100ms.'; + element.style.color = 'red'; + document.body.appendChild(element); + }, 100) + "> + Click me to cause an unhandled promise rejection. + </button> + + <script> + window.onunhandledrejection = (rejectionEvent) => { + clearTimeout(window.timer); + const element = document.createElement("p"); + element.innerText = rejectionEvent.reason.message; + element.style.color = "green"; + document.body.appendChild(element); + } + </script> +</body> +</html> |