fix: proxy postmessage properly

This commit is contained in:
Percs 2024-10-17 01:30:07 -05:00
parent 51ce240bf5
commit ca79f507d7
2 changed files with 4 additions and 5 deletions

View file

@ -55,11 +55,10 @@ export default function (client: ScramjetClient) {
}; };
// * origin because obviously // * origin because obviously
ctx.args[1] = "*"; if (typeof ctx.args[1] === "string") ctx.args[1] = "*";
if (typeof ctx.args[1] === "object") ctx.args[1].targetOrigin = "*";
ctx.return( ctx.return(wrappedPostMessage.call(ctx.fn, ...ctx.args));
wrappedPostMessage.call(ctx.fn, ctx.args[0], ctx.args[1], ctx.args[2])
);
}, },
}); });

View file

@ -61,7 +61,7 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
args[0] += "&type=module"; args[0] += "&type=module";
} }
if (args[1].name === "name") { if (args[1].name) {
args[1].name = `${client.url.origin}@${args[1].name}`; args[1].name = `${client.url.origin}@${args[1].name}`;
} }
} }