Bug 1931877, part 2 - Replace 2 arg MOZ_DIAGNOSTIC_ASSERT(false) with MOZ_DIAGNOSTIC_CRASH. r=necko-reviewers,win-reviewers,glandium,rkraesig,valentin

Differential Revision: https://phabricator.services.mozilla.com/D229361
This commit is contained in:
Andrew McCreight 2024-11-20 16:37:50 +00:00
parent e239bce2c0
commit 67817a936e
40 changed files with 76 additions and 83 deletions

View File

@ -795,7 +795,7 @@ ipc::IPCResult DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
// This diagnostic assert and the one down below expect a well-behaved
// child process. In IPC fuzzing, we directly fuzz parameters of each
// method over IPDL and the asserts are not valid under these conditions.
MOZ_DIAGNOSTIC_ASSERT(false, "Binding to nonexistent proxy!");
MOZ_DIAGNOSTIC_CRASH("Binding to nonexistent proxy!");
#endif
return IPC_FAIL(this, "binding to nonexistant proxy!");
}
@ -809,8 +809,7 @@ ipc::IPCResult DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
if (!outerDoc->IsOuterDoc() || outerDoc->ChildCount() > 1 ||
(outerDoc->ChildCount() == 1 && !outerDoc->RemoteChildAt(0)->IsDoc())) {
#ifndef FUZZING_SNAPSHOT
MOZ_DIAGNOSTIC_ASSERT(false,
"Binding to parent that isn't a valid OuterDoc!");
MOZ_DIAGNOSTIC_CRASH("Binding to parent that isn't a valid OuterDoc!");
#endif
return IPC_FAIL(this, "Binding to parent that isn't a valid OuterDoc!");
}

View File

@ -1563,7 +1563,7 @@ JSObject* BrowsingContext::ReadStructuredClone(JSContext* aCx,
// Note: Do this check after reading our ID data. Returning null will abort
// the decode operation anyway, but we should at least be as safe as possible.
if (NS_WARN_IF(!NS_IsMainThread())) {
MOZ_DIAGNOSTIC_ASSERT(false,
MOZ_DIAGNOSTIC_CRASH(
"We shouldn't be trying to decode a BrowsingContext "
"on a background thread.");
return nullptr;

View File

@ -3094,7 +3094,7 @@ already_AddRefed<nsIPrincipal> Document::MaybeDowngradePrincipal(
// extension principal, in the case of extension content scripts).
auto* basePrin = BasePrincipal::Cast(aPrincipal);
if (basePrin->Is<ExpandedPrincipal>()) {
MOZ_DIAGNOSTIC_ASSERT(false,
MOZ_DIAGNOSTIC_CRASH(
"Should never try to create a document with "
"an expanded principal");

View File

@ -313,16 +313,14 @@ nsIGlobalObject::GetServiceWorkerContainer() {
RefPtr<ServiceWorker> nsIGlobalObject::GetOrCreateServiceWorker(
const ServiceWorkerDescriptor& aDescriptor) {
MOZ_DIAGNOSTIC_ASSERT(false,
"this global should not have any service workers");
MOZ_DIAGNOSTIC_CRASH("this global should not have any service workers");
return nullptr;
}
RefPtr<ServiceWorkerRegistration> nsIGlobalObject::GetServiceWorkerRegistration(
const mozilla::dom::ServiceWorkerRegistrationDescriptor& aDescriptor)
const {
MOZ_DIAGNOSTIC_ASSERT(false,
"this global should not have any service workers");
MOZ_DIAGNOSTIC_CRASH("this global should not have any service workers");
return nullptr;
}

View File

@ -3452,7 +3452,7 @@ mozilla::ipc::IPCResult ContentChild::RecvCrossProcessRedirect(
nsresult rv = mozilla::ipc::LoadInfoArgsToLoadInfo(
aArgs.loadInfo(), NOT_REMOTE_TYPE, getter_AddRefs(loadInfo));
if (NS_FAILED(rv)) {
MOZ_DIAGNOSTIC_ASSERT(false, "LoadInfoArgsToLoadInfo failed");
MOZ_DIAGNOSTIC_CRASH("LoadInfoArgsToLoadInfo failed");
return IPC_OK();
}
@ -4224,7 +4224,7 @@ mozilla::ipc::IPCResult ContentChild::RecvReportFrameTimingData(
nsresult rv = mozilla::ipc::LoadInfoArgsToLoadInfo(
loadInfoArgs, NOT_REMOTE_TYPE, getter_AddRefs(loadInfo));
if (NS_FAILED(rv)) {
MOZ_DIAGNOSTIC_ASSERT(false, "LoadInfoArgsToLoadInfo failed");
MOZ_DIAGNOSTIC_CRASH("LoadInfoArgsToLoadInfo failed");
return IPC_OK();
}

View File

@ -196,7 +196,7 @@ size_t AudioConverter::DownmixAudio(void* aOut, const void* aIn,
dumbUpDownMix(static_cast<int16_t*>(aOut), outChannels,
static_cast<const int16_t*>(aIn), inChannels, aFrames);
} else {
MOZ_DIAGNOSTIC_ASSERT(false, "Unsupported data type");
MOZ_DIAGNOSTIC_CRASH("Unsupported data type");
}
return aFrames;
}
@ -312,7 +312,7 @@ size_t AudioConverter::DownmixAudio(void* aOut, const void* aIn,
}
}
} else {
MOZ_DIAGNOSTIC_ASSERT(false, "Unsupported data type");
MOZ_DIAGNOSTIC_CRASH("Unsupported data type");
}
return aFrames;
}
@ -337,7 +337,7 @@ size_t AudioConverter::DownmixAudio(void* aOut, const void* aIn,
*out++ = sample;
}
} else {
MOZ_DIAGNOSTIC_ASSERT(false, "Unsupported data type");
MOZ_DIAGNOSTIC_CRASH("Unsupported data type");
}
return aFrames;
}
@ -362,7 +362,7 @@ size_t AudioConverter::ResampleAudio(void* aOut, const void* aIn,
error = speex_resampler_process_interleaved_int(mResampler, in, &inframes,
out, &outframes);
} else {
MOZ_DIAGNOSTIC_ASSERT(false, "Unsupported data type");
MOZ_DIAGNOSTIC_CRASH("Unsupported data type");
error = RESAMPLER_ERR_ALLOC_FAILED;
}
MOZ_ASSERT(error == RESAMPLER_ERR_SUCCESS);
@ -425,7 +425,7 @@ size_t AudioConverter::UpmixAudio(void* aOut, const void* aIn,
dumbUpDownMix(static_cast<int16_t*>(aOut), mOut.Channels(),
static_cast<const int16_t*>(aIn), mIn.Channels(), aFrames);
} else {
MOZ_DIAGNOSTIC_ASSERT(false, "Unsupported data type");
MOZ_DIAGNOSTIC_CRASH("Unsupported data type");
}
return aFrames;
}
@ -454,7 +454,7 @@ size_t AudioConverter::UpmixAudio(void* aOut, const void* aIn,
*out++ = sample;
}
} else {
MOZ_DIAGNOSTIC_ASSERT(false, "Unsupported data type");
MOZ_DIAGNOSTIC_CRASH("Unsupported data type");
}
return aFrames;

View File

@ -348,7 +348,7 @@ class MediaDecoderStateMachine::DecodeMetadataState
RefPtr<MediaDecoder::SeekPromise> HandleSeek(
const SeekTarget& aTarget) override {
MOZ_DIAGNOSTIC_ASSERT(false, "Can't seek while decoding metadata.");
MOZ_DIAGNOSTIC_CRASH("Can't seek while decoding metadata.");
return MediaDecoder::SeekPromise::CreateAndReject(true, __func__);
}
@ -2835,28 +2835,28 @@ class MediaDecoderStateMachine::ShutdownState
RefPtr<ShutdownPromise> Enter();
void Exit() override {
MOZ_DIAGNOSTIC_ASSERT(false, "Shouldn't escape the SHUTDOWN state.");
MOZ_DIAGNOSTIC_CRASH("Shouldn't escape the SHUTDOWN state.");
}
State GetState() const override { return DECODER_STATE_SHUTDOWN; }
RefPtr<MediaDecoder::SeekPromise> HandleSeek(
const SeekTarget& aTarget) override {
MOZ_DIAGNOSTIC_ASSERT(false, "Can't seek in shutdown state.");
MOZ_DIAGNOSTIC_CRASH("Can't seek in shutdown state.");
return MediaDecoder::SeekPromise::CreateAndReject(true, __func__);
}
RefPtr<ShutdownPromise> HandleShutdown() override {
MOZ_DIAGNOSTIC_ASSERT(false, "Already shutting down.");
MOZ_DIAGNOSTIC_CRASH("Already shutting down.");
return nullptr;
}
void HandleVideoSuspendTimeout() override {
MOZ_DIAGNOSTIC_ASSERT(false, "Already shutting down.");
MOZ_DIAGNOSTIC_CRASH("Already shutting down.");
}
void HandleResumeVideoDecoding(const TimeUnit&) override {
MOZ_DIAGNOSTIC_ASSERT(false, "Already shutting down.");
MOZ_DIAGNOSTIC_CRASH("Already shutting down.");
}
};

View File

@ -1401,7 +1401,7 @@ void MediaTrackGraphImpl::UpdateGraph(GraphTime aEndBlockingDecisions) {
MediaTimeToSeconds(track->GetEnd()),
MediaTimeToSeconds(
track->GraphTimeToTrackTime(aEndBlockingDecisions))));
MOZ_DIAGNOSTIC_ASSERT(false,
MOZ_DIAGNOSTIC_CRASH(
"A non-ended SourceMediaTrack wasn't fed "
"enough data by NotifyPull");
}

View File

@ -335,7 +335,7 @@ class VideoFrameConverterImpl {
rtc::scoped_refptr<webrtc::I420Buffer> buffer =
mBufferPool.CreateI420Buffer(aFrame.mSize.width, aFrame.mSize.height);
if (!buffer) {
MOZ_DIAGNOSTIC_ASSERT(false,
MOZ_DIAGNOSTIC_CRASH(
"Buffers not leaving scope except for "
"reconfig, should never leak");
LOG(LogLevel::Warning,

View File

@ -299,7 +299,7 @@ void HLSDecoder::UpdateCurrentPrincipal(nsIURI* aMediaUri) {
// Principals are disjoint -- no access.
mContentPrincipal = NullPrincipal::Create(OriginAttributes());
} else {
MOZ_DIAGNOSTIC_ASSERT(false, "non-equal principals should be disjoint");
MOZ_DIAGNOSTIC_CRASH("non-equal principals should be disjoint");
mContentPrincipal = nullptr;
}
MediaDecoder::NotifyPrincipalChanged();

View File

@ -653,7 +653,7 @@ void RespondWithHandler::ResolvedCallback(JSContext* aCx,
if (NS_WARN_IF((response->Type() == ResponseType::Opaque ||
response->Type() == ResponseType::Cors) &&
ir->GetUnfilteredURL().IsEmpty())) {
MOZ_DIAGNOSTIC_ASSERT(false, "Cors or opaque Response without a URL");
MOZ_DIAGNOSTIC_CRASH("Cors or opaque Response without a URL");
return;
}

View File

@ -1542,7 +1542,7 @@ void FetchEventOp::ResolvedCallback(JSContext* aCx,
if (NS_WARN_IF((response->Type() == ResponseType::Opaque ||
response->Type() == ResponseType::Cors) &&
ir->GetUnfilteredURL().IsEmpty())) {
MOZ_DIAGNOSTIC_ASSERT(false, "Cors or opaque Response without a URL");
MOZ_DIAGNOSTIC_CRASH("Cors or opaque Response without a URL");
return;
}

View File

@ -1031,7 +1031,7 @@ CompareNetwork::OnStreamComplete(nsIStreamLoader* aLoader,
// Make non-release and debug builds to crash if this happens and fail
// explicitly on release builds.
MOZ_DIAGNOSTIC_ASSERT(false,
MOZ_DIAGNOSTIC_CRASH(
"ServiceWorker imported script redirected to an url "
"with an unexpected scheme");
return NS_ERROR_UNEXPECTED;

View File

@ -49,7 +49,7 @@ nsresult nsXMLPrettyPrinter::PrettyPrint(Document* aDocument,
// nsXMLContentSink should not ask us to pretty print an XML doc that comes
// with a CanAttachShadowDOM() == true root element, but just in case:
if (rootElement->CanAttachShadowDOM()) {
MOZ_DIAGNOSTIC_ASSERT(false, "We shouldn't be getting this root element");
MOZ_DIAGNOSTIC_CRASH("We shouldn't be getting this root element");
return NS_ERROR_UNEXPECTED;
}

View File

@ -37,10 +37,10 @@ static inline SkColorType GfxFormatToSkiaColorType(SurfaceFormat format) {
case SurfaceFormat::R8G8B8A8:
return kRGBA_8888_SkColorType;
case SurfaceFormat::A8R8G8B8:
MOZ_DIAGNOSTIC_ASSERT(false, "A8R8G8B8 unsupported by Skia");
MOZ_DIAGNOSTIC_CRASH("A8R8G8B8 unsupported by Skia");
return kRGBA_8888_SkColorType;
default:
MOZ_DIAGNOSTIC_ASSERT(false, "Unknown surface format");
MOZ_DIAGNOSTIC_CRASH("Unknown surface format");
return kRGBA_8888_SkColorType;
}
}

View File

@ -277,8 +277,7 @@ CanvasRenderThread::CreateWorkerTaskQueue() {
/* static */ void CanvasRenderThread::Dispatch(
already_AddRefed<nsIRunnable> aRunnable) {
if (!sCanvasRenderThread) {
MOZ_DIAGNOSTIC_ASSERT(false,
"Dispatching after CanvasRenderThread shutdown!");
MOZ_DIAGNOSTIC_CRASH("Dispatching after CanvasRenderThread shutdown!");
return;
}
sCanvasRenderThread->mThread->Dispatch(std::move(aRunnable));

View File

@ -279,7 +279,7 @@ bool CanvasTranslator::AddBuffer(ipc::SharedMemory::Handle&& aBufferHandle,
gfxCriticalNote << "CanvasTranslator::AddBuffer bad state "
<< uint32_t(State(mHeader->readerState));
#ifndef FUZZING_SNAPSHOT
MOZ_DIAGNOSTIC_ASSERT(false, "mHeader->readerState == State::Paused");
MOZ_DIAGNOSTIC_CRASH("mHeader->readerState == State::Paused");
#endif
Deactivate();
return false;
@ -343,7 +343,7 @@ bool CanvasTranslator::SetDataSurfaceBuffer(
gfxCriticalNote << "CanvasTranslator::SetDataSurfaceBuffer bad state "
<< uint32_t(State(mHeader->readerState));
#ifndef FUZZING_SNAPSHOT
MOZ_DIAGNOSTIC_ASSERT(false, "mHeader->readerState == State::Paused");
MOZ_DIAGNOSTIC_CRASH("mHeader->readerState == State::Paused");
#endif
Deactivate();
return false;
@ -1152,7 +1152,7 @@ already_AddRefed<gfx::DrawTarget> CanvasTranslator::CreateDrawTarget(
const gfx::IntSize& aSize, gfx::SurfaceFormat aFormat) {
if (!aTextureOwnerId.IsValid()) {
#ifndef FUZZING_SNAPSHOT
MOZ_DIAGNOSTIC_ASSERT(false, "No texture owner set");
MOZ_DIAGNOSTIC_CRASH("No texture owner set");
#endif
return nullptr;
}
@ -1191,7 +1191,7 @@ already_AddRefed<gfx::DrawTarget> CanvasTranslator::CreateDrawTarget(
gfx::ReferencePtr aRefPtr, const gfx::IntSize& aSize,
gfx::SurfaceFormat aFormat) {
#ifndef FUZZING_SNAPSHOT
MOZ_DIAGNOSTIC_ASSERT(false, "Unexpected CreateDrawTarget call!");
MOZ_DIAGNOSTIC_CRASH("Unexpected CreateDrawTarget call!");
#endif
return nullptr;
}

View File

@ -62,7 +62,7 @@ void CompositorManagerChild::InitSameProcess(uint32_t aNamespace,
aProcessToken, aNamespace, /* aSameProcess */ true);
child->SetOtherEndpointProcInfo(ipc::EndpointProcInfo::Current());
if (NS_WARN_IF(!child->Open(parent, CompositorThread(), ipc::ChildSide))) {
MOZ_DIAGNOSTIC_ASSERT(false, "Failed to open same process protocol");
MOZ_DIAGNOSTIC_CRASH("Failed to open same process protocol");
return;
}
child->mCanSend = true;

View File

@ -261,7 +261,7 @@ Result<Ok, LaunchError> LaunchApp(const std::wstring& cmdline,
for (HANDLE h : options.handles_to_inherit) {
if (SetHandleInformation(h, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT) ==
0) {
MOZ_DIAGNOSTIC_ASSERT(false, "SetHandleInformation failed");
MOZ_DIAGNOSTIC_CRASH("SetHandleInformation failed");
return Err(
LaunchError::FromWin32Error("SetHandleInformation", GetLastError()));
}

View File

@ -538,7 +538,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
if (msg->attached_handles_.Length() >
IPC::Message::MAX_DESCRIPTORS_PER_MESSAGE) {
MOZ_DIAGNOSTIC_ASSERT(false, "Too many file descriptors!");
MOZ_DIAGNOSTIC_CRASH("Too many file descriptors!");
CHROMIUM_LOG(FATAL) << "Too many file descriptors!";
// This should not be reached.
return false;
@ -560,7 +560,7 @@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
}
if (partial_write_->iter_.Done()) {
MOZ_DIAGNOSTIC_ASSERT(false, "partial_write_->iter_ should not be done");
MOZ_DIAGNOSTIC_CRASH("partial_write_->iter_ should not be done");
// report a send error to our caller, which will close the channel.
return false;
}

View File

@ -1888,7 +1888,7 @@ ArrayBufferObject::createUninitializedBufferAndData(
if (!data) {
if (cx->brittleMode) {
if (nbytes < INT32_MAX) {
MOZ_DIAGNOSTIC_ASSERT(false, "ArrayBuffer allocation OOM < 2GB - 1");
MOZ_DIAGNOSTIC_CRASH("ArrayBuffer allocation OOM < 2GB - 1");
} else {
MOZ_DIAGNOSTIC_ASSERT(
false,

View File

@ -338,7 +338,7 @@ Result<Ok, nsresult> URLPreloader::ReadCache(
"Entry should be in pendingURLs");
MOZ_DIAGNOSTIC_ASSERT(key.mPath.Length() > 0,
"Path should be non-empty");
MOZ_DIAGNOSTIC_ASSERT(false, "Entry should be new and not in any list");
MOZ_DIAGNOSTIC_CRASH("Entry should be new and not in any list");
#endif
return Err(NS_ERROR_UNEXPECTED);
}

View File

@ -144,7 +144,7 @@ static FrameChildListID ChildListIDForOutOfFlow(nsFrameState aPlaceholderState,
if (aPlaceholderState & PLACEHOLDER_FOR_ABSPOS) {
return FrameChildListID::Absolute;
}
MOZ_DIAGNOSTIC_ASSERT(false, "unknown list");
MOZ_DIAGNOSTIC_CRASH("unknown list");
return FrameChildListID::Float;
}

View File

@ -137,7 +137,7 @@ void AssertUniqueItem(nsDisplayItem* aItem) {
if (i->IsPreProcessedItem() || i->IsPreProcessed()) {
continue;
}
MOZ_DIAGNOSTIC_ASSERT(false, "Duplicate display item!");
MOZ_DIAGNOSTIC_CRASH("Duplicate display item!");
}
}
}

View File

@ -2229,7 +2229,7 @@ void LoadInfo::SetReservedClientInfo(const ClientInfo& aClientInfo) {
if (mReservedClientInfo.ref() == aClientInfo) {
return;
}
MOZ_DIAGNOSTIC_ASSERT(false, "mReservedClientInfo already set");
MOZ_DIAGNOSTIC_CRASH("mReservedClientInfo already set");
mReservedClientInfo.reset();
}
mReservedClientInfo.emplace(aClientInfo);

View File

@ -19,7 +19,7 @@ void HostRecordQueue::InsertRecord(nsHostRecord* aRec,
MOZ_DIAGNOSTIC_ASSERT(!mHighQ.contains(aRec), "Already in high queue");
MOZ_DIAGNOSTIC_ASSERT(!mMediumQ.contains(aRec), "Already in med queue");
MOZ_DIAGNOSTIC_ASSERT(!mLowQ.contains(aRec), "Already in low queue");
MOZ_DIAGNOSTIC_ASSERT(false, "Already on some other queue?");
MOZ_DIAGNOSTIC_CRASH("Already on some other queue?");
}
switch (AddrHostRecord::GetPriority(aFlags)) {
@ -51,7 +51,7 @@ void HostRecordQueue::AddToEvictionQ(
MOZ_DIAGNOSTIC_ASSERT(!inMediumQ, "Already in med queue");
bool inLowQ = mLowQ.contains(aRec);
MOZ_DIAGNOSTIC_ASSERT(!inLowQ, "Already in low queue");
MOZ_DIAGNOSTIC_ASSERT(false, "Already on some other queue?");
MOZ_DIAGNOSTIC_CRASH("Already on some other queue?");
// Bug 1678117 - it's not clear why this can happen, but let's fix it
// for release users.

View File

@ -233,7 +233,7 @@ AHostResolver::LookupStatus TRRQuery::CompleteLookup(
mTRRRequestCounter--;
pendingRequest = (mTRRRequestCounter != 0);
} else {
MOZ_DIAGNOSTIC_ASSERT(false, "Request counter is messed up");
MOZ_DIAGNOSTIC_CRASH("Request counter is messed up");
}
if (pendingRequest) { // There are other outstanding requests
LOG(("CompleteLookup: waiting for all responses!\n"));

View File

@ -329,7 +329,7 @@ nsresult nsHttpHandler::Init() {
// xpcshell tests doing this.
if (MOZ_UNLIKELY(AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdown) &&
!PR_GetEnv("XPCSHELL_TEST_PROFILE_DIR"))) {
MOZ_DIAGNOSTIC_ASSERT(false, "Try to init HttpHandler after shutdown");
MOZ_DIAGNOSTIC_CRASH("Try to init HttpHandler after shutdown");
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
}

View File

@ -773,7 +773,7 @@ nsresult nsNetworkLinkService::Init(void) {
if (inet_pton(AF_INET, ROUTE_CHECK_IPV4, &mRouteCheckIPv4) != 1) {
LOG(("Cannot parse address " ROUTE_CHECK_IPV4));
MOZ_DIAGNOSTIC_ASSERT(false, "Cannot parse address " ROUTE_CHECK_IPV4);
MOZ_DIAGNOSTIC_CRASH("Cannot parse address " ROUTE_CHECK_IPV4);
return NS_ERROR_UNEXPECTED;
}

View File

@ -1238,13 +1238,13 @@ nsresult NetlinkService::Init(NetlinkServiceListener* aListener) {
if (inet_pton(AF_INET, ROUTE_CHECK_IPV4, &mRouteCheckIPv4) != 1) {
LOG(("Cannot parse address " ROUTE_CHECK_IPV4));
MOZ_DIAGNOSTIC_ASSERT(false, "Cannot parse address " ROUTE_CHECK_IPV4);
MOZ_DIAGNOSTIC_CRASH("Cannot parse address " ROUTE_CHECK_IPV4);
return NS_ERROR_UNEXPECTED;
}
if (inet_pton(AF_INET6, ROUTE_CHECK_IPV6, &mRouteCheckIPv6) != 1) {
LOG(("Cannot parse address " ROUTE_CHECK_IPV6));
MOZ_DIAGNOSTIC_ASSERT(false, "Cannot parse address " ROUTE_CHECK_IPV6);
MOZ_DIAGNOSTIC_CRASH("Cannot parse address " ROUTE_CHECK_IPV6);
return NS_ERROR_UNEXPECTED;
}

View File

@ -107,7 +107,7 @@ int variantToSQLiteT(T aObj, nsIVariant* aValue) {
return sqlite3_T_array(aObj, data, count, CARRAY_TEXT);
}
MOZ_DIAGNOSTIC_ASSERT(false, "Unsupported type in Storage bound array");
MOZ_DIAGNOSTIC_CRASH("Unsupported type in Storage bound array");
// Technically this could leak with certain data types, but somebody was
// being incautious passing us this anyway.
free(data);

View File

@ -79,7 +79,7 @@ class ExtensionAPIRequest : public mozIExtensionAPIRequest {
case APIRequestType::REMOVE_LISTENER:
break;
default:
MOZ_DIAGNOSTIC_ASSERT(false, "Unexpected APIRequestType");
MOZ_DIAGNOSTIC_CRASH("Unexpected APIRequestType");
}
return false;

View File

@ -515,7 +515,7 @@ bool RequestWorkerRunnable::HandleAPIRequest(
if (isExtensionError && !okSerializedError) {
NS_WARNING("Failed to wrap ClonedErrorHolder");
MOZ_DIAGNOSTIC_ASSERT(false, "Failed to wrap ClonedErrorHolder");
MOZ_DIAGNOSTIC_CRASH("Failed to wrap ClonedErrorHolder");
return false;
}
@ -534,7 +534,7 @@ bool RequestWorkerRunnable::HandleAPIRequest(
return ProcessHandlerResult(aCx, aRetval);
}
MOZ_DIAGNOSTIC_ASSERT(false, "Unexpected API request ResultType");
MOZ_DIAGNOSTIC_CRASH("Unexpected API request ResultType");
return false;
}
@ -590,7 +590,7 @@ bool RequestWorkerRunnable::ProcessHandlerResult(
}
}
MOZ_DIAGNOSTIC_ASSERT(false, "Unexpected API request ResultType");
MOZ_DIAGNOSTIC_CRASH("Unexpected API request ResultType");
return false;
}
@ -627,7 +627,7 @@ void RequestWorkerRunnable::ReadResult(JSContext* aCx,
return;
}
MOZ_DIAGNOSTIC_ASSERT(false, "Unexpected API request ResultType");
MOZ_DIAGNOSTIC_CRASH("Unexpected API request ResultType");
aRv.Throw(NS_ERROR_UNEXPECTED);
}

View File

@ -1395,7 +1395,7 @@ void IPCFuzzController::SynchronizeOnMessageExecution(
MOZ_FUZZING_NYX_PRINT(
"ERROR: ======== END OF ITERATION (TIMEOUT) ========\n");
if (!!getenv("MOZ_FUZZ_CRASH_ON_TIMEOUT")) {
MOZ_DIAGNOSTIC_ASSERT(false, "IPCFuzzController Timeout");
MOZ_DIAGNOSTIC_CRASH("IPCFuzzController Timeout");
}
Nyx::instance().release(
IPCFuzzController::instance().getMessageStopCount());

View File

@ -108,7 +108,7 @@ void ContentCache::AssertIfInvalid() const {
? "Nothing"
: nsPrintfCString("%u", mCompositionStart.value()).get());
CrashReporter::AppendAppNotesToCrashReport(info);
MOZ_DIAGNOSTIC_ASSERT(false, "Invalid ContentCache data");
MOZ_DIAGNOSTIC_CRASH("Invalid ContentCache data");
#endif // #if MOZ_DIAGNOSTIC_ASSERT_ENABLED
}

View File

@ -810,7 +810,7 @@ nsresult WakeLockTopic::ProcessNextRequest() {
mState = WaitingToUninhibit;
return SendUninhibit() ? NS_OK : NS_ERROR_FAILURE;
default:
MOZ_DIAGNOSTIC_ASSERT(false, "Wrong state!");
MOZ_DIAGNOSTIC_CRASH("Wrong state!");
return NS_ERROR_FAILURE;
}
}

View File

@ -538,7 +538,7 @@ void nsBaseClipboard::MaybeRetryGetAvailableFlavors(
return;
}
MOZ_DIAGNOSTIC_ASSERT(false, "How can this happen?!?");
MOZ_DIAGNOSTIC_CRASH("How can this happen?!?");
callback->OnError(NS_ERROR_FAILURE);
});
}

View File

@ -958,7 +958,7 @@ nsresult nsPrintSettingsService::MaybeSavePrintSettingsToPrefs(
// defaults and can result in values being inappropriately propagated to
// prefixed prefs).
if (prtName.IsEmpty()) {
MOZ_DIAGNOSTIC_ASSERT(false, "Print settings must be saved with a prefix");
MOZ_DIAGNOSTIC_CRASH("Print settings must be saved with a prefix");
return NS_ERROR_FAILURE;
}
#endif

View File

@ -4807,8 +4807,7 @@ bool nsWindow::ProcessMessageInternal(UINT msg, WPARAM& wParam, LPARAM& lParam,
} else if (lParam & (ENDSESSION_CLOSEAPP | ENDSESSION_CRITICAL)) {
shutdownReason = AppShutdownReason::OSForceClose;
} else {
MOZ_DIAGNOSTIC_ASSERT(false,
"Received WM_ENDSESSION with unknown flags.");
MOZ_DIAGNOSTIC_CRASH("Received WM_ENDSESSION with unknown flags.");
shutdownReason = AppShutdownReason::OSForceClose;
}

View File

@ -146,13 +146,12 @@ class ExpirationTrackerImpl {
*/
nsresult AddObjectLocked(T* aObj, const AutoLock& aAutoLock) {
if (NS_WARN_IF(!aObj)) {
MOZ_DIAGNOSTIC_ASSERT(false, "Invalid object to add");
MOZ_DIAGNOSTIC_CRASH("Invalid object to add");
return NS_ERROR_UNEXPECTED;
}
nsExpirationState* state = aObj->GetExpirationState();
if (NS_WARN_IF(state->IsTracked())) {
MOZ_DIAGNOSTIC_ASSERT(false,
"Tried to add an object that's already tracked");
MOZ_DIAGNOSTIC_CRASH("Tried to add an object that's already tracked");
return NS_ERROR_UNEXPECTED;
}
nsTArray<T*>& generation = mGenerations[mNewestGeneration];
@ -181,13 +180,12 @@ class ExpirationTrackerImpl {
*/
void RemoveObjectLocked(T* aObj, const AutoLock& aAutoLock) {
if (NS_WARN_IF(!aObj)) {
MOZ_DIAGNOSTIC_ASSERT(false, "Invalid object to remove");
MOZ_DIAGNOSTIC_CRASH("Invalid object to remove");
return;
}
nsExpirationState* state = aObj->GetExpirationState();
if (NS_WARN_IF(!state->IsTracked())) {
MOZ_DIAGNOSTIC_ASSERT(false,
"Tried to remove an object that's not tracked");
MOZ_DIAGNOSTIC_CRASH("Tried to remove an object that's not tracked");
return;
}
nsTArray<T*>& generation = mGenerations[state->mGeneration];