ladybird/Tests/LibWeb/Text/input/HTML/ShadowRealm-rejection.html
Shannon Booth 6a668f27c7 LibWeb: Push promise rejection handling onto UniversalGlobalScopeMixin
This is needed for shadow realms which don't have a window or worker
global object. Fixes a crash for the attached test.
2024-11-30 11:55:11 +01:00

20 lines
530 B
HTML

<script src="../include.js"></script>
<script>
asyncTest(async done => {
const shadowRealm = new ShadowRealm();
try {
const result = await new Promise(shadowRealm.evaluate(`
(resolve, reject) => {
(async () => {
throw new Error('An error!');
})().then(resolve, (e) => reject(e.toString()));
}
`));
} catch (e) {
println(e);
}
done();
});
</script>