Verified Commit 837a9d0e authored by Henry Wilkes's avatar Henry Wilkes Committed by Pier Angelo Vendrame
Browse files

fixup! Bug 7494: Create local home page for TBB.

Bug 42186: Move override page logic to about:tor commit.
parent 38c921db
Loading
Loading
Loading
Loading
+38 −14
Changes for browser/components/BrowserContentHandler.sys.mjs: 38 added lines, 14 removed lines.
Original line number Diff line number Diff line
@@ -720,6 +720,23 @@ nsBrowserContentHandler.prototype = {
      }
    }

    // Retrieve the home page early so we can compare it against about:tor
    // to decide whether or not we need an override page (second tab) after
    // an update was applied.
    var startPage = "";
    try {
      var choice = Services.prefs.getIntPref("browser.startup.page");
      if (choice == 1 || choice == 3) {
        startPage = lazy.HomePage.get();
      }
    } catch (e) {
      console.error(e);
    }

    if (startPage == "about:blank") {
      startPage = "";
    }

    var override;
    var overridePage = "";
    var additionalPage = "";
@@ -859,6 +876,27 @@ nsBrowserContentHandler.prototype = {
              "%OLD_BASE_BROWSER_VERSION%",
              old_forkVersion
            );
            if (overridePage && AppConstants.BASE_BROWSER_UPDATE) {
              // Tor Browser: Instead of opening the post-update "override page"
              // directly, we ensure that about:tor will be opened, which should
              // notify the user that their browser was updated.
              //
              // The overridePage comes from the openURL attribute within the
              // updates.xml file or, if no showURL action is present, from the
              // startup.homepage_override_url pref.
              Services.prefs.setCharPref(
                "torbrowser.post_update.url",
                overridePage
              );
              Services.prefs.setBoolPref(
                "torbrowser.post_update.shouldNotify",
                true
              );
              // If the user's homepage is about:tor, we will inform them
              // about the update on that page; otherwise, we arrange to
              // open about:tor in a secondary tab.
              overridePage = startPage === "about:tor" ? "" : "about:tor";
            }
            break;
          }
          case OVERRIDE_NEW_BUILD_ID:
@@ -933,20 +971,6 @@ nsBrowserContentHandler.prototype = {
      }
    }

    var startPage = "";
    try {
      var choice = prefb.getIntPref("browser.startup.page");
      if (choice == 1 || choice == 3) {
        startPage = lazy.HomePage.get();
      }
    } catch (e) {
      console.error(e);
    }

    if (startPage == "about:blank") {
      startPage = "";
    }

    let skipStartPage =
      override == OVERRIDE_NEW_PROFILE &&
      prefb.getBoolPref("browser.startup.firstrunSkipsHomepage");