Bug 1541989 - Remove ability to pause updates from the old update UI. r=bytesized
authorRobert Strong <robert.bugzilla@gmail.com>
Thu, 18 Apr 2019 16:28:37 +0000
changeset 470113 22d715e983ea0a6b2dbfc77824cb021b9dffb1b3
parent 470112 a6fd01356cb36769e64da323fe21859a733cb68c
child 470114 cf8038ca2da37288169690932880e737024d5afc
push id112843
push useraiakab@mozilla.com
push dateFri, 19 Apr 2019 09:50:22 +0000
treeherdermozilla-inbound@c06f27cbfe40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbytesized
bugs1541989
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1541989 - Remove ability to pause updates from the old update UI. r=bytesized Pausing isn't implemented for BITS and this UI will be removed entirely in the future. Differential Revision: https://phabricator.services.mozilla.com/D27847
toolkit/locales/en-US/chrome/mozapps/update/updates.properties
toolkit/mozapps/update/content/updates.js
toolkit/mozapps/update/content/updates.xul
--- a/toolkit/locales/en-US/chrome/mozapps/update/updates.properties
+++ b/toolkit/locales/en-US/chrome/mozapps/update/updates.properties
@@ -12,18 +12,16 @@ updateName=%S %S
 # %2$S is the update version - provided by the update xml. Ex: version 10.0.5
 # %3$S is the build identifier - provided by the update xml. Ex: 20081022033543
 updateNightlyName=%1$S %2$S %3$S nightly
 intro_major=Do you want to upgrade to %1$S %2$S now?
 intro_minor=A security and stability update for %1$S is available:
 
 # LOCALIZATION NOTE: When present %S is brandShortName
 verificationError=%S could not confirm the integrity of the update package.
-resumePausedAfterCloseTitle=Software Update
-resumePausedAfterCloseMsg=You have paused downloading this update. Do you want to download the update in the background while you continue to use %S?
 updaterIOErrorTitle=Software Update Failed
 updaterIOErrorMsg=The update could not be installed. Please make sure there are no other copies of %S running on your computer, and then restart %S to try again.
 okButton=OK
 okButton.accesskey=O
 askLaterButton=Ask Later
 askLaterButton.accesskey=A
 noThanksButton=No Thanks
 noThanksButton.accesskey=N
@@ -42,35 +40,29 @@ restartLaterButton.accesskey=L
 restartNowButton=Restart %S
 restartNowButton.accesskey=R
 
 # LOCALIZATION NOTE: %S is the date the update was installed from the local
 # updates.xml for displaying update history
 statusSucceededFormat=Installed on: %S
 
 statusFailed=Install Failed
-pauseButtonPause=Pause
-pauseButtonResume=Resume
 hideButton=Hide
 hideButton.accesskey=H
 
 applyingUpdate=Applying update…
 
 updatesfound_minor.title=Update Available
 updatesfound_major.title=New Version Available
 
 installSuccess=The Update was successfully installed
 installPending=Install Pending
 patchApplyFailure=The Update could not be installed (patch apply failed)
 elevationFailure=You don’t have the permissions necessary to install this update. Please contact your system administrator.
 
-# LOCALIZATION NOTE: %S is the amount downloaded so far
-# example: Paused —  879 KB of 2.1 MB
-downloadPausedStatus=Paused —  %S
-
 check_error-200=Update XML file malformed (200)
 check_error-403=Access denied (403)
 check_error-404=Update XML file not found (404)
 check_error-500=Internal server error (500)
 check_error-2152398849=Failed (unknown reason)
 check_error-2152398861=Connection refused
 check_error-2152398862=Connection timed out
 # NS_ERROR_OFFLINE
--- a/toolkit/mozapps/update/content/updates.js
+++ b/toolkit/mozapps/update/content/updates.js
@@ -664,66 +664,51 @@ var gUpdatesFoundBasicPage = {
 
   onExtra1() {
     gUpdates.wiz.cancel();
   },
 };
 
 /**
  * The "Update is Downloading" page - provides feedback for the download
- * process plus a pause/resume UI
+ * process
  */
 var gDownloadingPage = {
   /**
    * DOM Elements
    */
   _downloadStatus: null,
   _downloadProgress: null,
-  _pauseButton: null,
-
-  /**
-   * Whether or not we are currently paused
-   */
-  _paused: false,
 
   /**
    * Label cache to hold the 'Connecting' string
    */
   _label_downloadStatus: null,
 
   /**
    * Member variables for updating download status
    */
   _lastSec: Infinity,
   _startTime: null,
-  _pausedStatus: "",
 
   _hiding: false,
 
   /**
    * Have we registered an observer for a background update being staged
    */
   _updateApplyingObserver: false,
 
   /**
    * Initialize
    */
   onPageShow() {
     this._downloadStatus = document.getElementById("downloadStatus");
     this._downloadProgress = document.getElementById("downloadProgress");
-    this._pauseButton = document.getElementById("pauseButton");
     this._label_downloadStatus = this._downloadStatus.textContent;
 
-    this._pauseButton.setAttribute("tooltiptext",
-                                   gUpdates.getAUSString("pauseButtonPause"));
-
-    // move focus to the pause/resume button and then disable it (bug #353177)
-    this._pauseButton.focus();
-    this._pauseButton.disabled = true;
-
     var um = Cc["@mozilla.org/updates/update-manager;1"].
              getService(Ci.nsIUpdateManager);
     var activeUpdate = um.activeUpdate;
     if (activeUpdate) {
       gUpdates.setUpdate(activeUpdate);
 
       // It's possible the update has already been downloaded and is being
       // applied by the time this page is shown, depending on how fast the
@@ -765,18 +750,20 @@ var gDownloadingPage = {
         // on how to manually update.
         this.cleanUp();
         gUpdates.wiz.goTo("errors");
         return;
       }
       // Add this UI as a listener for active downloads
       gAUS.addDownloadListener(this);
 
-      if (activeUpdate)
-        this._setUIState(!gAUS.isDownloading);
+      if (activeUpdate) {
+        this._downloadProgress.removeAttribute("value");
+        this._setStatus(this._label_downloadStatus);
+      }
     } catch (e) {
       LOG("gDownloadingPage", "onPageShow - error: " + e);
     }
 
     gUpdates.setButtons("hideButton", null, null, false);
     gUpdates.wiz.getButton("extra1").focus();
   },
 
@@ -806,56 +793,24 @@ var gDownloadingPage = {
   _updateDownloadStatus(aCurr, aMax) {
     let status;
 
     // Get the download time left and progress
     let rate = aCurr / (Date.now() - this._startTime) * 1000;
     [status, this._lastSec] =
       DownloadUtils.getDownloadStatus(aCurr, aMax, rate, this._lastSec);
 
-    // Get the download progress for pausing
-    this._pausedStatus = DownloadUtils.getTransferTotal(aCurr, aMax);
-
     return status;
   },
 
   /**
-   * Adjust UI to suit a certain state of paused-ness
-   * @param   paused
-   *          Whether or not the download is paused
-   */
-  _setUIState(paused) {
-    var u = gUpdates.update;
-    if (paused) {
-      if (!this._downloadProgress.hasAttribute("value"))
-        this._downloadProgress.setAttribute("value", "0");
-      this._pauseButton.setAttribute("tooltiptext",
-                                     gUpdates.getAUSString("pauseButtonResume"));
-      this._pauseButton.setAttribute("paused", "true");
-      var p = u.selectedPatch.QueryInterface(Ci.nsIWritablePropertyBag);
-      var status = p.getProperty("status");
-      if (status) {
-        let pausedStatus = gUpdates.getAUSString("downloadPausedStatus", [status]);
-        this._setStatus(pausedStatus);
-      }
-    } else {
-      this._downloadProgress.removeAttribute("value");
-      this._pauseButton.setAttribute("paused", "false");
-      this._pauseButton.setAttribute("tooltiptext",
-                                     gUpdates.getAUSString("pauseButtonPause"));
-      this._setStatus(this._label_downloadStatus);
-    }
-  },
-
-  /**
    * Wait for an update being staged in the background.
    */
   _setUpdateApplying() {
     this._downloadProgress.removeAttribute("value");
-    this._pauseButton.hidden = true;
     let applyingStatus = gUpdates.getAUSString("applyingUpdate");
     this._setStatus(applyingStatus);
 
     Services.obs.addObserver(this, "update-staged");
     this._updateApplyingObserver = true;
   },
 
   /**
@@ -866,34 +821,16 @@ var gDownloadingPage = {
 
     if (this._updateApplyingObserver) {
       Services.obs.removeObserver(this, "update-staged");
       this._updateApplyingObserver = false;
     }
   },
 
   /**
-   * When the user clicks the Pause/Resume button
-   */
-  onPause() {
-    if (this._paused) {
-      gAUS.downloadUpdate(gUpdates.update, false);
-    } else {
-      var patch = gUpdates.update.selectedPatch;
-      patch.QueryInterface(Ci.nsIWritablePropertyBag);
-      patch.setProperty("status", this._pausedStatus);
-      gAUS.stopDownload();
-    }
-    this._paused = !this._paused;
-
-    // Update the UI
-    this._setUIState(this._paused);
-  },
-
-  /**
    * When the user has closed the window using a Window Manager control (this
    * page doesn't have a cancel button) cancel the update in progress.
    */
   onWizardCancel() {
     if (this._hiding)
       return;
 
     this.cleanUp();
@@ -911,57 +848,31 @@ var gDownloadingPage = {
     // fed progress and state notifications after the UI we're updating has
     // gone away.
     this.cleanUp();
 
     var um = Cc["@mozilla.org/updates/update-manager;1"].
              getService(Ci.nsIUpdateManager);
     um.activeUpdate = gUpdates.update;
 
-    // If the download was paused by the user, ask the user if they want to
-    // have the update resume in the background.
-    var downloadInBackground = true;
-    if (this._paused) {
-      var title = gUpdates.getAUSString("resumePausedAfterCloseTitle");
-      var message = gUpdates.getAUSString("resumePausedAfterCloseMsg",
-                                          [gUpdates.brandName]);
-      var ps = Services.prompt;
-      var flags = ps.STD_YES_NO_BUTTONS;
-      // Focus the software update wizard before prompting. This will raise
-      // the software update wizard if it is minimized making it more obvious
-      // what the prompt is for and will solve the problem of windows
-      // obscuring the prompt. See bug #350299 for more details.
-      window.focus();
-      var rv = ps.confirmEx(window, title, message, flags, null, null, null,
-                            null, { });
-      if (rv == Ci.nsIPromptService.BUTTON_POS_0)
-        downloadInBackground = false;
-    }
-    if (downloadInBackground) {
-      // Continue download in the background at full speed.
-      LOG("gDownloadingPage", "onHide - continuing download in background " +
-          "at full speed");
-      gAUS.downloadUpdate(gUpdates.update, false);
-    }
+    // Continue download in the background at full speed.
+    LOG("gDownloadingPage", "onHide - continuing download in background " +
+        "at full speed");
+    gAUS.downloadUpdate(gUpdates.update, false);
     gUpdates.wiz.cancel();
   },
 
   /**
    * When the data transfer begins
    * @param   request
    *          The nsIRequest object for the transfer
    * @param   context
    *          Additional data
    */
   onStartRequest(request) {
-    // This !paused test is necessary because onStartRequest may fire after
-    // the download was paused (for those speedy clickers...)
-    if (this._paused)
-      return;
-
     this._downloadProgress.removeAttribute("value");
     this._setStatus(this._label_downloadStatus);
   },
 
   /**
    * When new data has been downloaded
    * @param   request
    *          The nsIRequest object for the transfer
@@ -976,24 +887,17 @@ var gDownloadingPage = {
     let status = this._updateDownloadStatus(progress, maxProgress);
     var currentProgress = Math.round(100 * (progress / maxProgress));
 
     var p = gUpdates.update.selectedPatch;
     p.QueryInterface(Ci.nsIWritablePropertyBag);
     p.setProperty("progress", currentProgress);
     p.setProperty("status", status);
 
-    // This !paused test is necessary because onProgress may fire after
-    // the download was paused (for those speedy clickers...)
-    if (this._paused)
-      return;
-
     this._downloadProgress.setAttribute("value", currentProgress);
-    if (this._pauseButton.disabled)
-      this._pauseButton.disabled = false;
 
     // If the update has completed downloading and the download status contains
     // the original text return early to avoid an assertion in debug builds.
     // Since the page will advance immmediately due to the update completing the
     // download updating the status is not important.
     // nsTextFrame::GetTrimmedOffsets 'Can only call this on frames that have
     // been reflowed'.
     if (progress == maxProgress &&
--- a/toolkit/mozapps/update/content/updates.xul
+++ b/toolkit/mozapps/update/content/updates.xul
@@ -104,18 +104,16 @@
     </vbox>
   </wizardpage>
 
   <wizardpage id="downloading" pageid="downloading">
     <updateheader label="&downloadPage.title;"/>
     <vbox class="update-content" flex="1">
       <hbox id="downloadStatusProgress">
         <html:progress id="downloadProgress" max="100"/>
-        <button id="pauseButton" oncommand="gDownloadingPage.onPause();"
-                paused="false"/>
       </hbox>
       <separator class="thin"/>
       <hbox id="downloadStatusLine">
         <label id="downloadStatus" flex="1">&connecting.label;</label>
       </hbox>
       <separator/>
       <hbox id="verificationFailed" align="start" hidden="true">
         <image id="verificationFailedIcon"/>