[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser/tor-browser-60.5.0esr-8.5-1] Bug 29180: MAR download stalls when about dialog is opened



commit ffda294141584fdf69257e2a04fbcc7d4705ca3f
Author: Kathy Brade <brade@xxxxxxxxxxxxxxxxx>
Date:   Thu Jan 31 10:01:14 2019 -0500

    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.
---
 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);
 

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits