author | Nicholas Nethercote <nnethercote@mozilla.com> |
Wed, 04 Feb 2015 20:05:36 -0800 | |
changeset 227756 | 7fa65aa297a48f9f568e58e38534f1c028624d64 |
parent 227755 | 27ba3e43fb81b90883e137e2457fcf3f7658143c |
child 227757 | 798d15daa5a9d6860667a5d4d27ca6e425c7db29 |
push id | 28238 |
push user | kwierso@gmail.com |
push date | Fri, 06 Feb 2015 00:55:16 +0000 |
treeherder | mozilla-central@7c5f187b65bf [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | Waldo |
bugs | 1127201 |
milestone | 38.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/chrome/nsChromeRegistryContent.cpp +++ b/chrome/nsChromeRegistryContent.cpp @@ -17,18 +17,18 @@ nsChromeRegistryContent::nsChromeRegistr void nsChromeRegistryContent::RegisterRemoteChrome( const InfallibleTArray<ChromePackage>& aPackages, const InfallibleTArray<ResourceMapping>& aResources, const InfallibleTArray<OverrideMapping>& aOverrides, const nsACString& aLocale, bool aReset) { - NS_ABORT_IF_FALSE(aReset || mLocale.IsEmpty(), - "RegisterChrome twice?"); + MOZ_ASSERT(aReset || mLocale.IsEmpty(), + "RegisterChrome twice?"); if (aReset) { mPackagesHash.Clear(); mOverrideTable.Clear(); // XXX Can't clear resources. } for (uint32_t i = aPackages.Length(); i > 0; ) {
--- a/dom/animation/Animation.cpp +++ b/dom/animation/Animation.cpp @@ -22,17 +22,17 @@ ComputedTimingFunction::Init(const nsTim } else { mSteps = aFunction.mSteps; } } static inline double StepEnd(uint32_t aSteps, double aPortion) { - NS_ABORT_IF_FALSE(0.0 <= aPortion && aPortion <= 1.0, "out of range"); + MOZ_ASSERT(0.0 <= aPortion && aPortion <= 1.0, "out of range"); uint32_t step = uint32_t(aPortion * aSteps); // floor return double(step) / double(aSteps); } double ComputedTimingFunction::GetValue(double aPortion) const { switch (mType) { @@ -42,17 +42,17 @@ ComputedTimingFunction::GetValue(double // There are diagrams in the spec that seem to suggest this check // and the bounds point should not be symmetric with StepEnd, but // should actually step up at rather than immediately after the // fraction points. However, we rely on rounding negative values // up to zero, so we can't do that. And it's not clear the spec // really meant it. return 1.0 - StepEnd(mSteps, 1.0 - aPortion); default: - NS_ABORT_IF_FALSE(false, "bad type"); + MOZ_ASSERT(false, "bad type"); // fall through case nsTimingFunction::StepEnd: return StepEnd(mSteps, aPortion); } } // In the Web Animations model, the time fraction can be outside the range // [0.0, 1.0] but it shouldn't be Infinity.
--- a/dom/archivereader/ArchiveRequest.cpp +++ b/dom/archivereader/ArchiveRequest.cpp @@ -37,17 +37,17 @@ protected: private: //data nsRefPtr<ArchiveRequest> mRequest; }; NS_IMETHODIMP ArchiveRequestEvent::Run() { - NS_ABORT_IF_FALSE(mRequest, "the request is not longer valid"); + MOZ_ASSERT(mRequest, "the request is not longer valid"); mRequest->Run(); return NS_OK; } // ArchiveRequest ArchiveRequest::ArchiveRequest(nsPIDOMWindow* aWindow, ArchiveReader* aReader)
--- a/dom/base/Attr.cpp +++ b/dom/base/Attr.cpp @@ -43,19 +43,19 @@ namespace dom { //---------------------------------------------------------------------- bool Attr::sInitialized; Attr::Attr(nsDOMAttributeMap *aAttrMap, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, const nsAString &aValue, bool aNsAware) : nsIAttribute(aAttrMap, aNodeInfo, aNsAware), mValue(aValue) { - NS_ABORT_IF_FALSE(mNodeInfo, "We must get a nodeinfo here!"); - NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::ATTRIBUTE_NODE, - "Wrong nodeType"); + MOZ_ASSERT(mNodeInfo, "We must get a nodeinfo here!"); + MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::ATTRIBUTE_NODE, + "Wrong nodeType"); // We don't add a reference to our content. It will tell us // to drop our reference when it goes away. } NS_IMPL_CYCLE_COLLECTION_CLASS(Attr) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Attr)
--- a/dom/base/Comment.h +++ b/dom/base/Comment.h @@ -14,18 +14,18 @@ namespace mozilla { namespace dom { class Comment MOZ_FINAL : public nsGenericDOMDataNode, public nsIDOMComment { private: void Init() { - NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE, - "Bad NodeType in aNodeInfo"); + MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE, + "Bad NodeType in aNodeInfo"); } virtual ~Comment(); public: explicit Comment(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) : nsGenericDOMDataNode(aNodeInfo) {
--- a/dom/base/Crypto.cpp +++ b/dom/base/Crypto.cpp @@ -51,17 +51,17 @@ Crypto::WrapObject(JSContext* aCx) return CryptoBinding::Wrap(aCx, this); } void Crypto::GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray, JS::MutableHandle<JSObject*> aRetval, ErrorResult& aRv) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "Called on the wrong thread"); + MOZ_ASSERT(NS_IsMainThread(), "Called on the wrong thread"); JS::Rooted<JSObject*> view(aCx, aArray.Obj()); // Throw if the wrong type of ArrayBufferView is passed in // (Part of the Web Crypto API spec) switch (JS_GetArrayBufferViewType(view)) { case js::Scalar::Int8: case js::Scalar::Uint8:
--- a/dom/base/DocumentFragment.h +++ b/dom/base/DocumentFragment.h @@ -22,21 +22,20 @@ namespace dom { class Element; class DocumentFragment : public FragmentOrElement, public nsIDOMDocumentFragment { private: void Init() { - NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == - nsIDOMNode::DOCUMENT_FRAGMENT_NODE && - mNodeInfo->Equals(nsGkAtoms::documentFragmentNodeName, - kNameSpaceID_None), - "Bad NodeType in aNodeInfo"); + MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_FRAGMENT_NODE && + mNodeInfo->Equals(nsGkAtoms::documentFragmentNodeName, + kNameSpaceID_None), + "Bad NodeType in aNodeInfo"); } public: using FragmentOrElement::GetFirstChild; using nsINode::QuerySelector; using nsINode::QuerySelectorAll; // Make sure bindings can see our superclass' protected GetElementById method. using nsINode::GetElementById;
--- a/dom/base/DocumentType.cpp +++ b/dom/base/DocumentType.cpp @@ -69,18 +69,18 @@ DocumentType::DocumentType(already_AddRe const nsAString& aPublicId, const nsAString& aSystemId, const nsAString& aInternalSubset) : DocumentTypeForward(aNodeInfo), mPublicId(aPublicId), mSystemId(aSystemId), mInternalSubset(aInternalSubset) { - NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE, - "Bad NodeType in aNodeInfo"); + MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE, + "Bad NodeType in aNodeInfo"); } DocumentType::~DocumentType() { } NS_IMPL_ISUPPORTS_INHERITED(DocumentType, nsGenericDOMDataNode, nsIDOMNode, nsIDOMDocumentType)
--- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -199,19 +199,19 @@ Element::NotifyStateChange(EventStates a nsAutoScriptBlocker scriptBlocker; doc->ContentStateChanged(this, aStates); } } void Element::UpdateLinkState(EventStates aState) { - NS_ABORT_IF_FALSE(!aState.HasAtLeastOneOfStates(~(NS_EVENT_STATE_VISITED | - NS_EVENT_STATE_UNVISITED)), - "Unexpected link state bits"); + MOZ_ASSERT(!aState.HasAtLeastOneOfStates(~(NS_EVENT_STATE_VISITED | + NS_EVENT_STATE_UNVISITED)), + "Unexpected link state bits"); mState = (mState & ~(NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)) | aState; } void Element::UpdateState(bool aNotify) {
--- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -147,18 +147,18 @@ class DestinationInsertionPointList; class Element : public FragmentOrElement { public: #ifdef MOZILLA_INTERNAL_API explicit Element(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo) : FragmentOrElement(aNodeInfo), mState(NS_EVENT_STATE_MOZ_READONLY) { - NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::ELEMENT_NODE, - "Bad NodeType in aNodeInfo"); + MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::ELEMENT_NODE, + "Bad NodeType in aNodeInfo"); SetIsElement(); } #endif // MOZILLA_INTERNAL_API NS_DECLARE_STATIC_IID_ACCESSOR(NS_ELEMENT_IID) NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) MOZ_OVERRIDE;
--- a/dom/base/EventSource.cpp +++ b/dom/base/EventSource.cpp @@ -575,19 +575,19 @@ EventSource::AsyncOnChannelRedirect(nsIC } OnRedirectVerifyCallback(NS_OK); return NS_OK; } nsresult EventSource::OnRedirectVerifyCallback(nsresult aResult) { - NS_ABORT_IF_FALSE(mRedirectCallback, "mRedirectCallback not set in callback"); - NS_ABORT_IF_FALSE(mNewRedirectChannel, - "mNewRedirectChannel not set in callback"); + MOZ_ASSERT(mRedirectCallback, "mRedirectCallback not set in callback"); + MOZ_ASSERT(mNewRedirectChannel, + "mNewRedirectChannel not set in callback"); NS_ENSURE_SUCCESS(aResult, aResult); // update our channel mHttpChannel = do_QueryInterface(mNewRedirectChannel); NS_ENSURE_STATE(mHttpChannel);
--- a/dom/base/Link.cpp +++ b/dom/base/Link.cpp @@ -24,17 +24,17 @@ namespace dom { Link::Link(Element *aElement) : mElement(aElement) , mHistory(services::GetHistoryService()) , mLinkState(eLinkState_NotLink) , mNeedsRegistration(false) , mRegistered(false) { - NS_ABORT_IF_FALSE(mElement, "Must have an element"); + MOZ_ASSERT(mElement, "Must have an element"); } Link::~Link() { UnregisterFromHistory(); } bool @@ -53,19 +53,19 @@ Link::SetLinkState(nsLinkState aState) "Setting state to the currently set state!"); // Set our current state as appropriate. mLinkState = aState; // Per IHistory interface documentation, we are no longer registered. mRegistered = false; - NS_ABORT_IF_FALSE(LinkState() == NS_EVENT_STATE_VISITED || - LinkState() == NS_EVENT_STATE_UNVISITED, - "Unexpected state obtained from LinkState()!"); + MOZ_ASSERT(LinkState() == NS_EVENT_STATE_VISITED || + LinkState() == NS_EVENT_STATE_UNVISITED, + "Unexpected state obtained from LinkState()!"); // Tell the element to update its visited state mElement->UpdateState(true); } EventStates Link::LinkState() const {
--- a/dom/base/NodeInfo.cpp +++ b/dom/base/NodeInfo.cpp @@ -43,17 +43,17 @@ NodeInfo::~NodeInfo() NS_IF_RELEASE(mInner.mExtraName); } NodeInfo::NodeInfo(nsIAtom *aName, nsIAtom *aPrefix, int32_t aNamespaceID, uint16_t aNodeType, nsIAtom* aExtraName, nsNodeInfoManager *aOwnerManager) { CheckValidNodeInfo(aNodeType, aName, aNamespaceID, aExtraName); - NS_ABORT_IF_FALSE(aOwnerManager, "Invalid aOwnerManager"); + MOZ_ASSERT(aOwnerManager, "Invalid aOwnerManager"); // Initialize mInner NS_ADDREF(mInner.mName = aName); NS_IF_ADDREF(mInner.mPrefix = aPrefix); mInner.mNamespaceID = aNamespaceID; mInner.mNodeType = aNodeType; mOwnerManager = aOwnerManager; NS_IF_ADDREF(mInner.mExtraName = aExtraName); @@ -99,18 +99,17 @@ NodeInfo::NodeInfo(nsIAtom *aName, nsIAt SetDOMStringToNull(mLocalName); break; case nsIDOMNode::PROCESSING_INSTRUCTION_NODE: case nsIDOMNode::DOCUMENT_TYPE_NODE: mInner.mExtraName->ToString(mNodeName); SetDOMStringToNull(mLocalName); break; default: - NS_ABORT_IF_FALSE(aNodeType == UINT16_MAX, - "Unknown node type"); + MOZ_ASSERT(aNodeType == UINT16_MAX, "Unknown node type"); } } // nsISupports NS_IMPL_CYCLE_COLLECTION_CLASS(NodeInfo)
--- a/dom/base/NodeInfoInlines.h +++ b/dom/base/NodeInfoInlines.h @@ -70,47 +70,47 @@ NodeInfo::QualifiedNameEquals(nsIAtom* a } // namespace dom } // namespace mozilla inline void CheckValidNodeInfo(uint16_t aNodeType, nsIAtom *aName, int32_t aNamespaceID, nsIAtom* aExtraName) { - NS_ABORT_IF_FALSE(aNodeType == nsIDOMNode::ELEMENT_NODE || - aNodeType == nsIDOMNode::ATTRIBUTE_NODE || - aNodeType == nsIDOMNode::TEXT_NODE || - aNodeType == nsIDOMNode::CDATA_SECTION_NODE || - aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE || - aNodeType == nsIDOMNode::COMMENT_NODE || - aNodeType == nsIDOMNode::DOCUMENT_NODE || - aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE || - aNodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE || - aNodeType == UINT16_MAX, - "Invalid nodeType"); - NS_ABORT_IF_FALSE((aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE || - aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) == - !!aExtraName, - "Supply aExtraName for and only for PIs and doctypes"); - NS_ABORT_IF_FALSE(aNodeType == nsIDOMNode::ELEMENT_NODE || - aNodeType == nsIDOMNode::ATTRIBUTE_NODE || - aNodeType == UINT16_MAX || - aNamespaceID == kNameSpaceID_None, - "Only attributes and elements can be in a namespace"); - NS_ABORT_IF_FALSE(aName && aName != nsGkAtoms::_empty, "Invalid localName"); - NS_ABORT_IF_FALSE(((aNodeType == nsIDOMNode::TEXT_NODE) == - (aName == nsGkAtoms::textTagName)) && - ((aNodeType == nsIDOMNode::CDATA_SECTION_NODE) == - (aName == nsGkAtoms::cdataTagName)) && - ((aNodeType == nsIDOMNode::COMMENT_NODE) == - (aName == nsGkAtoms::commentTagName)) && - ((aNodeType == nsIDOMNode::DOCUMENT_NODE) == - (aName == nsGkAtoms::documentNodeName)) && - ((aNodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) == - (aName == nsGkAtoms::documentFragmentNodeName)) && - ((aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) == - (aName == nsGkAtoms::documentTypeNodeName)) && - ((aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE) == - (aName == nsGkAtoms::processingInstructionTagName)), - "Wrong localName for nodeType"); + MOZ_ASSERT(aNodeType == nsIDOMNode::ELEMENT_NODE || + aNodeType == nsIDOMNode::ATTRIBUTE_NODE || + aNodeType == nsIDOMNode::TEXT_NODE || + aNodeType == nsIDOMNode::CDATA_SECTION_NODE || + aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE || + aNodeType == nsIDOMNode::COMMENT_NODE || + aNodeType == nsIDOMNode::DOCUMENT_NODE || + aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE || + aNodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE || + aNodeType == UINT16_MAX, + "Invalid nodeType"); + MOZ_ASSERT((aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE || + aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) == + !!aExtraName, + "Supply aExtraName for and only for PIs and doctypes"); + MOZ_ASSERT(aNodeType == nsIDOMNode::ELEMENT_NODE || + aNodeType == nsIDOMNode::ATTRIBUTE_NODE || + aNodeType == UINT16_MAX || + aNamespaceID == kNameSpaceID_None, + "Only attributes and elements can be in a namespace"); + MOZ_ASSERT(aName && aName != nsGkAtoms::_empty, "Invalid localName"); + MOZ_ASSERT(((aNodeType == nsIDOMNode::TEXT_NODE) == + (aName == nsGkAtoms::textTagName)) && + ((aNodeType == nsIDOMNode::CDATA_SECTION_NODE) == + (aName == nsGkAtoms::cdataTagName)) && + ((aNodeType == nsIDOMNode::COMMENT_NODE) == + (aName == nsGkAtoms::commentTagName)) && + ((aNodeType == nsIDOMNode::DOCUMENT_NODE) == + (aName == nsGkAtoms::documentNodeName)) && + ((aNodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE) == + (aName == nsGkAtoms::documentFragmentNodeName)) && + ((aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) == + (aName == nsGkAtoms::documentTypeNodeName)) && + ((aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE) == + (aName == nsGkAtoms::processingInstructionTagName)), + "Wrong localName for nodeType"); } -#endif /* mozilla_dom_NodeInfoInlines_h___ */ \ No newline at end of file +#endif /* mozilla_dom_NodeInfoInlines_h___ */
--- a/dom/base/WebSocket.cpp +++ b/dom/base/WebSocket.cpp @@ -1477,17 +1477,17 @@ WebSocketImpl::Init(JSContext* aCx, } else { *aConnectionFailed = false; } } void WebSocketImpl::AsyncOpen(ErrorResult& aRv) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread"); + MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread"); nsCString asciiOrigin; aRv = nsContentUtils::GetASCIIOrigin(mPrincipal, asciiOrigin); if (NS_WARN_IF(aRv.Failed())) { return; } ToLowerCase(asciiOrigin); @@ -1522,17 +1522,17 @@ public: private: nsRefPtr<WebSocketImpl> mWebSocketImpl; }; nsresult WebSocketImpl::InitializeConnection() { AssertIsOnMainThread(); - NS_ABORT_IF_FALSE(!mChannel, "mChannel should be null"); + MOZ_ASSERT(!mChannel, "mChannel should be null"); nsCOMPtr<nsIWebSocketChannel> wsChannel; nsAutoCloseWS autoClose(this); nsresult rv; if (mSecure) { wsChannel = do_CreateInstance("@mozilla.org/network/protocol;1?name=wss", &rv);
--- a/dom/base/nsAttrValue.cpp +++ b/dom/base/nsAttrValue.cpp @@ -1027,18 +1027,17 @@ nsAttrValue::Equals(const nsAttrValue& a default: { if (IsSVGType(thisCont->mType)) { // Currently this method is never called for nsAttrValue objects that // point to SVG data types. // If that changes then we probably want to add methods to the // corresponding SVG types to compare their base values. // As a shortcut, however, we can begin by comparing the pointers. - NS_ABORT_IF_FALSE(false, "Comparing nsAttrValues that point to SVG " - "data"); + MOZ_ASSERT(false, "Comparing nsAttrValues that point to SVG data"); return false; } NS_NOTREACHED("unknown type stored in MiscContainer"); return false; } } if (needsStringComparison) { if (thisCont->mStringBits == otherCont->mStringBits) { @@ -1749,17 +1748,17 @@ nsAttrValue::ResetMiscAtomOrString() } cont->mStringBits = 0; } } void nsAttrValue::SetSVGType(ValueType aType, const void* aValue, const nsAString* aSerialized) { - NS_ABORT_IF_FALSE(IsSVGType(aType), "Not an SVG type"); + MOZ_ASSERT(IsSVGType(aType), "Not an SVG type"); MiscContainer* cont = EnsureEmptyMiscContainer(); // All SVG types are just pointers to classes so just setting any of them // will do. We'll lose type-safety but the signature of the calling // function should ensure we don't get anything unexpected, and once we // stick aValue in a union we lose type information anyway. cont->mValue.mSVGAngle = static_cast<const nsSVGAngle*>(aValue); cont->mType = aType;
--- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -4337,17 +4337,17 @@ nsContentUtils::ParseFragmentXML(const n parser.forget(&sXMLFragmentParser); // sXMLFragmentParser now owns the parser } if (!sXMLFragmentSink) { NS_NewXMLFragmentContentSink(&sXMLFragmentSink); // sXMLFragmentSink now owns the sink } nsCOMPtr<nsIContentSink> contentsink = do_QueryInterface(sXMLFragmentSink); - NS_ABORT_IF_FALSE(contentsink, "Sink doesn't QI to nsIContentSink!"); + MOZ_ASSERT(contentsink, "Sink doesn't QI to nsIContentSink!"); sXMLFragmentParser->SetContentSink(contentsink); sXMLFragmentSink->SetTargetDocument(aDocument); sXMLFragmentSink->SetPreventScriptExecution(aPreventScriptExecution); nsresult rv = sXMLFragmentParser->ParseFragment(aSourceBuffer, aTagStack);
--- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -1760,17 +1760,17 @@ GetXPCProto(nsIXPConnect *aXPConnect, JS NS_ASSERTION(aNameStruct->mType == nsGlobalNameStruct::eTypeClassConstructor || aNameStruct->mType == nsGlobalNameStruct::eTypeExternalClassInfo, "Wrong type!"); nsCOMPtr<nsIClassInfo> ci; if (aNameStruct->mType == nsGlobalNameStruct::eTypeClassConstructor) { int32_t id = aNameStruct->mDOMClassInfoID; - NS_ABORT_IF_FALSE(id >= 0, "Negative DOM classinfo?!?"); + MOZ_ASSERT(id >= 0, "Negative DOM classinfo?!?"); nsDOMClassInfoID ci_id = (nsDOMClassInfoID)id; ci = NS_GetDOMClassInfoInstance(ci_id); } else { ci = nsDOMClassInfo::GetClassInfoInstance(aNameStruct->mData); }
--- a/dom/base/nsDOMDataChannel.cpp +++ b/dom/base/nsDOMDataChannel.cpp @@ -264,17 +264,17 @@ nsDOMDataChannel::Send(const nsAString& { NS_ConvertUTF16toUTF8 msgString(aData); Send(nullptr, msgString, msgString.Length(), false, aRv); } void nsDOMDataChannel::Send(File& aData, ErrorResult& aRv) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread"); + MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread"); nsCOMPtr<nsIInputStream> msgStream; nsresult rv = aData.GetInternalStream(getter_AddRefs(msgStream)); if (NS_FAILED(rv)) { aRv.Throw(rv); return; } @@ -291,33 +291,33 @@ nsDOMDataChannel::Send(File& aData, Erro } Send(msgStream, EmptyCString(), msgLength, true, aRv); } void nsDOMDataChannel::Send(const ArrayBuffer& aData, ErrorResult& aRv) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread"); + MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread"); aData.ComputeLengthAndData(); static_assert(sizeof(*aData.Data()) == 1, "byte-sized data required"); uint32_t len = aData.Length(); char* data = reinterpret_cast<char*>(aData.Data()); nsDependentCSubstring msgString(data, len); Send(nullptr, msgString, len, true, aRv); } void nsDOMDataChannel::Send(const ArrayBufferView& aData, ErrorResult& aRv) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread"); + MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread"); aData.ComputeLengthAndData(); static_assert(sizeof(*aData.Data()) == 1, "byte-sized data required"); uint32_t len = aData.Length(); char* data = reinterpret_cast<char*>(aData.Data());
--- a/dom/base/nsDOMTokenList.cpp +++ b/dom/base/nsDOMTokenList.cpp @@ -177,17 +177,17 @@ nsDOMTokenList::Add(const nsAString& aTo tokens.AppendElement(aToken); Add(tokens, aError); } void nsDOMTokenList::RemoveInternal(const nsAttrValue* aAttr, const nsTArray<nsString>& aTokens) { - NS_ABORT_IF_FALSE(aAttr, "Need an attribute"); + MOZ_ASSERT(aAttr, "Need an attribute"); nsAutoString input; aAttr->ToString(input); nsAString::const_iterator copyStart, tokenStart, iter, end; input.BeginReading(iter); input.EndReading(end); copyStart = iter; @@ -199,17 +199,17 @@ nsDOMTokenList::RemoveInternal(const nsA // skip whitespace. while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) { ++iter; } if (iter == end) { // At this point we're sure the last seen token (if any) wasn't to be // removed. So the trailing spaces will need to be kept. - NS_ABORT_IF_FALSE(!lastTokenRemoved, "How did this happen?"); + MOZ_ASSERT(!lastTokenRemoved, "How did this happen?"); output.Append(Substring(copyStart, end)); break; } tokenStart = iter; do { ++iter; @@ -222,18 +222,18 @@ nsDOMTokenList::RemoveInternal(const nsA ++iter; } copyStart = iter; lastTokenRemoved = true; } else { if (lastTokenRemoved && !output.IsEmpty()) { - NS_ABORT_IF_FALSE(!nsContentUtils::IsHTMLWhitespace( - output.Last()), "Invalid last output token"); + MOZ_ASSERT(!nsContentUtils::IsHTMLWhitespace(output.Last()), + "Invalid last output token"); output.Append(char16_t(' ')); } lastTokenRemoved = false; output.Append(Substring(copyStart, iter)); copyStart = iter; } }
--- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -1711,19 +1711,19 @@ nsDOMWindowUtils::GetTranslationNodes(ns static TemporaryRef<DataSourceSurface> CanvasToDataSourceSurface(nsIDOMHTMLCanvasElement* aCanvas) { nsCOMPtr<nsINode> node = do_QueryInterface(aCanvas); if (!node) { return nullptr; } - NS_ABORT_IF_FALSE(node->IsElement(), - "An nsINode that implements nsIDOMHTMLCanvasElement should " - "be an element."); + MOZ_ASSERT(node->IsElement(), + "An nsINode that implements nsIDOMHTMLCanvasElement should " + "be an element."); nsLayoutUtils::SurfaceFromElementResult result = nsLayoutUtils::SurfaceFromElement(node->AsElement()); return result.mSourceSurface->GetDataSurface(); } NS_IMETHODIMP nsDOMWindowUtils::CompareCanvases(nsIDOMHTMLCanvasElement *aCanvas1, nsIDOMHTMLCanvasElement *aCanvas2, @@ -2304,17 +2304,17 @@ nsDOMWindowUtils::GetClassName(JS::Handl MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome()); // Our argument must be a non-null object. if (aObject.isPrimitive()) { return NS_ERROR_XPC_BAD_CONVERT_JS; } *aName = NS_strdup(JS_GetClass(aObject.toObjectOrNull())->name); - NS_ABORT_IF_FALSE(*aName, "NS_strdup should be infallible."); + MOZ_ASSERT(*aName, "NS_strdup should be infallible."); return NS_OK; } NS_IMETHODIMP nsDOMWindowUtils::GetVisitedDependentComputedStyle( nsIDOMElement *aElement, const nsAString& aPseudoElement, const nsAString& aPropertyName, nsAString& aResult) { @@ -2693,19 +2693,19 @@ nsDOMWindowUtils::ComputeAnimationDistan NS_ENSURE_SUCCESS(rv, rv); nsCSSProperty property = nsCSSProps::LookupProperty(aProperty, nsCSSProps::eIgnoreEnabledState); if (property != eCSSProperty_UNKNOWN && nsCSSProps::IsShorthand(property)) { property = eCSSProperty_UNKNOWN; } - NS_ABORT_IF_FALSE(property == eCSSProperty_UNKNOWN || - !nsCSSProps::IsShorthand(property), - "should not have shorthand"); + MOZ_ASSERT(property == eCSSProperty_UNKNOWN || + !nsCSSProps::IsShorthand(property), + "should not have shorthand"); StyleAnimationValue v1, v2; if (property == eCSSProperty_UNKNOWN || !ComputeAnimationValue(property, content->AsElement(), aValue1, v1) || !ComputeAnimationValue(property, content->AsElement(), aValue2, v2)) { return NS_ERROR_ILLEGAL_VALUE; }
--- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -1051,18 +1051,18 @@ nsExternalResourceMap::ShowViewers() { mMap.EnumerateRead(ExternalResourceShower, nullptr); } void TransferZoomLevels(nsIDocument* aFromDoc, nsIDocument* aToDoc) { - NS_ABORT_IF_FALSE(aFromDoc && aToDoc, - "transferring zoom levels from/to null doc"); + MOZ_ASSERT(aFromDoc && aToDoc, + "transferring zoom levels from/to null doc"); nsIPresShell* fromShell = aFromDoc->GetShell(); if (!fromShell) return; nsPresContext* fromCtxt = fromShell->GetPresContext(); if (!fromCtxt) return; @@ -1078,18 +1078,18 @@ TransferZoomLevels(nsIDocument* aFromDoc toCtxt->SetFullZoom(fromCtxt->GetFullZoom()); toCtxt->SetBaseMinFontSize(fromCtxt->BaseMinFontSize()); toCtxt->SetTextZoom(fromCtxt->TextZoom()); } void TransferShowingState(nsIDocument* aFromDoc, nsIDocument* aToDoc) { - NS_ABORT_IF_FALSE(aFromDoc && aToDoc, - "transferring showing state from/to null doc"); + MOZ_ASSERT(aFromDoc && aToDoc, + "transferring showing state from/to null doc"); if (aFromDoc->IsShowing()) { aToDoc->OnPageShow(true, nullptr); } } nsresult nsExternalResourceMap::AddExternalResource(nsIURI* aURI, @@ -1619,18 +1619,18 @@ ClearAllBoxObjects(nsIContent* aKey, nsP if (aBoxObject) { aBoxObject->Clear(); } return PL_DHASH_NEXT; } nsIDocument::~nsIDocument() { - NS_ABORT_IF_FALSE(PR_CLIST_IS_EMPTY(&mDOMMediaQueryLists), - "must not have media query lists left"); + MOZ_ASSERT(PR_CLIST_IS_EMPTY(&mDOMMediaQueryLists), + "must not have media query lists left"); if (mNodeInfoManager) { mNodeInfoManager->DropDocumentReference(); } } nsDocument::~nsDocument() @@ -2206,18 +2206,18 @@ nsDocument::Init() mNodeInfoManager = new nsNodeInfoManager(); nsresult rv = mNodeInfoManager->Init(this); NS_ENSURE_SUCCESS(rv, rv); // mNodeInfo keeps NodeInfoManager alive! mNodeInfo = mNodeInfoManager->GetDocumentNodeInfo(); NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_OUT_OF_MEMORY); - NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_NODE, - "Bad NodeType in aNodeInfo"); + MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_NODE, + "Bad NodeType in aNodeInfo"); NS_ASSERTION(OwnerDoc() == this, "Our nodeinfo is busted!"); // If after creation the owner js global is not set for a document // we use the default compartment for this document, instead of creating // wrapper in some random compartment when the document is exposed to js // via some events. nsCOMPtr<nsIGlobalObject> global = xpc::NativeGlobal(xpc::PrivilegedJunkScope()); @@ -4692,21 +4692,21 @@ nsDocument::SetScriptGlobalObject(nsIScr #ifdef DEBUG { nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(aScriptGlobalObject)); NS_ASSERTION(!win || win->IsInnerWindow(), "Script global object must be an inner window!"); } #endif - NS_ABORT_IF_FALSE(aScriptGlobalObject || !mAnimationController || - mAnimationController->IsPausedByType( - nsSMILTimeContainer::PAUSE_PAGEHIDE | - nsSMILTimeContainer::PAUSE_BEGIN), - "Clearing window pointer while animations are unpaused"); + MOZ_ASSERT(aScriptGlobalObject || !mAnimationController || + mAnimationController->IsPausedByType( + nsSMILTimeContainer::PAUSE_PAGEHIDE | + nsSMILTimeContainer::PAUSE_BEGIN), + "Clearing window pointer while animations are unpaused"); if (mScriptGlobalObject && !aScriptGlobalObject) { // We're detaching from the window. We need to grab a pointer to // our layout history state now. mLayoutHistoryState = GetLayoutHistoryState(); if (mPresShell && !EventHandlingSuppressed()) { RevokeAnimationFrameNotifications(); @@ -10426,18 +10426,18 @@ nsDocument::AddImage(imgIRequest* aImage nsresult nsDocument::RemoveImage(imgIRequest* aImage, uint32_t aFlags) { NS_ENSURE_ARG_POINTER(aImage); // Get the old count. It should exist and be > 0. uint32_t count = 0; DebugOnly<bool> found = mImageTracker.Get(aImage, &count); - NS_ABORT_IF_FALSE(found, "Removing image that wasn't in the tracker!"); - NS_ABORT_IF_FALSE(count > 0, "Entry in the cache tracker with count 0!"); + MOZ_ASSERT(found, "Removing image that wasn't in the tracker!"); + MOZ_ASSERT(count > 0, "Entry in the cache tracker with count 0!"); // We're removing, so decrement the count. count--; // If the count is now zero, remove from the tracker. // Otherwise, set the new value. if (count != 0) { mImageTracker.Put(aImage, count);
--- a/dom/base/nsGenericDOMDataNode.cpp +++ b/dom/base/nsGenericDOMDataNode.cpp @@ -37,35 +37,33 @@ #include "nsWrapperCacheInlines.h" using namespace mozilla; using namespace mozilla::dom; nsGenericDOMDataNode::nsGenericDOMDataNode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo) : nsIContent(aNodeInfo) { - NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE || - mNodeInfo->NodeType() == nsIDOMNode::CDATA_SECTION_NODE || - mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE || - mNodeInfo->NodeType() == - nsIDOMNode::PROCESSING_INSTRUCTION_NODE || - mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE, - "Bad NodeType in aNodeInfo"); + MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE || + mNodeInfo->NodeType() == nsIDOMNode::CDATA_SECTION_NODE || + mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE || + mNodeInfo->NodeType() == nsIDOMNode::PROCESSING_INSTRUCTION_NODE || + mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE, + "Bad NodeType in aNodeInfo"); } nsGenericDOMDataNode::nsGenericDOMDataNode(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) : nsIContent(aNodeInfo) { - NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE || - mNodeInfo->NodeType() == nsIDOMNode::CDATA_SECTION_NODE || - mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE || - mNodeInfo->NodeType() == - nsIDOMNode::PROCESSING_INSTRUCTION_NODE || - mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE, - "Bad NodeType in aNodeInfo"); + MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE || + mNodeInfo->NodeType() == nsIDOMNode::CDATA_SECTION_NODE || + mNodeInfo->NodeType() == nsIDOMNode::COMMENT_NODE || + mNodeInfo->NodeType() == nsIDOMNode::PROCESSING_INSTRUCTION_NODE || + mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE, + "Bad NodeType in aNodeInfo"); } nsGenericDOMDataNode::~nsGenericDOMDataNode() { NS_PRECONDITION(!IsInDoc(), "Please remove this from the document properly"); if (GetParent()) { NS_RELEASE(mParent);
--- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -1525,17 +1525,17 @@ nsGlobalWindow::CleanUp() if (IsInnerWindow()) { DisableGamepadUpdates(); mHasGamepad = false; } else { MOZ_ASSERT(!mHasGamepad); } if (mCleanMessageManager) { - NS_ABORT_IF_FALSE(mIsChrome, "only chrome should have msg manager cleaned"); + MOZ_ASSERT(mIsChrome, "only chrome should have msg manager cleaned"); nsGlobalChromeWindow *asChrome = static_cast<nsGlobalChromeWindow*>(this); if (asChrome->mMessageManager) { static_cast<nsFrameMessageManager*>( asChrome->mMessageManager.get())->Disconnect(); } } mArguments = nullptr; @@ -8108,36 +8108,36 @@ PopulateMessagePortList(MessagePortBase* array->AppendElement(aKey); return PL_DHASH_NEXT; } NS_IMETHODIMP PostMessageEvent::Run() { - NS_ABORT_IF_FALSE(mTargetWindow->IsOuterWindow(), - "should have been passed an outer window!"); - NS_ABORT_IF_FALSE(!mSource || mSource->IsOuterWindow(), - "should have been passed an outer window!"); + MOZ_ASSERT(mTargetWindow->IsOuterWindow(), + "should have been passed an outer window!"); + MOZ_ASSERT(!mSource || mSource->IsOuterWindow(), + "should have been passed an outer window!"); AutoJSAPI jsapi; jsapi.Init(); JSContext* cx = jsapi.cx(); // If we bailed before this point we're going to leak mMessage, but // that's probably better than crashing. nsRefPtr<nsGlobalWindow> targetWindow; if (mTargetWindow->IsClosedOrClosing() || !(targetWindow = mTargetWindow->GetCurrentInnerWindowInternal()) || targetWindow->IsClosedOrClosing()) return NS_OK; - NS_ABORT_IF_FALSE(targetWindow->IsInnerWindow(), - "we ordered an inner window!"); + MOZ_ASSERT(targetWindow->IsInnerWindow(), + "we ordered an inner window!"); JSAutoCompartment ac(cx, targetWindow->GetWrapperPreserveColor()); // Ensure that any origin which might have been provided is the origin of this // window's document. Note that we do this *now* instead of when postMessage // is called because the target window might have been navigated to a // different location between then and now. If this check happened when // postMessage was called, it would be fairly easy for a malicious webpage to // intercept messages intended for another site by carefully timing navigation @@ -8224,18 +8224,18 @@ nsGlobalWindow::PostMessageMoz(JSContext // // http://www.whatwg.org/specs/web-apps/current-work/multipage/section-crossDocumentMessages.html // // First, get the caller's window nsRefPtr<nsGlobalWindow> callerInnerWin = CallerInnerWindow(); nsIPrincipal* callerPrin; if (callerInnerWin) { - NS_ABORT_IF_FALSE(callerInnerWin->IsInnerWindow(), - "should have gotten an inner window here"); + MOZ_ASSERT(callerInnerWin->IsInnerWindow(), + "should have gotten an inner window here"); // Compute the caller's origin either from its principal or, in the case the // principal doesn't carry a URI (e.g. the system principal), the caller's // document. We must get this now instead of when the event is created and // dispatched, because ultimately it is the identity of the calling window // *now* that determines who sent the message (and not an identity which might // have changed due to intervening navigations). callerPrin = callerInnerWin->GetPrincipal();
--- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -1713,18 +1713,18 @@ protected: mGroupMessageManagers(1) { mIsChrome = true; mCleanMessageManager = true; } ~nsGlobalChromeWindow() { - NS_ABORT_IF_FALSE(mCleanMessageManager, - "chrome windows may always disconnect the msg manager"); + MOZ_ASSERT(mCleanMessageManager, + "chrome windows may always disconnect the msg manager"); mGroupMessageManagers.EnumerateRead(DisconnectGroupMessageManager, nullptr); mGroupMessageManagers.Clear(); if (mMessageManager) { static_cast<nsFrameMessageManager *>( mMessageManager.get())->Disconnect(); }
--- a/dom/base/nsHostObjectURI.cpp +++ b/dom/base/nsHostObjectURI.cpp @@ -89,18 +89,17 @@ nsHostObjectURI::CloneInternal(nsSimpleU nsCOMPtr<nsIURI> simpleClone; nsresult rv = nsSimpleURI::CloneInternal(aRefHandlingMode, getter_AddRefs(simpleClone)); NS_ENSURE_SUCCESS(rv, rv); #ifdef DEBUG nsRefPtr<nsHostObjectURI> uriCheck; rv = simpleClone->QueryInterface(kHOSTOBJECTURICID, getter_AddRefs(uriCheck)); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) && uriCheck, - "Unexpected!"); + MOZ_ASSERT(NS_SUCCEEDED(rv) && uriCheck); #endif nsHostObjectURI* u = static_cast<nsHostObjectURI*>(simpleClone.get()); u->mPrincipal = mPrincipal; simpleClone.forget(aClone); return NS_OK;
--- a/dom/base/nsINode.cpp +++ b/dom/base/nsINode.cpp @@ -1057,17 +1057,17 @@ nsINode::IsEqualNode(nsINode* aOther) docType2->GetInternalSubset(string2); if (!string1.Equals(string2)) { return false; } break; } default: - NS_ABORT_IF_FALSE(false, "Unknown node type"); + MOZ_ASSERT(false, "Unknown node type"); } nsINode* nextNode = node1->GetFirstChild(); if (nextNode) { node1 = nextNode; node2 = node2->GetFirstChild(); } else { @@ -1352,17 +1352,17 @@ nsINode::Traverse(nsINode *tmp, nsCycleC // If we're in a black document, return early. if ((currentDoc && currentDoc->IsBlack())) { return false; } // If we're not in anonymous content and we have a black parent, // return early. nsIContent* parent = tmp->GetParent(); if (parent && !parent->UnoptimizableCCNode() && parent->IsBlack()) { - NS_ABORT_IF_FALSE(parent->IndexOf(tmp) >= 0, "Parent doesn't own us?"); + MOZ_ASSERT(parent->IndexOf(tmp) >= 0, "Parent doesn't own us?"); return false; } } } } NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNodeInfo) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(GetParent()) @@ -2579,17 +2579,17 @@ FindMatchingElements(nsINode* aRoot, nsC aList.AppendElement(results.ElementAt(i)); } } } struct ElementHolder { ElementHolder() : mElement(nullptr) {} void AppendElement(Element* aElement) { - NS_ABORT_IF_FALSE(!mElement, "Should only get one element"); + MOZ_ASSERT(!mElement, "Should only get one element"); mElement = aElement; } void SetCapacity(uint32_t aCapacity) { MOZ_CRASH("Don't call me!"); } uint32_t Length() { return 0; } Element* ElementAt(uint32_t aIndex) { return nullptr; } Element* mElement; };
--- a/dom/base/nsImageLoadingContent.cpp +++ b/dom/base/nsImageLoadingContent.cpp @@ -131,17 +131,17 @@ nsImageLoadingContent::Notify(imgIReques if (aType == imgINotificationObserver::UNLOCKED_DRAW) { OnUnlockedDraw(); return NS_OK; } if (aType == imgINotificationObserver::LOAD_COMPLETE) { // We should definitely have a request here - NS_ABORT_IF_FALSE(aRequest, "no request?"); + MOZ_ASSERT(aRequest, "no request?"); NS_PRECONDITION(aRequest == mCurrentRequest || aRequest == mPendingRequest, "Unknown request"); } { nsAutoScriptBlocker scriptBlocker; @@ -222,18 +222,18 @@ nsImageLoadingContent::OnLoadComplete(im // Our state may change. Watch it. AutoStateChanger changer(this, true); // If the pending request is loaded, switch to it. if (aRequest == mPendingRequest) { MakePendingRequestCurrent(); } - NS_ABORT_IF_FALSE(aRequest == mCurrentRequest, - "One way or another, we should be current by now"); + MOZ_ASSERT(aRequest == mCurrentRequest, + "One way or another, we should be current by now"); // We just loaded all the data we're going to get. If we're visible and // haven't done an initial paint (*), we want to make sure the image starts // decoding immediately, for two reasons: // // 1) This image is sitting idle but might need to be decoded as soon as we // start painting, in which case we've wasted time. // @@ -885,19 +885,19 @@ nsImageLoadingContent::LoadImage(nsIURI* AutoStateChanger changer(this, aNotify); // Sanity check. // // We use the principal of aDocument to avoid having to QI |this| an extra // time. It should always be the same as the principal of this node. #ifdef DEBUG nsCOMPtr<nsIContent> thisContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this)); - NS_ABORT_IF_FALSE(thisContent && - thisContent->NodePrincipal() == aDocument->NodePrincipal(), - "Principal mismatch?"); + MOZ_ASSERT(thisContent && + thisContent->NodePrincipal() == aDocument->NodePrincipal(), + "Principal mismatch?"); #endif // Are we blocked? int16_t cpDecision = nsIContentPolicy::REJECT_REQUEST; nsContentPolicyType policyType = PolicyTypeForLoad(aImageLoadType); nsContentUtils::CanLoadImage(aNewURI, static_cast<nsIImageLoadingContent*>(this), @@ -1214,17 +1214,17 @@ nsImageLoadingContent::PrepareNextReques // Otherwise, make it pending. return PreparePendingRequest(aImageLoadType); } void nsImageLoadingContent::SetBlockedRequest(nsIURI* aURI, int16_t aContentDecision) { // Sanity - NS_ABORT_IF_FALSE(!NS_CP_ACCEPTED(aContentDecision), "Blocked but not?"); + MOZ_ASSERT(!NS_CP_ACCEPTED(aContentDecision), "Blocked but not?"); // We do some slightly illogical stuff here to maintain consistency with // old behavior that people probably depend on. Even in the case where the // new image is blocked, the old one should really be canceled with the // reason "image source changed". However, apparently there's some abuse // over in nsImageFrame where the displaying of the "broken" icon for the // next image depends on the cancel reason of the previous image. ugh. ClearPendingRequest(NS_ERROR_IMAGE_BLOCKED, REQUEST_DISCARD); @@ -1340,18 +1340,18 @@ nsImageLoadingContent::ClearCurrentReque { if (!mCurrentRequest) { // Even if we didn't have a current request, we might have been keeping // a URI and flags as a placeholder for a failed load. Clear that now. mCurrentURI = nullptr; mCurrentRequestFlags = 0; return; } - NS_ABORT_IF_FALSE(!mCurrentURI, - "Shouldn't have both mCurrentRequest and mCurrentURI!"); + MOZ_ASSERT(!mCurrentURI, + "Shouldn't have both mCurrentRequest and mCurrentURI!"); // Deregister this image from the refresh driver so it no longer receives // notifications. nsLayoutUtils::DeregisterImageRequest(GetFramePresContext(), mCurrentRequest, &mCurrentRequestRegistered); // Clean up the request. UntrackImage(mCurrentRequest, aFlags);
--- a/dom/base/nsPerformance.cpp +++ b/dom/base/nsPerformance.cpp @@ -593,28 +593,28 @@ nsPerformance::AddEntry(nsIHttpChannel* } } bool nsPerformance::PerformanceEntryComparator::Equals( const PerformanceEntry* aElem1, const PerformanceEntry* aElem2) const { - NS_ABORT_IF_FALSE(aElem1 && aElem2, - "Trying to compare null performance entries"); + MOZ_ASSERT(aElem1 && aElem2, + "Trying to compare null performance entries"); return aElem1->StartTime() == aElem2->StartTime(); } bool nsPerformance::PerformanceEntryComparator::LessThan( const PerformanceEntry* aElem1, const PerformanceEntry* aElem2) const { - NS_ABORT_IF_FALSE(aElem1 && aElem2, - "Trying to compare null performance entries"); + MOZ_ASSERT(aElem1 && aElem2, + "Trying to compare null performance entries"); return aElem1->StartTime() < aElem2->StartTime(); } void nsPerformance::InsertPerformanceEntry(PerformanceEntry* aEntry) { MOZ_ASSERT(aEntry); MOZ_ASSERT(mEntries.Length() < mPrimaryBufferSize);
--- a/dom/base/nsReferencedElement.cpp +++ b/dom/base/nsReferencedElement.cpp @@ -13,17 +13,17 @@ #include "nsIDOMNode.h" #include "nsIDOMElement.h" #include "nsCycleCollectionParticipant.h" void nsReferencedElement::Reset(nsIContent* aFromContent, nsIURI* aURI, bool aWatch, bool aReferenceImage) { - NS_ABORT_IF_FALSE(aFromContent, "Reset() expects non-null content pointer"); + MOZ_ASSERT(aFromContent, "Reset() expects non-null content pointer"); Unlink(); if (!aURI) return; nsAutoCString refPart; aURI->GetRef(refPart);
--- a/dom/base/nsTextNode.h +++ b/dom/base/nsTextNode.h @@ -21,18 +21,18 @@ class nsNodeInfoManager; * Class used to implement DOM text nodes */ class nsTextNode : public mozilla::dom::Text, public nsIDOMText { private: void Init() { - NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE, - "Bad NodeType in aNodeInfo"); + MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::TEXT_NODE, + "Bad NodeType in aNodeInfo"); } public: explicit nsTextNode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo) : mozilla::dom::Text(aNodeInfo) { Init(); }
--- a/dom/base/nsTreeSanitizer.cpp +++ b/dom/base/nsTreeSanitizer.cpp @@ -1098,18 +1098,18 @@ nsTreeSanitizer::SanitizeStyleSheet(cons sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI); sheet->SetPrincipal(aDocument->NodePrincipal()); // Create the CSS parser, and parse the CSS text. nsCSSParser parser(nullptr, sheet); rv = parser.ParseSheet(aOriginal, aDocument->GetDocumentURI(), aBaseURI, aDocument->NodePrincipal(), 0, false); NS_ENSURE_SUCCESS(rv, true); // Mark the sheet as complete. - NS_ABORT_IF_FALSE(!sheet->IsModified(), - "should not get marked modified during parsing"); + MOZ_ASSERT(!sheet->IsModified(), + "should not get marked modified during parsing"); sheet->SetComplete(); // Loop through all the rules found in the CSS text int32_t ruleCount = sheet->StyleRuleCount(); for (int32_t i = 0; i < ruleCount; ++i) { mozilla::css::Rule* rule = sheet->GetStyleRuleAt(i); if (!rule) continue; switch (rule->GetType()) {
--- a/dom/base/nsXMLHttpRequest.cpp +++ b/dom/base/nsXMLHttpRequest.cpp @@ -316,17 +316,17 @@ nsXMLHttpRequest::~nsXMLHttpRequest() { mState |= XML_HTTP_REQUEST_DELETED; if (mState & (XML_HTTP_REQUEST_SENT | XML_HTTP_REQUEST_LOADING)) { Abort(); } - NS_ABORT_IF_FALSE(!(mState & XML_HTTP_REQUEST_SYNCLOOPING), "we rather crash than hang"); + MOZ_ASSERT(!(mState & XML_HTTP_REQUEST_SYNCLOOPING), "we rather crash than hang"); mState &= ~XML_HTTP_REQUEST_SYNCLOOPING; mResultJSON.setUndefined(); mResultArrayBuffer = nullptr; mozilla::DropJSObjects(this); } void @@ -1910,17 +1910,17 @@ NS_IMETHODIMP nsXMLHttpRequest::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *inStr, uint64_t sourceOffset, uint32_t count) { NS_ENSURE_ARG_POINTER(inStr); - NS_ABORT_IF_FALSE(mContext.get() == ctxt,"start context different from OnDataAvailable context"); + MOZ_ASSERT(mContext.get() == ctxt,"start context different from OnDataAvailable context"); mProgressSinceLastProgressEvent = true; bool cancelable = false; if ((mResponseType == XML_HTTP_RESPONSE_TYPE_BLOB || mResponseType == XML_HTTP_RESPONSE_TYPE_MOZ_BLOB) && !mDOMFile) { cancelable = CreateDOMFile(request); // The nsIStreamListener contract mandates us @@ -3231,18 +3231,18 @@ nsXMLHttpRequest::SetTimeout(uint32_t aT if (mRequestSentTime) { StartTimeoutTimer(); } } void nsXMLHttpRequest::StartTimeoutTimer() { - NS_ABORT_IF_FALSE(mRequestSentTime, - "StartTimeoutTimer mustn't be called before the request was sent!"); + MOZ_ASSERT(mRequestSentTime, + "StartTimeoutTimer mustn't be called before the request was sent!"); if (mState & XML_HTTP_REQUEST_DONE) { // do nothing! return; } if (mTimeoutTimer) { mTimeoutTimer->Cancel(); }
--- a/dom/events/ContentEventHandler.cpp +++ b/dom/events/ContentEventHandler.cpp @@ -246,19 +246,18 @@ static uint32_t CountNewlinesInXPLength( { NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT), "aContent is not a text node!"); const nsTextFragment* text = aContent->GetText(); if (!text) { return 0; } // For automated tests, we should abort on debug build. - NS_ABORT_IF_FALSE( - (aXPLength == UINT32_MAX || aXPLength <= text->GetLength()), - "aXPLength is out-of-bounds"); + MOZ_ASSERT(aXPLength == UINT32_MAX || aXPLength <= text->GetLength(), + "aXPLength is out-of-bounds"); const uint32_t length = std::min(aXPLength, text->GetLength()); uint32_t newlines = 0; for (uint32_t i = 0; i < length; ++i) { if (text->CharAt(i) == '\n') { ++newlines; } } return newlines; @@ -278,17 +277,17 @@ static uint32_t CountNewlinesInNativeLen (aNativeLength == UINT32_MAX || aNativeLength <= text->GetLength() * 2), "aNativeLength is unexpected value"); const uint32_t xpLength = text->GetLength(); uint32_t newlines = 0; for (uint32_t i = 0, nativeOffset = 0; i < xpLength && nativeOffset < aNativeLength; ++i, ++nativeOffset) { // For automated tests, we should abort on debug build. - NS_ABORT_IF_FALSE(i < text->GetLength(), "i is out-of-bounds"); + MOZ_ASSERT(i < text->GetLength(), "i is out-of-bounds"); if (text->CharAt(i) == '\n') { ++newlines; ++nativeOffset; } } return newlines; } #endif
--- a/dom/html/HTMLImageElement.cpp +++ b/dom/html/HTMLImageElement.cpp @@ -396,18 +396,18 @@ HTMLImageElement::BeforeSetAttr(int32_t nsresult HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, const nsAttrValue* aValue, bool aNotify) { if (aNameSpaceID == kNameSpaceID_None && mForm && (aName == nsGkAtoms::name || aName == nsGkAtoms::id) && aValue && !aValue->IsEmptyString()) { // add the image to the hashtable as needed - NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eAtom, - "Expected atom value for name/id"); + MOZ_ASSERT(aValue->Type() == nsAttrValue::eAtom, + "Expected atom value for name/id"); mForm->AddImageElementToTable(this, nsDependentAtomString(aValue->GetAtomValue())); } // Handle src/srcset/crossorigin updates. If aNotify is false, we are coming // from the parser or some such place; we'll get bound after all the // attributes have been set, so we'll do the image load from BindToTree.
--- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -270,17 +270,17 @@ class HTMLMediaElement::MediaLoadListene NS_DECL_NSIOBSERVER NS_DECL_NSIINTERFACEREQUESTOR public: explicit MediaLoadListener(HTMLMediaElement* aElement) : mElement(aElement), mLoadID(aElement->GetCurrentLoadID()) { - NS_ABORT_IF_FALSE(mElement, "Must pass an element to call back"); + MOZ_ASSERT(mElement, "Must pass an element to call back"); } private: nsRefPtr<HTMLMediaElement> mElement; nsCOMPtr<nsIStreamListener> mNextListener; uint32_t mLoadID; };
--- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -707,18 +707,18 @@ nsGenericHTMLElement::GetHrefURIForAncho } nsresult nsGenericHTMLElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName, const nsAttrValue* aValue, bool aNotify) { if (aNamespaceID == kNameSpaceID_None) { if (IsEventAttributeName(aName) && aValue) { - NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eString, - "Expected string value for script body"); + MOZ_ASSERT(aValue->Type() == nsAttrValue::eString, + "Expected string value for script body"); nsresult rv = SetEventHandler(aName, aValue->GetStringValue()); NS_ENSURE_SUCCESS(rv, rv); } else if (aNotify && aName == nsGkAtoms::spellcheck) { SyncEditorsOnSubtree(this); } else if (aName == nsGkAtoms::dir) { Directionality dir = eDir_LTR; @@ -2147,18 +2147,18 @@ nsresult nsGenericHTMLFormElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, const nsAttrValue* aValue, bool aNotify) { if (aNameSpaceID == kNameSpaceID_None) { // add the control to the hashtable as needed if (mForm && (aName == nsGkAtoms::name || aName == nsGkAtoms::id) && aValue && !aValue->IsEmptyString()) { - NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eAtom, - "Expected atom value for name/id"); + MOZ_ASSERT(aValue->Type() == nsAttrValue::eAtom, + "Expected atom value for name/id"); mForm->AddElementToTable(this, nsDependentAtomString(aValue->GetAtomValue())); } if (mForm && aName == nsGkAtoms::type) { nsAutoString tmp; GetAttr(kNameSpaceID_None, nsGkAtoms::name, tmp);
--- a/dom/html/nsHTMLDocument.cpp +++ b/dom/html/nsHTMLDocument.cpp @@ -1894,18 +1894,18 @@ nsHTMLDocument::WriteCommon(JSContext *c 1, getter_AddRefs(ignored)); // If Open() fails, or if it didn't create a parser (as it won't // if the user chose to not discard the current document through // onbeforeunload), don't write anything. if (NS_FAILED(rv) || !mParser) { return rv; } - NS_ABORT_IF_FALSE(!JS_IsExceptionPending(cx), - "Open() succeeded but JS exception is pending"); + MOZ_ASSERT(!JS_IsExceptionPending(cx), + "Open() succeeded but JS exception is pending"); } static NS_NAMED_LITERAL_STRING(new_line, "\n"); // Save the data in cache if the write isn't from within the doc if (mWyciwygChannel && !key) { if (!aText.IsEmpty()) { mWyciwygChannel->WriteToCacheEntry(aText); @@ -2768,17 +2768,17 @@ nsHTMLDocument::EditingStateChanged() NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr<nsIEditor> existingEditor; editSession->GetEditorForWindow(window, getter_AddRefs(existingEditor)); if (existingEditor) { // We might already have an editor if it was set up for mail, let's see // if this is actually the case. nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(existingEditor); - NS_ABORT_IF_FALSE(htmlEditor, "If we have an editor, it must be an HTML editor"); + MOZ_ASSERT(htmlEditor, "If we have an editor, it must be an HTML editor"); uint32_t flags = 0; existingEditor->GetFlags(&flags); if (flags & nsIPlaintextEditor::eEditorMailMask) { // We already have a mail editor, then we should not attempt to create // another one. return NS_OK; } }
--- a/dom/html/nsTextEditorState.cpp +++ b/dom/html/nsTextEditorState.cpp @@ -2102,17 +2102,17 @@ nsTextEditorState::UpdatePlaceholderVisi if (mBoundFrame && aNotify) { mBoundFrame->InvalidateFrame(); } } void nsTextEditorState::HideSelectionIfBlurred() { - NS_ABORT_IF_FALSE(mSelCon, "Should have a selection controller if we have a frame!"); + MOZ_ASSERT(mSelCon, "Should have a selection controller if we have a frame!"); nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement); if (!nsContentUtils::IsFocusedContent(content)) { mSelCon->SetDisplaySelection(nsISelectionController::SELECTION_HIDDEN); } } NS_IMPL_ISUPPORTS(nsAnonDivObserver, nsIMutationObserver)
--- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -1951,18 +1951,18 @@ ContentChild::RecvUpdateDictionaryList(I bool ContentChild::RecvAddPermission(const IPC::Permission& permission) { #if MOZ_PERMISSIONS nsCOMPtr<nsIPermissionManager> permissionManagerIface = services::GetPermissionManager(); nsPermissionManager* permissionManager = static_cast<nsPermissionManager*>(permissionManagerIface.get()); - NS_ABORT_IF_FALSE(permissionManager, - "We have no permissionManager in the Content process !"); + MOZ_ASSERT(permissionManager, + "We have no permissionManager in the Content process !"); nsCOMPtr<nsIURI> uri; NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("http://") + nsCString(permission.host)); NS_ENSURE_TRUE(uri, true); nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager(); MOZ_ASSERT(secMan);
--- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -2420,22 +2420,22 @@ ContentParent::RecvReadFontList(Infallib bool ContentParent::RecvReadPermissions(InfallibleTArray<IPC::Permission>* aPermissions) { #ifdef MOZ_PERMISSIONS nsCOMPtr<nsIPermissionManager> permissionManagerIface = services::GetPermissionManager(); nsPermissionManager* permissionManager = static_cast<nsPermissionManager*>(permissionManagerIface.get()); - NS_ABORT_IF_FALSE(permissionManager, - "We have no permissionManager in the Chrome process !"); + MOZ_ASSERT(permissionManager, + "We have no permissionManager in the Chrome process !"); nsCOMPtr<nsISimpleEnumerator> enumerator; DebugOnly<nsresult> rv = permissionManager->GetEnumerator(getter_AddRefs(enumerator)); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Could not get enumerator!"); + MOZ_ASSERT(NS_SUCCEEDED(rv), "Could not get enumerator!"); while(1) { bool hasMore; enumerator->HasMoreElements(&hasMore); if (!hasMore) break; nsCOMPtr<nsISupports> supp; enumerator->GetNext(getter_AddRefs(supp)); @@ -4420,18 +4420,18 @@ ContentParent::RecvRemoveIdleObserver(co } bool ContentParent::RecvBackUpXResources(const FileDescriptor& aXSocketFd) { #ifndef MOZ_X11 NS_RUNTIMEABORT("This message only makes sense on X11 platforms"); #else - NS_ABORT_IF_FALSE(0 > mChildXSocketFdDup.get(), - "Already backed up X resources??"); + MOZ_ASSERT(0 > mChildXSocketFdDup.get(), + "Already backed up X resources??"); mChildXSocketFdDup.forget(); if (aXSocketFd.IsValid()) { mChildXSocketFdDup.reset(aXSocketFd.PlatformHandle()); } #endif return true; }
--- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -3168,18 +3168,18 @@ TabChild::InitRenderingState(const Scrol // This results in |remoteFrame| being deleted. PRenderFrameChild::Send__delete__(remoteFrame); return false; } ShadowLayerForwarder* lf = mWidget->GetLayerManager(shadowManager, mTextureFactoryIdentifier.mParentBackend) ->AsShadowForwarder(); - NS_ABORT_IF_FALSE(lf && lf->HasShadowManager(), - "PuppetWidget should have shadow manager"); + MOZ_ASSERT(lf && lf->HasShadowManager(), + "PuppetWidget should have shadow manager"); lf->IdentifyTextureHost(mTextureFactoryIdentifier); ImageBridgeChild::IdentifyCompositorTextureHost(mTextureFactoryIdentifier); mRemoteFrame = remoteFrame; if (aLayersId != 0) { if (!sTabChildren) { sTabChildren = new TabChildMap; }
--- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -2161,29 +2161,29 @@ TabParent::RecvIsParentWindowMainWidgetV return NS_SUCCEEDED(rv); } bool TabParent::RecvGetDPI(float* aValue) { TryCacheDPIAndScale(); - NS_ABORT_IF_FALSE(mDPI > 0, - "Must not ask for DPI before OwnerElement is received!"); + MOZ_ASSERT(mDPI > 0, + "Must not ask for DPI before OwnerElement is received!"); *aValue = mDPI; return true; } bool TabParent::RecvGetDefaultScale(double* aValue) { TryCacheDPIAndScale(); - NS_ABORT_IF_FALSE(mDefaultScale.scale > 0, - "Must not ask for scale before OwnerElement is received!"); + MOZ_ASSERT(mDefaultScale.scale > 0, + "Must not ask for scale before OwnerElement is received!"); *aValue = mDefaultScale.scale; return true; } bool TabParent::RecvGetWidgetNativeData(WindowsHandle* aValue) { *aValue = 0;
--- a/dom/json/nsJSON.cpp +++ b/dom/json/nsJSON.cpp @@ -640,17 +640,17 @@ nsJSONListener::ConsumeConverted(const c rv = mDecoder->GetMaxLength(aBuffer, srcLen, &unicharLength); NS_ENSURE_SUCCESS(rv, rv); char16_t* endelems = mBufferedChars.AppendElements(unicharLength); int32_t preLength = unicharLength; rv = mDecoder->Convert(aBuffer, &srcLen, endelems, &unicharLength); if (NS_FAILED(rv)) return rv; - NS_ABORT_IF_FALSE(preLength >= unicharLength, "GetMaxLength lied"); + MOZ_ASSERT(preLength >= unicharLength, "GetMaxLength lied"); if (preLength > unicharLength) mBufferedChars.TruncateLength(mBufferedChars.Length() - (preLength - unicharLength)); return NS_OK; } nsresult nsJSONListener::Consume(const char16_t* aBuffer, uint32_t aByteLength) {
--- a/dom/media/AudioStream.cpp +++ b/dom/media/AudioStream.cpp @@ -366,17 +366,17 @@ AudioStream::Init(int32_t aNumChannels, mBytesPerFrame = sizeof(AudioDataValue) * mOutChannels; mAudioClock.Init(); // Size mBuffer for one second of audio. This value is arbitrary, and was // selected based on the observed behaviour of the existing AudioStream // implementations. uint32_t bufferLimit = FramesToBytes(aRate); - NS_ABORT_IF_FALSE(bufferLimit % mBytesPerFrame == 0, "Must buffer complete frames"); + MOZ_ASSERT(bufferLimit % mBytesPerFrame == 0, "Must buffer complete frames"); mBuffer.SetCapacity(bufferLimit); if (aLatencyRequest == LowLatency) { // Don't block this thread to initialize a cubeb stream. // When this is done, it will start callbacks from Cubeb. Those will // cause us to move from INITIALIZED to RUNNING. Until then, we // can't access any cubeb functions. // Use a RefPtr to avoid leaks if Dispatch fails @@ -627,18 +627,18 @@ AudioStream::Write(const AudioDataValue* timeMs = 0; } struct Inserts insert = { timeMs, aFrames}; mInserts.AppendElement(insert); } while (bytesToCopy > 0) { uint32_t available = std::min(bytesToCopy, mBuffer.Available()); - NS_ABORT_IF_FALSE(available % mBytesPerFrame == 0, - "Must copy complete frames."); + MOZ_ASSERT(available % mBytesPerFrame == 0, + "Must copy complete frames."); mBuffer.AppendElements(src, available); src += available; bytesToCopy -= available; if (bytesToCopy > 0) { // Careful - the CubebInit thread may not have gotten to STARTED yet if ((mState == INITIALIZED || mState == STARTED) && mLatencyRequest == LowLatency) { @@ -673,24 +673,24 @@ AudioStream::Write(const AudioDataValue* mWritten += aFrames; return NS_OK; } uint32_t AudioStream::Available() { MonitorAutoLock mon(mMonitor); - NS_ABORT_IF_FALSE(mBuffer.Length() % mBytesPerFrame == 0, "Buffer invariant violated."); + MOZ_ASSERT(mBuffer.Length() % mBytesPerFrame == 0, "Buffer invariant violated."); return BytesToFrames(mBuffer.Available()); } void AudioStream::SetVolume(double aVolume) { - NS_ABORT_IF_FALSE(aVolume >= 0.0 && aVolume <= 1.0, "Invalid volume"); + MOZ_ASSERT(aVolume >= 0.0 && aVolume <= 1.0, "Invalid volume"); if (cubeb_stream_set_volume(mCubebStream.get(), aVolume * CubebUtils::GetVolumeScale()) != CUBEB_OK) { NS_WARNING("Could not change volume on cubeb stream."); } } void AudioStream::SetMicrophoneActive(bool aActive) @@ -1030,17 +1030,17 @@ AudioStream::Reset() params.format = CUBEB_SAMPLE_FLOAT32NE; } mBytesPerFrame = sizeof(AudioDataValue) * mOutChannels; // Size mBuffer for one second of audio. This value is arbitrary, and was // selected based on the observed behaviour of the existing AudioStream // implementations. uint32_t bufferLimit = FramesToBytes(mInRate); - NS_ABORT_IF_FALSE(bufferLimit % mBytesPerFrame == 0, "Must buffer complete frames"); + MOZ_ASSERT(bufferLimit % mBytesPerFrame == 0, "Must buffer complete frames"); mBuffer.Reset(); mBuffer.SetCapacity(bufferLimit); // Don't block this thread to initialize a cubeb stream. // When this is done, it will start callbacks from Cubeb. Those will // cause us to move from INITIALIZED to RUNNING. Until then, we // can't access any cubeb functions. // Use a RefPtr to avoid leaks if Dispatch fails @@ -1049,17 +1049,17 @@ AudioStream::Reset() } long AudioStream::DataCallback(void* aBuffer, long aFrames) { MonitorAutoLock mon(mMonitor); MOZ_ASSERT(mState != SHUTDOWN, "No data callback after shutdown"); uint32_t available = std::min(static_cast<uint32_t>(FramesToBytes(aFrames)), mBuffer.Length()); - NS_ABORT_IF_FALSE(available % mBytesPerFrame == 0, "Must copy complete frames"); + MOZ_ASSERT(available % mBytesPerFrame == 0, "Must copy complete frames"); AudioDataValue* output = reinterpret_cast<AudioDataValue*>(aBuffer); uint32_t underrunFrames = 0; uint32_t servicedFrames = 0; int64_t insertTime; mShouldDropFrames = false; // NOTE: wasapi (others?) can call us back *after* stop()/Shutdown() (mState == SHUTDOWN) @@ -1108,17 +1108,17 @@ AudioStream::DataCallback(void* aBuffer, servicedFrames = GetUnprocessedWithSilencePadding(output, aFrames, insertTime); } else { servicedFrames = GetUnprocessed(output, aFrames, insertTime); } } else { servicedFrames = GetTimeStretched(output, aFrames, insertTime); } - NS_ABORT_IF_FALSE(mBuffer.Length() % mBytesPerFrame == 0, "Must copy complete frames"); + MOZ_ASSERT(mBuffer.Length() % mBytesPerFrame == 0, "Must copy complete frames"); // Notify any blocked Write() call that more space is available in mBuffer. mon.NotifyAll(); } else { GetBufferInsertTime(insertTime); } underrunFrames = aFrames - servicedFrames;
--- a/dom/media/AudioStream.h +++ b/dom/media/AudioStream.h @@ -83,17 +83,17 @@ class CircularByteBuffer public: CircularByteBuffer() : mBuffer(nullptr), mCapacity(0), mStart(0), mCount(0) {} // Set the capacity of the buffer in bytes. Must be called before any // call to append or pop elements. void SetCapacity(uint32_t aCapacity) { - NS_ABORT_IF_FALSE(!mBuffer, "Buffer allocated."); + MOZ_ASSERT(!mBuffer, "Buffer allocated."); mCapacity = aCapacity; mBuffer = new uint8_t[mCapacity]; } uint32_t Length() { return mCount; } @@ -103,48 +103,48 @@ public: uint32_t Available() { return Capacity() - Length(); } // Append aLength bytes from aSrc to the buffer. Caller must check that // sufficient space is available. void AppendElements(const uint8_t* aSrc, uint32_t aLength) { - NS_ABORT_IF_FALSE(mBuffer && mCapacity, "Buffer not initialized."); - NS_ABORT_IF_FALSE(aLength <= Available(), "Buffer full."); + MOZ_ASSERT(mBuffer && mCapacity, "Buffer not initialized."); + MOZ_ASSERT(aLength <= Available(), "Buffer full."); uint32_t end = (mStart + mCount) % mCapacity; uint32_t toCopy = std::min(mCapacity - end, aLength); memcpy(&mBuffer[end], aSrc, toCopy); memcpy(&mBuffer[0], aSrc + toCopy, aLength - toCopy); mCount += aLength; } // Remove aSize bytes from the buffer. Caller must check returned size in // aSize{1,2} before using the pointer returned in aData{1,2}. Caller // must not specify an aSize larger than Length(). void PopElements(uint32_t aSize, void** aData1, uint32_t* aSize1, void** aData2, uint32_t* aSize2) { - NS_ABORT_IF_FALSE(mBuffer && mCapacity, "Buffer not initialized."); - NS_ABORT_IF_FALSE(aSize <= Length(), "Request too large."); + MOZ_ASSERT(mBuffer && mCapacity, "Buffer not initialized."); + MOZ_ASSERT(aSize <= Length(), "Request too large."); *aData1 = &mBuffer[mStart]; *aSize1 = std::min(mCapacity - mStart, aSize); *aData2 = &mBuffer[0]; *aSize2 = aSize - *aSize1; mCount -= *aSize1 + *aSize2; mStart += *aSize1 + *aSize2; mStart %= mCapacity; } // Throw away all but aSize bytes from the buffer. Returns new size, which // may be less than aSize uint32_t ContractTo(uint32_t aSize) { - NS_ABORT_IF_FALSE(mBuffer && mCapacity, "Buffer not initialized."); + MOZ_ASSERT(mBuffer && mCapacity, "Buffer not initialized."); if (aSize >= mCount) { return mCount; } mStart += (mCount - aSize); mCount = aSize; mStart %= mCapacity; return mCount; }
--- a/dom/media/FileBlockCache.cpp +++ b/dom/media/FileBlockCache.cpp @@ -207,18 +207,19 @@ nsresult FileBlockCache::Run() // This also ensures we will insert a new index into mChangeIndexList // when this happens. // Hold a reference to the change, in case another change // overwrites the mBlockChanges entry for this block while we drop // mDataMonitor to take mFileMonitor. int32_t blockIndex = mChangeIndexList.PopFront(); nsRefPtr<BlockChange> change = mBlockChanges[blockIndex]; - NS_ABORT_IF_FALSE(change, - "Change index list should only contain entries for blocks with changes"); + MOZ_ASSERT(change, + "Change index list should only contain entries for blocks " + "with changes"); { MonitorAutoUnlock unlock(mDataMonitor); MonitorAutoLock lock(mFileMonitor); if (change->IsWrite()) { WriteBlockToFile(blockIndex, change->mData.get()); } else if (change->IsMove()) { MoveBlockInFile(change->mSourceBlockIndex, blockIndex); }
--- a/dom/media/MediaCache.cpp +++ b/dom/media/MediaCache.cpp @@ -2259,17 +2259,17 @@ MediaCacheStream::Read(char* aBuffer, ui } if (streamWithPartialBlock) { // We can just use the data in mPartialBlockBuffer. In fact we should // use it rather than waiting for the block to fill and land in // the cache. int64_t bytes = std::min<int64_t>(size, streamWithPartialBlock->mChannelOffset - mStreamOffset); // Clamp bytes until 64-bit file size issues are fixed. bytes = std::min(bytes, int64_t(INT32_MAX)); - NS_ABORT_IF_FALSE(bytes >= 0 && bytes <= aCount, "Bytes out of range."); + MOZ_ASSERT(bytes >= 0 && bytes <= aCount, "Bytes out of range."); memcpy(aBuffer, reinterpret_cast<char*>(streamWithPartialBlock->mPartialBlockBuffer.get()) + offsetInStreamBlock, bytes); if (mCurrentMode == MODE_METADATA) { streamWithPartialBlock->mMetadataInPartialBlockBuffer = true; } mStreamOffset += bytes; count = bytes; break; @@ -2284,17 +2284,17 @@ MediaCacheStream::Read(char* aBuffer, ui } continue; } gMediaCache->NoteBlockUsage(this, cacheBlock, mCurrentMode, TimeStamp::Now()); int64_t offset = cacheBlock*BLOCK_SIZE + offsetInStreamBlock; int32_t bytes; - NS_ABORT_IF_FALSE(size >= 0 && size <= INT32_MAX, "Size out of range."); + MOZ_ASSERT(size >= 0 && size <= INT32_MAX, "Size out of range."); nsresult rv = gMediaCache->ReadCacheFile(offset, aBuffer + count, int32_t(size), &bytes); if (NS_FAILED(rv)) { if (count == 0) return rv; // If we did successfully read some data, may as well return it break; } mStreamOffset += bytes; @@ -2356,26 +2356,26 @@ MediaCacheStream::ReadFromCache(char* aB int32_t cacheBlock = streamBlock < mBlocks.Length() ? mBlocks[streamBlock] : -1; if (channelBlock == streamBlock && streamOffset < mChannelOffset) { // We can just use the data in mPartialBlockBuffer. In fact we should // use it rather than waiting for the block to fill and land in // the cache. // Clamp bytes until 64-bit file size issues are fixed. int64_t toCopy = std::min<int64_t>(size, mChannelOffset - streamOffset); bytes = std::min(toCopy, int64_t(INT32_MAX)); - NS_ABORT_IF_FALSE(bytes >= 0 && bytes <= toCopy, "Bytes out of range."); + MOZ_ASSERT(bytes >= 0 && bytes <= toCopy, "Bytes out of range."); memcpy(aBuffer + count, reinterpret_cast<char*>(mPartialBlockBuffer.get()) + offsetInStreamBlock, bytes); } else { if (cacheBlock < 0) { // We expect all blocks to be cached! Fail! return NS_ERROR_FAILURE; } int64_t offset = cacheBlock*BLOCK_SIZE + offsetInStreamBlock; - NS_ABORT_IF_FALSE(size >= 0 && size <= INT32_MAX, "Size out of range."); + MOZ_ASSERT(size >= 0 && size <= INT32_MAX, "Size out of range."); nsresult rv = gMediaCache->ReadCacheFile(offset, aBuffer + count, int32_t(size), &bytes); if (NS_FAILED(rv)) { return rv; } } streamOffset += bytes; count += bytes; }
--- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -713,17 +713,17 @@ nsresult MediaDecoder::Play() } nsresult MediaDecoder::Seek(double aTime, SeekTarget::Type aSeekType) { MOZ_ASSERT(NS_IsMainThread()); ReentrantMonitorAutoEnter mon(GetReentrantMonitor()); UpdateDormantState(false /* aDormantTimeout */, true /* aActivity */); - NS_ABORT_IF_FALSE(aTime >= 0.0, "Cannot seek to a negative value."); + MOZ_ASSERT(aTime >= 0.0, "Cannot seek to a negative value."); int64_t timeUsecs = 0; nsresult rv = SecondsToUsecs(aTime, timeUsecs); NS_ENSURE_SUCCESS(rv, rv); mRequestedSeekTarget = SeekTarget(timeUsecs, aSeekType); mCurrentTime = aTime;
--- a/dom/media/MediaRecorder.cpp +++ b/dom/media/MediaRecorder.cpp @@ -974,17 +974,17 @@ MediaRecorder::Constructor(const GlobalO ownerWindow); object->SetMimeType(aInitDict.mMimeType); return object.forget(); } nsresult MediaRecorder::CreateAndDispatchBlobEvent(already_AddRefed<nsIDOMBlob>&& aBlob) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread"); + MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread"); if (!CheckPrincipal()) { // Media is not same-origin, don't allow the data out. nsRefPtr<nsIDOMBlob> blob = aBlob; return NS_ERROR_DOM_SECURITY_ERR; } BlobEventInit init; init.mBubbles = false; init.mCancelable = false; @@ -998,17 +998,17 @@ MediaRecorder::CreateAndDispatchBlobEven init); event->SetTrusted(true); return DispatchDOMEvent(nullptr, event, nullptr, nullptr); } void MediaRecorder::DispatchSimpleEvent(const nsAString & aStr) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread"); + MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread"); nsresult rv = CheckInnerWindowCorrectness(); if (NS_FAILED(rv)) { return; } nsCOMPtr<nsIDOMEvent> event; rv = NS_NewDOMEvent(getter_AddRefs(event), this, nullptr, nullptr); if (NS_FAILED(rv)) { @@ -1029,17 +1029,17 @@ MediaRecorder::DispatchSimpleEvent(const NS_ERROR("Failed to dispatch the event!!!"); return; } } void MediaRecorder::NotifyError(nsresult aRv) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread"); + MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread"); nsresult rv = CheckInnerWindowCorrectness(); if (NS_FAILED(rv)) { return; } nsString errorMsg; switch (aRv) { case NS_ERROR_DOM_SECURITY_ERR: errorMsg = NS_LITERAL_STRING("SecurityError"); @@ -1065,17 +1065,17 @@ MediaRecorder::NotifyError(nsresult aRv) NS_ERROR("Failed to dispatch the error event!!!"); return; } return; } bool MediaRecorder::CheckPrincipal() { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread"); + MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread"); if (!mDOMStream && !mAudioNode) { return false; } if (!GetOwner()) return false; nsCOMPtr<nsIDocument> doc = GetOwner()->GetExtantDoc(); if (!doc) { return false;
--- a/dom/media/gmp/GMPProcessChild.cpp +++ b/dom/media/gmp/GMPProcessChild.cpp @@ -31,22 +31,22 @@ GMPProcessChild::Init() std::string pluginFilename; std::string voucherFilename; #if defined(OS_POSIX) // NB: need to be very careful in ensuring that the first arg // (after the binary name) here is indeed the plugin module path. // Keep in sync with dom/plugins/PluginModuleParent. std::vector<std::string> values = CommandLine::ForCurrentProcess()->argv(); - NS_ABORT_IF_FALSE(values.size() >= 3, "not enough args"); + MOZ_ASSERT(values.size() >= 3, "not enough args"); pluginFilename = values[1]; voucherFilename = values[2]; #elif defined(OS_WIN) std::vector<std::wstring> values = CommandLine::ForCurrentProcess()->GetLooseValues(); - NS_ABORT_IF_FALSE(values.size() >= 2, "not enough loose args"); + MOZ_ASSERT(values.size() >= 2, "not enough loose args"); pluginFilename = WideToUTF8(values[0]); voucherFilename = WideToUTF8(values[1]); #else #error Not implemented #endif BackgroundHangMonitor::Startup();
--- a/dom/media/wave/WaveReader.cpp +++ b/dom/media/wave/WaveReader.cpp @@ -333,18 +333,18 @@ WaveReader::ReadAll(char* aBuf, int64_t } bool WaveReader::LoadRIFFChunk() { char riffHeader[RIFF_INITIAL_SIZE]; const char* p = riffHeader; - NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() == 0, - "LoadRIFFChunk called when resource in invalid state"); + MOZ_ASSERT(mDecoder->GetResource()->Tell() == 0, + "LoadRIFFChunk called when resource in invalid state"); if (!ReadAll(riffHeader, sizeof(riffHeader))) { return false; } static_assert(sizeof(uint32_t) * 3 <= RIFF_INITIAL_SIZE, "Reads would overflow riffHeader buffer."); if (ReadUint32BE(&p) != RIFF_CHUNK_MAGIC) { @@ -366,18 +366,18 @@ WaveReader::LoadRIFFChunk() bool WaveReader::LoadFormatChunk(uint32_t aChunkSize) { uint32_t rate, channels, frameSize, sampleFormat; char waveFormat[WAVE_FORMAT_CHUNK_SIZE]; const char* p = waveFormat; // RIFF chunks are always word (two byte) aligned. - NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0, - "LoadFormatChunk called with unaligned resource"); + MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0, + "LoadFormatChunk called with unaligned resource"); if (!ReadAll(waveFormat, sizeof(waveFormat))) { return false; } static_assert(sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t) + @@ -428,18 +428,18 @@ WaveReader::LoadFormatChunk(uint32_t aCh nsAutoArrayPtr<char> chunkExtension(new char[extra]); if (!ReadAll(chunkExtension.get(), extra)) { return false; } } } // RIFF chunks are always word (two byte) aligned. - NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0, - "LoadFormatChunk left resource unaligned"); + MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0, + "LoadFormatChunk left resource unaligned"); // Make sure metadata is fairly sane. The rate check is fairly arbitrary, // but the channels check is intentionally limited to mono or stereo // when the media is intended for direct playback because that's what the // audio backend currently supports. unsigned int actualFrameSize = (sampleFormat == 8 ? 1 : 2) * channels; if (rate < 100 || rate > 96000 || (((channels < 1 || channels > MAX_CHANNELS) || @@ -462,49 +462,49 @@ WaveReader::LoadFormatChunk(uint32_t aCh } return true; } bool WaveReader::FindDataOffset(uint32_t aChunkSize) { // RIFF chunks are always word (two byte) aligned. - NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0, - "FindDataOffset called with unaligned resource"); + MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0, + "FindDataOffset called with unaligned resource"); int64_t offset = mDecoder->GetResource()->Tell(); if (offset <= 0 || offset > UINT32_MAX) { NS_WARNING("PCM data offset out of range"); return false; } ReentrantMonitorAutoEnter monitor(mDecoder->GetReentrantMonitor()); mWaveLength = aChunkSize; mWavePCMOffset = uint32_t(offset); return true; } double WaveReader::BytesToTime(int64_t aBytes) const { - NS_ABORT_IF_FALSE(aBytes >= 0, "Must be >= 0"); + MOZ_ASSERT(aBytes >= 0, "Must be >= 0"); return float(aBytes) / mSampleRate / mFrameSize; } int64_t WaveReader::TimeToBytes(double aTime) const { - NS_ABORT_IF_FALSE(aTime >= 0.0f, "Must be >= 0"); + MOZ_ASSERT(aTime >= 0.0f, "Must be >= 0"); return RoundDownToFrame(int64_t(aTime * mSampleRate * mFrameSize)); } int64_t WaveReader::RoundDownToFrame(int64_t aBytes) const { - NS_ABORT_IF_FALSE(aBytes >= 0, "Must be >= 0"); + MOZ_ASSERT(aBytes >= 0, "Must be >= 0"); return aBytes - (aBytes % mFrameSize); } int64_t WaveReader::GetDataLength() { int64_t length = mWaveLength; // If the decoder has a valid content length, and it's shorter than the @@ -522,20 +522,20 @@ int64_t WaveReader::GetPosition() { return mDecoder->GetResource()->Tell(); } bool WaveReader::GetNextChunk(uint32_t* aChunk, uint32_t* aChunkSize) { - NS_ABORT_IF_FALSE(aChunk, "Must have aChunk"); - NS_ABORT_IF_FALSE(aChunkSize, "Must have aChunkSize"); - NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0, - "GetNextChunk called with unaligned resource"); + MOZ_ASSERT(aChunk, "Must have aChunk"); + MOZ_ASSERT(aChunkSize, "Must have aChunkSize"); + MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0, + "GetNextChunk called with unaligned resource"); char chunkHeader[CHUNK_HEADER_SIZE]; const char* p = chunkHeader; if (!ReadAll(chunkHeader, sizeof(chunkHeader))) { return false; } @@ -547,18 +547,18 @@ WaveReader::GetNextChunk(uint32_t* aChun return true; } bool WaveReader::LoadListChunk(uint32_t aChunkSize, nsAutoPtr<dom::HTMLMediaElement::MetadataTags> &aTags) { // List chunks are always word (two byte) aligned. - NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0, - "LoadListChunk called with unaligned resource"); + MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0, + "LoadListChunk called with unaligned resource"); static const unsigned int MAX_CHUNK_SIZE = 1 << 16; static_assert(uint64_t(MAX_CHUNK_SIZE) < UINT_MAX / sizeof(char), "MAX_CHUNK_SIZE too large for enumerator."); if (aChunkSize > MAX_CHUNK_SIZE || aChunkSize < 4) { return false; } @@ -623,18 +623,18 @@ WaveReader::LoadListChunk(uint32_t aChun return true; } bool WaveReader::LoadAllChunks(nsAutoPtr<dom::HTMLMediaElement::MetadataTags> &aTags) { // Chunks are always word (two byte) aligned. - NS_ABORT_IF_FALSE(mDecoder->GetResource()->Tell() % 2 == 0, - "LoadAllChunks called with unaligned resource"); + MOZ_ASSERT(mDecoder->GetResource()->Tell() % 2 == 0, + "LoadAllChunks called with unaligned resource"); bool loadFormatChunk = false; bool findDataOffset = false; for (;;) { static const unsigned int CHUNK_HEADER_SIZE = 8; char chunkHeader[CHUNK_HEADER_SIZE]; const char* p = chunkHeader;
--- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -1503,18 +1503,19 @@ bool JS::Rooted<JSObject*> obj(cx, nsNPObjWrapper::GetNewOrUsed(npp, cx, npobj)); if (!obj) { return false; } obj = JS_ObjectToInnerObject(cx, obj); - NS_ABORT_IF_FALSE(obj, - "JS_ObjectToInnerObject should never return null with non-null input."); + MOZ_ASSERT(obj, + "JS_ObjectToInnerObject should never return null with non-null " + "input."); if (result) { // Initialize the out param to void VOID_TO_NPVARIANT(*result); } if (!script || !script->UTF8Length || !script->UTF8Characters) { // Nothing to evaluate.
--- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -2664,18 +2664,18 @@ PluginInstanceChild::DoAsyncSetWindow(co if (!mAccumulatedInvalidRect.IsEmpty()) { AsyncShowPluginFrame(); } } bool PluginInstanceChild::CreateOptSurface(void) { - NS_ABORT_IF_FALSE(mSurfaceType != gfxSurfaceType::Max, - "Need a valid surface type here"); + MOZ_ASSERT(mSurfaceType != gfxSurfaceType::Max, + "Need a valid surface type here"); NS_ASSERTION(!mCurrentSurface, "mCurrentSurfaceActor can get out of sync."); nsRefPtr<gfxASurface> retsurf; // Use an opaque surface unless we're transparent and *don't* have // a background to source from. gfxImageFormat format = (mIsTransparent && !mBackground) ? gfxImageFormat::ARGB32 : gfxImageFormat::RGB24; @@ -3094,18 +3094,18 @@ PluginInstanceChild::PaintRectToSurface( dt->CopySurface(surface, ToIntRect(aRect), ToIntPoint(aRect.TopLeft())); } } void PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect, gfxASurface* aSurface) { - NS_ABORT_IF_FALSE(aSurface->GetContentType() == gfxContentType::COLOR_ALPHA, - "Refusing to pointlessly recover alpha"); + MOZ_ASSERT(aSurface->GetContentType() == gfxContentType::COLOR_ALPHA, + "Refusing to pointlessly recover alpha"); nsIntRect rect(aRect); // If |aSurface| can be used to paint and can have alpha values // recovered directly to it, do that to save a tmp surface and // copy. bool useSurfaceSubimageForBlack = false; if (gfxSurfaceType::Image == aSurface->GetType()) { gfxImageSurface* surfaceAsImage = @@ -3174,17 +3174,17 @@ PluginInstanceChild::PaintRectWithAlphaE gfxImageFormat::ARGB32); } // Paint onto black background blackImage->SetDeviceOffset(deviceOffset); PaintRectToSurface(rect, blackImage, gfxRGBA(0.0, 0.0, 0.0)); #endif - NS_ABORT_IF_FALSE(whiteImage && blackImage, "Didn't paint enough!"); + MOZ_ASSERT(whiteImage && blackImage, "Didn't paint enough!"); // Extract alpha from black and white image and store to black // image if (!gfxAlphaRecovery::RecoverAlpha(blackImage, whiteImage)) { return; } // If we had to use a temporary black surface, copy the pixels @@ -3538,17 +3538,17 @@ PluginInstanceChild::InvalidateRect(NPRe // before their first SetWindow(). SendNPN_InvalidateRect(*aInvalidRect); } bool PluginInstanceChild::RecvUpdateBackground(const SurfaceDescriptor& aBackground, const nsIntRect& aRect) { - NS_ABORT_IF_FALSE(mIsTransparent, "Only transparent plugins use backgrounds"); + MOZ_ASSERT(mIsTransparent, "Only transparent plugins use backgrounds"); if (!mBackground) { // XXX refactor me switch (aBackground.type()) { #ifdef MOZ_X11 case SurfaceDescriptor::TSurfaceDescriptorX11: { mBackground = aBackground.get_SurfaceDescriptorX11().OpenForeign(); break;
--- a/dom/plugins/ipc/PluginInstanceParent.cpp +++ b/dom/plugins/ipc/PluginInstanceParent.cpp @@ -740,17 +740,17 @@ PluginInstanceParent::ContentsScaleFacto nsresult PluginInstanceParent::SetBackgroundUnknown() { PLUGIN_LOG_DEBUG(("[InstanceParent][%p] SetBackgroundUnknown", this)); if (mBackground) { DestroyBackground(); - NS_ABORT_IF_FALSE(!mBackground, "Background not destroyed"); + MOZ_ASSERT(!mBackground, "Background not destroyed"); } return NS_OK; } nsresult PluginInstanceParent::BeginUpdateBackground(const nsIntRect& aRect, gfxContext** aCtx) @@ -759,28 +759,28 @@ PluginInstanceParent::BeginUpdateBackgro ("[InstanceParent][%p] BeginUpdateBackground for <x=%d,y=%d, w=%d,h=%d>", this, aRect.x, aRect.y, aRect.width, aRect.height)); if (!mBackground) { // XXX if we failed to create a background surface on one // update, there's no guarantee that later updates will be for // the entire background area until successful. We might want // to fix that eventually. - NS_ABORT_IF_FALSE(aRect.TopLeft() == nsIntPoint(0, 0), - "Expecting rect for whole frame"); + MOZ_ASSERT(aRect.TopLeft() == nsIntPoint(0, 0), + "Expecting rect for whole frame"); if (!CreateBackground(aRect.Size())) { *aCtx = nullptr; return NS_OK; } } gfxIntSize sz = mBackground->GetSize(); #ifdef DEBUG - NS_ABORT_IF_FALSE(nsIntRect(0, 0, sz.width, sz.height).Contains(aRect), - "Update outside of background area"); + MOZ_ASSERT(nsIntRect(0, 0, sz.width, sz.height).Contains(aRect), + "Update outside of background area"); #endif RefPtr<gfx::DrawTarget> dt = gfxPlatform::GetPlatform()-> CreateDrawTargetForSurface(mBackground, gfx::IntSize(sz.width, sz.height)); nsRefPtr<gfxContext> ctx = new gfxContext(dt); ctx.forget(aCtx); return NS_OK; @@ -816,17 +816,17 @@ PluginAsyncSurrogate* PluginInstanceParent::GetAsyncSurrogate() { return mSurrogate; } bool PluginInstanceParent::CreateBackground(const nsIntSize& aSize) { - NS_ABORT_IF_FALSE(!mBackground, "Already have a background"); + MOZ_ASSERT(!mBackground, "Already have a background"); // XXX refactor me #if defined(MOZ_X11) Screen* screen = DefaultScreenOfDisplay(DefaultXDisplay()); Visual* visual = DefaultVisualOfScreen(screen); mBackground = gfxXlibSurface::Create(screen, visual, gfxIntSize(aSize.width, aSize.height)); @@ -861,28 +861,28 @@ PluginInstanceParent::DestroyBackground( // If this fails, there's no problem: |bd| will be destroyed along // with the old background surface. unused << SendPPluginBackgroundDestroyerConstructor(pbd); } mozilla::plugins::SurfaceDescriptor PluginInstanceParent::BackgroundDescriptor() { - NS_ABORT_IF_FALSE(mBackground, "Need a background here"); + MOZ_ASSERT(mBackground, "Need a background here"); // XXX refactor me #ifdef MOZ_X11 gfxXlibSurface* xsurf = static_cast<gfxXlibSurface*>(mBackground.get()); return SurfaceDescriptorX11(xsurf); #endif #ifdef XP_WIN - NS_ABORT_IF_FALSE(gfxSharedImageSurface::IsSharedImage(mBackground), - "Expected shared image surface"); + MOZ_ASSERT(gfxSharedImageSurface::IsSharedImage(mBackground), + "Expected shared image surface"); gfxSharedImageSurface* shmem = static_cast<gfxSharedImageSurface*>(mBackground.get()); return shmem->GetShmem(); #endif // If this is ever used, which it shouldn't be, it will trigger a // hard assertion in IPDL-generated code. return mozilla::plugins::SurfaceDescriptor();
--- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -511,20 +511,20 @@ static const gint kBrowserEventPriority static const guint kBrowserEventIntervalMs = 10; // static gboolean PluginModuleChild::DetectNestedEventLoop(gpointer data) { PluginModuleChild* pmc = static_cast<PluginModuleChild*>(data); - NS_ABORT_IF_FALSE(0 != pmc->mNestedLoopTimerId, - "callback after descheduling"); - NS_ABORT_IF_FALSE(pmc->mTopLoopDepth < g_main_depth(), - "not canceled before returning to main event loop!"); + MOZ_ASSERT(0 != pmc->mNestedLoopTimerId, + "callback after descheduling"); + MOZ_ASSERT(pmc->mTopLoopDepth < g_main_depth(), + "not canceled before returning to main event loop!"); PLUGIN_LOG_DEBUG(("Detected nested glib event loop")); // just detected a nested loop; start a timer that will // periodically rpc-call back into the browser and process some // events pmc->mNestedLoopTimerId = g_timeout_add_full(kBrowserEventPriority, @@ -537,68 +537,68 @@ PluginModuleChild::DetectNestedEventLoop } // static gboolean PluginModuleChild::ProcessBrowserEvents(gpointer data) { PluginModuleChild* pmc = static_cast<PluginModuleChild*>(data); - NS_ABORT_IF_FALSE(pmc->mTopLoopDepth < g_main_depth(), - "not canceled before returning to main event loop!"); + MOZ_ASSERT(pmc->mTopLoopDepth < g_main_depth(), + "not canceled before returning to main event loop!"); pmc->CallProcessSomeEvents(); return TRUE; } void PluginModuleChild::EnteredCxxStack() { - NS_ABORT_IF_FALSE(0 == mNestedLoopTimerId, - "previous timer not descheduled"); + MOZ_ASSERT(0 == mNestedLoopTimerId, + "previous timer not descheduled"); mNestedLoopTimerId = g_timeout_add_full(kNestedLoopDetectorPriority, kNestedLoopDetectorIntervalMs, PluginModuleChild::DetectNestedEventLoop, this, nullptr); #ifdef DEBUG mTopLoopDepth = g_main_depth(); #endif } void PluginModuleChild::ExitedCxxStack() { - NS_ABORT_IF_FALSE(0 < mNestedLoopTimerId, - "nested loop timeout not scheduled"); + MOZ_ASSERT(0 < mNestedLoopTimerId, + "nested loop timeout not scheduled"); g_source_remove(mNestedLoopTimerId); mNestedLoopTimerId = 0; } #elif defined (MOZ_WIDGET_QT) void PluginModuleChild::EnteredCxxStack() { - NS_ABORT_IF_FALSE(mNestedLoopTimerObject == nullptr, - "previous timer not descheduled"); + MOZ_ASSERT(mNestedLoopTimerObject == nullptr, + "previous timer not descheduled"); mNestedLoopTimerObject = new NestedLoopTimer(this); QTimer::singleShot(kNestedLoopDetectorIntervalMs, mNestedLoopTimerObject, SLOT(timeOut())); } void PluginModuleChild::ExitedCxxStack() { - NS_ABORT_IF_FALSE(mNestedLoopTimerObject != nullptr, - "nested loop timeout not scheduled"); + MOZ_ASSERT(mNestedLoopTimerObject != nullptr, + "nested loop timeout not scheduled"); delete mNestedLoopTimerObject; mNestedLoopTimerObject = nullptr; } #endif bool PluginModuleChild::RecvSetParentHangTimeout(const uint32_t& aSeconds) @@ -631,18 +631,18 @@ PluginModuleChild::InitGraphics() // GtkPlug is a static class so will leak anyway but this ref makes sure. gpointer gtk_plug_class = g_type_class_ref(GTK_TYPE_PLUG); // The dispose method is a good place to hook into the destruction process // because the reference count should be 1 the last time dispose is // called. (Toggle references wouldn't detect if the reference count // might be higher.) GObjectDisposeFn* dispose = &G_OBJECT_CLASS(gtk_plug_class)->dispose; - NS_ABORT_IF_FALSE(*dispose != wrap_gtk_plug_dispose, - "InitGraphics called twice"); + MOZ_ASSERT(*dispose != wrap_gtk_plug_dispose, + "InitGraphics called twice"); real_gtk_plug_dispose = *dispose; *dispose = wrap_gtk_plug_dispose; // If we ever stop setting GDK_NATIVE_WINDOWS, we'll also need to // gtk_widget_add_events GDK_SCROLL_MASK or GDK client-side windows will // not tell us about the scroll events that it intercepts. With native // windows, this is called when GDK intercepts the events; if GDK doesn't // intercept the events, then the X server will instead send them directly @@ -1083,17 +1083,17 @@ const NPNetscapeFuncs PluginModuleChild: nullptr, // handleevent, unimplemented nullptr, // unfocusinstance, unimplemented mozilla::plugins::child::_urlredirectresponse }; PluginInstanceChild* InstCast(NPP aNPP) { - NS_ABORT_IF_FALSE(!!(aNPP->ndata), "nil instance"); + MOZ_ASSERT(!!(aNPP->ndata), "nil instance"); return static_cast<PluginInstanceChild*>(aNPP->ndata); } namespace mozilla { namespace plugins { namespace child { NPError
--- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -1507,18 +1507,18 @@ PluginModuleParent::NPP_SetValue(NPP ins } bool PluginModuleParent::RecvBackUpXResources(const FileDescriptor& aXSocketFd) { #ifndef MOZ_X11 NS_RUNTIMEABORT("This message only makes sense on X11 platforms"); #else - NS_ABORT_IF_FALSE(0 > mPluginXSocketFdDup.get(), - "Already backed up X resources??"); + MOZ_ASSERT(0 > mPluginXSocketFdDup.get(), + "Already backed up X resources??"); mPluginXSocketFdDup.forget(); if (aXSocketFd.IsValid()) { mPluginXSocketFdDup.reset(aXSocketFd.PlatformHandle()); } #endif return true; }
--- a/dom/plugins/ipc/PluginProcessChild.cpp +++ b/dom/plugins/ipc/PluginProcessChild.cpp @@ -104,24 +104,24 @@ PluginProcessChild::Init() std::string pluginFilename; #if defined(OS_POSIX) // NB: need to be very careful in ensuring that the first arg // (after the binary name) here is indeed the plugin module path. // Keep in sync with dom/plugins/PluginModuleParent. std::vector<std::string> values = CommandLine::ForCurrentProcess()->argv(); - NS_ABORT_IF_FALSE(values.size() >= 2, "not enough args"); + MOZ_ASSERT(values.size() >= 2, "not enough args"); pluginFilename = UnmungePluginDsoPath(values[1]); #elif defined(OS_WIN) std::vector<std::wstring> values = CommandLine::ForCurrentProcess()->GetLooseValues(); - NS_ABORT_IF_FALSE(values.size() >= 1, "not enough loose args"); + MOZ_ASSERT(values.size() >= 1, "not enough loose args"); if (ShouldProtectPluginCurrentDirectory(values[0].c_str())) { SanitizeEnvironmentVariables(); SetDllDirectory(L""); } pluginFilename = WideToUTF8(values[0]);
--- a/dom/smil/SMILIntegerType.cpp +++ b/dom/smil/SMILIntegerType.cpp @@ -8,17 +8,17 @@ #include "nsDebug.h" #include <math.h> namespace mozilla { void SMILIntegerType::Init(nsSMILValue& aValue) const { - NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected value type"); + MOZ_ASSERT(aValue.IsNull(), "Unexpected value type"); aValue.mU.mInt = 0; aValue.mType = this; } void SMILIntegerType::Destroy(nsSMILValue& aValue) const { NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value");
--- a/dom/smil/nsSMILAnimationController.cpp +++ b/dom/smil/nsSMILAnimationController.cpp @@ -27,17 +27,17 @@ using namespace mozilla::dom; nsSMILAnimationController::nsSMILAnimationController(nsIDocument* aDoc) : mAvgTimeBetweenSamples(0), mResampleNeeded(false), mDeferredStartSampling(false), mRunningSample(false), mRegisteredWithRefreshDriver(false), mDocument(aDoc) { - NS_ABORT_IF_FALSE(aDoc, "need a non-null document"); + MOZ_ASSERT(aDoc, "need a non-null document"); nsRefreshDriver* refreshDriver = GetRefreshDriver(); if (refreshDriver) { mStartTime = refreshDriver->MostRecentRefresh(); } else { mStartTime = mozilla::TimeStamp::Now(); } mCurrentSampleTime = mStartTime; @@ -52,19 +52,19 @@ nsSMILAnimationController::~nsSMILAnimat " elements when it dies"); NS_ASSERTION(!mRegisteredWithRefreshDriver, "Leaving stale entry in refresh driver's observer list"); } void nsSMILAnimationController::Disconnect() { - NS_ABORT_IF_FALSE(mDocument, "disconnecting when we weren't connected...?"); - NS_ABORT_IF_FALSE(mRefCnt.get() == 1, - "Expecting to disconnect when doc is sole remaining owner"); + MOZ_ASSERT(mDocument, "disconnecting when we weren't connected...?"); + MOZ_ASSERT(mRefCnt.get() == 1, + "Expecting to disconnect when doc is sole remaining owner"); NS_ASSERTION(mPauseState & nsSMILTimeContainer::PAUSE_PAGEHIDE, "Expecting to be paused for pagehide before disconnect"); StopSampling(GetRefreshDriver()); mDocument = nullptr; // (raw pointer) } @@ -165,19 +165,19 @@ void nsSMILAnimationController::RegisterAnimationElement( SVGAnimationElement* aAnimationElement) { mAnimationElementTable.PutEntry(aAnimationElement); if (mDeferredStartSampling) { mDeferredStartSampling = false; if (mChildContainerTable.Count()) { // mAnimationElementTable was empty, but now we've added its 1st element - NS_ABORT_IF_FALSE(mAnimationElementTable.Count() == 1, - "we shouldn't have deferred sampling if we already had " - "animations registered"); + MOZ_ASSERT(mAnimationElementTable.Count() == 1, + "we shouldn't have deferred sampling if we already had " + "animations registered"); StartSampling(GetRefreshDriver()); Sample(); // Run the first sample manually } // else, don't sample until a time container is registered (via AddChild) } } void nsSMILAnimationController::UnregisterAnimationElement( @@ -260,36 +260,34 @@ void nsSMILAnimationController::StartSampling(nsRefreshDriver* aRefreshDriver) { NS_ASSERTION(mPauseState == 0, "Starting sampling but controller is paused"); NS_ASSERTION(!mDeferredStartSampling, "Started sampling but the deferred start flag is still set"); if (aRefreshDriver) { MOZ_ASSERT(!mRegisteredWithRefreshDriver, "Redundantly registering with refresh driver"); - NS_ABORT_IF_FALSE(!GetRefreshDriver() || - aRefreshDriver == GetRefreshDriver(), - "Starting sampling with wrong refresh driver"); + MOZ_ASSERT(!GetRefreshDriver() || aRefreshDriver == GetRefreshDriver(), + "Starting sampling with wrong refresh driver"); // We're effectively resuming from a pause so update our current sample time // or else it will confuse our "average time between samples" calculations. mCurrentSampleTime = mozilla::TimeStamp::Now(); aRefreshDriver->AddRefreshObserver(this, Flush_Style); mRegisteredWithRefreshDriver = true; } } void nsSMILAnimationController::StopSampling(nsRefreshDriver* aRefreshDriver) { if (aRefreshDriver && mRegisteredWithRefreshDriver) { // NOTE: The document might already have been detached from its PresContext // (and RefreshDriver), which would make GetRefreshDriver() return null. - NS_ABORT_IF_FALSE(!GetRefreshDriver() || - aRefreshDriver == GetRefreshDriver(), - "Stopping sampling with wrong refresh driver"); + MOZ_ASSERT(!GetRefreshDriver() || aRefreshDriver == GetRefreshDriver(), + "Stopping sampling with wrong refresh driver"); aRefreshDriver->RemoveRefreshObserver(this, Flush_Style); mRegisteredWithRefreshDriver = false; } } void nsSMILAnimationController::MaybeStartSampling(nsRefreshDriver* aRefreshDriver) { @@ -477,18 +475,18 @@ nsSMILAnimationController::RewindElement mAnimationElementTable.EnumerateEntries(RewindAnimation, nullptr); mChildContainerTable.EnumerateEntries(ClearRewindNeeded, nullptr); } /*static*/ PLDHashOperator nsSMILAnimationController::RewindNeeded(TimeContainerPtrKey* aKey, void* aData) { - NS_ABORT_IF_FALSE(aData, - "Null data pointer during time container enumeration"); + MOZ_ASSERT(aData, + "Null data pointer during time container enumeration"); bool* rewindNeeded = static_cast<bool*>(aData); nsSMILTimeContainer* container = aKey->GetKey(); if (container->NeedsRewind()) { *rewindNeeded = true; return PL_DHASH_STOP; } @@ -564,17 +562,17 @@ nsSMILAnimationController::DoMilestoneSa // // Because we're only performing this clamping at the last moment, the // animations will still all get sampled in the correct order and // dependencies will be appropriately resolved. sampleTime = std::max(nextMilestone.mTime, sampleTime); for (uint32_t i = 0; i < length; ++i) { SVGAnimationElement* elem = params.mElements[i].get(); - NS_ABORT_IF_FALSE(elem, "nullptr animation element in list"); + MOZ_ASSERT(elem, "nullptr animation element in list"); nsSMILTimeContainer* container = elem->GetTimeContainer(); if (!container) // The container may be nullptr if the element has been detached from its // parent since registering a milestone. continue; nsSMILTimeValue containerTimeValue = container->ParentToContainerTime(sampleTime); @@ -592,20 +590,20 @@ nsSMILAnimationController::DoMilestoneSa } } } /*static*/ PLDHashOperator nsSMILAnimationController::GetNextMilestone(TimeContainerPtrKey* aKey, void* aData) { - NS_ABORT_IF_FALSE(aKey, "Null hash key for time container hash table"); - NS_ABORT_IF_FALSE(aKey->GetKey(), "Null time container key in hash table"); - NS_ABORT_IF_FALSE(aData, - "Null data pointer during time container enumeration"); + MOZ_ASSERT(aKey, "Null hash key for time container hash table"); + MOZ_ASSERT(aKey->GetKey(), "Null time container key in hash table"); + MOZ_ASSERT(aData, + "Null data pointer during time container enumeration"); nsSMILMilestone* nextMilestone = static_cast<nsSMILMilestone*>(aData); nsSMILTimeContainer* container = aKey->GetKey(); if (container->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN)) return PL_DHASH_NEXT; nsSMILMilestone thisMilestone; @@ -617,20 +615,20 @@ nsSMILAnimationController::GetNextMilest return PL_DHASH_NEXT; } /*static*/ PLDHashOperator nsSMILAnimationController::GetMilestoneElements(TimeContainerPtrKey* aKey, void* aData) { - NS_ABORT_IF_FALSE(aKey, "Null hash key for time container hash table"); - NS_ABORT_IF_FALSE(aKey->GetKey(), "Null time container key in hash table"); - NS_ABORT_IF_FALSE(aData, - "Null data pointer during time container enumeration"); + MOZ_ASSERT(aKey, "Null hash key for time container hash table"); + MOZ_ASSERT(aKey->GetKey(), "Null time container key in hash table"); + MOZ_ASSERT(aData, + "Null data pointer during time container enumeration"); GetMilestoneElementsParams* params = static_cast<GetMilestoneElementsParams*>(aData); nsSMILTimeContainer* container = aKey->GetKey(); if (container->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN)) return PL_DHASH_NEXT; @@ -697,18 +695,18 @@ nsSMILAnimationController::SampleTimedEl // Instead we build up a hashmap of active time containers during the previous // step (SampleTimeContainer) and then test here if the container for this // timed element is in the list. if (!aActiveContainers->GetEntry(timeContainer)) return; nsSMILTime containerTime = timeContainer->GetCurrentTime(); - NS_ABORT_IF_FALSE(!timeContainer->IsSeeking(), - "Doing a regular sample but the time container is still seeking"); + MOZ_ASSERT(!timeContainer->IsSeeking(), + "Doing a regular sample but the time container is still seeking"); aElement->TimedElement().SampleAt(containerTime); } /*static*/ void nsSMILAnimationController::AddAnimationToCompositorTable( SVGAnimationElement* aElement, nsSMILCompositorTable* aCompositorTable) { // Add a compositor to the hash table if there's not already one there
--- a/dom/smil/nsSMILAnimationFunction.cpp +++ b/dom/smil/nsSMILAnimationFunction.cpp @@ -215,20 +215,20 @@ nsSMILAnimationFunction::ComposeResult(c return; // Check that we have the right number of keySplines and keyTimes CheckValueListDependentAttrs(values.Length()); if (mErrorFlags != 0) return; // If this interval is active, we must have a non-negative mSampleTime - NS_ABORT_IF_FALSE(mSampleTime >= 0 || !mIsActive, - "Negative sample time for active animation"); - NS_ABORT_IF_FALSE(mSimpleDuration.IsResolved() || mLastValue, - "Unresolved simple duration for active or frozen animation"); + MOZ_ASSERT(mSampleTime >= 0 || !mIsActive, + "Negative sample time for active animation"); + MOZ_ASSERT(mSimpleDuration.IsResolved() || mLastValue, + "Unresolved simple duration for active or frozen animation"); // If we want to add but don't have a base value then just fail outright. // This can happen when we skipped getting the base value because there's an // animation function in the sandwich that should replace it but that function // failed unexpectedly. bool isAdditive = IsAdditive(); if (isAdditive && aResult.IsNull()) return; @@ -298,18 +298,18 @@ nsSMILAnimationFunction::CompareTo(const aOther->mAnimationElement->TimedElement(); if (thisTimedElement.IsTimeDependent(otherTimedElement)) return 1; if (otherTimedElement.IsTimeDependent(thisTimedElement)) return -1; // Animations that appear later in the document sort after those earlier in // the document - NS_ABORT_IF_FALSE(mAnimationElement != aOther->mAnimationElement, - "Two animations cannot have the same animation content element!"); + MOZ_ASSERT(mAnimationElement != aOther->mAnimationElement, + "Two animations cannot have the same animation content element!"); return (nsContentUtils::PositionIsBefore(mAnimationElement, aOther->mAnimationElement)) ? -1 : 1; } bool nsSMILAnimationFunction::WillReplace() const { @@ -363,18 +363,18 @@ nsSMILAnimationFunction::InterpolateResu // If we have an indefinite simple duration, just set the progress to be // 0 which will give us the expected behaviour of the animation being fixed at // its starting point. double simpleProgress = 0.0; if (mSimpleDuration.IsDefinite()) { nsSMILTime dur = mSimpleDuration.GetMillis(); - NS_ABORT_IF_FALSE(dur >= 0, "Simple duration should not be negative"); - NS_ABORT_IF_FALSE(mSampleTime >= 0, "Sample time should not be negative"); + MOZ_ASSERT(dur >= 0, "Simple duration should not be negative"); + MOZ_ASSERT(mSampleTime >= 0, "Sample time should not be negative"); if (mSampleTime >= dur || mSampleTime < 0) { NS_ERROR("Animation sampled outside interval"); return NS_ERROR_FAILURE; } if (dur > 0) { simpleProgress = (double)mSampleTime / dur; @@ -383,17 +383,17 @@ nsSMILAnimationFunction::InterpolateResu nsresult rv = NS_OK; nsSMILCalcMode calcMode = GetCalcMode(); if (calcMode != CALC_DISCRETE) { // Get the normalised progress between adjacent values const nsSMILValue* from = nullptr; const nsSMILValue* to = nullptr; // Init to -1 to make sure that if we ever forget to set this, the - // NS_ABORT_IF_FALSE that tests that intervalProgress is in range will fail. + // MOZ_ASSERT that tests that intervalProgress is in range will fail. double intervalProgress = -1.f; if (IsToAnimation()) { from = &aBaseValue; to = &aValues[0]; if (calcMode == CALC_PACED) { // Note: key[Times/Splines/Points] are ignored for calcMode="paced" intervalProgress = simpleProgress; } else { @@ -416,20 +416,20 @@ nsSMILAnimationFunction::InterpolateResu from = &aValues[index]; to = &aValues[index + 1]; intervalProgress = scaledSimpleProgress * (aValues.Length() - 1) - index; intervalProgress = ScaleIntervalProgress(intervalProgress, index); } if (NS_SUCCEEDED(rv)) { - NS_ABORT_IF_FALSE(from, "NULL from-value during interpolation"); - NS_ABORT_IF_FALSE(to, "NULL to-value during interpolation"); - NS_ABORT_IF_FALSE(0.0f <= intervalProgress && intervalProgress < 1.0f, - "Interval progress should be in the range [0, 1)"); + MOZ_ASSERT(from, "NULL from-value during interpolation"); + MOZ_ASSERT(to, "NULL to-value during interpolation"); + MOZ_ASSERT(0.0f <= intervalProgress && intervalProgress < 1.0f, + "Interval progress should be in the range [0, 1)"); rv = from->Interpolate(*to, intervalProgress, aResult); } } // Discrete-CalcMode case // Note: If interpolation failed (isn't supported for this type), the SVG // spec says to force discrete mode. if (calcMode == CALC_DISCRETE || NS_FAILED(rv)) { @@ -497,17 +497,17 @@ nsSMILAnimationFunction::ComputePacedPos double& aIntervalProgress, const nsSMILValue*& aFrom, const nsSMILValue*& aTo) { NS_ASSERTION(0.0f <= aSimpleProgress && aSimpleProgress < 1.0f, "aSimpleProgress is out of bounds"); NS_ASSERTION(GetCalcMode() == CALC_PACED, "Calling paced-specific function, but not in paced mode"); - NS_ABORT_IF_FALSE(aValues.Length() >= 2, "Unexpected number of values"); + MOZ_ASSERT(aValues.Length() >= 2, "Unexpected number of values"); // Trivial case: If we have just 2 values, then there's only one interval // for us to traverse, and our progress across that interval is the exact // same as our overall progress. if (aValues.Length() == 2) { aIntervalProgress = aSimpleProgress; aFrom = &aValues[0]; aTo = &aValues[1]; @@ -543,19 +543,19 @@ nsSMILAnimationFunction::ComputePacedPos NS_ASSERTION(remainingDist >= 0, "distance values must be non-negative"); double curIntervalDist; #ifdef DEBUG nsresult rv = #endif aValues[i].ComputeDistance(aValues[i+1], curIntervalDist); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), - "If we got through ComputePacedTotalDistance, we should " - "be able to recompute each sub-distance without errors"); + MOZ_ASSERT(NS_SUCCEEDED(rv), + "If we got through ComputePacedTotalDistance, we should " + "be able to recompute each sub-distance without errors"); NS_ASSERTION(curIntervalDist >= 0, "distance values must be non-negative"); // Clamp distance value at 0, just in case ComputeDistance is evil. curIntervalDist = std::max(curIntervalDist, 0.0); if (remainingDist >= curIntervalDist) { remainingDist -= curIntervalDist; } else { @@ -599,17 +599,17 @@ nsSMILAnimationFunction::ComputePacedTot double tmpDist; nsresult rv = aValues[i].ComputeDistance(aValues[i+1], tmpDist); if (NS_FAILED(rv)) { return COMPUTE_DISTANCE_ERROR; } // Clamp distance value to 0, just in case we have an evil ComputeDistance // implementation somewhere - NS_ABORT_IF_FALSE(tmpDist >= 0.0f, "distance values must be non-negative"); + MOZ_ASSERT(tmpDist >= 0.0f, "distance values must be non-negative"); tmpDist = std::max(tmpDist, 0.0); totalDistance += tmpDist; } return totalDistance; } @@ -629,19 +629,19 @@ nsSMILAnimationFunction::ScaleSimpleProg for (; i < numTimes - 2 && aProgress >= mKeyTimes[i+1]; ++i) { } if (aCalcMode == CALC_DISCRETE) { // discrete calcMode behaviour differs in that each keyTime defines the time // from when the corresponding value is set, and therefore the last value // needn't be 1. So check if we're in the last 'interval', that is, the // space between the final value and 1.0. if (aProgress >= mKeyTimes[i+1]) { - NS_ABORT_IF_FALSE(i == numTimes - 2, - "aProgress is not in range of the current interval, yet the current" - " interval is not the last bounded interval either."); + MOZ_ASSERT(i == numTimes - 2, + "aProgress is not in range of the current interval, yet the " + "current interval is not the last bounded interval either."); ++i; } return (double)i / numTimes; } double& intervalStart = mKeyTimes[i]; double& intervalEnd = mKeyTimes[i+1]; @@ -658,18 +658,18 @@ nsSMILAnimationFunction::ScaleIntervalPr uint32_t aIntervalIndex) { if (GetCalcMode() != CALC_SPLINE) return aProgress; if (!HasAttr(nsGkAtoms::keySplines)) return aProgress; - NS_ABORT_IF_FALSE(aIntervalIndex < mKeySplines.Length(), - "Invalid interval index"); + MOZ_ASSERT(aIntervalIndex < mKeySplines.Length(), + "Invalid interval index"); nsSMILKeySpline const &spline = mKeySplines[aIntervalIndex]; return spline.GetSplineValue(aProgress); } bool nsSMILAnimationFunction::HasAttr(nsIAtom* aAttName) const {
--- a/dom/smil/nsSMILAnimationFunction.h +++ b/dom/smil/nsSMILAnimationFunction.h @@ -201,20 +201,20 @@ public: * after we've reacted to their change to the 'inactive' state, so that we * won't needlessly recompose their targets in every sample. * * This should only be called on an animation function that is inactive and * that returns true from HasChanged(). */ void ClearHasChanged() { - NS_ABORT_IF_FALSE(HasChanged(), - "clearing mHasChanged flag, when it's already false"); - NS_ABORT_IF_FALSE(!IsActiveOrFrozen(), - "clearing mHasChanged flag for active animation"); + MOZ_ASSERT(HasChanged(), + "clearing mHasChanged flag, when it's already false"); + MOZ_ASSERT(!IsActiveOrFrozen(), + "clearing mHasChanged flag for active animation"); mHasChanged = false; } /** * Updates the cached record of our animation target, and returns a boolean * that indicates whether the target has changed since the last call to this * function. (This lets nsSMILCompositor check whether its animation * functions have changed value or target since the last sample. If none of
--- a/dom/smil/nsSMILCSSProperty.cpp +++ b/dom/smil/nsSMILCSSProperty.cpp @@ -17,20 +17,20 @@ using namespace mozilla::dom; // Helper function static bool GetCSSComputedValue(Element* aElem, nsCSSProperty aPropID, nsAString& aResult) { - NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(aPropID), - "Can't look up computed value of shorthand property"); - NS_ABORT_IF_FALSE(nsSMILCSSProperty::IsPropertyAnimatable(aPropID), - "Shouldn't get here for non-animatable properties"); + MOZ_ASSERT(!nsCSSProps::IsShorthand(aPropID), + "Can't look up computed value of shorthand property"); + MOZ_ASSERT(nsSMILCSSProperty::IsPropertyAnimatable(aPropID), + "Shouldn't get here for non-animatable properties"); nsIDocument* doc = aElem->GetCurrentDoc(); if (!doc) { // This can happen if we process certain types of restyles mid-sample // and remove anonymous animated content from the document as a result. // See bug 534975. return false; } @@ -48,19 +48,19 @@ GetCSSComputedValue(Element* aElem, return true; } // Class Methods nsSMILCSSProperty::nsSMILCSSProperty(nsCSSProperty aPropID, Element* aElement) : mPropID(aPropID), mElement(aElement) { - NS_ABORT_IF_FALSE(IsPropertyAnimatable(mPropID), - "Creating a nsSMILCSSProperty for a property " - "that's not supported for animation"); + MOZ_ASSERT(IsPropertyAnimatable(mPropID), + "Creating a nsSMILCSSProperty for a property " + "that's not supported for animation"); } nsSMILValue nsSMILCSSProperty::GetBaseValue() const { // To benefit from Return Value Optimization and avoid copy constructor calls // due to our use of return-by-value, we must return the exact same object // from ALL return points. This function must only return THIS variable:
--- a/dom/smil/nsSMILCSSValueType.cpp +++ b/dom/smil/nsSMILCSSValueType.cpp @@ -40,18 +40,18 @@ GetZeroValueForUnit(StyleAnimationValue: sZeroCoord(0, StyleAnimationValue::CoordConstructor); static const StyleAnimationValue sZeroPercent(0.0f, StyleAnimationValue::PercentConstructor); static const StyleAnimationValue sZeroFloat(0.0f, StyleAnimationValue::FloatConstructor); static const StyleAnimationValue sZeroColor(NS_RGB(0,0,0), StyleAnimationValue::ColorConstructor); - NS_ABORT_IF_FALSE(aUnit != StyleAnimationValue::eUnit_Null, - "Need non-null unit for a zero value"); + MOZ_ASSERT(aUnit != StyleAnimationValue::eUnit_Null, + "Need non-null unit for a zero value"); switch (aUnit) { case StyleAnimationValue::eUnit_Coord: return &sZeroCoord; case StyleAnimationValue::eUnit_Percent: return &sZeroPercent; case StyleAnimationValue::eUnit_Float: return &sZeroFloat; case StyleAnimationValue::eUnit_Color: @@ -70,18 +70,18 @@ GetZeroValueForUnit(StyleAnimationValue: // may apply a workaround for the special case where a 0 length-value is mixed // with a eUnit_Float value. (See comment below.) // // Returns true on success, or false. static const bool FinalizeStyleAnimationValues(const StyleAnimationValue*& aValue1, const StyleAnimationValue*& aValue2) { - NS_ABORT_IF_FALSE(aValue1 || aValue2, - "expecting at least one non-null value"); + MOZ_ASSERT(aValue1 || aValue2, + "expecting at least one non-null value"); // Are we missing either val? (If so, it's an implied 0 in other val's units) if (!aValue1) { aValue1 = GetZeroValueForUnit(aValue2->GetUnit()); return !!aValue1; // Fail if we have no zero value for this unit. } if (!aValue2) { aValue2 = GetZeroValueForUnit(aValue1->GetUnit()); @@ -137,35 +137,35 @@ ExtractValueWrapper(const nsSMILValue& a return static_cast<const ValueWrapper*>(aValue.mU.mPtr); } // Class methods // ------------- void nsSMILCSSValueType::Init(nsSMILValue& aValue) const { - NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected SMIL value type"); + MOZ_ASSERT(aValue.IsNull(), "Unexpected SMIL value type"); aValue.mU.mPtr = nullptr; aValue.mType = this; } void nsSMILCSSValueType::Destroy(nsSMILValue& aValue) const { - NS_ABORT_IF_FALSE(aValue.mType == this, "Unexpected SMIL value type"); + MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value type"); delete static_cast<ValueWrapper*>(aValue.mU.mPtr); aValue.mType = nsSMILNullType::Singleton(); } nsresult nsSMILCSSValueType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const { - NS_ABORT_IF_FALSE(aDest.mType == aSrc.mType, "Incompatible SMIL types"); - NS_ABORT_IF_FALSE(aDest.mType == this, "Unexpected SMIL value type"); + MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types"); + MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value type"); const ValueWrapper* srcWrapper = ExtractValueWrapper(aSrc); ValueWrapper* destWrapper = ExtractValueWrapper(aDest); if (srcWrapper) { if (!destWrapper) { // barely-initialized dest -- need to alloc & copy aDest.mU.mPtr = new ValueWrapper(*srcWrapper); } else { @@ -180,18 +180,18 @@ nsSMILCSSValueType::Assign(nsSMILValue& return NS_OK; } bool nsSMILCSSValueType::IsEqual(const nsSMILValue& aLeft, const nsSMILValue& aRight) const { - NS_ABORT_IF_FALSE(aLeft.mType == aRight.mType, "Incompatible SMIL types"); - NS_ABORT_IF_FALSE(aLeft.mType == this, "Unexpected SMIL value"); + MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types"); + MOZ_ASSERT(aLeft.mType == this, "Unexpected SMIL value"); const ValueWrapper* leftWrapper = ExtractValueWrapper(aLeft); const ValueWrapper* rightWrapper = ExtractValueWrapper(aRight); if (leftWrapper) { if (rightWrapper) { // Both non-null NS_WARN_IF_FALSE(leftWrapper != rightWrapper, "Two nsSMILValues with matching ValueWrapper ptr"); @@ -208,24 +208,24 @@ nsSMILCSSValueType::IsEqual(const nsSMIL // Both null return true; } nsresult nsSMILCSSValueType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, uint32_t aCount) const { - NS_ABORT_IF_FALSE(aValueToAdd.mType == aDest.mType, - "Trying to add invalid types"); - NS_ABORT_IF_FALSE(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"); ValueWrapper* destWrapper = ExtractValueWrapper(aDest); const ValueWrapper* valueToAddWrapper = ExtractValueWrapper(aValueToAdd); - NS_ABORT_IF_FALSE(destWrapper || valueToAddWrapper, - "need at least one fully-initialized value"); + MOZ_ASSERT(destWrapper || valueToAddWrapper, + "need at least one fully-initialized value"); nsCSSProperty property = (valueToAddWrapper ? valueToAddWrapper->mPropID : destWrapper->mPropID); // Special case: font-size-adjust and stroke-dasharray are explicitly // non-additive (even though StyleAnimationValue *could* support adding them) if (property == eCSSProperty_font_size_adjust || property == eCSSProperty_stroke_dasharray) { return NS_ERROR_FAILURE; @@ -255,23 +255,23 @@ nsSMILCSSValueType::Add(nsSMILValue& aDe NS_OK : NS_ERROR_FAILURE; } nsresult nsSMILCSSValueType::ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, double& aDistance) const { - NS_ABORT_IF_FALSE(aFrom.mType == aTo.mType, - "Trying to compare different types"); - NS_ABORT_IF_FALSE(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 ValueWrapper* fromWrapper = ExtractValueWrapper(aFrom); const ValueWrapper* toWrapper = ExtractValueWrapper(aTo); - NS_ABORT_IF_FALSE(toWrapper, "expecting non-null endpoint"); + MOZ_ASSERT(toWrapper, "expecting non-null endpoint"); const StyleAnimationValue* fromCSSValue = fromWrapper ? &fromWrapper->mCSSValue : nullptr; const StyleAnimationValue* toCSSValue = &toWrapper->mCSSValue; if (!FinalizeStyleAnimationValues(fromCSSValue, toCSSValue)) { return NS_ERROR_FAILURE; } @@ -282,28 +282,28 @@ nsSMILCSSValueType::ComputeDistance(cons } nsresult nsSMILCSSValueType::Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, nsSMILValue& aResult) const { - NS_ABORT_IF_FALSE(aStartVal.mType == aEndVal.mType, - "Trying to interpolate different types"); - NS_ABORT_IF_FALSE(aStartVal.mType == this, - "Unexpected types for interpolation"); - NS_ABORT_IF_FALSE(aResult.mType == this, "Unexpected result type"); - NS_ABORT_IF_FALSE(aUnitDistance >= 0.0 && aUnitDistance <= 1.0, - "unit distance value out of bounds"); - NS_ABORT_IF_FALSE(!aResult.mU.mPtr, "expecting barely-initialized outparam"); + 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"); + MOZ_ASSERT(aUnitDistance >= 0.0 && aUnitDistance <= 1.0, + "unit distance value out of bounds"); + MOZ_ASSERT(!aResult.mU.mPtr, "expecting barely-initialized outparam"); const ValueWrapper* startWrapper = ExtractValueWrapper(aStartVal); const ValueWrapper* endWrapper = ExtractValueWrapper(aEndVal); - NS_ABORT_IF_FALSE(endWrapper, "expecting non-null endpoint"); + MOZ_ASSERT(endWrapper, "expecting non-null endpoint"); const StyleAnimationValue* startCSSValue = startWrapper ? &startWrapper->mCSSValue : nullptr; const StyleAnimationValue* endCSSValue = &endWrapper->mCSSValue; if (!FinalizeStyleAnimationValues(startCSSValue, endCSSValue)) { return NS_ERROR_FAILURE; } @@ -365,34 +365,33 @@ ValueFromStringHelper(nsCSSProperty aPro return false; } if (isNegative) { InvertSign(aStyleAnimValue); } if (aPropID == eCSSProperty_font_size) { // Divide out text-zoom, since SVG is supposed to ignore it - NS_ABORT_IF_FALSE(aStyleAnimValue.GetUnit() == - StyleAnimationValue::eUnit_Coord, - "'font-size' value with unexpected style unit"); + MOZ_ASSERT(aStyleAnimValue.GetUnit() == StyleAnimationValue::eUnit_Coord, + "'font-size' value with unexpected style unit"); aStyleAnimValue.SetCoordValue(aStyleAnimValue.GetCoordValue() / aPresContext->TextZoom()); } return true; } // static void nsSMILCSSValueType::ValueFromString(nsCSSProperty aPropID, Element* aTargetElement, const nsAString& aString, nsSMILValue& aValue, bool* aIsContextSensitive) { - NS_ABORT_IF_FALSE(aValue.IsNull(), "Outparam should be null-typed"); + MOZ_ASSERT(aValue.IsNull(), "Outparam should be null-typed"); nsPresContext* presContext = GetPresContextForElement(aTargetElement); if (!presContext) { NS_WARNING("Not parsing animation value; unable to get PresContext"); return; } nsIDocument* doc = aTargetElement->GetCurrentDoc(); if (doc && !nsStyleUtil::CSPAllowsInlineStyle(nullptr, @@ -410,15 +409,15 @@ nsSMILCSSValueType::ValueFromString(nsCS } } // static bool nsSMILCSSValueType::ValueToString(const nsSMILValue& aValue, nsAString& aString) { - NS_ABORT_IF_FALSE(aValue.mType == &nsSMILCSSValueType::sSingleton, - "Unexpected SMIL value type"); + MOZ_ASSERT(aValue.mType == &nsSMILCSSValueType::sSingleton, + "Unexpected SMIL value type"); const ValueWrapper* wrapper = ExtractValueWrapper(aValue); return !wrapper || StyleAnimationValue::UncomputeValue(wrapper->mPropID, wrapper->mCSSValue, aString); }
--- a/dom/smil/nsSMILInstanceTime.cpp +++ b/dom/smil/nsSMILInstanceTime.cpp @@ -42,21 +42,21 @@ nsSMILInstanceTime::nsSMILInstanceTime(c break; } SetBaseInterval(aBaseInterval); } nsSMILInstanceTime::~nsSMILInstanceTime() { - NS_ABORT_IF_FALSE(!mBaseInterval, - "Destroying instance time without first calling Unlink()"); - NS_ABORT_IF_FALSE(mFixedEndpointRefCnt == 0, - "Destroying instance time that is still used as the fixed endpoint of an " - "interval"); + MOZ_ASSERT(!mBaseInterval, + "Destroying instance time without first calling Unlink()"); + MOZ_ASSERT(mFixedEndpointRefCnt == 0, + "Destroying instance time that is still used as the fixed " + "endpoint of an interval"); } void nsSMILInstanceTime::Unlink() { nsRefPtr<nsSMILInstanceTime> deathGrip(this); if (mBaseInterval) { mBaseInterval->RemoveDependentTime(*this); @@ -73,17 +73,17 @@ nsSMILInstanceTime::HandleChangedInterva { // It's possible a sequence of notifications might cause our base interval to // be updated and then deleted. Furthermore, the delete might happen whilst // we're still in the queue to be notified of the change. In any case, if we // don't have a base interval, just ignore the change. if (!mBaseInterval) return; - NS_ABORT_IF_FALSE(mCreator, "Base interval is set but creator is not."); + MOZ_ASSERT(mCreator, "Base interval is set but creator is not."); if (mVisited) { // Break the cycle here Unlink(); return; } bool objectChanged = mCreator->DependsOnBegin() ? aBeginObjectChanged : @@ -95,33 +95,35 @@ nsSMILInstanceTime::HandleChangedInterva nsRefPtr<nsSMILInstanceTime> deathGrip(this); mCreator->HandleChangedInstanceTime(*GetBaseTime(), aSrcContainer, *this, objectChanged); } void nsSMILInstanceTime::HandleDeletedInterval() { - NS_ABORT_IF_FALSE(mBaseInterval, - "Got call to HandleDeletedInterval on an independent instance time"); - NS_ABORT_IF_FALSE(mCreator, "Base interval is set but creator is not"); + MOZ_ASSERT(mBaseInterval, + "Got call to HandleDeletedInterval on an independent instance " + "time"); + MOZ_ASSERT(mCreator, "Base interval is set but creator is not"); mBaseInterval = nullptr; mFlags &= ~kMayUpdate; // Can't update without a base interval nsRefPtr<nsSMILInstanceTime> deathGrip(this); mCreator->HandleDeletedInstanceTime(*this); mCreator = nullptr; } void nsSMILInstanceTime::HandleFilteredInterval() { - NS_ABORT_IF_FALSE(mBaseInterval, - "Got call to HandleFilteredInterval on an independent instance time"); + MOZ_ASSERT(mBaseInterval, + "Got call to HandleFilteredInterval on an independent instance " + "time"); mBaseInterval = nullptr; mFlags &= ~kMayUpdate; // Can't update without a base interval mCreator = nullptr; } bool nsSMILInstanceTime::ShouldPreserve() const @@ -133,26 +135,26 @@ void nsSMILInstanceTime::UnmarkShouldPreserve() { mFlags &= ~kWasDynamicEndpoint; } void nsSMILInstanceTime::AddRefFixedEndpoint() { - NS_ABORT_IF_FALSE(mFixedEndpointRefCnt < UINT16_MAX, - "Fixed endpoint reference count upper limit reached"); + MOZ_ASSERT(mFixedEndpointRefCnt < UINT16_MAX, + "Fixed endpoint reference count upper limit reached"); ++mFixedEndpointRefCnt; mFlags &= ~kMayUpdate; // Once fixed, always fixed } void nsSMILInstanceTime::ReleaseFixedEndpoint() { - NS_ABORT_IF_FALSE(mFixedEndpointRefCnt > 0, "Duplicate release"); + MOZ_ASSERT(mFixedEndpointRefCnt > 0, "Duplicate release"); --mFixedEndpointRefCnt; if (mFixedEndpointRefCnt == 0 && IsDynamic()) { mFlags |= kWasDynamicEndpoint; } } bool nsSMILInstanceTime::IsDependentOn(const nsSMILInstanceTime& aOther) const @@ -174,35 +176,36 @@ nsSMILInstanceTime::IsDependentOn(const const nsSMILInstanceTime* nsSMILInstanceTime::GetBaseTime() const { if (!mBaseInterval) { return nullptr; } - NS_ABORT_IF_FALSE(mCreator, "Base interval is set but there is no creator."); + MOZ_ASSERT(mCreator, "Base interval is set but there is no creator."); if (!mCreator) { return nullptr; } return mCreator->DependsOnBegin() ? mBaseInterval->Begin() : mBaseInterval->End(); } void nsSMILInstanceTime::SetBaseInterval(nsSMILInterval* aBaseInterval) { - NS_ABORT_IF_FALSE(!mBaseInterval, - "Attempting to reassociate an instance time with a different interval."); + MOZ_ASSERT(!mBaseInterval, + "Attempting to reassociate an instance time with a different " + "interval."); if (aBaseInterval) { - NS_ABORT_IF_FALSE(mCreator, - "Attempting to create a dependent instance time without reference " - "to the creating nsSMILTimeValueSpec object."); + MOZ_ASSERT(mCreator, + "Attempting to create a dependent instance time without " + "reference to the creating nsSMILTimeValueSpec object."); if (!mCreator) return; aBaseInterval->AddDependentTime(*this); } mBaseInterval = aBaseInterval; }
--- a/dom/smil/nsSMILInstanceTime.h +++ b/dom/smil/nsSMILInstanceTime.h @@ -72,18 +72,18 @@ public: bool ShouldPreserve() const; void UnmarkShouldPreserve(); void AddRefFixedEndpoint(); void ReleaseFixedEndpoint(); void DependentUpdate(const nsSMILTimeValue& aNewTime) { - NS_ABORT_IF_FALSE(!IsFixedTime(), - "Updating an instance time that is not expected to be updated"); + MOZ_ASSERT(!IsFixedTime(), + "Updating an instance time that is not expected to be updated"); mTime = aNewTime; } bool IsDependent() const { return !!mBaseInterval; } bool IsDependentOn(const nsSMILInstanceTime& aOther) const; const nsSMILInterval* GetBaseInterval() const { return mBaseInterval; } const nsSMILInstanceTime* GetBaseTime() const;
--- a/dom/smil/nsSMILInterval.cpp +++ b/dom/smil/nsSMILInterval.cpp @@ -14,33 +14,33 @@ nsSMILInterval::nsSMILInterval() nsSMILInterval::nsSMILInterval(const nsSMILInterval& aOther) : mBegin(aOther.mBegin), mEnd(aOther.mEnd), mBeginFixed(false), mEndFixed(false) { - NS_ABORT_IF_FALSE(aOther.mDependentTimes.IsEmpty(), - "Attempting to copy-construct an interval with dependent times, " - "this will lead to instance times being shared between intervals."); + MOZ_ASSERT(aOther.mDependentTimes.IsEmpty(), + "Attempt to copy-construct an interval with dependent times; this " + "will lead to instance times being shared between intervals."); // For the time being we don't allow intervals with fixed endpoints to be // copied since we only ever copy-construct to establish a new current // interval. If we ever need to copy historical intervals we may need to move // the ReleaseFixedEndpoint calls from Unlink to the dtor. - NS_ABORT_IF_FALSE(!aOther.mBeginFixed && !aOther.mEndFixed, - "Attempting to copy-construct an interval with fixed endpoints"); + MOZ_ASSERT(!aOther.mBeginFixed && !aOther.mEndFixed, + "Attempt to copy-construct an interval with fixed endpoints"); } nsSMILInterval::~nsSMILInterval() { - NS_ABORT_IF_FALSE(mDependentTimes.IsEmpty(), - "Destroying interval without disassociating dependent instance times. " - "Unlink was not called"); + MOZ_ASSERT(mDependentTimes.IsEmpty(), + "Destroying interval without disassociating dependent instance " + "times. Unlink was not called"); } void nsSMILInterval::Unlink(bool aFiltered) { for (int32_t i = mDependentTimes.Length() - 1; i >= 0; --i) { if (aFiltered) { mDependentTimes[i]->HandleFilteredInterval(); @@ -57,76 +57,76 @@ nsSMILInterval::Unlink(bool aFiltered) mEnd->ReleaseFixedEndpoint(); } mEnd = nullptr; } nsSMILInstanceTime* nsSMILInterval::Begin() { - NS_ABORT_IF_FALSE(mBegin && mEnd, - "Requesting Begin() on un-initialized interval."); + MOZ_ASSERT(mBegin && mEnd, + "Requesting Begin() on un-initialized interval."); return mBegin; } nsSMILInstanceTime* nsSMILInterval::End() { - NS_ABORT_IF_FALSE(mBegin && mEnd, - "Requesting End() on un-initialized interval."); + MOZ_ASSERT(mBegin && mEnd, + "Requesting End() on un-initialized interval."); return mEnd; } void nsSMILInterval::SetBegin(nsSMILInstanceTime& aBegin) { - NS_ABORT_IF_FALSE(aBegin.Time().IsDefinite(), - "Attempting to set unresolved or indefinite begin time on interval"); - NS_ABORT_IF_FALSE(!mBeginFixed, - "Attempting to set begin time but the begin point is fixed"); + MOZ_ASSERT(aBegin.Time().IsDefinite(), + "Attempt to set unresolved or indefinite begin time on interval"); + MOZ_ASSERT(!mBeginFixed, + "Attempt to set begin time but the begin point is fixed"); // Check that we're not making an instance time dependent on itself. Such an // arrangement does not make intuitive sense and should be detected when // creating or updating intervals. - NS_ABORT_IF_FALSE(!mBegin || aBegin.GetBaseTime() != mBegin, - "Attempting to make self-dependent instance time"); + MOZ_ASSERT(!mBegin || aBegin.GetBaseTime() != mBegin, + "Attempt to make self-dependent instance time"); mBegin = &aBegin; } void nsSMILInterval::SetEnd(nsSMILInstanceTime& aEnd) { - NS_ABORT_IF_FALSE(!mEndFixed, - "Attempting to set end time but the end point is fixed"); + MOZ_ASSERT(!mEndFixed, + "Attempt to set end time but the end point is fixed"); // As with SetBegin, check we're not making an instance time dependent on // itself. - NS_ABORT_IF_FALSE(!mEnd || aEnd.GetBaseTime() != mEnd, - "Attempting to make self-dependent instance time"); + MOZ_ASSERT(!mEnd || aEnd.GetBaseTime() != mEnd, + "Attempting to make self-dependent instance time"); mEnd = &aEnd; } void nsSMILInterval::FixBegin() { - NS_ABORT_IF_FALSE(mBegin && mEnd, - "Fixing begin point on un-initialized interval"); - NS_ABORT_IF_FALSE(!mBeginFixed, "Duplicate calls to FixBegin()"); + MOZ_ASSERT(mBegin && mEnd, + "Fixing begin point on un-initialized interval"); + MOZ_ASSERT(!mBeginFixed, "Duplicate calls to FixBegin()"); mBeginFixed = true; mBegin->AddRefFixedEndpoint(); } void nsSMILInterval::FixEnd() { - NS_ABORT_IF_FALSE(mBegin && mEnd, - "Fixing end point on un-initialized interval"); - NS_ABORT_IF_FALSE(mBeginFixed, - "Fixing the end of an interval without a fixed begin"); - NS_ABORT_IF_FALSE(!mEndFixed, "Duplicate calls to FixEnd()"); + MOZ_ASSERT(mBegin && mEnd, + "Fixing end point on un-initialized interval"); + MOZ_ASSERT(mBeginFixed, + "Fixing the end of an interval without a fixed begin"); + MOZ_ASSERT(!mEndFixed, "Duplicate calls to FixEnd()"); mEndFixed = true; mEnd->AddRefFixedEndpoint(); } void nsSMILInterval::AddDependentTime(nsSMILInstanceTime& aTime) { nsRefPtr<nsSMILInstanceTime>* inserted = @@ -138,17 +138,17 @@ nsSMILInterval::AddDependentTime(nsSMILI void nsSMILInterval::RemoveDependentTime(const nsSMILInstanceTime& aTime) { #ifdef DEBUG bool found = #endif mDependentTimes.RemoveElementSorted(&aTime); - NS_ABORT_IF_FALSE(found, "Couldn't find instance time to delete."); + MOZ_ASSERT(found, "Couldn't find instance time to delete."); } void nsSMILInterval::GetDependentTimes(InstanceTimeList& aTimes) { aTimes = mDependentTimes; }
--- a/dom/smil/nsSMILInterval.h +++ b/dom/smil/nsSMILInterval.h @@ -23,26 +23,26 @@ class nsSMILInterval public: nsSMILInterval(); nsSMILInterval(const nsSMILInterval& aOther); ~nsSMILInterval(); void Unlink(bool aFiltered = false); const nsSMILInstanceTime* Begin() const { - NS_ABORT_IF_FALSE(mBegin && mEnd, - "Requesting Begin() on un-initialized instance time"); + MOZ_ASSERT(mBegin && mEnd, + "Requesting Begin() on un-initialized instance time"); return mBegin; } nsSMILInstanceTime* Begin(); const nsSMILInstanceTime* End() const { - NS_ABORT_IF_FALSE(mBegin && mEnd, - "Requesting End() on un-initialized instance time"); + MOZ_ASSERT(mBegin && mEnd, + "Requesting End() on un-initialized instance time"); return mEnd; } nsSMILInstanceTime* End(); void SetBegin(nsSMILInstanceTime& aBegin); void SetEnd(nsSMILInstanceTime& aEnd); void Set(nsSMILInstanceTime& aBegin, nsSMILInstanceTime& aEnd) {
--- a/dom/smil/nsSMILParserUtils.cpp +++ b/dom/smil/nsSMILParserUtils.cpp @@ -266,26 +266,25 @@ ParseOptionalOffset(RangedPtr<const char return SkipWhitespace(aIter, aEnd) && ParseOffsetValue(aIter, aEnd, aResult); } bool ParseAccessKey(const nsAString& aSpec, nsSMILTimeValueSpecParams& aResult) { - NS_ABORT_IF_FALSE(StringBeginsWith(aSpec, ACCESSKEY_PREFIX_CC) || - StringBeginsWith(aSpec, ACCESSKEY_PREFIX_LC), - "Calling ParseAccessKey on non-accesskey-type spec"); + MOZ_ASSERT(StringBeginsWith(aSpec, ACCESSKEY_PREFIX_CC) || + StringBeginsWith(aSpec, ACCESSKEY_PREFIX_LC), + "Calling ParseAccessKey on non-accesskey-type spec"); nsSMILTimeValueSpecParams result; result.mType = nsSMILTimeValueSpecParams::ACCESSKEY; - NS_ABORT_IF_FALSE( - ACCESSKEY_PREFIX_LC.Length() == ACCESSKEY_PREFIX_CC.Length(), - "Case variations for accesskey prefix differ in length"); + MOZ_ASSERT(ACCESSKEY_PREFIX_LC.Length() == ACCESSKEY_PREFIX_CC.Length(), + "Case variations for accesskey prefix differ in length"); RangedPtr<const char16_t> iter(SVGContentUtils::GetStartRangedPtr(aSpec)); RangedPtr<const char16_t> end(SVGContentUtils::GetEndRangedPtr(aSpec)); iter += ACCESSKEY_PREFIX_LC.Length(); // Expecting at least <accesskey> + ')' if (end - iter < 2) @@ -366,17 +365,17 @@ ConvertTokenToAtom(const nsAString& aTok nsAutoString token(aToken); const char16_t* read = token.BeginReading(); const char16_t* const end = token.EndReading(); char16_t* write = token.BeginWriting(); bool escape = false; while (read != end) { - NS_ABORT_IF_FALSE(write <= read, "Writing past where we've read"); + MOZ_ASSERT(write <= read, "Writing past where we've read"); if (!escape && *read == '\\') { escape = true; ++read; } else { *write++ = *read++; escape = false; } }
--- a/dom/smil/nsSMILTimeContainer.cpp +++ b/dom/smil/nsSMILTimeContainer.cpp @@ -249,19 +249,19 @@ nsSMILTimeContainer::PopMilestoneElement nsSMILTimeValue containerTime = ParentToContainerTime(aMilestone.mTime); if (!containerTime.IsDefinite()) return false; nsSMILMilestone containerMilestone(containerTime.GetMillis(), aMilestone.mIsEnd); - NS_ABORT_IF_FALSE(mMilestoneEntries.Top().mMilestone >= containerMilestone, - "Trying to pop off earliest times but we have earlier ones that were " - "overlooked"); + MOZ_ASSERT(mMilestoneEntries.Top().mMilestone >= containerMilestone, + "Trying to pop off earliest times but we have earlier ones that " + "were overlooked"); bool gotOne = false; while (!mMilestoneEntries.IsEmpty() && mMilestoneEntries.Top().mMilestone == containerMilestone) { aMatchedElements.AppendElement(mMilestoneEntries.Pop().mTimebase); gotOne = true; } @@ -286,17 +286,17 @@ nsSMILTimeContainer::Unlink() mMilestoneEntries.Clear(); } void nsSMILTimeContainer::UpdateCurrentTime() { nsSMILTime now = IsPaused() ? mPauseStart : GetParentTime(); mCurrentTime = now - mParentOffset; - NS_ABORT_IF_FALSE(mCurrentTime >= 0, "Container has negative time"); + MOZ_ASSERT(mCurrentTime >= 0, "Container has negative time"); } void nsSMILTimeContainer::NotifyTimeChange() { // Called when the container time is changed with respect to the document // time. When this happens time dependencies in other time containers need to // re-resolve their times because begin and end times are stored in container @@ -308,14 +308,14 @@ nsSMILTimeContainer::NotifyTimeChange() // registered. Other timed elements don't matter. const MilestoneEntry* p = mMilestoneEntries.Elements(); #if DEBUG uint32_t queueLength = mMilestoneEntries.Length(); #endif while (p < mMilestoneEntries.Elements() + mMilestoneEntries.Length()) { mozilla::dom::SVGAnimationElement* elem = p->mTimebase.get(); elem->TimedElement().HandleContainerTimeChange(); - NS_ABORT_IF_FALSE(queueLength == mMilestoneEntries.Length(), - "Call to HandleContainerTimeChange resulted in a change to the " - "queue of milestones"); + MOZ_ASSERT(queueLength == mMilestoneEntries.Length(), + "Call to HandleContainerTimeChange resulted in a change to the " + "queue of milestones"); ++p; } }
--- a/dom/smil/nsSMILTimeValue.h +++ b/dom/smil/nsSMILTimeValue.h @@ -83,18 +83,18 @@ public: { mState = STATE_UNRESOLVED; mMilliseconds = kUnresolvedMillis; } bool IsDefinite() const { return mState == STATE_DEFINITE; } nsSMILTime GetMillis() const { - NS_ABORT_IF_FALSE(mState == STATE_DEFINITE, - "GetMillis() called for unresolved or indefinite time"); + MOZ_ASSERT(mState == STATE_DEFINITE, + "GetMillis() called for unresolved or indefinite time"); return mState == STATE_DEFINITE ? mMilliseconds : kUnresolvedMillis; } void SetMillis(nsSMILTime aMillis) { mState = STATE_DEFINITE; mMilliseconds = aMillis;
--- a/dom/smil/nsSMILTimeValueSpec.cpp +++ b/dom/smil/nsSMILTimeValueSpec.cpp @@ -87,18 +87,18 @@ nsSMILTimeValueSpec::SetSpec(const nsASt } void nsSMILTimeValueSpec::ResolveReferences(nsIContent* aContextNode) { if (mParams.mType != nsSMILTimeValueSpecParams::SYNCBASE && !IsEventBased()) return; - NS_ABORT_IF_FALSE(aContextNode, - "null context node for resolving timing references against"); + MOZ_ASSERT(aContextNode, + "null context node for resolving timing references against"); // If we're not bound to the document yet, don't worry, we'll get called again // when that happens if (!aContextNode->IsInDoc()) return; // Hold ref to the old element so that it isn't destroyed in between resetting // the referenced element and using the pointer to update the referenced @@ -108,20 +108,20 @@ nsSMILTimeValueSpec::ResolveReferences(n if (mParams.mDependentElemID) { mReferencedElement.ResetWithID(aContextNode, nsDependentAtomString(mParams.mDependentElemID)); } else if (mParams.mType == nsSMILTimeValueSpecParams::EVENT) { Element* target = mOwner->GetTargetElement(); mReferencedElement.ResetWithElement(target); } else if (mParams.mType == nsSMILTimeValueSpecParams::ACCESSKEY) { nsIDocument* doc = aContextNode->GetCurrentDoc(); - NS_ABORT_IF_FALSE(doc, "We are in the document but current doc is null"); + MOZ_ASSERT(doc, "We are in the document but current doc is null"); mReferencedElement.ResetWithElement(doc->GetRootElement()); } else { - NS_ABORT_IF_FALSE(false, "Syncbase or repeat spec without ID"); + MOZ_ASSERT(false, "Syncbase or repeat spec without ID"); } UpdateReferencedElement(oldReferencedElement, mReferencedElement.get()); } bool nsSMILTimeValueSpec::IsEventBased() const { return mParams.mType == nsSMILTimeValueSpecParams::EVENT || @@ -292,21 +292,22 @@ nsSMILTimeValueSpec::IsWhitelistedEvent( } return false; } void nsSMILTimeValueSpec::RegisterEventListener(Element* aTarget) { - NS_ABORT_IF_FALSE(IsEventBased(), - "Attempting to register event-listener for unexpected nsSMILTimeValueSpec" - " type"); - NS_ABORT_IF_FALSE(mParams.mEventSymbol, - "Attempting to register event-listener but there is no event name"); + MOZ_ASSERT(IsEventBased(), + "Attempting to register event-listener for unexpected " + "nsSMILTimeValueSpec type"); + MOZ_ASSERT(mParams.mEventSymbol, + "Attempting to register event-listener but there is no event " + "name"); if (!aTarget) return; // When script is disabled, only allow registration for whitelisted events. if (!aTarget->GetOwnerDocument()->IsScriptEnabled() && !IsWhitelistedEvent()) { return; @@ -338,17 +339,17 @@ nsSMILTimeValueSpec::UnregisterEventList elm->RemoveEventListenerByType(mEventListener, nsDependentAtomString(mParams.mEventSymbol), AllEventsAtSystemGroupBubble()); } EventListenerManager* nsSMILTimeValueSpec::GetEventListenerManager(Element* aTarget) { - NS_ABORT_IF_FALSE(aTarget, "null target; can't get EventListenerManager"); + MOZ_ASSERT(aTarget, "null target; can't get EventListenerManager"); nsCOMPtr<EventTarget> target; if (mParams.mType == nsSMILTimeValueSpecParams::ACCESSKEY) { nsIDocument* doc = aTarget->GetCurrentDoc(); if (!doc) return nullptr; nsPIDOMWindow* win = doc->GetWindow(); @@ -362,20 +363,20 @@ nsSMILTimeValueSpec::GetEventListenerMan return nullptr; return target->GetOrCreateListenerManager(); } void nsSMILTimeValueSpec::HandleEvent(nsIDOMEvent* aEvent) { - NS_ABORT_IF_FALSE(mEventListener, "Got event without an event listener"); - NS_ABORT_IF_FALSE(IsEventBased(), - "Got event for non-event nsSMILTimeValueSpec"); - NS_ABORT_IF_FALSE(aEvent, "No event supplied"); + MOZ_ASSERT(mEventListener, "Got event without an event listener"); + MOZ_ASSERT(IsEventBased(), + "Got event for non-event nsSMILTimeValueSpec"); + MOZ_ASSERT(aEvent, "No event supplied"); // XXX In the long run we should get the time from the event itself which will // store the time in global document time which we'll need to convert to our // time container nsSMILTimeContainer* container = mOwner->GetTimeContainer(); if (!container) return; @@ -504,18 +505,18 @@ nsSMILTimeValueSpec::ConvertBetweenTimeC nsSMILTimeValue docTime = aSrcContainer->ContainerToParentTime(aSrcTime.GetMillis()); if (docTime.IsIndefinite()) // This will happen if the source container is paused and we have a future // time. Just return the indefinite time. return docTime; - NS_ABORT_IF_FALSE(docTime.IsDefinite(), - "ContainerToParentTime gave us an unresolved or indefinite time"); + MOZ_ASSERT(docTime.IsDefinite(), + "ContainerToParentTime gave us an unresolved or indefinite time"); return dstContainer->ParentToContainerTime(docTime.GetMillis()); } bool nsSMILTimeValueSpec::ApplyOffset(nsSMILTimeValue& aTime) const { // indefinite + offset = indefinite. Likewise for unresolved times.
--- a/dom/smil/nsSMILTimedElement.cpp +++ b/dom/smil/nsSMILTimedElement.cpp @@ -43,35 +43,35 @@ using namespace mozilla::dom; // // The serial number also means that every instance time has an unambiguous // position in the array so we can use RemoveElementSorted and the like. bool nsSMILTimedElement::InstanceTimeComparator::Equals( const nsSMILInstanceTime* aElem1, const nsSMILInstanceTime* aElem2) const { - NS_ABORT_IF_FALSE(aElem1 && aElem2, - "Trying to compare null instance time pointers"); - NS_ABORT_IF_FALSE(aElem1->Serial() && aElem2->Serial(), - "Instance times have not been assigned serial numbers"); - NS_ABORT_IF_FALSE(aElem1 == aElem2 || aElem1->Serial() != aElem2->Serial(), - "Serial numbers are not unique"); + MOZ_ASSERT(aElem1 && aElem2, + "Trying to compare null instance time pointers"); + MOZ_ASSERT(aElem1->Serial() && aElem2->Serial(), + "Instance times have not been assigned serial numbers"); + MOZ_ASSERT(aElem1 == aElem2 || aElem1->Serial() != aElem2->Serial(), + "Serial numbers are not unique"); return aElem1->Serial() == aElem2->Serial(); } bool nsSMILTimedElement::InstanceTimeComparator::LessThan( const nsSMILInstanceTime* aElem1, const nsSMILInstanceTime* aElem2) const { - NS_ABORT_IF_FALSE(aElem1 && aElem2, - "Trying to compare null instance time pointers"); - NS_ABORT_IF_FALSE(aElem1->Serial() && aElem2->Serial(), - "Instance times have not been assigned serial numbers"); + MOZ_ASSERT(aElem1 && aElem2, + "Trying to compare null instance time pointers"); + MOZ_ASSERT(aElem1->Serial() && aElem2->Serial(), + "Instance times have not been assigned serial numbers"); int8_t cmp = aElem1->Time().CompareTo(aElem2->Time()); return cmp == 0 ? aElem1->Serial() < aElem2->Serial() : cmp < 0; } //---------------------------------------------------------------------- // Helper class: AsyncTimeEventRunner @@ -190,19 +190,18 @@ nsSMILTimedElement::RemoveInstanceTimes( // instance time that corresponds to the previous interval's end time. // // Most functors supplied here fulfil this condition by checking if the // instance time is marked as "ShouldPreserve" and if so, not deleting it. // // However, when filtering instance times, we sometimes need to drop even // instance times marked as "ShouldPreserve". In that case we take special // care not to delete the end instance time of the previous interval. - NS_ABORT_IF_FALSE(!GetPreviousInterval() || - item != GetPreviousInterval()->End(), - "Removing end instance time of previous interval"); + MOZ_ASSERT(!GetPreviousInterval() || item != GetPreviousInterval()->End(), + "Removing end instance time of previous interval"); item->Unlink(); } else { newArray.AppendElement(item); } } aArray.Clear(); aArray.SwapElements(newArray); } @@ -277,29 +276,29 @@ nsSMILTimedElement::~nsSMILTimedElement( // (We shouldn't get any callbacks from this because all our instance times // are now disassociated with any intervals) ClearIntervals(); // The following assertions are important in their own right (for checking // correct behavior) but also because AutoIntervalUpdateBatcher holds pointers // to class so if they fail there's the possibility we might have dangling // pointers. - NS_ABORT_IF_FALSE(!mDeferIntervalUpdates, - "Interval updates should no longer be blocked when an nsSMILTimedElement " - "disappears"); - NS_ABORT_IF_FALSE(!mDoDeferredUpdate, - "There should no longer be any pending updates when an " - "nsSMILTimedElement disappears"); + MOZ_ASSERT(!mDeferIntervalUpdates, + "Interval updates should no longer be blocked when an " + "nsSMILTimedElement disappears"); + MOZ_ASSERT(!mDoDeferredUpdate, + "There should no longer be any pending updates when an " + "nsSMILTimedElement disappears"); } void nsSMILTimedElement::SetAnimationElement(SVGAnimationElement* aElement) { - NS_ABORT_IF_FALSE(aElement, "NULL owner element"); - NS_ABORT_IF_FALSE(!mAnimationElement, "Re-setting owner"); + MOZ_ASSERT(aElement, "NULL owner element"); + MOZ_ASSERT(!mAnimationElement, "Re-setting owner"); mAnimationElement = aElement; } nsSMILTimeContainer* nsSMILTimedElement::GetTimeContainer() { return mAnimationElement ? mAnimationElement->GetTimeContainer() : nullptr; } @@ -380,28 +379,28 @@ nsSMILTimedElement::GetHyperlinkTime() c //---------------------------------------------------------------------- // nsSMILTimedElement void nsSMILTimedElement::AddInstanceTime(nsSMILInstanceTime* aInstanceTime, bool aIsBegin) { - NS_ABORT_IF_FALSE(aInstanceTime, "Attempting to add null instance time"); + MOZ_ASSERT(aInstanceTime, "Attempting to add null instance time"); // Event-sensitivity: If an element is not active (but the parent time // container is), then events are only handled for begin specifications. if (mElementState != STATE_ACTIVE && !aIsBegin && aInstanceTime->IsDynamic()) { // No need to call Unlink here--dynamic instance times shouldn't be linked // to anything that's going to miss them - NS_ABORT_IF_FALSE(!aInstanceTime->GetBaseInterval(), - "Dynamic instance time has a base interval--we probably need to unlink" - " it if we're not going to use it"); + MOZ_ASSERT(!aInstanceTime->GetBaseInterval(), + "Dynamic instance time has a base interval--we probably need " + "to unlink it if we're not going to use it"); return; } aInstanceTime->SetSerial(++mInstanceSerialIndex); InstanceTimeList& instanceList = aIsBegin ? mBeginInstances : mEndInstances; nsRefPtr<nsSMILInstanceTime>* inserted = instanceList.InsertElementSorted(aInstanceTime, InstanceTimeComparator()); if (!inserted) { @@ -412,17 +411,17 @@ nsSMILTimedElement::AddInstanceTime(nsSM UpdateCurrentInterval(); } void nsSMILTimedElement::UpdateInstanceTime(nsSMILInstanceTime* aInstanceTime, nsSMILTimeValue& aUpdatedTime, bool aIsBegin) { - NS_ABORT_IF_FALSE(aInstanceTime, "Attempting to update null instance time"); + MOZ_ASSERT(aInstanceTime, "Attempting to update null instance time"); // The reason we update the time here and not in the nsSMILTimeValueSpec is // that it means we *could* re-sort more efficiently by doing a sorted remove // and insert but currently this doesn't seem to be necessary given how // infrequently we get these change notices. aInstanceTime->DependentUpdate(aUpdatedTime); InstanceTimeList& instanceList = aIsBegin ? mBeginInstances : mEndInstances; instanceList.Sort(InstanceTimeComparator()); @@ -444,29 +443,29 @@ nsSMILTimedElement::UpdateInstanceTime(n UpdateCurrentInterval(changedCurrentInterval); } void nsSMILTimedElement::RemoveInstanceTime(nsSMILInstanceTime* aInstanceTime, bool aIsBegin) { - NS_ABORT_IF_FALSE(aInstanceTime, "Attempting to remove null instance time"); + MOZ_ASSERT(aInstanceTime, "Attempting to remove null instance time"); // If the instance time should be kept (because it is or was the fixed end // point of an interval) then just disassociate it from the creator. if (aInstanceTime->ShouldPreserve()) { aInstanceTime->Unlink(); return; } InstanceTimeList& instanceList = aIsBegin ? mBeginInstances : mEndInstances; mozilla::DebugOnly<bool> found = instanceList.RemoveElementSorted(aInstanceTime, InstanceTimeComparator()); - NS_ABORT_IF_FALSE(found, "Couldn't find instance time to delete"); + MOZ_ASSERT(found, "Couldn't find instance time to delete"); UpdateCurrentInterval(); } namespace { class MOZ_STACK_CLASS RemoveByCreator { @@ -493,17 +492,17 @@ namespace const nsSMILTimeValueSpec* mCreator; }; } void nsSMILTimedElement::RemoveInstanceTimesForCreator( const nsSMILTimeValueSpec* aCreator, bool aIsBegin) { - NS_ABORT_IF_FALSE(aCreator, "Creator not set"); + MOZ_ASSERT(aCreator, "Creator not set"); InstanceTimeList& instances = aIsBegin ? mBeginInstances : mEndInstances; RemoveByCreator removeByCreator(aCreator); RemoveInstanceTimes(instances, removeByCreator); UpdateCurrentInterval(); } @@ -555,20 +554,20 @@ nsSMILTimedElement::SampleEndAt(nsSMILTi // our next real milestone is registered. RegisterMilestone(); } } void nsSMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, bool aEndOnly) { - NS_ABORT_IF_FALSE(mAnimationElement, - "Got sample before being registered with an animation element"); - NS_ABORT_IF_FALSE(GetTimeContainer(), - "Got sample without being registered with a time container"); + MOZ_ASSERT(mAnimationElement, + "Got sample before being registered with an animation element"); + MOZ_ASSERT(GetTimeContainer(), + "Got sample without being registered with a time container"); // This could probably happen if we later implement externalResourcesRequired // (bug 277955) and whilst waiting for those resources (and the animation to // start) we transfer a node from another document fragment that has already // started. In such a case we might receive milestone samples registered with // the already active container. if (GetTimeContainer()->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN)) return; @@ -599,21 +598,22 @@ nsSMILTimedElement::DoSampleAt(nsSMILTim bool stateChanged; nsSMILTimeValue sampleTime(aContainerTime); do { #ifdef DEBUG // Check invariant if (mElementState == STATE_STARTUP || mElementState == STATE_POSTACTIVE) { - NS_ABORT_IF_FALSE(!mCurrentInterval, - "Shouldn't have current interval in startup or postactive states"); + MOZ_ASSERT(!mCurrentInterval, + "Shouldn't have current interval in startup or postactive " + "states"); } else { - NS_ABORT_IF_FALSE(mCurrentInterval, - "Should have current interval in waiting and active states"); + MOZ_ASSERT(mCurrentInterval, + "Should have current interval in waiting and active states"); } #endif stateChanged = false; switch (mElementState) { case STATE_STARTUP: @@ -689,18 +689,18 @@ nsSMILTimedElement::DoSampleAt(nsSMILTim mOldIntervals[mOldIntervals.Length() - 1], false, true); } if (mElementState == STATE_WAITING) { NotifyNewInterval(); } FilterHistory(); stateChanged = true; } else { - NS_ABORT_IF_FALSE(!didApplyEarlyEnd, - "We got an early end, but didn't end"); + MOZ_ASSERT(!didApplyEarlyEnd, + "We got an early end, but didn't end"); nsSMILTime beginTime = mCurrentInterval->Begin()->Time().GetMillis(); NS_ASSERTION(aContainerTime >= beginTime, "Sample time should not precede current interval"); nsSMILTime activeTime = aContainerTime - beginTime; // The 'min' attribute can cause the active interval to be longer than // the 'repeating interval'. // In that extended period we apply the fill mode. @@ -766,53 +766,53 @@ nsSMILTimedElement::HandleContainerTimeC namespace { bool RemoveNonDynamic(nsSMILInstanceTime* aInstanceTime) { // Generally dynamically-generated instance times (DOM calls, event-based // times) are not associated with their creator nsSMILTimeValueSpec since // they may outlive them. - NS_ABORT_IF_FALSE(!aInstanceTime->IsDynamic() || - !aInstanceTime->GetCreator(), - "Dynamic instance time should be unlinked from its creator"); + MOZ_ASSERT(!aInstanceTime->IsDynamic() || !aInstanceTime->GetCreator(), + "Dynamic instance time should be unlinked from its creator"); return !aInstanceTime->IsDynamic() && !aInstanceTime->ShouldPreserve(); } } void nsSMILTimedElement::Rewind() { - NS_ABORT_IF_FALSE(mAnimationElement, - "Got rewind request before being attached to an animation element"); + MOZ_ASSERT(mAnimationElement, + "Got rewind request before being attached to an animation " + "element"); // It's possible to get a rewind request whilst we're already in the middle of // a backwards seek. This can happen when we're performing tree surgery and // seeking containers at the same time because we can end up requesting // a local rewind on an element after binding it to a new container and then // performing a rewind on that container as a whole without sampling in // between. // // However, it should currently be impossible to get a rewind in the middle of // a forwards seek since forwards seeks are detected and processed within the // same (re)sample. if (mSeekState == SEEK_NOT_SEEKING) { mSeekState = mElementState == STATE_ACTIVE ? SEEK_BACKWARD_FROM_ACTIVE : SEEK_BACKWARD_FROM_INACTIVE; } - NS_ABORT_IF_FALSE(mSeekState == SEEK_BACKWARD_FROM_INACTIVE || - mSeekState == SEEK_BACKWARD_FROM_ACTIVE, - "Rewind in the middle of a forwards seek?"); + MOZ_ASSERT(mSeekState == SEEK_BACKWARD_FROM_INACTIVE || + mSeekState == SEEK_BACKWARD_FROM_ACTIVE, + "Rewind in the middle of a forwards seek?"); ClearTimingState(RemoveNonDynamic); RebuildTimingState(RemoveNonDynamic); - NS_ABORT_IF_FALSE(!mCurrentInterval, - "Current interval is set at end of rewind"); + MOZ_ASSERT(!mCurrentInterval, + "Current interval is set at end of rewind"); } namespace { bool RemoveAll(nsSMILInstanceTime* aInstanceTime) { return true; @@ -967,18 +967,18 @@ nsSMILTimedElement::SetSimpleDuration(co if (!nsSMILParserUtils::ParseClockValue(dur, &duration) || duration.GetMillis() == 0L) { mSimpleDur.SetIndefinite(); return NS_ERROR_FAILURE; } } // mSimpleDur should never be unresolved. ParseClockValue will either set // duration to resolved or will return false. - NS_ABORT_IF_FALSE(duration.IsResolved(), - "Setting unresolved simple duration"); + MOZ_ASSERT(duration.IsResolved(), + "Setting unresolved simple duration"); mSimpleDur = duration; return NS_OK; } void nsSMILTimedElement::UnsetSimpleDuration() @@ -1000,17 +1000,17 @@ nsSMILTimedElement::SetMin(const nsAStri duration.SetMillis(0L); } else { if (!nsSMILParserUtils::ParseClockValue(min, &duration)) { mMin.SetMillis(0L); return NS_ERROR_FAILURE; } } - NS_ABORT_IF_FALSE(duration.GetMillis() >= 0L, "Invalid duration"); + MOZ_ASSERT(duration.GetMillis() >= 0L, "Invalid duration"); mMin = duration; return NS_OK; } void nsSMILTimedElement::UnsetMin() @@ -1031,17 +1031,17 @@ nsSMILTimedElement::SetMax(const nsAStri if (max.EqualsLiteral("media") || max.EqualsLiteral("indefinite")) { duration.SetIndefinite(); } else { if (!nsSMILParserUtils::ParseClockValue(max, &duration) || duration.GetMillis() == 0L) { mMax.SetIndefinite(); return NS_ERROR_FAILURE; } - NS_ABORT_IF_FALSE(duration.GetMillis() > 0L, "Invalid duration"); + MOZ_ASSERT(duration.GetMillis() > 0L, "Invalid duration"); } mMax = duration; return NS_OK; } void @@ -1157,18 +1157,18 @@ nsSMILTimedElement::UnsetFillMode() } } void nsSMILTimedElement::AddDependent(nsSMILTimeValueSpec& aDependent) { // There's probably no harm in attempting to register a dependent // nsSMILTimeValueSpec twice, but we're not expecting it to happen. - NS_ABORT_IF_FALSE(!mTimeDependents.GetEntry(&aDependent), - "nsSMILTimeValueSpec is already registered as a dependency"); + MOZ_ASSERT(!mTimeDependents.GetEntry(&aDependent), + "nsSMILTimeValueSpec is already registered as a dependency"); mTimeDependents.PutEntry(&aDependent); // Add current interval. We could add historical intervals too but that would // cause unpredictable results since some intervals may have been filtered. // SMIL doesn't say what to do here so for simplicity and consistency we // simply add the current interval if there is one. // // It's not necessary to call SyncPauseTime since we're dealing with @@ -1246,47 +1246,47 @@ nsSMILTimedElement::HandleTargetElementC } void nsSMILTimedElement::Traverse(nsCycleCollectionTraversalCallback* aCallback) { uint32_t count = mBeginSpecs.Length(); for (uint32_t i = 0; i < count; ++i) { nsSMILTimeValueSpec* beginSpec = mBeginSpecs[i]; - NS_ABORT_IF_FALSE(beginSpec, - "null nsSMILTimeValueSpec in list of begin specs"); + MOZ_ASSERT(beginSpec, + "null nsSMILTimeValueSpec in list of begin specs"); beginSpec->Traverse(aCallback); } count = mEndSpecs.Length(); for (uint32_t j = 0; j < count; ++j) { nsSMILTimeValueSpec* endSpec = mEndSpecs[j]; - NS_ABORT_IF_FALSE(endSpec, "null nsSMILTimeValueSpec in list of end specs"); + MOZ_ASSERT(endSpec, "null nsSMILTimeValueSpec in list of end specs"); endSpec->Traverse(aCallback); } } void nsSMILTimedElement::Unlink() { AutoIntervalUpdateBatcher updateBatcher(*this); // Remove dependencies on other elements uint32_t count = mBeginSpecs.Length(); for (uint32_t i = 0; i < count; ++i) { nsSMILTimeValueSpec* beginSpec = mBeginSpecs[i]; - NS_ABORT_IF_FALSE(beginSpec, - "null nsSMILTimeValueSpec in list of begin specs"); + MOZ_ASSERT(beginSpec, + "null nsSMILTimeValueSpec in list of begin specs"); beginSpec->Unlink(); } count = mEndSpecs.Length(); for (uint32_t j = 0; j < count; ++j) { nsSMILTimeValueSpec* endSpec = mEndSpecs[j]; - NS_ABORT_IF_FALSE(endSpec, "null nsSMILTimeValueSpec in list of end specs"); + MOZ_ASSERT(endSpec, "null nsSMILTimeValueSpec in list of end specs"); endSpec->Unlink(); } ClearIntervals(); // Make sure we don't notify other elements of new intervals mTimeDependents.Clear(); } @@ -1381,18 +1381,18 @@ nsSMILTimedElement::ClearIntervals() } mOldIntervals.Clear(); } bool nsSMILTimedElement::ApplyEarlyEnd(const nsSMILTimeValue& aSampleTime) { // This should only be called within DoSampleAt as a helper function - NS_ABORT_IF_FALSE(mElementState == STATE_ACTIVE, - "Unexpected state to try to apply an early end"); + MOZ_ASSERT(mElementState == STATE_ACTIVE, + "Unexpected state to try to apply an early end"); bool updated = false; // Only apply an early end if we're not already ending. if (mCurrentInterval->End()->Time() > aSampleTime) { nsSMILInstanceTime* earlyEnd = CheckForEarlyEnd(aSampleTime); if (earlyEnd) { if (earlyEnd->IsDependent()) { @@ -1692,18 +1692,18 @@ nsSMILTimedElement::FilterInstanceTimes( // http://www.w3.org/TR/2001/REC-smil-animation-20010904/#Timing-BeginEnd-LC-Start // bool nsSMILTimedElement::GetNextInterval(const nsSMILInterval* aPrevInterval, const nsSMILInterval* aReplacedInterval, const nsSMILInstanceTime* aFixedBeginTime, nsSMILInterval& aResult) const { - NS_ABORT_IF_FALSE(!aFixedBeginTime || aFixedBeginTime->Time().IsDefinite(), - "Unresolved or indefinite begin time specified for interval start"); + MOZ_ASSERT(!aFixedBeginTime || aFixedBeginTime->Time().IsDefinite(), + "Unresolved or indefinite begin time given for interval start"); static const nsSMILTimeValue zeroTime(0L); if (mRestartMode == RESTART_NEVER && aPrevInterval) return false; // Calc starting point nsSMILTimeValue beginAfter; bool prevIntervalWasZeroDur = false; @@ -1741,19 +1741,19 @@ nsSMILTimedElement::GetNextInterval(cons // If we're updating the current interval then skip any begin time that is // dependent on the current interval's begin time. e.g. // <animate id="a" begin="b.begin; a.begin+2s"... // If b's interval disappears whilst 'a' is in the waiting state the begin // time at "a.begin+2s" should be skipped since 'a' never begun. } while (aReplacedInterval && tempBegin->GetBaseTime() == aReplacedInterval->Begin()); } - NS_ABORT_IF_FALSE(tempBegin && tempBegin->Time().IsDefinite() && - tempBegin->Time() >= beginAfter, - "Got a bad begin time while fetching next interval"); + MOZ_ASSERT(tempBegin && tempBegin->Time().IsDefinite() && + tempBegin->Time() >= beginAfter, + "Got a bad begin time while fetching next interval"); // Calculate end time { int32_t endPos = 0; do { tempEnd = GetNextGreaterOrEqual(mEndInstances, tempBegin->Time(), endPos); @@ -1806,17 +1806,17 @@ nsSMILTimedElement::GetNextInterval(cons nsSMILTimeValue intervalEnd = tempEnd ? tempEnd->Time() : nsSMILTimeValue(); nsSMILTimeValue activeEnd = CalcActiveEnd(tempBegin->Time(), intervalEnd); if (!tempEnd || intervalEnd != activeEnd) { tempEnd = new nsSMILInstanceTime(activeEnd); } } - NS_ABORT_IF_FALSE(tempEnd, "Failed to get end point for next interval"); + MOZ_ASSERT(tempEnd, "Failed to get end point for next interval"); // When we choose the interval endpoints, we don't allow coincident // zero-duration intervals, so if we arrive here and we have a zero-duration // interval starting at the same point as a previous zero-duration interval, // then it must be because we've applied constraints to the active duration. // In that case, we will potentially run into an infinite loop, so we break // it by searching for the next interval that starts AFTER our current // zero-duration interval. @@ -1864,17 +1864,17 @@ nsSMILTimedElement::GetNextGreaterOrEqua const nsSMILTimeValue& aBase, int32_t& aPosition) const { nsSMILInstanceTime* result = nullptr; int32_t count = aList.Length(); for (; aPosition < count && !result; ++aPosition) { nsSMILInstanceTime* val = aList[aPosition].get(); - NS_ABORT_IF_FALSE(val, "NULL instance time in list"); + MOZ_ASSERT(val, "NULL instance time in list"); if (val->Time() >= aBase) { result = val; } } return result; } @@ -1882,20 +1882,20 @@ nsSMILTimedElement::GetNextGreaterOrEqua * @see SMILANIM 3.3.4 */ nsSMILTimeValue nsSMILTimedElement::CalcActiveEnd(const nsSMILTimeValue& aBegin, const nsSMILTimeValue& aEnd) const { nsSMILTimeValue result; - NS_ABORT_IF_FALSE(mSimpleDur.IsResolved(), - "Unresolved simple duration in CalcActiveEnd"); - NS_ABORT_IF_FALSE(aBegin.IsDefinite(), - "Indefinite or unresolved begin time in CalcActiveEnd"); + MOZ_ASSERT(mSimpleDur.IsResolved(), + "Unresolved simple duration in CalcActiveEnd"); + MOZ_ASSERT(aBegin.IsDefinite(), + "Indefinite or unresolved begin time in CalcActiveEnd"); result = GetRepeatDuration(); if (aEnd.IsDefinite()) { nsSMILTime activeDur = aEnd.GetMillis() - aBegin.GetMillis(); if (result.IsDefinite()) { result.SetMillis(std::min(result.GetMillis(), activeDur)); @@ -1963,19 +1963,19 @@ nsSMILTimedElement::ApplyMinAndMax(const } nsSMILTime nsSMILTimedElement::ActiveTimeToSimpleTime(nsSMILTime aActiveTime, uint32_t& aRepeatIteration) { nsSMILTime result; - NS_ABORT_IF_FALSE(mSimpleDur.IsResolved(), - "Unresolved simple duration in ActiveTimeToSimpleTime"); - NS_ABORT_IF_FALSE(aActiveTime >= 0, "Expecting non-negative active time"); + MOZ_ASSERT(mSimpleDur.IsResolved(), + "Unresolved simple duration in ActiveTimeToSimpleTime"); + MOZ_ASSERT(aActiveTime >= 0, "Expecting non-negative active time"); // Note that a negative aActiveTime will give us a negative value for // aRepeatIteration, which is bad because aRepeatIteration is unsigned if (mSimpleDur.IsIndefinite() || mSimpleDur.GetMillis() == 0L) { aRepeatIteration = 0; result = aActiveTime; } else { result = aActiveTime % mSimpleDur.GetMillis(); @@ -1996,18 +1996,18 @@ nsSMILTimedElement::ActiveTimeToSimpleTi // than) the defined end for the current interval. Ending in this manner will // also send a changed time notice to all time dependents for the current // interval end.' // nsSMILInstanceTime* nsSMILTimedElement::CheckForEarlyEnd( const nsSMILTimeValue& aContainerTime) const { - NS_ABORT_IF_FALSE(mCurrentInterval, - "Checking for an early end but the current interval is not set"); + MOZ_ASSERT(mCurrentInterval, + "Checking for an early end but the current interval is not set"); if (mRestartMode != RESTART_ALWAYS) return nullptr; int32_t position = 0; nsSMILInstanceTime* nextBegin = GetNextGreater(mBeginInstances, mCurrentInterval->Begin()->Time(), position); @@ -2047,45 +2047,46 @@ nsSMILTimedElement::UpdateCurrentInterva // In order to provide consistent behavior in such cases, we detect two // deletes in a row and then refuse to create any further intervals. That is, // we say the configuration is invalid. if (mDeleteCount > 1) { // When we update the delete count we also set the state to post active, so // if we're not post active here then something other than // UpdateCurrentInterval has updated the element state in between and all // bets are off. - NS_ABORT_IF_FALSE(mElementState == STATE_POSTACTIVE, - "Expected to be in post-active state after performing double delete"); + MOZ_ASSERT(mElementState == STATE_POSTACTIVE, + "Expected to be in post-active state after performing double " + "delete"); return; } // Check that we aren't stuck in infinite recursion updating some syncbase // dependencies. Generally such situations should be detected in advance and // the chain broken in a sensible and predictable manner, so if we're hitting // this assertion we need to work out how to detect the case that's causing // it. In release builds, just bail out before we overflow the stack. AutoRestore<uint8_t> depthRestorer(mUpdateIntervalRecursionDepth); if (++mUpdateIntervalRecursionDepth > sMaxUpdateIntervalRecursionDepth) { - NS_ABORT_IF_FALSE(false, - "Update current interval recursion depth exceeded threshold"); + MOZ_ASSERT(false, + "Update current interval recursion depth exceeded threshold"); return; } // If the interval is active the begin time is fixed. const nsSMILInstanceTime* beginTime = mElementState == STATE_ACTIVE ? mCurrentInterval->Begin() : nullptr; nsSMILInterval updatedInterval; if (GetNextInterval(GetPreviousInterval(), mCurrentInterval, beginTime, updatedInterval)) { if (mElementState == STATE_POSTACTIVE) { - NS_ABORT_IF_FALSE(!mCurrentInterval, - "In postactive state but the interval has been set"); + MOZ_ASSERT(!mCurrentInterval, + "In postactive state but the interval has been set"); mCurrentInterval = new nsSMILInterval(updatedInterval); mElementState = STATE_WAITING; NotifyNewInterval(); } else { bool beginChanged = false; bool endChanged = false; @@ -2147,22 +2148,23 @@ nsSMILTimedElement::SampleFillValue() { if (mFillMode != FILL_FREEZE || !mClient) return; nsSMILTime activeTime; if (mElementState == STATE_WAITING || mElementState == STATE_POSTACTIVE) { const nsSMILInterval* prevInterval = GetPreviousInterval(); - NS_ABORT_IF_FALSE(prevInterval, - "Attempting to sample fill value but there is no previous interval"); - NS_ABORT_IF_FALSE(prevInterval->End()->Time().IsDefinite() && - prevInterval->End()->IsFixedTime(), - "Attempting to sample fill value but the endpoint of the previous " - "interval is not resolved and fixed"); + MOZ_ASSERT(prevInterval, + "Attempting to sample fill value but there is no previous " + "interval"); + MOZ_ASSERT(prevInterval->End()->Time().IsDefinite() && + prevInterval->End()->IsFixedTime(), + "Attempting to sample fill value but the endpoint of the " + "previous interval is not resolved and fixed"); activeTime = prevInterval->End()->Time().GetMillis() - prevInterval->Begin()->Time().GetMillis(); // If the interval's repeat duration was shorter than its active duration, // use the end of the repeat duration to determine the frozen animation's // state. nsSMILTimeValue repeatDuration = GetRepeatDuration(); @@ -2214,18 +2216,18 @@ nsSMILTimedElement::AddInstanceTimeFromC } void nsSMILTimedElement::RegisterMilestone() { nsSMILTimeContainer* container = GetTimeContainer(); if (!container) return; - NS_ABORT_IF_FALSE(mAnimationElement, - "Got a time container without an owning animation element"); + MOZ_ASSERT(mAnimationElement, + "Got a time container without an owning animation element"); nsSMILMilestone nextMilestone; if (!GetNextMilestone(nextMilestone)) return; // This method is called every time we might possibly have updated our // current interval, but since nsSMILTimeContainer makes no attempt to filter // out redundant milestones we do some rudimentary filtering here. It's not @@ -2260,18 +2262,18 @@ nsSMILTimedElement::GetNextMilestone(nsS case STATE_STARTUP: // All elements register for an initial end sample at t=0 where we resolve // our initial interval. aNextMilestone.mIsEnd = true; // Initial sample should be an end sample aNextMilestone.mTime = 0; return true; case STATE_WAITING: - NS_ABORT_IF_FALSE(mCurrentInterval, - "In waiting state but the current interval has not been set"); + MOZ_ASSERT(mCurrentInterval, + "In waiting state but the current interval has not been set"); aNextMilestone.mIsEnd = false; aNextMilestone.mTime = mCurrentInterval->Begin()->Time().GetMillis(); return true; case STATE_ACTIVE: { // Work out what comes next: the interval end or the next repeat iteration nsSMILTimeValue nextRepeat; @@ -2309,35 +2311,35 @@ nsSMILTimedElement::GetNextMilestone(nsS return false; } MOZ_CRASH("Invalid element state"); } void nsSMILTimedElement::NotifyNewInterval() { - NS_ABORT_IF_FALSE(mCurrentInterval, - "Attempting to notify dependents of a new interval but the interval " - "is not set"); + MOZ_ASSERT(mCurrentInterval, + "Attempting to notify dependents of a new interval but the " + "interval is not set"); nsSMILTimeContainer* container = GetTimeContainer(); if (container) { container->SyncPauseTime(); } NotifyTimeDependentsParams params = { this, container }; mTimeDependents.EnumerateEntries(NotifyNewIntervalCallback, ¶ms); } void nsSMILTimedElement::NotifyChangedInterval(nsSMILInterval* aInterval, bool aBeginObjectChanged, bool aEndObjectChanged) { - NS_ABORT_IF_FALSE(aInterval, "Null interval for change notification"); + MOZ_ASSERT(aInterval, "Null interval for change notification"); nsSMILTimeContainer* container = GetTimeContainer(); if (container) { container->SyncPauseTime(); } // Copy the instance times list since notifying the instance times can result // in a chain reaction whereby our own interval gets deleted along with its @@ -2427,23 +2429,23 @@ nsSMILTimedElement::AreEndTimesDependent //---------------------------------------------------------------------- // Hashtable callback functions /* static */ PLDHashOperator nsSMILTimedElement::NotifyNewIntervalCallback(TimeValueSpecPtrKey* aKey, void* aData) { - NS_ABORT_IF_FALSE(aKey, "Null hash key for time container hash table"); - NS_ABORT_IF_FALSE(aKey->GetKey(), - "null nsSMILTimeValueSpec in set of time dependents"); + MOZ_ASSERT(aKey, "Null hash key for time container hash table"); + MOZ_ASSERT(aKey->GetKey(), + "null nsSMILTimeValueSpec in set of time dependents"); NotifyTimeDependentsParams* params = static_cast<NotifyTimeDependentsParams*>(aData); - NS_ABORT_IF_FALSE(params, "null data ptr while enumerating hashtable"); + MOZ_ASSERT(params, "null data ptr while enumerating hashtable"); nsSMILInterval* interval = params->mTimedElement->mCurrentInterval; // It's possible that in notifying one new time dependent of a new interval // that a chain reaction is triggered which results in the original interval // disappearing. If that's the case we can skip sending further notifications. if (!interval) return PL_DHASH_STOP; nsSMILTimeValueSpec* spec = aKey->GetKey();
--- a/dom/smil/nsSMILValue.cpp +++ b/dom/smil/nsSMILValue.cpp @@ -119,26 +119,27 @@ nsSMILValue::Interpolate(const nsSMILVal //---------------------------------------------------------------------- // Helper methods // Wrappers for nsISMILType::Init & ::Destroy that verify their postconditions void nsSMILValue::InitAndCheckPostcondition(const nsISMILType* aNewType) { aNewType->Init(*this); - NS_ABORT_IF_FALSE(mType == aNewType, - "Post-condition of Init failed. nsSMILValue is invalid"); + MOZ_ASSERT(mType == aNewType, + "Post-condition of Init failed. nsSMILValue is invalid"); } void nsSMILValue::DestroyAndCheckPostcondition() { mType->Destroy(*this); - NS_ABORT_IF_FALSE(IsNull(), "Post-condition of Destroy failed. " - "nsSMILValue not null after destroying"); + MOZ_ASSERT(IsNull(), + "Post-condition of Destroy failed. " + "nsSMILValue not null after destroying"); } void nsSMILValue::DestroyAndReinit(const nsISMILType* aNewType) { DestroyAndCheckPostcondition(); InitAndCheckPostcondition(aNewType); }
--- a/dom/speakermanager/SpeakerManager.cpp +++ b/dom/speakermanager/SpeakerManager.cpp @@ -73,17 +73,17 @@ SpeakerManager::SetForcespeaker(bool aEn service->ForceSpeaker(aEnable, mVisible); mForcespeaker = aEnable; } void SpeakerManager::DispatchSimpleEvent(const nsAString& aStr) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread"); + MOZ_ASSERT(NS_IsMainThread(), "Not running on main thread"); nsresult rv = CheckInnerWindowCorrectness(); if (NS_FAILED(rv)) { return; } nsCOMPtr<nsIDOMEvent> event; rv = NS_NewDOMEvent(getter_AddRefs(event), this, nullptr, nullptr); if (NS_FAILED(rv)) {
--- a/dom/storage/DOMStorageIPC.cpp +++ b/dom/storage/DOMStorageIPC.cpp @@ -37,25 +37,25 @@ NS_IMETHODIMP_(MozExternalRefCountType) return 0; } return count; } void DOMStorageDBChild::AddIPDLReference() { - NS_ABORT_IF_FALSE(!mIPCOpen, "Attempting to retain multiple IPDL references"); + MOZ_ASSERT(!mIPCOpen, "Attempting to retain multiple IPDL references"); mIPCOpen = true; AddRef(); } void DOMStorageDBChild::ReleaseIPDLReference() { - NS_ABORT_IF_FALSE(mIPCOpen, "Attempting to release non-existent IPDL reference"); + MOZ_ASSERT(mIPCOpen, "Attempting to release non-existent IPDL reference"); mIPCOpen = false; Release(); } DOMStorageDBChild::DOMStorageDBChild(DOMLocalStorageManager* aManager) : mManager(aManager) , mStatus(NS_OK) , mIPCOpen(false) @@ -270,25 +270,25 @@ DOMStorageDBChild::RecvError(const nsres // ---------------------------------------------------------------------------- NS_IMPL_ADDREF(DOMStorageDBParent) NS_IMPL_RELEASE(DOMStorageDBParent) void DOMStorageDBParent::AddIPDLReference() { - NS_ABORT_IF_FALSE(!mIPCOpen, "Attempting to retain multiple IPDL references"); + MOZ_ASSERT(!mIPCOpen, "Attempting to retain multiple IPDL references"); mIPCOpen = true; AddRef(); } void DOMStorageDBParent::ReleaseIPDLReference() { - NS_ABORT_IF_FALSE(mIPCOpen, "Attempting to release non-existent IPDL reference"); + MOZ_ASSERT(mIPCOpen, "Attempting to release non-existent IPDL reference"); mIPCOpen = false; Release(); } namespace { // anon class SendInitialChildDataRunnable : public nsRunnable {
--- a/dom/svg/DOMSVGLength.cpp +++ b/dom/svg/DOMSVGLength.cpp @@ -102,21 +102,22 @@ DOMSVGLength::DOMSVGLength(DOMSVGLengthL , mListIndex(aListIndex) , mAttrEnum(aAttrEnum) , mIsAnimValItem(aIsAnimValItem) , mUnit(nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER) , mValue(0.0f) , mVal(nullptr) { // These shifts are in sync with the members in the header. - NS_ABORT_IF_FALSE(aList && - aAttrEnum < (1 << 4) && - aListIndex <= MaxListIndex(), "bad arg"); + MOZ_ASSERT(aList && + aAttrEnum < (1 << 4) && + aListIndex <= MaxListIndex(), + "bad arg"); - NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGNumber!"); + MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGNumber!"); } DOMSVGLength::DOMSVGLength() : mList(nullptr) , mListIndex(0) , mAttrEnum(0) , mIsAnimValItem(false) , mUnit(nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER) @@ -530,17 +531,17 @@ DOMSVGLength::InsertingIntoList(DOMSVGLe { NS_ASSERTION(!HasOwner(), "Inserting item that is already in a list"); mList = aList; mAttrEnum = aAttrEnum; mListIndex = aListIndex; mIsAnimValItem = aIsAnimValItem; - NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGLength!"); + MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGLength!"); } void DOMSVGLength::RemovingFromList() { mValue = InternalItem().GetValueInCurrentUnits(); mUnit = InternalItem().GetUnit(); mList = nullptr;
--- a/dom/svg/DOMSVGLengthList.cpp +++ b/dom/svg/DOMSVGLengthList.cpp @@ -362,49 +362,49 @@ DOMSVGLengthList::GetItemAt(uint32_t aIn } nsRefPtr<DOMSVGLength> result = mItems[aIndex]; return result.forget(); } void DOMSVGLengthList::MaybeInsertNullInAnimValListAt(uint32_t aIndex) { - NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal"); + MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal"); DOMSVGLengthList* animVal = mAList->mAnimVal; if (!animVal || mAList->IsAnimating()) { // No animVal list wrapper, or animVal not a clone of baseVal return; } - NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(), - "animVal list not in sync!"); + MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(), + "animVal list not in sync!"); animVal->mItems.InsertElementAt(aIndex, static_cast<DOMSVGLength*>(nullptr)); UpdateListIndicesFromIndex(animVal->mItems, aIndex + 1); } void DOMSVGLengthList::MaybeRemoveItemFromAnimValListAt(uint32_t aIndex) { - NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal"); + MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal"); // This needs to be a strong reference; otherwise, the RemovingFromList call // below might drop the last reference to animVal before we're done with it. nsRefPtr<DOMSVGLengthList> animVal = mAList->mAnimVal; if (!animVal || mAList->IsAnimating()) { // No animVal list wrapper, or animVal not a clone of baseVal return; } - NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(), - "animVal list not in sync!"); + MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(), + "animVal list not in sync!"); if (animVal->mItems[aIndex]) { animVal->mItems[aIndex]->RemovingFromList(); } animVal->mItems.RemoveElementAt(aIndex); UpdateListIndicesFromIndex(animVal->mItems, aIndex); }
--- a/dom/svg/DOMSVGLengthList.h +++ b/dom/svg/DOMSVGLengthList.h @@ -76,19 +76,19 @@ public: return static_cast<nsIContent*>(Element()); } /** * This will normally be the same as InternalList().Length(), except if we've * hit OOM in which case our length will be zero. */ uint32_t LengthNoFlush() const { - NS_ABORT_IF_FALSE(mItems.Length() == 0 || - mItems.Length() == InternalList().Length(), - "DOM wrapper's list length is out of sync"); + MOZ_ASSERT(mItems.Length() == 0 || + mItems.Length() == InternalList().Length(), + "DOM wrapper's list length is out of sync"); return mItems.Length(); } /// Called to notify us to syncronize our length and detach excess items. void InternalListLengthWillChange(uint32_t aNewLength); /** * Returns true if our attribute is animating (in which case our animVal is @@ -141,18 +141,18 @@ private: } uint8_t Axis() const { return mAList->mAxis; } /// Used to determine if this list is the baseVal or animVal list. bool IsAnimValList() const { - NS_ABORT_IF_FALSE(this == mAList->mBaseVal || this == mAList->mAnimVal, - "Calling IsAnimValList() too early?!"); + MOZ_ASSERT(this == mAList->mBaseVal || this == mAList->mAnimVal, + "Calling IsAnimValList() too early?!"); return this == mAList->mAnimVal; } /** * Get a reference to this object's corresponding internal SVGLengthList. * * To simplify the code we just have this one method for obtaining both * baseVal and animVal internal lists. This means that animVal lists don't
--- a/dom/svg/DOMSVGNumber.cpp +++ b/dom/svg/DOMSVGNumber.cpp @@ -88,21 +88,22 @@ DOMSVGNumber::DOMSVGNumber(DOMSVGNumberL : mList(aList) , mParent(aList) , mListIndex(aListIndex) , mAttrEnum(aAttrEnum) , mIsAnimValItem(aIsAnimValItem) , mValue(0.0f) { // These shifts are in sync with the members in the header. - NS_ABORT_IF_FALSE(aList && - aAttrEnum < (1 << 4) && - aListIndex <= MaxListIndex(), "bad arg"); + MOZ_ASSERT(aList && + aAttrEnum < (1 << 4) && + aListIndex <= MaxListIndex(), + "bad arg"); - NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGNumber!"); + MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGNumber!"); } DOMSVGNumber::DOMSVGNumber(nsISupports* aParent) : mList(nullptr) , mParent(aParent) , mListIndex(0) , mAttrEnum(0) , mIsAnimValItem(false) @@ -175,17 +176,17 @@ DOMSVGNumber::InsertingIntoList(DOMSVGNu { NS_ASSERTION(!HasOwner(), "Inserting item that is already in a list"); mList = aList; mAttrEnum = aAttrEnum; mListIndex = aListIndex; mIsAnimValItem = aIsAnimValItem; - NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGNumber!"); + MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGNumber!"); } void DOMSVGNumber::RemovingFromList() { mValue = InternalItem(); mList = nullptr; mIsAnimValItem = false;
--- a/dom/svg/DOMSVGNumberList.cpp +++ b/dom/svg/DOMSVGNumberList.cpp @@ -341,49 +341,49 @@ DOMSVGNumberList::GetItemAt(uint32_t aIn } nsRefPtr<DOMSVGNumber> result = mItems[aIndex]; return result.forget(); } void DOMSVGNumberList::MaybeInsertNullInAnimValListAt(uint32_t aIndex) { - NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal"); + MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal"); DOMSVGNumberList* animVal = mAList->mAnimVal; if (!animVal || mAList->IsAnimating()) { // No animVal list wrapper, or animVal not a clone of baseVal return; } - NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(), - "animVal list not in sync!"); + MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(), + "animVal list not in sync!"); animVal->mItems.InsertElementAt(aIndex, static_cast<DOMSVGNumber*>(nullptr)); UpdateListIndicesFromIndex(animVal->mItems, aIndex + 1); } void DOMSVGNumberList::MaybeRemoveItemFromAnimValListAt(uint32_t aIndex) { - NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal"); + MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal"); // This needs to be a strong reference; otherwise, the RemovingFromList call // below might drop the last reference to animVal before we're done with it. nsRefPtr<DOMSVGNumberList> animVal = mAList->mAnimVal; if (!animVal || mAList->IsAnimating()) { // No animVal list wrapper, or animVal not a clone of baseVal return; } - NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(), - "animVal list not in sync!"); + MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(), + "animVal list not in sync!"); if (animVal->mItems[aIndex]) { animVal->mItems[aIndex]->RemovingFromList(); } animVal->mItems.RemoveElementAt(aIndex); UpdateListIndicesFromIndex(animVal->mItems, aIndex); }
--- a/dom/svg/DOMSVGNumberList.h +++ b/dom/svg/DOMSVGNumberList.h @@ -76,19 +76,19 @@ public: return static_cast<nsIContent*>(Element()); } /** * This will normally be the same as InternalList().Length(), except if we've * hit OOM in which case our length will be zero. */ uint32_t LengthNoFlush() const { - NS_ABORT_IF_FALSE(mItems.Length() == 0 || - mItems.Length() == InternalList().Length(), - "DOM wrapper's list length is out of sync"); + MOZ_ASSERT(mItems.Length() == 0 || + mItems.Length() == InternalList().Length(), + "DOM wrapper's list length is out of sync"); return mItems.Length(); } /// Called to notify us to syncronize our length and detach excess items. void InternalListLengthWillChange(uint32_t aNewLength); /** * Returns true if our attribute is animating (in which case our animVal is @@ -134,18 +134,18 @@ private: } uint8_t AttrEnum() const { return mAList->mAttrEnum; } /// Used to determine if this list is the baseVal or animVal list. bool IsAnimValList() const { - NS_ABORT_IF_FALSE(this == mAList->mBaseVal || this == mAList->mAnimVal, - "Calling IsAnimValList() too early?!"); + MOZ_ASSERT(this == mAList->mBaseVal || this == mAList->mAnimVal, + "Calling IsAnimValList() too early?!"); return this == mAList->mAnimVal; } /** * Get a reference to this object's corresponding internal SVGNumberList. * * To simplify the code we just have this one method for obtaining both * baseVal and animVal internal lists. This means that animVal lists don't
--- a/dom/svg/DOMSVGPathSeg.cpp +++ b/dom/svg/DOMSVGPathSeg.cpp @@ -75,57 +75,56 @@ private: DOMSVGPathSeg::DOMSVGPathSeg(DOMSVGPathSegList *aList, uint32_t aListIndex, bool aIsAnimValItem) : mList(aList) , mListIndex(aListIndex) , mIsAnimValItem(aIsAnimValItem) { // These shifts are in sync with the members in the header. - NS_ABORT_IF_FALSE(aList && - aListIndex <= MaxListIndex(), "bad arg"); + MOZ_ASSERT(aList && aListIndex <= MaxListIndex(), "bad arg"); - NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGPathSeg!"); + MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGPathSeg!"); } DOMSVGPathSeg::DOMSVGPathSeg() : mList(nullptr) , mListIndex(0) , mIsAnimValItem(false) { } void DOMSVGPathSeg::InsertingIntoList(DOMSVGPathSegList *aList, uint32_t aListIndex, bool aIsAnimValItem) { - NS_ABORT_IF_FALSE(!HasOwner(), "Inserting item that is already in a list"); + MOZ_ASSERT(!HasOwner(), "Inserting item that is already in a list"); mList = aList; mListIndex = aListIndex; mIsAnimValItem = aIsAnimValItem; - NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGPathSeg!"); + MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGPathSeg!"); } void DOMSVGPathSeg::RemovingFromList() { uint32_t argCount = SVGPathSegUtils::ArgCountForType(Type()); // InternalItem() + 1, because the args come after the encoded seg type memcpy(PtrToMemberArgs(), InternalItem() + 1, argCount * sizeof(float)); mList = nullptr; mIsAnimValItem = false; } void DOMSVGPathSeg::ToSVGPathSegEncodedData(float* aRaw) { - NS_ABORT_IF_FALSE(aRaw, "null pointer"); + MOZ_ASSERT(aRaw, "null pointer"); uint32_t argCount = SVGPathSegUtils::ArgCountForType(Type()); if (IsInList()) { // 1 + argCount, because we're copying the encoded seg type and args memcpy(aRaw, InternalItem(), (1 + argCount) * sizeof(float)); } else { aRaw[0] = SVGPathSegUtils::EncodeType(Type()); // aRaw + 1, because the args go after the encoded seg type memcpy(aRaw + 1, PtrToMemberArgs(), argCount * sizeof(float));
--- a/dom/svg/DOMSVGPathSeg.h +++ b/dom/svg/DOMSVGPathSeg.h @@ -15,20 +15,20 @@ class nsSVGElement; #define MOZ_SVG_LIST_INDEX_BIT_COUNT 31 namespace mozilla { #define CHECK_ARG_COUNT_IN_SYNC(segType) \ - NS_ABORT_IF_FALSE(ArrayLength(mArgs) == \ - SVGPathSegUtils::ArgCountForType(uint32_t(segType)) || \ - uint32_t(segType) == PATHSEG_CLOSEPATH, \ - "Arg count/array size out of sync") + MOZ_ASSERT(ArrayLength(mArgs) == \ + SVGPathSegUtils::ArgCountForType(uint32_t(segType)) || \ + uint32_t(segType) == PATHSEG_CLOSEPATH, \ + "Arg count/array size out of sync") #define IMPL_SVGPATHSEG_SUBCLASS_COMMON(segName, segType) \ explicit DOMSVGPathSeg##segName(const float *aArgs) \ : DOMSVGPathSeg() \ { \ CHECK_ARG_COUNT_IN_SYNC(segType); \ memcpy(mArgs, aArgs, \ SVGPathSegUtils::ArgCountForType(uint32_t(segType)) * sizeof(float)); \
--- a/dom/svg/DOMSVGPathSegList.cpp +++ b/dom/svg/DOMSVGPathSegList.cpp @@ -185,19 +185,19 @@ DOMSVGPathSegList::InternalListWillChang ItemAt(index) = nullptr; } // Only after the RemovingFromList() can we touch mInternalDataIndex! mItems[index].mInternalDataIndex = dataIndex; ++index; dataIndex += 1 + SVGPathSegUtils::ArgCountForType(newSegType); } - NS_ABORT_IF_FALSE((index == length && dataIndex <= dataLength) || - (index <= length && dataIndex == dataLength), - "very bad - list corruption?"); + MOZ_ASSERT((index == length && dataIndex <= dataLength) || + (index <= length && dataIndex == dataLength), + "very bad - list corruption?"); if (index < length) { // aNewValue has fewer items than our previous internal counterpart uint32_t newLength = index; // Remove excess items from the list: for (; index < length; ++index) { @@ -227,18 +227,18 @@ DOMSVGPathSegList::InternalListWillChang Clear(rv); MOZ_ASSERT(!rv.Failed()); return; } dataIndex += 1 + SVGPathSegUtils::ArgCountForType(SVGPathSegUtils::DecodeType(aNewValue.mData[dataIndex])); } } - NS_ABORT_IF_FALSE(dataIndex == dataLength, "Serious processing error"); - NS_ABORT_IF_FALSE(index == length, "Serious counting error"); + MOZ_ASSERT(dataIndex == dataLength, "Serious processing error"); + MOZ_ASSERT(index == length, "Serious counting error"); } bool DOMSVGPathSegList::AttrIsAnimating() const { return InternalAList().IsAnimating(); } @@ -247,17 +247,17 @@ DOMSVGPathSegList::InternalList() const { SVGAnimatedPathSegList *alist = mElement->GetAnimPathSegList(); return mIsAnimValList && alist->IsAnimating() ? *alist->mAnimVal : alist->mBaseVal; } SVGAnimatedPathSegList& DOMSVGPathSegList::InternalAList() const { - NS_ABORT_IF_FALSE(mElement->GetAnimPathSegList(), "Internal error"); + MOZ_ASSERT(mElement->GetAnimPathSegList(), "Internal error"); return *mElement->GetAnimPathSegList(); } // ---------------------------------------------------------------------------- // nsIDOMSVGPathSegList implementation: void DOMSVGPathSegList::Clear(ErrorResult& aError) @@ -513,62 +513,62 @@ DOMSVGPathSegList::GetItemAt(uint32_t aI } void DOMSVGPathSegList:: MaybeInsertNullInAnimValListAt(uint32_t aIndex, uint32_t aInternalIndex, uint32_t aArgCountForItem) { - NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal"); + MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal"); if (AttrIsAnimating()) { // animVal not a clone of baseVal return; } // The anim val list is in sync with the base val list DOMSVGPathSegList *animVal = GetDOMWrapperIfExists(InternalAList().GetAnimValKey()); if (!animVal) { // No animVal list wrapper return; } - NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(), - "animVal list not in sync!"); + MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(), + "animVal list not in sync!"); animVal->mItems.InsertElementAt(aIndex, ItemProxy(nullptr, aInternalIndex)); animVal->UpdateListIndicesFromIndex(aIndex + 1, 1 + aArgCountForItem); } void DOMSVGPathSegList:: MaybeRemoveItemFromAnimValListAt(uint32_t aIndex, int32_t aArgCountForItem) { - NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal"); + MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal"); if (AttrIsAnimating()) { // animVal not a clone of baseVal return; } // This needs to be a strong reference; otherwise, the RemovingFromList call // below might drop the last reference to animVal before we're done with it. nsRefPtr<DOMSVGPathSegList> animVal = GetDOMWrapperIfExists(InternalAList().GetAnimValKey()); if (!animVal) { // No animVal list wrapper return; } - NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(), - "animVal list not in sync!"); + MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(), + "animVal list not in sync!"); if (animVal->ItemAt(aIndex)) { animVal->ItemAt(aIndex)->RemovingFromList(); } animVal->mItems.RemoveElementAt(aIndex); animVal->UpdateListIndicesFromIndex(aIndex, -(1 + aArgCountForItem)); }
--- a/dom/svg/DOMSVGPathSegList.h +++ b/dom/svg/DOMSVGPathSegList.h @@ -93,19 +93,19 @@ public: static DOMSVGPathSegList* GetDOMWrapperIfExists(void *aList); /** * This will normally be the same as InternalList().CountItems(), except if * we've hit OOM, in which case our length will be zero. */ uint32_t LengthNoFlush() const { - NS_ABORT_IF_FALSE(mItems.Length() == 0 || - mItems.Length() == InternalList().CountItems(), - "DOM wrapper's list length is out of sync"); + MOZ_ASSERT(mItems.Length() == 0 || + mItems.Length() == InternalList().CountItems(), + "DOM wrapper's list length is out of sync"); return mItems.Length(); } /** * WATCH OUT! If you add code to call this on a baseVal wrapper, then you * must also call it on the animVal wrapper too if necessary!! See other * callers! *
--- a/dom/svg/DOMSVGPoint.h +++ b/dom/svg/DOMSVGPoint.h @@ -52,20 +52,19 @@ public: bool aIsAnimValItem) : nsISVGPoint() { mList = aList; mListIndex = aListIndex; mIsAnimValItem = aIsAnimValItem; // These shifts are in sync with the members. - NS_ABORT_IF_FALSE(aList && - aListIndex <= MaxListIndex(), "bad arg"); + MOZ_ASSERT(aList && aListIndex <= MaxListIndex(), "bad arg"); - NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGPoint!"); + MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGPoint!"); } explicit DOMSVGPoint(const DOMSVGPoint *aPt = nullptr) : nsISVGPoint() { if (aPt) { mPt = aPt->ToSVGPoint(); }
--- a/dom/svg/DOMSVGPointList.cpp +++ b/dom/svg/DOMSVGPointList.cpp @@ -189,17 +189,17 @@ DOMSVGPointList::InternalList() const { SVGAnimatedPointList *alist = mElement->GetAnimatedPointList(); return mIsAnimValList && alist->IsAnimating() ? *alist->mAnimVal : alist->mBaseVal; } SVGAnimatedPointList& DOMSVGPointList::InternalAList() const { - NS_ABORT_IF_FALSE(mElement->GetAnimatedPointList(), "Internal error"); + MOZ_ASSERT(mElement->GetAnimatedPointList(), "Internal error"); return *mElement->GetAnimatedPointList(); } // ---------------------------------------------------------------------------- // nsIDOMSVGPointList implementation: void DOMSVGPointList::Clear(ErrorResult& aError) @@ -409,60 +409,60 @@ DOMSVGPointList::GetItemAt(uint32_t aInd } nsRefPtr<nsISVGPoint> result = mItems[aIndex]; return result.forget(); } void DOMSVGPointList::MaybeInsertNullInAnimValListAt(uint32_t aIndex) { - NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal"); + MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal"); if (AttrIsAnimating()) { // animVal not a clone of baseVal return; } // The anim val list is in sync with the base val list DOMSVGPointList *animVal = GetDOMWrapperIfExists(InternalAList().GetAnimValKey()); if (!animVal) { // No animVal list wrapper return; } - NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(), - "animVal list not in sync!"); + MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(), + "animVal list not in sync!"); animVal->mItems.InsertElementAt(aIndex, static_cast<nsISVGPoint*>(nullptr)); UpdateListIndicesFromIndex(animVal->mItems, aIndex + 1); } void DOMSVGPointList::MaybeRemoveItemFromAnimValListAt(uint32_t aIndex) { - NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal"); + MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal"); if (AttrIsAnimating()) { // animVal not a clone of baseVal return; } // This needs to be a strong reference; otherwise, the RemovingFromList call // below might drop the last reference to animVal before we're done with it. nsRefPtr<DOMSVGPointList> animVal = GetDOMWrapperIfExists(InternalAList().GetAnimValKey()); if (!animVal) { // No animVal list wrapper return; } - NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(), - "animVal list not in sync!"); + MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(), + "animVal list not in sync!"); if (animVal->mItems[aIndex]) { animVal->mItems[aIndex]->RemovingFromList(); } animVal->mItems.RemoveElementAt(aIndex); UpdateListIndicesFromIndex(animVal->mItems, aIndex); }
--- a/dom/svg/DOMSVGPointList.h +++ b/dom/svg/DOMSVGPointList.h @@ -95,19 +95,19 @@ public: static DOMSVGPointList* GetDOMWrapperIfExists(void *aList); /** * This will normally be the same as InternalList().Length(), except if * we've hit OOM, in which case our length will be zero. */ uint32_t LengthNoFlush() const { - NS_ABORT_IF_FALSE(mItems.Length() == 0 || - mItems.Length() == InternalList().Length(), - "DOM wrapper's list length is out of sync"); + MOZ_ASSERT(mItems.Length() == 0 || + mItems.Length() == InternalList().Length(), + "DOM wrapper's list length is out of sync"); return mItems.Length(); } /** * WATCH OUT! If you add code to call this on a baseVal wrapper, then you * must also call it on the animVal wrapper too if necessary!! See other * callers! *
--- a/dom/svg/DOMSVGTransformList.cpp +++ b/dom/svg/DOMSVGTransformList.cpp @@ -388,50 +388,50 @@ DOMSVGTransformList::GetItemAt(uint32_t } nsRefPtr<SVGTransform> result = mItems[aIndex]; return result.forget(); } void DOMSVGTransformList::MaybeInsertNullInAnimValListAt(uint32_t aIndex) { - NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal"); + MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal"); DOMSVGTransformList* animVal = mAList->mAnimVal; if (!animVal || mAList->IsAnimating()) { // No animVal list wrapper, or animVal not a clone of baseVal return; } - NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(), - "animVal list not in sync!"); + MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(), + "animVal list not in sync!"); animVal->mItems.InsertElementAt(aIndex, static_cast<SVGTransform*>(nullptr)); UpdateListIndicesFromIndex(animVal->mItems, aIndex + 1); } void DOMSVGTransformList::MaybeRemoveItemFromAnimValListAt(uint32_t aIndex) { - NS_ABORT_IF_FALSE(!IsAnimValList(), "call from baseVal to animVal"); + MOZ_ASSERT(!IsAnimValList(), "call from baseVal to animVal"); // This needs to be a strong reference; otherwise, the RemovingFromList call // below might drop the last reference to animVal before we're done with it. nsRefPtr<DOMSVGTransformList> animVal = mAList->mAnimVal; if (!animVal || mAList->IsAnimating()) { // No animVal list wrapper, or animVal not a clone of baseVal return; } - NS_ABORT_IF_FALSE(animVal->mItems.Length() == mItems.Length(), - "animVal list not in sync!"); + MOZ_ASSERT(animVal->mItems.Length() == mItems.Length(), + "animVal list not in sync!"); if (animVal->mItems[aIndex]) { animVal->mItems[aIndex]->RemovingFromList(); } animVal->mItems.RemoveElementAt(aIndex); UpdateListIndicesFromIndex(animVal->mItems, aIndex); }
--- a/dom/svg/DOMSVGTransformList.h +++ b/dom/svg/DOMSVGTransformList.h @@ -71,19 +71,18 @@ public: return static_cast<nsIContent*>(Element()); } /** * This will normally be the same as InternalList().Length(), except if we've * hit OOM in which case our length will be zero. */ uint32_t LengthNoFlush() const { - NS_ABORT_IF_FALSE(mItems.IsEmpty() || - mItems.Length() == InternalList().Length(), - "DOM wrapper's list length is out of sync"); + MOZ_ASSERT(mItems.IsEmpty() || mItems.Length() == InternalList().Length(), + "DOM wrapper's list length is out of sync"); return mItems.Length(); } /// Called to notify us to synchronize our length and detach excess items. void InternalListLengthWillChange(uint32_t aNewLength); /** * Returns true if our attribute is animating (in which case our animVal is @@ -130,18 +129,18 @@ public: private: nsSVGElement* Element() const { return mAList->mElement; } /// Used to determine if this list is the baseVal or animVal list. bool IsAnimValList() const { - NS_ABORT_IF_FALSE(this == mAList->mBaseVal || this == mAList->mAnimVal, - "Calling IsAnimValList() too early?!"); + MOZ_ASSERT(this == mAList->mBaseVal || this == mAList->mAnimVal, + "Calling IsAnimValList() too early?!"); return this == mAList->mAnimVal; } /** * Get a reference to this object's corresponding internal SVGTransformList. * * To simplify the code we just have this one method for obtaining both * baseVal and animVal internal lists. This means that animVal lists don't
--- a/dom/svg/SVGAnimationElement.cpp +++ b/dom/svg/SVGAnimationElement.cpp @@ -77,19 +77,19 @@ SVGAnimationElement::HasAnimAttr(nsIAtom } Element* SVGAnimationElement::GetTargetElementContent() { if (HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) { return mHrefTarget.get(); } - NS_ABORT_IF_FALSE(!mHrefTarget.get(), - "We shouldn't have an xlink:href target " - "if we don't have an xlink:href attribute"); + MOZ_ASSERT(!mHrefTarget.get(), + "We shouldn't have an xlink:href target " + "if we don't have an xlink:href attribute"); // No "xlink:href" attribute --> I should target my parent. nsIContent* parent = GetFlattenedTreeParent(); return parent && parent->IsElement() ? parent->AsElement() : nullptr; } bool SVGAnimationElement::GetTargetAttributeName(int32_t *aNamespaceID, @@ -186,19 +186,18 @@ SVGAnimationElement::GetSimpleDuration(E // nsIContent methods nsresult SVGAnimationElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, nsIContent* aBindingParent, bool aCompileEventHandlers) { - NS_ABORT_IF_FALSE(!mHrefTarget.get(), - "Shouldn't have href-target yet " - "(or it should've been cleared)"); + MOZ_ASSERT(!mHrefTarget.get(), + "Shouldn't have href-target yet (or it should've been cleared)"); nsresult rv = SVGAnimationElementBase::BindToTree(aDocument, aParent, aBindingParent, aCompileEventHandlers); NS_ENSURE_SUCCESS(rv,rv); // XXXdholbert is GetCtx (as a check for SVG parent) still needed here? if (!GetCtx()) { // No use proceeding. We don't have an SVG parent (yet) so we won't be able @@ -309,18 +308,18 @@ SVGAnimationElement::AfterSetAttr(int32_ if (aNamespaceID != kNameSpaceID_XLink || aName != nsGkAtoms::href) return rv; if (!aValue) { mHrefTarget.Unlink(); AnimationTargetChanged(); } else if (IsInDoc()) { - NS_ABORT_IF_FALSE(aValue->Type() == nsAttrValue::eString, - "Expected href attribute to be string type"); + MOZ_ASSERT(aValue->Type() == nsAttrValue::eString, + "Expected href attribute to be string type"); UpdateHrefTarget(this, aValue->GetStringValue()); } // else: we're not yet in a document -- we'll update the target on // next BindToTree call. return rv; } nsresult
--- a/dom/svg/SVGContentUtils.cpp +++ b/dom/svg/SVGContentUtils.cpp @@ -51,18 +51,18 @@ SVGContentUtils::GetOuterSVGElement(nsSV return static_cast<SVGSVGElement*>(element); } return nullptr; } void SVGContentUtils::ActivateByHyperlink(nsIContent *aContent) { - NS_ABORT_IF_FALSE(aContent->IsNodeOfType(nsINode::eANIMATION), - "Expecting an animation element"); + MOZ_ASSERT(aContent->IsNodeOfType(nsINode::eANIMATION), + "Expecting an animation element"); static_cast<SVGAnimationElement*>(aContent)->ActivateByHyperlink(); } enum DashState { eDashedStroke, eContinuousStroke, //< all dashes, no gaps eNoStroke //< all gaps, no dashes @@ -277,27 +277,27 @@ SVGContentUtils::GetFontSize(Element *aE } return GetFontSize(styleContext); } float SVGContentUtils::GetFontSize(nsIFrame *aFrame) { - NS_ABORT_IF_FALSE(aFrame, "NULL frame in GetFontSize"); + MOZ_ASSERT(aFrame, "NULL frame in GetFontSize"); return GetFontSize(aFrame->StyleContext()); } float SVGContentUtils::GetFontSize(nsStyleContext *aStyleContext) { - NS_ABORT_IF_FALSE(aStyleContext, "NULL style context in GetFontSize"); + MOZ_ASSERT(aStyleContext, "NULL style context in GetFontSize"); nsPresContext *presContext = aStyleContext->PresContext(); - NS_ABORT_IF_FALSE(presContext, "NULL pres context in GetFontSize"); + MOZ_ASSERT(presContext, "NULL pres context in GetFontSize"); nscoord fontSize = aStyleContext->StyleFont()->mSize; return nsPresContext::AppUnitsToFloatCSSPixels(fontSize) / presContext->TextZoom(); } float SVGContentUtils::GetFontXHeight(Element *aElement) @@ -315,27 +315,27 @@ SVGContentUtils::GetFontXHeight(Element } return GetFontXHeight(styleContext); } float SVGContentUtils::GetFontXHeight(nsIFrame *aFrame) { - NS_ABORT_IF_FALSE(aFrame, "NULL frame in GetFontXHeight"); + MOZ_ASSERT(aFrame, "NULL frame in GetFontXHeight"); return GetFontXHeight(aFrame->StyleContext()); } float SVGContentUtils::GetFontXHeight(nsStyleContext *aStyleContext) { - NS_ABORT_IF_FALSE(aStyleContext, "NULL style context in GetFontXHeight"); + MOZ_ASSERT(aStyleContext, "NULL style context in GetFontXHeight"); nsPresContext *presContext = aStyleContext->PresContext(); - NS_ABORT_IF_FALSE(presContext, "NULL pres context in GetFontXHeight"); + MOZ_ASSERT(presContext, "NULL pres context in GetFontXHeight"); nsRefPtr<nsFontMetrics> fontMetrics; nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext, getter_AddRefs(fontMetrics)); if (!fontMetrics) { // ReportToConsole NS_WARNING("no FontMetrics in GetFontXHeight()");
--- a/dom/svg/SVGFEImageElement.cpp +++ b/dom/svg/SVGFEImageElement.cpp @@ -329,17 +329,17 @@ NS_IMETHODIMP SVGFEImageElement::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aData) { nsresult rv = nsImageLoadingContent::Notify(aRequest, aType, aData); if (aType == imgINotificationObserver::SIZE_AVAILABLE) { // Request a decode nsCOMPtr<imgIContainer> container; aRequest->GetImage(getter_AddRefs(container)); - NS_ABORT_IF_FALSE(container, "who sent the notification then?"); + MOZ_ASSERT(container, "who sent the notification then?"); container->StartDecoding(); } if (aType == imgINotificationObserver::LOAD_COMPLETE || aType == imgINotificationObserver::FRAME_UPDATE || aType == imgINotificationObserver::SIZE_AVAILABLE) { Invalidate(); }
--- a/dom/svg/SVGForeignObjectElement.cpp +++ b/dom/svg/SVGForeignObjectElement.cpp @@ -84,17 +84,17 @@ SVGForeignObjectElement::PrependLocalTra // our 'x' and 'y' attributes: float x, y; const_cast<SVGForeignObjectElement*>(this)-> GetAnimatedLengthValues(&x, &y, nullptr); gfxMatrix toUserSpace = gfxMatrix::Translation(x, y); if (aWhich == eChildToUserSpace) { return toUserSpace * aMatrix; } - NS_ABORT_IF_FALSE(aWhich == eAllTransforms, "Unknown TransformTypes"); + MOZ_ASSERT(aWhich == eAllTransforms, "Unknown TransformTypes"); return toUserSpace * fromUserSpace; } /* virtual */ bool SVGForeignObjectElement::HasValidDimensions() const { return mLengthAttributes[ATTR_WIDTH].IsExplicitlySet() && mLengthAttributes[ATTR_WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
--- a/dom/svg/SVGFragmentIdentifier.cpp +++ b/dom/svg/SVGFragmentIdentifier.cpp @@ -233,18 +233,18 @@ SVGFragmentIdentifier::ProcessSVGViewSpe return true; } bool SVGFragmentIdentifier::ProcessFragmentIdentifier(nsIDocument* aDocument, const nsAString& aAnchorName) { - NS_ABORT_IF_FALSE(aDocument->GetRootElement()->IsSVG(nsGkAtoms::svg), - "expecting an SVG root element"); + MOZ_ASSERT(aDocument->GetRootElement()->IsSVG(nsGkAtoms::svg), + "expecting an SVG root element"); dom::SVGSVGElement* rootElement = static_cast<dom::SVGSVGElement*>(aDocument->GetRootElement()); if (!rootElement->mUseCurrentView) { SaveOldViewBox(rootElement); SaveOldPreserveAspectRatio(rootElement); SaveOldZoomAndPan(rootElement);
--- a/dom/svg/SVGIFrameElement.cpp +++ b/dom/svg/SVGIFrameElement.cpp @@ -73,17 +73,17 @@ SVGIFrameElement::PrependLocalTransforms // our 'x' and 'y' attributes: float x, y; const_cast<SVGIFrameElement*>(this)-> GetAnimatedLengthValues(&x, &y, nullptr); gfxMatrix toUserSpace = gfxMatrix::Translation(x, y); if (aWhich == eChildToUserSpace) { return toUserSpace; } - NS_ABORT_IF_FALSE(aWhich == eAllTransforms, "Unknown TransformTypes"); + MOZ_ASSERT(aWhich == eAllTransforms, "Unknown TransformTypes"); return toUserSpace * fromUserSpace; } //---------------------------------------------------------------------- // nsIDOMNode methods nsresult
--- a/dom/svg/SVGIntegerPairSMILType.cpp +++ b/dom/svg/SVGIntegerPairSMILType.cpp @@ -8,17 +8,17 @@ #include "nsMathUtils.h" #include "nsDebug.h" namespace mozilla { void SVGIntegerPairSMILType::Init(nsSMILValue& aValue) const { - NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected value type"); + MOZ_ASSERT(aValue.IsNull(), "Unexpected value type"); aValue.mU.mIntPair[0] = 0; aValue.mU.mIntPair[1] = 0; aValue.mType = this; } void SVGIntegerPairSMILType::Destroy(nsSMILValue& aValue) const
--- a/dom/svg/SVGLength.cpp +++ b/dom/svg/SVGLength.cpp @@ -72,18 +72,18 @@ IsAbsoluteUnit(uint8_t aUnit) * * Example usage: to find out how many centimeters there are per inch: * * GetAbsUnitsPerAbsUnit(nsIDOMSVGLength::SVG_LENGTHTYPE_CM, * nsIDOMSVGLength::SVG_LENGTHTYPE_IN) */ inline static float GetAbsUnitsPerAbsUnit(uint8_t aUnits, uint8_t aPerUnit) { - NS_ABORT_IF_FALSE(IsAbsoluteUnit(aUnits), "Not a CSS absolute unit"); - NS_ABORT_IF_FALSE(IsAbsoluteUnit(aPerUnit), "Not a CSS absolute unit"); + MOZ_ASSERT(IsAbsoluteUnit(aUnits), "Not a CSS absolute unit"); + MOZ_ASSERT(IsAbsoluteUnit(aPerUnit), "Not a CSS absolute unit"); float CSSAbsoluteUnitConversionFactors[5][5] = { // columns: cm, mm, in, pt, pc // cm per...: { 1.0f, 0.1f, 2.54f, 0.035277777777777778f, 0.42333333333333333f }, // mm per...: { 10.0f, 1.0f, 25.4f, 0.35277777777777778f, 4.2333333333333333f }, // in per...: { 0.39370078740157481f, 0.039370078740157481f, 1.0f, 0.013888888888888889f, 0.16666666666666667f },
--- a/dom/svg/SVGLengthList.h +++ b/dom/svg/SVGLengthList.h @@ -105,24 +105,24 @@ private: } bool InsertItem(uint32_t aIndex, const SVGLength &aLength) { if (aIndex >= mLengths.Length()) aIndex = mLengths.Length(); return !!mLengths.InsertElementAt(aIndex, aLength); } void ReplaceItem(uint32_t aIndex, const SVGLength &aLength) { - NS_ABORT_IF_FALSE(aIndex < mLengths.Length(), - "DOM wrapper caller should have raised INDEX_SIZE_ERR"); + MOZ_ASSERT(aIndex < mLengths.Length(), + "DOM wrapper caller should have raised INDEX_SIZE_ERR"); mLengths[aIndex] = aLength; } void RemoveItem(uint32_t aIndex) { - NS_ABORT_IF_FALSE(aIndex < mLengths.Length(), - "DOM wrapper caller should have raised INDEX_SIZE_ERR"); + MOZ_ASSERT(aIndex < mLengths.Length(), + "DOM wrapper caller should have raised INDEX_SIZE_ERR"); mLengths.RemoveElementAt(aIndex); } bool AppendItem(SVGLength aLength) { return !!mLengths.AppendElement(aLength); } protected: @@ -198,24 +198,24 @@ public: /** * Returns true if this object is an "identity" value, from the perspective * of SMIL. In other words, returns true until the initial value set up in * SVGLengthListSMILType::Init() has been changed with a SetInfo() call. */ bool IsIdentity() const { if (!mElement) { - NS_ABORT_IF_FALSE(IsEmpty(), "target element propagation failure"); + MOZ_ASSERT(IsEmpty(), "target element propagation failure"); return true; } return false; } uint8_t Axis() const { - NS_ABORT_IF_FALSE(mElement, "Axis() isn't valid"); + MOZ_ASSERT(mElement, "Axis() isn't valid"); return mAxis; } /** * The value returned by this function depends on which attribute this object * is for. If appending a list of zeros to the attribute's list would have no * effect on rendering (e.g. the attributes 'dx' and 'dy' on <text>), then * this method will return true. If appending a list of zeros to the
--- a/dom/svg/SVGLengthListSMILType.cpp +++ b/dom/svg/SVGLengthListSMILType.cpp @@ -16,17 +16,17 @@ namespace mozilla { /*static*/ SVGLengthListSMILType SVGLengthListSMILType::sSingleton; //---------------------------------------------------------------------- // nsISMILType implementation void SVGLengthListSMILType::Init(nsSMILValue &aValue) const { - NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected value type"); + MOZ_ASSERT(aValue.IsNull(), "Unexpected value type"); SVGLengthListAndInfo* lengthList = new SVGLengthListAndInfo(); // See the comment documenting Init() in our header file: lengthList->SetCanZeroPadList(true); aValue.mU.mPtr = lengthList; aValue.mType = this; @@ -105,28 +105,28 @@ SVGLengthListSMILType::Add(nsSMILValue& for (uint32_t i = 0; i < dest.Length(); ++i) { dest[i].SetValueAndUnit(valueToAdd[i].GetValueInCurrentUnits() * aCount, valueToAdd[i].GetUnit()); } dest.SetInfo(valueToAdd.Element(), valueToAdd.Axis(), valueToAdd.CanZeroPadList()); // propagate target element info! return NS_OK; } - NS_ABORT_IF_FALSE(dest.Element() == valueToAdd.Element(), - "adding values from different elements...?"); + MOZ_ASSERT(dest.Element() == valueToAdd.Element(), + "adding values from different elements...?"); // Zero-pad our |dest| list, if necessary. if (dest.Length() < valueToAdd.Length()) { if (!dest.CanZeroPadList()) { // SVGContentUtils::ReportToConsole return NS_ERROR_FAILURE; } - NS_ABORT_IF_FALSE(valueToAdd.CanZeroPadList(), - "values disagree about attribute's zero-paddibility"); + MOZ_ASSERT(valueToAdd.CanZeroPadList(), + "values disagree about attribute's zero-paddibility"); uint32_t i = dest.Length(); if (!dest.SetLength(valueToAdd.Length())) { return NS_ERROR_OUT_OF_MEMORY; } for (; i < valueToAdd.Length(); ++i) { dest[i].SetValueAndUnit(0.0f, valueToAdd[i].GetUnit()); }
--- a/dom/svg/SVGMPathElement.cpp +++ b/dom/svg/SVGMPathElement.cpp @@ -81,19 +81,18 @@ SVGMPathElement::Href() // nsIContent methods nsresult SVGMPathElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, nsIContent* aBindingParent, bool aCompileEventHandlers) { - NS_ABORT_IF_FALSE(!mHrefTarget.get(), - "Shouldn't have href-target yet " - "(or it should've been cleared)"); + MOZ_ASSERT(!mHrefTarget.get(), + "Shouldn't have href-target yet (or it should've been cleared)"); nsresult rv = SVGMPathElementBase::BindToTree(aDocument, aParent, aBindingParent, aCompileEventHandlers); NS_ENSURE_SUCCESS(rv,rv); if (aDocument) { const nsAttrValue* hrefAttrValue = mAttrsAndChildren.GetAttr(nsGkAtoms::href, kNameSpaceID_XLink); @@ -176,19 +175,19 @@ SVGMPathElement::AttributeChanged(nsIDoc //---------------------------------------------------------------------- // Public helper methods SVGPathElement* SVGMPathElement::GetReferencedPath() { if (!HasAttr(kNameSpaceID_XLink, nsGkAtoms::href)) { - NS_ABORT_IF_FALSE(!mHrefTarget.get(), - "We shouldn't have an xlink:href target " - "if we don't have an xlink:href attribute"); + MOZ_ASSERT(!mHrefTarget.get(), + "We shouldn't have an xlink:href target " + "if we don't have an xlink:href attribute"); return nullptr; } nsIContent* genericTarget = mHrefTarget.get(); if (genericTarget && genericTarget->IsSVG(nsGkAtoms::path)) { return static_cast<SVGPathElement*>(genericTarget); } return nullptr;
--- a/dom/svg/SVGMarkerElement.cpp +++ b/dom/svg/SVGMarkerElement.cpp @@ -341,18 +341,18 @@ SVGMarkerElement::GetViewBoxTransform() if (!mViewBoxToViewportTransform) { float viewportWidth = mLengthAttributes[MARKERWIDTH].GetAnimValue(mCoordCtx); float viewportHeight = mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx); nsSVGViewBoxRect viewbox = GetViewBoxRect(); - NS_ABORT_IF_FALSE(viewbox.width > 0.0f && viewbox.height > 0.0f, - "Rendering should be disabled"); + MOZ_ASSERT(viewbox.width > 0.0f && viewbox.height > 0.0f, + "Rendering should be disabled"); gfx::Matrix viewBoxTM = SVGContentUtils::GetViewBoxTransform(viewportWidth, viewportHeight, viewbox.x, viewbox.y, viewbox.width, viewbox.height, mPreserveAspectRatio); float refX = mLengthAttributes[REFX].GetAnimValue(mCoordCtx);
--- a/dom/svg/SVGMotionSMILAnimationFunction.cpp +++ b/dom/svg/SVGMotionSMILAnimationFunction.cpp @@ -141,21 +141,21 @@ GetFirstMPathChild(nsIContent* aElem) return nullptr; } void SVGMotionSMILAnimationFunction:: RebuildPathAndVerticesFromBasicAttrs(const nsIContent* aContextElem) { - NS_ABORT_IF_FALSE(!HasAttr(nsGkAtoms::path), - "Should be using |path| attr if we have it"); - NS_ABORT_IF_FALSE(!mPath, "regenerating when we aleady have path"); - NS_ABORT_IF_FALSE(mPathVertices.IsEmpty(), - "regenerating when we already have vertices"); + MOZ_ASSERT(!HasAttr(nsGkAtoms::path), + "Should be using |path| attr if we have it"); + MOZ_ASSERT(!mPath, "regenerating when we aleady have path"); + MOZ_ASSERT(mPathVertices.IsEmpty(), + "regenerating when we already have vertices"); if (!aContextElem->IsSVG()) { NS_ERROR("Uh oh, SVG animateMotion element targeting a non-SVG node"); return; } SVGMotionSMILPathUtils::PathGenerator pathGenerator(static_cast<const nsSVGElement*>(aContextElem)); @@ -259,17 +259,17 @@ SVGMotionSMILAnimationFunction::RebuildP } } // Helper to regenerate our path representation & its list of vertices void SVGMotionSMILAnimationFunction:: RebuildPathAndVertices(const nsIContent* aTargetElement) { - NS_ABORT_IF_FALSE(mIsPathStale, "rebuilding path when it isn't stale"); + MOZ_ASSERT(mIsPathStale, "rebuilding path when it isn't stale"); // Clear stale data mPath = nullptr; mPathVertices.Clear(); mPathSourceType = ePathSourceType_None; // Do we have a mpath child? if so, it trumps everything. Otherwise, we look // through our list of path-defining attributes, in order of priority. @@ -292,17 +292,17 @@ SVGMotionSMILAnimationFunction:: bool SVGMotionSMILAnimationFunction:: GenerateValuesForPathAndPoints(Path* aPath, bool aIsKeyPoints, FallibleTArray<double>& aPointDistances, nsSMILValueArray& aResult) { - NS_ABORT_IF_FALSE(aResult.IsEmpty(), "outparam is non-empty"); + MOZ_ASSERT(aResult.IsEmpty(), "outparam is non-empty"); // If we're using "keyPoints" as our list of input distances, then we need // to de-normalize from the [0, 1] scale to the [0, totalPathLen] scale. double distanceMultiplier = aIsKeyPoints ? aPath->ComputeLength() : 1.0; const uint32_t numPoints = aPointDistances.Length(); for (uint32_t i = 0; i < numPoints; ++i) { double curDist = aPointDistances[i] * distanceMultiplier; if (!aResult.AppendElement( @@ -316,24 +316,24 @@ SVGMotionSMILAnimationFunction:: nsresult SVGMotionSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr, nsSMILValueArray& aResult) { if (mIsPathStale) { RebuildPathAndVertices(aSMILAttr.GetTargetNode()); } - NS_ABORT_IF_FALSE(!mIsPathStale, "Forgot to clear 'is path stale' state"); + MOZ_ASSERT(!mIsPathStale, "Forgot to clear 'is path stale' state"); if (!mPath) { // This could be due to e.g. a parse error. - NS_ABORT_IF_FALSE(mPathVertices.IsEmpty(), "have vertices but no path"); + MOZ_ASSERT(mPathVertices.IsEmpty(), "have vertices but no path"); return NS_ERROR_FAILURE; } - NS_ABORT_IF_FALSE(!mPathVertices.IsEmpty(), "have a path but no vertices"); + MOZ_ASSERT(!mPathVertices.IsEmpty(), "have a path but no vertices"); // Now: Make the actual list of nsSMILValues (using keyPoints, if set) bool isUsingKeyPoints = !mKeyPoints.IsEmpty(); bool success = GenerateValuesForPathAndPoints(mPath, isUsingKeyPoints, isUsingKeyPoints ? mKeyPoints : mPathVertices, aResult); if (!success) {
--- a/dom/svg/SVGMotionSMILPathUtils.cpp +++ b/dom/svg/SVGMotionSMILPathUtils.cpp @@ -17,29 +17,29 @@ namespace mozilla { //---------------------------------------------------------------------- // PathGenerator methods // For the dummy 'from' value used in pure by-animation & to-animation void SVGMotionSMILPathUtils::PathGenerator:: MoveToOrigin() { - NS_ABORT_IF_FALSE(!mHaveReceivedCommands, - "Not expecting requests for mid-path MoveTo commands"); + MOZ_ASSERT(!mHaveReceivedCommands, + "Not expecting requests for mid-path MoveTo commands"); mHaveReceivedCommands = true; mPathBuilder->MoveTo(Point(0, 0)); } // For 'from' and the first entry in 'values'. bool SVGMotionSMILPathUtils::PathGenerator:: MoveToAbsolute(const nsAString& aCoordPairStr) { - NS_ABORT_IF_FALSE(!mHaveReceivedCommands, - "Not expecting requests for mid-path MoveTo commands"); + MOZ_ASSERT(!mHaveReceivedCommands, + "Not expecting requests for mid-path MoveTo commands"); mHaveReceivedCommands = true; float xVal, yVal; if (!ParseCoordinatePair(aCoordPairStr, xVal, yVal)) { return false; } mPathBuilder->MoveTo(Point(xVal, yVal)); return true;
--- a/dom/svg/SVGMotionSMILPathUtils.h +++ b/dom/svg/SVGMotionSMILPathUtils.h @@ -81,18 +81,18 @@ public: { public: MotionValueParser(PathGenerator* aPathGenerator, FallibleTArray<double>* aPointDistances) : mPathGenerator(aPathGenerator), mPointDistances(aPointDistances), mDistanceSoFar(0.0) { - NS_ABORT_IF_FALSE(mPointDistances->IsEmpty(), - "expecting point distances array to start empty"); + MOZ_ASSERT(mPointDistances->IsEmpty(), + "expecting point distances array to start empty"); } // nsSMILParserUtils::GenericValueParser interface virtual bool Parse(const nsAString& aValueStr) MOZ_OVERRIDE; protected: PathGenerator* mPathGenerator; FallibleTArray<double>* mPointDistances;
--- a/dom/svg/SVGMotionSMILType.cpp +++ b/dom/svg/SVGMotionSMILType.cpp @@ -163,39 +163,39 @@ ExtractMotionSegmentArray(const nsSMILVa } // nsISMILType Methods // ------------------- void SVGMotionSMILType::Init(nsSMILValue& aValue) const { - NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected SMIL type"); + MOZ_ASSERT(aValue.IsNull(), "Unexpected SMIL type"); aValue.mType = this; aValue.mU.mPtr = new MotionSegmentArray(1); } void SVGMotionSMILType::Destroy(nsSMILValue& aValue) const { - NS_ABORT_IF_FALSE(aValue.mType == this, "Unexpected SMIL type"); + MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL type"); MotionSegmentArray* arr = static_cast<MotionSegmentArray*>(aValue.mU.mPtr); delete arr; aValue.mU.mPtr = nullptr; aValue.mType = nsSMILNullType::Singleton(); } nsresult SVGMotionSMILType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const { - NS_ABORT_IF_FALSE(aDest.mType == aSrc.mType, "Incompatible SMIL types"); - NS_ABORT_IF_FALSE(aDest.mType == this, "Unexpected SMIL type"); + MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types"); + MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type"); const MotionSegmentArray& srcArr = ExtractMotionSegmentArray(aSrc); MotionSegmentArray& dstArr = ExtractMotionSegmentArray(aDest); // Ensure we have sufficient memory. if (!dstArr.SetCapacity(srcArr.Length())) { return NS_ERROR_OUT_OF_MEMORY; } @@ -203,18 +203,18 @@ SVGMotionSMILType::Assign(nsSMILValue& a dstArr = srcArr; // Do the assignment. return NS_OK; } bool SVGMotionSMILType::IsEqual(const nsSMILValue& aLeft, const nsSMILValue& aRight) const { - NS_ABORT_IF_FALSE(aLeft.mType == aRight.mType, "Incompatible SMIL types"); - NS_ABORT_IF_FALSE(aLeft.mType == this, "Unexpected SMIL type"); + MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types"); + MOZ_ASSERT(aLeft.mType == this, "Unexpected SMIL type"); const MotionSegmentArray& leftArr = ExtractMotionSegmentArray(aLeft); const MotionSegmentArray& rightArr = ExtractMotionSegmentArray(aRight); // If array-lengths don't match, we're trivially non-equal. if (leftArr.Length() != rightArr.Length()) { return false; } @@ -252,48 +252,48 @@ GetAngleAndPointAtDistance(Path* aPath, } } } nsresult SVGMotionSMILType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, uint32_t aCount) const { - NS_ABORT_IF_FALSE(aDest.mType == aValueToAdd.mType, - "Incompatible SMIL types"); - NS_ABORT_IF_FALSE(aDest.mType == this, "Unexpected SMIL type"); + MOZ_ASSERT(aDest.mType == aValueToAdd.mType, + "Incompatible SMIL types"); + MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type"); MotionSegmentArray& dstArr = ExtractMotionSegmentArray(aDest); const MotionSegmentArray& srcArr = ExtractMotionSegmentArray(aValueToAdd); // We're doing a simple add here (as opposed to a sandwich add below). We // only do this when we're accumulating a repeat result. // NOTE: In other nsISMILTypes, we use this method with a barely-initialized // |aDest| value to assist with "by" animation. (In this case, // "barely-initialized" would mean dstArr.Length() would be empty.) However, // we don't do this for <animateMotion>, because we instead use our "by" // value to construct an equivalent "path" attribute, and we use *that* for // our actual animation. - NS_ABORT_IF_FALSE(srcArr.Length() == 1, "Invalid source segment arr to add"); - NS_ABORT_IF_FALSE(dstArr.Length() == 1, "Invalid dest segment arr to add to"); + MOZ_ASSERT(srcArr.Length() == 1, "Invalid source segment arr to add"); + MOZ_ASSERT(dstArr.Length() == 1, "Invalid dest segment arr to add to"); const MotionSegment& srcSeg = srcArr[0]; const MotionSegment& dstSeg = dstArr[0]; - NS_ABORT_IF_FALSE(srcSeg.mSegmentType == eSegmentType_PathPoint, - "expecting to be adding points from a motion path"); - NS_ABORT_IF_FALSE(dstSeg.mSegmentType == eSegmentType_PathPoint, - "expecting to be adding points from a motion path"); + MOZ_ASSERT(srcSeg.mSegmentType == eSegmentType_PathPoint, + "expecting to be adding points from a motion path"); + MOZ_ASSERT(dstSeg.mSegmentType == eSegmentType_PathPoint, + "expecting to be adding points from a motion path"); const PathPointParams& srcParams = srcSeg.mU.mPathPointParams; const PathPointParams& dstParams = dstSeg.mU.mPathPointParams; - NS_ABORT_IF_FALSE(srcSeg.mRotateType == dstSeg.mRotateType && - srcSeg.mRotateAngle == dstSeg.mRotateAngle, - "unexpected angle mismatch"); - NS_ABORT_IF_FALSE(srcParams.mPath == dstParams.mPath, - "unexpected path mismatch"); + MOZ_ASSERT(srcSeg.mRotateType == dstSeg.mRotateType && + srcSeg.mRotateAngle == dstSeg.mRotateAngle, + "unexpected angle mismatch"); + MOZ_ASSERT(srcParams.mPath == dstParams.mPath, + "unexpected path mismatch"); Path* path = srcParams.mPath; // Use destination to get our rotate angle. float rotateAngle = dstSeg.mRotateAngle; Point dstPt; GetAngleAndPointAtDistance(path, dstParams.mDistToPoint, dstSeg.mRotateType, rotateAngle, dstPt); @@ -308,62 +308,62 @@ SVGMotionSMILType::Add(nsSMILValue& aDes dstArr.AppendElement(MotionSegment(newX, newY, rotateAngle)); return NS_OK; } nsresult SVGMotionSMILType::SandwichAdd(nsSMILValue& aDest, const nsSMILValue& aValueToAdd) const { - NS_ABORT_IF_FALSE(aDest.mType == aValueToAdd.mType, - "Incompatible SMIL types"); - NS_ABORT_IF_FALSE(aDest.mType == this, "Unexpected SMIL type"); + MOZ_ASSERT(aDest.mType == aValueToAdd.mType, + "Incompatible SMIL types"); + MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL type"); MotionSegmentArray& dstArr = ExtractMotionSegmentArray(aDest); const MotionSegmentArray& srcArr = ExtractMotionSegmentArray(aValueToAdd); // We're only expecting to be adding 1 segment on to the list - NS_ABORT_IF_FALSE(srcArr.Length() == 1, - "Trying to do sandwich add of more than one value"); + MOZ_ASSERT(srcArr.Length() == 1, + "Trying to do sandwich add of more than one value"); if (!dstArr.AppendElement(srcArr[0])) { return NS_ERROR_OUT_OF_MEMORY; } return NS_OK; } nsresult SVGMotionSMILType::ComputeDistance(const nsSMILValue& aFrom, const nsSMILValue& aTo, double& aDistance) const { - NS_ABORT_IF_FALSE(aFrom.mType == aTo.mType, "Incompatible SMIL types"); - NS_ABORT_IF_FALSE(aFrom.mType == this, "Unexpected SMIL type"); + MOZ_ASSERT(aFrom.mType == aTo.mType, "Incompatible SMIL types"); + MOZ_ASSERT(aFrom.mType == this, "Unexpected SMIL type"); const MotionSegmentArray& fromArr = ExtractMotionSegmentArray(aFrom); const MotionSegmentArray& toArr = ExtractMotionSegmentArray(aTo); // ComputeDistance is only used for calculating distances between single // values in a values array. So we should only have one entry in each array. - NS_ABORT_IF_FALSE(fromArr.Length() == 1, - "Wrong number of elements in from value"); - NS_ABORT_IF_FALSE(toArr.Length() == 1, - "Wrong number of elements in to value"); + MOZ_ASSERT(fromArr.Length() == 1, + "Wrong number of elements in from value"); + MOZ_ASSERT(toArr.Length() == 1, + "Wrong number of elements in to value"); const MotionSegment& from = fromArr[0]; const MotionSegment& to = toArr[0]; - NS_ABORT_IF_FALSE(from.mSegmentType == to.mSegmentType, - "Mismatched MotionSegment types"); + MOZ_ASSERT(from.mSegmentType == to.mSegmentType, + "Mismatched MotionSegment types"); if (from.mSegmentType == eSegmentType_PathPoint) { const PathPointParams& fromParams = from.mU.mPathPointParams; const PathPointParams& toParams = to.mU.mPathPointParams; - NS_ABORT_IF_FALSE(fromParams.mPath == toParams.mPath, - "Interpolation endpoints should be from same path"); - NS_ABORT_IF_FALSE(fromParams.mDistToPoint <= toParams.mDistToPoint, - "To value shouldn't be before from value on path"); + MOZ_ASSERT(fromParams.mPath == toParams.mPath, + "Interpolation endpoints should be from same path"); + MOZ_ASSERT(fromParams.mDistToPoint <= toParams.mDistToPoint, + "To value shouldn't be before from value on path"); aDistance = fabs(toParams.mDistToPoint - fromParams.mDistToPoint); } else { const TranslationParams& fromParams = from.mU.mTranslationParams; const TranslationParams& toParams = to.mU.mTranslationParams; float dX = toParams.mX - fromParams.mX; float dY = toParams.mY - fromParams.mY; aDistance = NS_hypot(dX, dY); } @@ -380,60 +380,60 @@ InterpolateFloat(const float& aStartFlt, } nsresult SVGMotionSMILType::Interpolate(const nsSMILValue& aStartVal, const nsSMILValue& aEndVal, double aUnitDistance, nsSMILValue& aResult) const { - NS_ABORT_IF_FALSE(aStartVal.mType == aEndVal.mType, - "Trying to interpolate different types"); - NS_ABORT_IF_FALSE(aStartVal.mType == this, - "Unexpected types for interpolation"); - NS_ABORT_IF_FALSE(aResult.mType == this, "Unexpected result type"); - NS_ABORT_IF_FALSE(aUnitDistance >= 0.0 && aUnitDistance <= 1.0, - "unit distance value out of bounds"); + 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"); + MOZ_ASSERT(aUnitDistance >= 0.0 && aUnitDistance <= 1.0, + "unit distance value out of bounds"); const MotionSegmentArray& startArr = ExtractMotionSegmentArray(aStartVal); const MotionSegmentArray& endArr = ExtractMotionSegmentArray(aEndVal); MotionSegmentArray& resultArr = ExtractMotionSegmentArray(aResult); - NS_ABORT_IF_FALSE(startArr.Length() <= 1, - "Invalid start-point for animateMotion interpolation"); - NS_ABORT_IF_FALSE(endArr.Length() == 1, - "Invalid end-point for animateMotion interpolation"); - NS_ABORT_IF_FALSE(resultArr.IsEmpty(), - "Expecting result to be just-initialized w/ empty array"); + MOZ_ASSERT(startArr.Length() <= 1, + "Invalid start-point for animateMotion interpolation"); + MOZ_ASSERT(endArr.Length() == 1, + "Invalid end-point for animateMotion interpolation"); + MOZ_ASSERT(resultArr.IsEmpty(), + "Expecting result to be just-initialized w/ empty array"); const MotionSegment& endSeg = endArr[0]; - NS_ABORT_IF_FALSE(endSeg.mSegmentType == eSegmentType_PathPoint, - "Expecting to be interpolating along a path"); + MOZ_ASSERT(endSeg.mSegmentType == eSegmentType_PathPoint, + "Expecting to be interpolating along a path"); const PathPointParams& endParams = endSeg.mU.mPathPointParams; // NOTE: path & angle should match between start & end (since presumably // start & end came from the same <animateMotion> element), unless start is // empty. (as it would be for pure 'to' animation) Path* path = endParams.mPath; RotateType rotateType = endSeg.mRotateType; float rotateAngle = endSeg.mRotateAngle; float startDist; if (startArr.IsEmpty()) { startDist = 0.0f; } else { const MotionSegment& startSeg = startArr[0]; - NS_ABORT_IF_FALSE(startSeg.mSegmentType == eSegmentType_PathPoint, - "Expecting to be interpolating along a path"); + MOZ_ASSERT(startSeg.mSegmentType == eSegmentType_PathPoint, + "Expecting to be interpolating along a path"); const PathPointParams& startParams = startSeg.mU.mPathPointParams; - NS_ABORT_IF_FALSE(startSeg.mRotateType == endSeg.mRotateType && - startSeg.mRotateAngle == endSeg.mRotateAngle, - "unexpected angle mismatch"); - NS_ABORT_IF_FALSE(startParams.mPath == endParams.mPath, - "unexpected path mismatch"); + MOZ_ASSERT(startSeg.mRotateType == endSeg.mRotateType && + startSeg.mRotateAngle == endSeg.mRotateAngle, + "unexpected angle mismatch"); + MOZ_ASSERT(startParams.mPath == endParams.mPath, + "unexpected path mismatch"); startDist = startParams.mDistToPoint; } // Get the interpolated distance along our path. float resultDist = InterpolateFloat(startDist, endParams.mDistToPoint, aUnitDistance); // Construct the intermediate result segment, and put it in our outparam. @@ -451,19 +451,19 @@ SVGMotionSMILType::CreateMatrix(const ns gfx::Matrix matrix; uint32_t length = arr.Length(); for (uint32_t i = 0; i < length; i++) { Point point; // initialized below float rotateAngle = arr[i].mRotateAngle; // might get updated below if (arr[i].mSegmentType == eSegmentType_Translation) { point.x = arr[i].mU.mTranslationParams.mX; point.y = arr[i].mU.mTranslationParams.mY; - NS_ABORT_IF_FALSE(arr[i].mRotateType == eRotateType_Explicit, - "'auto'/'auto-reverse' should have been converted to " - "explicit angles when we generated this translation"); + MOZ_ASSERT(arr[i].mRotateType == eRotateType_Explicit, + "'auto'/'auto-reverse' should have been converted to " + "explicit angles when we generated this translation"); } else { GetAngleAndPointAtDistance(arr[i].mU.mPathPointParams.mPath, arr[i].mU.mPathPointParams.mDistToPoint, arr[i].mRotateType, rotateAngle, point); } matrix.PreTranslate(point.x, point.y); matrix.PreRotate(rotateAngle);
--- a/dom/svg/SVGNumberList.h +++ b/dom/svg/SVGNumberList.h @@ -108,24 +108,24 @@ private: bool InsertItem(uint32_t aIndex, const float &aNumber) { if (aIndex >= mNumbers.Length()) { aIndex = mNumbers.Length(); } return !!mNumbers.InsertElementAt(aIndex, aNumber); } void ReplaceItem(uint32_t aIndex, const float &aNumber) { - NS_ABORT_IF_FALSE(aIndex < mNumbers.Length(), - "DOM wrapper caller should have raised INDEX_SIZE_ERR"); + MOZ_ASSERT(aIndex < mNumbers.Length(), + "DOM wrapper caller should have raised INDEX_SIZE_ERR"); mNumbers[aIndex] = aNumber; } void RemoveItem(uint32_t aIndex) { - NS_ABORT_IF_FALSE(aIndex < mNumbers.Length(), - "DOM wrapper caller should have raised INDEX_SIZE_ERR"); + MOZ_ASSERT(aIndex < mNumbers.Length(), + "DOM wrapper caller should have raised INDEX_SIZE_ERR"); mNumbers.RemoveElementAt(aIndex); } bool AppendItem(float aNumber) { return !!mNumbers.AppendElement(aNumber); } protected:
--- a/dom/svg/SVGNumberListSMILType.cpp +++ b/dom/svg/SVGNumberListSMILType.cpp @@ -32,17 +32,17 @@ namespace mozilla { /*static*/ SVGNumberListSMILType SVGNumberListSMILType::sSingleton; //---------------------------------------------------------------------- // nsISMILType implementation void SVGNumberListSMILType::Init(nsSMILValue &aValue) const { - NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected value type"); + MOZ_ASSERT(aValue.IsNull(), "Unexpected value type"); SVGNumberListAndInfo* numberList = new SVGNumberListAndInfo(); aValue.mU.mPtr = numberList; aValue.mType = this; } void @@ -88,38 +88,38 @@ SVGNumberListSMILType::Add(nsSMILValue& NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type"); NS_PRECONDITION(aValueToAdd.mType == this, "Incompatible SMIL type"); SVGNumberListAndInfo& dest = *static_cast<SVGNumberListAndInfo*>(aDest.mU.mPtr); const SVGNumberListAndInfo& valueToAdd = *static_cast<const SVGNumberListAndInfo*>(aValueToAdd.mU.mPtr); - NS_ABORT_IF_FALSE(dest.Element() || valueToAdd.Element(), - "Target element propagation failure"); + MOZ_ASSERT(dest.Element() || valueToAdd.Element(), + "Target element propagation failure"); if (!valueToAdd.Element()) { - NS_ABORT_IF_FALSE(valueToAdd.Length() == 0, - "Not identity value - target element propagation failure"); + MOZ_ASSERT(valueToAdd.Length() == 0, + "Not identity value - target element propagation failure"); return NS_OK; } if (!dest.Element()) { - NS_ABORT_IF_FALSE(dest.Length() == 0, - "Not identity value - target element propagation failure"); + MOZ_ASSERT(dest.Length() == 0, + "Not identity value - target element propagation failure"); if (!dest.SetLength(valueToAdd.Length())) { return NS_ERROR_OUT_OF_MEMORY; } for (uint32_t i = 0; i < dest.Length(); ++i) { dest[i] = aCount * valueToAdd[i]; } dest.SetInfo(valueToAdd.Element()); // propagate target element info! return NS_OK; } - NS_ABORT_IF_FALSE(dest.Element() == valueToAdd.Element(), - "adding values from different elements...?"); + MOZ_ASSERT(dest.Element() == valueToAdd.Element(), + "adding values from different elements...?"); if (dest.Length() != valueToAdd.Length()) { // For now we only support animation between lists with the same number of // items. SVGContentUtils::ReportToConsole return NS_ERROR_FAILURE; } for (uint32_t i = 0; i < dest.Length(); ++i) { dest[i] += aCount * valueToAdd[i]; } @@ -178,34 +178,34 @@ SVGNumberListSMILType::Interpolate(const const SVGNumberListAndInfo& start = *static_cast<const SVGNumberListAndInfo*>(aStartVal.mU.mPtr); const SVGNumberListAndInfo& end = *static_cast<const SVGNumberListAndInfo*>(aEndVal.mU.mPtr); SVGNumberListAndInfo& result = *static_cast<SVGNumberListAndInfo*>(aResult.mU.mPtr); - NS_ABORT_IF_FALSE(end.Element(), "Can't propagate target element"); - NS_ABORT_IF_FALSE(start.Element() == end.Element() || !start.Element(), - "Different target elements"); + MOZ_ASSERT(end.Element(), "Can't propagate target element"); + MOZ_ASSERT(start.Element() == end.Element() || !start.Element(), + "Different target elements"); if (start.Element() && // 'start' is not an "identity" value start.Length() != end.Length()) { // For now we only support animation between lists of the same length. // SVGContentUtils::ReportToConsole return NS_ERROR_FAILURE; } if (!result.SetLength(end.Length())) { return NS_ERROR_OUT_OF_MEMORY; } result.SetInfo(end.Element()); // propagate target element info! if (start.Length() != end.Length()) { - NS_ABORT_IF_FALSE(start.Length() == 0, "Not an identity value"); + MOZ_ASSERT(start.Length() == 0, "Not an identity value"); for (uint32_t i = 0; i < end.Length(); ++i) { result[i] = aUnitDistance * end[i]; } return NS_OK; } for (uint32_t i = 0; i < end.Length(); ++i) { result[i] = start[i] + (end[i] - start[i]) * aUnitDistance; }
--- a/dom/svg/SVGNumberPairSMILType.cpp +++ b/dom/svg/SVGNumberPairSMILType.cpp @@ -10,17 +10,17 @@ namespace mozilla { /*static*/ SVGNumberPairSMILType SVGNumberPairSMILType::sSingleton; void SVGNumberPairSMILType::Init(nsSMILValue& aValue) const { - NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected value type"); + MOZ_ASSERT(aValue.IsNull(), "Unexpected value type"); aValue.mU.mNumberPair[0] = 0; aValue.mU.mNumberPair[1] = 0; aValue.mType = this; } void SVGNumberPairSMILType::Destroy(nsSMILValue& aValue) const
--- a/dom/svg/SVGOrientSMILType.cpp +++ b/dom/svg/SVGOrientSMILType.cpp @@ -12,17 +12,17 @@ namespace mozilla { /*static*/ SVGOrientSMILType SVGOrientSMILType::sSingleton; void SVGOrientSMILType::Init(nsSMILValue& aValue) const { - NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected value type"); + MOZ_ASSERT(aValue.IsNull(), "Unexpected value type"); aValue.mU.mOrient.mAngle = 0.0f; aValue.mU.mOrient.mUnit = SVG_ANGLETYPE_UNSPECIFIED; aValue.mU.mOrient.mOrientType = dom::SVG_MARKER_ORIENT_ANGLE; aValue.mType = this; } void
--- a/dom/svg/SVGPathData.cpp +++ b/dom/svg/SVGPathData.cpp @@ -52,17 +52,17 @@ SVGPathData::GetValueAsString(nsAString& uint32_t i = 0; for (;;) { nsAutoString segAsString; SVGPathSegUtils::GetValueAsString(&mData[i], segAsString); // We ignore OOM, since it's not useful for us to return an error. aValue.Append(segAsString); i += 1 + SVGPathSegUtils::ArgCountForType(mData[i]); if (i >= mData.Length()) { - NS_ABORT_IF_FALSE(i == mData.Length(), "Very, very bad - mData corrupt"); + MOZ_ASSERT(i == mData.Length(), "Very, very bad - mData corrupt"); return; } aValue.Append(' '); } } nsresult SVGPathData::SetValueFromString(const nsAString& aValue) @@ -101,33 +101,33 @@ SVGPathData::GetPathLength() const SVGPathTraversalState state; uint32_t i = 0; while (i < mData.Length()) { SVGPathSegUtils::TraversePathSegment(&mData[i], state); i += 1 + SVGPathSegUtils::ArgCountForType(mData[i]); } - NS_ABORT_IF_FALSE(i == mData.Length(), "Very, very bad - mData corrupt"); + MOZ_ASSERT(i == mData.Length(), "Very, very bad - mData corrupt"); return state.length; } #ifdef DEBUG uint32_t SVGPathData::CountItems() const { uint32_t i = 0, count = 0; while (i < mData.Length()) { i += 1 + SVGPathSegUtils::ArgCountForType(mData[i]); count++; } - NS_ABORT_IF_FALSE(i == mData.Length(), "Very, very bad - mData corrupt"); + MOZ_ASSERT(i == mData.Length(), "Very, very bad - mData corrupt"); return count; } #endif bool SVGPathData::GetSegmentLengths(nsTArray<double> *aLengths) const { @@ -140,17 +140,17 @@ SVGPathData::GetSegmentLengths(nsTArray< SVGPathSegUtils::TraversePathSegment(&mData[i], state); if (!aLengths->AppendElement(state.length)) { aLengths->Clear(); return false; } i += 1 + SVGPathSegUtils::ArgCountForType(mData[i]); } - NS_ABORT_IF_FALSE(i == mData.Length(), "Very, very bad - mData corrupt"); + MOZ_ASSERT(i == mData.Length(), "Very, very bad - mData corrupt"); return true; } bool SVGPathData::GetDistancesFromOriginToEndsOfVisibleSegments(FallibleTArray<double> *aOutput) const { SVGPathTraversalState state; @@ -176,17 +176,17 @@ SVGPathData::GetDistancesFromOriginToEnd segType != PATHSEG_MOVETO_REL)) { if (!aOutput->AppendElement(state.length)) { return false; } } i += 1 + SVGPathSegUtils::ArgCountForType(segType); } - NS_ABORT_IF_FALSE(i == mData.Length(), "Very, very bad - mData corrupt?"); + MOZ_ASSERT(i == mData.Length(), "Very, very bad - mData corrupt?"); return true; } uint32_t SVGPathData::GetPathSegAtLength(float aDistance) const { // TODO [SVGWG issue] get specified what happen if 'aDistance' < 0, or @@ -201,17 +201,17 @@ SVGPathData::GetPathSegAtLength(float aD SVGPathSegUtils::TraversePathSegment(&mData[i], state); if (state.length >= aDistance) { return segIndex; } i += 1 + SVGPathSegUtils::ArgCountForType(mData[i]); segIndex++; } - NS_ABORT_IF_FALSE(i == mData.Length(), "Very, very bad - mData corrupt"); + MOZ_ASSERT(i == mData.Length(), "Very, very bad - mData corrupt"); return std::max(0U, segIndex - 1); // -1 because while loop takes us 1 too far } /** * The SVG spec says we have to paint stroke caps for zero length subpaths: * * http://www.w3.org/TR/SVG11/implnote.html#PathElementImplementationNotes @@ -492,19 +492,19 @@ SVGPathData::BuildPath(PathBuilder* buil subpathContainsNonMoveTo = segType != PATHSEG_MOVETO_ABS && segType != PATHSEG_MOVETO_REL; i += argCount; prevSegType = segType; segStart = segEnd; } - NS_ABORT_IF_FALSE(i == mData.Length(), "Very, very bad - mData corrupt"); - NS_ABORT_IF_FALSE(prevSegType == segType, - "prevSegType should be left at the final segType"); + MOZ_ASSERT(i == mData.Length(), "Very, very bad - mData corrupt"); + MOZ_ASSERT(prevSegType == segType, + "prevSegType should be left at the final segType"); MAYBE_APPROXIMATE_ZERO_LENGTH_SUBPATH_SQUARE_CAPS_TO_DT; return builder->Finish(); } TemporaryRef<Path> SVGPathData::BuildPathForMeasuring() const @@ -810,17 +810,17 @@ SVGPathData::GetMarkerPositioningData(ns segEndAngle = AngleOfVectorF(segEnd - cp1); i += 2; break; } default: // Leave any existing marks in aMarks so we have a visual indication of // when things went wrong. - NS_ABORT_IF_FALSE(false, "Unknown segment type - path corruption?"); + MOZ_ASSERT(false, "Unknown segment type - path corruption?"); return; } // Set the angle of the mark at the start of this segment: if (aMarks->Length()) { nsSVGMark &mark = aMarks->LastElement(); if (!IsMoveto(segType) && IsMoveto(prevSegType)) { // start of new subpath @@ -852,17 +852,17 @@ SVGPathData::GetMarkerPositioningData(ns SVGContentUtils::AngleBisect(segEndAngle, pathStartAngle); } prevSegType = segType; prevSegEnd = segEnd; prevSegEndAngle = segEndAngle; } - NS_ABORT_IF_FALSE(i == mData.Length(), "Very, very bad - mData corrupt"); + MOZ_ASSERT(i == mData.Length(), "Very, very bad - mData corrupt"); if (aMarks->Length()) { if (prevSegType != PATHSEG_CLOSEPATH) { aMarks->LastElement().angle = prevSegEndAngle; } aMarks->LastElement().type = nsSVGMark::eEnd; aMarks->ElementAt(0).type = nsSVGMark::eStart; }
--- a/dom/svg/SVGPathData.h +++ b/dom/svg/SVGPathData.h @@ -258,17 +258,17 @@ public: /** * Returns true if this object is an "identity" value, from the perspective * of SMIL. In other words, returns true until the initial value set up in * SVGPathSegListSMILType::Init() has been changed with a SetElement() call. */ bool IsIdentity() const { if (!mElement) { - NS_ABORT_IF_FALSE(IsEmpty(), "target element propagation failure"); + MOZ_ASSERT(IsEmpty(), "target element propagation failure"); return true; } return false; } /** * Exposed so that SVGPathData baseVals can be copied to * SVGPathDataAndInfo objects. Note that callers should also call
--- a/dom/svg/SVGPathElement.cpp +++ b/dom/svg/SVGPathElement.cpp @@ -330,18 +330,18 @@ void SVGPathElement::GetMarkPoints(nsTArray<nsSVGMark> *aMarks) { mD.GetAnimValue().GetMarkerPositioningData(aMarks); } float SVGPathElement::GetPathLengthScale(PathLengthScaleForType aFor) { - NS_ABORT_IF_FALSE(aFor == eForTextPath || aFor == eForStroking, - "Unknown enum"); + MOZ_ASSERT(aFor == eForTextPath || aFor == eForStroking, + "Unknown enum"); if (mPathLength.IsExplicitlySet()) { float authorsPathLengthEstimate = mPathLength.GetAnimValue(); if (authorsPathLengthEstimate > 0) { RefPtr<Path> path = GetOrBuildPathForMeasuring(); if (!path) { // The path is empty or invalid so its length must be zero and // we know that 0 / authorsPathLengthEstimate = 0. return 0.0;
--- a/dom/svg/SVGPathSegListSMILType.cpp +++ b/dom/svg/SVGPathSegListSMILType.cpp @@ -18,17 +18,17 @@ namespace mozilla { //---------------------------------------------------------------------- // nsISMILType implementation void SVGPathSegListSMILType::Init(nsSMILValue &aValue) const { - NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected value type"); + MOZ_ASSERT(aValue.IsNull(), "Unexpected value type"); aValue.mU.mPtr = new SVGPathDataAndInfo(); aValue.mType = this; } void SVGPathSegListSMILType::Destroy(nsSMILValue& aValue) const { NS_PRECONDITION(aValue.mType == this, "Unexpected SMIL value type"); @@ -62,20 +62,20 @@ SVGPathSegListSMILType::IsEqual(const ns return *static_cast<const SVGPathDataAndInfo*>(aLeft.mU.mPtr) == *static_cast<const SVGPathDataAndInfo*>(aRight.mU.mPtr); } static bool ArcFlagsDiffer(SVGPathDataAndInfo::const_iterator aPathData1, SVGPathDataAndInfo::const_iterator aPathData2) { - NS_ABORT_IF_FALSE + MOZ_ASSERT (SVGPathSegUtils::IsArcType(SVGPathSegUtils::DecodeType(aPathData1[0])), "ArcFlagsDiffer called with non-arc segment"); - NS_ABORT_IF_FALSE + MOZ_ASSERT (SVGPathSegUtils::IsArcType(SVGPathSegUtils::DecodeType(aPathData2[0])), "ArcFlagsDiffer called with non-arc segment"); return aPathData1[LARGE_ARC_FLAG_IDX] != aPathData2[LARGE_ARC_FLAG_IDX] || aPathData1[SWEEP_FLAG_IDX] != aPathData2[SWEEP_FLAG_IDX]; } enum PathInterpolationResult { @@ -120,18 +120,18 @@ CanInterpolate(const SVGPathDataAndInfo& result = eRequiresConversion; } pStart += 1 + SVGPathSegUtils::ArgCountForType(startType); pEnd += 1 + SVGPathSegUtils::ArgCountForType(endType); } - NS_ABORT_IF_FALSE(pStart <= pStartDataEnd && pEnd <= pEndDataEnd, - "Iterated past end of buffer! (Corrupt path data?)"); + MOZ_ASSERT(pStart <= pStartDataEnd && pEnd <= pEndDataEnd, + "Iterated past end of buffer! (Corrupt path data?)"); if (pStart != pStartDataEnd || pEnd != pEndDataEnd) { return eCannotInterpolate; } return result; } @@ -171,31 +171,31 @@ AdjustSegmentForRelativeness(Relativenes */ static inline void AddWeightedPathSegs(double aCoeff1, SVGPathDataAndInfo::const_iterator& aSeg1, double aCoeff2, SVGPathDataAndInfo::const_iterator& aSeg2, SVGPathDataAndInfo::iterator& aResultSeg) { - NS_ABORT_IF_FALSE(aSeg2, "2nd segment must be non-null"); - NS_ABORT_IF_FALSE(aResultSeg, "result segment must be non-null"); + MOZ_ASSERT(aSeg2, "2nd segment must be non-null"); + MOZ_ASSERT(aResultSeg, "result segment must be non-null"); uint32_t segType = SVGPathSegUtils::DecodeType(aSeg2[0]); - NS_ABORT_IF_FALSE(!aSeg1 || SVGPathSegUtils::DecodeType(*aSeg1) == segType, - "unexpected segment type"); + MOZ_ASSERT(!aSeg1 || SVGPathSegUtils::DecodeType(*aSeg1) == segType, + "unexpected segment type"); // FIRST: Directly copy the arguments that don't make sense to add. aResultSeg[0] = aSeg2[0]; // encoded segment type bool isArcType = SVGPathSegUtils::IsArcType(segType); if (isArcType) { // Copy boolean arc flags. - NS_ABORT_IF_FALSE(!aSeg1 || !ArcFlagsDiffer(aSeg1, aSeg2), - "Expecting arc flags to match"); + MOZ_ASSERT(!aSeg1 || !ArcFlagsDiffer(aSeg1, aSeg2), + "Expecting arc flags to match"); aResultSeg[LARGE_ARC_FLAG_IDX] = aSeg2[LARGE_ARC_FLAG_IDX]; aResultSeg[SWEEP_FLAG_IDX] = aSeg2[SWEEP_FLAG_IDX]; } // SECOND: Add the arguments that are supposed to be added. // (The 1's below are to account for segment type) uint32_t numArgs = SVGPathSegUtils::ArgCountForType(segType); for (uint32_t i = 1; i < 1 + numArgs; ++i) { @@ -232,26 +232,26 @@ AddWeightedPathSegs(double aCoeff1, * identity, in which case we'll grow it to the right * size. Also allowed to be the same list as aList1. */ static void AddWeightedPathSegLists(double aCoeff1, const SVGPathDataAndInfo& aList1, double aCoeff2, const SVGPathDataAndInfo& aList2, SVGPathDataAndInfo& aResult) { - NS_ABORT_IF_FALSE(aCoeff1 >= 0.0 && aCoeff2 >= 0.0, - "expecting non-negative coefficients"); - NS_ABORT_IF_FALSE(!aList2.IsIdentity(), - "expecting 2nd list to be non-identity"); - NS_ABORT_IF_FALSE(aList1.IsIdentity() || aList1.Length() == aList2.Length(), - "expecting 1st list to be identity or to have same " - "length as 2nd list"); - NS_ABORT_IF_FALSE(aResult.IsIdentity() || aResult.Length() == aList2.Length(), - "expecting result list to be identity or to have same " - "length as 2nd list"); + MOZ_ASSERT(aCoeff1 >= 0.0 && aCoeff2 >= 0.0, + "expecting non-negative coefficients"); + MOZ_ASSERT(!aList2.IsIdentity(), + "expecting 2nd list to be non-identity"); + MOZ_ASSERT(aList1.IsIdentity() || aList1.Length() == aList2.Length(), + "expecting 1st list to be identity or to have same " + "length as 2nd list"); + MOZ_ASSERT(aResult.IsIdentity() || aResult.Length() == aList2.Length(), + "expecting result list to be identity or to have same " + "length as 2nd list"); SVGPathDataAndInfo::const_iterator iter1, end1; if (aList1.IsIdentity()) { iter1 = end1 = nullptr; // indicate that this is an identity list } else { iter1 = aList1.begin(); end1 = aList1.end(); } @@ -259,32 +259,32 @@ AddWeightedPathSegLists(double aCoeff1, SVGPathDataAndInfo::const_iterator end2 = aList2.end(); // Grow |aResult| if necessary. (NOTE: It's possible that aResult and aList1 // are the same list, so this may implicitly resize aList1. That's fine, // because in that case, we will have already set iter1 to nullptr above, to // record that our first operand is an identity value.) if (aResult.IsIdentity()) { DebugOnly<bool> success = aResult.SetLength(aList2.Length()); - NS_ABORT_IF_FALSE(success, "infallible nsTArray::SetLength should succeed"); + MOZ_ASSERT(success, "infallible nsTArray::SetLength should succeed"); aResult.SetElement(aList2.Element()); // propagate target element info! } SVGPathDataAndInfo::iterator resultIter = aResult.begin(); while ((!iter1 || iter1 != end1) && iter2 != end2) { AddWeightedPathSegs(aCoeff1, iter1, aCoeff2, iter2, resultIter); } - NS_ABORT_IF_FALSE((!iter1 || iter1 == end1) && - iter2 == end2 && - resultIter == aResult.end(), - "Very, very bad - path data corrupt"); + MOZ_ASSERT((!iter1 || iter1 == end1) && + iter2 == end2 && + resultIter == aResult.end(), + "Very, very bad - path data corrupt"); } static void ConvertPathSegmentData(SVGPathDataAndInfo::const_iterator& aStart, SVGPathDataAndInfo::const_iterator& aEnd, SVGPathDataAndInfo::iterator& aResult, SVGPathTraversalState& aState) { @@ -302,25 +302,25 @@ ConvertPathSegmentData(SVGPathDataAndInf while (segmentLengthIncludingType) { *aResult++ = *aStart++; --segmentLengthIncludingType; } SVGPathSegUtils::TraversePathSegment(pResultSegmentBegin, aState); return; } - NS_ABORT_IF_FALSE + MOZ_ASSERT (SVGPathSegUtils::SameTypeModuloRelativeness(startType, endType), "Incompatible path segment types passed to ConvertPathSegmentData!"); RelativenessAdjustmentType adjustmentType = SVGPathSegUtils::IsRelativeType(startType) ? eRelativeToAbsolute : eAbsoluteToRelative; - NS_ABORT_IF_FALSE + MOZ_ASSERT (segmentLengthIncludingType == 1 + SVGPathSegUtils::ArgCountForType(endType), "Compatible path segment types for interpolation had different lengths!"); aResult[0] = aEnd[0]; switch (endType) { case PATHSEG_LINETO_HORIZONTAL_ABS: @@ -383,18 +383,18 @@ ConvertAllPathSegmentData(SVGPathDataAnd SVGPathDataAndInfo::const_iterator aEndDataEnd, SVGPathDataAndInfo::iterator aResult) { SVGPathTraversalState state; state.mode = SVGPathTraversalState::eUpdateOnlyStartAndCurrentPos; while (aStart < aStartDataEnd && aEnd < aEndDataEnd) { ConvertPathSegmentData(aStart, aEnd, aResult, state); } - NS_ABORT_IF_FALSE(aStart == aStartDataEnd && aEnd == aEndDataEnd, - "Failed to convert all path segment data! (Corrupt?)"); + MOZ_ASSERT(aStart == aStartDataEnd && aEnd == aEndDataEnd, + "Failed to convert all path segment data! (Corrupt?)"); } nsresult SVGPathSegListSMILType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, uint32_t aCount) const { NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type"); @@ -406,18 +406,18 @@ SVGPathSegListSMILType::Add(nsSMILValue& *static_cast<const SVGPathDataAndInfo*>(aValueToAdd.mU.mPtr); if (valueToAdd.IsIdentity()) { // Adding identity value - no-op return NS_OK; } if (!dest.IsIdentity()) { // Neither value is identity; make sure they're compatible. - NS_ABORT_IF_FALSE(dest.Element() == valueToAdd.Element(), - "adding values from different elements...?"); + MOZ_ASSERT(dest.Element() == valueToAdd.Element(), + "adding values from different elements...?"); PathInterpolationResult check = CanInterpolate(dest, valueToAdd); if (check == eCannotInterpolate) { // SVGContentUtils::ReportToConsole - can't add path segment lists with // different numbers of segments, with arcs that have different flag // values, or with incompatible segment types. return NS_ERROR_FAILURE; } @@ -461,34 +461,34 @@ SVGPathSegListSMILType::Interpolate(cons NS_PRECONDITION(aResult.mType == this, "Unexpected result type"); const SVGPathDataAndInfo& start = *static_cast<const SVGPathDataAndInfo*>(aStartVal.mU.mPtr); const SVGPathDataAndInfo& end = *static_cast<const SVGPathDataAndInfo*>(aEndVal.mU.mPtr); SVGPathDataAndInfo& result = *static_cast<SVGPathDataAndInfo*>(aResult.mU.mPtr); - NS_ABORT_IF_FALSE(result.IsIdentity(), - "expecting outparam to start out as identity"); + MOZ_ASSERT(result.IsIdentity(), + "expecting outparam to start out as identity"); PathInterpolationResult check = CanInterpolate(start, end); if (check == eCannotInterpolate) { // SVGContentUtils::ReportToConsole - can't interpolate path segment lists with // different numbers of segments, with arcs with different flag values, or // with incompatible segment types. return NS_ERROR_FAILURE; } const SVGPathDataAndInfo* startListToUse = &start; if (check == eRequiresConversion) { // Can't convert |start| in-place, since it's const. Instead, we copy it // into |result|, converting the types as we go, and use that as our start. DebugOnly<bool> success = result.SetLength(end.Length()); - NS_ABORT_IF_FALSE(success, "infallible nsTArray::SetLength should succeed"); + MOZ_ASSERT(success, "infallible nsTArray::SetLength should succeed"); result.SetElement(end.Element()); // propagate target element info! ConvertAllPathSegmentData(start.begin(), start.end(), end.begin(), end.end(), result.begin()); startListToUse = &result; }
--- a/dom/svg/SVGPathSegUtils.cpp +++ b/dom/svg/SVGPathSegUtils.cpp @@ -64,17 +64,17 @@ SVGPathSegUtils::GetValueAsString(const case 6: nsTextFormatter::ssprintf(aValue, MOZ_UTF16("%c%g,%g %g,%g %g,%g"), typeAsChar, aSeg[1], aSeg[2], aSeg[3], aSeg[4], aSeg[5], aSeg[6]); break; default: - NS_ABORT_IF_FALSE(false, "Unknown segment type"); + MOZ_ASSERT(false, "Unknown segment type"); aValue = MOZ_UTF16("<unknown-segment-type>"); return; } } // nsTextFormatter::ssprintf is one of the nsTextFormatter methods that // randomly appends '\0' to its output string, which means that the length // of the output string is one too long. We need to manually remove that '\0'
--- a/dom/svg/SVGPathSegUtils.h +++ b/dom/svg/SVGPathSegUtils.h @@ -110,29 +110,29 @@ public: * At some point in the future we will likely want to encode other * information into the float, such as whether the command was explicit or * not. For now all this method does is save on int to float runtime * conversion by requiring uint32_t and float to be of the same size so we * can simply do a bitwise uint32_t<->float copy. */ static float EncodeType(uint32_t aType) { static_assert(sizeof(uint32_t) == sizeof(float), "sizeof uint32_t and float must be the same"); - NS_ABORT_IF_FALSE(IsValidType(aType), "Seg type not recognized"); + MOZ_ASSERT(IsValidType(aType), "Seg type not recognized"); return *(reinterpret_cast<float*>(&aType)); } static uint32_t DecodeType(float aType) { static_assert(sizeof(uint32_t) == sizeof(float), "sizeof uint32_t and float must be the same"); uint32_t type = *(reinterpret_cast<uint32_t*>(&aType)); - NS_ABORT_IF_FALSE(IsValidType(type), "Seg type not recognized"); + MOZ_ASSERT(IsValidType(type), "Seg type not recognized"); return type; } static char16_t GetPathSegTypeAsLetter(uint32_t aType) { - NS_ABORT_IF_FALSE(IsValidType(aType), "Seg type not recognized"); + MOZ_ASSERT(IsValidType(aType), "Seg type not recognized"); static const char16_t table[] = { char16_t('x'), // 0 == PATHSEG_UNKNOWN char16_t('z'), // 1 == PATHSEG_CLOSEPATH char16_t('M'), // 2 == PATHSEG_MOVETO_ABS char16_t('m'), // 3 == PATHSEG_MOVETO_REL char16_t('L'), // 4 == PATHSEG_LINETO_ABS char16_t('l'), // 5 == PATHSEG_LINETO_REL @@ -152,17 +152,17 @@ public: char16_t('t') // 19 == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL }; static_assert(MOZ_ARRAY_LENGTH(table) == NS_SVG_PATH_SEG_TYPE_COUNT, "Unexpected table size"); return table[aType]; } static uint32_t ArgCountForType(uint32_t aType) { - NS_ABORT_IF_FALSE(IsValidType(aType), "Seg type not recognized"); + MOZ_ASSERT(IsValidType(aType), "Seg type not recognized"); static const uint8_t table[] = { 0, // 0 == PATHSEG_UNKNOWN 0, // 1 == PATHSEG_CLOSEPATH 2, // 2 == PATHSEG_MOVETO_ABS 2, // 3 == PATHSEG_MOVETO_REL 2, // 4 == PATHSEG_LINETO_ABS 2, // 5 == PATHSEG_LINETO_REL @@ -214,41 +214,41 @@ public: } static bool IsArcType(uint32_t aType) { return aType == PATHSEG_ARC_ABS || aType == PATHSEG_ARC_REL; } static bool IsRelativeOrAbsoluteType(uint32_t aType) { - NS_ABORT_IF_FALSE(IsValidType(aType), "Seg type not recognized"); + MOZ_ASSERT(IsValidType(aType), "Seg type not recognized"); // When adding a new path segment type, ensure that the returned condition // below is still correct. static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, "Unexpected type"); return aType >= PATHSEG_MOVETO_ABS; } static bool IsRelativeType(uint32_t aType) { - NS_ABORT_IF_FALSE + MOZ_ASSERT (IsRelativeOrAbsoluteType(aType), "IsRelativeType called with segment type that does not come in relative and absolute forms"); // When adding a new path segment type, ensure that the returned condition // below is still correct. static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, "Unexpected type"); return aType & 1; } static uint32_t RelativeVersionOfType(uint32_t aType) { - NS_ABORT_IF_FALSE + MOZ_ASSERT (IsRelativeOrAbsoluteType(aType), "RelativeVersionOfType called with segment type that does not come in relative and absolute forms"); // When adding a new path segment type, ensure that the returned condition // below is still correct. static_assert(NS_SVG_PATH_SEG_LAST_VALID_TYPE == PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL, "Unexpected type");
--- a/dom/svg/SVGPointList.h +++ b/dom/svg/SVGPointList.h @@ -116,24 +116,24 @@ private: bool InsertItem(uint32_t aIndex, const SVGPoint &aPoint) { if (aIndex >= mItems.Length()) { aIndex = mItems.Length(); } return !!mItems.InsertElementAt(aIndex, aPoint); } void ReplaceItem(uint32_t aIndex, const SVGPoint &aPoint) { - NS_ABORT_IF_FALSE(aIndex < mItems.Length(), - "DOM wrapper caller should have raised INDEX_SIZE_ERR"); + MOZ_ASSERT(aIndex < mItems.Length(), + "DOM wrapper caller should have raised INDEX_SIZE_ERR"); mItems[aIndex] = aPoint; } void RemoveItem(uint32_t aIndex) { - NS_ABORT_IF_FALSE(aIndex < mItems.Length(), - "DOM wrapper caller should have raised INDEX_SIZE_ERR"); + MOZ_ASSERT(aIndex < mItems.Length(), + "DOM wrapper caller should have raised INDEX_SIZE_ERR"); mItems.RemoveElementAt(aIndex); } bool AppendItem(SVGPoint aPoint) { return !!mItems.AppendElement(aPoint); } protected: @@ -176,17 +176,17 @@ public: /** * Returns true if this object is an "identity" value, from the perspective * of SMIL. In other words, returns true until the initial value set up in * SVGPointListSMILType::Init() has been changed with a SetInfo() call. */ bool IsIdentity() const { if (!mElement) { - NS_ABORT_IF_FALSE(IsEmpty(), "target element propagation failure"); + MOZ_ASSERT(IsEmpty(), "target element propagation failure"); return true; } return false; } nsresult CopyFrom(const SVGPointListAndInfo& rhs) { mElement = rhs.mElement; return SVGPointList::CopyFrom(rhs);
--- a/dom/svg/SVGPointListSMILType.cpp +++ b/dom/svg/SVGPointListSMILType.cpp @@ -15,17 +15,17 @@ namespace mozilla { /*static*/ SVGPointListSMILType SVGPointListSMILType::sSingleton; //---------------------------------------------------------------------- // nsISMILType implementation void SVGPointListSMILType::Init(nsSMILValue &aValue) const { - NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected value type"); + MOZ_ASSERT(aValue.IsNull(), "Unexpected value type"); SVGPointListAndInfo* pointList = new SVGPointListAndInfo(); aValue.mU.mPtr = pointList; aValue.mType = this; } void @@ -71,34 +71,34 @@ SVGPointListSMILType::Add(nsSMILValue& a NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL type"); NS_PRECONDITION(aValueToAdd.mType == this, "Incompatible SMIL type"); SVGPointListAndInfo& dest = *static_cast<SVGPointListAndInfo*>(aDest.mU.mPtr); const SVGPointListAndInfo& valueToAdd = *static_cast<const SVGPointListAndInfo*>(aValueToAdd.mU.mPtr); - NS_ABORT_IF_FALSE(dest.Element() || valueToAdd.Element(), - "Target element propagation failure"); + MOZ_ASSERT(dest.Element() || valueToAdd.Element(), + "Target element propagation failure"); if (valueToAdd.IsIdentity()) { return NS_OK; } if (dest.IsIdentity()) { if (!dest.SetLength(valueToAdd.Length())) { return NS_ERROR_OUT_OF_MEMORY; } for (uint32_t i = 0; i < dest.Length(); ++i) { dest[i] = aCount * valueToAdd[i]; } dest.SetInfo(valueToAdd.Element()); // propagate target element info! return NS_OK; } - NS_ABORT_IF_FALSE(dest.Element() == valueToAdd.Element(), - "adding values from different elements...?"); + MOZ_ASSERT(dest.Element() == valueToAdd.Element(), + "adding values from different elements...?"); if (dest.Length() != valueToAdd.Length()) { // For now we only support animation between lists with the same number of // items. SVGContentUtils::ReportToConsole return NS_ERROR_FAILURE; } for (uint32_t i = 0; i < dest.Length(); ++i) { dest[i] += aCount * valueToAdd[i]; } @@ -158,34 +158,34 @@ SVGPointListSMILType::Interpolate(const const SVGPointListAndInfo& start = *static_cast<const SVGPointListAndInfo*>(aStartVal.mU.mPtr); const SVGPointListAndInfo& end = *static_cast<const SVGPointListAndInfo*>(aEndVal.mU.mPtr); SVGPointListAndInfo& result = *static_cast<SVGPointListAndInfo*>(aResult.mU.mPtr); - NS_ABORT_IF_FALSE(end.Element(), "Can't propagate target element"); - NS_ABORT_IF_FALSE(start.Element() == end.Element() || !start.Element(), - "Different target elements"); + MOZ_ASSERT(end.Element(), "Can't propagate target element"); + MOZ_ASSERT(start.Element() == end.Element() || !start.Element(), + "Different target elements"); if (start.Element() && // 'start' is not an "identity" value start.Length() != end.Length()) { // For now we only support animation between lists of the same length. // SVGContentUtils::ReportToConsole return NS_ERROR_FAILURE; } if (!result.SetLength(end.Length())) { return NS_ERROR_OUT_OF_MEMORY; } result.SetInfo(end.Element()); // propagate target element info! if (start.Length() != end.Length()) { - NS_ABORT_IF_FALSE(start.Length() == 0, "Not an identity value"); + MOZ_ASSERT(start.Length() == 0, "Not an identity value"); for (uint32_t i = 0; i < end.Length(); ++i) { result[i] = aUnitDistance * end[i]; } return NS_OK; } for (uint32_t i = 0; i < end.Length(); ++i) { result[i] = start[i] + (end[i] - start[i]) * aUnitDistance; }
--- a/dom/svg/SVGSVGElement.cpp +++ b/dom/svg/SVGSVGElement.cpp @@ -680,19 +680,18 @@ SVGSVGElement::UpdateHasChildrenOnlyTran mCurrentScale != 1.0f)); mHasChildrenOnlyTransform = hasChildrenOnlyTransform; } void SVGSVGElement::ChildrenOnlyTransformChanged(uint32_t aFlags) { // Avoid wasteful calls: - NS_ABORT_IF_FALSE(!(GetPrimaryFrame()->GetStateBits() & - NS_FRAME_IS_NONDISPLAY), - "Non-display SVG frames don't maintain overflow rects"); + MOZ_ASSERT(!(GetPrimaryFrame()->GetStateBits() & NS_FRAME_IS_NONDISPLAY), + "Non-display SVG frames don't maintain overflow rects"); nsChangeHint changeHint; bool hadChildrenOnlyTransform = mHasChildrenOnlyTransform; UpdateHasChildrenOnlyTransform(); if (hadChildrenOnlyTransform != mHasChildrenOnlyTransform) { @@ -958,17 +957,17 @@ SVGSVGElement::PrependLocalTransformsTo( if (IsInner()) { float x, y; const_cast<SVGSVGElement*>(this)->GetAnimatedLengthValues(&x, &y, nullptr); if (aWhich == eAllTransforms) { // the common case return ThebesMatrix(GetViewBoxTransform()) * gfxMatrix::Translation(x, y) * fromUserSpace; } - NS_ABORT_IF_FALSE(aWhich == eChildToUserSpace, "Unknown TransformTypes"); + MOZ_ASSERT(aWhich == eChildToUserSpace, "Unknown TransformTypes"); return ThebesMatrix(GetViewBoxTransform()) * gfxMatrix::Translation(x, y) * aMatrix; } if (IsRoot()) { gfxMatrix zoomPanTM; zoomPanTM.Translate(gfxPoint(mCurrentTranslate.GetX(), mCurrentTranslate.GetY())); zoomPanTM.Scale(mCurrentScale, mCurrentScale); return ThebesMatrix(GetViewBoxTransform()) * zoomPanTM * fromUserSpace; @@ -1022,36 +1021,36 @@ SVGSVGElement::HasViewBoxRect() const return true; } return mViewBox.HasRect(); } bool SVGSVGElement::ShouldSynthesizeViewBox() const { - NS_ABORT_IF_FALSE(!HasViewBoxRect(), - "Should only be called if we lack a viewBox"); + MOZ_ASSERT(!HasViewBoxRect(), + "Should only be called if we lack a viewBox"); nsIDocument* doc = GetUncomposedDoc(); return doc && doc->IsBeingUsedAsImage() && !mIsPaintingSVGImageElement && !GetParent(); } bool SVGSVGElement::SetPreserveAspectRatioProperty(const SVGPreserveAspectRatio& aPAR) { SVGPreserveAspectRatio* pAROverridePtr = new SVGPreserveAspectRatio(aPAR); nsresult rv = SetProperty(nsGkAtoms::overridePreserveAspectRatio, pAROverridePtr, nsINode::DeleteProperty<SVGPreserveAspectRatio>, true); - NS_ABORT_IF_FALSE(rv != NS_PROPTABLE_PROP_OVERWRITTEN, - "Setting override value when it's already set...?"); + MOZ_ASSERT(rv != NS_PROPTABLE_PROP_OVERWRITTEN, + "Setting override value when it's already set...?"); if (MOZ_UNLIKELY(NS_FAILED(rv))) { // property-insertion failed (e.g. OOM in property-table code) delete pAROverridePtr; return false; } return true; } @@ -1074,18 +1073,18 @@ SVGSVGElement::ClearPreserveAspectRatioP return valPtr; } void SVGSVGElement:: SetImageOverridePreserveAspectRatio(const SVGPreserveAspectRatio& aPAR) { #ifdef DEBUG - NS_ABORT_IF_FALSE(OwnerDoc()->IsBeingUsedAsImage(), - "should only override preserveAspectRatio in images"); + MOZ_ASSERT(OwnerDoc()->IsBeingUsedAsImage(), + "should only override preserveAspectRatio in images"); #endif bool hasViewBoxRect = HasViewBoxRect(); if (!hasViewBoxRect && ShouldSynthesizeViewBox()) { // My non-<svg:image> clients will have been painting me with a synthesized // viewBox, but my <svg:image> client that's about to paint me now does NOT // want that. Need to tell ourselves to flush our transform. mImageNeedsTransformInvalidation = true; @@ -1104,18 +1103,18 @@ SVGSVGElement:: mImageNeedsTransformInvalidation = true; } } void SVGSVGElement::ClearImageOverridePreserveAspectRatio() { #ifdef DEBUG - NS_ABORT_IF_FALSE(OwnerDoc()->IsBeingUsedAsImage(), - "should only override image preserveAspectRatio in images"); + MOZ_ASSERT(OwnerDoc()->IsBeingUsedAsImage(), + "should only override image preserveAspectRatio in images"); #endif mIsPaintingSVGImageElement = false; if (!HasViewBoxRect() && ShouldSynthesizeViewBox()) { // My non-<svg:image> clients will want to paint me with a synthesized // viewBox, but my <svg:image> client that just painted me did NOT // use that. Need to tell ourselves to flush our transform. mImageNeedsTransformInvalidation = true; @@ -1124,36 +1123,36 @@ SVGSVGElement::ClearImageOverridePreserv if (ClearPreserveAspectRatioProperty()) { mImageNeedsTransformInvalidation = true; } } void SVGSVGElement::FlushImageTransformInvalidation() { - NS_ABORT_IF_FALSE(!GetParent(), "Should only be called on root node"); - NS_ABORT_IF_FALSE(OwnerDoc()->IsBeingUsedAsImage(), - "Should only be called on image documents"); + MOZ_ASSERT(!GetParent(), "Should only be