mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 06:50:01 -04:00
refactor window and document proxies
This commit is contained in:
parent
f3f1a2ed41
commit
6f51642afb
9 changed files with 99 additions and 99 deletions
|
@ -13,14 +13,14 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
|
|||
argdbg(arg);
|
||||
}
|
||||
if (iswindow && identifier instanceof self.Window) {
|
||||
return client.windowProxy;
|
||||
return client.globalProxy;
|
||||
} 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;
|
||||
} else {
|
||||
// ... then we should pretend we aren't nested and return the current window
|
||||
return client.windowProxy;
|
||||
return client.globalProxy;
|
||||
}
|
||||
} else if (iswindow && identifier instanceof self.top.self.Window) {
|
||||
// instead of returning top, we need to return the uppermost parent that's inside a scramjet context
|
||||
|
@ -46,7 +46,7 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
|
|||
} else if (iswindow && identifier instanceof self.Document) {
|
||||
return client.documentProxy;
|
||||
} else if (isworker && identifier instanceof self.WorkerGlobalScope) {
|
||||
return client.windowProxy;
|
||||
return client.globalProxy;
|
||||
}
|
||||
|
||||
return identifier;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue