Bug 1077282: Cleanup uses of GreD vs GreBinD in our crashreporter, introcuded by v2 signature changes on OSX. r=bsmedberg

This commit is contained in:
Stephen Pohl 2014-10-10 15:07:01 -04:00
parent af02c5db64
commit b4db29c147
2 changed files with 19 additions and 21 deletions

View File

@ -1101,10 +1101,7 @@ nsresult SetExceptionHandler(nsIFile* aXREDirectory,
NS_ENSURE_SUCCESS(rv, rv);
#if defined(XP_MACOSX)
nsCOMPtr<nsIFile> parentPath;
exePath->GetParent(getter_AddRefs(parentPath));
exePath = parentPath.forget();
exePath->Append(NS_LITERAL_STRING("MacOS"));
exePath->SetNativeLeafName(NS_LITERAL_CSTRING("MacOS"));
exePath->Append(NS_LITERAL_STRING("crashreporter.app"));
exePath->Append(NS_LITERAL_STRING("Contents"));
exePath->Append(NS_LITERAL_STRING("MacOS"));

View File

@ -1043,31 +1043,29 @@ NS_IMETHODIMP
nsXULAppInfo::SetEnabled(bool aEnabled)
{
if (aEnabled) {
if (CrashReporter::GetEnabled())
if (CrashReporter::GetEnabled()) {
// no point in erroring for double-enabling
return NS_OK;
nsCOMPtr<nsIFile> xreDirectory;
if (gAppData) {
xreDirectory = gAppData->xreDirectory;
}
else {
// We didn't get started through XRE_Main, probably
nsCOMPtr<nsIFile> greDir;
NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(greDir));
if (!greDir)
return NS_ERROR_FAILURE;
xreDirectory = do_QueryInterface(greDir);
if (!xreDirectory)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIFile> greBinDir;
NS_GetSpecialDirectory(NS_GRE_BIN_DIR, getter_AddRefs(greBinDir));
if (!greBinDir) {
return NS_ERROR_FAILURE;
}
return CrashReporter::SetExceptionHandler(xreDirectory, true);
nsCOMPtr<nsIFile> xreBinDirectory = do_QueryInterface(greBinDir);
if (!xreBinDirectory) {
return NS_ERROR_FAILURE;
}
return CrashReporter::SetExceptionHandler(xreBinDirectory, true);
}
else {
if (!CrashReporter::GetEnabled())
if (!CrashReporter::GetEnabled()) {
// no point in erroring for double-disabling
return NS_OK;
}
return CrashReporter::UnsetExceptionHandler();
}
@ -3154,9 +3152,12 @@ XREMain::XRE_mainInit(bool* aExitFlag)
mAppData->flags |= NS_XRE_ENABLE_CRASH_REPORTER;
}
nsCOMPtr<nsIFile> xreBinDirectory;
xreBinDirectory = mDirProvider.GetGREBinDir();
if ((mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER) &&
NS_SUCCEEDED(
CrashReporter::SetExceptionHandler(mAppData->xreDirectory))) {
CrashReporter::SetExceptionHandler(xreBinDirectory))) {
nsCOMPtr<nsIFile> file;
rv = mDirProvider.GetUserAppDataDirectory(getter_AddRefs(file));
if (NS_SUCCEEDED(rv)) {