mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:07:35 +00:00
LibWeb: Use CSO if running script is null in HostPromiseRejectionTracker
This commit is contained in:
parent
1d5b03ce17
commit
62491cda0b
2 changed files with 39 additions and 13 deletions
29
Base/res/html/misc/unhandledpromisetest.html
Normal file
29
Base/res/html/misc/unhandledpromisetest.html
Normal file
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue