Bug 1299727 - Rename NS_WARN_IF_FALSE as NS_WARNING_ASSERTION. r=erahm.

The new name makes the sense of the condition much clearer. E.g. compare:

  NS_WARN_IF_FALSE(!rv.Failed());

with:

  NS_WARNING_ASSERTION(!rv.Failed());

The new name also makes it clearer that it only has effect in debug builds,
because that's standard for assertions.

--HG--
extra : rebase_source : 886e57a9e433e0cb6ed635cc075b34b7ebf81853
This commit is contained in:
Nicholas Nethercote 2016-09-01 15:01:16 +10:00
parent c94421bf7c
commit b71747b2ac
139 changed files with 438 additions and 357 deletions

View File

@ -257,8 +257,10 @@ nsScriptSecurityManager::AppStatusForPrincipal(nsIPrincipal *aPrin)
// mozbrowser frames.
bool inIsolatedMozBrowser = aPrin->GetIsInIsolatedMozBrowserElement();
NS_WARN_IF_FALSE(appId != nsIScriptSecurityManager::UNKNOWN_APP_ID,
"Asking for app status on a principal with an unknown app id");
NS_WARNING_ASSERTION(
appId != nsIScriptSecurityManager::UNKNOWN_APP_ID,
"Asking for app status on a principal with an unknown app id");
// Installed apps have a valid app id (not NO_APP_ID or UNKNOWN_APP_ID)
// and they are not inside a mozbrowser.
if (appId == nsIScriptSecurityManager::NO_APP_ID ||

View File

@ -453,7 +453,8 @@ nsChromeRegistryChrome::SendRegisteredChrome(
DebugOnly<bool> success =
parents[i]->SendRegisterChrome(packages, resources, overrides,
mSelectedLocale, true);
NS_WARN_IF_FALSE(success, "couldn't reset a child's registered chrome");
NS_WARNING_ASSERTION(success,
"couldn't reset a child's registered chrome");
}
}
}

View File

@ -6331,9 +6331,9 @@ nsDocShell::SetMixedContentChannel(nsIChannel* aMixedContentChannel)
// Get the root docshell.
nsCOMPtr<nsIDocShellTreeItem> root;
GetSameTypeRootTreeItem(getter_AddRefs(root));
NS_WARN_IF_FALSE(root.get() == static_cast<nsIDocShellTreeItem*>(this),
"Setting mMixedContentChannel on a docshell that is not "
"the root docshell");
NS_WARNING_ASSERTION(root.get() == static_cast<nsIDocShellTreeItem*>(this),
"Setting mMixedContentChannel on a docshell that is "
"not the root docshell");
}
#endif
mMixedContentChannel = aMixedContentChannel;
@ -12873,7 +12873,7 @@ nsDocShell::ExtractLastVisit(nsIChannel* aChannel,
rv = props->GetPropertyAsUint32(NS_LITERAL_STRING("docshell.previousFlags"),
aChannelRedirectFlags);
NS_WARN_IF_FALSE(
NS_WARNING_ASSERTION(
NS_SUCCEEDED(rv),
"Could not fetch previous flags, URI will be treated like referrer");
}

View File

@ -735,7 +735,8 @@ protected:
nsresult rv =
#endif
mFile->Remove(false);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to remove temporary DOMFile.");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Failed to remove temporary DOMFile.");
}
}

View File

@ -21,7 +21,8 @@ SameProcessMessageQueue::~SameProcessMessageQueue()
// This code should run during shutdown, and we should already have pumped the
// event loop. So we should only see messages here if someone is sending
// messages pretty late in shutdown.
NS_WARN_IF_FALSE(mQueue.IsEmpty(), "Shouldn't send messages during shutdown");
NS_WARNING_ASSERTION(mQueue.IsEmpty(),
"Shouldn't send messages during shutdown");
sSingleton = nullptr;
}

View File

@ -711,8 +711,8 @@ nsDOMMutationObserver::Observe(nsINode& aTarget,
#ifdef DEBUG
for (int32_t i = 0; i < mReceivers.Count(); ++i) {
NS_WARN_IF_FALSE(mReceivers[i]->Target(),
"All the receivers should have a target!");
NS_WARNING_ASSERTION(mReceivers[i]->Target(),
"All the receivers should have a target!");
}
#endif
}

View File

@ -10341,7 +10341,8 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
if (sheet->IsGecko()) {
RefPtr<CSSStyleSheet> clonedSheet =
sheet->AsGecko()->Clone(nullptr, nullptr, clonedDoc, nullptr);
NS_WARN_IF_FALSE(clonedSheet, "Cloning a stylesheet didn't work!");
NS_WARNING_ASSERTION(clonedSheet,
"Cloning a stylesheet didn't work!");
if (clonedSheet) {
clonedDoc->AddStyleSheet(clonedSheet);
}
@ -10360,7 +10361,8 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
if (sheet->IsGecko()) {
RefPtr<CSSStyleSheet> clonedSheet =
sheet->AsGecko()->Clone(nullptr, nullptr, clonedDoc, nullptr);
NS_WARN_IF_FALSE(clonedSheet, "Cloning a stylesheet didn't work!");
NS_WARNING_ASSERTION(clonedSheet,
"Cloning a stylesheet didn't work!");
if (clonedSheet) {
clonedDoc->AddOnDemandBuiltInUASheet(clonedSheet);
}
@ -12416,8 +12418,10 @@ nsDocument::SetPointerLock(Element* aElement, int aCursorStyle)
nsIFrame* rootFrame = shell->GetRootFrame();
if (!NS_WARN_IF(!rootFrame)) {
widget = rootFrame->GetNearestWidget();
NS_WARN_IF_FALSE(widget, "SetPointerLock(): Unable to find widget "
"in shell->GetRootFrame()->GetNearestWidget();");
NS_WARNING_ASSERTION(
widget,
"SetPointerLock(): Unable to find widget in "
"shell->GetRootFrame()->GetNearestWidget();");
if (aElement && !widget) {
return false;
}

View File

@ -2229,8 +2229,8 @@ nsFrameLoader::CheckForRecursiveLoad(nsIURI* aURI)
// Check that we're still in the docshell tree.
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
mDocShell->GetTreeOwner(getter_AddRefs(treeOwner));
NS_WARN_IF_FALSE(treeOwner,
"Trying to load a new url to a docshell without owner!");
NS_WARNING_ASSERTION(treeOwner,
"Trying to load a new url to a docshell without owner!");
NS_ENSURE_STATE(treeOwner);
if (mDocShell->ItemType() != nsIDocShellTreeItem::typeContent) {

View File

@ -970,9 +970,9 @@ nsGenericDOMDataNode::GetWholeText(nsAString& aWholeText)
return GetData(aWholeText);
int32_t index = parent->IndexOf(this);
NS_WARN_IF_FALSE(index >= 0,
"Trying to use .wholeText with an anonymous"
"text node child of a binding parent?");
NS_WARNING_ASSERTION(index >= 0,
"Trying to use .wholeText with an anonymous"
"text node child of a binding parent?");
NS_ENSURE_TRUE(index >= 0, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
int32_t first =
FirstLogicallyAdjacentTextNode(parent, index);

View File

@ -6534,7 +6534,7 @@ nsGlobalWindow::FinishFullscreenChange(bool aIsFullscreen)
ErrorResult rv;
mWakeLock = pmService->NewWakeLock(NS_LITERAL_STRING("DOM_Fullscreen"),
AsOuter()->GetCurrentInnerWindow(), rv);
NS_WARN_IF_FALSE(!rv.Failed(), "Failed to lock the wakelock");
NS_WARNING_ASSERTION(!rv.Failed(), "Failed to lock the wakelock");
rv.SuppressException();
} else if (mWakeLock && !mFullScreen) {
ErrorResult rv;

View File

@ -129,8 +129,8 @@ nsInProcessTabChildGlobal::Init()
nsresult rv =
#endif
InitTabChildGlobal();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"Couldn't initialize nsInProcessTabChildGlobal");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Couldn't initialize nsInProcessTabChildGlobal");
mMessageManager = new nsFrameMessageManager(this,
nullptr,
dom::ipc::MM_CHILD);

View File

@ -113,7 +113,7 @@ nsPlainTextSerializer::~nsPlainTextSerializer()
{
delete[] mTagStack;
delete[] mOLStack;
NS_WARN_IF_FALSE(mHeadLevel == 0, "Wrong head level!");
NS_WARNING_ASSERTION(mHeadLevel == 0, "Wrong head level!");
}
NS_IMPL_ISUPPORTS(nsPlainTextSerializer,

View File

@ -28,9 +28,9 @@ SendRequest(BluetoothReplyRunnable* aRunnable, const Request& aRequest)
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aRunnable);
NS_WARN_IF_FALSE(sBluetoothChild,
"Calling methods on BluetoothServiceChildProcess during "
"shutdown!");
NS_WARNING_ASSERTION(
sBluetoothChild,
"Calling methods on BluetoothServiceChildProcess during shutdown!");
if (sBluetoothChild) {
BluetoothRequestChild* actor = new BluetoothRequestChild(aRunnable);

View File

@ -82,8 +82,8 @@ CellBroadcast::CellBroadcast(nsPIDOMWindowInner* aWindow,
{
mListener = new Listener(this);
DebugOnly<nsresult> rv = aService->RegisterListener(mListener);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"Failed registering Cell Broadcast callback");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Failed registering Cell Broadcast callback");
}
CellBroadcast::~CellBroadcast()

View File

@ -28,7 +28,7 @@ WebCryptoThreadPool::Initialize()
MOZ_ASSERT(!gInstance, "More than one instance!");
gInstance = new WebCryptoThreadPool();
NS_WARN_IF_FALSE(gInstance, "Failed create thread pool!");
NS_WARNING_ASSERTION(gInstance, "Failed create thread pool!");
if (gInstance && NS_FAILED(gInstance->Init())) {
NS_WARNING("Failed to initialize thread pool!");
@ -90,7 +90,7 @@ WebCryptoThreadPool::Shutdown()
}
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
NS_WARN_IF_FALSE(obs, "Failed to retrieve observer service!");
NS_WARNING_ASSERTION(obs, "Failed to retrieve observer service!");
if (obs) {
if (NS_FAILED(obs->RemoveObserver(this,

View File

@ -167,7 +167,7 @@ public:
bool IsValid()
{
NS_WARN_IF_FALSE(!!(mTarget), "Event target is not valid!");
NS_WARNING_ASSERTION(!!(mTarget), "Event target is not valid!");
return !!(mTarget);
}

View File

@ -387,9 +387,10 @@ EventListenerManager::AddEventListenerInternal(
if (window) {
#ifdef DEBUG
nsCOMPtr<nsIDocument> d = window->GetExtantDoc();
NS_WARN_IF_FALSE(!nsContentUtils::IsChromeDoc(d),
"Please do not use pointerenter/leave events in chrome. "
"They are slower than pointerover/out!");
NS_WARNING_ASSERTION(
!nsContentUtils::IsChromeDoc(d),
"Please do not use pointerenter/leave events in chrome. "
"They are slower than pointerover/out!");
#endif
window->SetHasPointerEnterLeaveEventListeners();
}
@ -400,9 +401,10 @@ EventListenerManager::AddEventListenerInternal(
if (nsPIDOMWindowInner* window = GetInnerWindowForTarget()) {
#ifdef DEBUG
nsCOMPtr<nsIDocument> d = window->GetExtantDoc();
NS_WARN_IF_FALSE(!nsContentUtils::IsChromeDoc(d),
"Please do not use mouseenter/leave events in chrome. "
"They are slower than mouseover/out!");
NS_WARNING_ASSERTION(
!nsContentUtils::IsChromeDoc(d),
"Please do not use mouseenter/leave events in chrome. "
"They are slower than mouseover/out!");
#endif
window->SetHasMouseEnterLeaveEventListeners();
}

View File

@ -523,12 +523,12 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
return NS_ERROR_NULL_POINTER;
}
NS_WARN_IF_FALSE(!aTargetFrame ||
!aTargetFrame->GetContent() ||
aTargetFrame->GetContent() == aTargetContent ||
aTargetFrame->GetContent()->GetFlattenedTreeParent() == aTargetContent ||
aTargetFrame->IsGeneratedContentFrame(),
"aTargetFrame should be related with aTargetContent");
NS_WARNING_ASSERTION(
!aTargetFrame || !aTargetFrame->GetContent() ||
aTargetFrame->GetContent() == aTargetContent ||
aTargetFrame->GetContent()->GetFlattenedTreeParent() == aTargetContent ||
aTargetFrame->IsGeneratedContentFrame(),
"aTargetFrame should be related with aTargetContent");
#if DEBUG
if (aTargetFrame && aTargetFrame->IsGeneratedContentFrame()) {
nsCOMPtr<nsIContent> targetContent;

View File

@ -331,7 +331,8 @@ WheelTransaction::SetTimeout()
DebugOnly<nsresult> rv =
sTimer->InitWithFuncCallback(OnTimeout, nullptr, GetTimeoutTime(),
nsITimer::TYPE_ONE_SHOT);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "nsITimer::InitWithFuncCallback failed");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"nsITimer::InitWithFuncCallback failed");
}
/* static */ nsIntPoint

View File

@ -113,7 +113,7 @@ HTMLMenuElement::CreateBuilder()
}
nsCOMPtr<nsIMenuBuilder> builder = do_CreateInstance(HTMLMENUBUILDER_CONTRACTID);
NS_WARN_IF_FALSE(builder, "No builder available");
NS_WARNING_ASSERTION(builder, "No builder available");
return builder.forget();
}

View File

@ -746,7 +746,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
"How did those end up different here? wyciwyg channels are "
"not nsICachingChannel");
rv = cachingChan->SetCacheTokenCachedCharset(charset);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "cannot SetMetaDataElement");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "cannot SetMetaDataElement");
rv = NS_OK; // don't propagate error
}

View File

@ -45,8 +45,8 @@ IccListener::IccListener(IccManager* aIccManager, uint32_t aClientId)
}
DebugOnly<nsresult> rv = mHandler->RegisterListener(this);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"Failed registering icc listener with Icc Handler");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Failed registering icc listener with Icc Handler");
}
IccListener::~IccListener()

View File

@ -13257,16 +13257,19 @@ Factory::Create(const LoggingInfo& aLoggingInfo)
if (loggingInfo) {
MOZ_ASSERT(aLoggingInfo.backgroundChildLoggingId() == loggingInfo->Id());
#if !DISABLE_ASSERTS_FOR_FUZZING
NS_WARN_IF_FALSE(aLoggingInfo.nextTransactionSerialNumber() ==
loggingInfo->mLoggingInfo.nextTransactionSerialNumber(),
"NextTransactionSerialNumber doesn't match!");
NS_WARN_IF_FALSE(aLoggingInfo.nextVersionChangeTransactionSerialNumber() ==
loggingInfo->mLoggingInfo.
nextVersionChangeTransactionSerialNumber(),
"NextVersionChangeTransactionSerialNumber doesn't match!");
NS_WARN_IF_FALSE(aLoggingInfo.nextRequestSerialNumber() ==
loggingInfo->mLoggingInfo.nextRequestSerialNumber(),
"NextRequestSerialNumber doesn't match!");
NS_WARNING_ASSERTION(
aLoggingInfo.nextTransactionSerialNumber() ==
loggingInfo->mLoggingInfo.nextTransactionSerialNumber(),
"NextTransactionSerialNumber doesn't match!");
NS_WARNING_ASSERTION(
aLoggingInfo.nextVersionChangeTransactionSerialNumber() ==
loggingInfo->mLoggingInfo.
nextVersionChangeTransactionSerialNumber(),
"NextVersionChangeTransactionSerialNumber doesn't match!");
NS_WARNING_ASSERTION(
aLoggingInfo.nextRequestSerialNumber() ==
loggingInfo->mLoggingInfo.nextRequestSerialNumber(),
"NextRequestSerialNumber doesn't match!");
#endif // !DISABLE_ASSERTS_FOR_FUZZING
} else {
loggingInfo = new DatabaseLoggingInfo(aLoggingInfo);
@ -23089,19 +23092,20 @@ CommitOp::Run()
if (NS_SUCCEEDED(mResultCode)) {
if (fileRefcountFunction) {
mResultCode = fileRefcountFunction->WillCommit();
NS_WARN_IF_FALSE(NS_SUCCEEDED(mResultCode), "WillCommit() failed!");
NS_WARNING_ASSERTION(NS_SUCCEEDED(mResultCode),
"WillCommit() failed!");
}
if (NS_SUCCEEDED(mResultCode)) {
mResultCode = WriteAutoIncrementCounts();
NS_WARN_IF_FALSE(NS_SUCCEEDED(mResultCode),
"WriteAutoIncrementCounts() failed!");
NS_WARNING_ASSERTION(NS_SUCCEEDED(mResultCode),
"WriteAutoIncrementCounts() failed!");
if (NS_SUCCEEDED(mResultCode)) {
AssertForeignKeyConsistency(connection);
mResultCode = connection->CommitWriteTransaction();
NS_WARN_IF_FALSE(NS_SUCCEEDED(mResultCode), "Commit failed!");
NS_WARNING_ASSERTION(NS_SUCCEEDED(mResultCode), "Commit failed!");
if (NS_SUCCEEDED(mResultCode) &&
mTransaction->GetMode() == IDBTransaction::READ_WRITE_FLUSH) {

View File

@ -1605,7 +1605,7 @@ private:
mIOTarget.swap(ioTarget);
DebugOnly<nsresult> rv = stream->Close();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to close stream!");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Failed to close stream!");
MOZ_ALWAYS_SUCCEEDS(NS_DispatchToMainThread(NewRunnableMethod(ioTarget, &nsIThread::Shutdown)));

View File

@ -1088,7 +1088,8 @@ nsJSChannel::SetExecuteAsync(bool aIsAsync)
mIsAsync = aIsAsync;
}
// else ignore this call
NS_WARN_IF_FALSE(!mIsActive, "Calling SetExecuteAsync on active channel?");
NS_WARNING_ASSERTION(!mIsActive,
"Calling SetExecuteAsync on active channel?");
return NS_OK;
}

View File

@ -83,8 +83,9 @@ public:
// all the streams were ended (no mixer callback occured).
// XXX Remove this warning, or find a way to avoid it if the mixer callback
// isn't called.
NS_WARN_IF_FALSE(Available() == 0 || mSampleWriteOffset == 0,
"Audio Buffer is not full by the end of the callback.");
NS_WARNING_ASSERTION(
Available() == 0 || mSampleWriteOffset == 0,
"Audio Buffer is not full by the end of the callback.");
// Make sure the data returned is always set and not random!
if (Available()) {
PodZero(mBuffer + mSampleWriteOffset, FramesToSamples(CHANNELS, Available()));

View File

@ -365,8 +365,9 @@ public:
void Mix(AudioMixer& aMixer, uint32_t aChannelCount, uint32_t aSampleRate);
int ChannelCount() {
NS_WARN_IF_FALSE(!mChunks.IsEmpty(),
"Cannot query channel count on a AudioSegment with no chunks.");
NS_WARNING_ASSERTION(
!mChunks.IsEmpty(),
"Cannot query channel count on a AudioSegment with no chunks.");
// Find the first chunk that has non-zero channels. A chunk that hs zero
// channels is just silence and we can simply discard it.
for (ChunkIterator ci(*this); !ci.IsEnded(); ci.Next()) {

View File

@ -149,8 +149,8 @@ void InitBrandName()
if (NS_SUCCEEDED(rv)) {
rv = brandBundle->GetStringFromName(u"brandShortName",
getter_Copies(brandName));
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"Could not get the program name for a cubeb stream.");
NS_WARNING_ASSERTION(
NS_SUCCEEDED(rv), "Could not get the program name for a cubeb stream.");
}
}
/* cubeb expects a c-string. */
@ -170,12 +170,12 @@ cubeb* GetCubebContextUnlocked()
if (!sBrandName && NS_IsMainThread()) {
InitBrandName();
} else {
NS_WARN_IF_FALSE(sBrandName,
"Did not initialize sbrandName, and not on the main thread?");
NS_WARNING_ASSERTION(
sBrandName, "Did not initialize sbrandName, and not on the main thread?");
}
DebugOnly<int> rv = cubeb_init(&sCubebContext, sBrandName);
NS_WARN_IF_FALSE(rv == CUBEB_OK, "Could not get a cubeb context.");
NS_WARNING_ASSERTION(rv == CUBEB_OK, "Could not get a cubeb context.");
return sCubebContext;
}

View File

@ -153,11 +153,11 @@ public:
}
// Track had not been created on main thread before, create it now.
NS_WARN_IF_FALSE(!mStream->mTracks.IsEmpty(),
"A new track was detected on the input stream; creating "
"a corresponding MediaStreamTrack. Initial tracks "
"should be added manually to immediately and "
"synchronously be available to JS.");
NS_WARNING_ASSERTION(
!mStream->mTracks.IsEmpty(),
"A new track was detected on the input stream; creating a corresponding "
"MediaStreamTrack. Initial tracks should be added manually to "
"immediately and synchronously be available to JS.");
RefPtr<MediaStreamTrackSource> source;
if (mStream->mTrackSourceGetter) {
source = mStream->mTrackSourceGetter->GetMediaStreamTrackSource(aTrackID);

View File

@ -486,7 +486,8 @@ AsyncCubebTask::AsyncCubebTask(AudioCallbackDriver* aDriver, AsyncCubebOperation
mOperation(aOperation),
mShutdownGrip(aDriver->GraphImpl())
{
NS_WARN_IF_FALSE(mDriver->mAudioStream || aOperation == INIT, "No audio stream !");
NS_WARNING_ASSERTION(mDriver->mAudioStream || aOperation == INIT,
"No audio stream!");
}
AsyncCubebTask::~AsyncCubebTask()
@ -658,8 +659,9 @@ AudioCallbackDriver::Init()
DataCallback_s, StateCallback_s, this) == CUBEB_OK) {
mAudioStream.own(stream);
DebugOnly<int> rv = cubeb_stream_set_volume(mAudioStream, CubebUtils::GetVolumeScale());
NS_WARN_IF_FALSE(rv == CUBEB_OK,
"Could not set the audio stream volume in GraphDriver.cpp");
NS_WARNING_ASSERTION(
rv == CUBEB_OK,
"Could not set the audio stream volume in GraphDriver.cpp");
CubebUtils::ReportCubebBackendUsed();
} else {
#ifdef MOZ_WEBRTC
@ -1008,7 +1010,7 @@ AudioCallbackDriver::MixerCallback(AudioDataValue* aMixedBuffer,
MOZ_ASSERT(mBuffer.Available() == 0, "Missing frames to fill audio callback's buffer.");
DebugOnly<uint32_t> written = mScratchBuffer.Fill(aMixedBuffer + toWrite * aChannels, aFrames - toWrite);
NS_WARN_IF_FALSE(written == aFrames - toWrite, "Dropping frames.");
NS_WARNING_ASSERTION(written == aFrames - toWrite, "Dropping frames.");
};
void AudioCallbackDriver::PanOutputIfNeeded(bool aMicrophoneActive)

View File

@ -1726,8 +1726,8 @@ MediaCacheStream::NotifyDataStarted(int64_t aOffset)
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
ReentrantMonitorAutoEnter mon(gMediaCache->GetReentrantMonitor());
NS_WARN_IF_FALSE(aOffset == mChannelOffset,
"Server is giving us unexpected offset");
NS_WARNING_ASSERTION(aOffset == mChannelOffset,
"Server is giving us unexpected offset");
MOZ_ASSERT(aOffset >= 0);
mChannelOffset = aOffset;
if (mStreamLength >= 0) {

View File

@ -282,7 +282,7 @@ public:
case 270:
return kDegree_270;
default:
NS_WARN_IF_FALSE(aDegree == 0, "Invalid rotation degree, ignored");
NS_WARNING_ASSERTION(aDegree == 0, "Invalid rotation degree, ignored");
return kDegree_0;
}
}

View File

@ -254,8 +254,9 @@ ChannelMediaResource::OnStartRequest(nsIRequest* aRequest)
}
// Give some warnings if the ranges are unexpected.
// XXX These could be error conditions.
NS_WARN_IF_FALSE(mOffset == rangeStart,
"response range start does not match current offset");
NS_WARNING_ASSERTION(
mOffset == rangeStart,
"response range start does not match current offset");
mOffset = rangeStart;
mCacheStream.NotifyDataStarted(rangeStart);
}

View File

@ -1778,8 +1778,8 @@ OggDemuxer::GetSeekRanges(TrackInfo::TrackType aType,
startTime = RangeStartTime(aType, startOffset);
if (startTime != -1 &&
((endTime = RangeEndTime(aType, endOffset)) != -1)) {
NS_WARN_IF_FALSE(startTime < endTime,
"Start time must be before end time");
NS_WARNING_ASSERTION(startTime < endTime,
"Start time must be before end time");
aRanges.AppendElement(SeekRange(startOffset,
endOffset,
startTime,

View File

@ -1203,8 +1203,8 @@ nsresult OggReader::GetSeekRanges(nsTArray<SeekRange>& aRanges)
if (startTime != -1 &&
((endTime = RangeEndTime(endOffset)) != -1))
{
NS_WARN_IF_FALSE(startTime < endTime,
"Start time must be before end time");
NS_WARNING_ASSERTION(startTime < endTime,
"Start time must be before end time");
aRanges.AppendElement(SeekRange(startOffset,
endOffset,
startTime,

View File

@ -238,8 +238,8 @@ DelayBuffer::UpdateUpmixChannels(int aNewReadChunk, uint32_t aChannelCount,
return;
}
NS_WARN_IF_FALSE(mHaveWrittenBlock || aNewReadChunk != mCurrentChunk,
"Smoothing is making feedback delay too small.");
NS_WARNING_ASSERTION(mHaveWrittenBlock || aNewReadChunk != mCurrentChunk,
"Smoothing is making feedback delay too small.");
mLastReadChunk = aNewReadChunk;
mUpmixChannels = mChunks[aNewReadChunk].ChannelData<float>();

View File

@ -145,9 +145,10 @@ public:
{
#ifdef DEBUG
StreamTracks::Track* data = aSource->FindTrack(aId);
NS_WARN_IF_FALSE(!data || data->IsEnded() ||
aDesiredTime <= aSource->GetEndOfAppendedData(aId),
"MediaEngineDefaultAudioSource data underrun");
NS_WARNING_ASSERTION(
!data || data->IsEnded() ||
aDesiredTime <= aSource->GetEndOfAppendedData(aId),
"MediaEngineDefaultAudioSource data underrun");
#endif
}

View File

@ -79,7 +79,8 @@ PeerIdentity::GetNormalizedHost(const nsCOMPtr<nsIIDNService>& aIdnService,
{
const nsCString chost = NS_ConvertUTF16toUTF8(aHost);
DebugOnly<nsresult> rv = aIdnService->ConvertUTF8toACE(chost, aNormalizedHost);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to convert UTF-8 host to ASCII");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Failed to convert UTF-8 host to ASCII");
}
} /* namespace mozilla */

View File

@ -53,7 +53,8 @@ SpeechSynthesisVoice::GetName(nsString& aRetval) const
{
DebugOnly<nsresult> rv =
nsSynthVoiceRegistry::GetInstance()->GetVoiceName(mUri, aRetval);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to get SpeechSynthesisVoice.name");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Failed to get SpeechSynthesisVoice.name");
}
void
@ -61,7 +62,8 @@ SpeechSynthesisVoice::GetLang(nsString& aRetval) const
{
DebugOnly<nsresult> rv =
nsSynthVoiceRegistry::GetInstance()->GetVoiceLang(mUri, aRetval);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to get SpeechSynthesisVoice.lang");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Failed to get SpeechSynthesisVoice.lang");
}
bool
@ -70,7 +72,7 @@ SpeechSynthesisVoice::LocalService() const
bool isLocal;
DebugOnly<nsresult> rv =
nsSynthVoiceRegistry::GetInstance()->IsLocalVoice(mUri, &isLocal);
NS_WARN_IF_FALSE(
NS_WARNING_ASSERTION(
NS_SUCCEEDED(rv), "Failed to get SpeechSynthesisVoice.localService");
return isLocal;
@ -82,7 +84,7 @@ SpeechSynthesisVoice::Default() const
bool isDefault;
DebugOnly<nsresult> rv =
nsSynthVoiceRegistry::GetInstance()->IsDefaultVoice(mUri, &isDefault);
NS_WARN_IF_FALSE(
NS_WARNING_ASSERTION(
NS_SUCCEEDED(rv), "Failed to get SpeechSynthesisVoice.default");
return isDefault;

View File

@ -602,7 +602,7 @@ nsSpeechTask::Pause()
if (mCallback) {
DebugOnly<nsresult> rv = mCallback->OnPause();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Unable to call onPause() callback");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Unable to call onPause() callback");
}
if (mStream) {
@ -625,7 +625,8 @@ nsSpeechTask::Resume()
if (mCallback) {
DebugOnly<nsresult> rv = mCallback->OnResume();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Unable to call onResume() callback");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Unable to call onResume() callback");
}
if (mStream) {
@ -651,7 +652,8 @@ nsSpeechTask::Cancel()
if (mCallback) {
DebugOnly<nsresult> rv = mCallback->OnCancel();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Unable to call onCancel() callback");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Unable to call onCancel() callback");
}
if (mStream) {

View File

@ -814,7 +814,7 @@ nsSynthVoiceRegistry::SpeakImpl(VoiceData* aVoice,
SpeechServiceType serviceType;
DebugOnly<nsresult> rv = aVoice->mService->GetServiceType(&serviceType);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to get speech service type");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Failed to get speech service type");
if (serviceType == nsISpeechService::SERVICETYPE_INDIRECT_AUDIO) {
aTask->InitIndirectAudio();

View File

@ -605,7 +605,7 @@ nsPicoService::RegisterVoices()
// time before previous utterances end. So, aQueuesUtterances == false
DebugOnly<nsresult> rv =
registry->AddVoice(this, uri, name, voice->mLanguage, true, false);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to add voice");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Failed to add voice");
}
mInitialized = true;

View File

@ -440,7 +440,7 @@ SpeechDispatcherService::RegisterVoices()
registry->AddVoice(this, iter.Key(), voice->mName, voice->mLanguage,
voice->mName.EqualsLiteral("default"), true);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to add voice");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Failed to add voice");
}
mInitThread->Shutdown();

View File

@ -141,8 +141,9 @@ MobileConnection::MobileConnection(nsPIDOMWindowInner* aWindow,
if (CheckPermission("mobileconnection")) {
DebugOnly<nsresult> rv = mMobileConnection->RegisterListener(mListener);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"Failed registering mobile connection messages with service");
NS_WARNING_ASSERTION(
NS_SUCCEEDED(rv),
"Failed registering mobile connection messages with service");
UpdateVoice();
UpdateData();
@ -158,8 +159,8 @@ MobileConnection::MobileConnection(nsPIDOMWindowInner* aWindow,
}
rv = mIccHandler->RegisterListener(mListener);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"Failed registering icc messages with service");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Failed registering icc messages with service");
UpdateIccId();
}
}

View File

@ -38,8 +38,8 @@ GetSmsChild()
if (!gSmsChild) {
gSmsChild = ContentChild::GetSingleton()->SendPSmsConstructor();
NS_WARN_IF_FALSE(gSmsChild,
"Calling methods on SmsIPCService during shutdown!");
NS_WARNING_ASSERTION(gSmsChild,
"Calling methods on SmsIPCService during shutdown!");
}
return gSmsChild;

View File

@ -631,8 +631,8 @@ nsContentSecurityManager::IsOriginPotentiallyTrustworthy(nsIPrincipal* aPrincipa
// Blobs are expected to inherit their principal so we don't expect to have
// a codebase principal with scheme 'blob' here. We can't assert that though
// since someone could mess with a non-blob URI to give it that scheme.
NS_WARN_IF_FALSE(!scheme.EqualsLiteral("blob"),
"IsOriginPotentiallyTrustworthy ignoring blob scheme");
NS_WARNING_ASSERTION(!scheme.EqualsLiteral("blob"),
"IsOriginPotentiallyTrustworthy ignoring blob scheme");
// According to the specification, the user agent may choose to extend the
// trust to other, vendor-specific URL schemes. We use this for "resource:",

View File

@ -194,8 +194,8 @@ nsSMILCSSValueType::IsEqual(const nsSMILValue& aLeft,
if (leftWrapper) {
if (rightWrapper) {
// Both non-null
NS_WARN_IF_FALSE(leftWrapper != rightWrapper,
"Two nsSMILValues with matching ValueWrapper ptr");
NS_WARNING_ASSERTION(leftWrapper != rightWrapper,
"Two nsSMILValues with matching ValueWrapper ptr");
return (leftWrapper->mPropID == rightWrapper->mPropID &&
leftWrapper->mCSSValue == rightWrapper->mCSSValue);
}

View File

@ -190,7 +190,7 @@ nsSMILCompositor::UpdateCachedBaseValue(const nsSMILValue& aBaseValue)
if (!mCachedBaseValue) {
// We don't have last sample's base value cached. Assume it's changed.
mCachedBaseValue = new nsSMILValue(aBaseValue);
NS_WARN_IF_FALSE(mCachedBaseValue, "failed to cache base value (OOM?)");
NS_WARNING_ASSERTION(mCachedBaseValue, "failed to cache base value (OOM?)");
mForceCompositing = true;
} else if (*mCachedBaseValue != aBaseValue) {
// Base value has changed since last sample.

View File

@ -87,8 +87,8 @@ Voicemail::Voicemail(nsPIDOMWindowInner* aWindow,
mListener = new Listener(this);
DebugOnly<nsresult> rv = mService->RegisterListener(mListener);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"Failed registering voicemail messages with service");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Failed registering voicemail messages with service");
uint32_t length = 0;
if (NS_SUCCEEDED(mService->GetNumItems(&length)) && length != 0) {

View File

@ -2092,7 +2092,7 @@ RuntimeService::Shutdown()
mShuttingDown = true;
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
NS_WARN_IF_FALSE(obs, "Failed to get observer service?!");
NS_WARNING_ASSERTION(obs, "Failed to get observer service?!");
// Tell anyone that cares that they're about to lose worker support.
if (obs && NS_FAILED(obs->NotifyObservers(nullptr, WORKERS_SHUTDOWN_TOPIC,
@ -2129,7 +2129,7 @@ RuntimeService::Cleanup()
AssertIsOnMainThread();
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
NS_WARN_IF_FALSE(obs, "Failed to get observer service?!");
NS_WARNING_ASSERTION(obs, "Failed to get observer service?!");
if (mIdleThreadTimer) {
if (NS_FAILED(mIdleThreadTimer->Cancel())) {

View File

@ -142,7 +142,7 @@ private:
RootedDictionary<ServiceWorkerMessageEventInit> init(aCx);
nsCOMPtr<nsIPrincipal> principal = aTargetContainer->GetParentObject()->PrincipalOrNull();
NS_WARN_IF_FALSE(principal, "Why is the principal null here?");
NS_WARNING_ASSERTION(principal, "Why is the principal null here?");
bool isNullPrincipal = false;
bool isSystemPrincipal = false;

View File

@ -2195,7 +2195,8 @@ public:
AssertIsOnMainThread();
NS_WARNING("Unexpected error while dispatching fetch event!");
DebugOnly<nsresult> rv = mChannel->ResetInterception();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to resume intercepted network request");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Failed to resume intercepted network request");
}
NS_IMETHOD

View File

@ -1439,7 +1439,8 @@ private:
{
AssertIsOnMainThread();
nsresult rv = mChannel->ResetInterception();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to resume intercepted network request");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Failed to resume intercepted network request");
return rv;
}
};

View File

@ -220,8 +220,10 @@ ServiceWorkerRegistrationMainThread::GetWorkerReference(WhichServiceWorker aWhic
MOZ_CRASH("Invalid enum value");
}
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv) || rv == NS_ERROR_DOM_NOT_FOUND_ERR,
"Unexpected error getting service worker instance from ServiceWorkerManager");
NS_WARNING_ASSERTION(
NS_SUCCEEDED(rv) || rv == NS_ERROR_DOM_NOT_FOUND_ERR,
"Unexpected error getting service worker instance from "
"ServiceWorkerManager");
if (NS_FAILED(rv)) {
return nullptr;
}

View File

@ -390,7 +390,7 @@ ServiceWorkerUpdateJob::ComparisonResult(nsresult aStatus,
rv = nsContentUtils::FormatLocalizedString(nsContentUtils::eDOM_PROPERTIES,
"ServiceWorkerScopePathMismatch",
params, message);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Failed to format localized string");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Failed to format localized string");
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
swm->ReportToAllClients(mScope,
message,

View File

@ -290,7 +290,7 @@ LogErrorToConsole(const nsAString& aMessage,
nsCOMPtr<nsIScriptError> scriptError =
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
NS_WARN_IF_FALSE(scriptError, "Failed to create script error!");
NS_WARNING_ASSERTION(scriptError, "Failed to create script error!");
if (scriptError) {
if (NS_FAILED(scriptError->InitWithWindowID(aMessage, aFilename, aLine,
@ -304,7 +304,7 @@ LogErrorToConsole(const nsAString& aMessage,
nsCOMPtr<nsIConsoleService> consoleService =
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
NS_WARN_IF_FALSE(consoleService, "Failed to get console service!");
NS_WARNING_ASSERTION(consoleService, "Failed to get console service!");
if (consoleService) {
if (scriptError) {
@ -2436,9 +2436,9 @@ WorkerPrivateParent<Derived>::GetEventTarget()
target = mEventTarget;
}
NS_WARN_IF_FALSE(target,
"Requested event target for a worker that is already "
"shutting down!");
NS_WARNING_ASSERTION(
target,
"Requested event target for a worker that is already shutting down!");
return target.forget();
}

View File

@ -485,10 +485,10 @@ nsresult
MainThreadStopSyncLoopRunnable::Cancel()
{
nsresult rv = Run();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Run() failed");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "Run() failed");
nsresult rv2 = WorkerSyncRunnable::Cancel();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv2), "Cancel() failed");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv2), "Cancel() failed");
return NS_FAILED(rv) ? rv : rv2;
}

View File

@ -3019,8 +3019,9 @@ XULDocument::DoneWalking()
NS_ASSERTION(mDelayFrameLoaderInitialization,
"mDelayFrameLoaderInitialization should be true!");
mDelayFrameLoaderInitialization = false;
NS_WARN_IF_FALSE(mUpdateNestLevel == 0,
"Constructing XUL document in middle of an update?");
NS_WARNING_ASSERTION(
mUpdateNestLevel == 0,
"Constructing XUL document in middle of an update?");
if (mUpdateNestLevel == 0) {
MaybeInitializeFinalizeFrameLoaders();
}

View File

@ -122,7 +122,7 @@ TextEditRules::Init(TextEditor* aTextEditor)
// We hold a non-refcounted reference back to our editor.
mTextEditor = aTextEditor;
RefPtr<Selection> selection = mTextEditor->GetSelection();
NS_WARN_IF_FALSE(selection, "editor cannot get selection");
NS_WARNING_ASSERTION(selection, "editor cannot get selection");
// Put in a magic br if needed. This method handles null selection,
// which should never happen anyway

View File

@ -1254,7 +1254,7 @@ nsWebBrowser::Create()
if (XRE_IsParentProcess()) {
// Hook up global history. Do not fail if we can't - just warn.
rv = EnableGlobalHistory(mShouldEnableHistory);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "EnableGlobalHistory() failed");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "EnableGlobalHistory() failed");
}
NS_ENSURE_SUCCESS(mDocShellAsWin->Create(), NS_ERROR_FAILURE);

View File

@ -1007,7 +1007,8 @@ nsWebBrowserPersist::OnDataAvailable(
if ((-1 == channelContentLength) ||
((channelContentLength - (aOffset + aLength)) == 0))
{
NS_WARN_IF_FALSE(channelContentLength != -1,
NS_WARNING_ASSERTION(
channelContentLength != -1,
"nsWebBrowserPersist::OnDataAvailable() no content length "
"header, pushing what we have");
// we're done with this pass; see if we need to do upload

View File

@ -912,8 +912,9 @@ nsresult
mozInlineSpellChecker::SpellCheckRange(nsIDOMRange* aRange)
{
if (!mSpellCheck) {
NS_WARN_IF_FALSE(mPendingSpellCheck,
"Trying to spellcheck, but checking seems to be disabled");
NS_WARNING_ASSERTION(
mPendingSpellCheck,
"Trying to spellcheck, but checking seems to be disabled");
return NS_ERROR_NOT_INITIALIZED;
}

View File

@ -423,8 +423,9 @@ GLXLibrary::CreatePixmap(gfxASurface* aSurface)
if (matchIndex == -1) {
// GLX can't handle A8 surfaces, so this is not really unexpected. The
// caller should deal with this situation.
NS_WARN_IF_FALSE(format->depth == 8,
"[GLX] Couldn't find a FBConfig matching Pixmap format");
NS_WARNING_ASSERTION(
format->depth == 8,
"[GLX] Couldn't find a FBConfig matching Pixmap format");
return X11None;
}

View File

@ -355,7 +355,7 @@ RotatedContentBuffer::EnsureBuffer()
}
}
NS_WARN_IF_FALSE(mDTBuffer && mDTBuffer->IsValid(), "no buffer");
NS_WARNING_ASSERTION(mDTBuffer && mDTBuffer->IsValid(), "no buffer");
return !!mDTBuffer;
}
@ -370,7 +370,7 @@ RotatedContentBuffer::EnsureBufferOnWhite()
}
}
NS_WARN_IF_FALSE(mDTBufferOnWhite, "no buffer");
NS_WARNING_ASSERTION(mDTBufferOnWhite, "no buffer");
return !!mDTBufferOnWhite;
}

View File

@ -203,8 +203,9 @@ BasicPaintedLayer::Validate(LayerManager::DrawPaintedLayerCallback aCallback,
// It's possible that state.mRegionToInvalidate is nonempty here,
// if we are shrinking the valid region to nothing. So use mRegionToDraw
// instead.
NS_WARN_IF_FALSE(state.mRegionToDraw.IsEmpty(),
"No context when we have something to draw, resource exhaustion?");
NS_WARNING_ASSERTION(
state.mRegionToDraw.IsEmpty(),
"No context when we have something to draw, resource exhaustion?");
}
for (uint32_t i = 0; i < readbackUpdates.Length(); ++i) {

View File

@ -513,7 +513,7 @@ BufferTextureHost::UpdatedInternal(const nsIntRegion* aRegion)
}
if (GetFlags() & TextureFlags::IMMEDIATE_UPLOAD) {
DebugOnly<bool> result = MaybeUpload(!mNeedsFullUpdate ? &mMaybeUpdatedRegion : nullptr);
NS_WARN_IF_FALSE(result, "Failed to upload a texture");
NS_WARNING_ASSERTION(result, "Failed to upload a texture");
}
}

View File

@ -296,8 +296,9 @@ TiledLayerBufferComposite::UseTiles(const SurfaceDescriptorTiles& aTiles,
TileHost& tile = mRetainedTiles[i];
if (tileDesc.type() != TileDescriptor::TTexturedTileDescriptor) {
NS_WARN_IF_FALSE(tileDesc.type() == TileDescriptor::TPlaceholderTileDescriptor,
"Unrecognised tile descriptor type");
NS_WARNING_ASSERTION(
tileDesc.type() == TileDescriptor::TPlaceholderTileDescriptor,
"Unrecognised tile descriptor type");
continue;
}

View File

@ -39,7 +39,7 @@ Nv3DVUtils::~Nv3DVUtils()
#endif
// Uncomment these to enable spurious warnings.
//#define WARNING(str) NS_WARNING(str)
//#define WARN_IF_FALSE(b, str) NS_WARN_IF_FALSE(b, str)
//#define WARN_IF_FALSE(b, str) NS_WARNING_ASSERTION(b, str)
#define WARNING(str)
#define WARN_IF_FALSE(b, str)

View File

@ -61,7 +61,9 @@ ScopedXErrorHandler::ScopedXErrorHandler()
{
// Off main thread usage is not safe in general, but OMTC GL layers uses this
// with the main thread blocked, which makes it safe.
NS_WARN_IF_FALSE(NS_IsMainThread(), "ScopedXErrorHandler being called off main thread, may cause issues");
NS_WARNING_ASSERTION(
NS_IsMainThread(),
"ScopedXErrorHandler being called off main thread, may cause issues");
// let sXErrorPtr point to this object's mXError object, but don't reset this mXError object!
// think of the case of nested ScopedXErrorHandler's.
mOldXErrorPtr = sXErrorPtr;

View File

@ -445,8 +445,9 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxShapedText *aShapedText,
while (glyphStart < numGlyphs) { // keep finding groups until all glyphs are accounted for
bool inOrder = true;
int32_t charEnd = glyphToChar[glyphStart] - stringRange.location;
NS_WARN_IF_FALSE(charEnd >= 0 && charEnd < stringRange.length,
"glyph-to-char mapping points outside string range");
NS_WARNING_ASSERTION(
charEnd >= 0 && charEnd < stringRange.length,
"glyph-to-char mapping points outside string range");
// clamp charEnd to the valid range of the string
charEnd = std::max(charEnd, 0);
charEnd = std::min(charEnd, int32_t(stringRange.length));
@ -526,16 +527,16 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxShapedText *aShapedText,
}
} while (charEnd != charLimit);
NS_WARN_IF_FALSE(glyphStart < glyphEnd,
"character/glyph clump contains no glyphs!");
NS_WARNING_ASSERTION(glyphStart < glyphEnd,
"character/glyph clump contains no glyphs!");
if (glyphStart == glyphEnd) {
++glyphStart; // make progress - avoid potential infinite loop
charStart = charEnd;
continue;
}
NS_WARN_IF_FALSE(charStart != charEnd,
"character/glyph clump contains no characters!");
NS_WARNING_ASSERTION(charStart != charEnd,
"character/glyph clump contains no characters!");
if (charStart == charEnd) {
glyphStart = glyphEnd; // this is bad - we'll discard the glyph(s),
// as there's nowhere to attach them

View File

@ -202,8 +202,8 @@ gfxFontCache::~gfxFontCache()
// Expire everything that has a zero refcount, so we don't leak them.
AgeAllGenerations();
// All fonts should be gone.
NS_WARN_IF_FALSE(mFonts.Count() == 0,
"Fonts still alive while shutting down gfxFontCache");
NS_WARNING_ASSERTION(mFonts.Count() == 0,
"Fonts still alive while shutting down gfxFontCache");
// Note that we have to delete everything through the expiration
// tracker, since there might be fonts not in the hashtable but in
// the tracker.
@ -1820,8 +1820,9 @@ gfxFont::DrawOneGlyph(uint32_t aGlyphID, double aAdvance, gfxPoint *aPt,
if (!runParams.paintSVGGlyphs) {
return;
}
NS_WARN_IF_FALSE(runParams.drawMode != DrawMode::GLYPH_PATH,
"Rendering SVG glyph despite request for glyph path");
NS_WARNING_ASSERTION(
runParams.drawMode != DrawMode::GLYPH_PATH,
"Rendering SVG glyph despite request for glyph path");
if (RenderSVGGlyph(runParams.context, devPt,
aGlyphID, fontParams.contextPaint,
runParams.callbacks, *aEmittedGlyphs)) {
@ -2603,7 +2604,7 @@ gfxFont::GetShapedWord(DrawTarget *aDrawTarget,
DebugOnly<bool> ok =
ShapeText(aDrawTarget, aText, 0, aLength, aRunScript, aVertical, sw);
NS_WARN_IF_FALSE(ok, "failed to shape word - expect garbled text");
NS_WARNING_ASSERTION(ok, "failed to shape word - expect garbled text");
return sw;
}
@ -2695,7 +2696,7 @@ gfxFont::ShapeText(DrawTarget *aDrawTarget,
aScript, aVertical, aShapedText);
}
NS_WARN_IF_FALSE(ok, "shaper failed, expect scrambled or missing text");
NS_WARNING_ASSERTION(ok, "shaper failed, expect scrambled or missing text");
PostShapingFixup(aDrawTarget, aText, aOffset, aLength,
aVertical, aShapedText);
@ -2846,7 +2847,7 @@ gfxFont::ShapeTextWithoutWordCache(DrawTarget *aDrawTarget,
fragStart = i + 1;
}
NS_WARN_IF_FALSE(ok, "failed to shape text - expect garbled text");
NS_WARNING_ASSERTION(ok, "failed to shape text - expect garbled text");
return ok;
}

View File

@ -1515,7 +1515,8 @@ gfxHarfBuzzShaper::ShapeText(DrawTarget *aDrawTarget,
nsresult rv = SetGlyphsFromRun(aDrawTarget, aShapedText, aOffset, aLength,
aText, buffer, aVertical);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "failed to store glyphs into gfxShapedWord");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"failed to store glyphs into gfxShapedWord");
hb_buffer_destroy(buffer);
return NS_SUCCEEDED(rv);

View File

@ -1316,10 +1316,12 @@ gfxTextRun::CopyGlyphDataFrom(gfxTextRun *aSource, Range aRange, uint32_t aDest)
// This means the rendering of the cluster will probably not be very good,
// but it's the best we can do for now if the specified font only covered the
// initial base character and not its applied marks.
NS_WARN_IF_FALSE(aSource->IsClusterStart(start),
"Started font run in the middle of a cluster");
NS_WARN_IF_FALSE(end == aSource->GetLength() || aSource->IsClusterStart(end),
"Ended font run in the middle of a cluster");
NS_WARNING_ASSERTION(
aSource->IsClusterStart(start),
"Started font run in the middle of a cluster");
NS_WARNING_ASSERTION(
end == aSource->GetLength() || aSource->IsClusterStart(end),
"Ended font run in the middle of a cluster");
nsresult rv = AddGlyphRun(font, iter.GetGlyphRun()->mMatchType,
start - aRange.start + aDest, false,

View File

@ -2281,8 +2281,9 @@ MessageChannel::DebugAbort(const char* file, int line, const char* cond,
void
MessageChannel::DumpInterruptStack(const char* const pfx) const
{
NS_WARN_IF_FALSE(MessageLoop::current() != mWorkerLoop,
"The worker thread had better be paused in a debugger!");
NS_WARNING_ASSERTION(
MessageLoop::current() != mWorkerLoop,
"The worker thread had better be paused in a debugger!");
printf_stderr("%sMessageChannel 'backtrace':\n", pfx);

View File

@ -301,9 +301,9 @@ nsScriptErrorBase::ToString(nsACString& /*UTF8*/ aResult)
NS_IMETHODIMP
nsScriptErrorBase::GetOuterWindowID(uint64_t* aOuterWindowID)
{
NS_WARN_IF_FALSE(NS_IsMainThread() || mInitializedOnMainThread,
"This can't be safely determined off the main thread, "
"returning an inaccurate value!");
NS_WARNING_ASSERTION(NS_IsMainThread() || mInitializedOnMainThread,
"This can't be safely determined off the main thread, "
"returning an inaccurate value!");
if (!mInitializedOnMainThread && NS_IsMainThread()) {
InitializeOnMainThread();
@ -330,9 +330,9 @@ nsScriptErrorBase::GetTimeStamp(int64_t* aTimeStamp)
NS_IMETHODIMP
nsScriptErrorBase::GetIsFromPrivateWindow(bool* aIsFromPrivateWindow)
{
NS_WARN_IF_FALSE(NS_IsMainThread() || mInitializedOnMainThread,
"This can't be safely determined off the main thread, "
"returning an inaccurate value!");
NS_WARNING_ASSERTION(NS_IsMainThread() || mInitializedOnMainThread,
"This can't be safely determined off the main thread, "
"returning an inaccurate value!");
if (!mInitializedOnMainThread && NS_IsMainThread()) {
InitializeOnMainThread();

View File

@ -570,9 +570,9 @@ RecomputePosition(nsIFrame* aFrame)
parentReflowInput.mCBReflowInput = cbReflowInput.ptr();
}
NS_WARN_IF_FALSE(parentSize.ISize(parentWM) != NS_INTRINSICSIZE &&
parentSize.BSize(parentWM) != NS_INTRINSICSIZE,
"parentSize should be valid");
NS_WARNING_ASSERTION(parentSize.ISize(parentWM) != NS_INTRINSICSIZE &&
parentSize.BSize(parentWM) != NS_INTRINSICSIZE,
"parentSize should be valid");
parentReflowInput.SetComputedISize(std::max(parentSize.ISize(parentWM), 0));
parentReflowInput.SetComputedBSize(std::max(parentSize.BSize(parentWM), 0));
parentReflowInput.ComputedPhysicalMargin().SizeTo(0, 0, 0, 0);

View File

@ -1812,8 +1812,8 @@ SetupDirtyRects(const nsRect& aBGClipArea, const nsRect& aCallerDirtyRect,
// Compute the Thebes equivalent of the dirtyRect.
*aDirtyRectGfx = nsLayoutUtils::RectToGfxRect(*aDirtyRect, aAppUnitsPerPixel);
NS_WARN_IF_FALSE(aDirtyRect->IsEmpty() || !aDirtyRectGfx->IsEmpty(),
"converted dirty rect should not be empty");
NS_WARNING_ASSERTION(aDirtyRect->IsEmpty() || !aDirtyRectGfx->IsEmpty(),
"converted dirty rect should not be empty");
MOZ_ASSERT(!aDirtyRect->IsEmpty() || aDirtyRectGfx->IsEmpty(),
"second should be empty if first is");
}

View File

@ -2484,8 +2484,8 @@ nsDocumentViewer::FindContainerView()
// cases. Treat that as display:none, the document is not
// displayed.
if (subdocFrame->GetType() != nsGkAtoms::subDocumentFrame) {
NS_WARN_IF_FALSE(!subdocFrame->GetType(),
"Subdocument container has non-subdocument frame");
NS_WARNING_ASSERTION(!subdocFrame->GetType(),
"Subdocument container has non-subdocument frame");
return nullptr;
}
@ -3782,8 +3782,9 @@ nsDocumentViewer::PrintPreview(nsIPrintSettings* aPrintSettings,
nsIWebProgressListener* aWebProgressListener)
{
#if defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW)
NS_WARN_IF_FALSE(IsInitializedForPrintPreview(),
"Using docshell.printPreview is the preferred way for print previewing!");
NS_WARNING_ASSERTION(
IsInitializedForPrintPreview(),
"Using docshell.printPreview is the preferred way for print previewing!");
NS_ENSURE_ARG_POINTER(aChildDOMWin);
nsresult rv = NS_OK;

View File

@ -5160,10 +5160,10 @@ nsLayoutUtils::MinSizeContributionForAxis(PhysicalAxis aAxis,
nsLayoutUtils::ComputeCBDependentValue(nscoord aPercentBasis,
const nsStyleCoord& aCoord)
{
NS_WARN_IF_FALSE(aPercentBasis != NS_UNCONSTRAINEDSIZE,
"have unconstrained width or height; this should only "
"result from very large sizes, not attempts at intrinsic "
"size calculation");
NS_WARNING_ASSERTION(
aPercentBasis != NS_UNCONSTRAINEDSIZE,
"have unconstrained width or height; this should only result from very "
"large sizes, not attempts at intrinsic size calculation");
if (aCoord.IsCoordPercentCalcUnit()) {
return nsRuleNode::ComputeCoordPercentCalc(aCoord, aPercentBasis);
@ -7489,7 +7489,9 @@ nsLayoutUtils::SurfaceFromElement(HTMLVideoElement* aElement,
{
SurfaceFromElementResult result;
NS_WARN_IF_FALSE((aSurfaceFlags & SFE_PREFER_NO_PREMULTIPLY_ALPHA) == 0, "We can't support non-premultiplied alpha for video!");
NS_WARNING_ASSERTION(
(aSurfaceFlags & SFE_PREFER_NO_PREMULTIPLY_ALPHA) == 0,
"We can't support non-premultiplied alpha for video!");
#ifdef MOZ_EME
if (aElement->ContainsRestrictedContent()) {

View File

@ -1162,11 +1162,11 @@ nsPresContext::CompatibilityModeChanged()
// quirk.css needs to come after html.css; we just keep it at the end.
DebugOnly<nsresult> rv =
styleSet->AppendStyleSheet(SheetType::Agent, sheet);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "failed to insert quirk.css");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to insert quirk.css");
} else {
DebugOnly<nsresult> rv =
styleSet->RemoveStyleSheet(SheetType::Agent, sheet);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "failed to remove quirk.css");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "failed to remove quirk.css");
}
mQuirkSheetAdded = needsQuirkSheet;

View File

@ -1320,7 +1320,8 @@ PresShell::Destroy()
}
NS_WARN_IF_FALSE(!mWeakFrames, "Weak frames alive after destroying FrameManager");
NS_WARNING_ASSERTION(!mWeakFrames,
"Weak frames alive after destroying FrameManager");
while (mWeakFrames) {
mWeakFrames->Clear(this);
}
@ -8884,7 +8885,7 @@ PresShell::PrepareToUseCaretPosition(nsIWidget* aEventWidget,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
NS_ENSURE_SUCCESS(rv, false);
frame = content->GetPrimaryFrame();
NS_WARN_IF_FALSE(frame, "No frame for focused content?");
NS_WARNING_ASSERTION(frame, "No frame for focused content?");
}
// Actually scroll the selection (ie caret) into view. Note that this must

View File

@ -3489,9 +3489,10 @@ nsFlexContainerFrame::GetMainSizeFromReflowInput(
if (aAxisTracker.IsRowOriented()) {
// Row-oriented --> our main axis is the inline axis, so our main size
// is our inline size (which should already be resolved).
NS_WARN_IF_FALSE(aReflowInput.ComputedISize() != NS_UNCONSTRAINEDSIZE,
"Unconstrained inline size; this should only result from "
"huge sizes (not intrinsic sizing w/ orthogonal flows)");
NS_WARNING_ASSERTION(
aReflowInput.ComputedISize() != NS_UNCONSTRAINEDSIZE,
"Unconstrained inline size; this should only result from huge sizes "
"(not intrinsic sizing w/ orthogonal flows)");
return aReflowInput.ComputedISize();
}
@ -3592,9 +3593,10 @@ nsFlexContainerFrame::ComputeCrossSize(const ReflowInput& aReflowInput,
if (aAxisTracker.IsColumnOriented()) {
// Column-oriented --> our cross axis is the inline axis, so our cross size
// is our inline size (which should already be resolved).
NS_WARN_IF_FALSE(aReflowInput.ComputedISize() != NS_UNCONSTRAINEDSIZE,
"Unconstrained inline size; this should only result from "
"huge sizes (not intrinsic sizing w/ orthogonal flows)");
NS_WARNING_ASSERTION(
aReflowInput.ComputedISize() != NS_UNCONSTRAINEDSIZE,
"Unconstrained inline size; this should only result from huge sizes "
"(not intrinsic sizing w/ orthogonal flows)");
*aIsDefinite = true;
return aReflowInput.ComputedISize();
}
@ -3755,8 +3757,9 @@ nsFlexContainerFrame::SizeItemInCrossAxis(
// an instance of nsFrame (i.e. it should return null from GetType()).
// XXXdholbert Once we've fixed bug 765861, we should upgrade this to an
// assertion that trivially passes if bug 765861's flag has been flipped.
NS_WARN_IF_FALSE(!aItem.Frame()->GetType(),
"Child should at least request space for border/padding");
NS_WARNING_ASSERTION(
!aItem.Frame()->GetType(),
"Child should at least request space for border/padding");
aItem.SetCrossSize(0);
} else {
// (normal case)
@ -4199,9 +4202,10 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
// children (or if our children are huge enough that they have nscoord_MIN
// as their baseline... in which case, we'll use the wrong baseline, but no
// big deal)
NS_WARN_IF_FALSE(lines.getFirst()->IsEmpty(),
"Have flex items but didn't get an ascent - that's odd "
"(or there are just gigantic sizes involved)");
NS_WARNING_ASSERTION(
lines.getFirst()->IsEmpty(),
"Have flex items but didn't get an ascent - that's odd (or there are "
"just gigantic sizes involved)");
// Per spec, synthesize baseline from the flex container's content box
// (i.e. use block-end side of content-box)
// XXXdholbert This only makes sense if parent's writing mode is

View File

@ -159,8 +159,7 @@ nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBOffset,
if (aBSize == nscoord_MAX) {
// This warning (and the two below) are possible to hit on pages
// with really large objects.
NS_WARN_IF_FALSE(aInfoType == BAND_FROM_POINT,
"bad height");
NS_WARNING_ASSERTION(aInfoType == BAND_FROM_POINT, "bad height");
blockEnd = nscoord_MAX;
} else {
blockEnd = blockStart + aBSize;

View File

@ -379,7 +379,7 @@ nsWeakFrame::Init(nsIFrame* aFrame)
mFrame = aFrame;
if (mFrame) {
nsIPresShell* shell = mFrame->PresContext()->GetPresShell();
NS_WARN_IF_FALSE(shell, "Null PresShell in nsWeakFrame!");
NS_WARNING_ASSERTION(shell, "Null PresShell in nsWeakFrame!");
if (shell) {
shell->AddWeakFrame(this);
} else {
@ -657,18 +657,18 @@ nsFrame::DestroyFrom(nsIFrame* aDestructRoot)
// Delete previous sibling's reference to me.
nsIFrame* prevSib = Properties().Get(nsIFrame::IBSplitPrevSibling());
if (prevSib) {
NS_WARN_IF_FALSE(this ==
prevSib->Properties().Get(nsIFrame::IBSplitSibling()),
"IB sibling chain is inconsistent");
NS_WARNING_ASSERTION(
this == prevSib->Properties().Get(nsIFrame::IBSplitSibling()),
"IB sibling chain is inconsistent");
prevSib->Properties().Delete(nsIFrame::IBSplitSibling());
}
// Delete next sibling's reference to me.
nsIFrame* nextSib = Properties().Get(nsIFrame::IBSplitSibling());
if (nextSib) {
NS_WARN_IF_FALSE(this ==
nextSib->Properties().Get(nsIFrame::IBSplitPrevSibling()),
"IB sibling chain is inconsistent");
NS_WARNING_ASSERTION(
this == nextSib->Properties().Get(nsIFrame::IBSplitPrevSibling()),
"IB sibling chain is inconsistent");
nextSib->Properties().Delete(nsIFrame::IBSplitPrevSibling());
}
}

View File

@ -1611,7 +1611,7 @@ struct nsGridContainerFrame::Tracks
MOZ_ASSERT(aNewSize >= 0);
auto& sz = mSizes[aRow];
nscoord delta = aNewSize - sz.mBase;
NS_WARN_IF_FALSE(delta != nscoord(0), "Useless call to ResizeRow");
NS_WARNING_ASSERTION(delta != nscoord(0), "Useless call to ResizeRow");
sz.mBase = aNewSize;
const uint32_t numRows = mSizes.Length();
for (uint32_t r = aRow + 1; r < numRows; ++r) {

View File

@ -328,11 +328,11 @@ nsLineLayout::UpdateBand(WritingMode aWM,
#endif
// Compute the difference between last times width and the new width
NS_WARN_IF_FALSE(mRootSpan->mIEnd != NS_UNCONSTRAINEDSIZE &&
availSpace.ISize(lineWM) != NS_UNCONSTRAINEDSIZE,
"have unconstrained inline size; this should only result "
"from very large sizes, not attempts at intrinsic width "
"calculation");
NS_WARNING_ASSERTION(
mRootSpan->mIEnd != NS_UNCONSTRAINEDSIZE &&
availSpace.ISize(lineWM) != NS_UNCONSTRAINEDSIZE,
"have unconstrained inline size; this should only result from very large "
"sizes, not attempts at intrinsic width calculation");
// The root span's mIStart moves to aICoord
nscoord deltaICoord = availSpace.IStart(lineWM) - mRootSpan->mIStart;
// The inline size of all spans changes by this much (the root span's
@ -1193,10 +1193,10 @@ nsLineLayout::AllowForStartMargin(PerFrameData* pfd,
// the frame we will properly avoid adding in the starting margin.
pfd->mMargin.IStart(lineWM) = 0;
} else if (NS_UNCONSTRAINEDSIZE == aReflowInput.ComputedISize()) {
NS_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aReflowInput.AvailableISize(),
"have unconstrained inline-size; this should only result "
"from very large sizes, not attempts at intrinsic "
"inline-size calculation");
NS_WARNING_ASSERTION(
NS_UNCONSTRAINEDSIZE != aReflowInput.AvailableISize(),
"have unconstrained inline-size; this should only result from very "
"large sizes, not attempts at intrinsic inline-size calculation");
// For inline-ish and text-ish things (which don't compute widths
// in the reflow state), adjust available inline-size to account
// for the start margin. The end margin will be accounted for when
@ -2971,7 +2971,7 @@ FindNearestRubyBaseAncestor(nsIFrame* aFrame)
// XXX It is possible that no ruby base ancestor is found because of
// some edge cases like form control or canvas inside ruby text.
// See bug 1138092 comment 4.
NS_WARN_IF_FALSE(aFrame, "no ruby base ancestor?");
NS_WARNING_ASSERTION(aFrame, "no ruby base ancestor?");
return aFrame;
}

View File

@ -395,8 +395,9 @@ nsRubyBaseContainerFrame::Reflow(nsPresContext* aPresContext,
// will return 0. However, in this case, the actual width of the
// container could be non-zero because of non-empty ruby annotations.
// XXX When bug 765861 gets fixed, this warning should be upgraded.
NS_WARN_IF_FALSE(NS_INLINE_IS_BREAK(aStatus) ||
isize == lineSpanSize || mFrames.IsEmpty(), "bad isize");
NS_WARNING_ASSERTION(
NS_INLINE_IS_BREAK(aStatus) || isize == lineSpanSize || mFrames.IsEmpty(),
"bad isize");
// If there exists any span, the columns must either be completely
// reflowed, or be not reflowed at all.

View File

@ -342,9 +342,9 @@ nsRubyFrame::ReflowSegment(nsPresContext* aPresContext,
nscoord startLeading = baseRect.BStart(lineWM) - offsetRect.BStart(lineWM);
nscoord endLeading = offsetRect.BEnd(lineWM) - baseRect.BEnd(lineWM);
// XXX When bug 765861 gets fixed, this warning should be upgraded.
NS_WARN_IF_FALSE(startLeading >= 0 && endLeading >= 0,
"Leadings should be non-negative (because adding "
"ruby annotation can only increase the size)");
NS_WARNING_ASSERTION(startLeading >= 0 && endLeading >= 0,
"Leadings should be non-negative (because adding "
"ruby annotation can only increase the size)");
mBStartLeading = std::max(mBStartLeading, startLeading);
mBEndLeading = std::max(mBEndLeading, endLeading);
}

View File

@ -1231,8 +1231,9 @@ CanTextCrossFrameBoundary(nsIFrame* aFrame, nsIAtom* aType)
result.mFrameToScan = aFrame->PrincipalChildList().FirstChild();
result.mOverflowFrameToScan =
aFrame->GetChildList(nsIFrame::kOverflowList).FirstChild();
NS_WARN_IF_FALSE(!result.mOverflowFrameToScan,
"Scanning overflow inline frames is something we should avoid");
NS_WARNING_ASSERTION(
!result.mOverflowFrameToScan,
"Scanning overflow inline frames is something we should avoid");
result.mScanSiblings = true;
result.mTextRunCanCrossFrameBoundary = true;
result.mLineBreakerCanCrossFrameBoundary = true;
@ -9480,8 +9481,8 @@ nsTextFrame::TrimTrailingWhiteSpace(DrawTarget* aDrawTarget)
// Maybe if we passed a maxTextLength? But that only happens at direction
// changes (so we wouldn't kern across the boundary) or for first-letter
// (which always fits because it starts the line!).
NS_WARN_IF_FALSE(result.mDeltaWidth >= 0,
"Negative deltawidth, something odd is happening");
NS_WARNING_ASSERTION(result.mDeltaWidth >= 0,
"Negative deltawidth, something odd is happening");
#ifdef NOISY_TRIM
ListTag(stdout);

View File

@ -180,9 +180,9 @@ MergeCharactersInTextRun(gfxTextRun* aDest, gfxTextRun* aSrc,
// that decomposed into a sequence of base+diacritics, for example),
// just discard the entire merge run. See comment at start of this
// function.
NS_WARN_IF_FALSE(!aCharsToMerge[mergeRunStart],
"unable to merge across a glyph run boundary, "
"glyph(s) discarded");
NS_WARNING_ASSERTION(
!aCharsToMerge[mergeRunStart],
"unable to merge across a glyph run boundary, glyph(s) discarded");
if (!aCharsToMerge[mergeRunStart]) {
if (anyMissing) {
mergedGlyph.SetMissing(glyphs.Length());

View File

@ -163,8 +163,9 @@ nsMathMLFrame::GetPresentationDataFrom(nsIFrame* aFrame,
}
frame = frame->GetParent();
}
NS_WARN_IF_FALSE(frame && frame->GetContent(),
"bad MathML markup - could not find the top <math> element");
NS_WARNING_ASSERTION(
frame && frame->GetContent(),
"bad MathML markup - could not find the top <math> element");
}
/* static */ void

View File

@ -3385,7 +3385,7 @@ nsPrintEngine::TurnScriptingOn(bool aDoTurnOn)
if (nsCOMPtr<nsPIDOMWindowInner> window = doc->GetInnerWindow()) {
nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(window);
NS_WARN_IF_FALSE(go && go->GetGlobalJSObject(), "Can't get global");
NS_WARNING_ASSERTION(go && go->GetGlobalJSObject(), "Can't get global");
nsresult propThere = NS_PROPTABLE_PROP_NOT_THERE;
doc->GetProperty(nsGkAtoms::scriptEnabledBeforePrintOrPreview,
&propThere);

View File

@ -1488,8 +1488,8 @@ CSSStyleSheet::AppendStyleRule(css::Rule* aRule)
nsresult rv =
#endif
RegisterNamespaceRule(aRule);
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv),
"RegisterNamespaceRule returned error");
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"RegisterNamespaceRule returned error");
}
}

View File

@ -2312,10 +2312,10 @@ nsCSSRuleProcessor::RestrictedSelectorMatches(
MOZ_ASSERT(aSelector->IsRestrictedSelector(),
"aSelector must not have a pseudo-element");
NS_WARN_IF_FALSE(!HasPseudoClassSelectorArgsWithCombinators(aSelector),
"processing eRestyle_SomeDescendants can be slow if "
"pseudo-classes with selector arguments can now have "
"combinators in them");
NS_WARNING_ASSERTION(
!HasPseudoClassSelectorArgsWithCombinators(aSelector),
"processing eRestyle_SomeDescendants can be slow if pseudo-classes with "
"selector arguments can now have combinators in them");
// We match aSelector as if :visited and :link both match visited and
// unvisited links.

View File

@ -5426,10 +5426,10 @@ nsComputedDOMStyle::StyleCoordToNSCoord(const nsStyleCoord& aCoord,
// We can also get a negative value with a percentage value if
// percentageBase is negative; this isn't expected, but can happen
// when large length values overflow.
NS_WARN_IF_FALSE(percentageBase >= 0,
"percentage base value overflowed to become "
"negative for a property that disallows negative "
"values");
NS_WARNING_ASSERTION(
percentageBase >= 0,
"percentage base value overflowed to become negative for a property "
"that disallows negative values");
MOZ_ASSERT(aCoord.IsCalcUnit() ||
(aCoord.HasPercent() && percentageBase < 0),
"parser should have rejected value");

View File

@ -204,8 +204,8 @@ public:
"conditions or is uncacheable");
#ifdef DEBUG
for (Entry* e = static_cast<Entry*>(mEntries[aSID]); e; e = e->mNext) {
NS_WARN_IF_FALSE(e->mConditions != aConditions,
"wasteful to have duplicate conditional style data");
NS_WARNING_ASSERTION(e->mConditions != aConditions,
"wasteful to have duplicate conditional style data");
}
#endif

View File

@ -397,9 +397,9 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
return;
}
NS_WARN_IF_FALSE(!mPresContext->EffectCompositor()->
HasThrottledStyleUpdates(),
"throttled animations not up to date");
NS_WARNING_ASSERTION(
!mPresContext->EffectCompositor()->HasThrottledStyleUpdates(),
"throttled animations not up to date");
// Compute what the css-transitions spec calls the "after-change
// style", which is the new style without any data from transitions,

View File

@ -249,7 +249,7 @@ AutoSetRestoreSVGContextPaint::AutoSetRestoreSVGContextPaint(
DebugOnly<nsresult> res =
mSVGDocument->SetProperty(nsGkAtoms::svgContextPaint, aContextPaint);
NS_WARN_IF_FALSE(NS_SUCCEEDED(res), "Failed to set context paint");
NS_WARNING_ASSERTION(NS_SUCCEEDED(res), "Failed to set context paint");
}
AutoSetRestoreSVGContextPaint::~AutoSetRestoreSVGContextPaint()
@ -259,7 +259,7 @@ AutoSetRestoreSVGContextPaint::~AutoSetRestoreSVGContextPaint()
DebugOnly<nsresult> res =
mSVGDocument->SetProperty(nsGkAtoms::svgContextPaint, mOuterContextPaint);
NS_WARN_IF_FALSE(NS_SUCCEEDED(res), "Failed to restore context paint");
NS_WARNING_ASSERTION(NS_SUCCEEDED(res), "Failed to restore context paint");
}
}

View File

@ -3001,9 +3001,10 @@ nsTableFrame::ReflowChildren(TableReflowInput& aReflowInput,
nsIFrame* prevKidFrame = nullptr;
WritingMode wm = aReflowInput.reflowInput.GetWritingMode();
NS_WARN_IF_FALSE(wm.IsVertical() || NS_UNCONSTRAINEDSIZE !=
aReflowInput.reflowInput.ComputedWidth(),
"shouldn't have unconstrained width in horizontal mode");
NS_WARNING_ASSERTION(
wm.IsVertical() ||
NS_UNCONSTRAINEDSIZE != aReflowInput.reflowInput.ComputedWidth(),
"shouldn't have unconstrained width in horizontal mode");
nsSize containerSize =
aReflowInput.reflowInput.ComputedSizeAsContainerIfConstrained();

View File

@ -48,10 +48,10 @@ struct TableCellReflowInput : public ReflowInput
void TableCellReflowInput::FixUp(const LogicalSize& aAvailSpace)
{
// fix the mComputed values during a pass 2 reflow since the cell can be a percentage base
NS_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aAvailSpace.ISize(mWritingMode),
"have unconstrained inline-size; this should only result from "
"very large sizes, not attempts at intrinsic inline size "
"calculation");
NS_WARNING_ASSERTION(
NS_UNCONSTRAINEDSIZE != aAvailSpace.ISize(mWritingMode),
"have unconstrained inline-size; this should only result from very large "
"sizes, not attempts at intrinsic inline size calculation");
if (NS_UNCONSTRAINEDSIZE != ComputedISize()) {
nscoord computedISize = aAvailSpace.ISize(mWritingMode) -
ComputedLogicalBorderPadding().IStartEnd(mWritingMode);

Some files were not shown because too many files have changed in this diff Show More