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
This commit is contained in:
gandalf%firefox.pl
2005-03-11 02:10:54 +00:00
parent 8e66376134
commit eea751bc5a

View File

@@ -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);