mozilla-crashreporter-restart-args.patch
author Wolfgang Rosenauer <wr@rosenauer.org>
Thu, 14 Jun 2012 09:20:26 +0200
branchfirefox14
changeset 480 f99d16f8b0f5
parent 473 bfd820693349
child 483 6a8f38a81faf
child 486 83ef9ecabaeb
permissions -rw-r--r--
14.0b7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
473
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     1
# HG changeset patch
bfd820693349 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>
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     3
# Parent 2cea34f21fbbd778c9643f4453c8438719c27444
bfd820693349 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
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     5
bfd820693349 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
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     7
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
     8
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
bfd820693349 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)
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    10
 
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    11
   int i;
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    12
   nsCAutoString envVar;
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    13
   char *env;
bfd820693349 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++) {
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    15
     envVar = "MOZ_CRASHREPORTER_RESTART_ARG_";
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    16
     envVar.AppendInt(i);
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    17
     envVar += "=";
bfd820693349 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)
bfd820693349 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
bfd820693349 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
bfd820693349 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
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    22
-    int arg_len = 0;
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    23
-    if (i == 0 &&
bfd820693349 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 &&
bfd820693349 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) {
bfd820693349 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);
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    27
-    } else
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    28
-#endif
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    29
-    {
bfd820693349 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?
bfd820693349 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");
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    32
+    if(!argv1) {
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    33
       envVar += argv[i];
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    34
+    } else {
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    35
+      envVar += argv1;
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    36
     }
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    37
 
bfd820693349 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
bfd820693349 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
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    40
     env = ToNewCString(envVar);
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    41
     if (!env)
bfd820693349 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;
bfd820693349 crashreporter restart command should support MOZ_APP_LAUNCHER (bmo#762780)
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff changeset
    43