rewrite _top in open target

This commit is contained in:
velzie 2024-08-02 11:53:15 -04:00
parent db573d341c
commit c5fab0b66b
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
2 changed files with 6 additions and 1 deletions

View file

@ -6,7 +6,10 @@ export default function (client: ScramjetClient) {
apply(ctx) {
if (ctx.args[0]) ctx.args[0] = encodeUrl(ctx.args[0]);
const realwin = ctx.fn.apply(this, ctx.args);
if (["_parent", "_top", "_unfencedTop"].includes(ctx.args[1]))
ctx.args[1] = "_self";
const realwin = ctx.fn.apply(ctx.this, ctx.args);
if (ScramjetClient.SCRAMJET in realwin.self) {
return ctx.return(realwin.self[ScramjetClient.SCRAMJET].windowProxy);