mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 23:56:06 +00:00
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.
This commit is contained in:
parent
fb17f8ff66
commit
6a668f27c7
Notes:
github-actions[bot]
2024-11-30 11:07:17 +00:00
Author: https://github.com/shannonbooth
Commit: 6a668f27c7
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2631
9 changed files with 129 additions and 109 deletions
20
Tests/LibWeb/Text/input/HTML/ShadowRealm-rejection.html
Normal file
20
Tests/LibWeb/Text/input/HTML/ShadowRealm-rejection.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
<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>
|
Loading…
Add table
Add a link
Reference in a new issue