mozilla-gio-launch-uri.patch
changeset 236 a4f5954df3a3
parent 232 156406e2b62d
child 237 676030198746
--- a/mozilla-gio-launch-uri.patch	Tue Mar 01 09:58:05 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-# HG changeset patch
-# Parent 689e53e965fdd8c76354a69fa936a3fd4f07a220
-
-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
-@@ -53,16 +53,18 @@
- #include "nsContentHandlerApp.h"
- #endif
- #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
- 
-@@ -172,38 +174,50 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
-     }
-     if (!mDefaultApplication)
-       return NS_ERROR_FILE_NOT_FOUND;
- 
-     return LaunchWithIProcess(mDefaultApplication, nativePath);
-   }
- 
-   nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
-+  nsCAutoString uriSpec;
-+  if (giovfs) {
-+    // nsGIOMimeApp->Launch wants a URI string instead of local file
-+    nsresult rv;
-+    nsCOMPtr<nsIIOService> ioservice = do_GetService(NS_IOSERVICE_CONTRACTID, &rv);
-+    NS_ENSURE_SUCCESS(rv, rv);
-+    nsCOMPtr<nsIURI> uri;
-+    rv = ioservice->NewFileURI(aFile, getter_AddRefs(uri));
-+    NS_ENSURE_SUCCESS(rv, rv);
-+    uri->GetSpec(uriSpec);
-+  }
-+
-   nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
-   if (giovfs) {
-     nsCOMPtr<nsIGIOMimeApp> 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<nsIGnomeVFSMimeApp> 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<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromExtension(nativePath);
-   if (mimeInfo) {
-     nsCAutoString type;
-     mimeInfo->GetType(type);
-     if (giovfs) {
-       nsCOMPtr<nsIGIOMimeApp> app;
-       if (NS_SUCCEEDED(giovfs->GetAppForMimeType(type, getter_AddRefs(app))) && app)
--        return app->Launch(nativePath);
-+        return app->Launch(uriSpec);
-     } else if (gnomevfs) {
-       nsCOMPtr<nsIGnomeVFSMimeApp> app;
-       if (NS_SUCCEEDED(gnomevfs->GetAppForMimeType(type, getter_AddRefs(app))) && app)
-         return app->Launch(nativePath);
-     }
-   }
- 
-   if (!mDefaultApplication)