From ac5b03736af96567a3027f98a4f6a9ba1fefc5b5 Mon Sep 17 00:00:00 2001 From: velzie Date: Mon, 26 Aug 2024 12:28:09 -0400 Subject: [PATCH] dumb regression --- src/client/dom/element.ts | 2 +- src/client/dom/open.ts | 6 ++++-- src/client/shared/wrap.ts | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/client/dom/element.ts b/src/client/dom/element.ts index a9d0523..d0ce2f8 100644 --- a/src/client/dom/element.ts +++ b/src/client/dom/element.ts @@ -124,7 +124,7 @@ export default function (client: ScramjetClient, self: typeof window) { const realwin = ctx.get() as Window; if (ScramjetClient.SCRAMJET in realwin.self) { - return realwin.self[ScramjetClient.SCRAMJET].windowProxy; + return realwin.self[ScramjetClient.SCRAMJET].globalProxy.window; } else { // hook the iframe const newclient = new ScramjetClient(realwin.self); diff --git a/src/client/dom/open.ts b/src/client/dom/open.ts index 9783dd2..7691f7e 100644 --- a/src/client/dom/open.ts +++ b/src/client/dom/open.ts @@ -14,7 +14,9 @@ export default function (client: ScramjetClient) { if (!realwin) return ctx.return(realwin); if (ScramjetClient.SCRAMJET in realwin.self) { - return ctx.return(realwin.self[ScramjetClient.SCRAMJET].windowProxy); + return ctx.return( + realwin.self[ScramjetClient.SCRAMJET].globalProxy.window + ); } else { const newclient = new ScramjetClient(realwin.self); // hook the opened window @@ -31,7 +33,7 @@ export default function (client: ScramjetClient) { const realwin = ctx.get() as Window; if (realwin && ScramjetClient.SCRAMJET in realwin.self) { - return realwin.self[ScramjetClient.SCRAMJET].windowProxy; + return realwin.self[ScramjetClient.SCRAMJET].globalProxy; } else { // the opener has to have been already hooked, so if we reach here then it's a real window return undefined; diff --git a/src/client/shared/wrap.ts b/src/client/shared/wrap.ts index c35bb8d..cb8aa9b 100644 --- a/src/client/shared/wrap.ts +++ b/src/client/shared/wrap.ts @@ -17,7 +17,7 @@ export default function (client: ScramjetClient, self: typeof globalThis) { } else if (iswindow && identifier instanceof self.parent.self.Window) { if (ScramjetClient.SCRAMJET in self.parent.self) { // ... then we're in a subframe, and the parent frame is also in a proxy context, so we should return its proxy - return self.parent.self[ScramjetClient.SCRAMJET].windowProxy; + return self.parent.self[ScramjetClient.SCRAMJET].globalProxy; } else { // ... then we should pretend we aren't nested and return the current window return client.globalProxy; @@ -37,7 +37,7 @@ export default function (client: ScramjetClient, self: typeof globalThis) { current = test; } - return current[ScramjetClient.SCRAMJET].windowProxy; + return current[ScramjetClient.SCRAMJET].globalProxy.window; } else if ( (iswindow && identifier instanceof self.Location) || (isworker && identifier instanceof self.WorkerLocation) @@ -89,7 +89,7 @@ export default function (client: ScramjetClient, self: typeof globalThis) { } } self.$scramerr = function scramerr(e) { - console.warn("CAUGHT ERROR", e); + // console.warn("CAUGHT ERROR", e); }; self.$scramdbg = function scramdbg(args, t) { @@ -102,7 +102,7 @@ export default function (client: ScramjetClient, self: typeof globalThis) { apply(ctx) { ctx.args[0] = new Proxy(ctx.args[0], { apply(target, thisArg, argArray) { - console.warn("CAUGHT PROMISE REJECTION", argArray); + // console.warn("CAUGHT PROMISE REJECTION", argArray); Reflect.apply(target, thisArg, argArray); }, });