mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-14 15:00:01 -04:00
fix: cross origin isolated responseheaders on blobs
This commit is contained in:
parent
0dc93d6f62
commit
6e1733fd06
1 changed files with 8 additions and 16 deletions
|
@ -51,20 +51,8 @@ export async function swfetch(
|
||||||
requesturl.pathname.startsWith(this.config.prefix + "blob:") ||
|
requesturl.pathname.startsWith(this.config.prefix + "blob:") ||
|
||||||
requesturl.pathname.startsWith(this.config.prefix + "data:")
|
requesturl.pathname.startsWith(this.config.prefix + "data:")
|
||||||
) {
|
) {
|
||||||
let response: Response = await fetch(
|
const response: Response = await fetch(
|
||||||
requesturl.pathname.substring(this.config.prefix.length),
|
requesturl.pathname.substring(this.config.prefix.length)
|
||||||
{
|
|
||||||
// this is extremely redundant but i don't care
|
|
||||||
// method: request.method,
|
|
||||||
// body: request.body,
|
|
||||||
// headers: request.headers,
|
|
||||||
// credentials: "omit",
|
|
||||||
// mode: request.mode === "cors" ? request.mode : "same-origin",
|
|
||||||
// cache: request.cache,
|
|
||||||
// redirect: "manual",
|
|
||||||
// //@ts-ignore
|
|
||||||
// duplex: "half",
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
let body: BodyType;
|
let body: BodyType;
|
||||||
|
@ -81,8 +69,12 @@ export async function swfetch(
|
||||||
this.cookieStore
|
this.cookieStore
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let headers = Object.fromEntries(response.headers.entries());
|
const headers = Object.fromEntries(response.headers.entries());
|
||||||
headers["Cross-Origin-Embedder-Policy"] = "require-corp";
|
|
||||||
|
if (crossOriginIsolated) {
|
||||||
|
headers["Cross-Origin-Opener-Policy"] = "same-origin";
|
||||||
|
headers["Cross-Origin-Embedder-Policy"] = "require-corp";
|
||||||
|
}
|
||||||
|
|
||||||
return new Response(body, {
|
return new Response(body, {
|
||||||
status: response.status,
|
status: response.status,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue