On Fri, Jun 20, 2008 at 10:20:31PM +0200, Mike Hommey wrote:
> On Fri, Jun 20, 2008 at 03:04:42PM +0200, Sven Joachim wrote:
> > On 2008-06-20 14:07 +0200, Mike Hommey wrote:
> >
> > > On Fri, Jun 20, 2008 at 01:44:17PM +0200, Sven Joachim <[EMAIL
> > > PROTECTED]> wrote:
> > >> No, and I don't really want any Gnome stuff on my system. But maybe I
> > >> have to bite the bullet, since
> > >> https://bugzilla.mozilla.org/show_bug.cgi?id=409192 is really painful.
> > >
> > > As you can see there, I'm on it and the patch will be integrated in next
> > > upload ;)
> >
> > In the meantime, I installed iceweasel-gnome-support to get the
> > Edit->Preferences->Applications dialog working and set my small script
> > to run Gnus as the handler for mailto links.
> >
> > > Okay, according to your log, there seem to be something fishy with mailcap
> > > tests. Seeing the xulrunner code, I really don't understand what can be
> > > happening...
> > > Could you run:
> > > strace -f -eexecve,exit_group -o/some/file iceweasel
> > > and send the /some/file here ? This might be enlightening.
> >
> > Here it comes, but it does not seem to show much.
>
> So... I was able to reproduce the bug, and find why it happens...
> unfortunately, I have absolutely no idea how to fix this.
I'm a big liar, I somehow found something. The attached patch seems to
solve the issue for me. Can you give that a try? (You will need to
either apply that to older iceweasel (2.x) or xulrunner-1.9)
Cheers,
Mike
diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
index 39c4cb9..5403301 100644
--- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp
+++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp
@@ -67,7 +67,6 @@
#include "nsDirectoryServiceUtils.h"
#include "prenv.h" // for PR_GetEnv()
#include "nsAutoPtr.h"
-#include <stdlib.h> // for system()
#define LOG(args) PR_LOG(mLog, PR_LOG_DEBUG, args)
#define LOG_ENABLED() PR_LOG_TEST(mLog, PR_LOG_DEBUG)
@@ -1141,9 +1140,22 @@
nsOSHelperAppService::GetHandlerAndDescriptionFromMailcapFile(const nsAString& a
aMinorType,
aTypeOptions,
testCommand);
- LOG(("Running Test: %s\n", testCommand.get()));
- // XXX this should not use system(), since that can block
the UI thread!
- if (NS_SUCCEEDED(rv) && system(testCommand.get()) != 0) {
+ if (NS_FAILED(rv))
+ continue;
+ nsCOMPtr<nsIProcess> process =
do_CreateInstance(NS_PROCESS_CONTRACTID, &rv);
+ if (NS_FAILED(rv))
+ continue;
+ nsCOMPtr<nsILocalFile>
file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
+ if (NS_FAILED(rv))
+ continue;
+ rv = file->InitWithNativePath(NS_LITERAL_CSTRING("/bin/sh"));
+ if (NS_FAILED(rv))
+ continue;
+ if (NS_FAILED(rv = process->Init(file)))
+ continue;
+ const char *args[] = { "-c", testCommand.get() };
+ LOG(("Running Test: %s %d\n", testCommand.get(), rv));
+ if (process->Run(PR_TRUE, args, 2, NULL)) {
match = PR_FALSE;
}
}