Commit 9d1f789d authored by Mark Smith's avatar Mark Smith Committed by Matthew Finkel
Browse files

Bug 1642754 - Update prompts should not depend on how update was initiated r=bytesized

Show update badge and doorhanger when entering the "pending"
state for foreground updates.

Differential Revision: https://phabricator.services.mozilla.com/D79903
parent 9a3b8993
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -5002,8 +5002,6 @@ Downloader.prototype = {
      }
    }

    // XXX ehsan shouldShowPrompt should always be false here.
    // But what happens when there is already a UI showing?
    var state = this._patch.state;
    var shouldShowPrompt = false;
    var shouldRegisterOnlineObserver = false;
@@ -5044,9 +5042,7 @@ Downloader.prototype = {
        } else {
          state = STATE_PENDING;
        }
        if (this.background) {
        shouldShowPrompt = !getCanStageUpdates();
        }
        AUSTLMY.pingDownloadCode(this.isCompleteUpdate, AUSTLMY.DWNLD_SUCCESS);

        // Tell the updater.exe we're ready to apply.
@@ -5329,12 +5325,10 @@ Downloader.prototype = {
          LOG(
            "Downloader:onStopRequest - failed to stage update. Exception: " + e
          );
          if (this.background) {
          shouldShowPrompt = true;
        }
      }
    }
    }

    // Do this after *everything* else, since it will likely cause the app
    // to shut down.
+17 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ add_task(async function aboutDialog_foregroundCheck_downloadAuto() {

  // Since the partial should be successful specify an invalid size for the
  // complete update.
  let params = { queryString: "&invalidCompleteSize=1" };
  let params = { queryString: "&invalidCompleteSize=1&promptWaitTime=0" };
  await runAboutDialogUpdateTest(params, [
    {
      panelId: "checkingForUpdates",
@@ -28,6 +28,22 @@ add_task(async function aboutDialog_foregroundCheck_downloadAuto() {
      continueFile: CONTINUE_DOWNLOAD,
      downloadInfo,
    },
    async function aboutDialog_restart_notification() {
      is(
        PanelUI.notificationPanel.state,
        "closed",
        "The window's doorhanger is closed."
      );
      ok(
        PanelUI.menuButton.hasAttribute("badge-status"),
        "The window has a badge."
      );
      is(
        PanelUI.menuButton.getAttribute("badge-status"),
        "update-restart",
        "The restart badge is showing for the background window"
      );
    },
    {
      panelId: "apply",
      checkActiveUpdate: { state: STATE_PENDING },