Commit 3f613ce3 authored by Kathleen Brade's avatar Kathleen Brade Committed by Georg Koppen
Browse files

Bug 29180: MAR download stalls when about dialog is opened

Avoid stopping and restarting the download when the about dialog
or update dialog is opened. This avoids a race between canceling
the MAR download and trying to start a new download.
parent 848e4342
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -318,12 +318,19 @@ appUpdater.prototype =
    this.update.QueryInterface(Ci.nsIWritablePropertyBag);
    this.update.setProperty("foregroundDownload", "true");

    this.aus.pauseDownload();
    // If one is not already in progress, start a download. Previously,
    // we would pause and restart an existing download in case there was
    // a need to transition from a background download to a foreground one,
    // but that caused Tor bug 29180. There is no difference between a
    // foreground and background download unless the update manifest
    // includes a backgroundInterval attribute.
    if (!this.isDownloading) {
      let state = this.aus.downloadUpdate(this.update, false);
      if (state == "failed") {
        this.selectPanel("downloadFailed");
        return;
      }
    }

    this.setupDownloadingUI();
  },
+15 −12
Original line number Diff line number Diff line
@@ -751,19 +751,22 @@ var gDownloadingPage = {
      gUpdates.update.QueryInterface(Ci.nsIWritablePropertyBag);
      gUpdates.update.setProperty("foregroundDownload", "true");

      // Pause any active background download and restart it as a foreground
      // download.
      aus.pauseDownload();
      // If it is not already in progress, start the download. See
      // Tor bug 29180 as well as the longer comment in the startDownload()
      // function within browser/base/content/aboutDialog-appUpdater.js.
      if (!aus.isDownloading) {
        var state = aus.downloadUpdate(gUpdates.update, false);
        if (state == "failed") {
          // We've tried as hard as we could to download a valid update -
          // we fell back from a partial patch to a complete patch and even
        // then we couldn't validate. Show a validation error with instructions
        // on how to manually update.
          // then we couldn't validate. Show a validation error with
          // instructions on how to manually update.
          this.cleanUp();
          gUpdates.wiz.goTo("errors");
          return;
        }
      }

      // Add this UI as a listener for active downloads
      aus.addDownloadListener(this);