mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
The AsyncIteratorClose bytecode op calls async_iterator_close() which uses synchronous await() internally. This spins the event loop while execution contexts are on the stack, violating the microtask checkpoint assertion in LibWeb. Replace AsyncIteratorClose op emissions in for-await-of close handlers with inline bytecode that uses the proper Await op, allowing the async function to yield and resume naturally through the event loop. For the non-throw path (break/return/continue-to-outer): emit GetMethod, Call, Await, and ThrowIfNotObject inline. For the throw path: wrap the close steps in an exception handler so that any error from GetMethod/Call/Await is discarded and the original exception is rethrown, per spec step 5.
21 lines
345 B
JavaScript
21 lines
345 B
JavaScript
function forOfBreak() {
|
|
for (const x of [1, 2, 3]) {
|
|
if (x === 2) break;
|
|
}
|
|
}
|
|
forOfBreak();
|
|
|
|
function forOfReturn() {
|
|
for (const x of [1, 2, 3]) {
|
|
return x;
|
|
}
|
|
}
|
|
forOfReturn();
|
|
|
|
async function forAwaitOfBreak(iter) {
|
|
for await (const x of iter) {
|
|
if (x === 2) break;
|
|
}
|
|
}
|
|
forAwaitOfBreak([1, 2, 3]);
|