let dl = getDownload(aDownload.id);    if (!gSearching) gDownloadsView.insertBefore(dl, gDownloadsOtherLabel.nextSibling); else gDownloadsView.removeChild(dl);   
function downloadCompleted(aDownload) {  // Wrap this in try...catch since this can be called while shutting down...   // it doesn't really matter if it fails then since well.. we're shutting down  // and there's no UI to update!  try {    // getTypeFromFile fails if it can't find a type for this file. Handle this gracefully.    try {      // Refresh the icon, so that executable icons are shown.      var mimeService = Components.classes["@mozilla.org/uriloader/external-helper-app-service;1"].getService(Components.interfaces.nsIMIMEService);      var contentType = mimeService.getTypeFromFile(aDownload.targetFile);      var listItem = getDownload(aDownload.id)      var oldImage = listItem.getAttribute("image");      // I tack on the content-type here as a hack to bypass the cache which seems      // to be interfering despite the fact the image has 'validate="always"' set      // on it.       listItem.setAttribute("image", oldImage + "&contentType=" + contentType);    } catch (e) { }        var insertIndex = gDownloadManager.activeDownloadCount + 1;            // Remove the download from our book-keeping list and if the count    // falls to zero, update the title here, since we won't be getting    // any more progress notifications in which to do it.     for (var i = 0; i < gActiveDownloads.length; ++i) {      if (gActiveDownloads[i] == aDownload) {        gActiveDownloads.splice(i, 1);        break;      }    }    gDownloadViewController.onCommandUpdate();    if (gActiveDownloads.length == 0)      document.title = document.documentElement.getAttribute("statictitle");  }  catch (e) { }}
5459	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/5459/43455f9fc69a7b8e33dae13cc90fd333fc5448d2/downloads.js/buggy/toolkit/mozapps/downloads/content/downloads.js