crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
authorWolfgang Rosenauer <wr@rosenauer.org>
Mon, 11 Jun 2012 00:14:39 +0200
changeset 469 26e68edfc24b
parent 468 22a70eb49a43
child 470 983544dc8af4
crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
MozillaFirefox/mozilla-crashreporter-restart-args.patch
mozilla-crashreporter-restart-args.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MozillaFirefox/mozilla-crashreporter-restart-args.patch	Mon Jun 11 00:14:39 2012 +0200
@@ -0,0 +1,1 @@
+../mozilla-crashreporter-restart-args.patch
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mozilla-crashreporter-restart-args.patch	Mon Jun 11 00:14:39 2012 +0200
@@ -0,0 +1,43 @@
+# HG changeset patch
+# User Wolfgang Rosenauer <wr@rosenauer.org>
+# Parent 2cea34f21fbbd778c9643f4453c8438719c27444
+Bug 762780 - crashreporter fails to restart Firefox
+
+diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp
+--- a/toolkit/crashreporter/nsExceptionHandler.cpp
++++ b/toolkit/crashreporter/nsExceptionHandler.cpp
+@@ -1364,29 +1364,22 @@ SetRestartArgs(int argc, char** argv)
+ 
+   int i;
+   nsCAutoString envVar;
+   char *env;
+   for (i = 0; i < argc; i++) {
+     envVar = "MOZ_CRASHREPORTER_RESTART_ARG_";
+     envVar.AppendInt(i);
+     envVar += "=";
+-#if defined(XP_UNIX) && !defined(XP_MACOSX)
+-    // we'd like to run the script around the binary
+-    // instead of the binary itself, so remove the -bin
+-    // if it exists on the first argument
+-    int arg_len = 0;
+-    if (i == 0 &&
+-        (arg_len = strlen(argv[i])) > 4 &&
+-        strcmp(argv[i] + arg_len - 4, "-bin") == 0) {
+-      envVar.Append(argv[i], arg_len - 4);
+-    } else
+-#endif
+-    {
++    // Is there a request to suppress default binary launcher?
++    char* argv1 = getenv("MOZ_APP_LAUNCHER");
++    if(!argv1) {
+       envVar += argv[i];
++    } else {
++      envVar += argv1;
+     }
+ 
+     // PR_SetEnv() wants the string to be available for the lifetime
+     // of the app, so dup it here
+     env = ToNewCString(envVar);
+     if (!env)
+       return NS_ERROR_OUT_OF_MEMORY;
+