mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-15 23:30:00 -04:00
feat: rewrite iframe.contentWindow
This commit is contained in:
parent
506d99f9b6
commit
93db66ebc8
2 changed files with 20 additions and 4 deletions
|
@ -140,6 +140,22 @@ export default function (client: ScramjetClient, self: typeof window) {
|
|||
},
|
||||
});
|
||||
|
||||
client.Trap("HTMLIFrameElement.prototype.contentWindow", {
|
||||
get(ctx) {
|
||||
const realwin = ctx.get() as Window;
|
||||
|
||||
if (ScramjetClient.SCRAMJET in realwin.self) {
|
||||
return realwin.self[ScramjetClient.SCRAMJET].windowProxy;
|
||||
} else {
|
||||
// hook the iframe
|
||||
const newclient = new ScramjetClient(realwin.self);
|
||||
newclient.hook();
|
||||
|
||||
return newclient.windowProxy;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
for (const target of [
|
||||
self.Node.prototype,
|
||||
self.MutationObserver.prototype,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue