diff --git a/main.js b/main.js index 5b7e1b1c..d8a1a439 100644 --- a/main.js +++ b/main.js @@ -4013,13 +4013,18 @@ function createTab(initial, opts = {}) { wc.on("did-finish-load", () => { if (!tab.settings && !tab.addonId) webapps.probeTab(tab).then(() => { if (tab.id === activeId) emitTabs(); }).catch(() => {}); }); // Failed loads: NAME_NOT_RESOLVED, CONNECTION_REFUSED, cert errors, etc. // Show the branded error page instead of Chromium's default "This site - // can't be reached". Skip subframe errors, our own programmatic loads, - // and the couple of Chromium codes that fire on normal user actions - // (Stop / superseded nav / extension cancel). + // can't be reached". Skip subframe errors and the couple of Chromium + // codes that fire on normal user actions (Stop / superseded nav / + // extension cancel). Also skip failures of our own file:// loads + // (error.html / home.html) to avoid recursion — but DO handle failures + // of programmatic loadURL calls to clearnet (BNS fallbackToWeb sets + // internalNav to block will-navigate re-entry, not to swallow errors; + // without this, a cert-expired or unreachable upstream after a failed + // BNS lookup leaves the tab blank). wc.on("did-fail-load", (_e, code, desc, validatedURL, isMainFrame) => { if (!isMainFrame) return; - if (tab.internalNav) return; if (ERROR_CODE_IGNORE.has(code)) return; + if (typeof validatedURL === "string" && validatedURL.startsWith("file://")) return; loadErrorPage(tab, tab.id, { url: validatedURL || tab.url, code, desc }); }); // Firefox / Chrome-style bottom-left link preview: fires with the href