diff --git a/toolkit/airbag/nsAirbagExceptionHandler.cpp b/toolkit/airbag/nsAirbagExceptionHandler.cpp index dcb1a264909..4d338559e78 100755 --- a/toolkit/airbag/nsAirbagExceptionHandler.cpp +++ b/toolkit/airbag/nsAirbagExceptionHandler.cpp @@ -98,6 +98,9 @@ static google_breakpad::ExceptionHandler* gExceptionHandler = nsnull; static XP_CHAR* crashReporterPath; +// if this is false, we don't launch the crash reporter +static bool doReport = true; + // this holds additional data sent via the API static nsDataHashtable* crashReporterAPIData_Hash; static nsCString* crashReporterAPIData = nsnull; @@ -161,6 +164,10 @@ bool MinidumpCallback(const XP_CHAR* dump_path, } } + if (!doReport) { + return succeeded; + } + STARTUPINFO si; PROCESS_INFORMATION pi; @@ -191,6 +198,10 @@ bool MinidumpCallback(const XP_CHAR* dump_path, } } + if (!doReport) { + return succeeded; + } + pid_t pid = fork(); if (pid == -1) @@ -287,11 +298,17 @@ nsresult SetExceptionHandler(nsILocalFile* aXREDirectory) // check environment var to see if we're enabled. // we're off by default until we sort out the // rest of the infrastructure, - // so it must exist and be set to a non-zero value. + // so it must exist and be set to a non-empty value. const char* airbagEnv = PR_GetEnv("MOZ_AIRBAG"); - if (airbagEnv == NULL || atoi(airbagEnv) == 0) + if (airbagEnv == NULL || *airbagEnv == '\0') return NS_ERROR_NOT_AVAILABLE; + // this environment variable prevents us from launching + // the crash reporter client + const char* noReportEnv = PR_GetEnv("MOZ_CRASHREPORTER_NO_REPORT"); + if (noReportEnv && *noReportEnv) + doReport = false; + // allocate our strings crashReporterAPIData = new nsCString(); NS_ENSURE_TRUE(crashReporterAPIData, NS_ERROR_OUT_OF_MEMORY);