case Ci.nsIDownloadManager.DOWNLOAD_PAUSED: case Ci.nsIDownloadManager.DOWNLOAD_DOWNLOADING: 
case nsIDM.DOWNLOAD_PAUSED: case nsIDM.DOWNLOAD_DOWNLOADING: 
function updateStatus(aItem, aDownload) {  let status = "";  let state = Number(aItem.getAttribute("state"));  switch (state) {    case Ci.nsIDownloadManager.DOWNLOAD_PAUSED:    case Ci.nsIDownloadManager.DOWNLOAD_DOWNLOADING:      let currBytes = Number(aItem.getAttribute("currBytes"));      let maxBytes = Number(aItem.getAttribute("maxBytes"));      // Update the bytes transferred and bytes total      let ([progress, progressUnits] = convertByteUnits(currBytes),           [total, totalUnits] = convertByteUnits(maxBytes),           transfer) {        if (total < 0)          transfer = gStr.transferNoTotal;        else if (progressUnits == totalUnits)          transfer = gStr.transferSameUnits;        else          transfer = gStr.transferDiffUnits;        transfer = replaceInsert(transfer, 1, progress);        transfer = replaceInsert(transfer, 2, progressUnits);        transfer = replaceInsert(transfer, 3, total);        transfer = replaceInsert(transfer, 4, totalUnits);        if (state == Ci.nsIDownloadManager.DOWNLOAD_PAUSED) {          status = replaceInsert(gStr.paused, 1, transfer);          // don't need to process any more for PAUSED          break;        }        // Insert 1 is the download progress        status = replaceInsert(gStr.statusFormat, 1, transfer);      }      // if we don't have an active download, assume 0 bytes/sec      let speed = aDownload ? aDownload.speed : 0;      // Update the download rate      let ([rate, unit] = convertByteUnits(speed)) {        // Insert 2 is the download rate        status = replaceInsert(status, 2, rate);        // Insert 3 is the |unit|/sec        status = replaceInsert(status, 3, unit);      }      // Update time remaining.      let (remain) {        if ((speed > 0) && (maxBytes > 0)) {          let seconds = Math.ceil((maxBytes - currBytes) / speed);          let lastSec = Number(aItem.getAttribute("lastSeconds"));          // Reuse the last seconds if the new one is only slighty longer          // This avoids jittering seconds, e.g., 41 40 38 40 -> 41 40 38 38          // However, large changes are shown, e.g., 41 38 49 -> 41 38 49          let (diff = seconds - lastSec) {            if (diff > 0 && diff <= 10)              seconds = lastSec;            else              aItem.setAttribute("lastSeconds", seconds);          }          // Be friendly in the last few seconds          if (seconds <= 3)            remain = gStr.timeFewSeconds;          // Show 2 digit seconds starting at 60; otherwise use minutes          else if (seconds <= 60)            remain = replaceInsert(gStr.timeSecondsLeft, 1, seconds);          else            remain = replaceInsert(gStr.timeMinutesLeft, 1,                                   Math.ceil(seconds / 60));        } else {          remain = gStr.timeUnknown;        }        // Insert 4 is the time remaining        status = replaceInsert(status, 4, remain);      }      break;  }  aItem.setAttribute("status", status);}
5872	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5872/39be0419a4a695ce67977c967201261ea171190a/downloads.js/buggy/toolkit/mozapps/downloads/content/downloads.js