Skip to content

Commit 78c5abb

Browse files
authored
Release 11.30.2023 WCT v8 + Labs Update (#1)
* WCT v8 + Labs Update * Release 11.30.2023 Built from: CommunityToolkit/Windows@bef863c CommunityToolkit/Labs-Windows@6f640e6
1 parent d93b21b commit 78c5abb

2,167 files changed

Lines changed: 42107 additions & 22388 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

SharedArrayBufferServiceWorker.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// From https://dev.to/stefnotch/enabling-coop-coep-without-touching-the-server-2d3n
2+
3+
self.addEventListener("install", function () {
4+
self.skipWaiting();
5+
});
6+
7+
self.addEventListener("activate", (event) => {
8+
event.waitUntil(self.clients.claim());
9+
});
10+
11+
self.addEventListener("fetch", function (event) {
12+
if (event.request.cache === "only-if-cached" && event.request.mode !== "same-origin") {
13+
return;
14+
}
15+
16+
event.respondWith(
17+
fetch(event.request)
18+
.then(function (response) {
19+
// It seems like we only need to set the headers for index.html
20+
// If you want to be on the safe side, comment this out
21+
// if (!response.url.includes("index.html")) return response;
22+
23+
const newHeaders = new Headers(response.headers);
24+
newHeaders.set("Cross-Origin-Embedder-Policy", "credentialless");
25+
newHeaders.set("Cross-Origin-Opener-Policy", "same-origin");
26+
27+
const moddedResponse = new Response(response.body, {
28+
status: response.status,
29+
statusText: response.statusText,
30+
headers: newHeaders,
31+
});
32+
33+
return moddedResponse;
34+
})
35+
.catch(function (e) {
36+
console.error(e);
37+
})
38+
);
39+
});
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)