Fix race condition by making window.complete() async and awaiting it

- window.complete() was fire-and-forget, causing execution-complete to arrive before console messages
- This caused sandbox to unregister before console message responses arrived
- Made complete() async and await sendRuntimeMessage()
- SandboxedIframe wrapper now awaits window.complete()
- Ensures all messages are processed before cleanup/unregister
- Fixes 30-second timeout on javascript_repl
This commit is contained in:
Mario Zechner 2025-10-09 20:31:48 +02:00
parent bb138307b1
commit 5dcb5ecc89
2 changed files with 10 additions and 14 deletions

View file

@ -339,7 +339,7 @@ export class SandboxIframe extends LitElement {
}
}
window.complete();
await window.complete();
} catch (error) {
console.error(error?.stack || error?.message || String(error));
@ -352,7 +352,7 @@ export class SandboxIframe extends LitElement {
}
}
window.complete({
await window.complete({
message: error?.message || String(error),
stack: error?.stack || new Error().stack
});