From ac282b5848d90db100955fee6ce47745f67e0f40 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 04:30:12 +0200 Subject: Merging upstream version 115.9.0esr. Signed-off-by: Daniel Baumann --- toolkit/crashreporter/client/crashreporter.cpp | 33 +++++++++++++++++++------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'toolkit/crashreporter/client/crashreporter.cpp') diff --git a/toolkit/crashreporter/client/crashreporter.cpp b/toolkit/crashreporter/client/crashreporter.cpp index 4426e6446c..a14ea14fbc 100644 --- a/toolkit/crashreporter/client/crashreporter.cpp +++ b/toolkit/crashreporter/client/crashreporter.cpp @@ -753,16 +753,31 @@ int main(int argc, char** argv) { vector restartArgs; - ostringstream paramName; - int i = 0; - paramName << "MOZ_CRASHREPORTER_RESTART_ARG_" << i++; - const char* param = getenv(paramName.str().c_str()); - while (param && *param) { - restartArgs.push_back(param); - - paramName.str(""); + if (!extraData.isMember("WindowsErrorReporting")) { + // We relaunch the application associated with the client, but only when + // we encountered a crash caught by the exception handler. Crashes handled + // by WER are prevented from directly restarting the application. + string programPath = GetProgramPath(MOZ_APP_NAME); +#ifndef XP_WIN + const char* moz_app_launcher = getenv("MOZ_APP_LAUNCHER"); + if (moz_app_launcher) { + programPath = moz_app_launcher; + } +#endif // XP_WIN + + restartArgs.push_back(programPath); + + ostringstream paramName; + int i = 1; paramName << "MOZ_CRASHREPORTER_RESTART_ARG_" << i++; - param = getenv(paramName.str().c_str()); + const char* param = getenv(paramName.str().c_str()); + while (param && *param) { + restartArgs.push_back(param); + + paramName.str(""); + paramName << "MOZ_CRASHREPORTER_RESTART_ARG_" << i++; + param = getenv(paramName.str().c_str()); + } } // allow override of the server url via environment variable -- cgit v1.2.3