--- a/dom/base/DOMParser.cpp
+++ b/dom/base/DOMParser.cpp
@@ -352,18 +352,18 @@ DOMParser::Init(nsIPrincipal* principal,
rv = mPrincipal->GetURI(getter_AddRefs(mDocumentURI));
NS_ENSURE_SUCCESS(rv, rv);
}
}
}
mBaseURI = baseURI;
- NS_POSTCONDITION(mPrincipal, "Must have principal");
- NS_POSTCONDITION(mDocumentURI, "Must have document URI");
+ MOZ_ASSERT(mPrincipal, "Must have principal");
+ MOZ_ASSERT(mDocumentURI, "Must have document URI");
return NS_OK;
}
/*static */already_AddRefed<DOMParser>
DOMParser::Constructor(const GlobalObject& aOwner,
nsIPrincipal* aPrincipal, nsIURI* aDocumentURI,
nsIURI* aBaseURI, ErrorResult& rv)
{
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -1883,20 +1883,20 @@ Element::BindToTree(nsIDocument* aDocume
}
MOZ_ASSERT(parent);
}
}
// XXXbz script execution during binding can trigger some of these
// postcondition asserts.... But we do want that, since things will
// generally be quite broken when that happens.
- NS_POSTCONDITION(aDocument == GetUncomposedDoc(), "Bound to wrong document");
- NS_POSTCONDITION(aParent == GetParent(), "Bound to wrong parent");
- NS_POSTCONDITION(aBindingParent == GetBindingParent(),
- "Bound to wrong binding parent");
+ MOZ_ASSERT(aDocument == GetUncomposedDoc(), "Bound to wrong document");
+ MOZ_ASSERT(aParent == GetParent(), "Bound to wrong parent");
+ MOZ_ASSERT(aBindingParent == GetBindingParent(),
+ "Bound to wrong binding parent");
return NS_OK;
}
RemoveFromBindingManagerRunnable::RemoveFromBindingManagerRunnable(
nsBindingManager* aManager,
nsIContent* aContent,
nsIDocument* aDoc)
--- a/dom/base/nsGenericDOMDataNode.cpp
+++ b/dom/base/nsGenericDOMDataNode.cpp
@@ -565,20 +565,20 @@ nsGenericDOMDataNode::BindToTree(nsIDocu
nsNodeUtils::ParentChainChanged(this);
if (!hadParent && IsRootOfNativeAnonymousSubtree()) {
nsNodeUtils::NativeAnonymousChildListChange(this, false);
}
UpdateEditableState(false);
- NS_POSTCONDITION(aDocument == GetUncomposedDoc(), "Bound to wrong document");
- NS_POSTCONDITION(aParent == GetParent(), "Bound to wrong parent");
- NS_POSTCONDITION(aBindingParent == GetBindingParent(),
- "Bound to wrong binding parent");
+ MOZ_ASSERT(aDocument == GetUncomposedDoc(), "Bound to wrong document");
+ MOZ_ASSERT(aParent == GetParent(), "Bound to wrong parent");
+ MOZ_ASSERT(aBindingParent == GetBindingParent(),
+ "Bound to wrong binding parent");
return NS_OK;
}
void
nsGenericDOMDataNode::UnbindFromTree(bool aDeep, bool aNullParent)
{
// Unset frame flags; if we need them again later, they'll get set again.
--- a/dom/base/nsNameSpaceManager.cpp
+++ b/dom/base/nsNameSpaceManager.cpp
@@ -105,17 +105,17 @@ nsNameSpaceManager::RegisterNameSpace(co
aNameSpaceID = mURIArray.Length();
rv = AddNameSpace(atom.forget(), aNameSpaceID);
if (NS_FAILED(rv)) {
aNameSpaceID = kNameSpaceID_Unknown;
}
}
- NS_POSTCONDITION(aNameSpaceID >= -1, "Bogus namespace ID");
+ MOZ_ASSERT(aNameSpaceID >= -1, "Bogus namespace ID");
return rv;
}
nsresult
nsNameSpaceManager::GetNameSpaceURI(int32_t aNameSpaceID, nsAString& aURI)
{
NS_PRECONDITION(aNameSpaceID >= 0, "Bogus namespace ID");
@@ -154,21 +154,21 @@ nsNameSpaceManager::GetNameSpaceID(nsAto
}
int32_t nameSpaceID;
if (!aInChromeDoc
&& (mMathMLDisabled || mSVGDisabled)
&& mDisabledURIToIDTable.Get(aURI, &nameSpaceID)
&& ((mMathMLDisabled && kNameSpaceID_disabled_MathML == nameSpaceID) ||
(mSVGDisabled && kNameSpaceID_disabled_SVG == nameSpaceID))) {
- NS_POSTCONDITION(nameSpaceID >= 0, "Bogus namespace ID");
+ MOZ_ASSERT(nameSpaceID >= 0, "Bogus namespace ID");
return nameSpaceID;
}
if (mURIToIDTable.Get(aURI, &nameSpaceID)) {
- NS_POSTCONDITION(nameSpaceID >= 0, "Bogus namespace ID");
+ MOZ_ASSERT(nameSpaceID >= 0, "Bogus namespace ID");
return nameSpaceID;
}
return kNameSpaceID_Unknown;
}
nsresult
NS_NewElement(Element** aResult,
--- a/dom/base/nsNodeInfoManager.cpp
+++ b/dom/base/nsNodeInfoManager.cpp
@@ -454,17 +454,17 @@ nsNodeInfoManager::RemoveNodeInfo(NodeIn
mRecentlyUsedNodeInfos[index] = nullptr;
}
#ifdef DEBUG
bool ret =
#endif
PL_HashTableRemove(mNodeInfoHash, &aNodeInfo->mInner);
- NS_POSTCONDITION(ret, "Can't find mozilla::dom::NodeInfo to remove!!!");
+ MOZ_ASSERT(ret, "Can't find mozilla::dom::NodeInfo to remove!!!");
}
bool
nsNodeInfoManager::InternalSVGEnabled()
{
// If the svg.disabled pref. is true, convert all SVG nodes into
// disabled SVG nodes by swapping the namespace.
nsNameSpaceManager* nsmgr = nsNameSpaceManager::GetInstance();
--- a/dom/html/HTMLFormElement.cpp
+++ b/dom/html/HTMLFormElement.cpp
@@ -1289,20 +1289,21 @@ HTMLFormElement::AddElement(nsGenericHTM
(!mFirstSubmitInElements && !mFirstSubmitNotInElements)) &&
(*firstSubmitSlot == mDefaultSubmitElement ||
CompareFormControlPosition(aChild,
mDefaultSubmitElement, this) < 0)) {
mDefaultSubmitElement = aChild;
}
*firstSubmitSlot = aChild;
}
- NS_POSTCONDITION(mDefaultSubmitElement == mFirstSubmitInElements ||
- mDefaultSubmitElement == mFirstSubmitNotInElements ||
- !mDefaultSubmitElement,
- "What happened here?");
+
+ MOZ_ASSERT(mDefaultSubmitElement == mFirstSubmitInElements ||
+ mDefaultSubmitElement == mFirstSubmitNotInElements ||
+ !mDefaultSubmitElement,
+ "What happened here?");
// Notify that the state of the previous default submit element has changed
// if the element which is the default submit element has changed. The new
// default submit element is responsible for its own state update.
if (oldDefaultSubmit && oldDefaultSubmit != mDefaultSubmitElement) {
oldDefaultSubmit->UpdateState(aNotify);
}
}
@@ -1425,19 +1426,19 @@ HTMLFormElement::HandleDefaultSubmitRemo
"How did that happen?");
// Have both; use the earlier one
mDefaultSubmitElement =
CompareFormControlPosition(mFirstSubmitInElements,
mFirstSubmitNotInElements, this) < 0 ?
mFirstSubmitInElements : mFirstSubmitNotInElements;
}
- NS_POSTCONDITION(mDefaultSubmitElement == mFirstSubmitInElements ||
- mDefaultSubmitElement == mFirstSubmitNotInElements,
- "What happened here?");
+ MOZ_ASSERT(mDefaultSubmitElement == mFirstSubmitInElements ||
+ mDefaultSubmitElement == mFirstSubmitNotInElements,
+ "What happened here?");
// Notify about change if needed.
if (mDefaultSubmitElement) {
mDefaultSubmitElement->UpdateState(true);
}
}
nsresult
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -1513,17 +1513,17 @@ nsFrameConstructorState::ProcessFrameIns
break;
}
}
mFrameManager->InsertFrames(containingBlock, aChildListID,
insertionPoint, aFrameItems);
}
}
- NS_POSTCONDITION(aFrameItems.IsEmpty(), "How did that happen?");
+ MOZ_ASSERT(aFrameItems.IsEmpty(), "How did that happen?");
}
nsFrameConstructorSaveState::nsFrameConstructorSaveState()
: mItems(nullptr),
mSavedItems(nullptr),
mChildListID(kPrincipalList),
mState(nullptr),
@@ -9369,17 +9369,17 @@ nsCSSFrameConstructor::CreateContinuingF
if (nextInFlow) {
nextInFlow->SetPrevInFlow(newFrame);
newFrame->SetNextInFlow(nextInFlow);
} else if (nextContinuation) {
nextContinuation->SetPrevContinuation(newFrame);
newFrame->SetNextContinuation(nextContinuation);
}
- NS_POSTCONDITION(!newFrame->GetNextSibling(), "unexpected sibling");
+ MOZ_ASSERT(!newFrame->GetNextSibling(), "unexpected sibling");
return newFrame;
}
nsresult
nsCSSFrameConstructor::ReplicateFixedFrames(nsPageContentFrame* aParentFrame)
{
// Now deal with fixed-pos things.... They should appear on all pages,
// so we want to move over the placeholders when processing the child
@@ -13202,32 +13202,32 @@ Iterator::AppendItemsToList(nsCSSFrameCo
// Swap out undisplayed item arrays, before we nuke the array on our end
aTargetList.mUndisplayedItems.SwapElements(mList.mUndisplayedItems);
// reset mList
mList.Reset(aFCtor);
// Point ourselves to aEnd, as advertised
SetToEnd();
- NS_POSTCONDITION(*this == aEnd, "How did that happen?");
+ MOZ_ASSERT(*this == aEnd, "How did that happen?");
}
void
nsCSSFrameConstructor::FrameConstructionItemList::
Iterator::InsertItem(FrameConstructionItem* aItem)
{
if (IsDone()) {
mList.mItems.insertBack(aItem);
} else {
// Just insert the item before us. There's no magic here.
mCurrent->setPrevious(aItem);
}
mList.AdjustCountsForItem(aItem, 1);
- NS_POSTCONDITION(aItem->getNext() == mCurrent, "How did that happen?");
+ MOZ_ASSERT(aItem->getNext() == mCurrent, "How did that happen?");
}
void
nsCSSFrameConstructor::FrameConstructionItemList::
Iterator::DeleteItemsTo(nsCSSFrameConstructor* aFCtor, const Iterator& aEnd)
{
NS_PRECONDITION(&mList == &aEnd.mList, "End iterator for some other list?");
NS_PRECONDITION(*this != aEnd, "Shouldn't be at aEnd yet");
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1614,17 +1614,17 @@ nsLayoutUtils::GetChildListNameFor(nsIFr
#ifdef DEBUG
// Verify that the frame is actually in that child list or in the
// corresponding overflow list.
nsContainerFrame* parent = aChildFrame->GetParent();
bool found = parent->GetChildList(id).ContainsFrame(aChildFrame);
if (!found) {
found = parent->GetChildList(nsIFrame::kOverflowList)
.ContainsFrame(aChildFrame);
- NS_POSTCONDITION(found, "not in child list");
+ MOZ_ASSERT(found, "not in child list");
}
#endif
return id;
}
static Element*
GetPseudo(const nsIContent* aContent, nsAtom* aPseudoProperty)
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -1310,17 +1310,17 @@ nsContainerFrame::StealFrame(nsIFrame* a
removed = frameList->ContinueRemoveFrame(aChild);
if (frameList->IsEmpty()) {
DestroyOverflowList();
}
}
}
}
- NS_POSTCONDITION(removed, "StealFrame: can't find aChild");
+ MOZ_ASSERT(removed, "StealFrame: can't find aChild");
return removed ? NS_OK : NS_ERROR_UNEXPECTED;
}
nsFrameList
nsContainerFrame::StealFramesAfter(nsIFrame* aChild)
{
NS_ASSERTION(!aChild ||
!(aChild->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER),
@@ -1425,17 +1425,17 @@ nsContainerFrame::DeleteNextInFlowChild(
nsLayoutUtils::AssertTreeOnlyEmptyNextInFlows(aNextInFlow);
}
#endif
// Delete the next-in-flow frame and its descendants. This will also
// remove it from its next-in-flow/prev-in-flow chain.
aNextInFlow->Destroy();
- NS_POSTCONDITION(!prevInFlow->GetNextInFlow(), "non null next-in-flow");
+ MOZ_ASSERT(!prevInFlow->GetNextInFlow(), "non null next-in-flow");
}
/**
* Set the frames on the overflow list
*/
void
nsContainerFrame::SetOverflowFrames(const nsFrameList& aOverflowFrames)
{
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -6527,17 +6527,18 @@ nsIFrame* nsIFrame::GetTailContinuation(
frame = frame->GetPrevContinuation();
NS_ASSERTION(frame, "first continuation can't be overflow container");
}
for (nsIFrame* next = frame->GetNextContinuation();
next && !(next->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER);
next = frame->GetNextContinuation()) {
frame = next;
}
- NS_POSTCONDITION(frame, "illegal state in continuation chain.");
+
+ MOZ_ASSERT(frame, "illegal state in continuation chain.");
return frame;
}
// Associated view object
void
nsIFrame::SetView(nsView* aView)
{
if (aView) {
--- a/layout/generic/nsFrameList.cpp
+++ b/layout/generic/nsFrameList.cpp
@@ -252,17 +252,17 @@ nsFrameList::ExtractTail(FrameLinkEnumer
newFirstFrame = mFirstChild;
newLastFrame = mLastChild;
Clear();
}
// Now make sure aLink doesn't point to a frame we no longer have.
aLink.mFrame = nullptr;
- NS_POSTCONDITION(aLink.AtEnd(), "What's going on here?");
+ MOZ_ASSERT(aLink.AtEnd(), "What's going on here?");
return nsFrameList(newFirstFrame, newLastFrame);
}
nsIFrame*
nsFrameList::FrameAt(int32_t aIndex) const
{
NS_PRECONDITION(aIndex >= 0, "invalid arg");
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -601,17 +601,18 @@ ClearAllTextRunReferences(nsTextFrame* a
bool found = aStartContinuation == aFrame;
while (aFrame) {
NS_ASSERTION(aFrame->IsTextFrame(), "Bad frame");
if (!aFrame->RemoveTextRun(aTextRun)) {
break;
}
aFrame = aFrame->GetNextContinuation();
}
- NS_POSTCONDITION(!found || aStartContinuation, "how did we find null?");
+
+ MOZ_ASSERT(!found || aStartContinuation, "how did we find null?");
return found;
}
/**
* Kill all references to |aTextRun| starting at |aStartContinuation|.
* It could be referenced by any of its owners, and all their in-flows.
* If |aStartContinuation| is null then process all userdata frames
* and their continuations.
@@ -9088,19 +9089,21 @@ nsTextFrame::SetLength(int32_t aLength,
framesToRemove = f;
}
} else if (framesToRemove) {
RemoveEmptyInFlows(framesToRemove, f);
framesToRemove = nullptr;
}
f = next;
}
- NS_POSTCONDITION(!framesToRemove || (f && f->mContentOffset == end),
- "How did we exit the loop if we null out framesToRemove if "
- "!next || next->mContentOffset > end ?");
+
+ MOZ_ASSERT(!framesToRemove || (f && f->mContentOffset == end),
+ "How did we exit the loop if we null out framesToRemove if "
+ "!next || next->mContentOffset > end ?");
+
if (framesToRemove) {
// We are guaranteed that we exited the loop with f not null, per the
// postcondition above
RemoveEmptyInFlows(framesToRemove, f);
}
#ifdef DEBUG
f = this;
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -208,18 +208,18 @@ SheetLoadData::SheetLoadData(Loader* aLo
NS_PRECONDITION(mLoader, "Must have a loader!");
if (mParentData) {
mSyncLoad = mParentData->mSyncLoad;
mIsNonDocumentSheet = mParentData->mIsNonDocumentSheet;
mUseSystemPrincipal = mParentData->mUseSystemPrincipal;
++(mParentData->mPendingChildren);
}
- NS_POSTCONDITION(!mUseSystemPrincipal || mSyncLoad,
- "Shouldn't use system principal for async loads");
+ MOZ_ASSERT(!mUseSystemPrincipal || mSyncLoad,
+ "Shouldn't use system principal for async loads");
}
SheetLoadData::SheetLoadData(Loader* aLoader,
nsIURI* aURI,
StyleSheet* aSheet,
bool aSyncLoad,
bool aUseSystemPrincipal,
const Encoding* aPreloadEncoding,
@@ -243,18 +243,18 @@ SheetLoadData::SheetLoadData(Loader* aLo
, mSheetAlreadyComplete(false)
, mOwningElement(nullptr)
, mObserver(aObserver)
, mLoaderPrincipal(aLoaderPrincipal)
, mRequestingNode(aRequestingNode)
, mPreloadEncoding(aPreloadEncoding)
{
NS_PRECONDITION(mLoader, "Must have a loader!");
- NS_POSTCONDITION(!mUseSystemPrincipal || mSyncLoad,
- "Shouldn't use system principal for async loads");
+ MOZ_ASSERT(!mUseSystemPrincipal || mSyncLoad,
+ "Shouldn't use system principal for async loads");
}
SheetLoadData::~SheetLoadData()
{
NS_CSS_NS_RELEASE_LIST_MEMBER(SheetLoadData, this, mNext);
}
NS_IMETHODIMP
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -3105,22 +3105,22 @@ nsRuleNode::SetDefaultOnRoot(const nsSty
/**
* End an nsRuleNode::Compute*Data function for an inherited struct.
*
* @param type_ The nsStyle* type this function computes.
* @param data_ Variable holding the result of this function.
*/
#define COMPUTE_END_INHERITED(type_, data_) \
- NS_POSTCONDITION(!conditions.CacheableWithoutDependencies() || \
- aRuleDetail == eRuleFullReset || \
- (aStartStruct && aRuleDetail == eRulePartialReset), \
- "conditions.CacheableWithoutDependencies() must be false " \
- "for inherited structs unless all properties have been " \
- "specified with values other than inherit"); \
+ MOZ_ASSERT(!conditions.CacheableWithoutDependencies() || \
+ aRuleDetail == eRuleFullReset || \
+ (aStartStruct && aRuleDetail == eRulePartialReset), \
+ "conditions.CacheableWithoutDependencies() must be false " \
+ "for inherited structs unless all properties have been " \
+ "specified with values other than inherit"); \
if (conditions.CacheableWithoutDependencies()) { \
/* We were fully specified and can therefore be cached right on the */ \
/* rule node. */ \
if (!aHighestNode->mStyleData.mInheritedData) { \
aHighestNode->mStyleData.mInheritedData = \
new (mPresContext) nsInheritedStyleData; \
} \
NS_ASSERTION(!aHighestNode->mStyleData.mInheritedData-> \
@@ -3140,23 +3140,23 @@ nsRuleNode::SetDefaultOnRoot(const nsSty
/**
* End an nsRuleNode::Compute*Data function for a reset struct.
*
* @param type_ The nsStyle* type this function computes.
* @param data_ Variable holding the result of this function.
*/
#define COMPUTE_END_RESET(type_, data_) \
- NS_POSTCONDITION(!conditions.CacheableWithoutDependencies() || \
- aRuleDetail == eRuleNone || \
- aRuleDetail == eRulePartialReset || \
- aRuleDetail == eRuleFullReset, \
- "conditions.CacheableWithoutDependencies() must be false " \
- "for reset structs if any properties were specified as " \
- "inherit"); \
+ MOZ_ASSERT(!conditions.CacheableWithoutDependencies() || \
+ aRuleDetail == eRuleNone || \
+ aRuleDetail == eRulePartialReset || \
+ aRuleDetail == eRuleFullReset, \
+ "conditions.CacheableWithoutDependencies() must be false " \
+ "for reset structs if any properties were specified as " \
+ "inherit"); \
if (conditions.CacheableWithoutDependencies()) { \
/* We were fully specified and can therefore be cached right on the */ \
/* rule node. */ \
if (!aHighestNode->mStyleData.mResetData) { \
aHighestNode->mStyleData.mResetData = \
new (mPresContext) nsConditionalResetStyleData; \
} \
NS_ASSERTION(!aHighestNode->mStyleData.mResetData-> \
--- a/layout/style/nsRuleWalker.h
+++ b/layout/style/nsRuleWalker.h
@@ -25,17 +25,17 @@ public:
mCurrent = aNode;
}
nsPresContext* PresContext() const { return mRoot->PresContext(); }
protected:
void DoForward(nsIStyleRule* aRule) {
mCurrent = mCurrent->Transition(aRule, mLevel, mImportance);
- NS_POSTCONDITION(mCurrent, "Transition messed up");
+ MOZ_ASSERT(mCurrent, "Transition messed up");
}
public:
void Forward(nsIStyleRule* aRule) {
NS_PRECONDITION(!RefPtr<mozilla::css::Declaration>(do_QueryObject(aRule)),
"Calling the wrong Forward() overload");
DoForward(aRule);
}
--- a/xpcom/base/nsDebug.h
+++ b/xpcom/base/nsDebug.h
@@ -101,20 +101,19 @@ inline void MOZ_PretendNoReturn()
MOZ_PretendNoReturn(); \
} \
} while(0)
#else
#define NS_ASSERTION(expr, str) do { /* nothing */ } while(0)
#endif
/**
- * NS_PRECONDITION/POSTCONDITION are synonyms for NS_ASSERTION.
+ * NS_PRECONDITION is a synonym for NS_ASSERTION.
*/
#define NS_PRECONDITION(expr, str) NS_ASSERTION(expr, str)
-#define NS_POSTCONDITION(expr, str) NS_ASSERTION(expr, str)
/**
* This macros triggers a program failure if executed. It indicates that
* an attempt was made to execute a codepath which should not be reachable.
*/
#ifdef DEBUG
#define NS_NOTREACHED(str) \
do { \
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -1598,18 +1598,19 @@ nsLocalFile::Normalize()
}
if (currentDir.Last() == '\\') {
path.Replace(0, 2, currentDir);
} else {
path.Replace(0, 2, currentDir + NS_LITERAL_STRING("\\"));
}
}
- NS_POSTCONDITION(0 < rootIdx && rootIdx < (int32_t)path.Length(), "rootIdx is invalid");
- NS_POSTCONDITION(path.CharAt(rootIdx) == '\\', "rootIdx is invalid");
+
+ MOZ_ASSERT(0 < rootIdx && rootIdx < (int32_t)path.Length(), "rootIdx is invalid");
+ MOZ_ASSERT(path.CharAt(rootIdx) == '\\', "rootIdx is invalid");
// if there is nothing following the root path then it is already normalized
if (rootIdx + 1 == (int32_t)path.Length()) {
return NS_OK;
}
// assign the root
const char16_t* pathBuffer = path.get(); // simplify access to the buffer