summaryrefslogtreecommitdiff
path: root/Base/res/html
diff options
context:
space:
mode:
authorLuke Wilde <lukew@serenityos.org>2022-06-27 19:53:30 +0100
committerLinus Groh <mail@linusgroh.de>2022-06-29 21:21:50 +0100
commit62491cda0b9e8aa55067aa794d58a79b965f6f46 (patch)
tree3a260b6867b5f9ff31aaa7015a9ae4fb2f643293 /Base/res/html
parent1d5b03ce171df7a5a3aae3f4048ac3419e21fd74 (diff)
downloadserenity-62491cda0b9e8aa55067aa794d58a79b965f6f46.zip
LibWeb: Use CSO if running script is null in HostPromiseRejectionTracker
Diffstat (limited to 'Base/res/html')
-rw-r--r--Base/res/html/misc/unhandledpromisetest.html29
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>