[tor-commits] [tor-browser/tor-browser-68.1.0esr-9.0-1] fixup! Bug 4234: Use the Firefox Update Process for Tor Browser.

gk at torproject.org gk at torproject.org
Fri Aug 30 11:38:28 UTC 2019


commit f607d5bb45e536dc7094999252dc89c6bc84884b
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Thu Aug 29 21:12:37 2019 -0400

    fixup! Bug 4234: Use the Firefox Update Process for Tor Browser.
---
 browser/app/profile/firefox.js               | 10 ++--------
 toolkit/modules/UpdateUtils.jsm              | 16 ++++++++++------
 toolkit/mozapps/update/UpdateServiceStub.jsm |  4 ++++
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
index bb045fce1642..b0c42caa05a4 100644
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -143,14 +143,8 @@ pref("app.update.download.promptMaxAttempts", 2);
 pref("app.update.elevation.promptMaxAttempts", 2);
 
 // If set to true, the Update Service will automatically download updates if the
-// user can apply updates. This pref is no longer used on Windows, except as the
-// default value to migrate to the new location that this data is now stored
-// (which is in a file in the update directory). Because of this, this pref
-// should no longer be used directly. Instead, getAppUpdateAutoEnabled and
-// getAppUpdateAutoEnabled from UpdateUtils.jsm should be used.
-#ifndef XP_WIN
+// user can apply updates.
 pref("app.update.auto", true);
-#endif
 
 // If set to true, the Update Service will present no UI for any event.
 pref("app.update.silent", false);
@@ -178,7 +172,7 @@ pref("app.update.idletime", 60);
 pref("app.update.service.enabled", true);
 #endif
 
-#ifdef XP_WIN
+#ifdef MOZ_BITS_DOWNLOAD
 // If set to true, the Update Service will attempt to use Windows BITS to
 // download updates and will fallback to downloading internally if that fails.
 pref("app.update.BITS.enabled", true);
diff --git a/toolkit/modules/UpdateUtils.jsm b/toolkit/modules/UpdateUtils.jsm
index b267ebff48e8..e458dac76228 100644
--- a/toolkit/modules/UpdateUtils.jsm
+++ b/toolkit/modules/UpdateUtils.jsm
@@ -162,15 +162,17 @@ var UpdateUtils = {
    * downloads and installs updates. This corresponds to whether or not the user
    * has selected "Automatically install updates" in about:preferences.
    *
-   * On Windows, this setting is shared across all profiles for the installation
+   * On Windows (except in Tor Browser), this setting is shared across all profiles
+   * for the installation
    * and is read asynchrnously from the file. On other operating systems, this
    * setting is stored in a pref and is thus a per-profile setting.
    *
    * @return A Promise that resolves with a boolean.
    */
   getAppUpdateAutoEnabled() {
-    if (AppConstants.platform != "win") {
-      // On platforms other than Windows the setting is stored in a preference.
+    if (AppConstants.TOR_BROWSER_UPDATE || (AppConstants.platform != "win")) {
+      // On platforms other than Windows and always in Tor Browser the setting
+      // is stored in a preference.
       let prefValue = Services.prefs.getBoolPref(
         PREF_APP_UPDATE_AUTO,
         DEFAULT_APP_UPDATE_AUTO
@@ -241,7 +243,8 @@ var UpdateUtils = {
    * updates" and "Check for updates but let you choose to install them" options
    * in about:preferences.
    *
-   * On Windows, this setting is shared across all profiles for the installation
+   * On Windows (except in Tor Browser), this setting is shared across all profiles
+   * for the installation
    * and is written asynchrnously to the file. On other operating systems, this
    * setting is stored in a pref and is thus a per-profile setting.
    *
@@ -257,8 +260,9 @@ var UpdateUtils = {
    *         this operation simply sets a pref.
    */
   setAppUpdateAutoEnabled(enabledValue) {
-    if (AppConstants.platform != "win") {
-      // Only in Windows do we store the update config in the update directory
+    if (AppConstants.TOR_BROWSER_UPDATE || (AppConstants.platform != "win")) {
+      // Only in Windows (but never for Tor Browser) do we store the update config
+      // in the update directory
       let prefValue = !!enabledValue;
       Services.prefs.setBoolPref(PREF_APP_UPDATE_AUTO, prefValue);
       maybeUpdateAutoConfigChanged(prefValue);
diff --git a/toolkit/mozapps/update/UpdateServiceStub.jsm b/toolkit/mozapps/update/UpdateServiceStub.jsm
index 0318e52cd6c5..f3fdc12f53e5 100644
--- a/toolkit/mozapps/update/UpdateServiceStub.jsm
+++ b/toolkit/mozapps/update/UpdateServiceStub.jsm
@@ -45,8 +45,12 @@ function UpdateServiceStub() {
   // contains the status file's path
 
   // We may need to migrate update data
+  // In Tor Browser we skip this because we do not use an update agent and we
+  // do not want to store any data outside of the browser installation directory.
+  // For more info, see https://bugzilla.mozilla.org/show_bug.cgi?id=1458314
   if (
     AppConstants.platform == "win" &&
+    !AppConstants.TOR_BROWSER_UPDATE &&
     !Services.prefs.getBoolPref(prefUpdateDirMigrated, false)
   ) {
     migrateUpdateDirectory();



More information about the tor-commits mailing list