diff -r 2a08bb18befb -r b3f909e83302 mozilla-helper-app.patch --- a/mozilla-helper-app.patch Wed Sep 15 08:08:53 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -From: Wolfgang Rosenauer -Subject: no helper app for application/octet-stream but recognized extensions -References: -https://bugzilla.novell.com/show_bug.cgi?id=406979 -https://bugzilla.mozilla.org/show_bug.cgi?id=327323 - -diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp ---- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp -+++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp -@@ -47,6 +47,7 @@ - #include "nsMIMEInfoUnix.h" - #include "nsGNOMERegistry.h" - #include "nsIGnomeVFSService.h" -+#include "nsAutoPtr.h" - #ifdef MOZ_ENABLE_DBUS - #include "nsDBusHandlerApp.h" - #endif -@@ -74,13 +75,16 @@ NS_IMETHODIMP - nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval) - { - *_retval = PR_FALSE; -- nsCOMPtr vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); -- if (vfs) { -- nsCOMPtr app; -- if (NS_SUCCEEDED(vfs->GetAppForMimeType(mType, getter_AddRefs(app))) && app) -- *_retval = PR_TRUE; -+ nsRefPtr mimeInfo = nsGNOMERegistry::GetFromType(mType); -+ if (!mimeInfo) { -+ nsCAutoString ext; -+ GetPrimaryExtension(ext); -+ mimeInfo = nsGNOMERegistry::GetFromExtension(ext); - } - -+ if (mimeInfo) -+ *_retval = PR_TRUE; -+ - if (*_retval) - return NS_OK; - -@@ -113,6 +117,16 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns - nsCOMPtr app; - if (NS_SUCCEEDED(vfs->GetAppForMimeType(mType, getter_AddRefs(app))) && app) - return app->Launch(nativePath); -+ -+ // If we haven't got an app we try to get a valid one by searching for the -+ // extension mapped type -+ nsRefPtr mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath); -+ if (mimeInfo) { -+ nsCAutoString type; -+ mimeInfo->GetType(type); -+ if (NS_SUCCEEDED(vfs->GetAppForMimeType(type, getter_AddRefs(app))) && app) -+ return app->Launch(nativePath); -+ } - } - - if (!mDefaultApplication) -diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp ---- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp -+++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp -@@ -1580,8 +1580,16 @@ nsOSHelperAppService::GetMIMEInfoFromOS( - return retval; - } - -- // Copy the attributes of retval onto miByExt, to return it -+ // Copy the attributes of retval (mimeinfo from type) onto miByExt, to -+ // return it -+ // but reset to just collected mDefaultAppDescription (from ext) -+ // and preserve the primary extension as well -+ nsAutoString byExtDefault; -+ miByExt->GetDefaultDescription(byExtDefault); -+ retval->SetDefaultDescription(byExtDefault); - retval->CopyBasicDataTo(miByExt); -+ if (!aFileExt.IsEmpty()) -+ miByExt->SetPrimaryExtension(aFileExt); - - miByExt.swap(retval); - }