Commit 51a72676 authored by Kirk Steuber's avatar Kirk Steuber
Browse files

Bug 1727820 - Change aboutDialog-appUpdater to accomodate changes to AppUpdater r=bhearsum

In a previous patch in this stack, AppUpdater was changed to remove the checkForUpdates function. This change updates aboutDialog-appUpdater to accomodate this change.

It was probably incorrect for this function to be called previously. Calling into checkForUpdates() is functionally similar to calling into check(), except that checks are bypassed that probably shouldn't be bypassed.

Differential Revision: https://phabricator.services.mozilla.com/D159299
parent 8da6080b
Loading
Loading
Loading
Loading
+22 −4
Original line number Diff line number Diff line
@@ -20,6 +20,13 @@ XPCOMUtils.defineLazyModuleGetters(this, {
  DownloadUtils: "resource://gre/modules/DownloadUtils.jsm",
});

XPCOMUtils.defineLazyServiceGetter(
  this,
  "AUS",
  "@mozilla.org/updates/update-service;1",
  "nsIApplicationUpdateService"
);

var UPDATING_MIN_DISPLAY_TIME_MS = 1500;

var gAppUpdater;
@@ -101,9 +108,17 @@ appUpdater.prototype = {
      case AppUpdater.STATUS.DOWNLOADING: {
        let downloadStatus = document.getElementById("downloadStatus");
        if (!args.length) {
          // Very early in the DOWNLOADING state, `selectedPatch` may not be
          // available yet. But this function will be called again when it is
          // available. A `maxSize < 0` indicates that the max size is not yet
          // available.
          let maxSize = -1;
          if (this.update.selectedPatch) {
            maxSize = this.update.selectedPatch.size;
          }
          downloadStatus.textContent = DownloadUtils.getTransferTotal(
            0,
            this.update.selectedPatch.size
            maxSize
          );
          this.selectPanel("downloading");
        } else {
@@ -160,6 +175,9 @@ appUpdater.prototype = {
      case AppUpdater.STATUS.INTERNAL_ERROR:
        this.selectPanel("internalError");
        break;
      case AppUpdater.STATUS.NEVER_CHECKED:
        this.selectPanel("checkForUpdates");
        break;
    }
  },

@@ -215,7 +233,7 @@ appUpdater.prototype = {
   * Check for updates
   */
  checkForUpdates() {
    this._appUpdater.checkForUpdates();
    this._appUpdater.check();
  },

  /**
@@ -223,7 +241,7 @@ appUpdater.prototype = {
   * which is presented after the download has been downloaded.
   */
  buttonRestartAfterDownload() {
    if (!this._appUpdater.isReadyForRestart) {
    if (AUS.currentState != Ci.nsIApplicationUpdateService.STATE_PENDING) {
      return;
    }

@@ -265,6 +283,6 @@ appUpdater.prototype = {
   * Starts the download of an update mar.
   */
  startDownload() {
    this._appUpdater.startDownload();
    this._appUpdater.allowUpdateDownload();
  },
};