mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 06:50:01 -04:00
fix: only check for scramjetclient if win exists
This commit is contained in:
parent
1b509b2c8a
commit
4ea3e74fb6
1 changed files with 12 additions and 10 deletions
|
@ -36,20 +36,22 @@ export function createGlobalProxy(
|
||||||
const win: Self = value.self;
|
const win: Self = value.self;
|
||||||
// indexing into window gives you the contentWindow of the subframes for some reason
|
// indexing into window gives you the contentWindow of the subframes for some reason
|
||||||
// you can't *set* it so this should always be the right value
|
// you can't *set* it so this should always be the right value
|
||||||
if (SCRAMJETCLIENT in win) {
|
if (win) {
|
||||||
// then we've already hooked this frame and we can just send over its proxy
|
if (SCRAMJETCLIENT in win) {
|
||||||
return win[SCRAMJETCLIENT].globalProxy;
|
// then we've already hooked this frame and we can just send over its proxy
|
||||||
} else {
|
return win[SCRAMJETCLIENT].globalProxy;
|
||||||
// this can happen if it's an about:blank iframe that we've never gotten the chance to inject into
|
} else {
|
||||||
// just make a new client for it and inject
|
// this can happen if it's an about:blank iframe that we've never gotten the chance to inject into
|
||||||
const newclient = new ScramjetClient(win);
|
// just make a new client for it and inject
|
||||||
newclient.hook();
|
const newclient = new ScramjetClient(win);
|
||||||
|
newclient.hook();
|
||||||
|
|
||||||
return newclient.globalProxy;
|
return newclient.globalProxy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prop === "$scramjet") return null;
|
if (prop === "$scramjet") return undefined;
|
||||||
|
|
||||||
if (typeof prop === "string" && UNSAFE_GLOBALS.includes(prop))
|
if (typeof prop === "string" && UNSAFE_GLOBALS.includes(prop))
|
||||||
return client.wrapfn(value);
|
return client.wrapfn(value);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue