diff -r 6bf3bb4c115e -r 9ba8fb8909c4 mozilla-gio-launch-uri.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mozilla-gio-launch-uri.patch Thu Feb 17 20:14:47 2011 +0100 @@ -0,0 +1,75 @@ +# HG changeset patch +# Parent f81b405b9adebc56c3af5cfbf2f74cf01c22956b + +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 +@@ -51,16 +51,18 @@ + #include + #include "nsContentHandlerApp.h" + #endif + + #include "nsMIMEInfoUnix.h" + #include "nsCommonRegistry.h" + #include "nsIGIOService.h" + #include "nsIGnomeVFSService.h" ++#include "nsNetCID.h" ++#include "nsIIOService.h" + #include "nsAutoPtr.h" + #ifdef MOZ_ENABLE_DBUS + #include "nsDBusHandlerApp.h" + #endif + #if defined(XP_UNIX) && !defined(XP_MACOSX) + #include "nsKDEUtils.h" + #endif + +@@ -170,38 +172,47 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns + } + if (!mDefaultApplication) + return NS_ERROR_FILE_NOT_FOUND; + + return LaunchWithIProcess(mDefaultApplication, nativePath); + } + + nsCOMPtr giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID); ++ nsCAutoString uriSpec; ++ if (giovfs) { ++ // nsGIOMimeApp->Launch wants a URI string instead of local file ++ nsCOMPtr ioservice = do_GetService(NS_IOSERVICE_CONTRACTID); ++ nsCOMPtr uri; ++ ioservice->NewFileURI(aFile, getter_AddRefs(uri)); ++ uri->GetSpec(uriSpec); ++ } ++ + nsCOMPtr gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID); + if (giovfs) { + nsCOMPtr app; + if (NS_SUCCEEDED(giovfs->GetAppForMimeType(mSchemeOrType, getter_AddRefs(app))) && app) +- return app->Launch(nativePath); ++ return app->Launch(uriSpec); + } else if (gnomevfs) { + /* Fallback to GnomeVFS */ + nsCOMPtr app; + if (NS_SUCCEEDED(gnomevfs->GetAppForMimeType(mSchemeOrType, 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 = nsCommonRegistry::GetFromExtension(nativePath); + if (mimeInfo) { + nsCAutoString type; + mimeInfo->GetType(type); + if (giovfs) { + nsCOMPtr app; + if (NS_SUCCEEDED(giovfs->GetAppForMimeType(type, getter_AddRefs(app))) && app) +- return app->Launch(nativePath); ++ return app->Launch(uriSpec); + } else if (gnomevfs) { + nsCOMPtr app; + if (NS_SUCCEEDED(gnomevfs->GetAppForMimeType(type, getter_AddRefs(app))) && app) + return app->Launch(nativePath); + } + } + + if (!mDefaultApplication)