From 68343a3dff54fe60873fbc11eff5b9fefea83876 Mon Sep 17 00:00:00 2001 From: Catherine Date: Fri, 24 Oct 2025 09:26:54 +0000 Subject: [PATCH] Turns out a Web Worker is a type of frame (for COEP purposes). --- src/pages.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pages.go b/src/pages.go index cf26d18..a511fc3 100644 --- a/src/pages.go +++ b/src/pages.go @@ -12,6 +12,7 @@ import ( "net/url" "os" "path" + "slices" "strconv" "strings" "time" @@ -282,8 +283,12 @@ func getPage(w http.ResponseWriter, r *http.Request) error { } contentType := getMediaType(entry.GetContentType()) - if contentType == "" || contentType == "text/html" || contentType == "application/xhtml+xml" { - // allow the use of multi-threading in WebAssembly + if slices.Contains( + []string{"", "text/html", "application/xhtml+xml", "text/javascript"}, + contentType, + ) { + // allow the use of multi-threading in WebAssembly; + // note that a Web Worker is considered a type of frame for COEP purposes w.Header().Set("Cross-Origin-Embedder-Policy", "credentialless") w.Header().Set("Cross-Origin-Opener-Policy", "same-origin") }