commit 5a0ac465ad739e62dc0c2e9887a15f146e9415a8 Author: Georg Koppen gk@torproject.org Date: Mon Feb 25 07:45:23 2019 +0000
Revert "Revert "Bug 29180: MAR download stalls when about dialog is opened""
This reverts commit fcc53d9fa4969850b4cd77951974ee6db73e827b. --- browser/base/content/aboutDialog-appUpdater.js | 17 +++++++++++----- toolkit/mozapps/update/content/updates.js | 27 ++++++++++++++------------ 2 files changed, 27 insertions(+), 17 deletions(-)
diff --git a/browser/base/content/aboutDialog-appUpdater.js b/browser/base/content/aboutDialog-appUpdater.js index e81098a1e898..b732db6bee6b 100644 --- a/browser/base/content/aboutDialog-appUpdater.js +++ b/browser/base/content/aboutDialog-appUpdater.js @@ -318,11 +318,18 @@ appUpdater.prototype = this.update.QueryInterface(Ci.nsIWritablePropertyBag); this.update.setProperty("foregroundDownload", "true");
- this.aus.pauseDownload(); - let state = this.aus.downloadUpdate(this.update, false); - if (state == "failed") { - this.selectPanel("downloadFailed"); - return; + // 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(); diff --git a/toolkit/mozapps/update/content/updates.js b/toolkit/mozapps/update/content/updates.js index 5b6ae7cc6ba1..195265ff81f9 100644 --- a/toolkit/mozapps/update/content/updates.js +++ b/toolkit/mozapps/update/content/updates.js @@ -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(); - 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. - this.cleanUp(); - gUpdates.wiz.goTo("errors"); - return; + // 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. + this.cleanUp(); + gUpdates.wiz.goTo("errors"); + return; + } } + // Add this UI as a listener for active downloads aus.addDownloadListener(this);