Bug 1412048 - Replace NS_RUNTIMEABORT("...") with MOZ_CRASH("..."). r=froydnj

And remove unreachable code after MOZ_CRASH().

MozReview-Commit-ID: 6ShBtPRKYlF

--HG--
extra : rebase_source : 0fe45a59411bda663828336e2686707b550144ae
extra : source : 8473fd7333d2abe1ea1cc176510c292a5b34df45
This commit is contained in:
Chris Peterson 2017-10-24 23:30:31 -07:00
parent 4046844eac
commit 1df202b177
21 changed files with 53 additions and 94 deletions

View File

@ -3121,8 +3121,7 @@ ContentChild::RecvSetAudioSessionData(const nsID& aId,
mozilla::widget::StartAudioSession();
return IPC_OK();
#else
NS_RUNTIMEABORT("Not Reached!");
return IPC_FAIL_NO_REASON(this);
MOZ_CRASH("Not Reached!");
#endif
}
@ -3580,8 +3579,7 @@ ContentChild::RecvShareCodeCoverageMutex(const CrossProcessMutexHandle& aHandle)
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
}
@ -3592,8 +3590,7 @@ ContentChild::RecvDumpCodeCoverageCounters()
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
}
@ -3604,8 +3601,7 @@ ContentChild::RecvResetCodeCoverageCounters()
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
}

View File

@ -1063,8 +1063,7 @@ 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();

View File

@ -755,8 +755,7 @@ PluginInstanceChild::AnswerNPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId(
#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
}
@ -1075,8 +1074,7 @@ 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
@ -1090,8 +1088,7 @@ PluginInstanceChild::RecvWindowPosChanged(const NPRemoteEvent& event)
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
}
@ -1110,8 +1107,7 @@ PluginInstanceChild::RecvContentsScaleFactorChanged(const double& aContentsScale
#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
}

View File

@ -728,8 +728,7 @@ PluginModuleChild::RecvSetAudioSessionData(const nsID& aId,
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
@ -2616,7 +2615,7 @@ PluginModuleChild::RecvProcessNativeEventsInInterruptCall()
ProcessNativeEventsInInterruptCall();
return IPC_OK();
#else
NS_RUNTIMEABORT(
MOZ_CRASH(
"PluginModuleChild::RecvProcessNativeEventsInInterruptCall not implemented!");
return IPC_FAIL_NO_REASON(this);
#endif
@ -2663,8 +2662,7 @@ PluginModuleChild::PluginRequiresAudioDeviceChanges(
}
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
}
@ -2683,7 +2681,6 @@ PluginModuleChild::RecvNPP_SetValue_NPNVaudioDeviceChangeDetails(
}
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
}

View File

@ -1845,9 +1845,7 @@ PluginModuleChromeParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChange
}
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
}
@ -2582,8 +2580,7 @@ PluginModuleParent::AnswerProcessSomeEvents()
mozilla::ipc::IPCResult
PluginModuleParent::AnswerProcessSomeEvents()
{
NS_RUNTIMEABORT("unreached");
return IPC_FAIL_NO_REASON(this);
MOZ_CRASH("unreached");
}
#else
@ -2812,10 +2809,8 @@ 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

View File

@ -577,8 +577,7 @@ PresentationConnection::DoReceiveMessage(const nsACString& aData, bool aIsBinary
}
jsData.setObject(*arrayBuf);
} else {
NS_RUNTIMEABORT("Unknown binary type!");
return NS_ERROR_UNEXPECTED;
MOZ_CRASH("Unknown binary type!");
}
} else {
NS_ConvertUTF8toUTF16 utf16Data(aData);

View File

@ -5188,7 +5188,7 @@ HTMLEditRules::CheckForEmptyBlock(nsINode* aStartNode,
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);

View File

@ -105,7 +105,7 @@ ReadbackManagerD3D11::~ReadbackManagerD3D11()
::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.");
}
}
@ -136,7 +136,7 @@ ReadbackManagerD3D11::ProcessTasks()
::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);

View File

@ -975,7 +975,7 @@ DestroySurfaceDescriptor(IShmemAllocator* aAllocator, SurfaceDescriptor* aSurfac
break;
}
default:
NS_RUNTIMEABORT("surface type not implemented!");
MOZ_CRASH("surface type not implemented!");
}
*aSurface = SurfaceDescriptor();
}

View File

@ -68,29 +68,24 @@ public:
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,

View File

@ -93,8 +93,7 @@ VRManagerChild::InitForContent(Endpoint<PVRManagerChild>&& aEndpoint)
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;
@ -131,8 +130,7 @@ VRManagerChild::InitWithGPUProcess(Endpoint<PVRManagerChild>&& aEndpoint)
sVRManagerChildSingleton = new VRManagerChild();
if (!aEndpoint.Bind(sVRManagerChildSingleton)) {
NS_RUNTIMEABORT("Couldn't Open() Compositor channel.");
return;
MOZ_CRASH("Couldn't Open() Compositor channel.");
}
}

View File

@ -219,47 +219,44 @@ DisableSwitchNotifications(SwitchDevice 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

View File

@ -107,10 +107,8 @@ mozilla::ipc::IPCResult
TestCrashCleanupChild::AnswerDIEDIEDIE()
{
_exit(0);
NS_RUNTIMEABORT("unreached");
return IPC_FAIL_NO_REASON(this);
MOZ_CRASH("unreached");
}
} // namespace _ipdltest
} // namespace mozilla

View File

@ -146,10 +146,8 @@ mozilla::ipc::IPCResult
TestInterruptErrorCleanupChild::AnswerError()
{
_exit(0);
NS_RUNTIMEABORT("unreached");
return IPC_FAIL_NO_REASON(this);
MOZ_CRASH("unreached");
}
} // namespace _ipdltest
} // namespace mozilla

View File

@ -126,10 +126,8 @@ mozilla::ipc::IPCResult
TestInterruptShutdownRaceChild::AnswerExit()
{
_exit(0);
NS_RUNTIMEABORT("unreached");
return IPC_FAIL_NO_REASON(this);
MOZ_CRASH("unreached");
}
} // namespace _ipdltest
} // namespace mozilla

View File

@ -127,10 +127,11 @@ class Watchdog
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);
@ -142,7 +143,7 @@ class Watchdog
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
@ -1148,16 +1149,13 @@ 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

View File

@ -73,7 +73,7 @@ nsXPConnect::nsXPConnect()
XPCJSContext* xpccx = XPCJSContext::NewXPCJSContext(nullptr);
if (!xpccx) {
NS_RUNTIMEABORT("Couldn't create XPCJSContext.");
MOZ_CRASH("Couldn't create XPCJSContext.");
}
gPrimaryContext = xpccx;
mRuntime = xpccx->Runtime();

View File

@ -243,7 +243,7 @@ StyleSheetInfo::StyleSheetInfo(CORSMode aCORSMode,
#endif
{
if (!mPrincipal) {
NS_RUNTIMEABORT("NullPrincipal::Init failed");
MOZ_CRASH("NullPrincipal::Init failed");
}
}

View File

@ -840,30 +840,25 @@ nsComputedDOMStyle::GetPresShellForContent(const nsIContent* aContent)
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

View File

@ -131,7 +131,7 @@ 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

View File

@ -52,7 +52,7 @@ TEST(DeadlockDetectorScalability, DISABLED_OneLockNDeps)
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] =
@ -94,7 +94,7 @@ TEST(DeadlockDetectorScalability, MaxDepsNsq)
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");