aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-01-30 16:11:48 -0800
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-01-30 16:11:48 -0800
commit8c470194ce13781af550a74b2b4f2c1ed06670ac (patch)
tree91459d9bd2e0d0560d8b10d4f5973a4182b1c811
parent410a6bd32d6d072ecadef5a11b1be62495d4a6e3 (diff)
downloadbun-8c470194ce13781af550a74b2b4f2c1ed06670ac.tar.gz
bun-8c470194ce13781af550a74b2b4f2c1ed06670ac.tar.zst
bun-8c470194ce13781af550a74b2b4f2c1ed06670ac.zip
`""`
Diffstat (limited to '')
-rw-r--r--src/runtime/hmr.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/runtime/hmr.ts b/src/runtime/hmr.ts
index deb238a5c..9bfdbb77c 100644
--- a/src/runtime/hmr.ts
+++ b/src/runtime/hmr.ts
@@ -68,10 +68,13 @@ if (typeof window !== "undefined") {
prom: null,
cancel: false,
lastError: null,
- previousFavicon: null,
+ previousFavicon: "",
setErrorFavicon() {
if (typeof document === "undefined" || BunError.previousFavicon) return;
+ // we wrap this in a try / catch because if for some reason an error occurs because of this
+ // we don't want it to break the rest of the error handling code
+ // if they set a CSP header, that could cause this to fail
try {
let linkTag = document.querySelector("link[rel='icon']");
BunError.previousFavicon =
@@ -97,7 +100,7 @@ if (typeof window !== "undefined") {
linkTag.setAttribute("href", BunError.previousFavicon);
}
- BunError.previousFavicon = null;
+ BunError.previousFavicon = "";
} catch (exception) {}
}
},