Verified Commit 1e1a2221 authored by henry's avatar henry Committed by Pier Angelo Vendrame
Browse files

fixup! MB 112: Updater customization for Mullvad Browser

Bug 271: Do not open update override page in a new tab, and show in
about:mullvad-browser instead.
parent 0d3b0974
Loading
Loading
Loading
Loading
+28 −14
Original line number Diff line number Diff line
@@ -666,6 +666,23 @@ nsBrowserContentHandler.prototype = {
      }
    }

    // Retrieve the home page early so we can compare it against
    // about:mullvad-browser to decide whether or not we need an override page
    // (second tab) after an update was applied.
    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 = "";
    }

    var override;
    var overridePage = "";
    var additionalPage = "";
@@ -734,6 +751,17 @@ nsBrowserContentHandler.prototype = {
              "%OLD_BASE_BROWSER_VERSION%",
              old_forkVersion
            );
            if (overridePage && AppConstants.BASE_BROWSER_UPDATE) {
              // Mullvad Browser, copied from tor-browser: Instead of opening
              // the post-update "override page" directly, we include a link in
              // about:mullvad-browser.
              prefb.setCharPref("mullvadbrowser.post_update.url", overridePage);
              prefb.setBoolPref("mullvadbrowser.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:mullvad-browser" ? "" : "about:mullvad-browser";
            }
            break;
          case OVERRIDE_NEW_BUILD_ID:
            if (lazy.UpdateManager.readyUpdate) {
@@ -806,20 +834,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");