Bug 1402519 - Remove MOZ_CRASHREPORTER directives from xpcom; r=froydnj
authorGabriele Svelto <gsvelto@mozilla.com>
Tue, 10 Oct 2017 11:59:39 +0200
changeset 393539 5bd0686052829656cd02ed55f5cd16c29f4894b7
parent 393538 dfab473522a879041329425a4d19f31b1ecefce4
child 393540 4c24fa3a323b29d2a64188f83412eaa89a26a231
push id32962
push useraiakab@mozilla.com
push dateFri, 24 Nov 2017 10:01:11 +0000
treeherdermozilla-central@f2e36fbb90fa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1402519
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1402519 - Remove MOZ_CRASHREPORTER directives from xpcom; r=froydnj MozReview-Commit-ID: HS3M0DJQ3qc
xpcom/base/CycleCollectedJSContext.cpp
xpcom/base/CycleCollectedJSRuntime.cpp
xpcom/base/nsCrashOnException.cpp
xpcom/base/nsCycleCollector.cpp
xpcom/base/nsDebugImpl.cpp
xpcom/base/nsObjCExceptions.h
xpcom/build/nsXULAppAPI.h
xpcom/system/moz.build
xpcom/tests/gtest/TestDeadlockDetector.cpp
xpcom/tests/gtest/TestPLDHash.cpp
xpcom/tests/gtest/TestSTLWrappers.cpp
xpcom/threads/HangMonitor.cpp
xpcom/threads/nsThread.cpp
xpcom/threads/nsThread.h
xpcom/threads/nsThreadUtils.cpp
--- a/xpcom/base/CycleCollectedJSContext.cpp
+++ b/xpcom/base/CycleCollectedJSContext.cpp
@@ -32,20 +32,16 @@
 #include "nsCycleCollectionParticipant.h"
 #include "nsCycleCollector.h"
 #include "nsDOMJSUtils.h"
 #include "nsDOMMutationObserver.h"
 #include "nsJSUtils.h"
 #include "nsWrapperCache.h"
 #include "nsStringBuffer.h"
 
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
 #include "nsIException.h"
 #include "nsIPlatformInfo.h"
 #include "nsThread.h"
 #include "nsThreadUtils.h"
 #include "xpcpublic.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
--- a/xpcom/base/CycleCollectedJSRuntime.cpp
+++ b/xpcom/base/CycleCollectedJSRuntime.cpp
@@ -76,29 +76,26 @@
 #include "jsprf.h"
 #include "js/Debug.h"
 #include "js/GCAPI.h"
 #include "nsContentUtils.h"
 #include "nsCycleCollectionNoteRootCallback.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsCycleCollector.h"
 #include "nsDOMJSUtils.h"
+#include "nsExceptionHandler.h"
 #include "nsJSUtils.h"
 #include "nsWrapperCache.h"
 #include "nsStringBuffer.h"
 #include "GeckoProfiler.h"
 
 #ifdef MOZ_GECKO_PROFILER
 #include "ProfilerMarkerPayload.h"
 #endif
 
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
 #include "nsIException.h"
 #include "nsIPlatformInfo.h"
 #include "nsThread.h"
 #include "nsThreadUtils.h"
 #include "xpcpublic.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
@@ -540,20 +537,19 @@ CycleCollectedJSRuntime::CycleCollectedJ
       aCx, GCNurseryCollectionCallback);
   }
 
   JS_SetObjectsTenuredCallback(aCx, JSObjectsTenuredCb, this);
   JS::SetOutOfMemoryCallback(aCx, OutOfMemoryCallback, this);
   JS_SetExternalStringSizeofCallback(aCx, SizeofExternalStringCallback);
   JS::SetBuildIdOp(aCx, GetBuildId);
   JS::SetWarningReporter(aCx, MozCrashWarningReporter);
-#ifdef MOZ_CRASHREPORTER
-    js::AutoEnterOOMUnsafeRegion::setAnnotateOOMAllocationSizeCallback(
-            CrashReporter::AnnotateOOMAllocationSize);
-#endif
+
+  js::AutoEnterOOMUnsafeRegion::setAnnotateOOMAllocationSizeCallback(
+    CrashReporter::AnnotateOOMAllocationSize);
 
   static js::DOMCallbacks DOMcallbacks = {
     InstanceClassHasProtoAtDepth
   };
   SetDOMCallbacks(aCx, &DOMcallbacks);
   js::SetScriptEnvironmentPreparer(aCx, &mEnvironmentPreparer);
 
   JS::dbg::SetDebuggerMallocSizeOf(aCx, moz_malloc_size_of);
@@ -1442,46 +1438,42 @@ CycleCollectedJSRuntime::FinalizeDeferre
   }
 }
 
 void
 CycleCollectedJSRuntime::AnnotateAndSetOutOfMemory(OOMState* aStatePtr,
                                                    OOMState aNewState)
 {
   *aStatePtr = aNewState;
-#ifdef MOZ_CRASHREPORTER
   CrashReporter::AnnotateCrashReport(aStatePtr == &mOutOfMemoryState
                                      ? NS_LITERAL_CSTRING("JSOutOfMemory")
                                      : NS_LITERAL_CSTRING("JSLargeAllocationFailure"),
                                      aNewState == OOMState::Reporting
                                      ? NS_LITERAL_CSTRING("Reporting")
                                      : aNewState == OOMState::Reported
                                      ? NS_LITERAL_CSTRING("Reported")
                                      : NS_LITERAL_CSTRING("Recovered"));
-#endif
 }
 
 void
 CycleCollectedJSRuntime::OnGC(JSContext* aContext,
                               JSGCStatus aStatus)
 {
   switch (aStatus) {
     case JSGC_BEGIN:
       nsCycleCollector_prepareForGarbageCollection();
       mZonesWaitingForGC.Clear();
       break;
     case JSGC_END: {
-#ifdef MOZ_CRASHREPORTER
       if (mOutOfMemoryState == OOMState::Reported) {
         AnnotateAndSetOutOfMemory(&mOutOfMemoryState, OOMState::Recovered);
       }
       if (mLargeAllocationFailureState == OOMState::Reported) {
         AnnotateAndSetOutOfMemory(&mLargeAllocationFailureState, OOMState::Recovered);
       }
-#endif
 
       // Do any deferred finalization of native objects. Normally we do this
       // incrementally for an incremental GC, and immediately for a
       // non-incremental GC, on the basis that the type of GC reflects how
       // urgently resources should be destroyed. However under some circumstances
       // (such as in js::InternalCallOrConstruct) we can end up running a
       // non-incremental GC when there is a pending exception, and the finalizers
       // are not set up to handle that. In that case, just run them later, after
--- a/xpcom/base/nsCrashOnException.cpp
+++ b/xpcom/base/nsCrashOnException.cpp
@@ -1,34 +1,31 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsCrashOnException.h"
 #include "nsCOMPtr.h"
+#include "nsICrashReporter.h"
 #include "nsServiceManagerUtils.h"
 
-#ifdef MOZ_CRASHREPORTER
-#include "nsICrashReporter.h"
-#endif
 
 namespace mozilla {
 
 static int
 ReportException(EXCEPTION_POINTERS* aExceptionInfo)
 {
-#ifdef MOZ_CRASHREPORTER
   nsCOMPtr<nsICrashReporter> cr =
     do_GetService("@mozilla.org/toolkit/crash-reporter;1");
   if (cr) {
     cr->WriteMinidumpForException(aExceptionInfo);
   }
-#endif
+
   return EXCEPTION_EXECUTE_HANDLER;
 }
 
 XPCOM_API(LRESULT)
 CallWindowProcCrashProtected(WNDPROC aWndProc, HWND aHWnd, UINT aMsg,
                              WPARAM aWParam, LPARAM aLParam)
 {
   MOZ_SEH_TRY {
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -162,16 +162,17 @@
 #include "mozilla/LinkedList.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Move.h"
 #include "mozilla/SegmentedVector.h"
 
 #include "nsCycleCollectionParticipant.h"
 #include "nsCycleCollectionNoteRootCallback.h"
 #include "nsDeque.h"
+#include "nsExceptionHandler.h"
 #include "nsCycleCollector.h"
 #include "nsThreadUtils.h"
 #include "nsXULAppAPI.h"
 #include "prenv.h"
 #include "nsPrintfCString.h"
 #include "nsTArray.h"
 #include "nsIConsoleService.h"
 #include "mozilla/Attributes.h"
@@ -186,20 +187,16 @@
 #include <stdio.h>
 
 #include "mozilla/AutoGlobalTimelineMarker.h"
 #include "mozilla/Likely.h"
 #include "mozilla/PoisonIOInterposer.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/ThreadLocal.h"
 
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
 using namespace mozilla;
 
 struct NurseryPurpleBufferEntry
 {
   void* mPtr;
   nsCycleCollectionParticipant* mParticipant;
   nsCycleCollectingAutoRefCnt* mRefCnt;
 };
@@ -663,24 +660,22 @@ public:
 
 void
 PtrInfo::AnnotatedReleaseAssert(bool aCondition, const char* aMessage)
 {
   if (aCondition) {
     return;
   }
 
-#ifdef MOZ_CRASHREPORTER
   const char* piName = "Unknown";
   if (mParticipant) {
     piName = mParticipant->ClassName();
   }
   nsPrintfCString msg("%s, for class %s", aMessage, piName);
   CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CycleCollector"), msg);
-#endif
 
   MOZ_CRASH();
 }
 
 /**
  * A structure designed to be used like a linked list of PtrInfo, except
  * it allocates many PtrInfos at a time.
  */
--- a/xpcom/base/nsDebugImpl.cpp
+++ b/xpcom/base/nsDebugImpl.cpp
@@ -8,19 +8,17 @@
 #include "base/process_util.h"
 
 #include "mozilla/Atomics.h"
 #include "mozilla/Printf.h"
 
 #include "MainThreadUtils.h"
 #include "nsDebugImpl.h"
 #include "nsDebug.h"
-#ifdef MOZ_CRASHREPORTER
-# include "nsExceptionHandler.h"
-#endif
+#include "nsExceptionHandler.h"
 #include "nsString.h"
 #include "nsXULAppAPI.h"
 #include "prprf.h"
 #include "nsError.h"
 #include "prerror.h"
 #include "prerr.h"
 #include "prenv.h"
 
@@ -387,31 +385,29 @@ NS_DebugBreak(uint32_t aSeverity, const 
     case NS_DEBUG_WARNING:
       return;
 
     case NS_DEBUG_BREAK:
       Break(buf.buffer);
       return;
 
     case NS_DEBUG_ABORT: {
-#if defined(MOZ_CRASHREPORTER)
       // Updating crash annotations in the child causes us to do IPC. This can
       // really cause trouble if we're asserting from within IPC code. So we
       // have to do without the annotations in that case.
       if (XRE_IsParentProcess()) {
         // Don't include the PID in the crash report annotation to
         // allow faceting on crash-stats.mozilla.org.
         nsCString note("xpcom_runtime_abort(");
         note += nonPIDBuf.buffer;
         note += ")";
         CrashReporter::AppendAppNotesToCrashReport(note);
         CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AbortMessage"),
                                            nsDependentCString(nonPIDBuf.buffer));
       }
-#endif  // MOZ_CRASHREPORTER
 
 #if defined(DEBUG) && defined(_WIN32)
       RealBreak();
 #endif
 #if defined(DEBUG)
       nsTraceRefcnt::WalkTheStack(stderr);
 #endif
       Abort(buf.buffer);
@@ -609,13 +605,11 @@ NS_ErrorAccordingToNSPR()
     case PR_NO_ACCESS_RIGHTS_ERROR:      return NS_ERROR_FILE_ACCESS_DENIED;
     default:                             return NS_ERROR_FAILURE;
   }
 }
 
 void
 NS_ABORT_OOM(size_t aSize)
 {
-#if defined(MOZ_CRASHREPORTER)
   CrashReporter::AnnotateOOMAllocationSize(aSize);
-#endif
   MOZ_CRASH("OOM");
 }
--- a/xpcom/base/nsObjCExceptions.h
+++ b/xpcom/base/nsObjCExceptions.h
@@ -12,17 +12,17 @@
 #define nsObjCExceptions_h_
 
 #import <Foundation/Foundation.h>
 
 #ifdef DEBUG
 #import <ExceptionHandling/NSExceptionHandler.h>
 #endif
 
-#if defined(MOZ_CRASHREPORTER) && defined(__cplusplus)
+#if defined(__cplusplus)
 #include "nsICrashReporter.h"
 #include "nsCOMPtr.h"
 #include "nsServiceManagerUtils.h"
 #endif
 
 #include <unistd.h>
 #include <signal.h>
 #include "nsError.h"
@@ -42,17 +42,17 @@
 
 __attribute__((unused))
 static void
 nsObjCExceptionLog(NSException* aException)
 {
   NSLog(@"Mozilla has caught an Obj-C exception [%@: %@]",
         [aException name], [aException reason]);
 
-#if defined(MOZ_CRASHREPORTER) && defined(__cplusplus)
+#if defined(__cplusplus)
   // Attach exception info to the crash report.
   nsCOMPtr<nsICrashReporter> crashReporter =
     do_GetService("@mozilla.org/toolkit/crash-reporter;1");
   if (crashReporter) {
     crashReporter->AppendObjCExceptionInfoToAppNotes(static_cast<void*>(aException));
   }
 #endif
 
--- a/xpcom/build/nsXULAppAPI.h
+++ b/xpcom/build/nsXULAppAPI.h
@@ -398,26 +398,24 @@ XRE_API(const char*,
 #if defined(MOZ_WIDGET_ANDROID)
 XRE_API(void,
         XRE_SetAndroidChildFds, (JNIEnv* env, int crashFd, int ipcFd))
 #endif // defined(MOZ_WIDGET_ANDROID)
 
 XRE_API(void,
         XRE_SetProcessType, (const char* aProcessTypeString))
 
-#if defined(MOZ_CRASHREPORTER)
 // Used in the "master" parent process hosting the crash server
 XRE_API(bool,
         XRE_TakeMinidumpForChild, (uint32_t aChildPid, nsIFile** aDump,
                                    uint32_t* aSequence))
 
 // Used in child processes.
 XRE_API(bool,
         XRE_SetRemoteExceptionHandler, (const char* aPipe))
-#endif
 
 namespace mozilla {
 namespace gmp {
 class GMPLoader;
 } // namespace gmp
 } // namespace mozilla
 
 XRE_API(nsresult,
--- a/xpcom/system/moz.build
+++ b/xpcom/system/moz.build
@@ -1,25 +1,21 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 XPIDL_SOURCES += [
     'nsIBlocklistService.idl',
+    'nsICrashReporter.idl',
     'nsIDeviceSensors.idl',
     'nsIGConfService.idl',
     'nsIGeolocationProvider.idl',
     'nsIGIOService.idl',
     'nsIGSettingsService.idl',
     'nsIHapticFeedback.idl',
     'nsIPlatformInfo.idl',
     'nsIXULAppInfo.idl',
     'nsIXULRuntime.idl',
 ]
 
-if CONFIG['MOZ_CRASHREPORTER']:
-    XPIDL_SOURCES += [
-        'nsICrashReporter.idl',
-    ]
-
 XPIDL_MODULE = 'xpcom_system'
--- a/xpcom/tests/gtest/TestDeadlockDetector.cpp
+++ b/xpcom/tests/gtest/TestDeadlockDetector.cpp
@@ -3,30 +3,27 @@
  * 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 "mozilla/ArrayUtils.h"
 
 #include "prthread.h"
 
+#include "nsCOMPtr.h"
+#include "nsICrashReporter.h"
+#include "nsMemory.h"
+#include "nsServiceManagerUtils.h"
 #include "nsTArray.h"
-#include "nsMemory.h"
 
 #include "mozilla/CondVar.h"
 #include "mozilla/RecursiveMutex.h"
 #include "mozilla/ReentrantMonitor.h"
 #include "mozilla/Mutex.h"
 
-#ifdef MOZ_CRASHREPORTER
-#include "nsCOMPtr.h"
-#include "nsICrashReporter.h"
-#include "nsServiceManagerUtils.h"
-#endif
-
 #include "gtest/gtest.h"
 
 using namespace mozilla;
 
 // The code in this file is also used by
 // storage/test/gtest/test_deadlock_detector.cpp. The following two macros are
 // used to provide the necessary differentiation between this file and that
 // file.
@@ -69,23 +66,21 @@ protected:
   }
 
 private:
   unsigned int mOldSleepDuration;
 };
 
 void DisableCrashReporter()
 {
-#ifdef MOZ_CRASHREPORTER
     nsCOMPtr<nsICrashReporter> crashreporter =
         do_GetService("@mozilla.org/toolkit/crash-reporter;1");
     if (crashreporter) {
       crashreporter->SetEnabled(false);
     }
-#endif
 }
 
 //-----------------------------------------------------------------------------
 // Single-threaded sanity tests
 
 // Stupidest possible deadlock.
 int
 Sanity_Child()
--- a/xpcom/tests/gtest/TestPLDHash.cpp
+++ b/xpcom/tests/gtest/TestPLDHash.cpp
@@ -1,35 +1,32 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "PLDHashTable.h"
 #include "nsCOMPtr.h"
+#include "nsICrashReporter.h"
 #include "nsServiceManagerUtils.h"
 #include "gtest/gtest.h"
 
 // This test mostly focuses on edge cases. But more coverage of normal
 // operations wouldn't be a bad thing.
 
 #ifdef XP_UNIX
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 
 // This global variable is defined in toolkit/xre/nsSigHandlers.cpp.
 extern unsigned int _gdb_sleep_duration;
 #endif
 
-#ifdef MOZ_CRASHREPORTER
-#include "nsICrashReporter.h"
-#endif
-
 // We can test that certain operations cause expected aborts by forking
 // and then checking that the child aborted in the expected way (i.e. via
 // MOZ_CRASH). We skip this for the following configurations.
 // - On Windows, because it doesn't have fork().
 // - On non-DEBUG builds, because the crashes cause the crash reporter to pop
 //   up when running this test locally, which is surprising and annoying.
 // - On ASAN builds, because ASAN alters the way a MOZ_CRASHing process
 //   terminates, which makes it harder to test if the right thing has occurred.
@@ -44,23 +41,21 @@ TestCrashyOperation(void (*aCrashyOperat
 
   int pid = fork();
   ASSERT_NE(pid, -1);
 
   if (pid == 0) {
     // Disable the crashreporter -- writing a crash dump in the child will
     // prevent the parent from writing a subsequent dump. Crashes here are
     // expected, so we don't want their stacks to show up in the log anyway.
-#ifdef MOZ_CRASHREPORTER
     nsCOMPtr<nsICrashReporter> crashreporter =
       do_GetService("@mozilla.org/toolkit/crash-reporter;1");
     if (crashreporter) {
       crashreporter->SetEnabled(false);
     }
-#endif
 
     // Child: perform the crashy operation.
     fprintf(stderr, "TestCrashyOperation: The following crash is expected. Do not panic.\n");
     aCrashyOperation();
     fprintf(stderr, "TestCrashyOperation: didn't crash?!\n");
     ASSERT_TRUE(false);   // shouldn't reach here
   }
 
--- a/xpcom/tests/gtest/TestSTLWrappers.cpp
+++ b/xpcom/tests/gtest/TestSTLWrappers.cpp
@@ -5,21 +5,19 @@
 #  error "failed to wrap <algorithm>"
 #endif
 
 #include <vector>
 #ifndef mozilla_vector_h
 #  error "failed to wrap <vector>"
 #endif
 
-#ifdef MOZ_CRASHREPORTER
 #include "nsCOMPtr.h"
 #include "nsICrashReporter.h"
 #include "nsServiceManagerUtils.h"
-#endif
 
 // gcc errors out if we |try ... catch| with -fno-exceptions, but we
 // can still test on windows
 #ifdef _MSC_VER
    // C4530 will be generated whenever try...catch is used without
    // enabling exceptions. We know we don't enbale exceptions.
 #  pragma warning( disable : 4530 )
 #  define TRY       try
@@ -36,23 +34,21 @@ extern unsigned int _gdb_sleep_duration;
 #endif
 
 void ShouldAbort()
 {
 #if defined(XP_UNIX)
     _gdb_sleep_duration = 0;
 #endif
 
-#ifdef MOZ_CRASHREPORTER
     nsCOMPtr<nsICrashReporter> crashreporter =
         do_GetService("@mozilla.org/toolkit/crash-reporter;1");
     if (crashreporter) {
       crashreporter->SetEnabled(false);
     }
-#endif
 
     std::vector<int> v;
     int rv = 1;
 
     TRY {
       // v.at(1) on empty v should abort; NOT throw an exception
 
       // (Do some arithmetic with result of v.at() to avoid
--- a/xpcom/threads/HangMonitor.cpp
+++ b/xpcom/threads/HangMonitor.cpp
@@ -9,27 +9,24 @@
 #include "mozilla/Atomics.h"
 #include "mozilla/BackgroundHangMonitor.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ProcessedStack.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/UniquePtr.h"
+#include "nsExceptionHandler.h"
 #include "nsReadableUtils.h"
 #include "nsThreadUtils.h"
 #include "mozilla/StackWalk.h"
 #include "nsThreadUtils.h"
 #include "nsXULAppAPI.h"
 #include "GeckoProfiler.h"
 
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
 #ifdef XP_WIN
 #include <windows.h>
 #endif
 
 #if defined(MOZ_GECKO_PROFILER) && defined(MOZ_PROFILING) && defined(XP_WIN)
   #define REPORT_CHROME_HANGS
 #endif
 
@@ -105,25 +102,23 @@ Crash()
   }
 
 #ifdef XP_WIN
   if (::IsDebuggerPresent()) {
     return;
   }
 #endif
 
-#ifdef MOZ_CRASHREPORTER
   // If you change this, you must also deal with the threadsafety of AnnotateCrashReport in
   // non-chrome processes!
   if (GeckoProcessType_Default == XRE_GetProcessType()) {
     CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Hang"),
                                        NS_LITERAL_CSTRING("1"));
     CrashReporter::SetMinidumpAnalysisAllThreads();
   }
-#endif
 
   MOZ_CRASH("HangMonitor triggered");
 }
 
 #ifdef REPORT_CHROME_HANGS
 
 static void
 ChromeStackWalker(uint32_t aFrameNumber, void* aPC, void* aSP, void* aClosure)
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -33,26 +33,24 @@
 #include "mozilla/Services.h"
 #include "mozilla/SystemGroup.h"
 #include "nsXPCOMPrivate.h"
 #include "mozilla/ChaosMode.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/Unused.h"
 #include "mozilla/dom/ScriptSettings.h"
+#include "nsICrashReporter.h"
 #include "nsThreadSyncDispatch.h"
+#include "nsServiceManagerUtils.h"
 #include "GeckoProfiler.h"
 #include "InputEventStatistics.h"
 #include "ThreadEventTarget.h"
 
-#ifdef MOZ_CRASHREPORTER
-#include "nsServiceManagerUtils.h"
-#include "nsICrashReporter.h"
 #include "mozilla/dom/ContentChild.h"
-#endif
 
 #ifdef XP_LINUX
 #include <sys/time.h>
 #include <sys/resource.h>
 #include <sched.h>
 #endif
 
 #define HAVE_UALARM _BSD_SOURCE || (_XOPEN_SOURCE >= 500 ||                 \
@@ -471,17 +469,16 @@ nsThread::ThreadFunc(void* aArg)
   FreeTraceInfo();
 #endif
 
   NS_RELEASE(self);
 }
 
 //-----------------------------------------------------------------------------
 
-#ifdef MOZ_CRASHREPORTER
 // Tell the crash reporter to save a memory report if our heuristics determine
 // that an OOM failure is likely to occur soon.
 // Memory usage will not be checked more than every 30 seconds or saved more
 // than every 3 minutes
 // If |aShouldSave == kForceReport|, a report will be saved regardless of
 // whether the process is low on memory or not. However, it will still not be
 // saved if a report was saved less than 3 minutes ago.
 bool
@@ -536,17 +533,16 @@ nsThread::SaveMemoryReportNearOOM(Should
     nextCheck = now + TimeDuration::FromSeconds(kLowMemorySaveSeconds);
   } else {
     recentlySavedReport = false;
     nextCheck = now + TimeDuration::FromSeconds(kLowMemoryCheckSeconds);
   }
 
   return recentlySavedReport;
 }
-#endif
 
 #ifdef MOZ_CANARY
 int sCanaryOutputFD = -1;
 #endif
 
 nsThread::nsThread(NotNull<SynchronizedEventQueue*> aQueue,
                    MainThreadFlag aMainThread,
                    uint32_t aStackSize)
@@ -1202,21 +1198,19 @@ nsThread::DoMainThreadSpecificProcessing
                             mpPending == MemPressure_New ? u"low-memory-no-forward" :
                             u"low-memory-ongoing-no-forward");
       } else {
         NS_WARNING("Can't get observer service!");
       }
     }
   }
 
-#ifdef MOZ_CRASHREPORTER
   if (!ShuttingDown()) {
     SaveMemoryReportNearOOM(ShouldSaveMemoryReport::kMaybeReport);
   }
-#endif
 }
 
 NS_IMETHODIMP
 nsThread::GetEventTarget(nsIEventTarget** aEventTarget)
 {
   nsCOMPtr<nsIEventTarget> target = this;
   target.forget(aEventTarget);
   return NS_OK;
--- a/xpcom/threads/nsThread.h
+++ b/xpcom/threads/nsThread.h
@@ -82,25 +82,23 @@ public:
 
   uint32_t
   RecursionDepth() const;
 
   void ShutdownComplete(NotNull<struct nsThreadShutdownContext*> aContext);
 
   void WaitForAllAsynchronousShutdowns();
 
-#ifdef MOZ_CRASHREPORTER
   enum class ShouldSaveMemoryReport
   {
     kMaybeReport,
     kForceReport
   };
 
   static bool SaveMemoryReportNearOOM(ShouldSaveMemoryReport aShouldSave);
-#endif
 
   static const uint32_t kRunnableNameBufSize = 1000;
   static mozilla::Array<char, kRunnableNameBufSize> sMainThreadRunnableName;
 
   void EnableInputEventPrioritization()
   {
     EventQueue()->EnableInputEventPrioritization();
   }
--- a/xpcom/threads/nsThreadUtils.cpp
+++ b/xpcom/threads/nsThreadUtils.cpp
@@ -5,38 +5,33 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsThreadUtils.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Likely.h"
 #include "mozilla/TimeStamp.h"
 #include "LeakRefPtr.h"
 #include "nsComponentManagerUtils.h"
+#include "nsExceptionHandler.h"
 #include "nsITimer.h"
 
-#include "nsComponentManagerUtils.h"
-
 #ifdef MOZILLA_INTERNAL_API
 # include "nsThreadManager.h"
 #else
 # include "nsXPCOMCIDInternal.h"
 # include "nsIThreadManager.h"
 # include "nsServiceManagerUtils.h"
 #endif
 
 #ifdef XP_WIN
 #include <windows.h>
 #elif defined(XP_MACOSX)
 #include <sys/resource.h>
 #endif
 
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
 using namespace mozilla;
 
 #ifndef XPCOM_GLUE_AVOID_NSPR
 
 NS_IMPL_ISUPPORTS(IdlePeriod, nsIIdlePeriod)
 
 NS_IMETHODIMP
 IdlePeriod::GetIdlePeriodHint(TimeStamp* aIdleDeadline)
@@ -512,19 +507,17 @@ NS_ProcessNextEvent(nsIThread* aThread, 
   bool val;
   return NS_SUCCEEDED(aThread->ProcessNextEvent(aMayWait, &val)) && val;
 }
 
 void
 NS_SetCurrentThreadName(const char* aName)
 {
   PR_SetCurrentThreadName(aName);
-#ifdef MOZ_CRASHREPORTER
   CrashReporter::SetCurrentThreadName(aName);
-#endif
 }
 
 #ifdef MOZILLA_INTERNAL_API
 nsIThread*
 NS_GetCurrentThread()
 {
   return nsThreadManager::get().GetCurrentThread();
 }