Bug 582315 - Fix DownloadTaskbarProgress checks which will fix intermittent orange, r+a=sdwilsh

This commit is contained in:
Felipe Gomes 2010-08-04 15:51:00 -07:00
parent ae131eaee2
commit 7f1b4c8e24

View File

@ -283,20 +283,22 @@ var DownloadTaskbarProgressUpdater =
this._taskbarState = Ci.nsITaskbarProgress.STATE_NO_PROGRESS;
}
else {
let numPaused = 0;
let numPaused = 0, numScanning = 0;
// Enumerate all active downloads
let downloads = this._dm.activeDownloads;
while (downloads.hasMoreElements()) {
let download = downloads.getNext().QueryInterface(Ci.nsIDownload);
// Only set values if we actually know the download size
if (download.percentComplete < 100 && download.size > 0) {
if (download.percentComplete != -1) {
totalSize += download.size;
totalTransferred += download.amountTransferred;
}
// We might need to display a paused state, so track this
if (download.state == this._dm.DOWNLOAD_PAUSED) {
numPaused++;
} else if (download.state == this._dm.DOWNLOAD_SCANNING) {
numScanning++;
}
}
@ -314,8 +316,9 @@ var DownloadTaskbarProgressUpdater =
}
// If at least one download is not paused, and we don't have any
// information about download sizes, display an indeterminate indicator
else if (totalSize == 0) {
else if (totalSize == 0 || numActive == numScanning) {
this._taskbarState = Ci.nsITaskbarProgress.STATE_INDETERMINATE;
totalSize = 0;
totalTransferred = 0;
}
// Otherwise display a normal progress bar