Skip to content

Commit

Permalink
fix: proxy postmessage properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Percslol committed Oct 17, 2024
1 parent 51ce240 commit ca79f50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/client/shared/postmessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,10 @@ export default function (client: ScramjetClient) {
};

// * 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(
wrappedPostMessage.call(ctx.fn, ctx.args[0], ctx.args[1], ctx.args[2])
);
ctx.return(wrappedPostMessage.call(ctx.fn, ...ctx.args));
},
});

Expand Down
2 changes: 1 addition & 1 deletion src/client/shared/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
args[0] += "&type=module";
}

if (args[1].name === "name") {
if (args[1].name) {
args[1].name = `${client.url.origin}@${args[1].name}`;
}
}
Expand Down

0 comments on commit ca79f50

Please sign in to comment.