mozilla-crashreporter-restart-args.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Mon, 11 Jun 2012 00:14:39 +0200
changeset 469 26e68edfc24b
child 483 6a8f38a81faf
child 486 83ef9ecabaeb
permissions -rw-r--r--
crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
469
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     1
# HG changeset patch
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     2
# User Wolfgang Rosenauer <wr@rosenauer.org>
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     3
# Parent 2cea34f21fbbd778c9643f4453c8438719c27444
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     4
Bug 762780 - crashreporter fails to restart Firefox
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     6
diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     7
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     8
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     9
@@ -1364,29 +1364,22 @@ SetRestartArgs(int argc, char** argv)
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    10
 
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    11
   int i;
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    12
   nsCAutoString envVar;
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    13
   char *env;
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    14
   for (i = 0; i < argc; i++) {
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
     envVar = "MOZ_CRASHREPORTER_RESTART_ARG_";
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
     envVar.AppendInt(i);
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
     envVar += "=";
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    18
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    19
-    // we'd like to run the script around the binary
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    20
-    // instead of the binary itself, so remove the -bin
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    21
-    // if it exists on the first argument
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
-    int arg_len = 0;
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    23
-    if (i == 0 &&
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    24
-        (arg_len = strlen(argv[i])) > 4 &&
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    25
-        strcmp(argv[i] + arg_len - 4, "-bin") == 0) {
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    26
-      envVar.Append(argv[i], arg_len - 4);
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    27
-    } else
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
-#endif
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    29
-    {
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    30
+    // Is there a request to suppress default binary launcher?
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    31
+    char* argv1 = getenv("MOZ_APP_LAUNCHER");
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    32
+    if(!argv1) {
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    33
       envVar += argv[i];
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    34
+    } else {
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
+      envVar += argv1;
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    36
     }
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    37
 
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    38
     // PR_SetEnv() wants the string to be available for the lifetime
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    39
     // of the app, so dup it here
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    40
     env = ToNewCString(envVar);
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    41
     if (!env)
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    42
       return NS_ERROR_OUT_OF_MEMORY;
26e68edfc24b crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    43