add: let dl = getDownload(aDownload.id);    if (!gSearching) gDownloadsView.insertBefore(dl, gDownloadsOtherLabel.nextSibling); else gDownloadsView.removeChild(dl);   
context: 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) { }}
meta: 10520	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/10520/c816c402c2dc9a4ba3e0172325a9186da0704138/downloads.js/buggy/toolkit/mozapps/downloads/content/downloads.js