From b9db51200e83e0d045ade63ec8f1a6aebdf36189 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sat, 28 Nov 2026 22:31:25 +0000 Subject: [PATCH] web: drop window errors from scripts not of the page's origin (a browser's wallet or an extension), which could fail the boot --- web/index.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/web/index.html b/web/index.html index e131036..e4be202 100644 --- a/web/index.html +++ b/web/index.html @@ -159,6 +159,18 @@ "<" + t.tagName.toLowerCase() + "> load error (404, network or MIME type)", t.tagName === "SCRIPT"); return; } + // Scripts a browser or an extension injects (Brave's wallet touching window.ethereum, say) throw here too: + // drop an error that names no script of the page's origin (a blob: URL of it, or wasm), so it cannot fail the boot. + if (location.origin !== "null") { + let ours; + try { + const u = new URL(ev.filename); + ours = u.origin === location.origin || u.protocol === "wasm:"; + } catch { + ours = String(ev.error?.stack || "").includes(location.origin); + } + if (!ours) return; + } KW.report("exception", ev.message || "Script error", ev.error?.stack || (ev.filename ? ev.filename + ":" + ev.lineno + ":" + ev.colno : ""), !KW.started); }, true); addEventListener("unhandledrejection", (ev) => {