From eea751bc5a2359ba3a46ea748e3ea64092c93dd7 Mon Sep 17 00:00:00 2001 From: "gandalf%firefox.pl" Date: Fri, 11 Mar 2005 02:10:54 +0000 Subject: [PATCH] bug 245829: Download manager progress and title do not update correctly, wrong number of files and percentage after finishing or cancelling a download; r=mconnor git-svn-id: svn://10.0.0.236/trunk@170550 18797224-902f-48f8-a5cc-f745e15eee43 --- .../mozapps/downloads/content/downloads.js | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/mozilla/toolkit/mozapps/downloads/content/downloads.js b/mozilla/toolkit/mozapps/downloads/content/downloads.js index bf7d962e071..8359a41de88 100644 --- a/mozilla/toolkit/mozapps/downloads/content/downloads.js +++ b/mozilla/toolkit/mozapps/downloads/content/downloads.js @@ -129,16 +129,20 @@ function downloadCompleted(aDownload) var id = aDownload.targetFile.path; - // 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 = document.getElementById(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); + // 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 = document.getElementById(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 dlRes = rdf.GetUnicodeResource(id);