Commit 5e57a55f authored by Kathleen Brade's avatar Kathleen Brade Committed by Pier Angelo Vendrame
Browse files

BB 4234: Use the Firefox Update Process for Base Browser.

Windows: disable "runas" code path in updater (15201).
Windows: avoid writing to the registry (16236).
Also includes fixes for tickets 13047, 13301, 13356, 13594, 15406,
  16014, 16909, 24476, and 25909.

Also fix bug 27221: purge the startup cache if the Base Browser
version changed (even if the Firefox version and build ID did
not change), e.g., after a minor Base Browser update.

Also fix 32616: Disable GetSecureOutputDirectoryPath() functionality.

Bug 26048: potentially confusing "restart to update" message

Within the update doorhanger, remove the misleading message that mentions
that windows will be restored after an update is applied, and replace the
"Restart and Restore" button label with an existing
"Restart to update Tor Browser" string.

Bug 28885: notify users that update is downloading

Add a "Downloading Base Browser update" item which appears in the
hamburger (app) menu while the update service is downloading a MAR
file. Before this change, the browser did not indicate to the user
that an update was in progress, which is especially confusing in
Tor Browser because downloads often take some time. If the user
clicks on the new menu item, the about dialog is opened to allow
the user to see download progress.

As part of this fix, the update service was changed to always show
update-related messages in the hamburger menu, even if the update
was started in the foreground via the about dialog or via the
"Check for Tor Browser Update" toolbar menu item. This change is
consistent with the Tor Browser goal of making sure users are
informed about the update process.

Removed #28885 parts of this patch which have been uplifted to Firefox.
parent f23ace79
Loading
Loading
Loading
Loading
+2 −0
Changes for browser/app/Makefile.in: 2 added lines, 0 removed lines.
Original line number Original line Diff line number Diff line
@@ -92,9 +92,11 @@ tools repackage:: $(DIST)/bin/$(MOZ_APP_NAME) $(objdir)/macbuild/Contents/MacOS-
	rsync -aL $(DIST)/bin/$(MOZ_APP_NAME) '$(dist_dest)/Contents/MacOS'
	rsync -aL $(DIST)/bin/$(MOZ_APP_NAME) '$(dist_dest)/Contents/MacOS'
	cp -RL $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/firefox.icns '$(dist_dest)/Contents/Resources/firefox.icns'
	cp -RL $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/firefox.icns '$(dist_dest)/Contents/Resources/firefox.icns'
	cp -RL $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/document.icns '$(dist_dest)/Contents/Resources/document.icns'
	cp -RL $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/document.icns '$(dist_dest)/Contents/Resources/document.icns'
ifndef BASE_BROWSER_UPDATE
	$(MKDIR) -p '$(dist_dest)/Contents/Library/LaunchServices'
	$(MKDIR) -p '$(dist_dest)/Contents/Library/LaunchServices'
ifdef MOZ_UPDATER
ifdef MOZ_UPDATER
	cp -f '$(dist_dest)/Contents/MacOS/updater.app/Contents/MacOS/org.mozilla.updater' '$(dist_dest)/Contents/Library/LaunchServices'
	cp -f '$(dist_dest)/Contents/MacOS/updater.app/Contents/MacOS/org.mozilla.updater' '$(dist_dest)/Contents/Library/LaunchServices'
endif
endif
endif
	$(MKDIR) -p '$(dist_dest)/Contents/Frameworks'
	$(MKDIR) -p '$(dist_dest)/Contents/Frameworks'
	mv '$(dist_dest)/Contents/Resources/ChannelPrefs.framework' '$(dist_dest)/Contents/Frameworks'
	mv '$(dist_dest)/Contents/Resources/ChannelPrefs.framework' '$(dist_dest)/Contents/Frameworks'
+4 −15
Changes for browser/base/content/aboutDialog.js: 4 added lines, 15 removed lines.
Original line number Original line Diff line number Diff line
@@ -44,28 +44,21 @@ function init() {
  }
  }


  // Include the build ID and display warning if this is an "a#" (nightly or aurora) build
  // Include the build ID and display warning if this is an "a#" (nightly or aurora) build
  let versionIdMap = new Map([
  let versionId = "basebrowser-about-dialog-version";
    ["base", "aboutDialog-version"],
    ["base-nightly", "aboutDialog-version-nightly"],
    ["base-arch", "aboutdialog-version-arch"],
    ["base-arch-nightly", "aboutdialog-version-arch-nightly"],
  ]);
  let versionIdKey = "base";
  let versionAttributes = {
  let versionAttributes = {
    version: AppConstants.MOZ_APP_VERSION_DISPLAY,
    version: AppConstants.BASE_BROWSER_VERSION,
    firefoxVersion: AppConstants.MOZ_APP_VERSION_DISPLAY,
  };
  };


  let arch = Services.sysinfo.get("arch");
  let arch = Services.sysinfo.get("arch");
  if (["x86", "x86-64"].includes(arch)) {
  if (["x86", "x86-64"].includes(arch)) {
    versionAttributes.bits = Services.appinfo.is64Bit ? 64 : 32;
    versionAttributes.bits = Services.appinfo.is64Bit ? 64 : 32;
  } else {
  } else {
    versionIdKey += "-arch";
    versionAttributes.arch = arch;
    versionAttributes.arch = arch;
  }
  }


  let version = Services.appinfo.version;
  let version = Services.appinfo.version;
  if (/a\d+$/.test(version)) {
  if (/a\d+$/.test(version)) {
    versionIdKey += "-nightly";
    let buildID = Services.appinfo.appBuildID;
    let buildID = Services.appinfo.appBuildID;
    let year = buildID.slice(0, 4);
    let year = buildID.slice(0, 4);
    let month = buildID.slice(4, 6);
    let month = buildID.slice(4, 6);
@@ -79,11 +72,7 @@ function init() {
  // Use Fluent arguments for append version and the architecture of the build
  // Use Fluent arguments for append version and the architecture of the build
  let versionField = document.getElementById("version");
  let versionField = document.getElementById("version");


  document.l10n.setAttributes(
  document.l10n.setAttributes(versionField, versionId, versionAttributes);
    versionField,
    versionIdMap.get(versionIdKey),
    versionAttributes
  );


  // Show a release notes link if we have a URL.
  // Show a release notes link if we have a URL.
  let relNotesLink = document.getElementById("releasenotes");
  let relNotesLink = document.getElementById("releasenotes");
+1 −0
Changes for browser/base/content/aboutDialog.xhtml: 1 added line, 0 removed lines.
Original line number Original line Diff line number Diff line
@@ -35,6 +35,7 @@


    <html:link rel="localization" href="branding/brand.ftl"/>
    <html:link rel="localization" href="branding/brand.ftl"/>
    <html:link rel="localization" href="browser/aboutDialog.ftl"/>
    <html:link rel="localization" href="browser/aboutDialog.ftl"/>
    <html:link rel="localization" href="toolkit/global/base-browser.ftl"/>
  </linkset>
  </linkset>


  <html:div id="aboutDialogContainer">
  <html:div id="aboutDialogContainer">
+3 −0
Changes for browser/base/moz.build: 3 added lines, 0 removed lines.
Original line number Original line Diff line number Diff line
@@ -81,4 +81,7 @@ DEFINES["MOZ_APP_VERSION_DISPLAY"] = CONFIG["MOZ_APP_VERSION_DISPLAY"]


DEFINES["APP_LICENSE_BLOCK"] = "%s/content/overrides/app-license.html" % SRCDIR
DEFINES["APP_LICENSE_BLOCK"] = "%s/content/overrides/app-license.html" % SRCDIR


if CONFIG["BASE_BROWSER_UPDATE"]:
    DEFINES["BASE_BROWSER_UPDATE"] = True

JAR_MANIFESTS += ["jar.mn"]
JAR_MANIFESTS += ["jar.mn"]
+34 −2
Changes for browser/components/BrowserContentHandler.sys.mjs: 34 added lines, 2 removed lines.
Original line number Original line Diff line number Diff line
@@ -45,6 +45,9 @@ ChromeUtils.defineLazyGetter(lazy, "gWindowsAlertsService", () => {
    ?.QueryInterface(Ci.nsIWindowsAlertsService);
    ?.QueryInterface(Ci.nsIWindowsAlertsService);
});
});


const FORK_VERSION_PREF =
  "browser.startup.homepage_override.basebrowser.version";

// One-time startup homepage override configurations
// One-time startup homepage override configurations
const ONCE_DOMAINS = new Set(["mozilla.org", "firefox.com"]);
const ONCE_DOMAINS = new Set(["mozilla.org", "firefox.com"]);
const ONCE_PREF = "browser.startup.homepage_override.once";
const ONCE_PREF = "browser.startup.homepage_override.once";
@@ -119,7 +122,7 @@ const OVERRIDE_NEW_BUILD_ID = 3;
 *       if this is the first run with a new profile.
 *       if this is the first run with a new profile.
 *     OVERRIDE_NEW_MSTONE
 *     OVERRIDE_NEW_MSTONE
 *       if this is the first run with a build with a different Gecko milestone
 *       if this is the first run with a build with a different Gecko milestone
 *       (i.e. right after an upgrade).
 *       or fork version (i.e. right after an upgrade).
 *     OVERRIDE_NEW_BUILD_ID
 *     OVERRIDE_NEW_BUILD_ID
 *       if this is the first run with a new build ID of the same Gecko
 *       if this is the first run with a new build ID of the same Gecko
 *       milestone (i.e. after a nightly upgrade).
 *       milestone (i.e. after a nightly upgrade).
@@ -138,6 +141,8 @@ function needHomepageOverride(updateMilestones = true) {


  var mstone = Services.appinfo.platformVersion;
  var mstone = Services.appinfo.platformVersion;


  var savedForkVersion = Services.prefs.getCharPref(FORK_VERSION_PREF, null);

  var savedBuildID = Services.prefs.getCharPref(
  var savedBuildID = Services.prefs.getCharPref(
    "browser.startup.homepage_override.buildID",
    "browser.startup.homepage_override.buildID",
    ""
    ""
@@ -166,10 +171,28 @@ function needHomepageOverride(updateMilestones = true) {
        "browser.startup.homepage_override.buildID",
        "browser.startup.homepage_override.buildID",
        buildID
        buildID
      );
      );
      Services.prefs.setCharPref(
        FORK_VERSION_PREF,
        AppConstants.BASE_BROWSER_VERSION
      );
    }
    }
    return savedmstone ? OVERRIDE_NEW_MSTONE : OVERRIDE_NEW_PROFILE;
    return savedmstone ? OVERRIDE_NEW_MSTONE : OVERRIDE_NEW_PROFILE;
  }
  }


  if (AppConstants.BASE_BROWSER_VERSION != savedForkVersion) {
    if (updateMilestones) {
      Services.prefs.setCharPref(
        "browser.startup.homepage_override.buildID",
        buildID
      );
      Services.prefs.setCharPref(
        FORK_VERSION_PREF,
        AppConstants.BASE_BROWSER_VERSION
      );
    }
    return OVERRIDE_NEW_MSTONE;
  }

  if (buildID != savedBuildID) {
  if (buildID != savedBuildID) {
    if (updateMilestones) {
    if (updateMilestones) {
      Services.prefs.setCharPref(
      Services.prefs.setCharPref(
@@ -766,6 +789,10 @@ nsBrowserContentHandler.prototype = {
        "browser.startup.homepage_override.buildID",
        "browser.startup.homepage_override.buildID",
        "unknown"
        "unknown"
      );
      );

      // We do the same for the fork version.
      let old_forkVersion = Services.prefs.getCharPref(FORK_VERSION_PREF, null);

      override = needHomepageOverride();
      override = needHomepageOverride();
      // An object to measure the progress of handleUpdateSuccess
      // An object to measure the progress of handleUpdateSuccess
      let progress = {
      let progress = {
@@ -881,9 +908,10 @@ nsBrowserContentHandler.prototype = {
              }
              }
            }
            }


            let old_version = old_forkVersion ? old_forkVersion : old_mstone;
            if (
            if (
              update &&
              update &&
              Services.vc.compare(update.appVersion, old_mstone) > 0
              Services.vc.compare(update.appVersion, old_version) > 0
            ) {
            ) {
              overridePage = getPostUpdateOverridePage(
              overridePage = getPostUpdateOverridePage(
                update,
                update,
@@ -938,6 +966,10 @@ nsBrowserContentHandler.prototype = {
            );
            );


            overridePage = overridePage.replace("%OLD_VERSION%", old_mstone);
            overridePage = overridePage.replace("%OLD_VERSION%", old_mstone);
            overridePage = overridePage.replace(
              "%OLD_BASE_BROWSER_VERSION%",
              old_forkVersion
            );
            break;
            break;
          }
          }
          case OVERRIDE_NEW_BUILD_ID: {
          case OVERRIDE_NEW_BUILD_ID: {
Loading