mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibJS: Replace Array.fromAsync with a native JavaScript implementation
This allows us to use the bytecode implementation of await, which
correctly suspends execution contexts and handles completion
injections.
This gains us 4 test262 tests around mutating Array.fromAsync's
iterable whilst it's suspended as well.
This is also one step towards removing spin_until, which the
non-bytecode implementation of await uses.
```
Duration:
-5.98s
Summary:
Diff Tests:
+4 ✅ -4 ❌
Diff Tests:
[...]/Array/fromAsync/asyncitems-array-add-to-singleton.js ❌ -> ✅
[...]/Array/fromAsync/asyncitems-array-add.js ❌ -> ✅
[...]/Array/fromAsync/asyncitems-array-mutate.js ❌ -> ✅
[...]/Array/fromAsync/asyncitems-array-remove.js ❌ -> ✅
```
This commit is contained in:
parent
a63b0cfaba
commit
0eceee0a05
Notes:
github-actions[bot]
2025-11-30 10:56:04 +00:00
Author: https://github.com/Lubrsi
Commit: 0eceee0a05
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6728
Reviewed-by: https://github.com/Hendiadyoin1
Reviewed-by: https://github.com/awesomekling
15 changed files with 942 additions and 233 deletions
|
|
@ -101,4 +101,36 @@ describe("normal behavior", () => {
|
|||
|
||||
expect(counter).toBe(1);
|
||||
});
|
||||
|
||||
asyncTest("mapper exception takes priority over iterator closure exception", async () => {
|
||||
let exceptionOrder = [];
|
||||
|
||||
async function* iterator() {
|
||||
try {
|
||||
yield 1;
|
||||
yield 2;
|
||||
} finally {
|
||||
exceptionOrder.push("iterator");
|
||||
throw "iterator exception";
|
||||
}
|
||||
}
|
||||
|
||||
let exception = null;
|
||||
|
||||
try {
|
||||
await Array.fromAsync(iterator(), value => {
|
||||
if (value === 1) {
|
||||
exceptionOrder.push("mapper");
|
||||
throw "mapper exception";
|
||||
}
|
||||
|
||||
return value;
|
||||
});
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
|
||||
expect(exceptionOrder).toEqual(["mapper", "iterator"]);
|
||||
expect(exception).toBe("mapper exception");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue