Don't return a mime info based on mime type if we didn't get a helper to

use.   Bug 109897, r=cbiesinger@web.de, sr=rpotts
This commit is contained in:
bzbarsky%mit.edu 2001-11-27 21:24:32 +00:00
parent ad32eded51
commit 40836c7a18

View File

@ -1247,25 +1247,25 @@ NS_IMETHODIMP nsOSHelperAppService::GetFromMIMEType(const char *aMIMEType,
nsDependentSubstring majorType(majorTypeStart, majorTypeEnd);
nsDependentSubstring minorType(minorTypeStart, minorTypeEnd);
LookUpExtensionsAndDescription(majorType,
minorType,
extensions,
mime_types_description);
LookUpHandlerAndDescription(majorType,
minorType,
typeOptions,
handler,
mailcap_description,
mozillaFlags);
mailcap_description.Trim(" \t\"");
mozillaFlags.Trim(" \t");
if (extensions.IsEmpty() && mime_types_description.IsEmpty() &&
handler.IsEmpty() && mailcap_description.IsEmpty()) {
if (handler.IsEmpty()) {
// we have no useful info....
return NS_ERROR_FAILURE;
}
mailcap_description.Trim(" \t\"");
mozillaFlags.Trim(" \t");
LookUpExtensionsAndDescription(majorType,
minorType,
extensions,
mime_types_description);
nsCOMPtr<nsIMIMEInfo> mimeInfo(do_CreateInstance(NS_MIMEINFO_CONTRACTID, &rv));
if (NS_FAILED(rv))
@ -1281,9 +1281,8 @@ NS_IMETHODIMP nsOSHelperAppService::GetFromMIMEType(const char *aMIMEType,
rv = NS_ERROR_FAILURE;
nsCOMPtr<nsIFile> handlerFile;
if (! handler.IsEmpty()) {
rv = GetFileTokenForPath(handler.get(), getter_AddRefs(handlerFile));
}
rv = GetFileTokenForPath(handler.get(), getter_AddRefs(handlerFile));
if (NS_SUCCEEDED(rv)) {
mimeInfo->SetPreferredApplicationHandler(handlerFile);
mimeInfo->SetPreferredAction(nsIMIMEInfo::useHelperApp);