fix(theseus/error): show branded error page on BCNR→clearnet fallback failures
flytastic.ru (and any other site where the BCNR lookup NXDOMAINs and
the clearnet fallback fails with a cert / network error) was leaving
the tab blank instead of showing the error page.
Cause — tab.internalNav was overloaded. loadBns's fallbackToWeb sets
internalNav=true before loadURL("https://host/") so will-navigate
doesn't re-route the programmatic nav back through navigateTab. The
did-fail-load handler was using the SAME flag to suppress recursion
on its own loadFile(error.html) call — so a cert error during the
clearnet fallback was silently swallowed.
Narrow the suppression to its real target: skip did-fail-load only
when the failing URL is file:// (our own error.html / home.html
loads). Clearnet HTTPS failures from a programmatic loadURL now
surface the branded error page like any other failed navigation. The
will-navigate guard (its original purpose) is untouched.
This commit is contained in:
parent
faea4147d2
commit
14d9df31cc
1 changed files with 9 additions and 4 deletions
13
main.js
13
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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue