bug 412989 - allow per-app override of crashreporter.ini. r=bsmedberg

This commit is contained in:
ted.mielczarek%gmail.com 2008-01-26 16:49:30 +00:00
Родитель 82b476cba3
Коммит 03b2270665
2 изменённых файлов: 32 добавлений и 5 удалений

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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<nsIFile> 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