From aca9b90afe9dfabf7b0b5826f96bdafb46a66aae Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Sun, 20 Apr 2014 00:36:40 -0700 Subject: [PATCH] Bug 990764 - Replace MOZ_ASSUME_UNREACHABLE in dom. r=smaug --- dom/asmjscache/AsmJSCache.cpp | 12 ++++++------ dom/audiochannel/AudioChannelService.cpp | 6 +++--- dom/base/ScriptSettings.cpp | 2 +- dom/bluetooth/bluez/BluetoothHfpManager.cpp | 2 +- dom/camera/DOMCameraControl.cpp | 8 ++++---- dom/camera/DOMCameraControlListener.cpp | 2 +- dom/camera/GonkCameraControl.cpp | 4 +++- dom/indexedDB/IDBCursor.cpp | 12 ++++++------ dom/indexedDB/IDBObjectStore.cpp | 4 ++-- dom/network/src/NetUtils.h | 2 +- dom/quota/PersistenceType.h | 4 +--- dom/quota/QuotaManager.cpp | 2 +- dom/system/gonk/AudioManager.cpp | 2 +- dom/workers/RuntimeService.cpp | 2 +- dom/workers/WorkerPrivate.cpp | 10 +++++----- dom/workers/WorkerRunnable.cpp | 6 +++--- dom/workers/XMLHttpRequest.cpp | 2 +- 17 files changed, 41 insertions(+), 41 deletions(-) diff --git a/dom/asmjscache/AsmJSCache.cpp b/dom/asmjscache/AsmJSCache.cpp index 6a285ccd8a3a..82e6cc1ce9a1 100644 --- a/dom/asmjscache/AsmJSCache.cpp +++ b/dom/asmjscache/AsmJSCache.cpp @@ -1042,11 +1042,11 @@ MainProcessRunnable::Run() case eWaitingToOpenCacheFileForRead: case eOpened: case eFinished: { - MOZ_ASSUME_UNREACHABLE("Shouldn't Run() in this state"); + MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("Shouldn't Run() in this state"); } } - MOZ_ASSUME_UNREACHABLE("Corrupt state"); + MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("Corrupt state"); return NS_OK; } @@ -1511,11 +1511,11 @@ ChildProcessRunnable::Run() case eOpening: case eOpened: case eFinished: { - MOZ_ASSUME_UNREACHABLE("Shouldn't Run() in this state"); + MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("Shouldn't Run() in this state"); } } - MOZ_ASSUME_UNREACHABLE("Corrupt state"); + MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("Corrupt state"); return NS_OK; } @@ -1824,13 +1824,13 @@ public: WaitForStoragesToComplete(nsTArray& aStorages, nsIRunnable* aCallback) MOZ_OVERRIDE { - MOZ_ASSUME_UNREACHABLE("There are no storages"); + MOZ_ASSERT_UNREACHABLE("There are no storages"); } virtual void AbortTransactionsForStorage(nsIOfflineStorage* aStorage) MOZ_OVERRIDE { - MOZ_ASSUME_UNREACHABLE("There are no storages"); + MOZ_ASSERT_UNREACHABLE("There are no storages"); } virtual bool diff --git a/dom/audiochannel/AudioChannelService.cpp b/dom/audiochannel/AudioChannelService.cpp index 6efff476bafa..1b81f622a108 100644 --- a/dom/audiochannel/AudioChannelService.cpp +++ b/dom/audiochannel/AudioChannelService.cpp @@ -750,9 +750,9 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const ch } else if (!keyStr.EqualsLiteral("audio.volume.bt_sco")) { // bt_sco is not a valid audio channel so we manipulate it in // AudioManager.cpp. And the others should not be used. - // We didn't use MOZ_ASSUME_UNREACHABLE here because any web content who - // has permission of mozSettings can set any names then it can be easy to - // crash the B2G. + // We didn't use MOZ_CRASH or MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE here + // because any web content who has permission of mozSettings can set any + // names then it can be easy to crash the B2G. NS_WARNING("unexpected audio channel for volume control"); } } diff --git a/dom/base/ScriptSettings.cpp b/dom/base/ScriptSettings.cpp index 77a34d021c6f..5507c9060cd7 100644 --- a/dom/base/ScriptSettings.cpp +++ b/dom/base/ScriptSettings.cpp @@ -68,7 +68,7 @@ public: return mStack[i]; } } - MOZ_ASSUME_UNREACHABLE("Non-empty stack should always have an entry point"); + MOZ_CRASH("Non-empty stack should always have an entry point"); } nsIGlobalObject* EntryGlobal() { diff --git a/dom/bluetooth/bluez/BluetoothHfpManager.cpp b/dom/bluetooth/bluez/BluetoothHfpManager.cpp index a688759ade8a..b06fa1054833 100644 --- a/dom/bluetooth/bluez/BluetoothHfpManager.cpp +++ b/dom/bluetooth/bluez/BluetoothHfpManager.cpp @@ -1824,7 +1824,7 @@ BluetoothHfpManager::OnUpdateSdpRecords(const nsAString& aDeviceAddress) { // UpdateSdpRecord() is not called so this callback function should not // be invoked. - MOZ_ASSUME_UNREACHABLE("UpdateSdpRecords() should be called somewhere"); + MOZ_ASSERT_UNREACHABLE("UpdateSdpRecords() should be called somewhere"); } void diff --git a/dom/camera/DOMCameraControl.cpp b/dom/camera/DOMCameraControl.cpp index e0553e99b91b..26c508e1704b 100644 --- a/dom/camera/DOMCameraControl.cpp +++ b/dom/camera/DOMCameraControl.cpp @@ -179,7 +179,7 @@ nsDOMCameraControl::nsDOMCameraControl(uint32_t aCameraId, break; default: - MOZ_ASSUME_UNREACHABLE("Unanticipated camera mode!"); + MOZ_ASSERT_UNREACHABLE("Unanticipated camera mode!"); } config.mPreviewSize.width = aInitialConfig.mPreviewSize.mWidth; @@ -1068,7 +1068,7 @@ nsDOMCameraControl::OnHardwareStateChange(CameraControlListener::HardwareState a break; default: - MOZ_ASSUME_UNREACHABLE("Unanticipated camera hardware state"); + MOZ_ASSERT_UNREACHABLE("Unanticipated camera hardware state"); } } @@ -1163,7 +1163,7 @@ nsDOMCameraControl::OnRecorderStateChange(CameraControlListener::RecorderState a #endif default: - MOZ_ASSUME_UNREACHABLE("Unanticipated video recorder error"); + MOZ_ASSERT_UNREACHABLE("Unanticipated video recorder error"); return; } @@ -1344,7 +1344,7 @@ nsDOMCameraControl::OnUserError(CameraControlListener::UserContext aContext, nsr nsPrintfCString msg("Unhandled aContext=%u, aError=0x%x\n", aContext, aError); NS_WARNING(msg.get()); } - MOZ_ASSUME_UNREACHABLE("Unhandled user error"); + MOZ_ASSERT_UNREACHABLE("Unhandled user error"); return; } diff --git a/dom/camera/DOMCameraControlListener.cpp b/dom/camera/DOMCameraControlListener.cpp index a9751506001c..5105d8371e65 100644 --- a/dom/camera/DOMCameraControlListener.cpp +++ b/dom/camera/DOMCameraControlListener.cpp @@ -131,7 +131,7 @@ DOMCameraControlListener::OnPreviewStateChange(PreviewState aState) default: DOM_CAMERA_LOGE("Unknown preview state %d\n", aState); - MOZ_ASSUME_UNREACHABLE("Invalid preview state"); + MOZ_ASSERT_UNREACHABLE("Invalid preview state"); return; } NS_DispatchToMainThread(new Callback(mDOMCameraControl, aState)); diff --git a/dom/camera/GonkCameraControl.cpp b/dom/camera/GonkCameraControl.cpp index f5fc25a9be49..27c715464124 100644 --- a/dom/camera/GonkCameraControl.cpp +++ b/dom/camera/GonkCameraControl.cpp @@ -221,7 +221,9 @@ nsGonkCameraControl::SetConfigurationInternal(const Configuration& aConfig) break; default: - MOZ_ASSUME_UNREACHABLE("Unanticipated camera mode in SetConfigurationInternal()"); + MOZ_ASSERT_UNREACHABLE("Unanticipated camera mode in SetConfigurationInternal()"); + rv = NS_ERROR_FAILURE; + break; } DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__); diff --git a/dom/indexedDB/IDBCursor.cpp b/dom/indexedDB/IDBCursor.cpp index 15e5e25deb7a..bb33d31540e3 100644 --- a/dom/indexedDB/IDBCursor.cpp +++ b/dom/indexedDB/IDBCursor.cpp @@ -351,7 +351,7 @@ IDBCursor::ConvertDirection(mozilla::dom::IDBCursorDirection aDirection) return PREV_UNIQUE; default: - MOZ_ASSUME_UNREACHABLE("Unknown direction!"); + MOZ_CRASH("Unknown direction!"); } } @@ -492,7 +492,7 @@ IDBCursor::ContinueInternal(const Key& aKey, int32_t aCount, ErrorResult& aRv) break; default: - MOZ_ASSUME_UNREACHABLE("Unknown cursor type!"); + MOZ_CRASH("Unknown cursor type!"); } nsresult rv = helper->DispatchToTransactionPool(); @@ -560,7 +560,7 @@ IDBCursor::WrapObject(JSContext* aCx) return IDBCursorBinding::Wrap(aCx, this); default: - MOZ_ASSUME_UNREACHABLE("Bad type!"); + MOZ_CRASH("Bad type!"); } } @@ -583,7 +583,7 @@ IDBCursor::GetDirection() const return mozilla::dom::IDBCursorDirection::Prevunique; default: - MOZ_ASSUME_UNREACHABLE("Bad direction!"); + MOZ_CRASH("Bad direction!"); } } @@ -606,7 +606,7 @@ IDBCursor::GetSource(OwningIDBObjectStoreOrIDBIndex& aSource) const break; default: - MOZ_ASSUME_UNREACHABLE("Bad type!"); + MOZ_ASSERT_UNREACHABLE("Bad type!"); } } @@ -724,7 +724,7 @@ IDBCursor::Continue(JSContext* aCx, break; default: - MOZ_ASSUME_UNREACHABLE("Unknown direction type!"); + MOZ_CRASH("Unknown direction type!"); } } diff --git a/dom/indexedDB/IDBObjectStore.cpp b/dom/indexedDB/IDBObjectStore.cpp index 099c93820bbf..a971d91f432e 100644 --- a/dom/indexedDB/IDBObjectStore.cpp +++ b/dom/indexedDB/IDBObjectStore.cpp @@ -4125,7 +4125,7 @@ OpenKeyCursorHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */) break; default: - MOZ_ASSUME_UNREACHABLE("Unknown direction type!"); + MOZ_CRASH("Unknown direction type!"); } nsCString firstQuery = queryStart + keyRangeClause + directionClause + @@ -4197,7 +4197,7 @@ OpenKeyCursorHelper::DoDatabaseWork(mozIStorageConnection* /* aConnection */) break; default: - MOZ_ASSUME_UNREACHABLE("Unknown direction type!"); + MOZ_CRASH("Unknown direction type!"); } mContinueQuery = queryStart + keyRangeClause + directionClause + openLimit; diff --git a/dom/network/src/NetUtils.h b/dom/network/src/NetUtils.h index fbdd7213cc71..ebc8fb669dad 100644 --- a/dom/network/src/NetUtils.h +++ b/dom/network/src/NetUtils.h @@ -65,7 +65,7 @@ public: #define USE_DLFUNC(name) \ FUNC##name name = (FUNC##name) dlsym(GetSharedLibrary(), #name); \ if (!name) { \ - MOZ_ASSUME_UNREACHABLE("Symbol not found in shared library : " #name); \ + MOZ_CRASH("Symbol not found in shared library : " #name); \ } #endif // NetUtils_h diff --git a/dom/quota/PersistenceType.h b/dom/quota/PersistenceType.h index 736747312a4d..a5546bf12025 100644 --- a/dom/quota/PersistenceType.h +++ b/dom/quota/PersistenceType.h @@ -37,8 +37,6 @@ PersistenceTypeToText(PersistenceType aPersistenceType, nsACString& aText) default: MOZ_CRASH("Bad persistence type value!"); } - - MOZ_ASSUME_UNREACHABLE("Should never get here!"); } inline PersistenceType @@ -52,7 +50,7 @@ PersistenceTypeFromText(const nsACString& aText) return PERSISTENCE_TYPE_TEMPORARY; } - MOZ_ASSUME_UNREACHABLE("Should never get here!"); + MOZ_CRASH("Should never get here!"); } inline nsresult diff --git a/dom/quota/QuotaManager.cpp b/dom/quota/QuotaManager.cpp index 6e9f9e9474c3..2ef99ac7a4ab 100644 --- a/dom/quota/QuotaManager.cpp +++ b/dom/quota/QuotaManager.cpp @@ -430,7 +430,7 @@ public: mCallbackState = Complete; return; default: - MOZ_ASSUME_UNREACHABLE("Can't advance past Complete!"); + MOZ_ASSERT_UNREACHABLE("Can't advance past Complete!"); } } diff --git a/dom/system/gonk/AudioManager.cpp b/dom/system/gonk/AudioManager.cpp index 458cd9a7118c..f9b0ed8ab86d 100644 --- a/dom/system/gonk/AudioManager.cpp +++ b/dom/system/gonk/AudioManager.cpp @@ -144,7 +144,7 @@ public: static_cast(audioManager.get())->SetStreamVolumeIndex( AUDIO_STREAM_BLUETOOTH_SCO, volIndex); } else { - MOZ_ASSUME_UNREACHABLE("unexpected audio channel for initializing " + MOZ_ASSERT_UNREACHABLE("unexpected audio channel for initializing " "volume control"); } diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index b34cba320f7f..83610036d683 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -2450,7 +2450,7 @@ NS_IMETHODIMP RuntimeService::WorkerThread::Observer::OnDispatchedEvent( nsIThreadInternal* /*aThread */) { - MOZ_ASSUME_UNREACHABLE("This should never be called!"); + MOZ_CRASH("OnDispatchedEvent() should never be called!"); } NS_IMETHODIMP diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 01f365ebab45..25a05b9f1633 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -894,14 +894,14 @@ private: virtual bool PreDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate) MOZ_OVERRIDE { - MOZ_ASSUME_UNREACHABLE("Don't call Dispatch() on CloseEventRunnable!"); + MOZ_CRASH("Don't call Dispatch() on CloseEventRunnable!"); } virtual void PostDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate, bool aDispatchResult) MOZ_OVERRIDE { - MOZ_ASSUME_UNREACHABLE("Don't call Dispatch() on CloseEventRunnable!"); + MOZ_CRASH("Don't call Dispatch() on CloseEventRunnable!"); } virtual bool @@ -1500,14 +1500,14 @@ private: virtual bool PreDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate) MOZ_OVERRIDE { - MOZ_ASSUME_UNREACHABLE("Don't call Dispatch() on KillCloseEventRunnable!"); + MOZ_CRASH("Don't call Dispatch() on KillCloseEventRunnable!"); } virtual void PostDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate, bool aDispatchResult) MOZ_OVERRIDE { - MOZ_ASSUME_UNREACHABLE("Don't call Dispatch() on KillCloseEventRunnable!"); + MOZ_CRASH("Don't call Dispatch() on KillCloseEventRunnable!"); } virtual bool @@ -4066,7 +4066,7 @@ WorkerPrivate::DoRunLoop(JSContext* aCx) } } - MOZ_ASSUME_UNREACHABLE("Shouldn't get here!"); + MOZ_CRASH("Shouldn't get here!"); } void diff --git a/dom/workers/WorkerRunnable.cpp b/dom/workers/WorkerRunnable.cpp index cc6628445738..0e8f0da4d85b 100644 --- a/dom/workers/WorkerRunnable.cpp +++ b/dom/workers/WorkerRunnable.cpp @@ -67,7 +67,7 @@ WorkerRunnable::PreDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate) break; default: - MOZ_ASSUME_UNREACHABLE("Unknown behavior!"); + MOZ_ASSERT_UNREACHABLE("Unknown behavior!"); } #endif @@ -154,7 +154,7 @@ WorkerRunnable::PostDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate, break; default: - MOZ_ASSUME_UNREACHABLE("Unknown behavior!"); + MOZ_ASSERT_UNREACHABLE("Unknown behavior!"); } #endif @@ -190,7 +190,7 @@ WorkerRunnable::PostRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate, break; default: - MOZ_ASSUME_UNREACHABLE("Unknown behavior!"); + MOZ_ASSERT_UNREACHABLE("Unknown behavior!"); } #endif diff --git a/dom/workers/XMLHttpRequest.cpp b/dom/workers/XMLHttpRequest.cpp index dc6bd64531d4..1bdd15432c19 100644 --- a/dom/workers/XMLHttpRequest.cpp +++ b/dom/workers/XMLHttpRequest.cpp @@ -203,7 +203,7 @@ ConvertStringToResponseType(const nsAString& aString) } } - MOZ_ASSUME_UNREACHABLE("Don't know anything about this response type!"); + MOZ_CRASH("Don't know anything about this response type!"); } enum