diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index f69a078a4eb6..4ae754d14bf8 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -2595,16 +2595,11 @@ NS_IMETHODIMP nsExternalHelperAppService::GetFromTypeAndExtension(const nsACStri // (3) No match yet. Ask extras. if (!found) { rv = NS_ERROR_FAILURE; -#ifdef XP_WIN - /* XXX Gross hack to wallpaper over the most common Win32 - * extension issues caused by the fix for bug 116938. See bug - * 120327, comment 271 for why this is needed. Not even sure we - * want to remove this once we have fixed all this stuff to work - * right; any info we get from extras on this type is pretty much - * useless.... - */ + // Getting info for application/octet-stream content-type from extras + // does not make a sense because this tends to open all octet-streams + // as Binary file with exe, com or bin extension regardless the real + // extension. if (!typeToUse.Equals(APPLICATION_OCTET_STREAM, nsCaseInsensitiveCStringComparator())) -#endif rv = FillMIMEInfoForMimeTypeFromExtras(typeToUse, *_retval); LOG(("Searched extras (by type), rv 0x%08" PRIX32 "\n", static_cast(rv))); // If that didn't work out, try file extension from extras diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp index 31bc54e0834e..1dd37e22972c 100644 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp @@ -31,6 +31,7 @@ #include "prenv.h" // for PR_GetEnv() #include "nsAutoPtr.h" #include "mozilla/Preferences.h" +#include "nsMimeTypes.h" using namespace mozilla; @@ -1450,7 +1451,12 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aType, const nsACString& aFileExt, bool *aFound) { *aFound = true; - RefPtr retval = GetFromType(PromiseFlatCString(aType)); + RefPtr retval; + // Fallback to lookup by extension when generic 'application/octet-stream' + // content type is received. + if (!aType.EqualsLiteral(APPLICATION_OCTET_STREAM)) { + retval = GetFromType(PromiseFlatCString(aType)); + } bool hasDefault = false; if (retval) retval->GetHasDefaultHandler(&hasDefault);