Bug 1402519 - Remove MOZ_CRASHREPORTER directives from toolkit; r?mossop draft
authorGabriele Svelto <gsvelto@mozilla.com>
Tue, 10 Oct 2017 15:56:48 +0200
changeset 688686 a827f4935a9f0143cf2feff79f77ec5a6bf4a4c9
parent 688685 5128a58ded9c279b7d135ae9ab9818b6012e6772
child 688687 c447f6731597de88c173994d9816441c69e9981e
push id86821
push usergsvelto@mozilla.com
push dateMon, 30 Oct 2017 14:19:43 +0000
reviewersmossop
bugs1402519
milestone58.0a1
Bug 1402519 - Remove MOZ_CRASHREPORTER directives from toolkit; r?mossop MozReview-Commit-ID: GsnhrLJYkqG
toolkit/components/places/tests/gtest/places_test_harness_tail.h
toolkit/components/terminator/nsTerminator.cpp
toolkit/xre/nsAndroidStartup.cpp
toolkit/xre/nsAppRunner.cpp
toolkit/xre/nsEmbedFunctions.cpp
toolkit/xre/nsX11ErrorHandler.cpp
--- a/toolkit/components/places/tests/gtest/places_test_harness_tail.h
+++ b/toolkit/components/places/tests/gtest/places_test_harness_tail.h
@@ -1,19 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsWidgetsCID.h"
 #include "nsIComponentRegistrar.h"
-#ifdef MOZ_CRASHREPORTER
 #include "nsICrashReporter.h"
-#endif
 
 #ifndef TEST_NAME
 #error "Must #define TEST_NAME before including places_test_harness_tail.h"
 #endif
 
 int gTestsIndex = 0;
 
 #define TEST_INFO_STR "TEST-INFO | "
--- a/toolkit/components/terminator/nsTerminator.cpp
+++ b/toolkit/components/terminator/nsTerminator.cpp
@@ -24,19 +24,17 @@
 
 #include "nsString.h"
 #include "nsServiceManagerUtils.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsAppDirectoryServiceDefs.h"
 
 #include "nsIObserverService.h"
 #include "nsIPrefService.h"
-#if defined(MOZ_CRASHREPORTER)
 #include "nsExceptionHandler.h"
-#endif
 #include "GeckoProfiler.h"
 #include "nsThreadUtils.h"
 
 #if defined(XP_WIN)
 #include <windows.h>
 #else
 #include <unistd.h>
 #endif
@@ -538,19 +536,17 @@ nsTerminator::UpdateTelemetry()
   PR_EnterMonitor(gWriteReady);
   PR_Notify(gWriteReady);
   PR_ExitMonitor(gWriteReady);
 }
 
 void
 nsTerminator::UpdateCrashReport(const char* aTopic)
 {
-#if defined(MOZ_CRASHREPORTER)
   // In case of crash, we wish to know where in shutdown we are
   nsAutoCString report(aTopic);
 
   Unused << CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ShutdownProgress"),
                                                report);
-#endif // defined(MOZ_CRASHREPORTER)
 }
 
 
 } // namespace mozilla
--- a/toolkit/xre/nsAndroidStartup.cpp
+++ b/toolkit/xre/nsAndroidStartup.cpp
@@ -24,24 +24,22 @@
 
 using namespace mozilla;
 
 extern "C" NS_EXPORT void
 GeckoStart(JNIEnv* env, char** argv, int argc, const StaticXREAppData& aAppData)
 {
     mozilla::jni::SetGeckoThreadEnv(env);
 
-#ifdef MOZ_CRASHREPORTER
     const struct mapping_info *info = getLibraryMapping();
     while (info->name) {
       CrashReporter::AddLibraryMapping(info->name, info->base,
                                        info->len, info->offset);
       info++;
     }
-#endif
 
     if (!argv) {
         LOG("Failed to get arguments for GeckoStart\n");
         return;
     }
 
     BootstrapConfig config;
     config.appData = &aAppData;
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -192,26 +192,24 @@
 #ifdef DEBUG
 #include "mozilla/Logging.h"
 #endif
 
 #ifdef MOZ_JPROF
 #include "jprof.h"
 #endif
 
-#ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
 #include "nsICrashReporter.h"
 #define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
 #include "nsIPrefService.h"
 #include "nsIMemoryInfoDumper.h"
 #if defined(XP_LINUX) && !defined(ANDROID)
 #include "mozilla/widget/LSBUtils.h"
 #endif
-#endif
 
 #include "base/command_line.h"
 #include "GTestRunner.h"
 
 #ifdef MOZ_WIDGET_ANDROID
 #include "GeneratedJNIWrappers.h"
 #endif
 
@@ -693,50 +691,44 @@ bool gSafeMode = false;
  * The nsXULAppInfo object implements nsIFactory so that it can be its own
  * singleton.
  */
 class nsXULAppInfo : public nsIXULAppInfo,
                      public nsIObserver,
 #ifdef XP_WIN
                      public nsIWinAppHelper,
 #endif
-#ifdef MOZ_CRASHREPORTER
                      public nsICrashReporter,
                      public nsIFinishDumpingCallback,
-#endif
                      public nsIXULRuntime
 
 {
 public:
   constexpr nsXULAppInfo() {}
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIPLATFORMINFO
   NS_DECL_NSIXULAPPINFO
   NS_DECL_NSIXULRUNTIME
   NS_DECL_NSIOBSERVER
-#ifdef MOZ_CRASHREPORTER
   NS_DECL_NSICRASHREPORTER
   NS_DECL_NSIFINISHDUMPINGCALLBACK
-#endif
 #ifdef XP_WIN
   NS_DECL_NSIWINAPPHELPER
 #endif
 };
 
 NS_INTERFACE_MAP_BEGIN(nsXULAppInfo)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXULRuntime)
   NS_INTERFACE_MAP_ENTRY(nsIXULRuntime)
   NS_INTERFACE_MAP_ENTRY(nsIObserver)
 #ifdef XP_WIN
   NS_INTERFACE_MAP_ENTRY(nsIWinAppHelper)
 #endif
-#ifdef MOZ_CRASHREPORTER
   NS_INTERFACE_MAP_ENTRY(nsICrashReporter)
   NS_INTERFACE_MAP_ENTRY(nsIFinishDumpingCallback)
-#endif
   NS_INTERFACE_MAP_ENTRY(nsIPlatformInfo)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIXULAppInfo, gAppData ||
                                      XRE_IsContentProcess())
 NS_INTERFACE_MAP_END
 
 NS_IMETHODIMP_(MozExternalRefCountType)
 nsXULAppInfo::AddRef()
 {
@@ -1104,22 +1096,18 @@ nsXULAppInfo::GetReplacedLockTime(PRTime
     return NS_ERROR_NOT_AVAILABLE;
   gProfileLock->GetReplacedLockTime(aReplacedLockTime);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULAppInfo::GetLastRunCrashID(nsAString &aLastRunCrashID)
 {
-#ifdef MOZ_CRASHREPORTER
   CrashReporter::GetLastRunCrashID(aLastRunCrashID);
   return NS_OK;
-#else
-  return NS_ERROR_NOT_IMPLEMENTED;
-#endif
 }
 
 NS_IMETHODIMP
 nsXULAppInfo::GetIsReleaseOrBeta(bool* aResult)
 {
 #ifdef RELEASE_OR_BETA
   *aResult = true;
 #else
@@ -1206,17 +1194,16 @@ nsXULAppInfo::GetUserCanElevate(bool *aU
 
   if (hToken)
     CloseHandle(hToken);
 
   return NS_OK;
 }
 #endif
 
-#ifdef MOZ_CRASHREPORTER
 NS_IMETHODIMP
 nsXULAppInfo::GetEnabled(bool *aEnabled)
 {
   *aEnabled = CrashReporter::GetEnabled();
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -1436,17 +1423,16 @@ NS_IMETHODIMP
 nsXULAppInfo::Callback(nsISupports* aData)
 {
   nsCOMPtr<nsIFile> file = do_QueryInterface(aData);
   MOZ_ASSERT(file);
 
   CrashReporter::SetMemoryReportFile(file);
   return NS_OK;
 }
-#endif
 
 static const nsXULAppInfo kAppInfo;
 static nsresult AppInfoConstructor(nsISupports* aOuter,
                                    REFNSIID aIID, void **aResult)
 {
   NS_ENSURE_NO_AGGREGATION(aOuter);
 
   return const_cast<nsXULAppInfo*>(&kAppInfo)->
@@ -1542,19 +1528,17 @@ static const mozilla::Module::CIDEntry k
   { &kProfileServiceCID, false, ProfileServiceFactoryConstructor, nullptr },
   { &kNativeAppSupportCID, false, nullptr, ScopedXPCOMStartup::CreateAppSupport },
   { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kXREContracts[] = {
   { XULAPPINFO_SERVICE_CONTRACTID, &kAPPINFO_CID },
   { XULRUNTIME_SERVICE_CONTRACTID, &kAPPINFO_CID },
-#ifdef MOZ_CRASHREPORTER
   { NS_CRASHREPORTER_CONTRACTID, &kAPPINFO_CID },
-#endif
   { NS_PROFILESERVICE_CONTRACTID, &kProfileServiceCID },
   { NS_NATIVEAPPSUPPORT_CONTRACTID, &kNativeAppSupportCID },
   { nullptr }
 };
 
 static const mozilla::Module kXREModule = {
   mozilla::Module::kVersion,
   kXRECIDs,
@@ -2891,17 +2875,16 @@ static void SaveStateForAppInitiatedRest
 static void RestoreStateForAppInitiatedRestart()
 {
   for (auto & savedVar : gSavedVars) {
     if (savedVar.value)
       PR_SetEnv(savedVar.value);
   }
 }
 
-#ifdef MOZ_CRASHREPORTER
 // When we first initialize the crash reporter we don't have a profile,
 // so we set the minidump path to $TEMP.  Once we have a profile,
 // we set it to $PROFILE/minidumps, creating the directory
 // if needed.
 static void MakeOrSetMinidumpPath(nsIFile* profD)
 {
   nsCOMPtr<nsIFile> dumpD;
   profD->Clone(getter_AddRefs(dumpD));
@@ -2916,17 +2899,16 @@ static void MakeOrSetMinidumpPath(nsIFil
       NS_ENSURE_SUCCESS_VOID(rv);
     }
 
     nsAutoString pathStr;
     if (NS_SUCCEEDED(dumpD->GetPath(pathStr)))
       CrashReporter::SetMinidumpPath(pathStr);
   }
 }
-#endif
 
 const XREAppData* gAppData = nullptr;
 
 #ifdef MOZ_WIDGET_GTK
 static void MOZ_gdk_display_close(GdkDisplay *display)
 {
 #if CLEANUP_MEMORY
   // XXX wallpaper for bug 417163: don't close the Display if we're using the
@@ -3344,17 +3326,16 @@ XREMain::XRE_mainInit(bool* aExitFlag)
            (const char*) mAppData->maxVersion);
     return 1;
   }
 
   rv = mDirProvider.Initialize(mAppData->directory, mAppData->xreDirectory);
   if (NS_FAILED(rv))
     return 1;
 
-#ifdef MOZ_CRASHREPORTER
   if (EnvHasValue("MOZ_CRASHREPORTER")) {
     mAppData->flags |= NS_XRE_ENABLE_CRASH_REPORTER;
   }
 
   nsCOMPtr<nsIFile> xreBinDirectory;
   xreBinDirectory = mDirProvider.GetGREBinDir();
 
   if ((mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER) &&
@@ -3430,17 +3411,16 @@ XREMain::XRE_mainInit(bool* aExitFlag)
         nsAutoCString overridePath;
         overrideini->GetNativePath(overridePath);
 #endif
 
         SaveWordToEnv("MOZ_CRASHREPORTER_STRINGS_OVERRIDE", overridePath);
       }
     }
   }
-#endif
 
 #if defined(MOZ_SANDBOX) && defined(XP_WIN)
   if (mAppData->sandboxBrokerServices) {
     SandboxBroker::Initialize(mAppData->sandboxBrokerServices);
   } else {
 #if defined(MOZ_CONTENT_SANDBOX)
     // If we're sandboxing content and we fail to initialize, then crashing here
     // seems like the sensible option.
@@ -3580,31 +3560,27 @@ XREMain::XRE_mainInit(bool* aExitFlag)
           } else if (vtype == REG_DWORD && len == sizeof(updateRevision[0])) {
             cpuUpdateRevision = static_cast<int>(updateRevision[0]);
             break;
           }
         }
       }
     }
 
-#ifdef MOZ_CRASHREPORTER
     if (cpuUpdateRevision > 0) {
       CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CPUMicrocodeVersion"),
                                          nsPrintfCString("0x%x",
                                                          cpuUpdateRevision));
     }
-#endif
   }
 #endif
 
-#ifdef MOZ_CRASHREPORTER
     CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("SafeMode"),
                                        gSafeMode ? NS_LITERAL_CSTRING("1") :
                                                    NS_LITERAL_CSTRING("0"));
-#endif
 
   // Handle --no-remote and --new-instance command line arguments. Setup
   // the environment to better accommodate other components and various
   // restart scenarios.
   ar = CheckArg("no-remote", true);
   if (ar == ARG_BAD) {
     PR_fprintf(PR_STDERR, "Error: argument --no-remote is invalid when argument --osint is specified\n");
     return 1;
@@ -3658,17 +3634,16 @@ XREMain::XRE_mainInit(bool* aExitFlag)
     }
     *aExitFlag = true;
     return 0;
   }
 
   return 0;
 }
 
-#ifdef MOZ_CRASHREPORTER
 #ifdef XP_WIN
 /**
  * Uses WMI to read some manufacturer information that may be useful for
  * diagnosing hardware-specific crashes. This function is best-effort; failures
  * shouldn't burden the caller. COM must be initialized before calling.
  */
 static void AnnotateSystemManufacturer()
 {
@@ -3752,18 +3727,16 @@ AnnotateLSBRelease(void*)
   nsCString dist, desc, release, codename;
   if (widget::lsb::GetLSBRelease(dist, desc, release, codename)) {
     CrashReporter::AppendAppNotesToCrashReport(desc);
   }
 }
 
 #endif // defined(XP_LINUX) && !defined(ANDROID)
 
-#endif
-
 #ifdef XP_WIN
 static void ReadAheadDll(const wchar_t* dllName) {
   wchar_t dllPath[MAX_PATH];
   if (ConstructSystem32Path(dllName, dllPath, MAX_PATH)) {
     ReadAheadLib(dllPath);
   }
 }
 
@@ -4184,22 +4157,20 @@ XREMain::XRE_mainStartup(bool* aExitFlag
 
   rv = mDirProvider.SetProfile(mProfD, mProfLD);
   NS_ENSURE_SUCCESS(rv, 1);
 
   //////////////////////// NOW WE HAVE A PROFILE ////////////////////////
 
   mozilla::Telemetry::SetProfileDir(mProfD);
 
-#ifdef MOZ_CRASHREPORTER
   if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER)
       MakeOrSetMinidumpPath(mProfD);
 
   CrashReporter::SetProfileDirectory(mProfD);
-#endif
 
   nsAutoCString version;
   BuildVersion(version);
 
 #ifdef TARGET_OS_ABI
   NS_NAMED_LITERAL_CSTRING(osABI, TARGET_OS_ABI);
 #else
   // No TARGET_XPCOM_ABI, but at least the OS is known
@@ -4280,17 +4251,16 @@ XREMain::XRE_mainStartup(bool* aExitFlag
 
   if (flagFile) {
     flagFile->Remove(true);
   }
 
   return 0;
 }
 
-#if defined(MOZ_CRASHREPORTER)
 #if defined(MOZ_CONTENT_SANDBOX)
 void AddSandboxAnnotations()
 {
   // Include the sandbox content level, regardless of platform
   int level = GetEffectiveContentSandboxLevel();
 
   nsAutoCString levelString;
   levelString.AppendInt(level);
@@ -4311,17 +4281,16 @@ void AddSandboxAnnotations()
   sandboxCapable = SandboxInfo::Get().CanSandboxContent();
 #endif
 
   CrashReporter::AnnotateCrashReport(
     NS_LITERAL_CSTRING("ContentSandboxCapable"),
     sandboxCapable ? NS_LITERAL_CSTRING("1") : NS_LITERAL_CSTRING("0"));
 }
 #endif /* MOZ_CONTENT_SANDBOX */
-#endif /* MOZ_CRASHREPORTER */
 
 /*
  * XRE_mainRun - Command line startup, profile migration, and
  * the calling of appStartup->Run().
  */
 nsresult
 XREMain::XRE_mainRun()
 {
@@ -4346,17 +4315,16 @@ XREMain::XRE_mainRun()
 
     comp = do_GetService("@mozilla.org/focus-event-suppressor-service;1");
   }
 #endif
 
   rv = mScopedXPCOM->SetWindowCreator(mNativeApp);
   NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
 
-#ifdef MOZ_CRASHREPORTER
   // tell the crash reporter to also send the release channel
   nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
   if (NS_SUCCEEDED(rv)) {
     nsCOMPtr<nsIPrefBranch> defaultPrefBranch;
     rv = prefs->GetDefaultBranch(nullptr, getter_AddRefs(defaultPrefBranch));
 
     if (NS_SUCCEEDED(rv)) {
       nsCString sval;
@@ -4382,18 +4350,16 @@ XREMain::XRE_mainRun()
                   PR_PRIORITY_LOW, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0);
 #endif
 
 #if defined(XP_LINUX) && !defined(ANDROID)
   PR_CreateThread(PR_USER_THREAD, AnnotateLSBRelease, 0, PR_PRIORITY_LOW,
                   PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0);
 #endif
 
-#endif
-
   if (mStartOffline) {
     nsCOMPtr<nsIIOService2> io (do_GetService("@mozilla.org/network/io-service;1"));
     NS_ENSURE_TRUE(io, NS_ERROR_FAILURE);
     io->SetManageOfflineStatus(false);
     io->SetOffline(true);
   }
 
 
@@ -4511,21 +4477,19 @@ XREMain::XRE_mainRun()
   nsCOMPtr<nsIAppStartup> appStartup
     (do_GetService(NS_APPSTARTUP_CONTRACTID));
   NS_ENSURE_TRUE(appStartup, NS_ERROR_FAILURE);
 
   mDirProvider.DoStartup();
 
   OverrideDefaultLocaleIfNeeded();
 
-#ifdef MOZ_CRASHREPORTER
   nsCString userAgentLocale;
   LocaleService::GetInstance()->GetAppLocaleAsLangTag(userAgentLocale);
   CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("useragent_locale"), userAgentLocale);
-#endif
 
   appStartup->GetShuttingDown(&mShuttingDown);
 
   nsCOMPtr<nsICommandLineRunner> cmdLine;
 
   nsCOMPtr<nsIFile> workingDir;
   rv = NS_GetSpecialDirectory(NS_OS_CURRENT_WORKING_DIR, getter_AddRefs(workingDir));
   NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
@@ -4606,20 +4570,18 @@ XREMain::XRE_mainRun()
 
     nsCOMPtr<nsIObserverService> obsService =
       mozilla::services::GetObserverService();
     if (obsService)
       obsService->NotifyObservers(nullptr, "final-ui-startup", nullptr);
 
     (void)appStartup->DoneStartingUp();
 
-#ifdef MOZ_CRASHREPORTER
     CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("StartupCrash"),
                                        NS_LITERAL_CSTRING("0"));
-#endif
 
     appStartup->GetShuttingDown(&mShuttingDown);
   }
 
   if (!mShuttingDown) {
     rv = cmdLine->Run();
     NS_ENSURE_SUCCESS_LOG(rv, NS_ERROR_FAILURE);
 
@@ -4662,30 +4624,26 @@ XREMain::XRE_mainRun()
   Telemetry::Accumulate(Telemetry::SANDBOX_HAS_USER_NAMESPACES_PRIVILEGED,
                         sandboxInfo.Test(SandboxInfo::kHasPrivilegedUserNamespaces));
   Telemetry::Accumulate(Telemetry::SANDBOX_HAS_USER_NAMESPACES,
                         sandboxInfo.Test(SandboxInfo::kHasUserNamespaces));
   Telemetry::Accumulate(Telemetry::SANDBOX_CONTENT_ENABLED,
                         sandboxInfo.Test(SandboxInfo::kEnabledForContent));
   Telemetry::Accumulate(Telemetry::SANDBOX_MEDIA_ENABLED,
                         sandboxInfo.Test(SandboxInfo::kEnabledForMedia));
-#if defined(MOZ_CRASHREPORTER)
   nsAutoCString flagsString;
   flagsString.AppendInt(sandboxInfo.AsInteger());
 
   CrashReporter::AnnotateCrashReport(
     NS_LITERAL_CSTRING("ContentSandboxCapabilities"), flagsString);
-#endif /* MOZ_CRASHREPORTER */
 #endif /* MOZ_SANDBOX && XP_LINUX */
 
-#if defined(MOZ_CRASHREPORTER)
 #if defined(MOZ_CONTENT_SANDBOX)
   AddSandboxAnnotations();
 #endif /* MOZ_CONTENT_SANDBOX */
-#endif /* MOZ_CRASHREPORTER */
 
   {
     rv = appStartup->Run();
     if (NS_FAILED(rv)) {
       NS_ERROR("failed to run appstartup");
       gLogConsoleErrors = true;
     }
   }
@@ -4900,35 +4858,32 @@ XREMain::XRE_main(int argc, char* argv[]
       MOZ_gdk_display_close(mGdkDisplay);
     }
 #endif
 
     {
       rv = LaunchChild(mNativeApp, true);
     }
 
-#ifdef MOZ_CRASHREPORTER
     if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER)
       CrashReporter::UnsetExceptionHandler();
-#endif
+
     return rv == NS_ERROR_LAUNCHED_CHILD_PROCESS ? 0 : 1;
   }
 
 #ifdef MOZ_WIDGET_GTK
   // gdk_display_close also calls gdk_display_manager_set_default_display
   // appropriately when necessary.
   if (!gfxPlatform::IsHeadless()) {
     MOZ_gdk_display_close(mGdkDisplay);
   }
 #endif
 
-#ifdef MOZ_CRASHREPORTER
   if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER)
       CrashReporter::UnsetExceptionHandler();
-#endif
 
   XRE_DeinitCommandLine();
 
   return NS_FAILED(rv) ? 1 : 0;
 }
 
 void
 XRE_StopLateWriteChecks(void) {
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -238,19 +238,17 @@ GeckoProcessType sChildProcessType = Gec
 } // namespace startup
 } // namespace mozilla
 
 #if defined(MOZ_WIDGET_ANDROID)
 void
 XRE_SetAndroidChildFds (JNIEnv* env, int crashFd, int ipcFd)
 {
   mozilla::jni::SetGeckoThreadEnv(env);
-#if defined(MOZ_CRASHREPORTER)
   CrashReporter::SetNotificationPipeForChild(crashFd);
-#endif // defined(MOZ_CRASHREPORTER)
   IPC::Channel::SetClientChannelFd(ipcFd);
 }
 #endif // defined(MOZ_WIDGET_ANDROID)
 
 void
 XRE_SetProcessType(const char* aProcessTypeString)
 {
   static bool called = false;
@@ -265,17 +263,16 @@ XRE_SetProcessType(const char* aProcessT
        ++i) {
     if (!strcmp(kGeckoProcessTypeString[i], aProcessTypeString)) {
       sChildProcessType = static_cast<GeckoProcessType>(i);
       return;
     }
   }
 }
 
-#if defined(MOZ_CRASHREPORTER)
 // FIXME/bug 539522: this out-of-place function is stuck here because
 // IPDL wants access to this crashreporter interface, and
 // crashreporter is built in such a way to make that awkward
 bool
 XRE_TakeMinidumpForChild(uint32_t aChildPid, nsIFile** aDump,
                          uint32_t* aSequence)
 {
   return CrashReporter::TakeMinidumpForChild(aChildPid, aDump, aSequence);
@@ -287,43 +284,40 @@ XRE_SetRemoteExceptionHandler(const char
 #if defined(XP_WIN) || defined(XP_MACOSX)
   return CrashReporter::SetRemoteExceptionHandler(nsDependentCString(aPipe));
 #elif defined(OS_LINUX)
   return CrashReporter::SetRemoteExceptionHandler();
 #else
 #  error "OOP crash reporter unsupported on this platform"
 #endif
 }
-#endif // if defined(MOZ_CRASHREPORTER)
 
 #if defined(XP_WIN)
 void
 SetTaskbarGroupId(const nsString& aId)
 {
     if (FAILED(SetCurrentProcessExplicitAppUserModelID(aId.get()))) {
         NS_WARNING("SetCurrentProcessExplicitAppUserModelID failed for child process.");
     }
 }
 #endif
 
-#if defined(MOZ_CRASHREPORTER)
 #if defined(MOZ_CONTENT_SANDBOX)
 void
 AddContentSandboxLevelAnnotation()
 {
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
     int level = GetEffectiveContentSandboxLevel();
     nsAutoCString levelString;
     levelString.AppendInt(level);
     CrashReporter::AnnotateCrashReport(
       NS_LITERAL_CSTRING("ContentSandboxLevel"), levelString);
   }
 }
 #endif /* MOZ_CONTENT_SANDBOX */
-#endif /* MOZ_CRASHREPORTER */
 
 namespace {
 
 int GetDebugChildPauseTime() {
   auto pauseStr = PR_GetEnv("MOZ_DEBUG_CHILD_PAUSE");
   if (pauseStr && *pauseStr) {
     int pause = atoi(pauseStr);
     if (pause != 1) { // must be !=1 since =1 enables the default pause time
@@ -478,45 +472,47 @@ XRE_InitChildProcess(int aArgc,
     NS_WARNING("child task_set_bootstrap_port() failed");
     return NS_ERROR_FAILURE;
   }
 
 #endif
 
   SetupErrorHandling(aArgv[0]);
 
-#if defined(MOZ_CRASHREPORTER)
-  if (aArgc < 1)
-    return NS_ERROR_FAILURE;
-  const char* const crashReporterArg = aArgv[--aArgc];
+  if (!CrashReporter::IsDummy()) {
+    if (aArgc < 1) {
+      return NS_ERROR_FAILURE;
+    }
+
+    const char* const crashReporterArg = aArgv[--aArgc];
 
-#  if defined(XP_WIN) || defined(XP_MACOSX)
-  // on windows and mac, |crashReporterArg| is the named pipe on which the
-  // server is listening for requests, or "-" if crash reporting is
-  // disabled.
-  if (0 != strcmp("-", crashReporterArg) &&
-      !XRE_SetRemoteExceptionHandler(crashReporterArg)) {
-    // Bug 684322 will add better visibility into this condition
-    NS_WARNING("Could not setup crash reporting\n");
+#if defined(XP_WIN) || defined(XP_MACOSX)
+    // on windows and mac, |crashReporterArg| is the named pipe on which the
+    // server is listening for requests, or "-" if crash reporting is
+    // disabled.
+    if (0 != strcmp("-", crashReporterArg) &&
+        !XRE_SetRemoteExceptionHandler(crashReporterArg)) {
+      // Bug 684322 will add better visibility into this condition
+      NS_WARNING("Could not setup crash reporting\n");
+    }
+#elif defined(OS_LINUX)
+    // on POSIX, |crashReporterArg| is "true" if crash reporting is
+    // enabled, false otherwise
+    if (0 != strcmp("false", crashReporterArg) &&
+        !XRE_SetRemoteExceptionHandler(nullptr)) {
+      // Bug 684322 will add better visibility into this condition
+      NS_WARNING("Could not setup crash reporting\n");
+    }
+#else
+#  error "OOP crash reporting unsupported on this platform"
+#endif
   }
-#  elif defined(OS_LINUX)
-  // on POSIX, |crashReporterArg| is "true" if crash reporting is
-  // enabled, false otherwise
-  if (0 != strcmp("false", crashReporterArg) &&
-      !XRE_SetRemoteExceptionHandler(nullptr)) {
-    // Bug 684322 will add better visibility into this condition
-    NS_WARNING("Could not setup crash reporting\n");
-  }
-#  else
-#    error "OOP crash reporting unsupported on this platform"
-#  endif
 
   // For Init/Shutdown thread name annotations in the crash reporter.
   CrashReporter::InitThreadAnnotationRAII annotation;
-#endif // if defined(MOZ_CRASHREPORTER)
 
   gArgv = aArgv;
   gArgc = aArgc;
 
 #ifdef MOZ_X11
   XInitThreads();
 #endif
 #if MOZ_WIDGET_GTK == 2
@@ -667,42 +663,38 @@ XRE_InitChildProcess(int aArgc,
       default:
         MOZ_CRASH("Unknown main thread class");
       }
 
       if (!process->Init(aArgc, aArgv)) {
         return NS_ERROR_FAILURE;
       }
 
-#ifdef MOZ_CRASHREPORTER
 #if defined(XP_WIN) || defined(XP_MACOSX)
       CrashReporter::InitChildProcessTmpDir(crashReportTmpDir);
 #endif
-#endif
 
 #if defined(XP_WIN)
       // Set child processes up such that they will get killed after the
       // chrome process is killed in cases where the user shuts the system
       // down or logs off.
       ::SetProcessShutdownParameters(0x280 - 1, SHUTDOWN_NORETRY);
 #endif
 
 #if defined(MOZ_SANDBOX) && defined(XP_WIN)
       // We need to do this after the process has been initialised, as
       // InitLoggingIfRequired may need access to prefs.
       mozilla::sandboxing::InitLoggingIfRequired(aChildData->ProvideLogFunction);
 #endif
 
       OverrideDefaultLocaleIfNeeded();
 
-#if defined(MOZ_CRASHREPORTER)
 #if defined(MOZ_CONTENT_SANDBOX)
       AddContentSandboxLevelAnnotation();
 #endif
-#endif
 
       // Run the UI event loop on the main thread.
       uiMessageLoop.MessageLoop::Run();
 
       // Allow ProcessChild to clean up after itself before going out of
       // scope and being deleted
       process->CleanUp();
       mozilla::Omnijar::CleanUp();
--- a/toolkit/xre/nsX11ErrorHandler.cpp
+++ b/toolkit/xre/nsX11ErrorHandler.cpp
@@ -112,27 +112,25 @@ X11Error(Display *display, XErrorEvent *
       notes.AppendLiteral("; sync");
     } else {
       notes.AppendLiteral("; ");
       notes.AppendInt(uint32_t(age));
       notes.AppendLiteral(" requests ago");
     }
   }
 
-#ifdef MOZ_CRASHREPORTER
   switch (XRE_GetProcessType()) {
   case GeckoProcessType_Default:
   case GeckoProcessType_Plugin:
   case GeckoProcessType_Content:
     CrashReporter::AppendAppNotesToCrashReport(notes);
     break;
   default:
     ; // crash report notes not supported.
   }
-#endif
 
 #ifdef DEBUG
   // The resource id is unlikely to be useful in a crash report without
   // context of other ids, but add it to the debug console output.
   notes.AppendLiteral("; id=0x");
   notes.AppendInt(uint32_t(event->resourceid), 16);
 #ifdef MOZ_X11
   // Actually, for requests where Xlib gets the reply synchronously,