diff --git a/src/client/global.ts b/src/client/global.ts index e0a9853..8502eb9 100644 --- a/src/client/global.ts +++ b/src/client/global.ts @@ -6,13 +6,15 @@ import { indirectEval } from "./shared/eval"; export const UNSAFE_GLOBALS = [ "window", - "top", "self", "globalThis", + "this", "parent", + "top", + "location", "document", - "frames", "eval", + "frames", ]; export function createGlobalProxy( @@ -21,21 +23,17 @@ export function createGlobalProxy( ): typeof globalThis { return new Proxy(self, { get(target, prop) { - if (prop === "location") return client.locationProxy; - if (typeof prop === "string" && UNSAFE_GLOBALS.includes(prop)) - return client.wrapfn(self[prop]); - if (prop === "$scramjet") return; - if (prop === "eval") return indirectEval.bind(client); - const value = Reflect.get(target, prop); + if (typeof prop === "string" && UNSAFE_GLOBALS.includes(prop)) + return client.wrapfn(value); + return value; }, set(target, prop, value) { if (prop === "location") { client.url = value; - return; } diff --git a/src/client/shared/wrap.ts b/src/client/shared/wrap.ts index 73a305a..0e066e9 100644 --- a/src/client/shared/wrap.ts +++ b/src/client/shared/wrap.ts @@ -7,10 +7,6 @@ import { indirectEval } from "./eval"; export function createWrapFn(client: ScramjetClient, self: typeof globalThis) { return function (identifier: any, args: any) { - if (args && typeof args === "object" && args.length === 0) - for (const arg of args) { - // argdbg(arg); - } if (iswindow && identifier instanceof self.Window) { return client.globalProxy; } else if (iswindow && identifier instanceof self.parent.self.Window) {