From d14a61e1d07dcc0c8015114b13609104b0688502 Mon Sep 17 00:00:00 2001 From: TJ Date: Wed, 17 Sep 2008 01:29:10 +0100 Subject: [PATCH] When an incorrect or unrecognised Content-Type is found, and GetFromType() fails, GetFromExtension() is used to get the mime-type from the extension. When the download completes the helper fails to launch since it is re-evaluated using the (unrecognised) mime-type but no fall-back on the extension is done. This fix makes another call to GetFromType() after GetFromExtension() to determine the helper application and configure the mimeInfo object correctly (closes LP #239952 and Mozilla bug # 455626). Signed-off-by: TJ --- .../exthandler/unix/nsOSHelperAppService.cpp | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp index 39c4cb9..8300a61 100644 --- a/mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp +++ b/mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp @@ -1603,8 +1603,14 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aType, // If we had an extension match but no type match, set the mimetype and use // it if (!retval && miByExt) { - if (!aType.IsEmpty()) - miByExt->SetMIMEType(aType); + if (!aType.IsEmpty()) { + // now we've go the MIME type, repeat the look-up on that + nsCString aMimeType; + miByExt->GetMIMEType(aMimeType); + // reuse miByExt + miByExt = GetFromType(PromiseFlatCString(aMimeType)); + miByExt->GetHasDefaultHandler(&hasDefault); + } miByExt.swap(retval); return retval; -- 1.5.4.3