Pier Angelo Vendrame pushed to branch tor-browser-149.0a1-16.0-2 at The Tor Project / Applications / Tor Browser Commits: 0c255cf8 by Pier Angelo Vendrame at 2026-04-16T19:24:49+02:00 fixup! TB 27476: Implement about:torconnect captive portal within Tor Browser TB 44846: Make sure redirect to about:torconnect works with felt-privacy TB 44798: Exempt iframes from about:torconnect redirects - - - - - 1 changed file: - toolkit/content/aboutNetError.mjs Changes: ===================================== toolkit/content/aboutNetError.mjs ===================================== @@ -379,7 +379,7 @@ function initOnionError() { } // Returns pageTitleId, bodyTitle, bodyTitleId, and longDesc as an object -async function initTitleAndBodyIds(baseURL, isTRROnlyFailure) { +function initTitleAndBodyIds(baseURL, isTRROnlyFailure) { let bodyTitle = document.querySelector(".title-text"); let longDesc = document.getElementById("errorLongDesc"); const tryAgain = document.getElementById("netErrorButtonContainer"); @@ -475,22 +475,12 @@ async function initTitleAndBodyIds(baseURL, isTRROnlyFailure) { learnMore.hidden = false; document.body.className = "certerror"; break; - - case "proxyConnectFailure": - if (await RPMSendQuery("ShouldShowTorConnect")) { - // pass orginal destination as redirect param - const encodedRedirect = encodeURIComponent(document.location.href); - document.location.replace( - `about:torconnect?redirect=${encodedRedirect}` - ); - } - break; } return { pageTitleId, bodyTitle, bodyTitleId, longDesc }; } -async function initPage() { +function initPage() { // We show an offline support page in case of a system-wide error, // when a user cannot connect to the internet and access the SUMO website. // For example, clock error, which causes certerrors across the web or @@ -561,8 +551,10 @@ async function initPage() { tryAgain.hidden = false; const learnMoreLink = document.getElementById("learnMoreLink"); learnMoreLink.setAttribute("href", baseURL + "connection-not-secure"); - let { pageTitleId, bodyTitle, bodyTitleId, longDesc } = - await initTitleAndBodyIds(baseURL, isTRROnlyFailure); + let { pageTitleId, bodyTitle, bodyTitleId, longDesc } = initTitleAndBodyIds( + baseURL, + isTRROnlyFailure + ); // We can handle the offline page separately. if (gNoConnectivity) { @@ -1411,6 +1403,24 @@ async function init() { i++; errorCode = await retryErrorCode(); } + + if (!errorCode) { + errorCode = gErrorCode; + } + if (errorCode === "proxyConnectFailure") { + let inIframe; + try { + inIframe = window.self !== window.top; + } catch { + // Assume a frame if access to top is blocked. + inIframe = true; + } + if (!inIframe && (await RPMSendQuery("ShouldShowTorConnect"))) { + // pass orginal destination as redirect param + const encodedRedirect = encodeURIComponent(document.location.href); + document.location.replace(`about:torconnect?redirect=${encodedRedirect}`); + } + } } async function main() { View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/0c255cf8... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/0c255cf8... You're receiving this email because of your account on gitlab.torproject.org. Manage all notifications: https://gitlab.torproject.org/-/profile/notifications | Help: https://gitlab.torproject.org/help
participants (1)
-
Pier Angelo Vendrame (@pierov)