mozilla-gio-launch-uri.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Thu, 17 Feb 2011 20:14:47 +0100
changeset 228 9ba8fb8909c4
child 229 298263f797be
permissions -rw-r--r--
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch) call to the ntlm_auth helper fails (bmo#634334) (mozilla-ntlm-full-path.patch from Petr Cerny)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
228
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     1
# HG changeset patch
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     2
# Parent f81b405b9adebc56c3af5cfbf2f74cf01c22956b
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     3
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
--- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     6
+++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     7
@@ -51,16 +51,18 @@
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     8
 #include <contentaction/contentaction.h>
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     9
 #include "nsContentHandlerApp.h"
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    10
 #endif
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    11
 
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    12
 #include "nsMIMEInfoUnix.h"
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    13
 #include "nsCommonRegistry.h"
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    14
 #include "nsIGIOService.h"
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
 #include "nsIGnomeVFSService.h"
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
+#include "nsNetCID.h"
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
+#include "nsIIOService.h"
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    18
 #include "nsAutoPtr.h"
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
 #ifdef MOZ_ENABLE_DBUS
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    20
 #include "nsDBusHandlerApp.h"
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    21
 #endif
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
 #if defined(XP_UNIX) && !defined(XP_MACOSX)
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    23
 #include "nsKDEUtils.h"
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    24
 #endif
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    25
 
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    26
@@ -170,38 +172,47 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    27
     }
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
     if (!mDefaultApplication)
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    29
       return NS_ERROR_FILE_NOT_FOUND;
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    30
 
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    31
     return LaunchWithIProcess(mDefaultApplication, nativePath);
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    32
   }
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    33
 
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    34
   nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
+  nsCAutoString uriSpec;
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    36
+  if (giovfs) {
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    37
+    // nsGIOMimeApp->Launch wants a URI string instead of local file
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    38
+    nsCOMPtr<nsIIOService> ioservice = do_GetService(NS_IOSERVICE_CONTRACTID);
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    39
+    nsCOMPtr<nsIURI> uri;
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    40
+    ioservice->NewFileURI(aFile, getter_AddRefs(uri));
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    41
+    uri->GetSpec(uriSpec);
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    42
+  }
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    43
+
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    44
   nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    45
   if (giovfs) {
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    46
     nsCOMPtr<nsIGIOMimeApp> app;
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    47
     if (NS_SUCCEEDED(giovfs->GetAppForMimeType(mSchemeOrType, getter_AddRefs(app))) && app)
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    48
-      return app->Launch(nativePath);
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    49
+      return app->Launch(uriSpec);
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    50
   } else if (gnomevfs) {
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    51
     /* Fallback to GnomeVFS */
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    52
     nsCOMPtr<nsIGnomeVFSMimeApp> app;
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    53
     if (NS_SUCCEEDED(gnomevfs->GetAppForMimeType(mSchemeOrType, getter_AddRefs(app))) && app)
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    54
       return app->Launch(nativePath);
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    55
   }
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    56
 
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    57
   // If we haven't got an app we try to get a valid one by searching for the
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    58
   // extension mapped type
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    59
   nsRefPtr<nsMIMEInfoBase> mimeInfo = nsCommonRegistry::GetFromExtension(nativePath);
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    60
   if (mimeInfo) {
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    61
     nsCAutoString type;
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    62
     mimeInfo->GetType(type);
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    63
     if (giovfs) {
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    64
       nsCOMPtr<nsIGIOMimeApp> app;
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    65
       if (NS_SUCCEEDED(giovfs->GetAppForMimeType(type, getter_AddRefs(app))) && app)
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    66
-        return app->Launch(nativePath);
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    67
+        return app->Launch(uriSpec);
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    68
     } else if (gnomevfs) {
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    69
       nsCOMPtr<nsIGnomeVFSMimeApp> app;
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    70
       if (NS_SUCCEEDED(gnomevfs->GetAppForMimeType(type, getter_AddRefs(app))) && app)
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    71
         return app->Launch(nativePath);
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    72
     }
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    73
   }
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    74
 
9ba8fb8909c4 fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    75
   if (!mDefaultApplication)