[tbb-commits] [tor-browser/tor-browser-60.5.1esr-8.5-1] Revert "Bug 28885: notify users that update is downloading"

gk at torproject.org gk at torproject.org
Tue Feb 12 08:51:33 UTC 2019


commit 58a439dd4e6fc1734d60d7175caa1cb2f88fbbac
Author: Georg Koppen <gk at torproject.org>
Date:   Tue Feb 12 08:50:23 2019 +0000

    Revert "Bug 28885: notify users that update is downloading"
    
    This reverts commit 5f2b1d1a6be48be796f30dbef8ab3a3e42ae428f.
    
    We don't want to ship a new Torbutton right now but it contains needed
    language strings.
---
 browser/app/profile/000-tor-browser.js             |  1 -
 .../customizableui/content/panelUI.inc.xul         |  1 -
 .../components/customizableui/content/panelUI.js   | 28 ----------------------
 browser/components/nsBrowserGlue.js                |  1 -
 .../themes/shared/customizableui/panelUI.inc.css   |  1 -
 browser/themes/shared/toolbarbutton-icons.inc.css  |  1 -
 toolkit/mozapps/update/UpdateListener.jsm          | 23 ------------------
 toolkit/mozapps/update/nsUpdateService.js          | 28 ----------------------
 8 files changed, 84 deletions(-)

diff --git a/browser/app/profile/000-tor-browser.js b/browser/app/profile/000-tor-browser.js
index 9f1e727ce724..11027f4c9a3a 100644
--- a/browser/app/profile/000-tor-browser.js
+++ b/browser/app/profile/000-tor-browser.js
@@ -20,7 +20,6 @@ pref("startup.homepage_override_url", "https://blog.torproject.org/category/tags
 // Try to nag a bit more about updates: Pop up a restart dialog an hour after the initial dialog
 pref("app.update.promptWaitTime", 3600);
 pref("app.update.badge", true);
-pref("app.update.notifyDuringDownload", true);
 pref("extensions.hotfix.id", ""); // Bug 16837: Disable hotfix updates as they may cause compat issues
 
 #ifdef XP_WIN
diff --git a/browser/components/customizableui/content/panelUI.inc.xul b/browser/components/customizableui/content/panelUI.inc.xul
index ee4f8351d02b..5891556a6e5f 100644
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -172,7 +172,6 @@
         <vbox id="appMenu-addon-banners"/>
         <toolbarbutton class="panel-banner-item"
                        label-update-available="&updateAvailable.panelUI.label;"
-                       label-update-downloading="Downloading update"
                        label-update-manual="&updateManual.panelUI.label;"
                        label-update-restart="&updateRestart.panelUI.label2;"
                        oncommand="PanelUI._onBannerItemSelected(event)"
diff --git a/browser/components/customizableui/content/panelUI.js b/browser/components/customizableui/content/panelUI.js
index a4018bb2e6c2..5233be130be2 100644
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -46,7 +46,6 @@ const PanelUI = {
 
   init() {
     this._initElements();
-    this._initUpdaterStrings();
 
     this.menuButton.addEventListener("mousedown", this);
     this.menuButton.addEventListener("keypress", this);
@@ -54,7 +53,6 @@ const PanelUI = {
 
     Services.obs.addObserver(this, "fullscreen-nav-toolbox");
     Services.obs.addObserver(this, "appMenu-notifications");
-    Services.obs.addObserver(this, "show-update-progress");
 
     XPCOMUtils.defineLazyPreferenceGetter(this, "autoHideToolbarInFullScreen",
       "browser.fullscreen.autohide", false, (pref, previousValue, newValue) => {
@@ -122,28 +120,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)
@@ -176,7 +152,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);
@@ -277,9 +252,6 @@ const PanelUI = {
         this._notifications = AppMenuNotifications.notifications;
         this._updateNotifications(true);
         break;
-      case "show-update-progress":
-        openAboutDialog();
-        break;
     }
   },
 
diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js
index e68817fd3c7c..0ec10a3337d4 100644
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -187,7 +187,6 @@ const global = this;
 
 const listeners = {
   observers: {
-    "update-downloading": ["UpdateListener"],
     "update-staged": ["UpdateListener"],
     "update-downloaded": ["UpdateListener"],
     "update-available": ["UpdateListener"],
diff --git a/browser/themes/shared/customizableui/panelUI.inc.css b/browser/themes/shared/customizableui/panelUI.inc.css
index 4cb2032a09d1..75946aa5f082 100644
--- a/browser/themes/shared/customizableui/panelUI.inc.css
+++ b/browser/themes/shared/customizableui/panelUI.inc.css
@@ -62,7 +62,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;
diff --git a/browser/themes/shared/toolbarbutton-icons.inc.css b/browser/themes/shared/toolbarbutton-icons.inc.css
index 230ddf951858..d3a634d5ff51 100644
--- a/browser/themes/shared/toolbarbutton-icons.inc.css
+++ b/browser/themes/shared/toolbarbutton-icons.inc.css
@@ -259,7 +259,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 8437f4b884d4..a2b228d321ac 100644
--- a/toolkit/mozapps/update/UpdateListener.jsm
+++ b/toolkit/mozapps/update/UpdateListener.jsm
@@ -127,15 +127,6 @@ var UpdateListener = {
                                 doc => this.replaceReleaseNotes(doc, update, "updateManualWhatsNew"));
   },
 
-  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":
@@ -213,17 +204,6 @@ var UpdateListener = {
     }
   },
 
-  handleUpdateDownloading(status) {
-    switch (status) {
-      case "downloading":
-        this.showUpdateDownloadingNotification();
-        break;
-      case "idle":
-        this.reset();
-        break;
-    }
-  },
-
   observe(subject, topic, status) {
     if (!this.enabled) {
       return;
@@ -235,9 +215,6 @@ var UpdateListener = {
       case "update-available":
         this.handleUpdateAvailable(update, status);
         break;
-      case "update-downloading":
-        this.handleUpdateDownloading(status);
-        break;
       case "update-staged":
       case "update-downloaded":
         this.handleUpdateStagedOrDownloaded(update, status);
diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js
index 159112805425..b2a4e82cf241 100644
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -38,7 +38,6 @@ const PREF_APP_UPDATE_ENABLED              = "app.update.enabled";
 const PREF_APP_UPDATE_IDLETIME             = "app.update.idletime";
 const PREF_APP_UPDATE_LOG                  = "app.update.log";
 const PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED  = "app.update.notifiedUnsupported";
-const PREF_APP_UPDATE_NOTIFYDURINGDOWNLOAD = "app.update.notifyDuringDownload";
 const PREF_APP_UPDATE_POSTUPDATE           = "app.update.postupdate";
 const PREF_APP_UPDATE_PROMPTWAITTIME       = "app.update.promptWaitTime";
 const PREF_APP_UPDATE_SERVICE_ENABLED      = "app.update.service.enabled";
@@ -3326,8 +3325,6 @@ Downloader.prototype = {
     if (this._request && this._request instanceof Ci.nsIRequest) {
       this._request.cancel(cancelError);
     }
-
-    this._notifyDownloadStatusObservers();
   },
 
   /**
@@ -3501,13 +3498,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.
    */
@@ -3562,9 +3552,6 @@ Downloader.prototype = {
     var um = Cc["@mozilla.org/updates/update-manager;1"].
              getService(Ci.nsIUpdateManager);
     um.saveUpdates();
-
-    this._notifyDownloadStatusObservers();
-
     return STATE_DOWNLOADING;
   },
 
@@ -3741,16 +3728,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.
@@ -3855,7 +3835,6 @@ Downloader.prototype = {
     }
 
     this._request = null;
-    this._notifyDownloadStatusObservers();
 
     if (state == STATE_DOWNLOAD_FAILED) {
       var allFailed = true;
@@ -3928,16 +3907,9 @@ Downloader.prototype = {
           // processor service.
           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