mozilla-crashreporter-restart-args.patch
changeset 515 0f6539389500
parent 514 ff06037ec39c
child 517 fa93154734b8
equal deleted inserted replaced
514:ff06037ec39c 515:0f6539389500
     1 # HG changeset patch
       
     2 # User Wolfgang Rosenauer <wr@rosenauer.org>
       
     3 # Parent 07bb4ecfd6d6cc16360e7a32ee10b885d523f20d
       
     4 Bug 762780 - crashreporter restart command should support MOZ_APP_LAUNCHER
       
     5 
       
     6 diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp
       
     7 --- a/toolkit/crashreporter/nsExceptionHandler.cpp
       
     8 +++ b/toolkit/crashreporter/nsExceptionHandler.cpp
       
     9 @@ -1360,32 +1360,25 @@ nsresult
       
    10  SetRestartArgs(int argc, char** argv)
       
    11  {
       
    12    if (!gExceptionHandler)
       
    13      return NS_OK;
       
    14  
       
    15    int i;
       
    16    nsCAutoString envVar;
       
    17    char *env;
       
    18 +  char *argv1 = getenv("MOZ_APP_LAUNCHER");
       
    19    for (i = 0; i < argc; i++) {
       
    20      envVar = "MOZ_CRASHREPORTER_RESTART_ARG_";
       
    21      envVar.AppendInt(i);
       
    22      envVar += "=";
       
    23 -#if defined(XP_UNIX) && !defined(XP_MACOSX)
       
    24 -    // we'd like to run the script around the binary
       
    25 -    // instead of the binary itself, so remove the -bin
       
    26 -    // if it exists on the first argument
       
    27 -    int arg_len = 0;
       
    28 -    if (i == 0 &&
       
    29 -        (arg_len = strlen(argv[i])) > 4 &&
       
    30 -        strcmp(argv[i] + arg_len - 4, "-bin") == 0) {
       
    31 -      envVar.Append(argv[i], arg_len - 4);
       
    32 -    } else
       
    33 -#endif
       
    34 -    {
       
    35 +    if (argv1 && i == 0) {
       
    36 +      // Is there a request to suppress default binary launcher?
       
    37 +      envVar += argv1;
       
    38 +    } else {
       
    39        envVar += argv[i];
       
    40      }
       
    41  
       
    42      // PR_SetEnv() wants the string to be available for the lifetime
       
    43      // of the app, so dup it here
       
    44      env = ToNewCString(envVar);
       
    45      if (!env)
       
    46        return NS_ERROR_OUT_OF_MEMORY;