Bug 929067 - Canceling a download from the Downloads Panel sometimes pauses it instead. r=enn
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Tue, 11 Mar 2014 15:50:46 +0100
changeset 190195 8d1664e48b5967e72bd79b9a38e5ac15af6e263d
parent 190194 8800134ab715246b4759b13585f9eb1610000836
child 190196 ea3a5092c05aae26968b2bdac61999527c450bd6
child 190307 1e331682951f1f77bfd4ee73a095809538a28848
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenn
bugs929067
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 929067 - Canceling a download from the Downloads Panel sometimes pauses it instead. r=enn
toolkit/components/jsdownloads/src/DownloadCore.jsm
--- a/toolkit/components/jsdownloads/src/DownloadCore.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadCore.jsm
@@ -358,29 +358,32 @@ this.Download.prototype = {
     let currentAttempt = deferAttempt.promise;
     this._currentAttempt = currentAttempt;
 
     // Restart the progress and speed calculations from scratch.
     this._lastProgressTimeMs = 0;
 
     // This function propagates progress from the DownloadSaver object, unless
     // it comes in late from a download attempt that was replaced by a new one.
+    // If the cancellation process for the download has started, then the update
+    // is ignored.
     function DS_setProgressBytes(aCurrentBytes, aTotalBytes, aHasPartialData)
     {
-      if (this._currentAttempt == currentAttempt || !this._currentAttempt) {
+      if (this._currentAttempt == currentAttempt) {
         this._setBytes(aCurrentBytes, aTotalBytes, aHasPartialData);
       }
     }
 
     // This function propagates download properties from the DownloadSaver
     // object, unless it comes in late from a download attempt that was
-    // replaced by a new one.
+    // replaced by a new one.  If the cancellation process for the download has
+    // started, then the update is ignored.
     function DS_setProperties(aOptions)
     {
-      if (this._currentAttempt && this._currentAttempt != currentAttempt) {
+      if (this._currentAttempt != currentAttempt) {
         return;
       }
 
       let changeMade = false;
 
       if ("contentType" in aOptions &&
           this.contentType != aOptions.contentType) {
         this.contentType = aOptions.contentType;