Bug 1457813 - Part 2: Replace non-asserting NS_PRECONDITIONs with MOZ_ASSERTs. r=froydnj

s/NS_PRECONDITION/MOZ_ASSERT/ and reindent

MozReview-Commit-ID: KuUsnVe2h8L

--HG--
extra : source : c14655ab3df2c9b1465dd8102b9d25683359a37b
This commit is contained in:
Chris Peterson 2018-04-28 12:50:58 -07:00
parent d4cad70c37
commit 71422dcaa9
292 changed files with 1627 additions and 1642 deletions

View file

@ -239,7 +239,7 @@ void
FocusManager::DispatchFocusEvent(DocAccessible* aDocument,
Accessible* aTarget)
{
NS_PRECONDITION(aDocument, "No document for focused accessible!");
MOZ_ASSERT(aDocument, "No document for focused accessible!");
if (aDocument) {
RefPtr<AccEvent> event =
new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, aTarget,
@ -292,8 +292,8 @@ FocusManager::ProcessDOMFocus(nsINode* aTarget)
void
FocusManager::ProcessFocusEvent(AccEvent* aEvent)
{
NS_PRECONDITION(aEvent->GetEventType() == nsIAccessibleEvent::EVENT_FOCUS,
"Focus event is expected!");
MOZ_ASSERT(aEvent->GetEventType() == nsIAccessibleEvent::EVENT_FOCUS,
"Focus event is expected!");
// Emit focus event if event target is the active item. Otherwise then check
// if it's still focused and then update active item and emit focus event.

View file

@ -37,13 +37,13 @@ TextAttrsMgr::GetAttributes(nsIPersistentProperties* aAttributes,
// 3. Offset accessible and result hyper text offsets must not be specified
// but include default text attributes flag and attributes list must be
// specified in the case of default text attributes.
NS_PRECONDITION(mHyperTextAcc &&
((mOffsetAcc && mOffsetAccIdx != -1 &&
aStartOffset && aEndOffset) ||
(!mOffsetAcc && mOffsetAccIdx == -1 &&
!aStartOffset && !aEndOffset &&
mIncludeDefAttrs && aAttributes)),
"Wrong usage of TextAttrsMgr!");
MOZ_ASSERT(mHyperTextAcc &&
((mOffsetAcc && mOffsetAccIdx != -1 &&
aStartOffset && aEndOffset) ||
(!mOffsetAcc && mOffsetAccIdx == -1 &&
!aStartOffset && !aEndOffset &&
mIncludeDefAttrs && aAttributes)),
"Wrong usage of TextAttrsMgr!");
// Embedded objects are combined into own range with empty attributes set.
if (mOffsetAcc && !mOffsetAcc->IsText()) {

View file

@ -2356,7 +2356,7 @@ Accessible::IsLink() const
uint32_t
Accessible::StartOffset()
{
NS_PRECONDITION(IsLink(), "StartOffset is called not on hyper link!");
MOZ_ASSERT(IsLink(), "StartOffset is called not on hyper link!");
HyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nullptr;
return hyperText ? hyperText->GetChildOffset(this) : 0;
@ -2365,7 +2365,7 @@ Accessible::StartOffset()
uint32_t
Accessible::EndOffset()
{
NS_PRECONDITION(IsLink(), "EndOffset is called on not hyper link!");
MOZ_ASSERT(IsLink(), "EndOffset is called on not hyper link!");
HyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nullptr;
return hyperText ? (hyperText->GetChildOffset(this) + 1) : 0;
@ -2374,21 +2374,21 @@ Accessible::EndOffset()
uint32_t
Accessible::AnchorCount()
{
NS_PRECONDITION(IsLink(), "AnchorCount is called on not hyper link!");
MOZ_ASSERT(IsLink(), "AnchorCount is called on not hyper link!");
return 1;
}
Accessible*
Accessible::AnchorAt(uint32_t aAnchorIndex)
{
NS_PRECONDITION(IsLink(), "GetAnchor is called on not hyper link!");
MOZ_ASSERT(IsLink(), "GetAnchor is called on not hyper link!");
return aAnchorIndex == 0 ? this : nullptr;
}
already_AddRefed<nsIURI>
Accessible::AnchorURIAt(uint32_t aAnchorIndex)
{
NS_PRECONDITION(IsLink(), "AnchorURIAt is called on not hyper link!");
MOZ_ASSERT(IsLink(), "AnchorURIAt is called on not hyper link!");
return nullptr;
}

View file

@ -743,7 +743,7 @@ public:
*/
inline bool IsLinkValid()
{
NS_PRECONDITION(IsLink(), "IsLinkValid is called on not hyper link!");
MOZ_ASSERT(IsLink(), "IsLinkValid is called on not hyper link!");
// XXX In order to implement this we would need to follow every link
// Perhaps we can get information about invalid links from the cache

View file

@ -17,7 +17,7 @@ using namespace mozilla::a11y;
inline bool
ToNSRange(id aValue, NSRange* aRange)
{
NS_PRECONDITION(aRange, "aRange is nil");
MOZ_ASSERT(aRange, "aRange is nil");
if ([aValue isKindOfClass:[NSValue class]] &&
strcmp([(NSValue*)aValue objCType], @encode(NSRange)) == 0) {
@ -547,7 +547,7 @@ ToNSString(id aValue)
- (NSString*)stringFromRange:(NSRange*)range
{
NS_PRECONDITION(range, "no range");
MOZ_ASSERT(range, "no range");
AccessibleWrap* accWrap = [self getGeckoAccessible];
ProxyAccessible* proxy = [self getProxyAccessible];

View file

@ -19,7 +19,7 @@ xpcAccessibleSelectable::GetSelectedItems(nsIArray** aSelectedItems)
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
AutoTArray<Accessible*, 10> items;
Intl()->SelectedItems(&items);
@ -48,7 +48,7 @@ xpcAccessibleSelectable::GetSelectedItemCount(uint32_t* aSelectionCount)
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
*aSelectionCount = Intl()->SelectedItemCount();
return NS_OK;
@ -63,7 +63,7 @@ xpcAccessibleSelectable::GetSelectedItemAt(uint32_t aIndex,
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
*aSelected = ToXPC(Intl()->GetSelectedItem(aIndex));
if (*aSelected) {
@ -82,7 +82,7 @@ xpcAccessibleSelectable::IsItemSelected(uint32_t aIndex, bool* aIsSelected)
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
*aIsSelected = Intl()->IsItemSelected(aIndex);
return NS_OK;
@ -93,7 +93,7 @@ xpcAccessibleSelectable::AddItemToSelection(uint32_t aIndex)
{
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
return Intl()->AddItemToSelection(aIndex) ? NS_OK : NS_ERROR_INVALID_ARG;
}
@ -103,7 +103,7 @@ xpcAccessibleSelectable::RemoveItemFromSelection(uint32_t aIndex)
{
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
return Intl()->RemoveItemFromSelection(aIndex) ? NS_OK : NS_ERROR_INVALID_ARG;
}
@ -116,7 +116,7 @@ xpcAccessibleSelectable::SelectAll(bool* aIsMultiSelect)
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
*aIsMultiSelect = Intl()->SelectAll();
return NS_OK;
@ -127,7 +127,7 @@ xpcAccessibleSelectable::UnselectAll()
{
if (!Intl())
return NS_ERROR_FAILURE;
NS_PRECONDITION(Intl()->IsSelect(), "Called on non selectable widget!");
MOZ_ASSERT(Intl()->IsSelect(), "Called on non selectable widget!");
Intl()->UnselectAll();
return NS_OK;

View file

@ -371,7 +371,7 @@ XULTreeGridRowAccessible::ChildCount() const
XULTreeGridCellAccessible*
XULTreeGridRowAccessible::GetCellAccessible(nsITreeColumn* aColumn) const
{
NS_PRECONDITION(aColumn, "No tree column!");
MOZ_ASSERT(aColumn, "No tree column!");
void* key = static_cast<void*>(aColumn);
XULTreeGridCellAccessible* cachedCell = mAccessibleCache.GetWeak(key);

View file

@ -330,7 +330,7 @@ ContentPrincipal::MayLoadInternal(nsIURI* aURI)
NS_IMETHODIMP
ContentPrincipal::GetHashValue(uint32_t* aValue)
{
NS_PRECONDITION(mCodebase, "Need a codebase");
MOZ_ASSERT(mCodebase, "Need a codebase");
*aValue = nsScriptSecurityManager::HashPrincipalByOrigin(this);
return NS_OK;

View file

@ -28,7 +28,7 @@ NS_IMETHODIMP_(MozExternalRefCountType)
nsJSPrincipals::AddRef()
{
MOZ_ASSERT(NS_IsMainThread());
NS_PRECONDITION(int32_t(refcount) >= 0, "illegal refcnt");
MOZ_ASSERT(int32_t(refcount) >= 0, "illegal refcnt");
nsrefcnt count = ++refcount;
NS_LOG_ADDREF(this, count, "nsJSPrincipals", sizeof(*this));
return count;
@ -38,7 +38,7 @@ NS_IMETHODIMP_(MozExternalRefCountType)
nsJSPrincipals::Release()
{
MOZ_ASSERT(NS_IsMainThread());
NS_PRECONDITION(0 != refcount, "dup release");
MOZ_ASSERT(0 != refcount, "dup release");
nsrefcnt count = --refcount;
NS_LOG_RELEASE(this, count, "nsJSPrincipals");
if (count == 0) {

View file

@ -260,7 +260,8 @@ nsScriptSecurityManager::GetChannelResultPrincipal(nsIChannel* aChannel,
nsIPrincipal** aPrincipal,
bool aIgnoreSandboxing)
{
NS_PRECONDITION(aChannel, "Must have channel!");
MOZ_ASSERT(aChannel, "Must have channel!");
// Check whether we have an nsILoadInfo that says what we should do.
nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
if (loadInfo && loadInfo->GetForceInheritPrincipalOverruleOwner()) {
@ -349,7 +350,7 @@ NS_IMETHODIMP
nsScriptSecurityManager::GetChannelURIPrincipal(nsIChannel* aChannel,
nsIPrincipal** aPrincipal)
{
NS_PRECONDITION(aChannel, "Must have channel!");
MOZ_ASSERT(aChannel, "Must have channel!");
// Get the principal from the URI. Make sure this does the same thing
// as nsDocument::Reset and XULDocument::StartDocumentLoad.
@ -517,7 +518,7 @@ nsScriptSecurityManager::CheckLoadURIFromScript(JSContext *cx, nsIURI *aURI)
static nsresult
DenyAccessIfURIHasFlags(nsIURI* aURI, uint32_t aURIFlags)
{
NS_PRECONDITION(aURI, "Must have URI!");
MOZ_ASSERT(aURI, "Must have URI!");
bool uriHasFlags;
nsresult rv =
@ -565,7 +566,8 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal,
nsIURI *aTargetURI,
uint32_t aFlags)
{
NS_PRECONDITION(aPrincipal, "CheckLoadURIWithPrincipal must have a principal");
MOZ_ASSERT(aPrincipal, "CheckLoadURIWithPrincipal must have a principal");
// If someone passes a flag that we don't understand, we should
// fail, because they may need a security check that we don't
// provide.

View file

@ -113,7 +113,7 @@ nsChromeProtocolHandler::NewChannel2(nsIURI* aURI,
NS_ENSURE_ARG_POINTER(aURI);
NS_ENSURE_ARG_POINTER(aLoadInfo);
NS_PRECONDITION(aResult, "Null out param");
MOZ_ASSERT(aResult, "Null out param");
#ifdef DEBUG
// Check that the uri we got is already canonified

View file

@ -261,7 +261,7 @@ nsDSURIContentListener::CanHandleContent(const char* aContentType,
char** aDesiredContentType,
bool* aCanHandleContent)
{
NS_PRECONDITION(aCanHandleContent, "Null out param?");
MOZ_ASSERT(aCanHandleContent, "Null out param?");
NS_ENSURE_ARG_POINTER(aDesiredContentType);
*aCanHandleContent = false;

View file

@ -537,7 +537,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsDocLoader)
NS_IMETHODIMP
nsDocShell::GetInterface(const nsIID& aIID, void** aSink)
{
NS_PRECONDITION(aSink, "null out param");
MOZ_ASSERT(aSink, "null out param");
*aSink = nullptr;
@ -668,9 +668,9 @@ nsDocShell::LoadURI(nsIURI* aURI,
uint32_t aLoadFlags,
bool aFirstParty)
{
NS_PRECONDITION(aLoadInfo || (aLoadFlags & EXTRA_LOAD_FLAGS) == 0,
"Unexpected flags");
NS_PRECONDITION((aLoadFlags & 0xf) == 0, "Should not have these flags set");
MOZ_ASSERT(aLoadInfo || (aLoadFlags & EXTRA_LOAD_FLAGS) == 0,
"Unexpected flags");
MOZ_ASSERT((aLoadFlags & 0xf) == 0, "Should not have these flags set");
// Note: we allow loads to get through here even if mFiredUnloadEvent is
// true; that case will get handled in LoadInternal or LoadHistoryEntry,
@ -3127,7 +3127,7 @@ nsDocShell::CanAccessItem(nsIDocShellTreeItem* aTargetItem,
nsIDocShellTreeItem* aAccessingItem,
bool aConsiderOpener)
{
NS_PRECONDITION(aTargetItem, "Must have target item!");
MOZ_ASSERT(aTargetItem, "Must have target item!");
if (!gValidateOrigin || !aAccessingItem) {
// Good to go
@ -5291,7 +5291,7 @@ nsDocShell::LoadPage(nsISupports* aPageDescriptor, uint32_t aDisplayType)
NS_IMETHODIMP
nsDocShell::GetCurrentDescriptor(nsISupports** aPageDescriptor)
{
NS_PRECONDITION(aPageDescriptor, "Null out param?");
MOZ_ASSERT(aPageDescriptor, "Null out param?");
*aPageDescriptor = nullptr;
@ -6345,7 +6345,7 @@ nsDocShell::ForceRefreshURIFromTimer(nsIURI* aURI,
bool aMetaRefresh,
nsITimer* aTimer)
{
NS_PRECONDITION(aTimer, "Must have a timer here");
MOZ_ASSERT(aTimer, "Must have a timer here");
// Remove aTimer from mRefreshURIList if needed
if (mRefreshURIList) {
@ -9758,8 +9758,8 @@ nsDocShell::InternalLoad(nsIURI* aURI,
if (mFiredUnloadEvent) {
if (IsOKToLoadURI(aURI)) {
NS_PRECONDITION(aWindowTarget.IsEmpty(),
"Shouldn't have a window target here!");
MOZ_ASSERT(aWindowTarget.IsEmpty(),
"Shouldn't have a window target here!");
// If this is a replace load, make whatever load triggered
// the unload event also a replace load, so we don't
@ -11340,8 +11340,8 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel,
uint32_t aLoadType, bool aFireOnLocationChange,
bool aAddToGlobalHistory, bool aCloneSHChildren)
{
NS_PRECONDITION(aURI, "uri is null");
NS_PRECONDITION(!aChannel || !aTriggeringPrincipal, "Shouldn't have both set");
MOZ_ASSERT(aURI, "uri is null");
MOZ_ASSERT(!aChannel || !aTriggeringPrincipal, "Shouldn't have both set");
MOZ_ASSERT(!aPrincipalToInherit || (aPrincipalToInherit && aTriggeringPrincipal));
@ -11992,8 +11992,8 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel,
bool aCloneChildren,
nsISHEntry** aNewEntry)
{
NS_PRECONDITION(aURI, "uri is null");
NS_PRECONDITION(!aChannel || !aTriggeringPrincipal, "Shouldn't have both set");
MOZ_ASSERT(aURI, "uri is null");
MOZ_ASSERT(!aChannel || !aTriggeringPrincipal, "Shouldn't have both set");
#if defined(DEBUG)
if (MOZ_LOG_TEST(gDocShellLog, LogLevel::Debug)) {
@ -13153,7 +13153,7 @@ nsDocShell::GetIsContent(bool* aIsContent)
bool
nsDocShell::IsOKToLoadURI(nsIURI* aURI)
{
NS_PRECONDITION(aURI, "Must have a URI!");
MOZ_ASSERT(aURI, "Must have a URI!");
if (!mFiredUnloadEvent) {
return true;

View file

@ -31,7 +31,7 @@ nsWebNavigationInfo::IsTypeSupported(const nsACString& aType,
nsIWebNavigation* aWebNav,
uint32_t* aIsTypeSupported)
{
NS_PRECONDITION(aIsTypeSupported, "null out param?");
MOZ_ASSERT(aIsTypeSupported, "null out param?");
// Note to self: aWebNav could be an nsWebBrowser or an nsDocShell here (or
// an nsSHistory, but not much we can do with that). So if we start using
@ -94,7 +94,7 @@ nsresult
nsWebNavigationInfo::IsTypeSupportedInternal(const nsCString& aType,
uint32_t* aIsSupported)
{
NS_PRECONDITION(aIsSupported, "Null out param?");
MOZ_ASSERT(aIsSupported, "Null out param?");
nsContentUtils::ContentViewerType vtype = nsContentUtils::TYPE_UNSUPPORTED;

View file

@ -53,7 +53,7 @@ static bool gInitialized = false;
static nsresult
Initialize()
{
NS_PRECONDITION(!gInitialized, "docshell module already initialized");
MOZ_ASSERT(!gInitialized, "docshell module already initialized");
if (gInitialized) {
return NS_OK;
}

View file

@ -139,8 +139,8 @@ nsSHEntryShared::DropPresentationState()
nsresult
nsSHEntryShared::SetContentViewer(nsIContentViewer* aViewer)
{
NS_PRECONDITION(!aViewer || !mContentViewer,
"SHEntryShared already contains viewer");
MOZ_ASSERT(!aViewer || !mContentViewer,
"SHEntryShared already contains viewer");
if (mContentViewer || !aViewer) {
DropPresentationState();

View file

@ -689,7 +689,7 @@ nsSHistory::GetCount(int32_t* aResult)
NS_IMETHODIMP
nsSHistory::GetIndex(int32_t* aResult)
{
NS_PRECONDITION(aResult, "null out param?");
MOZ_ASSERT(aResult, "null out param?");
*aResult = mIndex;
return NS_OK;
}
@ -698,7 +698,7 @@ nsSHistory::GetIndex(int32_t* aResult)
NS_IMETHODIMP
nsSHistory::GetRequestedIndex(int32_t* aResult)
{
NS_PRECONDITION(aResult, "null out param?");
MOZ_ASSERT(aResult, "null out param?");
*aResult = mRequestedIndex;
return NS_OK;
}

View file

@ -66,8 +66,8 @@ CharacterData::CharacterData(already_AddRefed<dom::NodeInfo>&& aNodeInfo)
CharacterData::~CharacterData()
{
NS_PRECONDITION(!IsInUncomposedDoc(),
"Please remove this from the document properly");
MOZ_ASSERT(!IsInUncomposedDoc(),
"Please remove this from the document properly");
if (GetParent()) {
NS_RELEASE(mParent);
}
@ -246,8 +246,8 @@ CharacterData::SetTextInternal(uint32_t aOffset, uint32_t aCount,
uint32_t aLength, bool aNotify,
CharacterDataChangeInfo::Details* aDetails)
{
NS_PRECONDITION(aBuffer || !aLength,
"Null buffer passed to SetTextInternal!");
MOZ_ASSERT(aBuffer || !aLength,
"Null buffer passed to SetTextInternal!");
// sanitize arguments
uint32_t textLength = mText.GetLength();
@ -446,28 +446,28 @@ CharacterData::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers)
{
NS_PRECONDITION(aParent || aDocument, "Must have document if no parent!");
NS_PRECONDITION(NODE_FROM(aParent, aDocument)->OwnerDoc() == OwnerDoc(),
"Must have the same owner document");
NS_PRECONDITION(!aParent || aDocument == aParent->GetUncomposedDoc(),
"aDocument must be current doc of aParent");
NS_PRECONDITION(!GetUncomposedDoc() && !IsInUncomposedDoc(),
"Already have a document. Unbind first!");
MOZ_ASSERT(aParent || aDocument, "Must have document if no parent!");
MOZ_ASSERT(NODE_FROM(aParent, aDocument)->OwnerDoc() == OwnerDoc(),
"Must have the same owner document");
MOZ_ASSERT(!aParent || aDocument == aParent->GetUncomposedDoc(),
"aDocument must be current doc of aParent");
MOZ_ASSERT(!GetUncomposedDoc() && !IsInUncomposedDoc(),
"Already have a document. Unbind first!");
// Note that as we recurse into the kids, they'll have a non-null parent. So
// only assert if our parent is _changing_ while we have a parent.
NS_PRECONDITION(!GetParent() || aParent == GetParent(),
"Already have a parent. Unbind first!");
NS_PRECONDITION(!GetBindingParent() ||
aBindingParent == GetBindingParent() ||
(!aBindingParent && aParent &&
aParent->GetBindingParent() == GetBindingParent()),
"Already have a binding parent. Unbind first!");
NS_PRECONDITION(aBindingParent != this,
"Content must not be its own binding parent");
NS_PRECONDITION(!IsRootOfNativeAnonymousSubtree() ||
aBindingParent == aParent,
"Native anonymous content must have its parent as its "
"own binding parent");
MOZ_ASSERT(!GetParent() || aParent == GetParent(),
"Already have a parent. Unbind first!");
MOZ_ASSERT(!GetBindingParent() ||
aBindingParent == GetBindingParent() ||
(!aBindingParent && aParent &&
aParent->GetBindingParent() == GetBindingParent()),
"Already have a binding parent. Unbind first!");
MOZ_ASSERT(aBindingParent != this,
"Content must not be its own binding parent");
MOZ_ASSERT(!IsRootOfNativeAnonymousSubtree() ||
aBindingParent == aParent,
"Native anonymous content must have its parent as its "
"own binding parent");
if (!aBindingParent && aParent) {
aBindingParent = aParent->GetBindingParent();

View file

@ -1534,30 +1534,30 @@ Element::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers)
{
NS_PRECONDITION(aParent || aDocument, "Must have document if no parent!");
NS_PRECONDITION((NODE_FROM(aParent, aDocument)->OwnerDoc() == OwnerDoc()),
"Must have the same owner document");
NS_PRECONDITION(!aParent || aDocument == aParent->GetUncomposedDoc(),
"aDocument must be current doc of aParent");
NS_PRECONDITION(!GetUncomposedDoc(), "Already have a document. Unbind first!");
MOZ_ASSERT(aParent || aDocument, "Must have document if no parent!");
MOZ_ASSERT((NODE_FROM(aParent, aDocument)->OwnerDoc() == OwnerDoc()),
"Must have the same owner document");
MOZ_ASSERT(!aParent || aDocument == aParent->GetUncomposedDoc(),
"aDocument must be current doc of aParent");
MOZ_ASSERT(!GetUncomposedDoc(), "Already have a document. Unbind first!");
// Note that as we recurse into the kids, they'll have a non-null parent. So
// only assert if our parent is _changing_ while we have a parent.
NS_PRECONDITION(!GetParent() || aParent == GetParent(),
"Already have a parent. Unbind first!");
NS_PRECONDITION(!GetBindingParent() ||
aBindingParent == GetBindingParent() ||
(!aBindingParent && aParent &&
aParent->GetBindingParent() == GetBindingParent()),
"Already have a binding parent. Unbind first!");
NS_PRECONDITION(aBindingParent != this,
"Content must not be its own binding parent");
NS_PRECONDITION(!IsRootOfNativeAnonymousSubtree() ||
aBindingParent == aParent,
"Native anonymous content must have its parent as its "
"own binding parent");
NS_PRECONDITION(aBindingParent || !aParent ||
aBindingParent == aParent->GetBindingParent(),
"We should be passed the right binding parent");
MOZ_ASSERT(!GetParent() || aParent == GetParent(),
"Already have a parent. Unbind first!");
MOZ_ASSERT(!GetBindingParent() ||
aBindingParent == GetBindingParent() ||
(!aBindingParent && aParent &&
aParent->GetBindingParent() == GetBindingParent()),
"Already have a binding parent. Unbind first!");
MOZ_ASSERT(aBindingParent != this,
"Content must not be its own binding parent");
MOZ_ASSERT(!IsRootOfNativeAnonymousSubtree() ||
aBindingParent == aParent,
"Native anonymous content must have its parent as its "
"own binding parent");
MOZ_ASSERT(aBindingParent || !aParent ||
aBindingParent == aParent->GetBindingParent(),
"We should be passed the right binding parent");
#ifdef MOZ_XUL
// First set the binding parent
@ -1841,7 +1841,7 @@ RemoveFromBindingManagerRunnable::Run()
void
Element::UnbindFromTree(bool aDeep, bool aNullParent)
{
NS_PRECONDITION(aDeep || (!GetUncomposedDoc() && !GetBindingParent()),
MOZ_ASSERT(aDeep || (!GetUncomposedDoc() && !GetBindingParent()),
"Shallow unbind won't clear document and binding parent on "
"kids!");
@ -2218,9 +2218,9 @@ Element::DispatchEvent(nsPresContext* aPresContext,
bool aFullDispatch,
nsEventStatus* aStatus)
{
NS_PRECONDITION(aTarget, "Must have target");
NS_PRECONDITION(aEvent, "Must have source event");
NS_PRECONDITION(aStatus, "Null out param?");
MOZ_ASSERT(aTarget, "Must have target");
MOZ_ASSERT(aEvent, "Must have source event");
MOZ_ASSERT(aStatus, "Null out param?");
if (!aPresContext) {
return NS_OK;
@ -2247,9 +2247,9 @@ Element::DispatchClickEvent(nsPresContext* aPresContext,
const EventFlags* aExtraEventFlags,
nsEventStatus* aStatus)
{
NS_PRECONDITION(aTarget, "Must have target");
NS_PRECONDITION(aSourceEvent, "Must have source event");
NS_PRECONDITION(aStatus, "Null out param?");
MOZ_ASSERT(aTarget, "Must have target");
MOZ_ASSERT(aSourceEvent, "Must have source event");
MOZ_ASSERT(aStatus, "Null out param?");
WidgetMouseEvent event(aSourceEvent->IsTrusted(), eMouseClick,
aSourceEvent->mWidget, WidgetMouseEvent::eReal);
@ -2322,7 +2322,7 @@ Element::SetEventHandler(nsAtom* aEventName,
return NS_OK;
}
NS_PRECONDITION(aEventName, "Must have event name!");
MOZ_ASSERT(aEventName, "Must have event name!");
bool defer = true;
EventListenerManager* manager =
GetEventListenerManagerForAttr(aEventName, &defer);

View file

@ -603,22 +603,22 @@ protected:
// those in EXTERNALLY_MANAGED_STATES.
virtual void AddStates(EventStates aStates)
{
NS_PRECONDITION(!aStates.HasAtLeastOneOfStates(INTRINSIC_STATES),
"Should only be adding externally-managed states here");
MOZ_ASSERT(!aStates.HasAtLeastOneOfStates(INTRINSIC_STATES),
"Should only be adding externally-managed states here");
AddStatesSilently(aStates);
NotifyStateChange(aStates);
}
virtual void RemoveStates(EventStates aStates)
{
NS_PRECONDITION(!aStates.HasAtLeastOneOfStates(INTRINSIC_STATES),
"Should only be removing externally-managed states here");
MOZ_ASSERT(!aStates.HasAtLeastOneOfStates(INTRINSIC_STATES),
"Should only be removing externally-managed states here");
RemoveStatesSilently(aStates);
NotifyStateChange(aStates);
}
virtual void ToggleStates(EventStates aStates, bool aNotify)
{
NS_PRECONDITION(!aStates.HasAtLeastOneOfStates(INTRINSIC_STATES),
"Should only be removing externally-managed states here");
MOZ_ASSERT(!aStates.HasAtLeastOneOfStates(INTRINSIC_STATES),
"Should only be removing externally-managed states here");
mState ^= aStates;
if (aNotify) {
NotifyStateChange(aStates);

View file

@ -835,12 +835,12 @@ EventSourceImpl::AsyncOnChannelRedirect(nsIChannel* aOldChannel,
return NS_ERROR_ABORT;
}
nsCOMPtr<nsIRequest> aOldRequest = do_QueryInterface(aOldChannel);
NS_PRECONDITION(aOldRequest, "Redirect from a null request?");
MOZ_ASSERT(aOldRequest, "Redirect from a null request?");
nsresult rv = CheckHealthOfRequestCallback(aOldRequest);
NS_ENSURE_SUCCESS(rv, rv);
NS_PRECONDITION(aNewChannel, "Redirect without a channel?");
MOZ_ASSERT(aNewChannel, "Redirect without a channel?");
nsCOMPtr<nsIURI> newURI;
rv = NS_GetFinalChannelURI(aNewChannel, getter_AddRefs(newURI));
@ -1373,8 +1373,7 @@ EventSourceImpl::TimerCallback(nsITimer* aTimer, void* aClosure)
return;
}
NS_PRECONDITION(!thisObject->mHttpChannel,
"the channel hasn't been cancelled!!");
MOZ_ASSERT(!thisObject->mHttpChannel, "the channel hasn't been cancelled!!");
if (!thisObject->IsFrozen()) {
nsresult rv = thisObject->InitChannelAndRequestEventSource();

View file

@ -814,8 +814,8 @@ FragmentOrElement::FragmentOrElement(already_AddRefed<mozilla::dom::NodeInfo>&&
FragmentOrElement::~FragmentOrElement()
{
NS_PRECONDITION(!IsInUncomposedDoc(),
"Please remove this from the document properly");
MOZ_ASSERT(!IsInUncomposedDoc(),
"Please remove this from the document properly");
if (GetParent()) {
NS_RELEASE(mParent);
}
@ -1187,7 +1187,7 @@ FragmentOrElement::InsertChildBefore(nsIContent* aKid,
nsIContent* aBeforeThis,
bool aNotify)
{
NS_PRECONDITION(aKid, "null ptr");
MOZ_ASSERT(aKid, "null ptr");
int32_t index = aBeforeThis ? ComputeIndexOf(aBeforeThis) : GetChildCount();
MOZ_ASSERT(index >= 0);
@ -1200,7 +1200,7 @@ FragmentOrElement::InsertChildAt_Deprecated(nsIContent* aKid,
uint32_t aIndex,
bool aNotify)
{
NS_PRECONDITION(aKid, "null ptr");
MOZ_ASSERT(aKid, "null ptr");
return doInsertChildAt(aKid, aIndex, aNotify, mAttrsAndChildren);
}

View file

@ -122,7 +122,7 @@ private:
explicit Notification(IDTracker* aTarget)
: mTarget(aTarget)
{
NS_PRECONDITION(aTarget, "Must have a target");
MOZ_ASSERT(aTarget, "Must have a target");
}
IDTracker* mTarget;
};

View file

@ -2122,7 +2122,7 @@ nsresult
Selection::StartAutoScrollTimer(nsIFrame* aFrame, const nsPoint& aPoint,
uint32_t aDelay)
{
NS_PRECONDITION(aFrame, "Need a frame");
MOZ_ASSERT(aFrame, "Need a frame");
nsresult result;
if (!mFrameSelection) {
@ -2160,7 +2160,7 @@ Selection::StopAutoScrollTimer()
nsresult
Selection::DoAutoScroll(nsIFrame* aFrame, nsPoint aPoint)
{
NS_PRECONDITION(aFrame, "Need a frame");
MOZ_ASSERT(aFrame, "Need a frame");
if (mAutoScrollTimer) {
(void)mAutoScrollTimer->Stop();

View file

@ -614,7 +614,7 @@ nsAttrAndChildArray::SetAndSwapMappedAttr(nsAtom* aLocalName,
nsresult
nsAttrAndChildArray::DoSetMappedAttrStyleSheet(nsHTMLStyleSheet* aSheet)
{
NS_PRECONDITION(mImpl && mImpl->mMappedAttrs,
MOZ_ASSERT(mImpl && mImpl->mMappedAttrs,
"Should have mapped attrs here!");
if (aSheet == mImpl->mMappedAttrs->GetStyleSheet()) {
return NS_OK;
@ -800,7 +800,7 @@ nsAttrAndChildArray::GetMapped() const
nsresult nsAttrAndChildArray::EnsureCapacityToClone(const nsAttrAndChildArray& aOther,
bool aAllocateChildren)
{
NS_PRECONDITION(!mImpl, "nsAttrAndChildArray::EnsureCapacityToClone requires the array be empty when called");
MOZ_ASSERT(!mImpl, "nsAttrAndChildArray::EnsureCapacityToClone requires the array be empty when called");
uint32_t attrCount = aOther.NonMappedAttrCount();
uint32_t childCount = 0;
@ -930,8 +930,8 @@ inline void
nsAttrAndChildArray::SetChildAtPos(void** aPos, nsIContent* aChild,
uint32_t aIndex, uint32_t aChildCount)
{
NS_PRECONDITION(!aChild->GetNextSibling(), "aChild with next sibling?");
NS_PRECONDITION(!aChild->GetPreviousSibling(), "aChild with prev sibling?");
MOZ_ASSERT(!aChild->GetNextSibling(), "aChild with next sibling?");
MOZ_ASSERT(!aChild->GetPreviousSibling(), "aChild with prev sibling?");
*aPos = aChild;
NS_ADDREF(aChild);
@ -965,4 +965,3 @@ nsAttrAndChildArray::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) co
return n;
}

View file

@ -184,7 +184,7 @@ private:
bool AttrSlotIsTaken(uint32_t aSlot) const
{
NS_PRECONDITION(aSlot < AttrSlotCount(), "out-of-bounds");
MOZ_ASSERT(aSlot < AttrSlotCount(), "out-of-bounds");
return mImpl->mBuffer[aSlot * ATTRSIZE];
}

View file

@ -737,7 +737,7 @@ nsAttrValue::GetAsAtom() const
const nsCheapString
nsAttrValue::GetStringValue() const
{
NS_PRECONDITION(Type() == eString, "wrong type");
MOZ_ASSERT(Type() == eString, "wrong type");
return nsCheapString(static_cast<nsStringBuffer*>(GetPtr()));
}
@ -758,7 +758,7 @@ nsAttrValue::GetColorValue(nscolor& aColor) const
void
nsAttrValue::GetEnumString(nsAString& aResult, bool aRealTag) const
{
NS_PRECONDITION(Type() == eEnum, "wrong type");
MOZ_ASSERT(Type() == eEnum, "wrong type");
uint32_t allEnumBits =
(BaseType() == eIntegerBase) ? static_cast<uint32_t>(GetIntInternal())
@ -800,8 +800,8 @@ nsAttrValue::GetAtomCount() const
nsAtom*
nsAttrValue::AtomAt(int32_t aIndex) const
{
NS_PRECONDITION(aIndex >= 0, "Index must not be negative");
NS_PRECONDITION(GetAtomCount() > uint32_t(aIndex), "aIndex out of range");
MOZ_ASSERT(aIndex >= 0, "Index must not be negative");
MOZ_ASSERT(GetAtomCount() > uint32_t(aIndex), "aIndex out of range");
if (BaseType() == eAtomBase) {
return GetAtomValue();
@ -1400,8 +1400,8 @@ nsAttrValue::ParseEnumValue(const nsAString& aValue,
}
if (aDefaultValue) {
NS_PRECONDITION(aTable <= aDefaultValue && aDefaultValue < tableEntry,
"aDefaultValue not inside aTable?");
MOZ_ASSERT(aTable <= aDefaultValue && aDefaultValue < tableEntry,
"aDefaultValue not inside aTable?");
SetIntValueAndType(EnumTableEntryToValue(aTable, aDefaultValue),
eEnum, &aValue);
return true;
@ -1443,7 +1443,7 @@ bool
nsAttrValue::ParseIntWithBounds(const nsAString& aString,
int32_t aMin, int32_t aMax)
{
NS_PRECONDITION(aMin < aMax, "bad boundaries");
MOZ_ASSERT(aMin < aMax, "bad boundaries");
ResetIfSet();
@ -1965,4 +1965,3 @@ nsAttrValue::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
return n;
}

View file

@ -128,7 +128,7 @@ public:
inline int32_t
nsAttrValue::GetIntegerValue() const
{
NS_PRECONDITION(Type() == eInteger, "wrong type");
MOZ_ASSERT(Type() == eInteger, "wrong type");
return (BaseType() == eIntegerBase)
? GetIntInternal()
: GetMiscContainer()->mValue.mInteger;
@ -137,7 +137,7 @@ nsAttrValue::GetIntegerValue() const
inline int16_t
nsAttrValue::GetEnumValue() const
{
NS_PRECONDITION(Type() == eEnum, "wrong type");
MOZ_ASSERT(Type() == eEnum, "wrong type");
// We don't need to worry about sign extension here since we're
// returning an int16_t which will cut away the top bits.
return static_cast<int16_t>((
@ -150,7 +150,7 @@ nsAttrValue::GetEnumValue() const
inline float
nsAttrValue::GetPercentValue() const
{
NS_PRECONDITION(Type() == ePercent, "wrong type");
MOZ_ASSERT(Type() == ePercent, "wrong type");
return ((BaseType() == eIntegerBase)
? GetIntInternal()
: GetMiscContainer()->mValue.mPercent)
@ -160,35 +160,35 @@ nsAttrValue::GetPercentValue() const
inline mozilla::AtomArray*
nsAttrValue::GetAtomArrayValue() const
{
NS_PRECONDITION(Type() == eAtomArray, "wrong type");
MOZ_ASSERT(Type() == eAtomArray, "wrong type");
return GetMiscContainer()->mValue.mAtomArray;
}
inline mozilla::DeclarationBlock*
nsAttrValue::GetCSSDeclarationValue() const
{
NS_PRECONDITION(Type() == eCSSDeclaration, "wrong type");
MOZ_ASSERT(Type() == eCSSDeclaration, "wrong type");
return GetMiscContainer()->mValue.mCSSDeclaration;
}
inline nsIURI*
nsAttrValue::GetURLValue() const
{
NS_PRECONDITION(Type() == eURL, "wrong type");
MOZ_ASSERT(Type() == eURL, "wrong type");
return GetMiscContainer()->mValue.mURL;
}
inline double
nsAttrValue::GetDoubleValue() const
{
NS_PRECONDITION(Type() == eDoubleValue, "wrong type");
MOZ_ASSERT(Type() == eDoubleValue, "wrong type");
return GetMiscContainer()->mDoubleValue;
}
inline bool
nsAttrValue::GetIntMarginValue(nsIntMargin& aMargin) const
{
NS_PRECONDITION(Type() == eIntMarginValue, "wrong type");
MOZ_ASSERT(Type() == eIntMarginValue, "wrong type");
nsIntMargin* m = GetMiscContainer()->mValue.mIntMargin;
if (!m)
return false;
@ -269,7 +269,7 @@ nsAttrValue::Type() const
inline nsAtom*
nsAttrValue::GetAtomValue() const
{
NS_PRECONDITION(Type() == eAtom, "wrong type");
MOZ_ASSERT(Type() == eAtom, "wrong type");
return reinterpret_cast<nsAtom*>(GetPtr());
}

View file

@ -542,8 +542,8 @@ DragDataProducer::Produce(DataTransfer* aDataTransfer,
nsIContent** aDragNode,
nsACString& aPrincipalURISpec)
{
NS_PRECONDITION(aCanDrag && aSelection && aDataTransfer && aDragNode,
"null pointer passed to Produce");
MOZ_ASSERT(aCanDrag && aSelection && aDataTransfer && aDragNode,
"null pointer passed to Produce");
NS_ASSERTION(mWindow, "window not set");
NS_ASSERTION(mSelectionTargetNode, "selection target node should have been set");

View file

@ -628,7 +628,7 @@ nsContentList::AttributeChanged(Element* aElement,
int32_t aModType,
const nsAttrValue* aOldValue)
{
NS_PRECONDITION(aElement, "Must have a content node to work with");
MOZ_ASSERT(aElement, "Must have a content node to work with");
if (!mFunc || !mFuncMayDependOnAttr || mState == LIST_DIRTY ||
!MayContainRelevantNodes(aElement->GetParentNode()) ||
@ -658,7 +658,7 @@ void
nsContentList::ContentAppended(nsIContent* aFirstNewContent)
{
nsIContent* container = aFirstNewContent->GetParent();
NS_PRECONDITION(container, "Can't get at the new content if no container!");
MOZ_ASSERT(container, "Can't get at the new content if no container!");
/*
* If the state is LIST_DIRTY then we have no useful information in our list
@ -827,9 +827,9 @@ nsContentList::Match(Element *aElement)
bool
nsContentList::MatchSelf(nsIContent *aContent)
{
NS_PRECONDITION(aContent, "Can't match null stuff, you know");
NS_PRECONDITION(mDeep || aContent->GetParentNode() == mRootNode,
"MatchSelf called on a node that we can't possibly match");
MOZ_ASSERT(aContent, "Can't match null stuff, you know");
MOZ_ASSERT(mDeep || aContent->GetParentNode() == mRootNode,
"MatchSelf called on a node that we can't possibly match");
if (!aContent->IsElement()) {
return false;

View file

@ -387,8 +387,8 @@ public:
// most common namespace id is kNameSpaceID_Unknown. So check the
// string first. Cases in which whether our root's ownerDocument
// is HTML changes are extremely rare, so check those last.
NS_PRECONDITION(mXMLMatchAtom,
"How did we get here with a null match atom on our list?");
MOZ_ASSERT(mXMLMatchAtom,
"How did we get here with a null match atom on our list?");
return
mXMLMatchAtom->Equals(aKey.mTagname) &&
mRootNode == aKey.mRootNode &&

View file

@ -88,7 +88,7 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod,
}
//sanity-check passed-through parameters
NS_PRECONDITION(decision, "Null out pointer");
MOZ_ASSERT(decision, "Null out pointer");
WARN_IF_URI_UNINITIALIZED(contentLocation, "Request URI");
WARN_IF_URI_UNINITIALIZED(requestingLocation, "Requesting URI");
@ -208,7 +208,7 @@ nsContentPolicy::ShouldLoad(nsIURI *contentLocation,
int16_t *decision)
{
// ShouldProcess does not need a content location, but we do
NS_PRECONDITION(contentLocation, "Must provide request location");
MOZ_ASSERT(contentLocation, "Must provide request location");
nsresult rv = CheckPolicy(&nsIContentPolicy::ShouldLoad,
contentLocation, loadInfo,
mimeType, decision);

View file

@ -195,8 +195,8 @@ nsContentSink::Init(nsIDocument* aDoc,
nsISupports* aContainer,
nsIChannel* aChannel)
{
NS_PRECONDITION(aDoc, "null ptr");
NS_PRECONDITION(aURI, "null ptr");
MOZ_ASSERT(aDoc, "null ptr");
MOZ_ASSERT(aURI, "null ptr");
if (!aDoc || !aURI) {
return NS_ERROR_NULL_POINTER;

View file

@ -770,7 +770,7 @@ nsresult nsContentUtils::RemoveWyciwygScheme(nsIURI* aURI, nsIURI** aReturn)
#ifdef DEBUG
bool isWyciwyg = false;
aURI->SchemeIs("wyciwyg", &isWyciwyg);
NS_PRECONDITION(isWyciwyg, "Scheme should be wyciwyg");
MOZ_ASSERT(isWyciwyg, "Scheme should be wyciwyg");
#endif
nsAutoCString path;
nsresult rv = aURI->GetPathQueryRef(path);
@ -1061,7 +1061,7 @@ nsContentUtils::Atob(const nsAString& aAsciiBase64String,
bool
nsContentUtils::IsAutocompleteEnabled(mozilla::dom::HTMLInputElement* aInput)
{
NS_PRECONDITION(aInput, "aInput should not be null!");
MOZ_ASSERT(aInput, "aInput should not be null!");
nsAutoString autocomplete;
aInput->GetAutocomplete(autocomplete);
@ -2193,7 +2193,7 @@ nsContentUtils::IsAbsoluteURL(const nsACString& aURL)
bool
nsContentUtils::InProlog(nsINode *aNode)
{
NS_PRECONDITION(aNode, "missing node to nsContentUtils::InProlog");
MOZ_ASSERT(aNode, "missing node to nsContentUtils::InProlog");
nsINode* parent = aNode->GetParentNode();
if (!parent || !parent->IsDocument()) {
@ -2391,7 +2391,7 @@ nsContentUtils::LookupBindingMember(JSContext* aCx, nsIContent *aContent,
nsINode*
nsContentUtils::GetCrossDocParentNode(nsINode* aChild)
{
NS_PRECONDITION(aChild, "The child is null!");
MOZ_ASSERT(aChild, "The child is null!");
nsINode* parent = aChild->GetParentNode();
if (parent && parent->IsContent() && aChild->IsContent()) {
@ -2412,8 +2412,8 @@ bool
nsContentUtils::ContentIsDescendantOf(const nsINode* aPossibleDescendant,
const nsINode* aPossibleAncestor)
{
NS_PRECONDITION(aPossibleDescendant, "The possible descendant is null!");
NS_PRECONDITION(aPossibleAncestor, "The possible ancestor is null!");
MOZ_ASSERT(aPossibleDescendant, "The possible descendant is null!");
MOZ_ASSERT(aPossibleAncestor, "The possible ancestor is null!");
do {
if (aPossibleDescendant == aPossibleAncestor)
@ -2428,8 +2428,8 @@ bool
nsContentUtils::ContentIsHostIncludingDescendantOf(
const nsINode* aPossibleDescendant, const nsINode* aPossibleAncestor)
{
NS_PRECONDITION(aPossibleDescendant, "The possible descendant is null!");
NS_PRECONDITION(aPossibleAncestor, "The possible ancestor is null!");
MOZ_ASSERT(aPossibleDescendant, "The possible descendant is null!");
MOZ_ASSERT(aPossibleAncestor, "The possible ancestor is null!");
do {
if (aPossibleDescendant == aPossibleAncestor)
@ -2478,8 +2478,8 @@ bool
nsContentUtils::ContentIsCrossDocDescendantOf(nsINode* aPossibleDescendant,
nsINode* aPossibleAncestor)
{
NS_PRECONDITION(aPossibleDescendant, "The possible descendant is null!");
NS_PRECONDITION(aPossibleAncestor, "The possible ancestor is null!");
MOZ_ASSERT(aPossibleDescendant, "The possible descendant is null!");
MOZ_ASSERT(aPossibleAncestor, "The possible ancestor is null!");
do {
if (aPossibleDescendant == aPossibleAncestor)
@ -2497,8 +2497,8 @@ nsContentUtils::ContentIsFlattenedTreeDescendantOf(
const nsINode* aPossibleDescendant,
const nsINode* aPossibleAncestor)
{
NS_PRECONDITION(aPossibleDescendant, "The possible descendant is null!");
NS_PRECONDITION(aPossibleAncestor, "The possible ancestor is null!");
MOZ_ASSERT(aPossibleDescendant, "The possible descendant is null!");
MOZ_ASSERT(aPossibleAncestor, "The possible ancestor is null!");
do {
if (aPossibleDescendant == aPossibleAncestor) {
@ -2516,8 +2516,8 @@ nsContentUtils::ContentIsFlattenedTreeDescendantOfForStyle(
const nsINode* aPossibleDescendant,
const nsINode* aPossibleAncestor)
{
NS_PRECONDITION(aPossibleDescendant, "The possible descendant is null!");
NS_PRECONDITION(aPossibleAncestor, "The possible ancestor is null!");
MOZ_ASSERT(aPossibleDescendant, "The possible descendant is null!");
MOZ_ASSERT(aPossibleAncestor, "The possible ancestor is null!");
do {
if (aPossibleDescendant == aPossibleAncestor) {
@ -3451,9 +3451,9 @@ nsContentUtils::CanLoadImage(nsIURI* aURI, nsINode* aNode,
int16_t* aImageBlockingStatus,
uint32_t aContentType)
{
NS_PRECONDITION(aURI, "Must have a URI");
NS_PRECONDITION(aLoadingDocument, "Must have a document");
NS_PRECONDITION(aLoadingPrincipal, "Must have a loading principal");
MOZ_ASSERT(aURI, "Must have a URI");
MOZ_ASSERT(aLoadingDocument, "Must have a document");
MOZ_ASSERT(aLoadingPrincipal, "Must have a loading principal");
nsresult rv;
@ -3676,11 +3676,11 @@ nsContentUtils::LoadImage(nsIURI* aURI, nsINode* aContext,
uint32_t aContentPolicyType,
bool aUseUrgentStartForChannel)
{
NS_PRECONDITION(aURI, "Must have a URI");
NS_PRECONDITION(aContext, "Must have a context");
NS_PRECONDITION(aLoadingDocument, "Must have a document");
NS_PRECONDITION(aLoadingPrincipal, "Must have a principal");
NS_PRECONDITION(aRequest, "Null out param");
MOZ_ASSERT(aURI, "Must have a URI");
MOZ_ASSERT(aContext, "Must have a context");
MOZ_ASSERT(aLoadingDocument, "Must have a document");
MOZ_ASSERT(aLoadingPrincipal, "Must have a principal");
MOZ_ASSERT(aRequest, "Null out param");
imgLoader* imgLoader = GetImgLoaderForDocument(aLoadingDocument);
if (!imgLoader) {
@ -3788,7 +3788,7 @@ nsContentUtils::ContentIsDraggable(nsIContent* aContent)
bool
nsContentUtils::IsDraggableImage(nsIContent* aContent)
{
NS_PRECONDITION(aContent, "Must have content node to test");
MOZ_ASSERT(aContent, "Must have content node to test");
nsCOMPtr<nsIImageLoadingContent> imageContent(do_QueryInterface(aContent));
if (!imageContent) {
@ -4590,7 +4590,7 @@ nsContentUtils::MatchElementId(nsIContent *aContent, const nsAtom* aId)
Element *
nsContentUtils::MatchElementId(nsIContent *aContent, const nsAString& aId)
{
NS_PRECONDITION(!aId.IsEmpty(), "Will match random elements");
MOZ_ASSERT(!aId.IsEmpty(), "Will match random elements");
// ID attrs are generally stored as atoms, so just atomize this up front
RefPtr<nsAtom> id(NS_Atomize(aId));
@ -4737,9 +4737,9 @@ void
nsContentUtils::MaybeFireNodeRemoved(nsINode* aChild, nsINode* aParent,
nsIDocument* aOwnerDoc)
{
NS_PRECONDITION(aChild, "Missing child");
NS_PRECONDITION(aChild->GetParentNode() == aParent, "Wrong parent");
NS_PRECONDITION(aChild->OwnerDoc() == aOwnerDoc, "Wrong owner-doc");
MOZ_ASSERT(aChild, "Missing child");
MOZ_ASSERT(aChild->GetParentNode() == aParent, "Wrong parent");
MOZ_ASSERT(aChild->OwnerDoc() == aOwnerDoc, "Wrong owner-doc");
// Having an explicit check here since it's an easy mistake to fall into,
// and there might be existing code with problems. We'd rather be safe
@ -5407,10 +5407,8 @@ bool
nsContentUtils::IsInSameAnonymousTree(const nsINode* aNode,
const nsIContent* aContent)
{
NS_PRECONDITION(aNode,
"Must have a node to work with");
NS_PRECONDITION(aContent,
"Must have a content to work with");
MOZ_ASSERT(aNode, "Must have a node to work with");
MOZ_ASSERT(aContent, "Must have a content to work with");
if (!aNode->IsContent()) {
/**
@ -5494,7 +5492,7 @@ nsContentUtils::TriggerLink(nsIContent *aContent, nsPresContext *aPresContext,
bool aClick, bool aIsTrusted)
{
NS_ASSERTION(aPresContext, "Need a nsPresContext");
NS_PRECONDITION(aLinkURI, "No link URI");
MOZ_ASSERT(aLinkURI, "No link URI");
if (aContent->IsEditable()) {
return;
@ -6279,7 +6277,7 @@ SameOriginCheckerImpl::AsyncOnChannelRedirect(nsIChannel* aOldChannel,
uint32_t aFlags,
nsIAsyncVerifyRedirectCallback* cb)
{
NS_PRECONDITION(aNewChannel, "Redirecting to null channel?");
MOZ_ASSERT(aNewChannel, "Redirecting to null channel?");
nsresult rv = nsContentUtils::CheckSameOrigin(aOldChannel, aNewChannel);
if (NS_SUCCEEDED(rv)) {
@ -6299,7 +6297,7 @@ SameOriginCheckerImpl::GetInterface(const nsIID& aIID, void** aResult)
nsresult
nsContentUtils::GetASCIIOrigin(nsIPrincipal* aPrincipal, nsACString& aOrigin)
{
NS_PRECONDITION(aPrincipal, "missing principal");
MOZ_ASSERT(aPrincipal, "missing principal");
aOrigin.Truncate();
@ -6320,7 +6318,7 @@ nsContentUtils::GetASCIIOrigin(nsIPrincipal* aPrincipal, nsACString& aOrigin)
nsresult
nsContentUtils::GetASCIIOrigin(nsIURI* aURI, nsACString& aOrigin)
{
NS_PRECONDITION(aURI, "missing uri");
MOZ_ASSERT(aURI, "missing uri");
// For Blob URI we have to return the origin of page using its principal.
nsCOMPtr<nsIURIWithPrincipal> uriWithPrincipal = do_QueryInterface(aURI);
@ -6374,7 +6372,7 @@ nsContentUtils::GetASCIIOrigin(nsIURI* aURI, nsACString& aOrigin)
nsresult
nsContentUtils::GetUTFOrigin(nsIPrincipal* aPrincipal, nsAString& aOrigin)
{
NS_PRECONDITION(aPrincipal, "missing principal");
MOZ_ASSERT(aPrincipal, "missing principal");
aOrigin.Truncate();
@ -6395,7 +6393,7 @@ nsContentUtils::GetUTFOrigin(nsIPrincipal* aPrincipal, nsAString& aOrigin)
nsresult
nsContentUtils::GetUTFOrigin(nsIURI* aURI, nsAString& aOrigin)
{
NS_PRECONDITION(aURI, "missing uri");
MOZ_ASSERT(aURI, "missing uri");
bool isBlobURL = false;
nsresult rv = aURI->SchemeIs(BLOBURI_SCHEME, &isBlobURL);

View file

@ -2191,7 +2191,7 @@ public:
static already_AddRefed<nsContentList>
GetElementsByClassName(nsINode* aRootNode, const nsAString& aClasses)
{
NS_PRECONDITION(aRootNode, "Must have root node");
MOZ_ASSERT(aRootNode, "Must have root node");
return GetFuncStringContentList<nsCacheableFuncStringHTMLCollection>(aRootNode,
MatchClassNames,

View file

@ -505,8 +505,8 @@ struct PositionComparator
bool
nsIdentifierMapEntry::AddIdElement(Element* aElement)
{
NS_PRECONDITION(aElement, "Must have element");
NS_PRECONDITION(!mIdContentList.Contains(nullptr),
MOZ_ASSERT(aElement, "Must have element");
MOZ_ASSERT(!mIdContentList.Contains(nullptr),
"Why is null in our list?");
#ifdef DEBUG
@ -549,7 +549,7 @@ nsIdentifierMapEntry::AddIdElement(Element* aElement)
void
nsIdentifierMapEntry::RemoveIdElement(Element* aElement)
{
NS_PRECONDITION(aElement, "Missing element");
MOZ_ASSERT(aElement, "Missing element");
// This should only be called while the document is in an update.
// Assertions near the call to this method guarantee this.
@ -820,8 +820,8 @@ nsExternalResourceMap::RequestResource(nsIURI* aURI,
// If we ever start allowing non-same-origin loads here, we might need to do
// something interesting with aRequestingPrincipal even for the hashtable
// gets.
NS_PRECONDITION(aURI, "Must have a URI");
NS_PRECONDITION(aRequestingNode, "Must have a node");
MOZ_ASSERT(aURI, "Must have a URI");
MOZ_ASSERT(aRequestingNode, "Must have a node");
*aPendingLoad = nullptr;
if (mHaveShutDown) {
return nullptr;
@ -958,9 +958,9 @@ nsExternalResourceMap::AddExternalResource(nsIURI* aURI,
nsILoadGroup* aLoadGroup,
nsIDocument* aDisplayDocument)
{
NS_PRECONDITION(aURI, "Unexpected call");
NS_PRECONDITION((aViewer && aLoadGroup) || (!aViewer && !aLoadGroup),
"Must have both or neither");
MOZ_ASSERT(aURI, "Unexpected call");
MOZ_ASSERT((aViewer && aLoadGroup) || (!aViewer && !aLoadGroup),
"Must have both or neither");
RefPtr<PendingLoad> load;
mPendingLoads.Remove(aURI, getter_AddRefs(load));
@ -1050,7 +1050,7 @@ nsExternalResourceMap::PendingLoad::SetupViewer(nsIRequest* aRequest,
nsIContentViewer** aViewer,
nsILoadGroup** aLoadGroup)
{
NS_PRECONDITION(!mTargetListener, "Unexpected call to OnStartRequest");
MOZ_ASSERT(!mTargetListener, "Unexpected call to OnStartRequest");
*aViewer = nullptr;
*aLoadGroup = nullptr;
@ -1161,8 +1161,8 @@ nsresult
nsExternalResourceMap::PendingLoad::StartLoad(nsIURI* aURI,
nsINode* aRequestingNode)
{
NS_PRECONDITION(aURI, "Must have a URI");
NS_PRECONDITION(aRequestingNode, "Must have a node");
MOZ_ASSERT(aURI, "Must have a URI");
MOZ_ASSERT(aRequestingNode, "Must have a node");
nsCOMPtr<nsILoadGroup> loadGroup =
aRequestingNode->OwnerDoc()->GetDocumentLoadGroup();
@ -1754,7 +1754,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDocument)
NS_IMETHODIMP_(MozExternalRefCountType)
nsDocument::Release()
{
NS_PRECONDITION(0 != mRefCnt, "dup release");
MOZ_ASSERT(0 != mRefCnt, "dup release");
NS_ASSERT_OWNINGTHREAD(nsDocument);
nsISupports* base = NS_CYCLE_COLLECTION_CLASSNAME(nsDocument)::Upcast(this);
bool shouldDelete = false;
@ -2229,7 +2229,7 @@ nsIDocument::ResetToURI(nsIURI* aURI,
nsILoadGroup* aLoadGroup,
nsIPrincipal* aPrincipal)
{
NS_PRECONDITION(aURI, "Null URI passed to ResetToURI");
MOZ_ASSERT(aURI, "Null URI passed to ResetToURI");
MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug,
("DOCUMENT %p ResetToURI %s", this, aURI->GetSpecOrDefault().get()));
@ -2532,9 +2532,9 @@ AppendSheetsToStyleSet(ServoStyleSet* aStyleSet,
void
nsIDocument::FillStyleSet(ServoStyleSet* aStyleSet)
{
NS_PRECONDITION(aStyleSet, "Must have a style set");
NS_PRECONDITION(aStyleSet->SheetCount(SheetType::Doc) == 0,
"Style set already has document sheets?");
MOZ_ASSERT(aStyleSet, "Must have a style set");
MOZ_ASSERT(aStyleSet->SheetCount(SheetType::Doc) == 0,
"Style set already has document sheets?");
MOZ_ASSERT(!mStyleSetFilled);
@ -4381,7 +4381,7 @@ nsIDocument::RemoveStyleSheetFromStyleSets(StyleSheet* aSheet)
void
nsIDocument::RemoveStyleSheet(StyleSheet* aSheet)
{
NS_PRECONDITION(aSheet, "null arg");
MOZ_ASSERT(aSheet, "null arg");
RefPtr<StyleSheet> sheet = aSheet; // hold ref so it won't die too soon
if (!mStyleSheets.RemoveElement(aSheet)) {
@ -4407,8 +4407,8 @@ nsIDocument::UpdateStyleSheets(nsTArray<RefPtr<StyleSheet>>& aOldSheets,
BeginUpdate(UPDATE_STYLE);
// XXX Need to set the sheet on the ownernode, if any
NS_PRECONDITION(aOldSheets.Length() == aNewSheets.Length(),
"The lists must be the same length!");
MOZ_ASSERT(aOldSheets.Length() == aNewSheets.Length(),
"The lists must be the same length!");
int32_t count = aOldSheets.Length();
RefPtr<StyleSheet> oldSheet;
@ -4459,7 +4459,7 @@ nsIDocument::InsertStyleSheetAt(StyleSheet* aSheet, size_t aIndex)
void
nsIDocument::SetStyleSheetApplicableState(StyleSheet* aSheet, bool aApplicable)
{
NS_PRECONDITION(aSheet, "null arg");
MOZ_ASSERT(aSheet, "null arg");
// If we're actually in the document style sheet list
if (mStyleSheets.IndexOf(aSheet) != mStyleSheets.NoIndex) {
@ -4543,7 +4543,7 @@ nsresult
nsIDocument::LoadAdditionalStyleSheet(additionalSheetType aType,
nsIURI* aSheetURI)
{
NS_PRECONDITION(aSheetURI, "null arg");
MOZ_ASSERT(aSheetURI, "null arg");
// Checking if we have loaded this one already.
if (FindSheet(mAdditionalSheets[aType], aSheetURI) >= 0)
@ -5478,8 +5478,8 @@ nsIDocument::UnblockDOMContentLoaded()
void
nsIDocument::ContentStateChanged(nsIContent* aContent, EventStates aStateMask)
{
NS_PRECONDITION(!nsContentUtils::IsSafeToRunScript(),
"Someone forgot a scriptblocker");
MOZ_ASSERT(!nsContentUtils::IsSafeToRunScript(),
"Someone forgot a scriptblocker");
NS_DOCUMENT_NOTIFY_OBSERVERS(ContentStateChanged,
(this, aContent, aStateMask));
}
@ -6746,8 +6746,8 @@ nsIDocument::RequestExternalResource(nsIURI* aURI,
nsINode* aRequestingNode,
ExternalResourceLoad** aPendingLoad)
{
NS_PRECONDITION(aURI, "Must have a URI");
NS_PRECONDITION(aRequestingNode, "Must have a node");
MOZ_ASSERT(aURI, "Must have a URI");
MOZ_ASSERT(aRequestingNode, "Must have a node");
if (mDisplayDocument) {
return mDisplayDocument->RequestExternalResource(aURI,
aRequestingNode,
@ -6921,7 +6921,7 @@ bool
nsIDocument::MatchNameAttribute(Element* aElement, int32_t aNamespaceID,
nsAtom* aAtom, void* aData)
{
NS_PRECONDITION(aElement, "Must have element to work with!");
MOZ_ASSERT(aElement, "Must have element to work with!");
if (!aElement->HasName()) {
return false;
@ -8392,11 +8392,11 @@ nsIDocument::PostUnblockOnloadEvent()
void
nsIDocument::DoUnblockOnload()
{
NS_PRECONDITION(!mDisplayDocument,
MOZ_ASSERT(!mDisplayDocument,
"Shouldn't get here for resource document");
NS_PRECONDITION(mOnloadBlockCount != 0,
"Shouldn't have a count of zero here, since we stabilized in "
"PostUnblockOnloadEvent");
MOZ_ASSERT(mOnloadBlockCount != 0,
"Shouldn't have a count of zero here, since we stabilized in "
"PostUnblockOnloadEvent");
--mOnloadBlockCount;

View file

@ -99,7 +99,7 @@ protected:
bool IsVisibleNode(nsINode* aNode)
{
NS_PRECONDITION(aNode, "");
MOZ_ASSERT(aNode, "null node");
if (mFlags & SkipInvisibleContent) {
// Treat the visibility of the ShadowRoot as if it were
@ -1754,7 +1754,7 @@ nsHTMLCopyEncoder::GetChildAt(nsINode *aParent, int32_t aOffset)
return resultNode;
nsCOMPtr<nsIContent> content = do_QueryInterface(aParent);
NS_PRECONDITION(content, "null content in nsHTMLCopyEncoder::GetChildAt");
MOZ_ASSERT(content, "null content in nsHTMLCopyEncoder::GetChildAt");
resultNode = content->GetChildAt_Deprecated(aOffset);

View file

@ -1563,8 +1563,8 @@ nsFocusManager::IsWindowVisible(nsPIDOMWindowOuter* aWindow)
bool
nsFocusManager::IsNonFocusableRoot(nsIContent* aContent)
{
NS_PRECONDITION(aContent, "aContent must not be NULL");
NS_PRECONDITION(aContent->IsInComposedDoc(), "aContent must be in a document");
MOZ_ASSERT(aContent, "aContent must not be NULL");
MOZ_ASSERT(aContent->IsInComposedDoc(), "aContent must be in a document");
// If aContent is in designMode, the root element is not focusable.
// NOTE: in designMode, most elements are not focusable, just the document is

View file

@ -630,7 +630,7 @@ SetTreeOwnerAndChromeEventHandlerOnDocshellTree(nsIDocShellTreeItem* aItem,
nsIDocShellTreeOwner* aOwner,
EventTarget* aHandler)
{
NS_PRECONDITION(aItem, "Must have item");
MOZ_ASSERT(aItem, "Must have item");
aItem->SetTreeOwner(aOwner);
@ -662,8 +662,8 @@ nsFrameLoader::AddTreeItemToTreeOwner(nsIDocShellTreeItem* aItem,
int32_t aParentType,
nsIDocShell* aParentNode)
{
NS_PRECONDITION(aItem, "Must have docshell treeitem");
NS_PRECONDITION(mOwnerContent, "Must have owning content");
MOZ_ASSERT(aItem, "Must have docshell treeitem");
MOZ_ASSERT(mOwnerContent, "Must have owning content");
nsAutoString value;
bool isContent = mOwnerContent->AttrValueIs(

View file

@ -91,7 +91,7 @@ namespace dom {
already_AddRefed<nsIContent>
CreateGenConImageContent(nsIDocument* aDocument, imgRequestProxy* aImageRequest)
{
NS_PRECONDITION(aImageRequest, "Must have request!");
MOZ_ASSERT(aImageRequest, "Must have request!");
RefPtr<NodeInfo> nodeInfo =
aDocument->NodeInfoManager()->
GetNodeInfo(nsGkAtoms::mozgeneratedcontentimage,

View file

@ -1667,8 +1667,8 @@ nsGlobalWindowInner::SetNewDocument(nsIDocument* aDocument,
nsISupports* aState,
bool aForceReuseInnerWindow)
{
NS_PRECONDITION(mDocumentPrincipal == nullptr,
"mDocumentPrincipal prematurely set!");
MOZ_ASSERT(mDocumentPrincipal == nullptr,
"mDocumentPrincipal prematurely set!");
MOZ_ASSERT(aDocument);
if (!mOuterWindow) {
@ -4780,7 +4780,7 @@ public:
NS_IMETHOD Run() override
{
NS_PRECONDITION(NS_IsMainThread(), "Should be called on the main thread.");
MOZ_ASSERT(NS_IsMainThread(), "Should be called on the main thread.");
return mWindow->FireHashchange(mOldURL, mNewURL);
}

View file

@ -1415,7 +1415,7 @@ WindowStateHolder::WindowStateHolder(nsGlobalWindowInner* aWindow)
: mInnerWindow(aWindow),
mInnerWindowReflector(RootingCx(), aWindow->GetWrapper())
{
NS_PRECONDITION(aWindow, "null window");
MOZ_ASSERT(aWindow, "null window");
aWindow->Suspend();
@ -1640,7 +1640,7 @@ nsGlobalWindowOuter::SetNewDocument(nsIDocument* aDocument,
nsISupports* aState,
bool aForceReuseInnerWindow)
{
NS_PRECONDITION(mDocumentPrincipal == nullptr,
MOZ_ASSERT(mDocumentPrincipal == nullptr,
"mDocumentPrincipal prematurely set!");
MOZ_ASSERT(aDocument);
@ -3850,7 +3850,7 @@ nsGlobalWindowOuter::WindowExists(const nsAString& aName,
bool aForceNoOpener,
bool aLookForCallerOnJSStack)
{
NS_PRECONDITION(mDocShell, "Must have docshell");
MOZ_ASSERT(mDocShell, "Must have docshell");
if (aForceNoOpener) {
return aName.LowerCaseEqualsLiteral("_self") ||
@ -6901,10 +6901,11 @@ nsGlobalWindowOuter::OpenInternal(const nsAString& aUrl, const nsAString& aName,
if (argv)
argv->GetLength(&argc);
#endif
NS_PRECONDITION(!aExtraArgument || (!argv && argc == 0),
"Can't pass in arguments both ways");
NS_PRECONDITION(!aCalledNoScript || (!argv && argc == 0),
"Can't pass JS args when called via the noscript methods");
MOZ_ASSERT(!aExtraArgument || (!argv && argc == 0),
"Can't pass in arguments both ways");
MOZ_ASSERT(!aCalledNoScript || (!argv && argc == 0),
"Can't pass JS args when called via the noscript methods");
mozilla::Maybe<AutoUnblockScriptClosing> closeUnblocker;
@ -7731,4 +7732,3 @@ nsAutoPopupStatePusherInternal::~nsAutoPopupStatePusherInternal()
{
nsContentUtils::PopPopupControlState(mOldState);
}

View file

@ -148,8 +148,8 @@ nsImageLoadingContent::Notify(imgIRequest* aRequest,
// We should definitely have a request here
MOZ_ASSERT(aRequest, "no request?");
NS_PRECONDITION(aRequest == mCurrentRequest || aRequest == mPendingRequest,
"Unknown request");
MOZ_ASSERT(aRequest == mCurrentRequest || aRequest == mPendingRequest,
"Unknown request");
}
{
@ -342,7 +342,7 @@ nsImageLoadingContent::SetLoadingEnabled(bool aLoadingEnabled)
NS_IMETHODIMP
nsImageLoadingContent::GetImageBlockingStatus(int16_t* aStatus)
{
NS_PRECONDITION(aStatus, "Null out param");
MOZ_ASSERT(aStatus, "Null out param");
*aStatus = ImageBlockingStatus();
return NS_OK;
}
@ -719,7 +719,7 @@ NS_IMETHODIMP
nsImageLoadingContent::GetRequestType(imgIRequest* aRequest,
int32_t* aRequestType)
{
NS_PRECONDITION(aRequestType, "Null out param");
MOZ_ASSERT(aRequestType, "Null out param");
ErrorResult result;
*aRequestType = GetRequestType(aRequest, result);
@ -1239,8 +1239,8 @@ nsImageLoadingContent::StringToURI(const nsAString& aSpec,
nsIDocument* aDocument,
nsIURI** aURI)
{
NS_PRECONDITION(aDocument, "Must have a document");
NS_PRECONDITION(aURI, "Null out param");
MOZ_ASSERT(aDocument, "Must have a document");
MOZ_ASSERT(aURI, "Null out param");
// (1) Get the base URI
nsIContent* thisContent = AsContent();
@ -1748,4 +1748,4 @@ mozilla::net::ReferrerPolicy
nsImageLoadingContent::GetImageReferrerPolicy()
{
return mozilla::net::RP_Unset;
};
}

View file

@ -814,7 +814,7 @@ nsJSContext::ConvertSupportsTojsvals(nsISupports* aArgs,
nsresult
nsJSContext::AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv)
{
NS_PRECONDITION(aArg, "Empty arg");
MOZ_ASSERT(aArg, "Empty arg");
nsCOMPtr<nsISupportsPrimitive> argPrimitive(do_QueryInterface(aArg));
if (!argPrimitive)

View file

@ -152,7 +152,7 @@ void
nsMappedAttributes::SetAndSwapAttr(nsAtom* aAttrName, nsAttrValue& aValue,
bool* aValueWasSet)
{
NS_PRECONDITION(aAttrName, "null name");
MOZ_ASSERT(aAttrName, "null name");
*aValueWasSet = false;
uint32_t i;
for (i = 0; i < mAttrCount && !Attrs()[i].mName.IsSmaller(aAttrName); ++i) {
@ -178,7 +178,7 @@ nsMappedAttributes::SetAndSwapAttr(nsAtom* aAttrName, nsAttrValue& aValue,
const nsAttrValue*
nsMappedAttributes::GetAttr(nsAtom* aAttrName) const
{
NS_PRECONDITION(aAttrName, "null name");
MOZ_ASSERT(aAttrName, "null name");
for (uint32_t i = 0; i < mAttrCount; ++i) {
if (Attrs()[i].mName.Equals(aAttrName)) {

View file

@ -126,7 +126,7 @@ nsNameSpaceManager::RegisterNameSpace(already_AddRefed<nsAtom> aURI,
nsresult
nsNameSpaceManager::GetNameSpaceURI(int32_t aNameSpaceID, nsAString& aURI)
{
NS_PRECONDITION(aNameSpaceID >= 0, "Bogus namespace ID");
MOZ_ASSERT(aNameSpaceID >= 0, "Bogus namespace ID");
// We have historically treated GetNameSpaceURI calls for kNameSpaceID_None
// as erroneous.

View file

@ -107,7 +107,7 @@ NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
nsresult
nsNodeInfoManager::Init(nsIDocument *aDocument)
{
NS_PRECONDITION(!mPrincipal,
MOZ_ASSERT(!mPrincipal,
"Being inited when we already have a principal?");
mPrincipal = NullPrincipal::CreateWithoutOriginAttributes();
@ -319,7 +319,7 @@ nsNodeInfoManager::SetDocumentPrincipal(nsIPrincipal *aPrincipal)
void
nsNodeInfoManager::RemoveNodeInfo(NodeInfo *aNodeInfo)
{
NS_PRECONDITION(aNodeInfo, "Trying to remove null nodeinfo from manager!");
MOZ_ASSERT(aNodeInfo, "Trying to remove null nodeinfo from manager!");
if (aNodeInfo == mDocumentNodeInfo) {
mDocumentNodeInfo = nullptr;

View file

@ -210,8 +210,8 @@ void
nsNodeUtils::ContentInserted(nsINode* aContainer,
nsIContent* aChild)
{
NS_PRECONDITION(aContainer->IsContent() || aContainer->IsDocument(),
"container must be an nsIContent or an nsIDocument");
MOZ_ASSERT(aContainer->IsContent() || aContainer->IsDocument(),
"container must be an nsIContent or an nsIDocument");
nsIDocument* doc = aContainer->OwnerDoc();
IMPL_MUTATION_NOTIFICATION(ContentInserted, aContainer, (aChild),
IsRemoveNotification::No);
@ -222,8 +222,8 @@ nsNodeUtils::ContentRemoved(nsINode* aContainer,
nsIContent* aChild,
nsIContent* aPreviousSibling)
{
NS_PRECONDITION(aContainer->IsContent() || aContainer->IsDocument(),
"container must be an nsIContent or an nsIDocument");
MOZ_ASSERT(aContainer->IsContent() || aContainer->IsDocument(),
"container must be an nsIContent or an nsIDocument");
nsIDocument* doc = aContainer->OwnerDoc();
MOZ_ASSERT(aChild->GetParentNode() == aContainer,
"We expect the parent link to be still around at this point");
@ -383,11 +383,10 @@ nsNodeUtils::CloneAndAdopt(nsINode *aNode, bool aClone, bool aDeep,
nsCOMArray<nsINode> *aNodesWithProperties,
nsINode* aParent, ErrorResult& aError)
{
NS_PRECONDITION((!aClone && aNewNodeInfoManager) || !aReparentScope,
"If cloning or not getting a new nodeinfo we shouldn't "
"rewrap");
NS_PRECONDITION(!aParent || aNode->IsContent(),
"Can't insert document or attribute nodes into a parent");
MOZ_ASSERT((!aClone && aNewNodeInfoManager) || !aReparentScope,
"If cloning or not getting a new nodeinfo we shouldn't rewrap");
MOZ_ASSERT(!aParent || aNode->IsContent(),
"Can't insert document or attribute nodes into a parent");
// First deal with aNode and walk its attributes (and their children). Then,
// if aDeep is true, deal with aNode's children (and recurse into their
@ -713,4 +712,3 @@ nsNodeUtils::GetFirstChildOfTemplateOrNode(nsINode* aNode)
return aNode->GetFirstChild();
}

View file

@ -140,7 +140,7 @@ nsPropertyTable::GetPropertyInternal(nsPropertyOwner aObject,
bool aRemove,
nsresult* aResult)
{
NS_PRECONDITION(aPropertyName && aObject, "unexpected null param");
MOZ_ASSERT(aPropertyName && aObject, "unexpected null param");
nsresult rv = NS_PROPTABLE_PROP_NOT_THERE;
void *propValue = nullptr;
@ -172,7 +172,7 @@ nsPropertyTable::SetPropertyInternal(nsPropertyOwner aObject,
void* aPropDtorData,
bool aTransfer)
{
NS_PRECONDITION(aPropertyName && aObject, "unexpected null param");
MOZ_ASSERT(aPropertyName && aObject, "unexpected null param");
PropertyList* propertyList = GetPropertyListFor(aPropertyName);
@ -218,7 +218,7 @@ nsresult
nsPropertyTable::DeleteProperty(nsPropertyOwner aObject,
nsAtom* aPropertyName)
{
NS_PRECONDITION(aPropertyName && aObject, "unexpected null param");
MOZ_ASSERT(aPropertyName && aObject, "unexpected null param");
PropertyList* propertyList = GetPropertyListFor(aPropertyName);
if (propertyList) {

View file

@ -60,7 +60,7 @@ nsRange::GetDocGroup() const
static void InvalidateAllFrames(nsINode* aNode)
{
NS_PRECONDITION(aNode, "bad arg");
MOZ_ASSERT(aNode, "bad arg");
nsIFrame* frame = nullptr;
switch (aNode->NodeType()) {
@ -199,7 +199,7 @@ struct IsItemInRangeComparator
nsRange::IsNodeSelected(nsINode* aNode, uint32_t aStartOffset,
uint32_t aEndOffset)
{
NS_PRECONDITION(aNode, "bad arg");
MOZ_ASSERT(aNode, "bad arg");
nsINode* n = GetNextRangeCommonAncestor(aNode);
NS_ASSERTION(n || !aNode->IsSelectionDescendant(),
@ -461,7 +461,7 @@ static void UnmarkDescendants(nsINode* aNode)
void
nsRange::RegisterCommonAncestor(nsINode* aNode)
{
NS_PRECONDITION(aNode, "bad arg");
MOZ_ASSERT(aNode, "bad arg");
MOZ_DIAGNOSTIC_ASSERT(IsInSelection(), "registering range not in selection");
@ -482,7 +482,7 @@ nsRange::RegisterCommonAncestor(nsINode* aNode)
void
nsRange::UnregisterCommonAncestor(nsINode* aNode, bool aIsUnlinking)
{
NS_PRECONDITION(aNode, "bad arg");
MOZ_ASSERT(aNode, "bad arg");
NS_ASSERTION(aNode->IsCommonAncestorForRangeInSelection(), "wrong node");
MOZ_DIAGNOSTIC_ASSERT(aNode == mRegisteredCommonAncestor, "wrong node");
LinkedList<nsRange>* ranges = aNode->GetExistingCommonAncestorRanges();
@ -964,29 +964,32 @@ nsRange::DoSetRange(const RawRangeBoundary& aStart,
const RawRangeBoundary& aEnd,
nsINode* aRoot, bool aNotInsertedYet)
{
NS_PRECONDITION((aStart.IsSet() && aEnd.IsSet() && aRoot) ||
(!aStart.IsSet() && !aEnd.IsSet() && !aRoot),
"Set all or none");
NS_PRECONDITION(!aRoot || aNotInsertedYet ||
(nsContentUtils::ContentIsDescendantOf(aStart.Container(), aRoot) &&
nsContentUtils::ContentIsDescendantOf(aEnd.Container(), aRoot) &&
aRoot == IsValidBoundary(aStart.Container()) &&
aRoot == IsValidBoundary(aEnd.Container())),
"Wrong root");
NS_PRECONDITION(!aRoot ||
(aStart.Container()->IsContent() &&
aEnd.Container()->IsContent() &&
aRoot ==
static_cast<nsIContent*>(aStart.Container())->GetBindingParent() &&
aRoot ==
static_cast<nsIContent*>(aEnd.Container())->GetBindingParent()) ||
(!aRoot->GetParentNode() &&
(aRoot->IsDocument() ||
aRoot->IsAttr() ||
aRoot->IsDocumentFragment() ||
/*For backward compatibility*/
aRoot->IsContent())),
"Bad root");
MOZ_ASSERT((aStart.IsSet() && aEnd.IsSet() && aRoot) ||
(!aStart.IsSet() && !aEnd.IsSet() && !aRoot),
"Set all or none");
MOZ_ASSERT(!aRoot || aNotInsertedYet ||
(nsContentUtils::ContentIsDescendantOf(aStart.Container(), aRoot) &&
nsContentUtils::ContentIsDescendantOf(aEnd.Container(), aRoot) &&
aRoot == IsValidBoundary(aStart.Container()) &&
aRoot == IsValidBoundary(aEnd.Container())),
"Wrong root");
MOZ_ASSERT(!aRoot ||
(aStart.Container()->IsContent() &&
aEnd.Container()->IsContent() &&
aRoot ==
static_cast<nsIContent*>(aStart.Container())->GetBindingParent() &&
aRoot ==
static_cast<nsIContent*>(aEnd.Container())->GetBindingParent()) ||
(!aRoot->GetParentNode() &&
(aRoot->IsDocument() ||
aRoot->IsAttr() ||
aRoot->IsDocumentFragment() ||
/*For backward compatibility*/
aRoot->IsContent())),
"Bad root");
if (mRoot != aRoot) {
if (mRoot) {
mRoot->RemoveMutationObserver(this);

View file

@ -289,7 +289,7 @@ nsSyncLoader::AsyncOnChannelRedirect(nsIChannel *aOldChannel,
uint32_t aFlags,
nsIAsyncVerifyRedirectCallback *callback)
{
NS_PRECONDITION(aNewChannel, "Redirecting to null channel?");
MOZ_ASSERT(aNewChannel, "Redirecting to null channel?");
mChannel = aNewChannel;

View file

@ -215,9 +215,9 @@ NS_NewAttributeContent(nsNodeInfoManager *aNodeInfoManager,
int32_t aNameSpaceID, nsAtom* aAttrName,
nsIContent** aResult)
{
NS_PRECONDITION(aNodeInfoManager, "Missing nodeInfoManager");
NS_PRECONDITION(aAttrName, "Must have an attr name");
NS_PRECONDITION(aNameSpaceID != kNameSpaceID_Unknown, "Must know namespace");
MOZ_ASSERT(aNodeInfoManager, "Missing nodeInfoManager");
MOZ_ASSERT(aAttrName, "Must have an attr name");
MOZ_ASSERT(aNameSpaceID != kNameSpaceID_Unknown, "Must know namespace");
*aResult = nullptr;
@ -239,8 +239,8 @@ nsAttributeTextNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers)
{
NS_PRECONDITION(aParent && aParent->GetParent(),
"This node can't be a child of the document or of the document root");
MOZ_ASSERT(aParent && aParent->GetParent(),
"This node can't be a child of the document or of the document root");
nsresult rv = nsTextNode::BindToTree(aDocument, aParent,
aBindingParent, aCompileEventHandlers);
@ -305,4 +305,3 @@ nsAttributeTextNode::UpdateText(bool aNotify)
SetText(attrValue, aNotify);
}
}

View file

@ -1357,7 +1357,7 @@ nsTreeSanitizer::Sanitize(DocumentFragment* aFragment)
// If you want to relax these preconditions, be sure to check the code in
// here that notifies / does not notify or that fires mutation events if
// in tree.
NS_PRECONDITION(!aFragment->IsInUncomposedDoc(), "The fragment is in doc?");
MOZ_ASSERT(!aFragment->IsInUncomposedDoc(), "The fragment is in doc?");
mFullDocument = false;
SanitizeChildren(aFragment);
@ -1370,9 +1370,9 @@ nsTreeSanitizer::Sanitize(nsIDocument* aDocument)
// here that notifies / does not notify or that fires mutation events if
// in tree.
#ifdef DEBUG
NS_PRECONDITION(!aDocument->GetContainer(), "The document is in a shell.");
MOZ_ASSERT(!aDocument->GetContainer(), "The document is in a shell.");
RefPtr<mozilla::dom::Element> root = aDocument->GetRootElement();
NS_PRECONDITION(root->IsHTMLElement(nsGkAtoms::html), "Not HTML root.");
MOZ_ASSERT(root->IsHTMLElement(nsGkAtoms::html), "Not HTML root.");
#endif
mFullDocument = true;
@ -1542,7 +1542,7 @@ nsTreeSanitizer::LogMessage(const char* aMessage, nsIDocument* aDoc,
void
nsTreeSanitizer::InitializeStatics()
{
NS_PRECONDITION(!sElementsHTML, "Initializing a second time.");
MOZ_ASSERT(!sElementsHTML, "Initializing a second time.");
sElementsHTML = new AtomsTable(ArrayLength(kElementsHTML));
for (uint32_t i = 0; kElementsHTML[i]; i++) {

View file

@ -257,7 +257,7 @@ DoDrawImageSecurityCheck(dom::HTMLCanvasElement *aCanvasElement,
if (CORSUsed)
return;
NS_PRECONDITION(aPrincipal, "Must have a principal here");
MOZ_ASSERT(aPrincipal, "Must have a principal here");
if (aCanvasElement->NodePrincipal()->Subsumes(aPrincipal)) {
// This canvas has access to that image anyway

View file

@ -197,7 +197,7 @@ nsControllerCommandTable::GetSupportedCommands(uint32_t* aCount,
nsresult
NS_NewControllerCommandTable(nsIControllerCommandTable** aResult)
{
NS_PRECONDITION(aResult != nullptr, "null ptr");
MOZ_ASSERT(aResult != nullptr, "null ptr");
if (!aResult) {
return NS_ERROR_NULL_POINTER;
}

View file

@ -503,7 +503,7 @@ nsresult
ContentEventHandler::QueryContentRect(nsIContent* aContent,
WidgetQueryContentEvent* aEvent)
{
NS_PRECONDITION(aContent, "aContent must not be null");
MOZ_ASSERT(aContent, "aContent must not be null");
nsIFrame* frame = aContent->GetPrimaryFrame();
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
@ -2699,7 +2699,7 @@ ContentEventHandler::OnQueryCharacterAtPoint(WidgetQueryContentEvent* aEvent)
// The root frame's widget might be different, e.g., the event was fired on
// a popup but the rootFrame is the document root.
if (rootWidget != aEvent->mWidget) {
NS_PRECONDITION(aEvent->mWidget, "The event must have the widget");
MOZ_ASSERT(aEvent->mWidget, "The event must have the widget");
nsView* view = nsView::GetViewFor(aEvent->mWidget);
NS_ENSURE_TRUE(view, NS_ERROR_FAILURE);
rootFrame = view->GetFrame();

View file

@ -303,7 +303,7 @@ EventListenerService::AddSystemEventListener(EventTarget *aTarget,
bool aUseCapture,
JSContext* aCx)
{
NS_PRECONDITION(aTarget, "Missing target");
MOZ_ASSERT(aTarget, "Missing target");
NS_ENSURE_TRUE(aTarget, NS_ERROR_UNEXPECTED);
@ -329,7 +329,7 @@ EventListenerService::RemoveSystemEventListener(EventTarget *aTarget,
bool aUseCapture,
JSContext* aCx)
{
NS_PRECONDITION(aTarget, "Missing target");
MOZ_ASSERT(aTarget, "Missing target");
NS_ENSURE_TRUE(aTarget, NS_ERROR_UNEXPECTED);

View file

@ -5272,11 +5272,11 @@ EventStateManager::SetContentState(nsIContent* aContent, EventStates aState)
{
// We manage 4 states here: ACTIVE, HOVER, DRAGOVER, URLTARGET
// The input must be exactly one of them.
NS_PRECONDITION(aState == NS_EVENT_STATE_ACTIVE ||
aState == NS_EVENT_STATE_HOVER ||
aState == NS_EVENT_STATE_DRAGOVER ||
aState == NS_EVENT_STATE_URLTARGET,
"Unexpected state");
MOZ_ASSERT(aState == NS_EVENT_STATE_ACTIVE ||
aState == NS_EVENT_STATE_HOVER ||
aState == NS_EVENT_STATE_DRAGOVER ||
aState == NS_EVENT_STATE_URLTARGET,
"Unexpected state");
nsCOMPtr<nsIContent> notifyContent1;
nsCOMPtr<nsIContent> notifyContent2;
@ -5514,7 +5514,7 @@ EventStateManager::EnsureDocument(nsPresContext* aPresContext)
void
EventStateManager::FlushPendingEvents(nsPresContext* aPresContext)
{
NS_PRECONDITION(nullptr != aPresContext, "nullptr ptr");
MOZ_ASSERT(nullptr != aPresContext, "nullptr ptr");
nsIPresShell *shell = aPresContext->GetPresShell();
if (shell) {
shell->FlushPendingNotifications(FlushType::InterruptibleLayout);

View file

@ -310,7 +310,7 @@ WheelTransaction::Shutdown()
/* static */ void
WheelTransaction::OnFailToScrollTarget()
{
NS_PRECONDITION(sTargetFrame, "We don't have mouse scrolling transaction");
MOZ_ASSERT(sTargetFrame, "We don't have mouse scrolling transaction");
if (Prefs::sTestMouseScroll) {
// This event is used for automated tests, see bug 442774.

View file

@ -1762,9 +1762,9 @@ HTMLFormElement::GetActionURL(nsIURI** aActionURL,
NS_IMETHODIMP_(nsIFormControl*)
HTMLFormElement::GetDefaultSubmitElement() const
{
NS_PRECONDITION(mDefaultSubmitElement == mFirstSubmitInElements ||
mDefaultSubmitElement == mFirstSubmitNotInElements,
"What happened here?");
MOZ_ASSERT(mDefaultSubmitElement == mFirstSubmitInElements ||
mDefaultSubmitElement == mFirstSubmitNotInElements,
"What happened here?");
return mDefaultSubmitElement;
}
@ -1772,7 +1772,7 @@ HTMLFormElement::GetDefaultSubmitElement() const
bool
HTMLFormElement::IsDefaultSubmitElement(const nsIFormControl* aControl) const
{
NS_PRECONDITION(aControl, "Unexpected call");
MOZ_ASSERT(aControl, "Unexpected call");
if (aControl == mDefaultSubmitElement) {
// Yes, it is
@ -1821,7 +1821,7 @@ HTMLFormElement::ImplicitSubmissionIsDisabled() const
bool
HTMLFormElement::IsLastActiveElement(const nsIFormControl* aControl) const
{
NS_PRECONDITION(aControl, "Unexpected call");
MOZ_ASSERT(aControl, "Unexpected call");
for (auto* element : Reversed(mControls->mElements)) {
if (element->IsSingleLineTextOrNumberControl(false) &&

View file

@ -74,8 +74,8 @@ nsresult
HTMLFrameSetElement::GetRowSpec(int32_t *aNumValues,
const nsFramesetSpec** aSpecs)
{
NS_PRECONDITION(aNumValues, "Must have a pointer to an integer here!");
NS_PRECONDITION(aSpecs, "Must have a pointer to an array of nsFramesetSpecs");
MOZ_ASSERT(aNumValues, "Must have a pointer to an integer here!");
MOZ_ASSERT(aSpecs, "Must have a pointer to an array of nsFramesetSpecs");
*aNumValues = 0;
*aSpecs = nullptr;
@ -104,8 +104,8 @@ nsresult
HTMLFrameSetElement::GetColSpec(int32_t *aNumValues,
const nsFramesetSpec** aSpecs)
{
NS_PRECONDITION(aNumValues, "Must have a pointer to an integer here!");
NS_PRECONDITION(aSpecs, "Must have a pointer to an array of nsFramesetSpecs");
MOZ_ASSERT(aNumValues, "Must have a pointer to an integer here!");
MOZ_ASSERT(aSpecs, "Must have a pointer to an array of nsFramesetSpecs");
*aNumValues = 0;
*aSpecs = nullptr;

View file

@ -865,7 +865,7 @@ HTMLImageElement::GetForm() const
void
HTMLImageElement::SetForm(HTMLFormElement* aForm)
{
NS_PRECONDITION(aForm, "Don't pass null here");
MOZ_ASSERT(aForm, "Don't pass null here");
NS_ASSERTION(!mForm,
"We don't support switching from one non-null form to another.");

View file

@ -876,12 +876,12 @@ UploadLastDir::FetchDirectoryAndDisplayPicker(nsIDocument* aDoc,
nsIFilePicker* aFilePicker,
nsIFilePickerShownCallback* aFpCallback)
{
NS_PRECONDITION(aDoc, "aDoc is null");
NS_PRECONDITION(aFilePicker, "aFilePicker is null");
NS_PRECONDITION(aFpCallback, "aFpCallback is null");
MOZ_ASSERT(aDoc, "aDoc is null");
MOZ_ASSERT(aFilePicker, "aFilePicker is null");
MOZ_ASSERT(aFpCallback, "aFpCallback is null");
nsIURI* docURI = aDoc->GetDocumentURI();
NS_PRECONDITION(docURI, "docURI is null");
MOZ_ASSERT(docURI, "docURI is null");
nsCOMPtr<nsILoadContext> loadContext = aDoc->GetLoadContext();
nsCOMPtr<nsIContentPrefCallback2> prefCallback =
@ -906,13 +906,13 @@ UploadLastDir::FetchDirectoryAndDisplayPicker(nsIDocument* aDoc,
nsresult
UploadLastDir::StoreLastUsedDirectory(nsIDocument* aDoc, nsIFile* aDir)
{
NS_PRECONDITION(aDoc, "aDoc is null");
MOZ_ASSERT(aDoc, "aDoc is null");
if (!aDir) {
return NS_OK;
}
nsCOMPtr<nsIURI> docURI = aDoc->GetDocumentURI();
NS_PRECONDITION(docURI, "docURI is null");
MOZ_ASSERT(docURI, "docURI is null");
// Attempt to get the CPS, if it's not present we'll just return
nsCOMPtr<nsIContentPrefService2> contentPrefService =
@ -2794,8 +2794,8 @@ HTMLInputElement::SetValueInternal(const nsAString& aValue,
const nsAString* aOldValue,
uint32_t aFlags)
{
NS_PRECONDITION(GetValueMode() != VALUE_MODE_FILENAME,
"Don't call SetValueInternal for file inputs");
MOZ_ASSERT(GetValueMode() != VALUE_MODE_FILENAME,
"Don't call SetValueInternal for file inputs");
// We want to remember if the SetValueInternal() call is being made for a XUL
// element. We do that by looking at the parent node here, and if that node

View file

@ -120,7 +120,7 @@ HTMLSharedElement::IsAttributeMapped(const nsAtom* aAttribute) const
static void
SetBaseURIUsingFirstBaseWithHref(nsIDocument* aDocument, nsIContent* aMustMatch)
{
NS_PRECONDITION(aDocument, "Need a document!");
MOZ_ASSERT(aDocument, "Need a document!");
for (nsIContent* child = aDocument->GetFirstChild(); child;
child = child->GetNextNode()) {
@ -173,7 +173,7 @@ static void
SetBaseTargetUsingFirstBaseWithTarget(nsIDocument* aDocument,
nsIContent* aMustMatch)
{
NS_PRECONDITION(aDocument, "Need a document!");
MOZ_ASSERT(aDocument, "Need a document!");
for (nsIContent* child = aDocument->GetFirstChild(); child;
child = child->GetNextNode()) {

View file

@ -544,8 +544,8 @@ bool
nsGenericHTMLElement::CheckHandleEventForAnchorsPreconditions(
EventChainVisitor& aVisitor)
{
NS_PRECONDITION(nsCOMPtr<Link>(do_QueryObject(this)),
"should be called only when |this| implements |Link|");
MOZ_ASSERT(nsCOMPtr<Link>(do_QueryObject(this)),
"should be called only when |this| implements |Link|");
if (!aVisitor.mPresContext) {
// We need a pres context to do link stuff. Some events (e.g. mutation
@ -589,7 +589,7 @@ nsGenericHTMLElement::PostHandleEventForAnchors(EventChainPostVisitor& aVisitor)
bool
nsGenericHTMLElement::IsHTMLLink(nsIURI** aURI) const
{
NS_PRECONDITION(aURI, "Must provide aURI out param");
MOZ_ASSERT(aURI, "Must provide aURI out param");
*aURI = GetHrefURIForAnchors().take();
// We promise out param is non-null if we return true, so base rv on it
@ -1683,7 +1683,7 @@ nsGenericHTMLFormElement::SaveSubtreeState()
void
nsGenericHTMLFormElement::SetForm(HTMLFormElement* aForm)
{
NS_PRECONDITION(aForm, "Don't pass null here");
MOZ_ASSERT(aForm, "Don't pass null here");
NS_ASSERTION(!mForm,
"We don't support switching from one non-null form to another.");
@ -2223,8 +2223,8 @@ void
nsGenericHTMLFormElement::UpdateFormOwner(bool aBindToTree,
Element* aFormIdElement)
{
NS_PRECONDITION(!aBindToTree || !aFormIdElement,
"aFormIdElement shouldn't be set if aBindToTree is true!");
MOZ_ASSERT(!aBindToTree || !aFormIdElement,
"aFormIdElement shouldn't be set if aBindToTree is true!");
bool needStateUpdate = false;
if (!aBindToTree) {

View file

@ -84,7 +84,7 @@ nsGenericHTMLFrameElement::~nsGenericHTMLFrameElement()
nsresult
nsGenericHTMLFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
{
NS_PRECONDITION(aContentDocument, "Null out param");
MOZ_ASSERT(aContentDocument, "Null out param");
nsCOMPtr<nsIDOMDocument> document =
do_QueryInterface(GetContentDocument(*nsContentUtils::SubjectPrincipal()));
document.forget(aContentDocument);

View file

@ -785,7 +785,7 @@ HTMLContentSink::DidBuildModel(bool aTerminated)
NS_IMETHODIMP
HTMLContentSink::SetParser(nsParserBase* aParser)
{
NS_PRECONDITION(aParser, "Should have a parser here!");
MOZ_ASSERT(aParser, "Should have a parser here!");
mParser = aParser;
return NS_OK;
}
@ -968,7 +968,7 @@ HTMLContentSink::NotifyInsert(nsIContent* aContent,
void
HTMLContentSink::NotifyRootInsertion()
{
NS_PRECONDITION(!mNotifiedRootInsertion, "Double-notifying on root?");
MOZ_ASSERT(!mNotifiedRootInsertion, "Double-notifying on root?");
NS_ASSERTION(!mLayoutStarted,
"How did we start layout without notifying on root?");
// Now make sure to notify that we have now inserted our root. If

View file

@ -1415,7 +1415,7 @@ nsJSURI::EqualsInternal(nsIURI* aOther,
bool* aResult)
{
NS_ENSURE_ARG_POINTER(aOther);
NS_PRECONDITION(aResult, "null pointer for outparam");
MOZ_ASSERT(aResult, "null pointer for outparam");
RefPtr<nsJSURI> otherJSURI;
nsresult rv = aOther->QueryInterface(kJSURICID,

View file

@ -64,13 +64,13 @@ public:
*/
nsIURI* GetScriptURI()
{
NS_PRECONDITION(mFrozen, "Not ready for this call yet!");
MOZ_ASSERT(mFrozen, "Not ready for this call yet!");
return mUri;
}
nsIPrincipal* GetScriptURITriggeringPrincipal()
{
NS_PRECONDITION(mFrozen, "Not ready for this call yet!");
MOZ_ASSERT(mFrozen, "Not ready for this call yet!");
return mSrcTriggeringPrincipal;
}
@ -97,7 +97,7 @@ public:
*/
bool GetScriptIsModule()
{
NS_PRECONDITION(mFrozen, "Not ready for this call yet!");
MOZ_ASSERT(mFrozen, "Not ready for this call yet!");
return mIsModule;
}
@ -106,7 +106,7 @@ public:
*/
bool GetScriptDeferred()
{
NS_PRECONDITION(mFrozen, "Not ready for this call yet!");
MOZ_ASSERT(mFrozen, "Not ready for this call yet!");
return mDefer;
}
@ -115,7 +115,7 @@ public:
*/
bool GetScriptAsync()
{
NS_PRECONDITION(mFrozen, "Not ready for this call yet!");
MOZ_ASSERT(mFrozen, "Not ready for this call yet!");
return mAsync;
}
@ -124,7 +124,7 @@ public:
*/
bool GetScriptExternal()
{
NS_PRECONDITION(mFrozen, "Not ready for this call yet!");
MOZ_ASSERT(mFrozen, "Not ready for this call yet!");
return mExternal;
}

View file

@ -734,8 +734,8 @@ NS_IMETHODIMP
nsCSPContext::SetRequestContext(nsIDOMDocument* aDOMDocument,
nsIPrincipal* aPrincipal)
{
NS_PRECONDITION(aDOMDocument || aPrincipal,
"Can't set context without doc or principal");
MOZ_ASSERT(aDOMDocument || aPrincipal,
"Can't set context without doc or principal");
NS_ENSURE_ARG(aDOMDocument || aPrincipal);
if (aDOMDocument) {

View file

@ -14,7 +14,7 @@ namespace mozilla {
void
SMILBoolType::Init(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.IsNull(), "Unexpected value type");
MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
aValue.mU.mBool = false;
aValue.mType = this;
}
@ -22,7 +22,7 @@ SMILBoolType::Init(nsSMILValue& aValue) const
void
SMILBoolType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
aValue.mU.mBool = false;
aValue.mType = nsSMILNullType::Singleton();
}
@ -30,8 +30,8 @@ SMILBoolType::Destroy(nsSMILValue& aValue) const
nsresult
SMILBoolType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
aDest.mU.mBool = aSrc.mU.mBool;
return NS_OK;
}
@ -40,8 +40,8 @@ bool
SMILBoolType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return aLeft.mU.mBool == aRight.mU.mBool;
}
@ -50,9 +50,8 @@ nsresult
SMILBoolType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == aDest.mType, "Trying to add invalid types");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
return NS_ERROR_FAILURE; // bool values can't be added to each other
}
@ -61,8 +60,8 @@ SMILBoolType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType, "Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
return NS_ERROR_FAILURE; // there is no concept of distance between bool values
}
@ -72,11 +71,11 @@ SMILBoolType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
return NS_ERROR_FAILURE; // bool values do not interpolate
}

View file

@ -14,7 +14,7 @@ namespace mozilla {
void
SMILEnumType::Init(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.IsNull(), "Unexpected value type");
MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
aValue.mU.mUint = 0;
aValue.mType = this;
}
@ -22,7 +22,7 @@ SMILEnumType::Init(nsSMILValue& aValue) const
void
SMILEnumType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
aValue.mU.mUint = 0;
aValue.mType = nsSMILNullType::Singleton();
}
@ -30,8 +30,8 @@ SMILEnumType::Destroy(nsSMILValue& aValue) const
nsresult
SMILEnumType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
aDest.mU.mUint = aSrc.mU.mUint;
return NS_OK;
}
@ -40,8 +40,8 @@ bool
SMILEnumType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return aLeft.mU.mUint == aRight.mU.mUint;
}
@ -50,9 +50,9 @@ nsresult
SMILEnumType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
return NS_ERROR_FAILURE; // enum values can't be added to each other
}
@ -61,8 +61,8 @@ SMILEnumType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType,"Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
return NS_ERROR_FAILURE; // there is no concept of distance between enum values
}
@ -72,11 +72,11 @@ SMILEnumType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
MOZ_ASSERT(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
return NS_ERROR_FAILURE; // enum values do not interpolate
}

View file

@ -22,7 +22,7 @@ SMILIntegerType::Init(nsSMILValue& aValue) const
void
SMILIntegerType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
aValue.mU.mInt = 0;
aValue.mType = nsSMILNullType::Singleton();
}
@ -30,8 +30,8 @@ SMILIntegerType::Destroy(nsSMILValue& aValue) const
nsresult
SMILIntegerType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
aDest.mU.mInt = aSrc.mU.mInt;
return NS_OK;
}
@ -40,8 +40,8 @@ bool
SMILIntegerType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return aLeft.mU.mInt == aRight.mU.mInt;
}
@ -50,9 +50,9 @@ nsresult
SMILIntegerType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
aDest.mU.mInt += aValueToAdd.mU.mInt * aCount;
return NS_OK;
}
@ -62,8 +62,8 @@ SMILIntegerType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType, "Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
aDistance = fabs(double(aTo.mU.mInt - aFrom.mU.mInt));
return NS_OK;
}
@ -74,11 +74,10 @@ SMILIntegerType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const double startVal = double(aStartVal.mU.mInt);
const double endVal = double(aEndVal.mU.mInt);

View file

@ -14,7 +14,7 @@ namespace mozilla {
void
SMILStringType::Init(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.IsNull(), "Unexpected value type");
MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
aValue.mU.mPtr = new nsString();
aValue.mType = this;
}
@ -22,7 +22,7 @@ SMILStringType::Init(nsSMILValue& aValue) const
void
SMILStringType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
delete static_cast<nsAString*>(aValue.mU.mPtr);
aValue.mU.mPtr = nullptr;
aValue.mType = nsSMILNullType::Singleton();
@ -31,8 +31,8 @@ SMILStringType::Destroy(nsSMILValue& aValue) const
nsresult
SMILStringType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
const nsAString* src = static_cast<const nsAString*>(aSrc.mU.mPtr);
nsAString* dst = static_cast<nsAString*>(aDest.mU.mPtr);
@ -44,8 +44,8 @@ bool
SMILStringType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
const nsAString* leftString =
static_cast<const nsAString*>(aLeft.mU.mPtr);
@ -58,9 +58,9 @@ nsresult
SMILStringType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
return NS_ERROR_FAILURE; // string values can't be added to each other
}
@ -69,8 +69,8 @@ SMILStringType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType, "Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
return NS_ERROR_FAILURE; // there is no concept of distance between string values
}
@ -80,11 +80,10 @@ SMILStringType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
return NS_ERROR_FAILURE; // string values do not interpolate
}

View file

@ -12,7 +12,7 @@
void
nsSMILFloatType::Init(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.IsNull(), "Unexpected value type");
MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
aValue.mU.mDouble = 0.0;
aValue.mType = this;
}
@ -20,7 +20,7 @@ nsSMILFloatType::Init(nsSMILValue& aValue) const
void
nsSMILFloatType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
aValue.mU.mDouble = 0.0;
aValue.mType = nsSMILNullType::Singleton();
}
@ -28,8 +28,8 @@ nsSMILFloatType::Destroy(nsSMILValue& aValue) const
nsresult
nsSMILFloatType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
aDest.mU.mDouble = aSrc.mU.mDouble;
return NS_OK;
}
@ -38,8 +38,8 @@ bool
nsSMILFloatType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return aLeft.mU.mDouble == aRight.mU.mDouble;
}
@ -48,9 +48,9 @@ nsresult
nsSMILFloatType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
aDest.mU.mDouble += aValueToAdd.mU.mDouble * aCount;
return NS_OK;
}
@ -60,8 +60,8 @@ nsSMILFloatType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType, "Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
const double &from = aFrom.mU.mDouble;
const double &to = aTo.mU.mDouble;
@ -77,11 +77,11 @@ nsSMILFloatType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const double &startVal = aStartVal.mU.mDouble;
const double &endVal = aEndVal.mU.mDouble;

View file

@ -18,8 +18,8 @@ nsSMILNullType::Singleton()
nsresult
nsSMILNullType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aSrc.mType == this, "Unexpected source type");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aSrc.mType == this, "Unexpected source type");
aDest.mU = aSrc.mU;
aDest.mType = Singleton();
return NS_OK;
@ -29,8 +29,8 @@ bool
nsSMILNullType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return true; // All null-typed values are equivalent.
}

View file

@ -24,7 +24,7 @@ SVGIntegerPairSMILType::Init(nsSMILValue& aValue) const
void
SVGIntegerPairSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
aValue.mU.mIntPair[0] = 0;
aValue.mU.mIntPair[1] = 0;
aValue.mType = nsSMILNullType::Singleton();
@ -33,8 +33,8 @@ SVGIntegerPairSMILType::Destroy(nsSMILValue& aValue) const
nsresult
SVGIntegerPairSMILType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
aDest.mU.mIntPair[0] = aSrc.mU.mIntPair[0];
aDest.mU.mIntPair[1] = aSrc.mU.mIntPair[1];
@ -45,8 +45,8 @@ bool
SVGIntegerPairSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return aLeft.mU.mIntPair[0] == aRight.mU.mIntPair[0] &&
aLeft.mU.mIntPair[1] == aRight.mU.mIntPair[1];
@ -56,9 +56,9 @@ nsresult
SVGIntegerPairSMILType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
aDest.mU.mIntPair[0] += aValueToAdd.mU.mIntPair[0] * aCount;
aDest.mU.mIntPair[1] += aValueToAdd.mU.mIntPair[1] * aCount;
@ -71,8 +71,8 @@ SVGIntegerPairSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType,"Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
double delta[2];
delta[0] = aTo.mU.mIntPair[0] - aFrom.mU.mIntPair[0];
@ -88,11 +88,10 @@ SVGIntegerPairSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
double currentVal[2];
currentVal[0] = aStartVal.mU.mIntPair[0] +

View file

@ -36,7 +36,7 @@ SVGLengthListSMILType::Init(nsSMILValue &aValue) const
void
SVGLengthListSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value type");
delete static_cast<SVGLengthListAndInfo*>(aValue.mU.mPtr);
aValue.mU.mPtr = nullptr;
aValue.mType = nsSMILNullType::Singleton();
@ -46,8 +46,8 @@ nsresult
SVGLengthListSMILType::Assign(nsSMILValue& aDest,
const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
const SVGLengthListAndInfo* src =
static_cast<const SVGLengthListAndInfo*>(aSrc.mU.mPtr);
@ -61,8 +61,8 @@ bool
SVGLengthListSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return *static_cast<const SVGLengthListAndInfo*>(aLeft.mU.mPtr) ==
*static_cast<const SVGLengthListAndInfo*>(aRight.mU.mPtr);
@ -73,8 +73,8 @@ SVGLengthListSMILType::Add(nsSMILValue& aDest,
const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aValueToAdd.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aValueToAdd.mType == this, "Incompatible SMIL type");
SVGLengthListAndInfo& dest =
*static_cast<SVGLengthListAndInfo*>(aDest.mU.mPtr);
@ -161,8 +161,8 @@ SVGLengthListSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aTo.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aFrom.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aTo.mType == this, "Incompatible SMIL type");
const SVGLengthListAndInfo& from =
*static_cast<const SVGLengthListAndInfo*>(aFrom.mU.mPtr);
@ -231,11 +231,10 @@ SVGLengthListSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const SVGLengthListAndInfo& start =
*static_cast<const SVGLengthListAndInfo*>(aStartVal.mU.mPtr);

View file

@ -49,7 +49,7 @@ SVGNumberListSMILType::Init(nsSMILValue &aValue) const
void
SVGNumberListSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value type");
delete static_cast<SVGNumberListAndInfo*>(aValue.mU.mPtr);
aValue.mU.mPtr = nullptr;
aValue.mType = nsSMILNullType::Singleton();
@ -59,8 +59,8 @@ nsresult
SVGNumberListSMILType::Assign(nsSMILValue& aDest,
const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
const SVGNumberListAndInfo* src =
static_cast<const SVGNumberListAndInfo*>(aSrc.mU.mPtr);
@ -74,8 +74,8 @@ bool
SVGNumberListSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return *static_cast<const SVGNumberListAndInfo*>(aLeft.mU.mPtr) ==
*static_cast<const SVGNumberListAndInfo*>(aRight.mU.mPtr);
@ -86,8 +86,8 @@ SVGNumberListSMILType::Add(nsSMILValue& aDest,
const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aValueToAdd.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aValueToAdd.mType == this, "Incompatible SMIL type");
SVGNumberListAndInfo& dest =
*static_cast<SVGNumberListAndInfo*>(aDest.mU.mPtr);
@ -133,8 +133,8 @@ SVGNumberListSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aTo.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aFrom.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aTo.mType == this, "Incompatible SMIL type");
const SVGNumberListAndInfo& from =
*static_cast<const SVGNumberListAndInfo*>(aFrom.mU.mPtr);
@ -171,11 +171,10 @@ SVGNumberListSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const SVGNumberListAndInfo& start =
*static_cast<const SVGNumberListAndInfo*>(aStartVal.mU.mPtr);

View file

@ -26,7 +26,7 @@ SVGNumberPairSMILType::Init(nsSMILValue& aValue) const
void
SVGNumberPairSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
aValue.mU.mNumberPair[0] = 0;
aValue.mU.mNumberPair[1] = 0;
aValue.mType = nsSMILNullType::Singleton();
@ -35,8 +35,8 @@ SVGNumberPairSMILType::Destroy(nsSMILValue& aValue) const
nsresult
SVGNumberPairSMILType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
aDest.mU.mNumberPair[0] = aSrc.mU.mNumberPair[0];
aDest.mU.mNumberPair[1] = aSrc.mU.mNumberPair[1];
@ -47,8 +47,8 @@ bool
SVGNumberPairSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return aLeft.mU.mNumberPair[0] == aRight.mU.mNumberPair[0] &&
aLeft.mU.mNumberPair[1] == aRight.mU.mNumberPair[1];
@ -58,9 +58,9 @@ nsresult
SVGNumberPairSMILType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
aDest.mU.mNumberPair[0] += aValueToAdd.mU.mNumberPair[0] * aCount;
aDest.mU.mNumberPair[1] += aValueToAdd.mU.mNumberPair[1] * aCount;
@ -73,8 +73,8 @@ SVGNumberPairSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType,"Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
double delta[2];
delta[0] = aTo.mU.mNumberPair[0] - aFrom.mU.mNumberPair[0];
@ -90,11 +90,10 @@ SVGNumberPairSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
aResult.mU.mNumberPair[0] =
float(aStartVal.mU.mNumberPair[0] +

View file

@ -32,7 +32,7 @@ SVGOrientSMILType::Init(nsSMILValue& aValue) const
void
SVGOrientSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value.");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value.");
aValue.mU.mPtr = nullptr;
aValue.mType = nsSMILNullType::Singleton();
}
@ -40,8 +40,8 @@ SVGOrientSMILType::Destroy(nsSMILValue& aValue) const
nsresult
SVGOrientSMILType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types.");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value.");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types.");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value.");
aDest.mU.mOrient.mAngle = aSrc.mU.mOrient.mAngle;
aDest.mU.mOrient.mUnit = aSrc.mU.mOrient.mUnit;
@ -53,8 +53,8 @@ bool
SVGOrientSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return
aLeft.mU.mOrient.mAngle == aRight.mU.mOrient.mAngle &&
@ -66,9 +66,9 @@ nsresult
SVGOrientSMILType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
if (aDest.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE ||
aValueToAdd.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE) {
@ -98,8 +98,8 @@ SVGOrientSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType,"Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
if (aFrom.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE ||
aTo.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE) {
@ -124,11 +124,10 @@ SVGOrientSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation.");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type.");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation.");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type.");
if (aStartVal.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE ||
aEndVal.mU.mOrient.mOrientType != SVG_MARKER_ORIENT_ANGLE) {

View file

@ -32,7 +32,7 @@ SVGPathSegListSMILType::Init(nsSMILValue &aValue) const
void
SVGPathSegListSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value type");
delete static_cast<SVGPathDataAndInfo*>(aValue.mU.mPtr);
aValue.mU.mPtr = nullptr;
aValue.mType = nsSMILNullType::Singleton();
@ -42,8 +42,8 @@ nsresult
SVGPathSegListSMILType::Assign(nsSMILValue& aDest,
const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
const SVGPathDataAndInfo* src =
static_cast<const SVGPathDataAndInfo*>(aSrc.mU.mPtr);
@ -57,8 +57,8 @@ bool
SVGPathSegListSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return *static_cast<const SVGPathDataAndInfo*>(aLeft.mU.mPtr) ==
*static_cast<const SVGPathDataAndInfo*>(aRight.mU.mPtr);
@ -400,8 +400,8 @@ SVGPathSegListSMILType::Add(nsSMILValue& aDest,
const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aValueToAdd.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aValueToAdd.mType == this, "Incompatible SMIL type");
SVGPathDataAndInfo& dest =
*static_cast<SVGPathDataAndInfo*>(aDest.mU.mPtr);
@ -440,8 +440,8 @@ SVGPathSegListSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aTo.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aFrom.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aTo.mType == this, "Incompatible SMIL type");
// See https://bugzilla.mozilla.org/show_bug.cgi?id=522306#c18
@ -455,11 +455,10 @@ SVGPathSegListSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const SVGPathDataAndInfo& start =
*static_cast<const SVGPathDataAndInfo*>(aStartVal.mU.mPtr);

View file

@ -32,7 +32,7 @@ SVGPointListSMILType::Init(nsSMILValue &aValue) const
void
SVGPointListSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value type");
delete static_cast<SVGPointListAndInfo*>(aValue.mU.mPtr);
aValue.mU.mPtr = nullptr;
aValue.mType = nsSMILNullType::Singleton();
@ -42,8 +42,8 @@ nsresult
SVGPointListSMILType::Assign(nsSMILValue& aDest,
const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
const SVGPointListAndInfo* src =
static_cast<const SVGPointListAndInfo*>(aSrc.mU.mPtr);
@ -57,8 +57,8 @@ bool
SVGPointListSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
return *static_cast<const SVGPointListAndInfo*>(aLeft.mU.mPtr) ==
*static_cast<const SVGPointListAndInfo*>(aRight.mU.mPtr);
@ -69,8 +69,8 @@ SVGPointListSMILType::Add(nsSMILValue& aDest,
const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aValueToAdd.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aValueToAdd.mType == this, "Incompatible SMIL type");
SVGPointListAndInfo& dest =
*static_cast<SVGPointListAndInfo*>(aDest.mU.mPtr);
@ -112,8 +112,8 @@ SVGPointListSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aTo.mType == this, "Incompatible SMIL type");
MOZ_ASSERT(aFrom.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aTo.mType == this, "Incompatible SMIL type");
const SVGPointListAndInfo& from =
*static_cast<const SVGPointListAndInfo*>(aFrom.mU.mPtr);
@ -151,11 +151,10 @@ SVGPointListSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const SVGPointListAndInfo& start =
*static_cast<const SVGPointListAndInfo*>(aStartVal.mU.mPtr);

View file

@ -22,7 +22,7 @@ typedef FallibleTArray<SVGTransformSMILData> TransformArray;
void
SVGTransformListSMILType::Init(nsSMILValue &aValue) const
{
NS_PRECONDITION(aValue.IsNull(), "Unexpected value type");
MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
TransformArray* transforms = new TransformArray(1);
aValue.mU.mPtr = transforms;
@ -32,7 +32,7 @@ SVGTransformListSMILType::Init(nsSMILValue &aValue) const
void
SVGTransformListSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value type");
TransformArray* params = static_cast<TransformArray*>(aValue.mU.mPtr);
delete params;
aValue.mU.mPtr = nullptr;
@ -43,8 +43,8 @@ nsresult
SVGTransformListSMILType::Assign(nsSMILValue& aDest,
const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
const TransformArray* srcTransforms =
static_cast<const TransformArray*>(aSrc.mU.mPtr);
@ -60,8 +60,8 @@ bool
SVGTransformListSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected SMIL type");
const TransformArray& leftArr
(*static_cast<const TransformArray*>(aLeft.mU.mPtr));
@ -90,8 +90,8 @@ SVGTransformListSMILType::Add(nsSMILValue& aDest,
const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aDest.mType == aValueToAdd.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aDest.mType == aValueToAdd.mType, "Incompatible SMIL types");
TransformArray& dstTransforms(*static_cast<TransformArray*>(aDest.mU.mPtr));
const TransformArray& srcTransforms
@ -142,8 +142,8 @@ nsresult
SVGTransformListSMILType::SandwichAdd(nsSMILValue& aDest,
const nsSMILValue& aValueToAdd) const
{
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type");
NS_PRECONDITION(aDest.mType == aValueToAdd.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aDest.mType == aValueToAdd.mType, "Incompatible SMIL types");
// For <animateTransform> a sandwich add means a matrix post-multiplication
// which just means to put the additional transform on the end of the array
@ -180,9 +180,9 @@ SVGTransformListSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,
MOZ_ASSERT(aFrom.mType == aTo.mType,
"Can't compute difference between different SMIL types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected SMIL type");
MOZ_ASSERT(aFrom.mType == this, "Unexpected SMIL type");
const TransformArray* fromTransforms =
static_cast<const TransformArray*>(aFrom.mU.mPtr);
@ -245,11 +245,10 @@ SVGTransformListSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Can't interpolate between different SMIL types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected type for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Can't interpolate between different SMIL types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected type for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const TransformArray& startTransforms =
(*static_cast<const TransformArray*>(aStartVal.mU.mPtr));
@ -319,7 +318,7 @@ SVGTransformListSMILType::AppendTransform(
const SVGTransformSMILData& aTransform,
nsSMILValue& aValue)
{
NS_PRECONDITION(aValue.mType == Singleton(), "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == Singleton(), "Unexpected SMIL value type");
TransformArray& transforms = *static_cast<TransformArray*>(aValue.mU.mPtr);
return transforms.AppendElement(aTransform, fallible) ?
@ -331,7 +330,7 @@ bool
SVGTransformListSMILType::AppendTransforms(const SVGTransformList& aList,
nsSMILValue& aValue)
{
NS_PRECONDITION(aValue.mType == Singleton(), "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == Singleton(), "Unexpected SMIL value type");
TransformArray& transforms = *static_cast<TransformArray*>(aValue.mU.mPtr);
@ -352,7 +351,7 @@ bool
SVGTransformListSMILType::GetTransforms(const nsSMILValue& aValue,
FallibleTArray<nsSVGTransform>& aTransforms)
{
NS_PRECONDITION(aValue.mType == Singleton(), "Unexpected SMIL value type");
MOZ_ASSERT(aValue.mType == Singleton(), "Unexpected SMIL value type");
const TransformArray& smilTransforms =
*static_cast<const TransformArray*>(aValue.mU.mPtr);

View file

@ -26,7 +26,7 @@ SVGViewBoxSMILType::Init(nsSMILValue& aValue) const
void
SVGViewBoxSMILType::Destroy(nsSMILValue& aValue) const
{
NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
delete static_cast<nsSVGViewBoxRect*>(aValue.mU.mPtr);
aValue.mU.mPtr = nullptr;
aValue.mType = nsSMILNullType::Singleton();
@ -35,8 +35,8 @@ SVGViewBoxSMILType::Destroy(nsSMILValue& aValue) const
nsresult
SVGViewBoxSMILType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const
{
NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types");
NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value");
MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
const nsSVGViewBoxRect* src = static_cast<const nsSVGViewBoxRect*>(aSrc.mU.mPtr);
nsSVGViewBoxRect* dst = static_cast<nsSVGViewBoxRect*>(aDest.mU.mPtr);
@ -48,8 +48,8 @@ bool
SVGViewBoxSMILType::IsEqual(const nsSMILValue& aLeft,
const nsSMILValue& aRight) const
{
NS_PRECONDITION(aLeft.mType == aRight.mType, "Incompatible SMIL types");
NS_PRECONDITION(aLeft.mType == this, "Unexpected type for SMIL value");
MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
const nsSVGViewBoxRect* leftBox =
static_cast<const nsSVGViewBoxRect*>(aLeft.mU.mPtr);
@ -62,9 +62,9 @@ nsresult
SVGViewBoxSMILType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd,
uint32_t aCount) const
{
NS_PRECONDITION(aValueToAdd.mType == aDest.mType,
MOZ_ASSERT(aValueToAdd.mType == aDest.mType,
"Trying to add invalid types");
NS_PRECONDITION(aValueToAdd.mType == this, "Unexpected source type");
MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
// See https://bugzilla.mozilla.org/show_bug.cgi?id=541884#c3 and the two
// comments that follow that one for arguments for and against allowing
@ -78,8 +78,8 @@ SVGViewBoxSMILType::ComputeDistance(const nsSMILValue& aFrom,
const nsSMILValue& aTo,
double& aDistance) const
{
NS_PRECONDITION(aFrom.mType == aTo.mType,"Trying to compare different types");
NS_PRECONDITION(aFrom.mType == this, "Unexpected source type");
MOZ_ASSERT(aFrom.mType == aTo.mType,"Trying to compare different types");
MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
const nsSVGViewBoxRect* from = static_cast<const nsSVGViewBoxRect*>(aFrom.mU.mPtr);
const nsSVGViewBoxRect* to = static_cast<const nsSVGViewBoxRect*>(aTo.mU.mPtr);
@ -110,11 +110,10 @@ SVGViewBoxSMILType::Interpolate(const nsSMILValue& aStartVal,
double aUnitDistance,
nsSMILValue& aResult) const
{
NS_PRECONDITION(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
NS_PRECONDITION(aStartVal.mType == this,
"Unexpected types for interpolation");
NS_PRECONDITION(aResult.mType == this, "Unexpected result type");
MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
"Trying to interpolate different types");
MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
const nsSVGViewBoxRect* start = static_cast<const nsSVGViewBoxRect*>(aStartVal.mU.mPtr);
const nsSVGViewBoxRect* end = static_cast<const nsSVGViewBoxRect*>(aEndVal.mU.mPtr);

View file

@ -202,7 +202,7 @@ nsBindingManager::RemovedFromDocumentInternal(nsIContent* aContent,
nsIDocument* aOldDocument,
DestructorHandling aDestructorHandling)
{
NS_PRECONDITION(aOldDocument != nullptr, "no old document");
MOZ_ASSERT(aOldDocument != nullptr, "no old document");
RefPtr<nsXBLBinding> binding = aContent->GetXBLBinding();
if (binding) {
@ -298,7 +298,7 @@ nsBindingManager::LoadBindingDocument(nsIDocument* aBoundDoc,
nsIURI* aURL,
nsIPrincipal* aOriginPrincipal)
{
NS_PRECONDITION(aURL, "Must have a URI to load!");
MOZ_ASSERT(aURL, "Must have a URI to load!");
// First we need to load our binding.
nsXBLService* xblService = nsXBLService::GetInstance();
@ -471,7 +471,7 @@ nsBindingManager::ExecuteDetachedHandlers()
nsresult
nsBindingManager::PutXBLDocumentInfo(nsXBLDocumentInfo* aDocumentInfo)
{
NS_PRECONDITION(aDocumentInfo, "Must have a non-null documentinfo!");
MOZ_ASSERT(aDocumentInfo, "Must have a non-null documentinfo!");
if (!mDocumentTable) {
mDocumentTable = new nsRefPtrHashtable<nsURIHashKey,nsXBLDocumentInfo>();
@ -502,7 +502,7 @@ nsBindingManager::GetXBLDocumentInfo(nsIURI* aURL)
nsresult
nsBindingManager::PutLoadingDocListener(nsIURI* aURL, nsIStreamListener* aListener)
{
NS_PRECONDITION(aListener, "Must have a non-null listener!");
MOZ_ASSERT(aListener, "Must have a non-null listener!");
if (!mLoadingDocTable) {
mLoadingDocTable =

View file

@ -170,7 +170,7 @@ nsXBLContentSink::ReportError(const char16_t* aErrorText,
nsIScriptError *aError,
bool *_retval)
{
NS_PRECONDITION(aError && aSourceText && aErrorText, "Check arguments!!!");
MOZ_ASSERT(aError && aSourceText && aErrorText, "Check arguments!!!");
// XXX FIXME This function overrides and calls on
// nsXMLContentSink::ReportError, and probably should die. See bug 347826.

View file

@ -375,9 +375,8 @@ nsXBLProtoImplField::InstallField(JS::Handle<JSObject*> aBoundNode,
const nsXBLPrototypeBinding& aProtoBinding,
bool* aDidInstall) const
{
NS_PRECONDITION(aBoundNode,
"uh-oh, bound node should NOT be null or bad things will "
"happen");
MOZ_ASSERT(aBoundNode,
"uh-oh, bound node should NOT be null or bad things will happen");
*aDidInstall = false;

View file

@ -44,8 +44,8 @@ nsXBLProtoImplMethod::~nsXBLProtoImplMethod()
void
nsXBLProtoImplMethod::AppendBodyText(const nsAString& aText)
{
NS_PRECONDITION(!IsCompiled(),
"Must not be compiled when accessing uncompiled method");
MOZ_ASSERT(!IsCompiled(),
"Must not be compiled when accessing uncompiled method");
nsXBLUncompiledMethod* uncompiledMethod = GetUncompiledMethod();
if (!uncompiledMethod) {
@ -59,8 +59,8 @@ nsXBLProtoImplMethod::AppendBodyText(const nsAString& aText)
void
nsXBLProtoImplMethod::AddParameter(const nsAString& aText)
{
NS_PRECONDITION(!IsCompiled(),
"Must not be compiled when accessing uncompiled method");
MOZ_ASSERT(!IsCompiled(),
"Must not be compiled when accessing uncompiled method");
if (aText.IsEmpty()) {
NS_WARNING("Empty name attribute in xbl:parameter!");
@ -79,8 +79,8 @@ nsXBLProtoImplMethod::AddParameter(const nsAString& aText)
void
nsXBLProtoImplMethod::SetLineNumber(uint32_t aLineNumber)
{
NS_PRECONDITION(!IsCompiled(),
"Must not be compiled when accessing uncompiled method");
MOZ_ASSERT(!IsCompiled(),
"Must not be compiled when accessing uncompiled method");
nsXBLUncompiledMethod* uncompiledMethod = GetUncompiledMethod();
if (!uncompiledMethod) {
@ -95,7 +95,7 @@ nsresult
nsXBLProtoImplMethod::InstallMember(JSContext* aCx,
JS::Handle<JSObject*> aTargetClassObject)
{
NS_PRECONDITION(IsCompiled(),
MOZ_ASSERT(IsCompiled(),
"Should not be installing an uncompiled method");
MOZ_ASSERT(js::IsObjectInContextCompartment(aTargetClassObject, aCx));
@ -130,9 +130,9 @@ nsXBLProtoImplMethod::CompileMember(AutoJSAPI& jsapi, const nsString& aClassStr,
JS::Handle<JSObject*> aClassObject)
{
AssertInCompilationScope();
NS_PRECONDITION(!IsCompiled(),
MOZ_ASSERT(!IsCompiled(),
"Trying to compile an already-compiled method");
NS_PRECONDITION(aClassObject,
MOZ_ASSERT(aClassObject,
"Must have class object to compile");
nsXBLUncompiledMethod* uncompiledMethod = GetUncompiledMethod();
@ -263,7 +263,7 @@ nsXBLProtoImplAnonymousMethod::Execute(nsIContent* aBoundElement,
const nsXBLPrototypeBinding& aProtoBinding)
{
MOZ_ASSERT(aBoundElement->IsElement());
NS_PRECONDITION(IsCompiled(), "Can't execute uncompiled method");
MOZ_ASSERT(IsCompiled(), "Can't execute uncompiled method");
if (!GetCompiledMethod()) {
// Nothing to do here

View file

@ -86,8 +86,7 @@ void nsXBLProtoImplProperty::EnsureUncompiledText(PropertyOp& aPropertyOp)
void
nsXBLProtoImplProperty::AppendGetterText(const nsAString& aText)
{
NS_PRECONDITION(!mIsCompiled,
"Must not be compiled when accessing getter text");
MOZ_ASSERT(!mIsCompiled, "Must not be compiled when accessing getter text");
EnsureUncompiledText(mGetter);
mGetter.GetUncompiled()->AppendText(aText);
}
@ -95,8 +94,7 @@ nsXBLProtoImplProperty::AppendGetterText(const nsAString& aText)
void
nsXBLProtoImplProperty::AppendSetterText(const nsAString& aText)
{
NS_PRECONDITION(!mIsCompiled,
"Must not be compiled when accessing setter text");
MOZ_ASSERT(!mIsCompiled, "Must not be compiled when accessing setter text");
EnsureUncompiledText(mSetter);
mSetter.GetUncompiled()->AppendText(aText);
}
@ -104,8 +102,7 @@ nsXBLProtoImplProperty::AppendSetterText(const nsAString& aText)
void
nsXBLProtoImplProperty::SetGetterLineNumber(uint32_t aLineNumber)
{
NS_PRECONDITION(!mIsCompiled,
"Must not be compiled when accessing getter text");
MOZ_ASSERT(!mIsCompiled, "Must not be compiled when accessing getter text");
EnsureUncompiledText(mGetter);
mGetter.GetUncompiled()->SetLineNumber(aLineNumber);
}
@ -113,8 +110,7 @@ nsXBLProtoImplProperty::SetGetterLineNumber(uint32_t aLineNumber)
void
nsXBLProtoImplProperty::SetSetterLineNumber(uint32_t aLineNumber)
{
NS_PRECONDITION(!mIsCompiled,
"Must not be compiled when accessing setter text");
MOZ_ASSERT(!mIsCompiled, "Must not be compiled when accessing setter text");
EnsureUncompiledText(mSetter);
mSetter.GetUncompiled()->SetLineNumber(aLineNumber);
}
@ -125,8 +121,7 @@ nsresult
nsXBLProtoImplProperty::InstallMember(JSContext *aCx,
JS::Handle<JSObject*> aTargetClassObject)
{
NS_PRECONDITION(mIsCompiled,
"Should not be installing an uncompiled property");
MOZ_ASSERT(mIsCompiled, "Should not be installing an uncompiled property");
MOZ_ASSERT(mGetter.IsCompiled() && mSetter.IsCompiled());
MOZ_ASSERT(js::IsObjectInContextCompartment(aTargetClassObject, aCx));
@ -169,10 +164,8 @@ nsXBLProtoImplProperty::CompileMember(AutoJSAPI& jsapi, const nsString& aClassSt
JS::Handle<JSObject*> aClassObject)
{
AssertInCompilationScope();
NS_PRECONDITION(!mIsCompiled,
"Trying to compile an already-compiled property");
NS_PRECONDITION(aClassObject,
"Must have class object to compile");
MOZ_ASSERT(!mIsCompiled, "Trying to compile an already-compiled property");
MOZ_ASSERT(aClassObject, "Must have class object to compile");
MOZ_ASSERT(!mGetter.IsCompiled() && !mSetter.IsCompiled());
JSContext *cx = jsapi.cx();

View file

@ -480,7 +480,7 @@ nsXBLService::LoadBindings(Element* aElement, nsIURI* aURL,
nsIPrincipal* aOriginPrincipal,
nsXBLBinding** aBinding, bool* aResolveStyle)
{
NS_PRECONDITION(aOriginPrincipal, "Must have an origin principal");
MOZ_ASSERT(aOriginPrincipal, "Must have an origin principal");
*aBinding = nullptr;
*aResolveStyle = false;
@ -900,9 +900,9 @@ nsXBLService::LoadBindingDocumentInfo(nsIContent* aBoundElement,
bool aForceSyncLoad,
nsXBLDocumentInfo** aResult)
{
NS_PRECONDITION(aBindingURI, "Must have a binding URI");
NS_PRECONDITION(!aOriginPrincipal || aBoundDocument,
"If we're doing a security check, we better have a document!");
MOZ_ASSERT(aBindingURI, "Must have a binding URI");
MOZ_ASSERT(!aOriginPrincipal || aBoundDocument,
"If we're doing a security check, we better have a document!");
*aResult = nullptr;
// Allow XBL in unprivileged documents if it's specified in a privileged or

View file

@ -3217,7 +3217,7 @@ XMLHttpRequestMainThread::AsyncOnChannelRedirect(nsIChannel *aOldChannel,
uint32_t aFlags,
nsIAsyncVerifyRedirectCallback *callback)
{
NS_PRECONDITION(aNewChannel, "Redirect without a channel?");
MOZ_ASSERT(aNewChannel, "Redirect without a channel?");
// Prepare to receive callback
mRedirectCallback = callback;

View file

@ -20,7 +20,7 @@ NS_NewXMLProcessingInstruction(nsNodeInfoManager *aNodeInfoManager,
using mozilla::dom::ProcessingInstruction;
using mozilla::dom::XMLStylesheetProcessingInstruction;
NS_PRECONDITION(aNodeInfoManager, "Missing nodeinfo manager");
MOZ_ASSERT(aNodeInfoManager, "Missing nodeinfo manager");
RefPtr<nsAtom> target = NS_Atomize(aTarget);
MOZ_ASSERT(target);

View file

@ -79,7 +79,7 @@ NS_NewXMLContentSink(nsIXMLContentSink** aResult,
nsISupports* aContainer,
nsIChannel* aChannel)
{
NS_PRECONDITION(nullptr != aResult, "null ptr");
MOZ_ASSERT(nullptr != aResult, "null ptr");
if (nullptr == aResult) {
return NS_ERROR_NULL_POINTER;
}
@ -456,7 +456,7 @@ nsXMLContentSink::WillResume(void)
NS_IMETHODIMP
nsXMLContentSink::SetParser(nsParserBase* aParser)
{
NS_PRECONDITION(aParser, "Should have a parser here!");
MOZ_ASSERT(aParser, "Should have a parser here!");
mParser = aParser;
return NS_OK;
}
@ -844,7 +844,7 @@ nsXMLContentSink::GetCurrentStackNode()
nsresult
nsXMLContentSink::PushContent(nsIContent *aContent)
{
NS_PRECONDITION(aContent, "Null content being pushed!");
MOZ_ASSERT(aContent, "Null content being pushed!");
StackNode *sn = mContentStack.AppendElement();
NS_ENSURE_TRUE(sn, NS_ERROR_OUT_OF_MEMORY);
@ -973,7 +973,7 @@ nsXMLContentSink::HandleStartElement(const char16_t *aName,
uint32_t aLineNumber,
bool aInterruptable)
{
NS_PRECONDITION(aAttsCount % 2 == 0, "incorrect aAttsCount");
MOZ_ASSERT(aAttsCount % 2 == 0, "incorrect aAttsCount");
// Adjust aAttsCount so it's the actual number of attributes
aAttsCount /= 2;
@ -1358,7 +1358,7 @@ nsXMLContentSink::ReportError(const char16_t* aErrorText,
nsIScriptError *aError,
bool *_retval)
{
NS_PRECONDITION(aError && aSourceText && aErrorText, "Check arguments!!!");
MOZ_ASSERT(aError && aSourceText && aErrorText, "Check arguments!!!");
nsresult rv = NS_OK;
// The expat driver should report the error. We're just cleaning up the mess.

View file

@ -296,7 +296,7 @@ nsXMLFragmentContentSink::ReportError(const char16_t* aErrorText,
nsIScriptError *aError,
bool *_retval)
{
NS_PRECONDITION(aError && aSourceText && aErrorText, "Check arguments!!!");
MOZ_ASSERT(aError && aSourceText && aErrorText, "Check arguments!!!");
// The expat driver should report the error.
*_retval = true;

View file

@ -177,8 +177,7 @@ txXPathTreeWalker::isOnNode(const txXPathNode& aNode) const
inline int32_t
txXPathNodeUtils::getUniqueIdentifier(const txXPathNode& aNode)
{
NS_PRECONDITION(!aNode.isAttribute(),
"Not implemented for attributes.");
MOZ_ASSERT(!aNode.isAttribute(), "Not implemented for attributes.");
return NS_PTR_TO_INT32(aNode.mNode);
}

View file

@ -395,7 +395,7 @@ txExecutionState::pushTemplateRule(txStylesheet::ImportFrame* aFrame,
void
txExecutionState::popTemplateRule()
{
NS_PRECONDITION(!mTemplateRules.IsEmpty(), "No rules to pop");
MOZ_ASSERT(!mTemplateRules.IsEmpty(), "No rules to pop");
mTemplateRules.RemoveLastElement();
}
@ -457,7 +457,7 @@ txExecutionState::getKeyNodes(const txExpandedName& aKeyName,
txExecutionState::TemplateRule*
txExecutionState::getCurrentTemplateRule()
{
NS_PRECONDITION(!mTemplateRules.IsEmpty(), "No current rule!");
MOZ_ASSERT(!mTemplateRules.IsEmpty(), "No current rule!");
return &mTemplateRules[mTemplateRules.Length() - 1];
}

View file

@ -125,7 +125,7 @@ txStylesheetSink::HandleStartElement(const char16_t *aName,
uint32_t aAttsCount,
uint32_t aLineNumber)
{
NS_PRECONDITION(aAttsCount % 2 == 0, "incorrect aAttsCount");
MOZ_ASSERT(aAttsCount % 2 == 0, "incorrect aAttsCount");
nsresult rv =
mCompiler->startElement(aName, aAtts, aAttsCount / 2);
@ -208,7 +208,7 @@ txStylesheetSink::ReportError(const char16_t *aErrorText,
nsIScriptError *aError,
bool *_retval)
{
NS_PRECONDITION(aError && aSourceText && aErrorText, "Check arguments!!!");
MOZ_ASSERT(aError && aSourceText && aErrorText, "Check arguments!!!");
// The expat driver should report the error.
*_retval = true;

View file

@ -432,8 +432,8 @@ txMozillaXMLOutput::startElement(nsAtom* aPrefix, nsAtom* aLocalName,
nsAtom* aLowercaseLocalName,
const int32_t aNsID)
{
NS_PRECONDITION(aNsID != kNameSpaceID_None || !aPrefix,
"Can't have prefix without namespace");
MOZ_ASSERT(aNsID != kNameSpaceID_None || !aPrefix,
"Can't have prefix without namespace");
if (mOutputFormat.mMethod == eHTMLOutput && aNsID == kNameSpaceID_None) {
RefPtr<nsAtom> owner;

View file

@ -703,7 +703,7 @@ txStylesheetCompilerState::addToplevelItem(txToplevelItem* aItem)
nsresult
txStylesheetCompilerState::openInstructionContainer(txInstructionContainer* aContainer)
{
NS_PRECONDITION(!mNextInstrPtr, "can't nest instruction-containers");
MOZ_ASSERT(!mNextInstrPtr, "can't nest instruction-containers");
mNextInstrPtr = aContainer->mFirstInstruction.StartAssignment();
return NS_OK;
@ -720,7 +720,7 @@ txStylesheetCompilerState::closeInstructionContainer()
nsresult
txStylesheetCompilerState::addInstruction(nsAutoPtr<txInstruction>&& aInstruction)
{
NS_PRECONDITION(mNextInstrPtr, "adding instruction outside container");
MOZ_ASSERT(mNextInstrPtr, "adding instruction outside container");
txInstruction* newInstr = aInstruction;

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