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:
@@ -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
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user