[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-149.0a1-16.0-2] fixup! TB 27476: Implement about:torconnect captive portal within Tor Browser



Title: GitLab

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:

Changes:

  • toolkit/content/aboutNetError.mjs
    ... ... @@ -379,7 +379,7 @@ function initOnionError() {
    379 379
     }
    
    380 380
     
    
    381 381
     // Returns pageTitleId, bodyTitle, bodyTitleId, and longDesc as an object
    
    382
    -async function initTitleAndBodyIds(baseURL, isTRROnlyFailure) {
    
    382
    +function initTitleAndBodyIds(baseURL, isTRROnlyFailure) {
    
    383 383
       let bodyTitle = document.querySelector(".title-text");
    
    384 384
       let longDesc = document.getElementById("errorLongDesc");
    
    385 385
       const tryAgain = document.getElementById("netErrorButtonContainer");
    
    ... ... @@ -475,22 +475,12 @@ async function initTitleAndBodyIds(baseURL, isTRROnlyFailure) {
    475 475
           learnMore.hidden = false;
    
    476 476
           document.body.className = "certerror";
    
    477 477
           break;
    
    478
    -
    
    479
    -    case "proxyConnectFailure":
    
    480
    -      if (await RPMSendQuery("ShouldShowTorConnect")) {
    
    481
    -        // pass orginal destination as redirect param
    
    482
    -        const encodedRedirect = encodeURIComponent(document.location.href);
    
    483
    -        document.location.replace(
    
    484
    -          `about:torconnect?redirect=${encodedRedirect}`
    
    485
    -        );
    
    486
    -      }
    
    487
    -      break;
    
    488 478
       }
    
    489 479
     
    
    490 480
       return { pageTitleId, bodyTitle, bodyTitleId, longDesc };
    
    491 481
     }
    
    492 482
     
    
    493
    -async function initPage() {
    
    483
    +function initPage() {
    
    494 484
       // We show an offline support page in case of a system-wide error,
    
    495 485
       // when a user cannot connect to the internet and access the SUMO website.
    
    496 486
       // For example, clock error, which causes certerrors across the web or
    
    ... ... @@ -561,8 +551,10 @@ async function initPage() {
    561 551
       tryAgain.hidden = false;
    
    562 552
       const learnMoreLink = document.getElementById("learnMoreLink");
    
    563 553
       learnMoreLink.setAttribute("href", baseURL + "connection-not-secure");
    
    564
    -  let { pageTitleId, bodyTitle, bodyTitleId, longDesc } =
    
    565
    -    await initTitleAndBodyIds(baseURL, isTRROnlyFailure);
    
    554
    +  let { pageTitleId, bodyTitle, bodyTitleId, longDesc } = initTitleAndBodyIds(
    
    555
    +    baseURL,
    
    556
    +    isTRROnlyFailure
    
    557
    +  );
    
    566 558
     
    
    567 559
       // We can handle the offline page separately.
    
    568 560
       if (gNoConnectivity) {
    
    ... ... @@ -1411,6 +1403,24 @@ async function init() {
    1411 1403
         i++;
    
    1412 1404
         errorCode = await retryErrorCode();
    
    1413 1405
       }
    
    1406
    +
    
    1407
    +  if (!errorCode) {
    
    1408
    +    errorCode = gErrorCode;
    
    1409
    +  }
    
    1410
    +  if (errorCode === "proxyConnectFailure") {
    
    1411
    +    let inIframe;
    
    1412
    +    try {
    
    1413
    +      inIframe = window.self !== window.top;
    
    1414
    +    } catch {
    
    1415
    +      // Assume a frame if access to top is blocked.
    
    1416
    +      inIframe = true;
    
    1417
    +    }
    
    1418
    +    if (!inIframe && (await RPMSendQuery("ShouldShowTorConnect"))) {
    
    1419
    +      // pass orginal destination as redirect param
    
    1420
    +      const encodedRedirect = encodeURIComponent(document.location.href);
    
    1421
    +      document.location.replace(`about:torconnect?redirect=${encodedRedirect}`);
    
    1422
    +    }
    
    1423
    +  }
    
    1414 1424
     }
    
    1415 1425
     
    
    1416 1426
     async function main() {
    

  • _______________________________________________
    tor-commits mailing list -- tor-commits@xxxxxxxxxxxxxxxxxxxx
    To unsubscribe send an email to tor-commits-leave@xxxxxxxxxxxxxxxxxxxx