Fix up context check

This commit is contained in:
Mario Zechner 2025-10-11 21:41:24 +02:00
parent 8a96741441
commit 63bfe95c18
5 changed files with 19 additions and 29 deletions

View file

@ -52,7 +52,7 @@ export class ConsoleRuntimeProvider implements SandboxRuntimeProvider {
(originalConsole as any)[method].apply(console, args);
// Send immediately and track the promise (only in extension context)
if ((window as any).__isExtensionContext?.()) {
if ((window as any).sendRuntimeMessage) {
const sendPromise = (window as any)
.sendRuntimeMessage({
type: "console",
@ -108,7 +108,7 @@ export class ConsoleRuntimeProvider implements SandboxRuntimeProvider {
const finalError = error || lastError;
if ((window as any).__isExtensionContext?.()) {
if ((window as any).sendRuntimeMessage) {
if (finalError) {
await (window as any).sendRuntimeMessage({
type: "execution-error",