Verified Commit c3637be5 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃
Browse files

fixup! Bug 27476: Implement about:torconnect captive portal within Tor Browser

Moved the logic of the about:tor redirects before the bootstrap
parent 4fa75c0e
Loading
Loading
Loading
Loading
+22 −16
Original line number Diff line number Diff line
@@ -418,6 +418,28 @@ export const URILoadingHelper = {
      return;
    }

    // make sure users are not faced with the scary red 'tor isn't working' screen
    // if they navigate to about:tor before bootstrapped
    //
    // fixes tor-browser#40752
    // new tabs also redirect to about:tor if browser.newtabpage.enabled is true
    // otherwise they go to about:blank
    if (lazy.TorConnect.shouldShowTorConnect) {
      const homeURLs = [
        "about:home",
        "about:privatebrowsing",
        "about:tor",
        "about:welcome",
      ];
      if (
        homeURLs.includes(url) ||
        (url === "about:newtab" &&
          Services.prefs.getBoolPref("browser.newtabpage.enabled", false))
      ) {
        url = lazy.TorConnect.getRedirectURL(url);
      }
    }

    let {
      allowThirdPartyFixup,
      postData,
@@ -673,22 +695,6 @@ export const URILoadingHelper = {
  ) {
    event = BrowserUtils.getRootEvent(event);

    // make sure users are not faced with the scary red 'tor isn't working' screen
    // if they navigate to about:tor before bootstrapped
    //
    // fixes tor-browser#40752
    // new tabs also redirect to about:tor if browser.newtabpage.enabled is true
    // otherwise they go to about:blank
    if (lazy.TorConnect.shouldShowTorConnect) {
      if (
        url === "about:tor" ||
        (url === "about:newtab" &&
          Services.prefs.getBoolPref("browser.newtabpage.enabled", false))
      ) {
        url = lazy.TorConnect.getRedirectURL(url);
      }
    }

    let params;

    if (aIgnoreButton && typeof aIgnoreButton == "object") {