author | Wolfgang Rosenauer <wr@rosenauer.org> |
Tue, 01 Mar 2011 09:55:56 +0100 | |
changeset 231 | bb385ce8c773 |
parent 229 | 298263f797be |
permissions | -rw-r--r-- |
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 |
231
bb385ce8c773
slightly improve mozilla-gio-launch-uri.patch as committed for upstream
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
229
diff
changeset
|
2 |
# Parent 689e53e965fdd8c76354a69fa936a3fd4f07a220 |
228
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 |
229
298263f797be
update to 2.0b12/4.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
228
diff
changeset
|
7 |
@@ -53,16 +53,18 @@ |
228
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
8 |
#include "nsContentHandlerApp.h" |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
9 |
#endif |
229
298263f797be
update to 2.0b12/4.0b12
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
228
diff
changeset
|
10 |
#endif |
228
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 |
|
231
bb385ce8c773
slightly improve mozilla-gio-launch-uri.patch as committed for upstream
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
229
diff
changeset
|
26 |
@@ -172,38 +174,50 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(ns |
228
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 |
231
bb385ce8c773
slightly improve mozilla-gio-launch-uri.patch as committed for upstream
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
229
diff
changeset
|
38 |
+ nsresult rv; |
bb385ce8c773
slightly improve mozilla-gio-launch-uri.patch as committed for upstream
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
229
diff
changeset
|
39 |
+ nsCOMPtr<nsIIOService> ioservice = do_GetService(NS_IOSERVICE_CONTRACTID, &rv); |
bb385ce8c773
slightly improve mozilla-gio-launch-uri.patch as committed for upstream
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
229
diff
changeset
|
40 |
+ NS_ENSURE_SUCCESS(rv, rv); |
228
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
41 |
+ nsCOMPtr<nsIURI> uri; |
231
bb385ce8c773
slightly improve mozilla-gio-launch-uri.patch as committed for upstream
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
229
diff
changeset
|
42 |
+ rv = ioservice->NewFileURI(aFile, getter_AddRefs(uri)); |
bb385ce8c773
slightly improve mozilla-gio-launch-uri.patch as committed for upstream
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
229
diff
changeset
|
43 |
+ NS_ENSURE_SUCCESS(rv, rv); |
228
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
44 |
+ uri->GetSpec(uriSpec); |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
45 |
+ } |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
46 |
+ |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
47 |
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
|
48 |
if (giovfs) { |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
49 |
nsCOMPtr<nsIGIOMimeApp> app; |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
50 |
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
|
51 |
- 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
|
52 |
+ 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
|
53 |
} else if (gnomevfs) { |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
54 |
/* Fallback to GnomeVFS */ |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
55 |
nsCOMPtr<nsIGnomeVFSMimeApp> app; |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
56 |
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
|
57 |
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
|
58 |
} |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
59 |
|
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
60 |
// 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
|
61 |
// extension mapped type |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
62 |
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
|
63 |
if (mimeInfo) { |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
64 |
nsCAutoString type; |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
65 |
mimeInfo->GetType(type); |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
66 |
if (giovfs) { |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
67 |
nsCOMPtr<nsIGIOMimeApp> app; |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
68 |
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
|
69 |
- 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
|
70 |
+ 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
|
71 |
} else if (gnomevfs) { |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
72 |
nsCOMPtr<nsIGnomeVFSMimeApp> app; |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
73 |
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
|
74 |
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
|
75 |
} |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
76 |
} |
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
77 |
|
9ba8fb8909c4
fix GIO helper app launch (bnc#672903) (mozilla-gio-launch-uri.patch)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
78 |
if (!mDefaultApplication) |