[tbb-commits] [tor-browser/tor-browser-78.0.1esr-10.0-1] squash! Bug 4234: Use the Firefox Update Process for Tor Browser.

sysrqb at torproject.org sysrqb at torproject.org
Fri Jul 31 15:20:18 UTC 2020


commit 9edbe737efc9625c3ada0d94a301a976c8417176
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Tue Jul 28 10:12:43 2020 -0400

    squash! Bug 4234: Use the Firefox Update Process for Tor Browser.
    
    Removed #28885 parts of this patch which have been uplifted to Firefox.
---
 browser/components/BrowserGlue.jsm                 |  1 -
 .../customizableui/content/panelUI.inc.xhtml       |  1 -
 .../components/customizableui/content/panelUI.js   | 28 ----------------------
 .../themes/shared/customizableui/panelUI.inc.css   |  3 ---
 browser/themes/shared/notification-icons.inc.css   |  1 -
 browser/themes/shared/toolbarbutton-icons.inc.css  |  1 -
 toolkit/mozapps/update/UpdateListener.jsm          | 23 ------------------
 toolkit/mozapps/update/UpdateService.jsm           | 28 ----------------------
 8 files changed, 86 deletions(-)

diff --git a/browser/components/BrowserGlue.jsm b/browser/components/BrowserGlue.jsm
index 43565440dd17..24828f4c0347 100644
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -780,7 +780,6 @@ const global = this;
 
 const listeners = {
   observers: {
-    "update-downloading": ["UpdateListener"],
     "update-staged": ["UpdateListener"],
     "update-downloaded": ["UpdateListener"],
     "update-available": ["UpdateListener"],
diff --git a/browser/components/customizableui/content/panelUI.inc.xhtml b/browser/components/customizableui/content/panelUI.inc.xhtml
index 80a015021d3b..27ef02cb3165 100644
--- a/browser/components/customizableui/content/panelUI.inc.xhtml
+++ b/browser/components/customizableui/content/panelUI.inc.xhtml
@@ -225,7 +225,6 @@
         <vbox id="appMenu-addon-banners"/>
         <toolbarbutton id="appMenu-update-banner" class="panel-banner-item"
                        label-update-available="&updateAvailable.panelUI.label;"
-                       label-update-downloading="Downloading update"
                        label-update-manual="&updateManual.panelUI.label;"
                        label-update-unsupported="&updateUnsupported.panelUI.label;"
                        label-update-restart="&updateRestart.panelUI.label2;"
diff --git a/browser/components/customizableui/content/panelUI.js b/browser/components/customizableui/content/panelUI.js
index e63f004e7fc3..9c10a73f063c 100644
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -59,14 +59,12 @@ const PanelUI = {
 
   init() {
     this._initElements();
-    this._initUpdaterStrings();
 
     this.menuButton.addEventListener("mousedown", this);
     this.menuButton.addEventListener("keypress", this);
 
     Services.obs.addObserver(this, "fullscreen-nav-toolbox");
     Services.obs.addObserver(this, "appMenu-notifications");
-    Services.obs.addObserver(this, "show-update-progress");
 
     XPCOMUtils.defineLazyPreferenceGetter(
       this,
@@ -148,28 +146,6 @@ const PanelUI = {
     }
   },
 
-  _initUpdaterStrings() {
-    // If Torbutton is installed and enabled, replace the "Downloading update"
-    // string with one from torbutton.properties (to facilitate localization).
-    try {
-      let brands = Services.strings.createBundle(
-                                 "chrome://branding/locale/brand.properties");
-      let stringArgs = [brands.GetStringFromName("brandShortName")];
-      let torbuttonBundle = Services.strings.createBundle(
-                            "chrome://torbutton/locale/torbutton.properties");
-      let label = torbuttonBundle.formatStringFromName(
-                              "updateDownloadingPanelUILabel", stringArgs, 1);
-      let attrName = "label-update-downloading";
-      let elements = document.getElementsByClassName("panel-banner-item");
-      for (let i = 0; i < elements.length; ++i) {
-        let elem = elements.item(i);
-        if (elem.hasAttribute(attrName)) {
-          elem.setAttribute(attrName, label);
-        }
-      }
-    } catch (e) {}
-  },
-
   _eventListenersAdded: false,
   _ensureEventListenersAdded() {
     if (this._eventListenersAdded) {
@@ -206,7 +182,6 @@ const PanelUI = {
 
     Services.obs.removeObserver(this, "fullscreen-nav-toolbox");
     Services.obs.removeObserver(this, "appMenu-notifications");
-    Services.obs.removeObserver(this, "show-update-progress");
 
     window.removeEventListener("MozDOMFullscreen:Entered", this);
     window.removeEventListener("MozDOMFullscreen:Exited", this);
@@ -296,9 +271,6 @@ const PanelUI = {
         this._notifications = AppMenuNotifications.notifications;
         this._updateNotifications(true);
         break;
-      case "show-update-progress":
-        openAboutDialog();
-        break;
     }
   },
 
diff --git a/browser/themes/shared/customizableui/panelUI.inc.css b/browser/themes/shared/customizableui/panelUI.inc.css
index c991daee0759..8a24f03c0ad6 100644
--- a/browser/themes/shared/customizableui/panelUI.inc.css
+++ b/browser/themes/shared/customizableui/panelUI.inc.css
@@ -67,7 +67,6 @@
 }
 
 #PanelUI-menu-button[badge-status="update-available"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
-#PanelUI-menu-button[badge-status="update-downloading"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
 #PanelUI-menu-button[badge-status="update-manual"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
 #PanelUI-menu-button[badge-status="update-restart"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
 #PanelUI-menu-button[badge-status="update-unsupported"] > .toolbarbutton-badge-stack > .toolbarbutton-badge {
@@ -81,7 +80,6 @@
 }
 
 #PanelUI-menu-button[badge-status="update-available"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
-#PanelUI-menu-button[badge-status="update-downloading"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
 #PanelUI-menu-button[badge-status="update-manual"] > .toolbarbutton-badge-stack > .toolbarbutton-badge,
 #PanelUI-menu-button[badge-status="update-restart"] > .toolbarbutton-badge-stack > .toolbarbutton-badge {
   background: #74BF43 url(chrome://browser/skin/update-badge.svg) no-repeat center;
@@ -92,7 +90,6 @@
 }
 
 .panel-banner-item[notificationid="update-available"]::after,
-.panel-banner-item[notificationid="update-downloading"]::after,
 .panel-banner-item[notificationid="update-manual"]::after,
 .panel-banner-item[notificationid="update-restart"]::after {
   background: #74BF43 url(chrome://browser/skin/update-badge.svg) no-repeat center;
diff --git a/browser/themes/shared/notification-icons.inc.css b/browser/themes/shared/notification-icons.inc.css
index 7aa92d51f4d6..94e3f760a122 100644
--- a/browser/themes/shared/notification-icons.inc.css
+++ b/browser/themes/shared/notification-icons.inc.css
@@ -404,7 +404,6 @@ html|*#webRTC-previewVideo {
 
 /* UPDATE */
 .popup-notification-icon[popupid="update-available"],
-.popup-notification-icon[popupid="update-downloading"],
 .popup-notification-icon[popupid="update-manual"],
 .popup-notification-icon[popupid="update-restart"] {
   background: #74BF43 url(chrome://browser/skin/notification-icons/update.svg) no-repeat center;
diff --git a/browser/themes/shared/toolbarbutton-icons.inc.css b/browser/themes/shared/toolbarbutton-icons.inc.css
index cf02f871c9a4..5856fa2dc28f 100644
--- a/browser/themes/shared/toolbarbutton-icons.inc.css
+++ b/browser/themes/shared/toolbarbutton-icons.inc.css
@@ -298,7 +298,6 @@ toolbar[brighttext] {
 }
 
 #PanelUI-menu-button[badge-status="update-available"],
-#PanelUI-menu-button[badge-status="update-downloading"],
 #PanelUI-menu-button[badge-status="update-manual"],
 #PanelUI-menu-button[badge-status="update-restart"] {
   list-style-image: url("chrome://browser/skin/menu-badged.svg");
diff --git a/toolkit/mozapps/update/UpdateListener.jsm b/toolkit/mozapps/update/UpdateListener.jsm
index c788af8862e6..17919e914b11 100644
--- a/toolkit/mozapps/update/UpdateListener.jsm
+++ b/toolkit/mozapps/update/UpdateListener.jsm
@@ -205,15 +205,6 @@ var UpdateListener = {
     }
   },
 
-  showUpdateDownloadingNotification() {
-    this.showUpdateNotification("downloading", true, true, () => {
-      // The user clicked on the "Downloading update" app menu item.
-      // Code in browser/components/customizableui/content/panelUI.js
-      // receives the following notification and opens the about dialog.
-      Services.obs.notifyObservers(null, "show-update-progress", null);
-    });
-  },
-
   handleUpdateError(update, status) {
     switch (status) {
       case "download-attempt-failed":
@@ -296,17 +287,6 @@ var UpdateListener = {
     }
   },
 
-  handleUpdateDownloading(status) {
-    switch (status) {
-      case "downloading":
-        this.showUpdateDownloadingNotification();
-        break;
-      case "idle":
-        this.reset();
-        break;
-    }
-  },
-
   observe(subject, topic, status) {
     let update = subject && subject.QueryInterface(Ci.nsIUpdate);
 
@@ -319,9 +299,6 @@ var UpdateListener = {
         }
         this.handleUpdateAvailable(update, status);
         break;
-      case "update-downloading":
-        this.handleUpdateDownloading(status);
-        break;
       case "update-staged":
       case "update-downloaded":
         // An update check has found an update and downloaded / staged the
diff --git a/toolkit/mozapps/update/UpdateService.jsm b/toolkit/mozapps/update/UpdateService.jsm
index 15e06940f8e7..9fe676a529aa 100644
--- a/toolkit/mozapps/update/UpdateService.jsm
+++ b/toolkit/mozapps/update/UpdateService.jsm
@@ -63,7 +63,6 @@ const PREF_APP_UPDATE_ELEVATE_ATTEMPTS = "app.update.elevate.attempts";
 const PREF_APP_UPDATE_ELEVATE_MAXATTEMPTS = "app.update.elevate.maxAttempts";
 const PREF_APP_UPDATE_LOG = "app.update.log";
 const PREF_APP_UPDATE_LOG_FILE = "app.update.log.file";
-const PREF_APP_UPDATE_NOTIFYDURINGDOWNLOAD = "app.update.notifyDuringDownload";
 const PREF_APP_UPDATE_PROMPTWAITTIME = "app.update.promptWaitTime";
 const PREF_APP_UPDATE_SERVICE_ENABLED = "app.update.service.enabled";
 const PREF_APP_UPDATE_SERVICE_ERRORS = "app.update.service.errors";
@@ -4396,13 +4395,11 @@ Downloader.prototype = {
         // retrying after a failed cancel is not an error, so we will set the
         // cancel promise to null in the failure case.
         this._cancelPromise = null;
-        this._notifyDownloadStatusObservers();
         throw e;
       }
     } else if (this._request && this._request instanceof Ci.nsIRequest) {
       this._request.cancel(cancelError);
     }
-    this._notifyDownloadStatusObservers();
   },
 
   /**
@@ -4617,13 +4614,6 @@ Downloader.prototype = {
     return selectedPatch;
   },
 
-  _notifyDownloadStatusObservers: function Downloader_notifyDownloadStatusObservers() {
-    if (Services.prefs.getBoolPref(PREF_APP_UPDATE_NOTIFYDURINGDOWNLOAD, false)) {
-      let status = this.updateService.isDownloading ? "downloading" : "idle";
-      Services.obs.notifyObservers(this._update, "update-downloading", status);
-    }
-  },
-
   /**
    * Whether or not we are currently downloading something.
    */
@@ -4865,9 +4855,6 @@ Downloader.prototype = {
         .getService(Ci.nsIUpdateManager)
         .saveUpdates();
     }
-
-    this._notifyDownloadStatusObservers();
-
     return STATE_DOWNLOADING;
   },
 
@@ -5209,16 +5196,9 @@ Downloader.prototype = {
         } else {
           state = STATE_PENDING;
         }
-#if defined(TOR_BROWSER_UPDATE)
-        // In Tor Browser, show update-related messages in the hamburger menu
-        // even if the update was started in the foreground, e.g., from the
-        // about box.
-        shouldShowPrompt = !getCanStageUpdates();
-#else
         if (this.background) {
           shouldShowPrompt = !getCanStageUpdates();
         }
-#endif
         AUSTLMY.pingDownloadCode(this.isCompleteUpdate, AUSTLMY.DWNLD_SUCCESS);
 
         // Tell the updater.exe we're ready to apply.
@@ -5386,7 +5366,6 @@ Downloader.prototype = {
     }
 
     this._request = null;
-    this._notifyDownloadStatusObservers();
 
     if (state == STATE_DOWNLOAD_FAILED) {
       var allFailed = true;
@@ -5497,16 +5476,9 @@ Downloader.prototype = {
           LOG(
             "Downloader:onStopRequest - failed to stage update. Exception: " + e
           );
-#if defined(TOR_BROWSER_UPDATE)
-          // In Tor Browser, show update-related messages in the hamburger menu
-          // even if the update was started in the foreground, e.g., from the
-          // about box.
-          shouldShowPrompt = true;
-#else
           if (this.background) {
             shouldShowPrompt = true;
           }
-#endif
         }
       }
     }





More information about the tbb-commits mailing list