Bug 1412048 - Replace NS_RUNTIMEABORT("...") with MOZ_CRASH("..."). r=froydnj
authorChris Peterson <cpeterson@mozilla.com>
Tue, 24 Oct 2017 23:30:31 -0700
changeset 389264 7fb3d74bb529af93322a8c80734811995a068cf0
parent 389263 08edcb682be1ed138cdd7f2ab1eb8d45435207d6
child 389265 856d69fd98273f302d97e3b9d970c62362e44e2a
push id32780
push userebalazs@mozilla.com
push dateTue, 31 Oct 2017 10:46:39 +0000
treeherdermozilla-central@371e44e00347 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1412048
milestone58.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 1412048 - Replace NS_RUNTIMEABORT("...") with MOZ_CRASH("..."). r=froydnj And remove unreachable code after MOZ_CRASH(). MozReview-Commit-ID: 6ShBtPRKYlF
dom/ipc/ContentChild.cpp
dom/ipc/ContentParent.cpp
dom/plugins/ipc/PluginInstanceChild.cpp
dom/plugins/ipc/PluginModuleChild.cpp
dom/plugins/ipc/PluginModuleParent.cpp
dom/presentation/PresentationConnection.cpp
editor/libeditor/HTMLEditRules.cpp
gfx/layers/d3d11/ReadbackManagerD3D11.cpp
gfx/layers/ipc/ShadowLayers.cpp
gfx/tests/gtest/TestLayers.cpp
gfx/vr/ipc/VRManagerChild.cpp
hal/sandbox/SandboxHal.cpp
ipc/ipdl/test/cxx/TestCrashCleanup.cpp
ipc/ipdl/test/cxx/TestInterruptErrorCleanup.cpp
ipc/ipdl/test/cxx/TestInterruptShutdownRace.cpp
js/xpconnect/src/XPCJSContext.cpp
js/xpconnect/src/nsXPConnect.cpp
layout/style/StyleSheet.cpp
layout/style/nsComputedDOMStyle.cpp
toolkit/xre/AutoSQLiteLifetime.cpp
xpcom/tests/gtest/TestDeadlockDetectorScalability.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -3116,18 +3116,17 @@ ContentChild::RecvSetAudioSessionData(co
                                                         aIconPath))) {
       return IPC_OK();
     }
 
     // Ignore failures here; we can't really do anything about them
     mozilla::widget::StartAudioSession();
     return IPC_OK();
 #else
-    NS_RUNTIMEABORT("Not Reached!");
-    return IPC_FAIL_NO_REASON(this);
+    MOZ_CRASH("Not Reached!");
 #endif
 }
 
 // This code goes here rather than nsGlobalWindow.cpp because nsGlobalWindow.cpp
 // can't include ContentChild.h since it includes windows.h.
 
 static uint64_t gNextWindowID = 0;
 
@@ -3575,42 +3574,39 @@ ContentChild::RecvSetPluginList(const ui
 
 mozilla::ipc::IPCResult
 ContentChild::RecvShareCodeCoverageMutex(const CrossProcessMutexHandle& aHandle)
 {
 #ifdef MOZ_CODE_COVERAGE
   CodeCoverageHandler::Init(aHandle);
   return IPC_OK();
 #else
-  NS_RUNTIMEABORT("Shouldn't receive this message in non-code coverage builds!");
-  return IPC_FAIL_NO_REASON(this);
+  MOZ_CRASH("Shouldn't receive this message in non-code coverage builds!");
 #endif
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvDumpCodeCoverageCounters()
 {
 #ifdef MOZ_CODE_COVERAGE
   CodeCoverageHandler::DumpCounters(0);
   return IPC_OK();
 #else
-  NS_RUNTIMEABORT("Shouldn't receive this message in non-code coverage builds!");
-  return IPC_FAIL_NO_REASON(this);
+  MOZ_CRASH("Shouldn't receive this message in non-code coverage builds!");
 #endif
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvResetCodeCoverageCounters()
 {
 #ifdef MOZ_CODE_COVERAGE
   CodeCoverageHandler::ResetCounters(0);
   return IPC_OK();
 #else
-  NS_RUNTIMEABORT("Shouldn't receive this message in non-code coverage builds!");
-  return IPC_FAIL_NO_REASON(this);
+  MOZ_CRASH("Shouldn't receive this message in non-code coverage builds!");
 #endif
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvSetInputEventQueueEnabled()
 {
   nsThreadManager::get().EnableMainThreadEventPrioritization();
   return IPC_OK();
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1058,18 +1058,17 @@ ContentParent::RecvLoadPlugin(const uint
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 ContentParent::RecvUngrabPointer(const uint32_t& aTime)
 {
 #if !defined(MOZ_WIDGET_GTK)
-  NS_RUNTIMEABORT("This message only makes sense on GTK platforms");
-  return IPC_OK();
+  MOZ_CRASH("This message only makes sense on GTK platforms");
 #else
   gdk_pointer_ungrab(aTime);
   return IPC_OK();
 #endif
 }
 
 mozilla::ipc::IPCResult
 ContentParent::RecvRemovePermission(const IPC::Principal& aPrincipal,
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -750,18 +750,17 @@ PluginInstanceChild::AnswerNPP_GetValue_
     }
 
     *aPlugId = nsCString(plugId);
     *aResult = result;
     return IPC_OK();
 
 #else
 
-    NS_RUNTIMEABORT("shouldn't be called on non-ATK platforms");
-    return IPC_FAIL_NO_REASON(this);
+    MOZ_CRASH("shouldn't be called on non-ATK platforms");
 
 #endif
 }
 
 mozilla::ipc::IPCResult
 PluginInstanceChild::AnswerNPP_SetValue_NPNVprivateModeBool(const bool& value,
                                                             NPError* result)
 {
@@ -1070,33 +1069,31 @@ PluginInstanceChild::AnswerNPP_HandleEve
 }
 
 #else
 mozilla::ipc::IPCResult
 PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event,
                                                      const uint32_t &surfaceid,
                                                      int16_t* handled)
 {
-    NS_RUNTIMEABORT("NPP_HandleEvent_IOSurface is a OSX-only message");
-    return IPC_FAIL_NO_REASON(this);
+    MOZ_CRASH("NPP_HandleEvent_IOSurface is a OSX-only message");
 }
 #endif
 
 mozilla::ipc::IPCResult
 PluginInstanceChild::RecvWindowPosChanged(const NPRemoteEvent& event)
 {
     NS_ASSERTION(!mLayersRendering && !mPendingPluginCall,
                  "Shouldn't be receiving WindowPosChanged with layer rendering");
 
 #ifdef OS_WIN
     int16_t dontcare;
     return AnswerNPP_HandleEvent(event, &dontcare);
 #else
-    NS_RUNTIMEABORT("WindowPosChanged is a windows-only message");
-    return IPC_FAIL_NO_REASON(this);
+    MOZ_CRASH("WindowPosChanged is a windows-only message");
 #endif
 }
 
 mozilla::ipc::IPCResult
 PluginInstanceChild::RecvContentsScaleFactorChanged(const double& aContentsScaleFactor)
 {
 #if defined(XP_MACOSX) || defined(XP_WIN)
     mContentsScaleFactor = aContentsScaleFactor;
@@ -1105,18 +1102,17 @@ PluginInstanceChild::RecvContentsScaleFa
         // Release the shared context so that it is reallocated
         // with the new size.
         ::CGContextRelease(mShContext);
         mShContext = nullptr;
     }
 #endif
     return IPC_OK();
 #else
-    NS_RUNTIMEABORT("ContentsScaleFactorChanged is an Windows or OSX only message");
-    return IPC_FAIL_NO_REASON(this);
+    MOZ_CRASH("ContentsScaleFactorChanged is an Windows or OSX only message");
 #endif
 }
 
 mozilla::ipc::IPCResult
 PluginInstanceChild::AnswerCreateChildPluginWindow(NativeWindowHandle* aChildPluginWindow)
 {
 #if defined(XP_WIN)
     MOZ_ASSERT(!mPluginWindowHWND);
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -723,18 +723,17 @@ PluginModuleChild::RecvNPP_GetSitesWithD
 }
 
 mozilla::ipc::IPCResult
 PluginModuleChild::RecvSetAudioSessionData(const nsID& aId,
                                            const nsString& aDisplayName,
                                            const nsString& aIconPath)
 {
 #if !defined XP_WIN
-    NS_RUNTIMEABORT("Not Reached!");
-    return IPC_FAIL_NO_REASON(this);
+    MOZ_CRASH("Not Reached!");
 #else
     nsresult rv = mozilla::widget::RecvAudioSessionData(aId, aDisplayName, aIconPath);
     NS_ENSURE_SUCCESS(rv, IPC_OK()); // Bail early if this fails
 
     // Ignore failures here; we can't really do anything about them
     mozilla::widget::StartAudioSession();
     return IPC_OK();
 #endif
@@ -2611,17 +2610,17 @@ PluginModuleChild::ResetEventHooks()
 mozilla::ipc::IPCResult
 PluginModuleChild::RecvProcessNativeEventsInInterruptCall()
 {
     PLUGIN_LOG_DEBUG(("%s", FULLFUNCTION));
 #if defined(OS_WIN)
     ProcessNativeEventsInInterruptCall();
     return IPC_OK();
 #else
-    NS_RUNTIMEABORT(
+    MOZ_CRASH(
         "PluginModuleChild::RecvProcessNativeEventsInInterruptCall not implemented!");
     return IPC_FAIL_NO_REASON(this);
 #endif
 }
 
 #ifdef MOZ_WIDGET_COCOA
 void
 PluginModuleChild::ProcessNativeEvents() {
@@ -2658,18 +2657,17 @@ PluginModuleChild::PluginRequiresAudioDe
             if (!CallNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges(
     	      	                                        aShouldRegister, &rv)) {
                 return NPERR_GENERIC_ERROR;
             }
         }
     }
     return rv;
 #else
-    NS_RUNTIMEABORT("PluginRequiresAudioDeviceChanges is not available on this platform.");
-    return NPERR_GENERIC_ERROR;
+    MOZ_CRASH("PluginRequiresAudioDeviceChanges is not available on this platform.");
 #endif // XP_WIN
 }
 
 mozilla::ipc::IPCResult
 PluginModuleChild::RecvNPP_SetValue_NPNVaudioDeviceChangeDetails(
                               const NPAudioDeviceChangeDetailsIPC& detailsIPC)
 {
 #if defined(XP_WIN)
@@ -2678,12 +2676,11 @@ PluginModuleChild::RecvNPP_SetValue_NPNV
     details.role = detailsIPC.role;
     details.defaultDevice = detailsIPC.defaultDevice.c_str();
     for (auto iter = mAudioNotificationSet.ConstIter(); !iter.Done(); iter.Next()) {
       PluginInstanceChild* pluginInst = iter.Get()->GetKey();
       pluginInst->DefaultAudioDeviceChanged(details);
     }
     return IPC_OK();
 #else
-    NS_RUNTIMEABORT("NPP_SetValue_NPNVaudioDeviceChangeDetails is a Windows-only message");
-    return IPC_FAIL_NO_REASON(this);
+    MOZ_CRASH("NPP_SetValue_NPNVaudioDeviceChangeDetails is a Windows-only message");
 #endif
 }
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -1840,19 +1840,17 @@ PluginModuleChromeParent::AnswerNPN_SetV
     nsresult err =
       mozilla::plugins::PluginUtilsWin::RegisterForAudioDeviceChanges(this,
                                                                shouldRegister);
     if (err != NS_OK) {
       *result = NPERR_GENERIC_ERROR;
     }
     return IPC_OK();
 #else
-    NS_RUNTIMEABORT("NPPVpluginRequiresAudioDeviceChanges is not valid on this platform.");
-    *result = NPERR_GENERIC_ERROR;
-    return IPC_OK();
+    MOZ_CRASH("NPPVpluginRequiresAudioDeviceChanges is not valid on this platform.");
 #endif
 }
 
 mozilla::ipc::IPCResult
 PluginModuleParent::RecvBackUpXResources(const FileDescriptor& aXSocketFd)
 {
 #ifndef MOZ_X11
     MOZ_CRASH("This message only makes sense on X11 platforms");
@@ -2577,18 +2575,17 @@ PluginModuleParent::AnswerProcessSomeEve
     mozilla::plugins::PluginUtilsOSX::InvokeNativeEventLoop();
     return IPC_OK();
 }
 
 #elif !defined(MOZ_WIDGET_GTK)
 mozilla::ipc::IPCResult
 PluginModuleParent::AnswerProcessSomeEvents()
 {
-    NS_RUNTIMEABORT("unreached");
-    return IPC_FAIL_NO_REASON(this);
+    MOZ_CRASH("unreached");
 }
 
 #else
 static const int kMaxChancesToProcessEvents = 20;
 
 mozilla::ipc::IPCResult
 PluginModuleParent::AnswerProcessSomeEvents()
 {
@@ -2807,20 +2804,18 @@ PluginModuleParent::EnsureTextureAllocat
     return mTextureAllocatorForDXGISurface;
 }
 
 
 mozilla::ipc::IPCResult
 PluginModuleParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges(
                                         const bool& shouldRegister,
                                         NPError* result) {
-    NS_RUNTIMEABORT("SetValue_NPPVpluginRequiresAudioDeviceChanges is only valid "
-      "with PluginModuleChromeParent");
-    *result = NPERR_GENERIC_ERROR;
-    return IPC_OK();
+    MOZ_CRASH("SetValue_NPPVpluginRequiresAudioDeviceChanges is only valid "
+              "with PluginModuleChromeParent");
 }
 
 #ifdef MOZ_CRASHREPORTER_INJECTOR
 
 // We only add the crash reporter to subprocess which have the filename
 // FlashPlayerPlugin*
 #define FLASH_PROCESS_PREFIX "FLASHPLAYERPLUGIN"
 
--- a/dom/presentation/PresentationConnection.cpp
+++ b/dom/presentation/PresentationConnection.cpp
@@ -572,18 +572,17 @@ PresentationConnection::DoReceiveMessage
     } else if (mBinaryType == PresentationConnectionBinaryType::Arraybuffer) {
       JS::Rooted<JSObject*> arrayBuf(cx);
       rv = nsContentUtils::CreateArrayBuffer(cx, aData, arrayBuf.address());
       if (NS_WARN_IF(NS_FAILED(rv))) {
         return rv;
       }
       jsData.setObject(*arrayBuf);
     } else {
-      NS_RUNTIMEABORT("Unknown binary type!");
-      return NS_ERROR_UNEXPECTED;
+      MOZ_CRASH("Unknown binary type!");
     }
   } else {
     NS_ConvertUTF8toUTF16 utf16Data(aData);
     if(NS_WARN_IF(!ToJSValue(cx, utf16Data, &jsData))) {
       return NS_ERROR_FAILURE;
     }
   }
 
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -5183,17 +5183,17 @@ HTMLEditRules::CheckForEmptyBlock(nsINod
           EditorDOMPoint pt = GetGoodSelPointForNode(*priorNode, aAction);
           nsresult rv = aSelection->Collapse(pt.node, pt.offset);
           NS_ENSURE_SUCCESS(rv, rv);
         } else {
           nsresult rv = aSelection->Collapse(blockParent, offset + 1);
           NS_ENSURE_SUCCESS(rv, rv);
         }
       } else if (aAction != nsIEditor::eNone) {
-        NS_RUNTIMEABORT("CheckForEmptyBlock doesn't support this action yet");
+        MOZ_CRASH("CheckForEmptyBlock doesn't support this action yet");
       }
     }
     NS_ENSURE_STATE(htmlEditor);
     *aHandled = true;
     nsresult rv = htmlEditor->DeleteNode(emptyBlock);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   return NS_OK;
--- a/gfx/layers/d3d11/ReadbackManagerD3D11.cpp
+++ b/gfx/layers/d3d11/ReadbackManagerD3D11.cpp
@@ -100,17 +100,17 @@ ReadbackManagerD3D11::~ReadbackManagerD3
   // to leak the thread and its synchronisation in favor of crashing or freezing
   DWORD result = ::WaitForSingleObject(mTaskThread, 5000);
   if (result != WAIT_TIMEOUT) {
     ::DeleteCriticalSection(&mTaskMutex);
     ::CloseHandle(mShutdownEvent);
     ::CloseHandle(mTaskSemaphore);
     ::CloseHandle(mTaskThread);
   } else {
-    NS_RUNTIMEABORT("ReadbackManager: Task thread did not shutdown in 5 seconds.");
+    MOZ_CRASH("ReadbackManager: Task thread did not shutdown in 5 seconds.");
   }
 }
 
 void
 ReadbackManagerD3D11::PostTask(ID3D10Texture2D *aTexture, TextureReadbackSink* aSink)
 {
   ReadbackTask *task = new ReadbackTask;
   task->mReadbackTexture = aTexture;
@@ -131,17 +131,17 @@ ReadbackManagerD3D11::ProcessTasks()
   while (true) {
     DWORD result = ::WaitForMultipleObjects(2, handles, FALSE, INFINITE);
     if (result != WAIT_OBJECT_0) {
       return;
     }
 
     ::EnterCriticalSection(&mTaskMutex);
     if (mPendingReadbackTasks.Length() == 0) {
-      NS_RUNTIMEABORT("Trying to read from an empty array, bad bad bad");
+      MOZ_CRASH("Trying to read from an empty array, bad bad bad");
     }
     ReadbackTask *nextReadbackTask = mPendingReadbackTasks[0].forget();
     mPendingReadbackTasks.RemoveElementAt(0);
     ::LeaveCriticalSection(&mTaskMutex);
 
     // We want to block here until the texture contents are available, the
     // easiest thing is to simply map and unmap.
     D3D10_MAPPED_TEXTURE2D mappedTex;
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -970,17 +970,17 @@ DestroySurfaceDescriptor(IShmemAllocator
     }
     case MemoryOrShmem::Tuintptr_t: {
       uint8_t* ptr = (uint8_t*)desc.data().get_uintptr_t();
       GfxMemoryImageReporter::WillFree(ptr);
       delete [] ptr;
       break;
     }
     default:
-      NS_RUNTIMEABORT("surface type not implemented!");
+      MOZ_CRASH("surface type not implemented!");
   }
   *aSurface = SurfaceDescriptor();
 }
 
 bool
 ShadowLayerForwarder::AllocSurfaceDescriptor(const gfx::IntSize& aSize,
                                              gfxContentType aContent,
                                              SurfaceDescriptor* aBuffer)
--- a/gfx/tests/gtest/TestLayers.cpp
+++ b/gfx/tests/gtest/TestLayers.cpp
@@ -63,39 +63,34 @@ public:
     RefPtr<ContainerLayer> layer = new TestContainerLayer(this);
     return layer.forget();
   }
   virtual void GetBackendName(nsAString& aName) {}
   virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_BASIC; }
   virtual bool BeginTransaction() { return true; }
   virtual already_AddRefed<ImageLayer> CreateImageLayer() {
     MOZ_CRASH("Not implemented.");
-    return nullptr;
   }
   virtual already_AddRefed<PaintedLayer> CreatePaintedLayer() {
     RefPtr<PaintedLayer> layer = new TestPaintedLayer(this);
     return layer.forget();
   }
   virtual already_AddRefed<ColorLayer> CreateColorLayer() {
-    NS_RUNTIMEABORT("Not implemented.");
-    return nullptr;
+    MOZ_CRASH("Not implemented.");
   }
   virtual already_AddRefed<TextLayer> CreateTextLayer() {
-    NS_RUNTIMEABORT("Not implemented.");
-    return nullptr;
+    MOZ_CRASH("Not implemented.");
   }
   virtual already_AddRefed<BorderLayer> CreateBorderLayer() {
-    NS_RUNTIMEABORT("Not implemented.");
-    return nullptr;
+    MOZ_CRASH("Not implemented.");
   }
   virtual void SetRoot(Layer* aLayer) {}
   virtual bool BeginTransactionWithTarget(gfxContext* aTarget) { return true; }
   virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() {
-    NS_RUNTIMEABORT("Not implemented.");
-    return nullptr;
+    MOZ_CRASH("Not implemented.");
   }
   virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags aFlags = END_DEFAULT) {}
   virtual int32_t GetMaxTextureSize() const { return 0; }
 };
 
 class TestUserData: public LayerUserData {
--- a/gfx/vr/ipc/VRManagerChild.cpp
+++ b/gfx/vr/ipc/VRManagerChild.cpp
@@ -88,18 +88,17 @@ VRManagerChild::IsCreated()
 /* static */ bool
 VRManagerChild::InitForContent(Endpoint<PVRManagerChild>&& aEndpoint)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!sVRManagerChildSingleton);
 
   RefPtr<VRManagerChild> child(new VRManagerChild());
   if (!aEndpoint.Bind(child)) {
-    NS_RUNTIMEABORT("Couldn't Open() Compositor channel.");
-    return false;
+    MOZ_CRASH("Couldn't Open() Compositor channel.");
   }
   sVRManagerChildSingleton = child;
   return true;
 }
 
 /* static */ bool
 VRManagerChild::ReinitForContent(Endpoint<PVRManagerChild>&& aEndpoint)
 {
@@ -126,18 +125,17 @@ VRManagerChild::InitSameProcess()
 /* static */ void
 VRManagerChild::InitWithGPUProcess(Endpoint<PVRManagerChild>&& aEndpoint)
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(!sVRManagerChildSingleton);
 
   sVRManagerChildSingleton = new VRManagerChild();
   if (!aEndpoint.Bind(sVRManagerChildSingleton)) {
-    NS_RUNTIMEABORT("Couldn't Open() Compositor channel.");
-    return;
+    MOZ_CRASH("Couldn't Open() Compositor channel.");
   }
 }
 
 /*static*/ void
 VRManagerChild::ShutDown()
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (sVRManagerChildSingleton) {
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -214,57 +214,54 @@ void
 DisableSwitchNotifications(SwitchDevice aDevice)
 {
   Hal()->SendDisableSwitchNotifications(aDevice);
 }
 
 bool
 EnableAlarm()
 {
-  NS_RUNTIMEABORT("Alarms can't be programmed from sandboxed contexts.  Yet.");
-  return false;
+  MOZ_CRASH("Alarms can't be programmed from sandboxed contexts.  Yet.");
 }
 
 void
 DisableAlarm()
 {
-  NS_RUNTIMEABORT("Alarms can't be programmed from sandboxed contexts.  Yet.");
+  MOZ_CRASH("Alarms can't be programmed from sandboxed contexts.  Yet.");
 }
 
 bool
 SetAlarm(int32_t aSeconds, int32_t aNanoseconds)
 {
-  NS_RUNTIMEABORT("Alarms can't be programmed from sandboxed contexts.  Yet.");
-  return false;
+  MOZ_CRASH("Alarms can't be programmed from sandboxed contexts.  Yet.");
 }
 
 void
 SetProcessPriority(int aPid, ProcessPriority aPriority)
 {
-  NS_RUNTIMEABORT("Only the main process may set processes' priorities.");
+  MOZ_CRASH("Only the main process may set processes' priorities.");
 }
 
 bool
 SetProcessPrioritySupported()
 {
-  NS_RUNTIMEABORT("Only the main process may call SetProcessPrioritySupported().");
-  return false;
+  MOZ_CRASH("Only the main process may call SetProcessPrioritySupported().");
 }
 
 void
 SetCurrentThreadPriority(ThreadPriority aThreadPriority)
 {
-  NS_RUNTIMEABORT("Setting current thread priority cannot be called from sandboxed contexts.");
+  MOZ_CRASH("Setting current thread priority cannot be called from sandboxed contexts.");
 }
 
 void
 SetThreadPriority(PlatformThreadId aThreadId,
                   ThreadPriority aThreadPriority)
 {
-  NS_RUNTIMEABORT("Setting thread priority cannot be called from sandboxed contexts.");
+  MOZ_CRASH("Setting thread priority cannot be called from sandboxed contexts.");
 }
 
 void
 StartDiskSpaceWatcher()
 {
   MOZ_CRASH("StartDiskSpaceWatcher() can't be called from sandboxed contexts.");
 }
 
--- a/ipc/ipdl/test/cxx/TestCrashCleanup.cpp
+++ b/ipc/ipdl/test/cxx/TestCrashCleanup.cpp
@@ -102,15 +102,13 @@ TestCrashCleanupChild::~TestCrashCleanup
 {
     MOZ_COUNT_DTOR(TestCrashCleanupChild);
 }
 
 mozilla::ipc::IPCResult
 TestCrashCleanupChild::AnswerDIEDIEDIE()
 {
     _exit(0);
-    NS_RUNTIMEABORT("unreached");
-    return IPC_FAIL_NO_REASON(this);
+    MOZ_CRASH("unreached");
 }
 
-
 } // namespace _ipdltest
 } // namespace mozilla
--- a/ipc/ipdl/test/cxx/TestInterruptErrorCleanup.cpp
+++ b/ipc/ipdl/test/cxx/TestInterruptErrorCleanup.cpp
@@ -141,15 +141,13 @@ TestInterruptErrorCleanupChild::~TestInt
 {
     MOZ_COUNT_DTOR(TestInterruptErrorCleanupChild);
 }
 
 mozilla::ipc::IPCResult
 TestInterruptErrorCleanupChild::AnswerError()
 {
     _exit(0);
-    NS_RUNTIMEABORT("unreached");
-    return IPC_FAIL_NO_REASON(this);
+    MOZ_CRASH("unreached");
 }
 
-
 } // namespace _ipdltest
 } // namespace mozilla
--- a/ipc/ipdl/test/cxx/TestInterruptShutdownRace.cpp
+++ b/ipc/ipdl/test/cxx/TestInterruptShutdownRace.cpp
@@ -121,15 +121,13 @@ TestInterruptShutdownRaceChild::RecvStar
 
     return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 TestInterruptShutdownRaceChild::AnswerExit()
 {
     _exit(0);
-    NS_RUNTIMEABORT("unreached");
-    return IPC_FAIL_NO_REASON(this);
+    MOZ_CRASH("unreached");
 }
 
-
 } // namespace _ipdltest
 } // namespace mozilla
--- a/js/xpconnect/src/XPCJSContext.cpp
+++ b/js/xpconnect/src/XPCJSContext.cpp
@@ -122,32 +122,33 @@ class Watchdog
     // Invoked by the main thread only.
     //
 
     void Init()
     {
         MOZ_ASSERT(NS_IsMainThread());
         mLock = PR_NewLock();
         if (!mLock)
-            NS_RUNTIMEABORT("PR_NewLock failed.");
+            MOZ_CRASH("PR_NewLock failed.");
+
         mWakeup = PR_NewCondVar(mLock);
         if (!mWakeup)
-            NS_RUNTIMEABORT("PR_NewCondVar failed.");
+            MOZ_CRASH("PR_NewCondVar failed.");
 
         {
             AutoLockWatchdog lock(this);
 
             // Gecko uses thread private for accounting and has to clean up at thread exit.
             // Therefore, even though we don't have a return value from the watchdog, we need to
             // join it on shutdown.
             mThread = PR_CreateThread(PR_USER_THREAD, WatchdogMain, this,
                                       PR_PRIORITY_NORMAL, PR_GLOBAL_THREAD,
                                       PR_JOINABLE_THREAD, 0);
             if (!mThread)
-                NS_RUNTIMEABORT("PR_CreateThread failed!");
+                MOZ_CRASH("PR_CreateThread failed!");
 
             // WatchdogMain acquires the lock and then asserts mInitialized. So
             // make sure to set mInitialized before releasing the lock here so
             // that it's atomic with the creation of the thread.
             mInitialized = true;
         }
     }
 
@@ -1143,26 +1144,23 @@ XPCJSContext::InitTLS()
 
 // static
 XPCJSContext*
 XPCJSContext::NewXPCJSContext(XPCJSContext* aPrimaryContext)
 {
     XPCJSContext* self = new XPCJSContext();
     nsresult rv = self->Initialize(aPrimaryContext);
     if (NS_FAILED(rv)) {
-        NS_RUNTIMEABORT("new XPCJSContext failed to initialize.");
-        delete self;
-        return nullptr;
+        MOZ_CRASH("new XPCJSContext failed to initialize.");
     }
 
     if (self->Context())
         return self;
 
-    NS_RUNTIMEABORT("new XPCJSContext failed to initialize.");
-    return nullptr;
+    MOZ_CRASH("new XPCJSContext failed to initialize.");
 }
 
 void
 XPCJSContext::BeforeProcessTask(bool aMightBlock)
 {
     MOZ_ASSERT(NS_IsMainThread());
 
     // If ProcessNextEvent was called during a Promise "then" callback, we
--- a/js/xpconnect/src/nsXPConnect.cpp
+++ b/js/xpconnect/src/nsXPConnect.cpp
@@ -68,17 +68,17 @@ static XPCJSContext* gPrimaryContext;
 
 nsXPConnect::nsXPConnect()
     : mShuttingDown(false)
 {
     XPCJSContext::InitTLS();
 
     XPCJSContext* xpccx = XPCJSContext::NewXPCJSContext(nullptr);
     if (!xpccx) {
-        NS_RUNTIMEABORT("Couldn't create XPCJSContext.");
+        MOZ_CRASH("Couldn't create XPCJSContext.");
     }
     gPrimaryContext = xpccx;
     mRuntime = xpccx->Runtime();
 }
 
 nsXPConnect::~nsXPConnect()
 {
     MOZ_ASSERT(XPCJSContext::Get() == gPrimaryContext);
--- a/layout/style/StyleSheet.cpp
+++ b/layout/style/StyleSheet.cpp
@@ -238,17 +238,17 @@ StyleSheetInfo::StyleSheetInfo(CORSMode 
   , mReferrerPolicy(aReferrerPolicy)
   , mIntegrity(aIntegrity)
   , mComplete(false)
 #ifdef DEBUG
   , mPrincipalSet(false)
 #endif
 {
   if (!mPrincipal) {
-    NS_RUNTIMEABORT("NullPrincipal::Init failed");
+    MOZ_CRASH("NullPrincipal::Init failed");
   }
 }
 
 StyleSheetInfo::StyleSheetInfo(StyleSheetInfo& aCopy,
                                StyleSheet* aPrimarySheet)
   : mSheetURI(aCopy.mSheetURI)
   , mOriginalSheetURI(aCopy.mOriginalSheetURI)
   , mBaseURI(aCopy.mBaseURI)
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -835,40 +835,35 @@ nsComputedDOMStyle::GetPresShellForConte
 }
 
 // nsDOMCSSDeclaration abstract methods which should never be called
 // on a nsComputedDOMStyle object, but must be defined to avoid
 // compile errors.
 DeclarationBlock*
 nsComputedDOMStyle::GetCSSDeclaration(Operation)
 {
-  NS_RUNTIMEABORT("called nsComputedDOMStyle::GetCSSDeclaration");
-  return nullptr;
+  MOZ_CRASH("called nsComputedDOMStyle::GetCSSDeclaration");
 }
 
 nsresult
 nsComputedDOMStyle::SetCSSDeclaration(DeclarationBlock*)
 {
-  NS_RUNTIMEABORT("called nsComputedDOMStyle::SetCSSDeclaration");
-  return NS_ERROR_FAILURE;
+  MOZ_CRASH("called nsComputedDOMStyle::SetCSSDeclaration");
 }
 
 nsIDocument*
 nsComputedDOMStyle::DocToUpdate()
 {
-  NS_RUNTIMEABORT("called nsComputedDOMStyle::DocToUpdate");
-  return nullptr;
+  MOZ_CRASH("called nsComputedDOMStyle::DocToUpdate");
 }
 
 void
 nsComputedDOMStyle::GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv)
 {
-  NS_RUNTIMEABORT("called nsComputedDOMStyle::GetCSSParsingEnvironment");
-  // Just in case NS_RUNTIMEABORT ever stops killing us for some reason
-  aCSSParseEnv.mPrincipal = nullptr;
+  MOZ_CRASH("called nsComputedDOMStyle::GetCSSParsingEnvironment");
 }
 
 nsDOMCSSDeclaration::ServoCSSParsingEnvironment
 nsComputedDOMStyle::GetServoCSSParsingEnvironment() const
 {
   MOZ_CRASH("called nsComputedDOMStyle::GetServoCSSParsingEnvironment");
 }
 
--- a/toolkit/xre/AutoSQLiteLifetime.cpp
+++ b/toolkit/xre/AutoSQLiteLifetime.cpp
@@ -126,17 +126,17 @@ const sqlite3_mem_methods memMethods = {
 
 #endif  // MOZ_STORAGE_MEMORY
 
 namespace mozilla {
 
 AutoSQLiteLifetime::AutoSQLiteLifetime()
 {
   if (++AutoSQLiteLifetime::sSingletonEnforcer != 1) {
-    NS_RUNTIMEABORT("multiple instances of AutoSQLiteLifetime constructed!");
+    MOZ_CRASH("multiple instances of AutoSQLiteLifetime constructed!");
   }
 
 #ifdef MOZ_STORAGE_MEMORY
   sResult = ::sqlite3_config(SQLITE_CONFIG_MALLOC, &memMethods);
 #else
   sResult = SQLITE_OK;
 #endif
 
--- a/xpcom/tests/gtest/TestDeadlockDetectorScalability.cpp
+++ b/xpcom/tests/gtest/TestDeadlockDetectorScalability.cpp
@@ -47,17 +47,17 @@ TEST(DeadlockDetectorScalability, DISABL
 {
     // NB: Using a larger test size to stress our traversal logic.
     const int N = 1 << 17; // 131k
     const int K = 100;
 
     mozilla::Mutex* lock = new mozilla::Mutex("deadlockDetector.scalability.t2.master");
     mozilla::Mutex** locks = new mozilla::Mutex*[N];
     if (!locks)
-        NS_RUNTIMEABORT("couldn't allocate lock array");
+        MOZ_CRASH("couldn't allocate lock array");
 
     for (int i = 0; i < N; ++i)
         locks[i] =
             new mozilla::Mutex("deadlockDetector.scalability.t2.dep");
 
     // establish orders
     {mozilla::MutexAutoLock m(*lock);
         for (int i = 0; i < N; ++i)
@@ -89,17 +89,17 @@ TEST(DeadlockDetectorScalability, DISABL
 
 TEST(DeadlockDetectorScalability, MaxDepsNsq)
 {
     const int N = 1 << 10; // 1k
     const int K = 10;
 
     mozilla::Mutex** locks = new mozilla::Mutex*[N];
     if (!locks)
-        NS_RUNTIMEABORT("couldn't allocate lock array");
+        MOZ_CRASH("couldn't allocate lock array");
 
     for (int i = 0; i < N; ++i)
         locks[i] = new mozilla::Mutex("deadlockDetector.scalability.t3");
 
     for (int i = 0; i < N; ++i) {
         mozilla::MutexAutoLock al1(*locks[i]);
         for (int j = i+1; j < N; ++j)
             mozilla::MutexAutoLock al2(*locks[j]);