diff --git a/toolkit/crashreporter/client/crashreporter.cpp b/toolkit/crashreporter/client/crashreporter.cpp index 0dc1ee36596..72be3a0d2ee 100644 --- a/toolkit/crashreporter/client/crashreporter.cpp +++ b/toolkit/crashreporter/client/crashreporter.cpp @@ -230,6 +230,11 @@ static bool ReadConfig() if (!ReadStringsFromFile(iniPath, gStrings, true)) return false; + // See if we have a string override file, if so process it + char* overrideEnv = getenv("MOZ_CRASHREPORTER_STRINGS_OVERRIDE"); + if (overrideEnv && *overrideEnv && UIFileExists(overrideEnv)) + ReadStringsFromFile(overrideEnv, gStrings, true); + return true; } diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 88ae4c0a45a..55d2a89e092 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -2636,16 +2636,16 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData) // pass some basic info from the app data if (appData.vendor) CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Vendor"), - nsDependentCString(appData.vendor)); + nsDependentCString(appData.vendor)); if (appData.name) CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProductName"), - nsDependentCString(appData.name)); + nsDependentCString(appData.name)); if (appData.version) CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Version"), - nsDependentCString(appData.version)); + nsDependentCString(appData.version)); if (appData.buildID) CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("BuildID"), - nsDependentCString(appData.buildID)); + nsDependentCString(appData.buildID)); CrashReporter::SetRestartArgs(argc, argv); // annotate other data (user id etc) @@ -2654,9 +2654,31 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData) rv = dirProvider.Initialize(gAppData->directory, gAppData->xreDirectory); if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(dirProvider.GetUserAppDataDirectory( - getter_AddRefs(userAppDataDir)))) { + getter_AddRefs(userAppDataDir)))) { CrashReporter::SetupExtraData(userAppDataDir, nsDependentCString(appData.buildID)); + + // see if we have a crashreporter-override.ini in the application directory + nsCOMPtr overrideini; + PRBool exists; + static char overrideEnv[MAXPATHLEN]; + if (NS_SUCCEEDED(dirProvider.GetAppDir()->Clone(getter_AddRefs(overrideini))) && + NS_SUCCEEDED(overrideini->AppendNative(NS_LITERAL_CSTRING("crashreporter-override.ini"))) && + NS_SUCCEEDED(overrideini->Exists(&exists)) && + exists) { +#ifdef XP_WIN + nsAutoString overridePathW; + overrideini->GetPath(overridePathW); + NS_ConvertUTF16toUTF8 overridePath(overridePathW); +#else + nsAutoCString overridePath; + overrideini->GetNativePath(overridePath); +#endif + + sprintf(overrideEnv, "MOZ_CRASHREPORTER_STRINGS_OVERRIDE=%s", + overridePath.get()); + PR_SetEnv(overrideEnv); + } } } #endif