var overallProgress = aCurTotalProgress;  var downloadID = "dl" + aDownload.id; var download = this.doc.getElementById(downloadID);   var percent; if (aMaxTotalProgress > 0) { percent = Math.floor((overallProgress*100.0)/aMaxTotalProgress); if (percent > 100) percent = 100;   if (download) { download.setAttribute("progress", percent);  download.setAttribute("progressmode", "normal");  onUpdateProgress(); } } else { percent = -1;   download.setAttribute("progressmode", "undetermined"); 
var download = getDownload(aDownload.id); if (!download) {  let uri = Cc["@mozilla.org/network/util;1"]. getService(Ci.nsIIOService).newFileURI(aDownload.targetFile); let itm = createDownloadItem(aDownload.id, uri.spec, aDownload.displayName, aDownload.source.spec, aDownload.state, aDownload.percentComplete); download = gDownloadsView.insertBefore(itm, gDownloadsActiveLabel.nextSibling); 
  onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress,                              aCurTotalProgress, aMaxTotalProgress, aDownload)  {    var overallProgress = aCurTotalProgress;    var downloadID = "dl" + aDownload.id;    var download = this.doc.getElementById(downloadID);    // Calculate percentage.    var percent;    if (aMaxTotalProgress > 0) {      percent = Math.floor((overallProgress*100.0)/aMaxTotalProgress);      if (percent > 100)        percent = 100;      // Advance progress meter.      if (download) {        download.setAttribute("progress", percent);        download.setAttribute("progressmode", "normal");                onUpdateProgress();      }    } else {      percent = -1;      // Progress meter should be barber-pole in this case.      download.setAttribute("progressmode", "undetermined");    }    // Now that we've set the progress and the time, update the UI with     // all the the pertinent information (bytes transferred, bytes total,    // download rate, time remaining).     let status = this._statusFormat;    // Update the bytes transferred and bytes total    let ([progress, progressUnits] = this._convertByteUnits(aCurTotalProgress),         [total, totalUnits] = this._convertByteUnits(aMaxTotalProgress),         transfer) {      if (total <= 0)        transfer = this._transferNoTotal;      else if (progressUnits == totalUnits)        transfer = this._transferSameUnits;      else        transfer = this._transferDiffUnits;      transfer = this._replaceInsert(transfer, 1, progress);      transfer = this._replaceInsert(transfer, 2, progressUnits);      transfer = this._replaceInsert(transfer, 3, total);      transfer = this._replaceInsert(transfer, 4, totalUnits);      // Insert 1 is the download progress      status = this._replaceInsert(status, 1, transfer);      if (download)        download.setAttribute("status-internal", transfer);    }    // Update the download rate    let ([rate, unit] = this._convertByteUnits(aDownload.speed)) {      // Insert 2 is the download rate      status = this._replaceInsert(status, 2, rate);      // Insert 3 is the |unit|/sec      status = this._replaceInsert(status, 3, unit);    }    // Update time remaining.    let (remain) {      if ((aDownload.speed > 0) && (aMaxTotalProgress > 0)) {        let minutes = Math.ceil((aMaxTotalProgress - aCurTotalProgress) /                                aDownload.speed / 60);        if (minutes > 1)          remain = this._replaceInsert(this._timeLeft, 1, minutes);        else          remain = this._timeLessMinute;      } else {        remain = this._timeUnknown;      }      // Insert 4 is the time remaining      status = this._replaceInsert(status, 4, remain);    }        if (download)      download.setAttribute("status", status);  },
5872	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5872/43455f9fc69a7b8e33dae13cc90fd333fc5448d2/DownloadProgressListener.js/clean/toolkit/mozapps/downloads/content/DownloadProgressListener.js