Bug 308204: null description in helper version info leaves Download Actions blank, patch by Phil Ringnalda <philringnalda@gmail.com>, r=mconnor

This commit is contained in:
gavin%gavinsharp.com 2006-04-09 21:10:51 +00:00
parent 938d13e4b9
commit 28977a8df1
2 changed files with 16 additions and 7 deletions

View File

@ -283,15 +283,20 @@ var gDownloadActionsWindow = {
_getDisplayNameForFile: function (aFile)
{
#ifdef XP_WIN
if (aFile instanceof Components.interfaces.nsILocalFileWin)
return aFile.getVersionInfoField("FileDescription");
#else
if (aFile instanceof Components.interfaces.nsILocalFileWin) {
try {
return aFile.getVersionInfoField("FileDescription");
}
catch (e) {
// fall through to the filename
}
}
#endif
// XXXben - Read the bundle name on OS X.
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var url = ios.newFileURI(aFile).QueryInterface(Components.interfaces.nsIURL);
return url.fileName;
#endif
},
_loadMIMERegistryData: function ()

View File

@ -51,14 +51,18 @@
<![CDATA[
#ifdef XP_WIN
var lfw = aFile.QueryInterface(Components.interfaces.nsILocalFileWin);
return lfw.getVersionInfoField("FileDescription");
#else
try {
return lfw.getVersionInfoField("FileDescription");
}
catch (e) {
// fall through to the filename
}
#endif
// XXXben - Read the bundle name on OS X.
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var url = ios.newFileURI(aFile).QueryInterface(Components.interfaces.nsIURL);
return url.fileName;
#endif
]]>
</body>
</method>