From 95629996c4e60d6a20f4caaab44882f53068a8a0 Mon Sep 17 00:00:00 2001 From: "ted.mielczarek%gmail.com" Date: Tue, 8 May 2007 15:15:20 +0000 Subject: [PATCH] bug 379290 - add some environment variables to support use in automated testing - add MOZ_CRASHREPORTER_NO_REPORT. r=bsmedberg --- toolkit/airbag/nsAirbagExceptionHandler.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) 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);