From ee41df7dc2e04f0abdf1d08b5c71ef2c266bbdb6 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 9 Feb 2015 14:34:50 -0800 Subject: [PATCH] Bug 1127201 (attempt 2, part 1) - Replace most NS_ABORT_IF_FALSE calls with MOZ_ASSERT. r=Waldo. --- chrome/nsChromeRegistryContent.cpp | 4 +- dom/animation/Animation.cpp | 4 +- dom/archivereader/ArchiveRequest.cpp | 2 +- dom/base/Attr.cpp | 6 +- dom/base/Comment.h | 4 +- dom/base/Crypto.cpp | 2 +- dom/base/DocumentFragment.h | 9 +- dom/base/DocumentType.cpp | 4 +- dom/base/Element.cpp | 6 +- dom/base/Element.h | 4 +- dom/base/EventSource.cpp | 6 +- dom/base/Link.cpp | 8 +- dom/base/NodeInfo.cpp | 5 +- dom/base/NodeInfoInlines.h | 74 ++-- dom/base/WebSocket.cpp | 4 +- dom/base/nsAttrValue.cpp | 5 +- dom/base/nsContentUtils.cpp | 2 +- dom/base/nsDOMClassInfo.cpp | 2 +- dom/base/nsDOMDataChannel.cpp | 6 +- dom/base/nsDOMTokenList.cpp | 8 +- dom/base/nsDOMWindowUtils.cpp | 14 +- dom/base/nsDocument.cpp | 30 +- dom/base/nsGenericDOMDataNode.cpp | 26 +- dom/base/nsGlobalWindow.cpp | 18 +- dom/base/nsGlobalWindow.h | 4 +- dom/base/nsHostObjectURI.cpp | 3 +- dom/base/nsINode.cpp | 6 +- dom/base/nsImageLoadingContent.cpp | 18 +- dom/base/nsPerformance.cpp | 8 +- dom/base/nsReferencedElement.cpp | 2 +- dom/base/nsTextNode.h | 4 +- dom/base/nsTreeSanitizer.cpp | 4 +- dom/base/nsXMLHttpRequest.cpp | 8 +- dom/events/ContentEventHandler.cpp | 7 +- dom/html/HTMLImageElement.cpp | 4 +- dom/html/HTMLMediaElement.cpp | 2 +- dom/html/nsGenericHTMLElement.cpp | 8 +- dom/html/nsHTMLDocument.cpp | 6 +- dom/html/nsTextEditorState.cpp | 2 +- dom/ipc/ContentChild.cpp | 4 +- dom/ipc/ContentParent.cpp | 10 +- dom/ipc/TabChild.cpp | 4 +- dom/ipc/TabParent.cpp | 8 +- dom/json/nsJSON.cpp | 2 +- dom/media/AudioStream.cpp | 16 +- dom/media/AudioStream.h | 12 +- dom/media/FileBlockCache.cpp | 5 +- dom/media/MediaCache.cpp | 8 +- dom/media/MediaDecoder.cpp | 2 +- dom/media/MediaRecorder.cpp | 8 +- dom/media/gmp/GMPProcessChild.cpp | 4 +- dom/media/wave/WaveReader.cpp | 38 +- dom/plugins/base/nsNPAPIPlugin.cpp | 5 +- dom/plugins/ipc/PluginInstanceChild.cpp | 12 +- dom/plugins/ipc/PluginInstanceParent.cpp | 18 +- dom/plugins/ipc/PluginModuleChild.cpp | 34 +- dom/plugins/ipc/PluginModuleParent.cpp | 4 +- dom/plugins/ipc/PluginProcessChild.cpp | 4 +- dom/smil/SMILIntegerType.cpp | 2 +- dom/smil/nsSMILAnimationController.cpp | 50 +-- dom/smil/nsSMILAnimationFunction.cpp | 46 +- dom/smil/nsSMILAnimationFunction.h | 8 +- dom/smil/nsSMILCSSProperty.cpp | 14 +- dom/smil/nsSMILCSSValueType.cpp | 67 ++- dom/smil/nsSMILInstanceTime.cpp | 43 +- dom/smil/nsSMILInstanceTime.h | 4 +- dom/smil/nsSMILInterval.cpp | 62 +-- dom/smil/nsSMILInterval.h | 8 +- dom/smil/nsSMILParserUtils.cpp | 13 +- dom/smil/nsSMILTimeContainer.cpp | 14 +- dom/smil/nsSMILTimeValue.h | 4 +- dom/smil/nsSMILTimeValueSpec.cpp | 33 +- dom/smil/nsSMILTimedElement.cpp | 208 ++++----- dom/smil/nsSMILValue.cpp | 9 +- dom/speakermanager/SpeakerManager.cpp | 2 +- dom/storage/DOMStorageIPC.cpp | 8 +- dom/svg/DOMSVGLength.cpp | 11 +- dom/svg/DOMSVGLengthList.cpp | 12 +- dom/svg/DOMSVGLengthList.h | 10 +- dom/svg/DOMSVGNumber.cpp | 11 +- dom/svg/DOMSVGNumberList.cpp | 12 +- dom/svg/DOMSVGNumberList.h | 10 +- dom/svg/DOMSVGPathSeg.cpp | 11 +- dom/svg/DOMSVGPathSeg.h | 8 +- dom/svg/DOMSVGPathSegList.cpp | 24 +- dom/svg/DOMSVGPathSegList.h | 6 +- dom/svg/DOMSVGPoint.h | 5 +- dom/svg/DOMSVGPointList.cpp | 14 +- dom/svg/DOMSVGPointList.h | 6 +- dom/svg/DOMSVGTransformList.cpp | 12 +- dom/svg/DOMSVGTransformList.h | 9 +- dom/svg/SVGAnimationElement.cpp | 15 +- dom/svg/SVGContentUtils.cpp | 16 +- dom/svg/SVGFEImageElement.cpp | 2 +- dom/svg/SVGForeignObjectElement.cpp | 2 +- dom/svg/SVGFragmentIdentifier.cpp | 4 +- dom/svg/SVGIFrameElement.cpp | 2 +- dom/svg/SVGIntegerPairSMILType.cpp | 2 +- dom/svg/SVGLength.cpp | 4 +- dom/svg/SVGLengthList.h | 12 +- dom/svg/SVGLengthListSMILType.cpp | 10 +- dom/svg/SVGMPathElement.cpp | 11 +- dom/svg/SVGMarkerElement.cpp | 4 +- dom/svg/SVGMotionSMILAnimationFunction.cpp | 20 +- dom/svg/SVGMotionSMILPathUtils.cpp | 8 +- dom/svg/SVGMotionSMILPathUtils.h | 4 +- dom/svg/SVGMotionSMILType.cpp | 124 +++--- dom/svg/SVGNumberList.h | 8 +- dom/svg/SVGNumberListSMILType.cpp | 26 +- dom/svg/SVGNumberPairSMILType.cpp | 2 +- dom/svg/SVGOrientSMILType.cpp | 2 +- dom/svg/SVGPathData.cpp | 22 +- dom/svg/SVGPathData.h | 2 +- dom/svg/SVGPathElement.cpp | 4 +- dom/svg/SVGPathSegListSMILType.cpp | 70 +-- dom/svg/SVGPathSegUtils.cpp | 2 +- dom/svg/SVGPathSegUtils.h | 14 +- dom/svg/SVGPointList.h | 10 +- dom/svg/SVGPointListSMILType.cpp | 18 +- dom/svg/SVGSVGElement.cpp | 41 +- dom/svg/SVGStringList.h | 8 +- dom/svg/SVGTransform.cpp | 17 +- dom/svg/SVGTransformList.h | 8 +- dom/svg/SVGTransformableElement.cpp | 8 +- dom/svg/SVGUseElement.cpp | 2 +- dom/svg/SVGViewBoxSMILType.cpp | 2 +- dom/svg/nsISVGPoint.cpp | 6 +- dom/svg/nsSVGAnimatedTransformList.cpp | 11 +- dom/svg/nsSVGAttrTearoffTable.h | 8 +- dom/svg/nsSVGElement.cpp | 91 ++-- dom/svg/nsSVGEnum.cpp | 4 +- dom/svg/nsSVGTransform.cpp | 7 +- dom/svg/nsSVGTransform.h | 10 +- dom/xml/CDATASection.h | 4 +- dom/xml/ProcessingInstruction.cpp | 5 +- dom/xslt/xpath/txXPCOMExtensionFunction.cpp | 8 +- dom/xslt/xslt/txMozillaXMLOutput.cpp | 2 +- dom/xul/XULDocument.cpp | 2 +- editor/libeditor/nsPlaintextEditor.cpp | 2 +- .../printingui/win/nsPrintDialogUtil.cpp | 4 +- gfx/gl/GLContextProviderGLX.cpp | 8 +- gfx/layers/Layers.cpp | 4 +- gfx/layers/TiledLayerBuffer.h | 14 +- gfx/layers/basic/BasicLayerManager.cpp | 6 +- gfx/layers/basic/BasicLayersImpl.cpp | 4 +- gfx/layers/client/ClientLayerManager.cpp | 8 +- gfx/layers/client/ClientLayerManager.h | 5 +- gfx/layers/client/ContentClient.cpp | 6 +- .../composite/AsyncCompositionManager.cpp | 6 +- gfx/layers/ipc/CompositorParent.cpp | 6 +- gfx/layers/ipc/ImageBridgeChild.cpp | 12 +- gfx/layers/ipc/ImageBridgeParent.cpp | 2 +- gfx/layers/ipc/LayerTransactionChild.cpp | 4 +- gfx/layers/ipc/ShadowLayerChild.cpp | 5 +- gfx/layers/ipc/ShadowLayers.cpp | 31 +- gfx/layers/ipc/SharedBufferManagerChild.cpp | 10 +- gfx/layers/ipc/SharedPlanarYCbCrImage.cpp | 12 +- gfx/layers/opengl/CompositorOGL.cpp | 2 +- gfx/src/nsColor.cpp | 4 +- gfx/src/nsCoord.h | 4 +- gfx/src/nsFontMetrics.cpp | 7 +- gfx/thebes/gfx3DMatrix.h | 4 +- gfx/thebes/gfxAlphaRecoverySSE2.cpp | 4 +- gfx/thebes/gfxFT2FontList.cpp | 5 +- gfx/thebes/gfxFontEntry.cpp | 8 +- .../gfxReusableSharedImageSurfaceWrapper.cpp | 6 +- image/decoders/nsBMPDecoder.cpp | 9 +- image/decoders/nsGIFDecoder2.cpp | 4 +- image/decoders/nsICODecoder.cpp | 6 +- image/decoders/nsIconDecoder.cpp | 2 +- image/decoders/nsJPEGDecoder.cpp | 11 +- image/decoders/nsPNGDecoder.cpp | 4 +- image/src/Decoder.cpp | 20 +- image/src/Image.cpp | 2 +- image/src/ProgressTracker.cpp | 6 +- image/src/RasterImage.cpp | 10 +- image/src/SVGDocumentWrapper.cpp | 12 +- image/src/imgFrame.cpp | 2 +- image/src/imgLoader.cpp | 18 +- image/src/imgLoader.h | 4 +- image/src/imgRequest.cpp | 28 +- image/src/imgRequestProxy.cpp | 8 +- image/src/imgTools.cpp | 4 +- intl/uconv/util/nsUCSupport.cpp | 4 +- ipc/glue/MessageChannel.h | 8 +- ipc/glue/MessageLink.h | 4 +- ipc/glue/ProcessChild.cpp | 4 +- ipc/glue/SharedMemory.cpp | 8 +- ipc/glue/SharedMemoryBasic_android.cpp | 6 +- ipc/glue/SharedMemorySysV.h | 6 +- ipc/glue/Shmem.cpp | 32 +- ipc/ipdl/ipdl/lower.py | 2 +- layout/base/FrameLayerBuilder.cpp | 5 +- layout/base/RestyleManager.cpp | 21 +- layout/base/nsCSSFrameConstructor.cpp | 42 +- layout/base/nsCSSRendering.cpp | 20 +- layout/base/nsCSSRendering.h | 2 +- layout/base/nsChangeHint.h | 6 +- layout/base/nsDisplayList.cpp | 14 +- layout/base/nsDocumentViewer.cpp | 9 +- layout/base/nsLayoutUtils.cpp | 14 +- layout/base/nsPresArena.cpp | 23 +- layout/base/nsPresShell.cpp | 5 +- layout/base/nsRefreshDriver.cpp | 12 +- layout/generic/nsBlockFrame.cpp | 24 +- layout/generic/nsBlockReflowState.cpp | 25 +- layout/generic/nsFloatManager.cpp | 2 +- layout/generic/nsFontInflationData.cpp | 16 +- layout/generic/nsFrame.cpp | 4 +- layout/generic/nsIFrame.h | 4 +- layout/generic/nsImageFrame.cpp | 2 +- layout/generic/nsImageFrame.h | 6 +- layout/generic/nsImageMap.cpp | 4 +- layout/generic/nsLineBox.cpp | 8 +- layout/generic/nsLineBox.h | 52 +-- layout/generic/nsLineLayout.h | 5 +- layout/generic/nsPluginFrame.cpp | 2 +- layout/generic/nsTextFrame.cpp | 2 +- layout/ipc/RenderFrameParent.cpp | 22 +- layout/style/AnimationCommon.cpp | 22 +- layout/style/AnimationCommon.h | 4 +- layout/style/CSSCalc.h | 46 +- layout/style/CSSStyleSheet.cpp | 8 +- layout/style/CounterStyleManager.cpp | 48 +- layout/style/Declaration.cpp | 94 ++-- layout/style/Declaration.h | 26 +- layout/style/ErrorReporter.cpp | 4 +- layout/style/FontFaceSet.cpp | 4 +- layout/style/Loader.cpp | 8 +- layout/style/MediaQueryList.cpp | 8 +- layout/style/StyleAnimationValue.cpp | 360 ++++++++------- layout/style/StyleRule.cpp | 10 +- layout/style/nsAnimationManager.cpp | 14 +- layout/style/nsCSSDataBlock.cpp | 75 ++-- layout/style/nsCSSDataBlock.h | 24 +- layout/style/nsCSSParser.cpp | 132 +++--- layout/style/nsCSSProps.cpp | 84 ++-- layout/style/nsCSSProps.h | 48 +- layout/style/nsCSSPseudoClasses.cpp | 4 +- layout/style/nsCSSRuleProcessor.cpp | 20 +- layout/style/nsCSSRules.cpp | 20 +- layout/style/nsCSSRules.h | 4 +- layout/style/nsCSSValue.cpp | 291 ++++++------ layout/style/nsCSSValue.h | 78 ++-- layout/style/nsComputedDOMStyle.cpp | 114 +++-- layout/style/nsMediaFeatures.cpp | 4 +- layout/style/nsRuleData.cpp | 5 +- layout/style/nsRuleData.h | 25 +- layout/style/nsRuleNode.cpp | 415 +++++++++--------- layout/style/nsRuleNode.h | 12 +- layout/style/nsStyleContext.cpp | 10 +- layout/style/nsStyleContext.h | 10 +- layout/style/nsStyleCoord.cpp | 4 +- layout/style/nsStyleSet.cpp | 52 +-- layout/style/nsStyleStruct.cpp | 114 ++--- layout/style/nsStyleStruct.h | 30 +- layout/style/nsStyleUtil.cpp | 6 +- layout/style/nsTransitionManager.cpp | 42 +- layout/svg/SVGTextFrame.cpp | 10 +- layout/svg/nsSVGAFrame.cpp | 4 +- layout/svg/nsSVGContainerFrame.cpp | 30 +- layout/svg/nsSVGEffects.cpp | 6 +- layout/svg/nsSVGFilterFrame.cpp | 2 +- layout/svg/nsSVGFilterInstance.cpp | 4 +- layout/svg/nsSVGForeignObjectFrame.cpp | 12 +- layout/svg/nsSVGGFrame.cpp | 4 +- layout/svg/nsSVGGradientFrame.cpp | 6 +- layout/svg/nsSVGImageFrame.cpp | 4 +- layout/svg/nsSVGInnerSVGFrame.cpp | 4 +- layout/svg/nsSVGMarkerFrame.cpp | 4 +- layout/svg/nsSVGMarkerFrame.h | 8 +- layout/svg/nsSVGOuterSVGFrame.cpp | 35 +- layout/svg/nsSVGOuterSVGFrame.h | 8 +- layout/svg/nsSVGPathGeometryFrame.cpp | 10 +- layout/svg/nsSVGPatternFrame.cpp | 2 +- layout/svg/nsSVGSwitchFrame.cpp | 8 +- layout/svg/nsSVGUtils.cpp | 30 +- layout/tables/nsCellMap.cpp | 6 +- media/mtransport/transportlayer.h | 2 +- .../src/peerconnection/PeerConnectionImpl.h | 2 +- modules/libjar/nsJARInputStream.cpp | 8 +- netwerk/base/ProxyAutoConfig.cpp | 4 +- netwerk/base/nsPACMan.cpp | 34 +- netwerk/base/nsSimpleURI.cpp | 4 +- netwerk/base/nsSocketTransport2.cpp | 8 +- netwerk/base/nsSocketTransportService2.cpp | 14 +- netwerk/base/nsStandardURL.cpp | 4 +- netwerk/base/nsUnicharStreamLoader.cpp | 6 +- netwerk/cache/nsCacheMetaData.cpp | 8 +- netwerk/ipc/ChannelEventQueue.h | 4 +- netwerk/ipc/NeckoChild.cpp | 12 +- netwerk/protocol/ftp/FTPChannelChild.cpp | 4 +- netwerk/protocol/rtsp/RtspChannelChild.cpp | 6 +- .../rtsp/controller/RtspControllerChild.cpp | 6 +- .../protocol/websocket/WebSocketChannel.cpp | 130 +++--- .../websocket/WebSocketChannelChild.cpp | 12 +- .../protocol/wyciwyg/WyciwygChannelChild.cpp | 4 +- netwerk/socket/nsSOCKSIOLayer.cpp | 90 ++-- parser/html/nsHtml5Module.cpp | 4 +- parser/htmlparser/nsParser.cpp | 5 +- security/manager/ssl/src/CryptoTask.cpp | 4 +- storage/public/mozIStorageStatement.idl | 28 +- storage/public/mozIStorageValueArray.idl | 28 +- toolkit/components/places/Helpers.cpp | 2 +- toolkit/components/places/History.cpp | 6 +- toolkit/components/places/nsNavBookmarks.cpp | 2 +- toolkit/components/telemetry/Telemetry.cpp | 2 +- toolkit/crashreporter/nsExceptionHandler.cpp | 10 +- toolkit/system/gnome/nsAlertsIconListener.cpp | 2 +- toolkit/xre/EventTracer.cpp | 2 +- toolkit/xre/ProfileReset.cpp | 2 +- toolkit/xre/nsAppRunner.cpp | 2 +- toolkit/xre/nsEmbedFunctions.cpp | 10 +- toolkit/xre/nsUpdateDriver.cpp | 10 +- view/nsView.cpp | 27 +- widget/InputData.cpp | 20 +- widget/InputData.h | 4 +- widget/PuppetWidget.cpp | 20 +- widget/android/AndroidBridge.cpp | 4 +- widget/android/nsDeviceContextAndroid.cpp | 2 +- widget/cocoa/WidgetTraceEvent.mm | 2 +- widget/gtk/WidgetTraceEvent.cpp | 4 +- widget/gtk/nsLookAndFeel.cpp | 2 +- widget/gtk/nsWindow.cpp | 49 ++- widget/nsBaseScreen.cpp | 18 +- widget/nsBaseWidget.cpp | 2 +- widget/qt/nsDeviceContextSpecQt.cpp | 2 +- widget/windows/AudioSession.cpp | 40 +- widget/windows/WidgetTraceEvent.cpp | 2 +- widget/windows/WinMouseScrollHandler.cpp | 6 +- xpcom/base/nsCycleCollector.cpp | 2 +- xpcom/build/Omnijar.cpp | 4 +- xpcom/build/Omnijar.h | 6 +- xpcom/ds/TimeStamp_darwin.cpp | 8 +- xpcom/glue/BlockingResourceBase.cpp | 2 +- xpcom/glue/nsCOMPtr.h | 18 +- xpcom/glue/nsStringAPI.h | 8 +- xpcom/glue/nsTArray-inl.h | 19 +- xpcom/glue/nsTArray.h | 4 +- xpcom/glue/nsTPriorityQueue.h | 4 +- xpcom/io/Base64.cpp | 6 +- xpcom/io/nsInputStreamTee.cpp | 2 +- xpcom/io/nsLocalFileWin.cpp | 2 +- xpcom/string/nsAlgorithm.h | 4 +- xpcom/string/nsTDependentString.cpp | 2 +- xpcom/string/nsTSubstring.cpp | 2 +- xpcom/threads/TimerThread.h | 2 +- 347 files changed, 2974 insertions(+), 3007 deletions(-) diff --git a/chrome/nsChromeRegistryContent.cpp b/chrome/nsChromeRegistryContent.cpp index 978b5f8aabf..eec49b22373 100644 --- a/chrome/nsChromeRegistryContent.cpp +++ b/chrome/nsChromeRegistryContent.cpp @@ -22,8 +22,8 @@ nsChromeRegistryContent::RegisterRemoteChrome( 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(); diff --git a/dom/animation/Animation.cpp b/dom/animation/Animation.cpp index 55a6af26e52..9b298ba10d4 100644 --- a/dom/animation/Animation.cpp +++ b/dom/animation/Animation.cpp @@ -27,7 +27,7 @@ ComputedTimingFunction::Init(const nsTimingFunction &aFunction) 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); } @@ -47,7 +47,7 @@ ComputedTimingFunction::GetValue(double aPortion) const // 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); diff --git a/dom/archivereader/ArchiveRequest.cpp b/dom/archivereader/ArchiveRequest.cpp index 617d1e61000..9a8453dd81f 100644 --- a/dom/archivereader/ArchiveRequest.cpp +++ b/dom/archivereader/ArchiveRequest.cpp @@ -42,7 +42,7 @@ private: //data 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; } diff --git a/dom/base/Attr.cpp b/dom/base/Attr.cpp index 06226b66f2b..50a19932684 100644 --- a/dom/base/Attr.cpp +++ b/dom/base/Attr.cpp @@ -48,9 +48,9 @@ Attr::Attr(nsDOMAttributeMap *aAttrMap, 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. diff --git a/dom/base/Comment.h b/dom/base/Comment.h index 538610f1a76..5bef6d711cf 100644 --- a/dom/base/Comment.h +++ b/dom/base/Comment.h @@ -19,8 +19,8 @@ class Comment MOZ_FINAL : public nsGenericDOMDataNode, 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(); diff --git a/dom/base/Crypto.cpp b/dom/base/Crypto.cpp index 7d0812cf6ea..83b769cde76 100644 --- a/dom/base/Crypto.cpp +++ b/dom/base/Crypto.cpp @@ -56,7 +56,7 @@ Crypto::GetRandomValues(JSContext* aCx, const ArrayBufferView& aArray, JS::MutableHandle 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 view(aCx, aArray.Obj()); diff --git a/dom/base/DocumentFragment.h b/dom/base/DocumentFragment.h index 550c37913a4..92ff12af099 100644 --- a/dom/base/DocumentFragment.h +++ b/dom/base/DocumentFragment.h @@ -27,11 +27,10 @@ class DocumentFragment : public FragmentOrElement, 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: diff --git a/dom/base/DocumentType.cpp b/dom/base/DocumentType.cpp index 24f117cad54..50ef9e9004f 100644 --- a/dom/base/DocumentType.cpp +++ b/dom/base/DocumentType.cpp @@ -74,8 +74,8 @@ DocumentType::DocumentType(already_AddRefed& aNodeInfo, 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() diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index dccd60d31bc..0acc25de202 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -204,9 +204,9 @@ Element::NotifyStateChange(EventStates 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; diff --git a/dom/base/Element.h b/dom/base/Element.h index b168e1c0174..e35a2486c89 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -152,8 +152,8 @@ public: 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 diff --git a/dom/base/EventSource.cpp b/dom/base/EventSource.cpp index 04647b070e5..ae596e25f84 100644 --- a/dom/base/EventSource.cpp +++ b/dom/base/EventSource.cpp @@ -580,9 +580,9 @@ EventSource::AsyncOnChannelRedirect(nsIChannel *aOldChannel, 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); diff --git a/dom/base/Link.cpp b/dom/base/Link.cpp index e4d625ba77c..22d4574ac5a 100644 --- a/dom/base/Link.cpp +++ b/dom/base/Link.cpp @@ -29,7 +29,7 @@ Link::Link(Element *aElement) , mNeedsRegistration(false) , mRegistered(false) { - NS_ABORT_IF_FALSE(mElement, "Must have an element"); + MOZ_ASSERT(mElement, "Must have an element"); } Link::~Link() @@ -58,9 +58,9 @@ Link::SetLinkState(nsLinkState 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); diff --git a/dom/base/NodeInfo.cpp b/dom/base/NodeInfo.cpp index a87b8f65067..64fdaeb04eb 100644 --- a/dom/base/NodeInfo.cpp +++ b/dom/base/NodeInfo.cpp @@ -48,7 +48,7 @@ NodeInfo::NodeInfo(nsIAtom *aName, nsIAtom *aPrefix, int32_t aNamespaceID, 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); @@ -104,8 +104,7 @@ NodeInfo::NodeInfo(nsIAtom *aName, nsIAtom *aPrefix, int32_t aNamespaceID, SetDOMStringToNull(mLocalName); break; default: - NS_ABORT_IF_FALSE(aNodeType == UINT16_MAX, - "Unknown node type"); + MOZ_ASSERT(aNodeType == UINT16_MAX, "Unknown node type"); } } diff --git a/dom/base/NodeInfoInlines.h b/dom/base/NodeInfoInlines.h index b4f5f7f4870..970b6e53d39 100644 --- a/dom/base/NodeInfoInlines.h +++ b/dom/base/NodeInfoInlines.h @@ -75,42 +75,42 @@ 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___ */ diff --git a/dom/base/WebSocket.cpp b/dom/base/WebSocket.cpp index dea1b9825bc..b1e0716cdef 100644 --- a/dom/base/WebSocket.cpp +++ b/dom/base/WebSocket.cpp @@ -1482,7 +1482,7 @@ WebSocketImpl::Init(JSContext* aCx, 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); @@ -1527,7 +1527,7 @@ nsresult WebSocketImpl::InitializeConnection() { AssertIsOnMainThread(); - NS_ABORT_IF_FALSE(!mChannel, "mChannel should be null"); + MOZ_ASSERT(!mChannel, "mChannel should be null"); nsCOMPtr wsChannel; nsAutoCloseWS autoClose(this); diff --git a/dom/base/nsAttrValue.cpp b/dom/base/nsAttrValue.cpp index 0e1cbeeb04a..b1def985fea 100644 --- a/dom/base/nsAttrValue.cpp +++ b/dom/base/nsAttrValue.cpp @@ -1032,8 +1032,7 @@ nsAttrValue::Equals(const nsAttrValue& aOther) const // 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"); @@ -1754,7 +1753,7 @@ nsAttrValue::ResetMiscAtomOrString() 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 diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 08d1b60c5da..f356ac6711e 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -4277,7 +4277,7 @@ nsContentUtils::ParseFragmentXML(const nsAString& aSourceBuffer, // sXMLFragmentSink now owns the sink } nsCOMPtr 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); diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 06c2ada3c13..bba83eec532 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -1765,7 +1765,7 @@ GetXPCProto(nsIXPConnect *aXPConnect, JSContext *cx, nsGlobalWindow *aWin, nsCOMPtr 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; diff --git a/dom/base/nsDOMDataChannel.cpp b/dom/base/nsDOMDataChannel.cpp index 661217d335c..622665c7d62 100644 --- a/dom/base/nsDOMDataChannel.cpp +++ b/dom/base/nsDOMDataChannel.cpp @@ -269,7 +269,7 @@ nsDOMDataChannel::Send(const nsAString& aData, ErrorResult& 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 msgStream; nsresult rv = aData.GetInternalStream(getter_AddRefs(msgStream)); @@ -296,7 +296,7 @@ nsDOMDataChannel::Send(File& aData, ErrorResult& 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(); @@ -312,7 +312,7 @@ nsDOMDataChannel::Send(const ArrayBuffer& aData, ErrorResult& 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(); diff --git a/dom/base/nsDOMTokenList.cpp b/dom/base/nsDOMTokenList.cpp index 856718566f5..ea7ed14e7b6 100644 --- a/dom/base/nsDOMTokenList.cpp +++ b/dom/base/nsDOMTokenList.cpp @@ -182,7 +182,7 @@ void nsDOMTokenList::RemoveInternal(const nsAttrValue* aAttr, const nsTArray& aTokens) { - NS_ABORT_IF_FALSE(aAttr, "Need an attribute"); + MOZ_ASSERT(aAttr, "Need an attribute"); nsAutoString input; aAttr->ToString(input); @@ -204,7 +204,7 @@ nsDOMTokenList::RemoveInternal(const nsAttrValue* aAttr, 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; @@ -227,8 +227,8 @@ nsDOMTokenList::RemoveInternal(const nsAttrValue* aAttr, } 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; diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 07f45b1f2ec..b512a009ed5 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -1716,9 +1716,9 @@ CanvasToDataSourceSurface(nsIDOMHTMLCanvasElement* aCanvas) 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(); @@ -2309,7 +2309,7 @@ nsDOMWindowUtils::GetClassName(JS::Handle aObject, JSContext* aCx, } *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; } @@ -2698,9 +2698,9 @@ nsDOMWindowUtils::ComputeAnimationDistance(nsIDOMElement* aElement, 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 || diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 15413a245a2..608ddff6d5c 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -1056,8 +1056,8 @@ 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) @@ -1083,8 +1083,8 @@ TransferZoomLevels(nsIDocument* aFromDoc, 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); @@ -1624,8 +1624,8 @@ ClearAllBoxObjects(nsIContent* aKey, nsPIBoxObject* aBoxObject, void* aUserArg) 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(); @@ -2211,8 +2211,8 @@ nsDocument::Init() // 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!"); @@ -4672,11 +4672,11 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject) "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 @@ -10406,8 +10406,8 @@ nsDocument::RemoveImage(imgIRequest* aImage, uint32_t aFlags) // Get the old count. It should exist and be > 0. uint32_t count = 0; DebugOnly 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--; diff --git a/dom/base/nsGenericDOMDataNode.cpp b/dom/base/nsGenericDOMDataNode.cpp index d4057ecbc5a..8dfe9bd6101 100644 --- a/dom/base/nsGenericDOMDataNode.cpp +++ b/dom/base/nsGenericDOMDataNode.cpp @@ -42,25 +42,23 @@ using namespace mozilla::dom; nsGenericDOMDataNode::nsGenericDOMDataNode(already_AddRefed& 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&& 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() diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 4cb01457a91..abd222b7cd7 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -1524,7 +1524,7 @@ nsGlobalWindow::CleanUp() } 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(this); if (asChrome->mMessageManager) { static_cast( @@ -8113,10 +8113,10 @@ PopulateMessagePortList(MessagePortBase* aKey, MessagePortBase* aValue, void* aC 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(); @@ -8131,8 +8131,8 @@ PostMessageEvent::Run() 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 @@ -8229,8 +8229,8 @@ nsGlobalWindow::PostMessageMoz(JSContext* aCx, JS::Handle aMessage, nsRefPtr 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 diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index be3ab37ffac..f415eaa96af 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -1718,8 +1718,8 @@ protected: ~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(); diff --git a/dom/base/nsHostObjectURI.cpp b/dom/base/nsHostObjectURI.cpp index c5fb2bbeb7d..94b02ff6085 100644 --- a/dom/base/nsHostObjectURI.cpp +++ b/dom/base/nsHostObjectURI.cpp @@ -94,8 +94,7 @@ nsHostObjectURI::CloneInternal(nsSimpleURI::RefHandlingEnum aRefHandlingMode, #ifdef DEBUG nsRefPtr 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(simpleClone.get()); diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp index e5d01d15850..3069cc2689d 100644 --- a/dom/base/nsINode.cpp +++ b/dom/base/nsINode.cpp @@ -1062,7 +1062,7 @@ nsINode::IsEqualNode(nsINode* aOther) break; } default: - NS_ABORT_IF_FALSE(false, "Unknown node type"); + MOZ_ASSERT(false, "Unknown node type"); } nsINode* nextNode = node1->GetFirstChild(); @@ -1357,7 +1357,7 @@ nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb) // 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; } } @@ -2584,7 +2584,7 @@ FindMatchingElements(nsINode* aRoot, nsCSSSelectorList* aSelectorList, T &aList, 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!"); } diff --git a/dom/base/nsImageLoadingContent.cpp b/dom/base/nsImageLoadingContent.cpp index 1a41c536c77..c1157d3d4d4 100644 --- a/dom/base/nsImageLoadingContent.cpp +++ b/dom/base/nsImageLoadingContent.cpp @@ -136,7 +136,7 @@ nsImageLoadingContent::Notify(imgIRequest* aRequest, 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"); @@ -227,8 +227,8 @@ nsImageLoadingContent::OnLoadComplete(imgIRequest* aRequest, nsresult aStatus) 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 @@ -890,9 +890,9 @@ nsImageLoadingContent::LoadImage(nsIURI* aNewURI, // time. It should always be the same as the principal of this node. #ifdef DEBUG nsCOMPtr thisContent = do_QueryInterface(static_cast(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? @@ -1219,7 +1219,7 @@ 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 @@ -1347,8 +1347,8 @@ nsImageLoadingContent::ClearCurrentRequest(nsresult aReason, 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. diff --git a/dom/base/nsPerformance.cpp b/dom/base/nsPerformance.cpp index 1ecdc487323..012014d4396 100644 --- a/dom/base/nsPerformance.cpp +++ b/dom/base/nsPerformance.cpp @@ -605,8 +605,8 @@ 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(); } @@ -615,8 +615,8 @@ 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(); } diff --git a/dom/base/nsReferencedElement.cpp b/dom/base/nsReferencedElement.cpp index 17532bd6af5..68b510da974 100644 --- a/dom/base/nsReferencedElement.cpp +++ b/dom/base/nsReferencedElement.cpp @@ -18,7 +18,7 @@ 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(); diff --git a/dom/base/nsTextNode.h b/dom/base/nsTextNode.h index 0e644d271a7..2bad2cad6f3 100644 --- a/dom/base/nsTextNode.h +++ b/dom/base/nsTextNode.h @@ -26,8 +26,8 @@ class nsTextNode : public mozilla::dom::Text, 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: diff --git a/dom/base/nsTreeSanitizer.cpp b/dom/base/nsTreeSanitizer.cpp index 88f038da099..c2e977f5687 100644 --- a/dom/base/nsTreeSanitizer.cpp +++ b/dom/base/nsTreeSanitizer.cpp @@ -1103,8 +1103,8 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal, 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(); diff --git a/dom/base/nsXMLHttpRequest.cpp b/dom/base/nsXMLHttpRequest.cpp index 8f0aa506b2e..8682b761dfc 100644 --- a/dom/base/nsXMLHttpRequest.cpp +++ b/dom/base/nsXMLHttpRequest.cpp @@ -321,7 +321,7 @@ nsXMLHttpRequest::~nsXMLHttpRequest() 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(); @@ -1915,7 +1915,7 @@ nsXMLHttpRequest::OnDataAvailable(nsIRequest *request, { 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; @@ -3236,8 +3236,8 @@ nsXMLHttpRequest::SetTimeout(uint32_t aTimeout, ErrorResult& aRv) 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; diff --git a/dom/events/ContentEventHandler.cpp b/dom/events/ContentEventHandler.cpp index f6f6f6734fa..cc2c1061b59 100644 --- a/dom/events/ContentEventHandler.cpp +++ b/dom/events/ContentEventHandler.cpp @@ -251,9 +251,8 @@ static uint32_t CountNewlinesInXPLength(nsIContent* aContent, 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) { @@ -283,7 +282,7 @@ static uint32_t CountNewlinesInNativeLength(nsIContent* aContent, 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; diff --git a/dom/html/HTMLImageElement.cpp b/dom/html/HTMLImageElement.cpp index 94a25ba08ba..d930a869f83 100644 --- a/dom/html/HTMLImageElement.cpp +++ b/dom/html/HTMLImageElement.cpp @@ -401,8 +401,8 @@ HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, (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())); } diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 7632b0cb42a..0772bac042d 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -275,7 +275,7 @@ public: : 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: diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index dbc685dc583..1fab50ab830 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -712,8 +712,8 @@ nsGenericHTMLElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName, { 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); } @@ -2152,8 +2152,8 @@ nsGenericHTMLFormElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, 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())); } diff --git a/dom/html/nsHTMLDocument.cpp b/dom/html/nsHTMLDocument.cpp index e981df36ae7..0c14fbfd9f1 100644 --- a/dom/html/nsHTMLDocument.cpp +++ b/dom/html/nsHTMLDocument.cpp @@ -1899,8 +1899,8 @@ nsHTMLDocument::WriteCommon(JSContext *cx, 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"); @@ -2773,7 +2773,7 @@ nsHTMLDocument::EditingStateChanged() // We might already have an editor if it was set up for mail, let's see // if this is actually the case. nsCOMPtr 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) { diff --git a/dom/html/nsTextEditorState.cpp b/dom/html/nsTextEditorState.cpp index 68ff1a25d04..c2eb2d060cc 100644 --- a/dom/html/nsTextEditorState.cpp +++ b/dom/html/nsTextEditorState.cpp @@ -2107,7 +2107,7 @@ nsTextEditorState::UpdatePlaceholderVisibility(bool aNotify) 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 content = do_QueryInterface(mTextCtrlElement); if (!nsContentUtils::IsFocusedContent(content)) { mSelCon->SetDisplaySelection(nsISelectionController::SELECTION_HIDDEN); diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index d9724291b9f..456b3526811 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -1964,8 +1964,8 @@ ContentChild::RecvAddPermission(const IPC::Permission& permission) services::GetPermissionManager(); nsPermissionManager* permissionManager = static_cast(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 uri; NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("http://") + nsCString(permission.host)); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 36ded080a26..52e6a69f959 100755 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -2425,12 +2425,12 @@ ContentParent::RecvReadPermissions(InfallibleTArray* aPermissio services::GetPermissionManager(); nsPermissionManager* permissionManager = static_cast(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 enumerator; DebugOnly 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); @@ -4425,8 +4425,8 @@ 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()); diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 186272362de..b74ce4bffeb 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -3179,8 +3179,8 @@ TabChild::InitRenderingState(const ScrollingBehavior& aScrolling, 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); diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 8fe360e9c5f..2e921606f38 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -2182,8 +2182,8 @@ 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; } @@ -2193,8 +2193,8 @@ 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; } diff --git a/dom/json/nsJSON.cpp b/dom/json/nsJSON.cpp index ae399933307..790da1298c8 100644 --- a/dom/json/nsJSON.cpp +++ b/dom/json/nsJSON.cpp @@ -645,7 +645,7 @@ nsJSONListener::ConsumeConverted(const char* aBuffer, uint32_t aByteLength) 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; diff --git a/dom/media/AudioStream.cpp b/dom/media/AudioStream.cpp index 04492fd0783..03e28babaab 100644 --- a/dom/media/AudioStream.cpp +++ b/dom/media/AudioStream.cpp @@ -371,7 +371,7 @@ AudioStream::Init(int32_t aNumChannels, int32_t aRate, // 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) { @@ -632,8 +632,8 @@ AudioStream::Write(const AudioDataValue* aBuf, uint32_t aFrames, TimeStamp *aTim 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; @@ -678,14 +678,14 @@ 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."); @@ -1035,7 +1035,7 @@ AudioStream::Reset() // 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); @@ -1054,7 +1054,7 @@ 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(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(aBuffer); uint32_t underrunFrames = 0; uint32_t servicedFrames = 0; @@ -1113,7 +1113,7 @@ AudioStream::DataCallback(void* aBuffer, long aFrames) 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(); diff --git a/dom/media/AudioStream.h b/dom/media/AudioStream.h index aae8a3cb94c..f2990a1cd5d 100644 --- a/dom/media/AudioStream.h +++ b/dom/media/AudioStream.h @@ -88,7 +88,7 @@ public: // 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]; } @@ -108,8 +108,8 @@ public: // 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; @@ -124,8 +124,8 @@ public: // 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); @@ -139,7 +139,7 @@ public: // 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; } diff --git a/dom/media/FileBlockCache.cpp b/dom/media/FileBlockCache.cpp index df88e956d07..6461b6fc5be 100644 --- a/dom/media/FileBlockCache.cpp +++ b/dom/media/FileBlockCache.cpp @@ -212,8 +212,9 @@ nsresult FileBlockCache::Run() // mDataMonitor to take mFileMonitor. int32_t blockIndex = mChangeIndexList.PopFront(); nsRefPtr 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); diff --git a/dom/media/MediaCache.cpp b/dom/media/MediaCache.cpp index aa29dd9ce81..4b757bd9ba0 100644 --- a/dom/media/MediaCache.cpp +++ b/dom/media/MediaCache.cpp @@ -2264,7 +2264,7 @@ MediaCacheStream::Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes) int64_t bytes = std::min(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(streamWithPartialBlock->mPartialBlockBuffer.get()) + offsetInStreamBlock, bytes); if (mCurrentMode == MODE_METADATA) { @@ -2289,7 +2289,7 @@ MediaCacheStream::Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes) 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) @@ -2361,7 +2361,7 @@ MediaCacheStream::ReadFromCache(char* aBuffer, int64_t aOffset, int64_t aCount) // Clamp bytes until 64-bit file size issues are fixed. int64_t toCopy = std::min(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(mPartialBlockBuffer.get()) + offsetInStreamBlock, bytes); } else { @@ -2370,7 +2370,7 @@ MediaCacheStream::ReadFromCache(char* aBuffer, int64_t aOffset, int64_t aCount) 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; diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 1105f30044e..f9bee3fb7ab 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -718,7 +718,7 @@ nsresult MediaDecoder::Seek(double aTime, SeekTarget::Type aSeekType) 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); diff --git a/dom/media/MediaRecorder.cpp b/dom/media/MediaRecorder.cpp index a6c0acea12a..c827ec38f99 100644 --- a/dom/media/MediaRecorder.cpp +++ b/dom/media/MediaRecorder.cpp @@ -979,7 +979,7 @@ MediaRecorder::Constructor(const GlobalObject& aGlobal, nsresult MediaRecorder::CreateAndDispatchBlobEvent(already_AddRefed&& 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 blob = aBlob; @@ -1003,7 +1003,7 @@ MediaRecorder::CreateAndDispatchBlobEvent(already_AddRefed&& aBlob) 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; @@ -1034,7 +1034,7 @@ MediaRecorder::DispatchSimpleEvent(const nsAString & aStr) 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; @@ -1070,7 +1070,7 @@ MediaRecorder::NotifyError(nsresult aRv) 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; } diff --git a/dom/media/gmp/GMPProcessChild.cpp b/dom/media/gmp/GMPProcessChild.cpp index e88aebd87f2..803d9c2ccb3 100644 --- a/dom/media/gmp/GMPProcessChild.cpp +++ b/dom/media/gmp/GMPProcessChild.cpp @@ -36,12 +36,12 @@ GMPProcessChild::Init() // (after the binary name) here is indeed the plugin module path. // Keep in sync with dom/plugins/PluginModuleParent. std::vector 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 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 diff --git a/dom/media/wave/WaveReader.cpp b/dom/media/wave/WaveReader.cpp index b3f4f92c278..4d385cd9632 100644 --- a/dom/media/wave/WaveReader.cpp +++ b/dom/media/wave/WaveReader.cpp @@ -338,8 +338,8 @@ 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; @@ -371,8 +371,8 @@ WaveReader::LoadFormatChunk(uint32_t aChunkSize) 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; @@ -433,8 +433,8 @@ WaveReader::LoadFormatChunk(uint32_t aChunkSize) } // 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 @@ -467,8 +467,8 @@ 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) { @@ -485,21 +485,21 @@ WaveReader::FindDataOffset(uint32_t aChunkSize) 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); } @@ -527,10 +527,10 @@ WaveReader::GetPosition() 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; @@ -552,8 +552,8 @@ WaveReader::LoadListChunk(uint32_t aChunkSize, nsAutoPtr &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), @@ -628,8 +628,8 @@ bool WaveReader::LoadAllChunks(nsAutoPtr &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; diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index 1dde6fa3205..f55b8af55f6 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -1508,8 +1508,9 @@ _evaluate(NPP npp, NPObject* npobj, NPString *script, NPVariant *result) } 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 diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index c87166a05b1..b91e715aa72 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -2669,8 +2669,8 @@ PluginInstanceChild::DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType, 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 retsurf; @@ -3099,8 +3099,8 @@ 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 @@ -3179,7 +3179,7 @@ PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect, 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 @@ -3543,7 +3543,7 @@ 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 diff --git a/dom/plugins/ipc/PluginInstanceParent.cpp b/dom/plugins/ipc/PluginInstanceParent.cpp index 6f83bdf70e1..808d1ace49e 100644 --- a/dom/plugins/ipc/PluginInstanceParent.cpp +++ b/dom/plugins/ipc/PluginInstanceParent.cpp @@ -745,7 +745,7 @@ PluginInstanceParent::SetBackgroundUnknown() if (mBackground) { DestroyBackground(); - NS_ABORT_IF_FALSE(!mBackground, "Background not destroyed"); + MOZ_ASSERT(!mBackground, "Background not destroyed"); } return NS_OK; @@ -764,8 +764,8 @@ PluginInstanceParent::BeginUpdateBackground(const nsIntRect& aRect, // 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; @@ -774,8 +774,8 @@ PluginInstanceParent::BeginUpdateBackground(const nsIntRect& aRect, 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 dt = gfxPlatform::GetPlatform()-> @@ -821,7 +821,7 @@ PluginInstanceParent::GetAsyncSurrogate() 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 @@ -866,7 +866,7 @@ PluginInstanceParent::DestroyBackground() mozilla::plugins::SurfaceDescriptor PluginInstanceParent::BackgroundDescriptor() { - NS_ABORT_IF_FALSE(mBackground, "Need a background here"); + MOZ_ASSERT(mBackground, "Need a background here"); // XXX refactor me @@ -876,8 +876,8 @@ PluginInstanceParent::BackgroundDescriptor() #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(mBackground.get()); return shmem->GetShmem(); diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index 104d6eca464..6b6202fd2a1 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -516,10 +516,10 @@ PluginModuleChild::DetectNestedEventLoop(gpointer data) { PluginModuleChild* pmc = static_cast(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")); @@ -542,8 +542,8 @@ PluginModuleChild::ProcessBrowserEvents(gpointer data) { PluginModuleChild* pmc = static_cast(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(); @@ -553,8 +553,8 @@ PluginModuleChild::ProcessBrowserEvents(gpointer data) 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, @@ -571,8 +571,8 @@ PluginModuleChild::EnteredCxxStack() 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; @@ -582,8 +582,8 @@ PluginModuleChild::ExitedCxxStack() 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())); @@ -592,8 +592,8 @@ PluginModuleChild::EnteredCxxStack() 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; } @@ -636,8 +636,8 @@ PluginModuleChild::InitGraphics() // 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; @@ -1088,7 +1088,7 @@ const NPNetscapeFuncs PluginModuleChild::sBrowserFuncs = { PluginInstanceChild* InstCast(NPP aNPP) { - NS_ABORT_IF_FALSE(!!(aNPP->ndata), "nil instance"); + MOZ_ASSERT(!!(aNPP->ndata), "nil instance"); return static_cast(aNPP->ndata); } diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 5710a570edb..e114ef88414 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -1512,8 +1512,8 @@ 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()); diff --git a/dom/plugins/ipc/PluginProcessChild.cpp b/dom/plugins/ipc/PluginProcessChild.cpp index 8075e695d98..238ea7e4b5a 100644 --- a/dom/plugins/ipc/PluginProcessChild.cpp +++ b/dom/plugins/ipc/PluginProcessChild.cpp @@ -109,14 +109,14 @@ PluginProcessChild::Init() // (after the binary name) here is indeed the plugin module path. // Keep in sync with dom/plugins/PluginModuleParent. std::vector 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 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(); diff --git a/dom/smil/SMILIntegerType.cpp b/dom/smil/SMILIntegerType.cpp index f6fd6908859..f80efd8636b 100644 --- a/dom/smil/SMILIntegerType.cpp +++ b/dom/smil/SMILIntegerType.cpp @@ -13,7 +13,7 @@ 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; } diff --git a/dom/smil/nsSMILAnimationController.cpp b/dom/smil/nsSMILAnimationController.cpp index 8709794f07c..50b44d16aa1 100644 --- a/dom/smil/nsSMILAnimationController.cpp +++ b/dom/smil/nsSMILAnimationController.cpp @@ -32,7 +32,7 @@ nsSMILAnimationController::nsSMILAnimationController(nsIDocument* aDoc) 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) { @@ -57,9 +57,9 @@ nsSMILAnimationController::~nsSMILAnimationController() 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"); @@ -170,9 +170,9 @@ nsSMILAnimationController::RegisterAnimationElement( 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) @@ -265,9 +265,8 @@ nsSMILAnimationController::StartSampling(nsRefreshDriver* aRefreshDriver) 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(); @@ -282,9 +281,8 @@ 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; } @@ -482,8 +480,8 @@ nsSMILAnimationController::RewindElements() 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(aData); nsSMILTimeContainer* container = aKey->GetKey(); @@ -569,7 +567,7 @@ nsSMILAnimationController::DoMilestoneSamples() 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 @@ -597,10 +595,10 @@ nsSMILAnimationController::DoMilestoneSamples() 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(aData); @@ -622,10 +620,10 @@ nsSMILAnimationController::GetNextMilestone(TimeContainerPtrKey* aKey, 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(aData); @@ -702,8 +700,8 @@ nsSMILAnimationController::SampleTimedElement( 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); } diff --git a/dom/smil/nsSMILAnimationFunction.cpp b/dom/smil/nsSMILAnimationFunction.cpp index e111e3ec014..a60424b8e9e 100644 --- a/dom/smil/nsSMILAnimationFunction.cpp +++ b/dom/smil/nsSMILAnimationFunction.cpp @@ -220,10 +220,10 @@ nsSMILAnimationFunction::ComposeResult(const nsISMILAttr& aSMILAttr, 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 @@ -303,8 +303,8 @@ nsSMILAnimationFunction::CompareTo(const nsSMILAnimationFunction* aOther) const // 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; @@ -368,8 +368,8 @@ nsSMILAnimationFunction::InterpolateResult(const nsSMILValueArray& aValues, 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"); @@ -388,7 +388,7 @@ nsSMILAnimationFunction::InterpolateResult(const nsSMILValueArray& aValues, 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; @@ -421,10 +421,10 @@ nsSMILAnimationFunction::InterpolateResult(const nsSMILValueArray& aValues, } 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); } } @@ -502,7 +502,7 @@ nsSMILAnimationFunction::ComputePacedPosition(const nsSMILValueArray& aValues, "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 @@ -548,9 +548,9 @@ nsSMILAnimationFunction::ComputePacedPosition(const nsSMILValueArray& aValues, 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. @@ -604,7 +604,7 @@ nsSMILAnimationFunction::ComputePacedTotalDistance( // 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; @@ -634,9 +634,9 @@ nsSMILAnimationFunction::ScaleSimpleProgress(double aProgress, // 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; @@ -663,8 +663,8 @@ nsSMILAnimationFunction::ScaleIntervalProgress(double 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); diff --git a/dom/smil/nsSMILAnimationFunction.h b/dom/smil/nsSMILAnimationFunction.h index 27f4e6f20cb..e3a334b4d29 100644 --- a/dom/smil/nsSMILAnimationFunction.h +++ b/dom/smil/nsSMILAnimationFunction.h @@ -206,10 +206,10 @@ public: */ 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; } diff --git a/dom/smil/nsSMILCSSProperty.cpp b/dom/smil/nsSMILCSSProperty.cpp index a94f9e1fe57..44ebaeaad47 100644 --- a/dom/smil/nsSMILCSSProperty.cpp +++ b/dom/smil/nsSMILCSSProperty.cpp @@ -22,10 +22,10 @@ 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) { @@ -53,9 +53,9 @@ 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 diff --git a/dom/smil/nsSMILCSSValueType.cpp b/dom/smil/nsSMILCSSValueType.cpp index baf63dd3103..f9e06afd22f 100644 --- a/dom/smil/nsSMILCSSValueType.cpp +++ b/dom/smil/nsSMILCSSValueType.cpp @@ -45,8 +45,8 @@ GetZeroValueForUnit(StyleAnimationValue::Unit aUnit) 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; @@ -75,8 +75,8 @@ 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) { @@ -142,7 +142,7 @@ ExtractValueWrapper(const nsSMILValue& aValue) 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; @@ -151,7 +151,7 @@ nsSMILCSSValueType::Init(nsSMILValue& aValue) const 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(aValue.mU.mPtr); aValue.mType = nsSMILNullType::Singleton(); } @@ -159,8 +159,8 @@ nsSMILCSSValueType::Destroy(nsSMILValue& aValue) const 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); @@ -185,8 +185,8 @@ 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); @@ -213,14 +213,14 @@ 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); @@ -260,13 +260,13 @@ 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; @@ -287,18 +287,18 @@ nsSMILCSSValueType::Interpolate(const nsSMILValue& aStartVal, 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; @@ -370,9 +370,8 @@ ValueFromStringHelper(nsCSSProperty aPropID, 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()); } @@ -387,7 +386,7 @@ nsSMILCSSValueType::ValueFromString(nsCSSProperty aPropID, 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"); @@ -415,8 +414,8 @@ 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, diff --git a/dom/smil/nsSMILInstanceTime.cpp b/dom/smil/nsSMILInstanceTime.cpp index 013ae4bd834..cc7eaad829b 100644 --- a/dom/smil/nsSMILInstanceTime.cpp +++ b/dom/smil/nsSMILInstanceTime.cpp @@ -47,11 +47,11 @@ nsSMILInstanceTime::nsSMILInstanceTime(const nsSMILTimeValue& aTime, 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 @@ -78,7 +78,7 @@ nsSMILInstanceTime::HandleChangedInterval( 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 @@ -100,9 +100,10 @@ nsSMILInstanceTime::HandleChangedInterval( 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 @@ -115,8 +116,9 @@ nsSMILInstanceTime::HandleDeletedInterval() 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 @@ -138,8 +140,8 @@ nsSMILInstanceTime::UnmarkShouldPreserve() 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 } @@ -147,7 +149,7 @@ nsSMILInstanceTime::AddRefFixedEndpoint() void nsSMILInstanceTime::ReleaseFixedEndpoint() { - NS_ABORT_IF_FALSE(mFixedEndpointRefCnt > 0, "Duplicate release"); + MOZ_ASSERT(mFixedEndpointRefCnt > 0, "Duplicate release"); --mFixedEndpointRefCnt; if (mFixedEndpointRefCnt == 0 && IsDynamic()) { mFlags |= kWasDynamicEndpoint; @@ -179,7 +181,7 @@ nsSMILInstanceTime::GetBaseTime() const 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; } @@ -191,13 +193,14 @@ nsSMILInstanceTime::GetBaseTime() const 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; diff --git a/dom/smil/nsSMILInstanceTime.h b/dom/smil/nsSMILInstanceTime.h index 05ca2a2564c..0360e5d3c1a 100644 --- a/dom/smil/nsSMILInstanceTime.h +++ b/dom/smil/nsSMILInstanceTime.h @@ -77,8 +77,8 @@ public: 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; } diff --git a/dom/smil/nsSMILInterval.cpp b/dom/smil/nsSMILInterval.cpp index a2324c1f21b..db6132b45cc 100644 --- a/dom/smil/nsSMILInterval.cpp +++ b/dom/smil/nsSMILInterval.cpp @@ -19,23 +19,23 @@ nsSMILInterval::nsSMILInterval(const nsSMILInterval& aOther) 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 @@ -62,31 +62,31 @@ nsSMILInterval::Unlink(bool aFiltered) 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; } @@ -94,12 +94,12 @@ nsSMILInterval::SetBegin(nsSMILInstanceTime& 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; } @@ -107,9 +107,9 @@ nsSMILInterval::SetEnd(nsSMILInstanceTime& 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(); } @@ -117,11 +117,11 @@ nsSMILInterval::FixBegin() 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(); } @@ -143,7 +143,7 @@ nsSMILInterval::RemoveDependentTime(const nsSMILInstanceTime& aTime) 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 diff --git a/dom/smil/nsSMILInterval.h b/dom/smil/nsSMILInterval.h index 2f7eafd2b3b..86ecf20d1a5 100644 --- a/dom/smil/nsSMILInterval.h +++ b/dom/smil/nsSMILInterval.h @@ -28,16 +28,16 @@ public: 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(); diff --git a/dom/smil/nsSMILParserUtils.cpp b/dom/smil/nsSMILParserUtils.cpp index 09ecb0ca5a7..63548f7a97f 100644 --- a/dom/smil/nsSMILParserUtils.cpp +++ b/dom/smil/nsSMILParserUtils.cpp @@ -271,16 +271,15 @@ ParseOptionalOffset(RangedPtr& aIter, 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 iter(SVGContentUtils::GetStartRangedPtr(aSpec)); RangedPtr end(SVGContentUtils::GetEndRangedPtr(aSpec)); @@ -371,7 +370,7 @@ ConvertTokenToAtom(const nsAString& aToken, 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; diff --git a/dom/smil/nsSMILTimeContainer.cpp b/dom/smil/nsSMILTimeContainer.cpp index 407509b7386..61248db0409 100644 --- a/dom/smil/nsSMILTimeContainer.cpp +++ b/dom/smil/nsSMILTimeContainer.cpp @@ -254,9 +254,9 @@ nsSMILTimeContainer::PopMilestoneElementsAtMilestone( 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() && @@ -291,7 +291,7 @@ 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 @@ -313,9 +313,9 @@ nsSMILTimeContainer::NotifyTimeChange() 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; } } diff --git a/dom/smil/nsSMILTimeValue.h b/dom/smil/nsSMILTimeValue.h index daf1a1888cc..033cb7404b3 100644 --- a/dom/smil/nsSMILTimeValue.h +++ b/dom/smil/nsSMILTimeValue.h @@ -88,8 +88,8 @@ public: 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; } diff --git a/dom/smil/nsSMILTimeValueSpec.cpp b/dom/smil/nsSMILTimeValueSpec.cpp index 5b2f87e2465..39e3d8875a1 100644 --- a/dom/smil/nsSMILTimeValueSpec.cpp +++ b/dom/smil/nsSMILTimeValueSpec.cpp @@ -92,8 +92,8 @@ 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 @@ -113,10 +113,10 @@ nsSMILTimeValueSpec::ResolveReferences(nsIContent* aContextNode) 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()); } @@ -297,11 +297,12 @@ nsSMILTimeValueSpec::IsWhitelistedEvent() 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; @@ -343,7 +344,7 @@ nsSMILTimeValueSpec::UnregisterEventListener(Element* aTarget) 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 target; @@ -367,10 +368,10 @@ nsSMILTimeValueSpec::GetEventListenerManager(Element* aTarget) 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 @@ -509,8 +510,8 @@ nsSMILTimeValueSpec::ConvertBetweenTimeContainers( // 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()); } diff --git a/dom/smil/nsSMILTimedElement.cpp b/dom/smil/nsSMILTimedElement.cpp index 7af56886988..826d80f6e46 100644 --- a/dom/smil/nsSMILTimedElement.cpp +++ b/dom/smil/nsSMILTimedElement.cpp @@ -48,12 +48,12 @@ 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(); } @@ -63,10 +63,10 @@ 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; @@ -195,9 +195,8 @@ nsSMILTimedElement::RemoveInstanceTimes(InstanceTimeList& aArray, // 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); @@ -282,19 +281,19 @@ nsSMILTimedElement::~nsSMILTimedElement() // 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; } @@ -385,7 +384,7 @@ 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. @@ -394,9 +393,9 @@ nsSMILTimedElement::AddInstanceTime(nsSMILInstanceTime* aInstanceTime, { // 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; } @@ -417,7 +416,7 @@ 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 @@ -449,7 +448,7 @@ 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. @@ -461,7 +460,7 @@ nsSMILTimedElement::RemoveInstanceTime(nsSMILInstanceTime* aInstanceTime, InstanceTimeList& instanceList = aIsBegin ? mBeginInstances : mEndInstances; mozilla::DebugOnly 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(); } @@ -498,7 +497,7 @@ 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); @@ -560,10 +559,10 @@ nsSMILTimedElement::SampleEndAt(nsSMILTime aContainerTime) 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 @@ -604,11 +603,12 @@ nsSMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, bool aEndOnly) #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 @@ -694,8 +694,8 @@ nsSMILTimedElement::DoSampleAt(nsSMILTime aContainerTime, bool aEndOnly) 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"); @@ -771,9 +771,8 @@ namespace // 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(); } } @@ -781,8 +780,9 @@ namespace 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 @@ -799,15 +799,15 @@ nsSMILTimedElement::Rewind() 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 @@ -972,8 +972,8 @@ nsSMILTimedElement::SetSimpleDuration(const nsAString& aDurSpec) } // 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; @@ -1005,7 +1005,7 @@ nsSMILTimedElement::SetMin(const nsAString& aMinSpec) } } - NS_ABORT_IF_FALSE(duration.GetMillis() >= 0L, "Invalid duration"); + MOZ_ASSERT(duration.GetMillis() >= 0L, "Invalid duration"); mMin = duration; @@ -1036,7 +1036,7 @@ nsSMILTimedElement::SetMax(const nsAString& aMaxSpec) mMax.SetIndefinite(); return NS_ERROR_FAILURE; } - NS_ABORT_IF_FALSE(duration.GetMillis() > 0L, "Invalid duration"); + MOZ_ASSERT(duration.GetMillis() > 0L, "Invalid duration"); } mMax = duration; @@ -1162,8 +1162,8 @@ 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 @@ -1251,15 +1251,15 @@ 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); } } @@ -1273,15 +1273,15 @@ nsSMILTimedElement::Unlink() 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(); } @@ -1386,8 +1386,8 @@ 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; @@ -1697,8 +1697,8 @@ nsSMILTimedElement::GetNextInterval(const nsSMILInterval* aPrevInterval, 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) @@ -1746,9 +1746,9 @@ nsSMILTimedElement::GetNextInterval(const nsSMILInterval* aPrevInterval, } 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 { @@ -1811,7 +1811,7 @@ nsSMILTimedElement::GetNextInterval(const nsSMILInterval* aPrevInterval, 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 @@ -1869,7 +1869,7 @@ nsSMILTimedElement::GetNextGreaterOrEqual(const InstanceTimeList& aList, 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; } @@ -1887,10 +1887,10 @@ nsSMILTimedElement::CalcActiveEnd(const nsSMILTimeValue& aBegin, { 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(); @@ -1968,9 +1968,9 @@ nsSMILTimedElement::ActiveTimeToSimpleTime(nsSMILTime aActiveTime, { 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 @@ -2001,8 +2001,8 @@ 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; @@ -2052,8 +2052,9 @@ nsSMILTimedElement::UpdateCurrentInterval(bool aForceChangeNotice) // 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; } @@ -2064,8 +2065,8 @@ nsSMILTimedElement::UpdateCurrentInterval(bool aForceChangeNotice) // it. In release builds, just bail out before we overflow the stack. AutoRestore 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; } @@ -2079,8 +2080,8 @@ nsSMILTimedElement::UpdateCurrentInterval(bool aForceChangeNotice) 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(); @@ -2152,12 +2153,13 @@ nsSMILTimedElement::SampleFillValue() 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(); @@ -2219,8 +2221,8 @@ 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)) @@ -2265,8 +2267,8 @@ nsSMILTimedElement::GetNextMilestone(nsSMILMilestone& aNextMilestone) const 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; @@ -2314,9 +2316,9 @@ nsSMILTimedElement::GetNextMilestone(nsSMILMilestone& aNextMilestone) const 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) { @@ -2332,7 +2334,7 @@ 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) { @@ -2432,13 +2434,13 @@ nsSMILTimedElement::AreEndTimesDependentOn( 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(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 diff --git a/dom/smil/nsSMILValue.cpp b/dom/smil/nsSMILValue.cpp index 319fa4e2eed..e0404b16339 100644 --- a/dom/smil/nsSMILValue.cpp +++ b/dom/smil/nsSMILValue.cpp @@ -124,16 +124,17 @@ 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 diff --git a/dom/speakermanager/SpeakerManager.cpp b/dom/speakermanager/SpeakerManager.cpp index 472f914c431..0035458aaf4 100644 --- a/dom/speakermanager/SpeakerManager.cpp +++ b/dom/speakermanager/SpeakerManager.cpp @@ -78,7 +78,7 @@ SpeakerManager::SetForcespeaker(bool 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; diff --git a/dom/storage/DOMStorageIPC.cpp b/dom/storage/DOMStorageIPC.cpp index 10ae15a0fe6..411a9c3e452 100644 --- a/dom/storage/DOMStorageIPC.cpp +++ b/dom/storage/DOMStorageIPC.cpp @@ -42,7 +42,7 @@ NS_IMETHODIMP_(MozExternalRefCountType) DOMStorageDBChild::Release(void) 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(); } @@ -50,7 +50,7 @@ DOMStorageDBChild::AddIPDLReference() 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(); } @@ -275,7 +275,7 @@ 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(); } @@ -283,7 +283,7 @@ DOMStorageDBParent::AddIPDLReference() 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(); } diff --git a/dom/svg/DOMSVGLength.cpp b/dom/svg/DOMSVGLength.cpp index f50d1f9ee90..a847dccbcad 100644 --- a/dom/svg/DOMSVGLength.cpp +++ b/dom/svg/DOMSVGLength.cpp @@ -107,11 +107,12 @@ DOMSVGLength::DOMSVGLength(DOMSVGLengthList *aList, , 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() @@ -535,7 +536,7 @@ DOMSVGLength::InsertingIntoList(DOMSVGLengthList *aList, mListIndex = aListIndex; mIsAnimValItem = aIsAnimValItem; - NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGLength!"); + MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGLength!"); } void diff --git a/dom/svg/DOMSVGLengthList.cpp b/dom/svg/DOMSVGLengthList.cpp index fe42255191e..8c01d40982f 100644 --- a/dom/svg/DOMSVGLengthList.cpp +++ b/dom/svg/DOMSVGLengthList.cpp @@ -367,7 +367,7 @@ DOMSVGLengthList::GetItemAt(uint32_t aIndex) 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; @@ -376,8 +376,8 @@ DOMSVGLengthList::MaybeInsertNullInAnimValListAt(uint32_t aIndex) 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(nullptr)); @@ -387,7 +387,7 @@ DOMSVGLengthList::MaybeInsertNullInAnimValListAt(uint32_t aIndex) 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. @@ -398,8 +398,8 @@ DOMSVGLengthList::MaybeRemoveItemFromAnimValListAt(uint32_t aIndex) 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(); diff --git a/dom/svg/DOMSVGLengthList.h b/dom/svg/DOMSVGLengthList.h index 1f9eba6e13e..796d284ed0f 100644 --- a/dom/svg/DOMSVGLengthList.h +++ b/dom/svg/DOMSVGLengthList.h @@ -81,9 +81,9 @@ public: * 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(); } @@ -146,8 +146,8 @@ private: /// 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; } diff --git a/dom/svg/DOMSVGNumber.cpp b/dom/svg/DOMSVGNumber.cpp index 9ebd941e8de..c8b2b65e3ef 100644 --- a/dom/svg/DOMSVGNumber.cpp +++ b/dom/svg/DOMSVGNumber.cpp @@ -93,11 +93,12 @@ DOMSVGNumber::DOMSVGNumber(DOMSVGNumberList *aList, , 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) @@ -180,7 +181,7 @@ DOMSVGNumber::InsertingIntoList(DOMSVGNumberList *aList, mListIndex = aListIndex; mIsAnimValItem = aIsAnimValItem; - NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGNumber!"); + MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGNumber!"); } void diff --git a/dom/svg/DOMSVGNumberList.cpp b/dom/svg/DOMSVGNumberList.cpp index 335e4bb21c1..19906d4fa73 100644 --- a/dom/svg/DOMSVGNumberList.cpp +++ b/dom/svg/DOMSVGNumberList.cpp @@ -346,7 +346,7 @@ DOMSVGNumberList::GetItemAt(uint32_t aIndex) 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; @@ -355,8 +355,8 @@ DOMSVGNumberList::MaybeInsertNullInAnimValListAt(uint32_t aIndex) 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(nullptr)); @@ -366,7 +366,7 @@ DOMSVGNumberList::MaybeInsertNullInAnimValListAt(uint32_t aIndex) 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. @@ -377,8 +377,8 @@ DOMSVGNumberList::MaybeRemoveItemFromAnimValListAt(uint32_t aIndex) 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(); diff --git a/dom/svg/DOMSVGNumberList.h b/dom/svg/DOMSVGNumberList.h index 974b75b2a1f..a84577c9d0c 100644 --- a/dom/svg/DOMSVGNumberList.h +++ b/dom/svg/DOMSVGNumberList.h @@ -81,9 +81,9 @@ public: * 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(); } @@ -139,8 +139,8 @@ private: /// 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; } diff --git a/dom/svg/DOMSVGPathSeg.cpp b/dom/svg/DOMSVGPathSeg.cpp index 258f8a50baa..fc8e255c7a8 100644 --- a/dom/svg/DOMSVGPathSeg.cpp +++ b/dom/svg/DOMSVGPathSeg.cpp @@ -80,10 +80,9 @@ DOMSVGPathSeg::DOMSVGPathSeg(DOMSVGPathSegList *aList, , 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() @@ -98,13 +97,13 @@ 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 @@ -120,7 +119,7 @@ DOMSVGPathSeg::RemovingFromList() 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 diff --git a/dom/svg/DOMSVGPathSeg.h b/dom/svg/DOMSVGPathSeg.h index 430a1d9ddd2..a031e439714 100644 --- a/dom/svg/DOMSVGPathSeg.h +++ b/dom/svg/DOMSVGPathSeg.h @@ -20,10 +20,10 @@ class nsSVGElement; 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) \ diff --git a/dom/svg/DOMSVGPathSegList.cpp b/dom/svg/DOMSVGPathSegList.cpp index b639c951506..993e4525685 100644 --- a/dom/svg/DOMSVGPathSegList.cpp +++ b/dom/svg/DOMSVGPathSegList.cpp @@ -190,9 +190,9 @@ DOMSVGPathSegList::InternalListWillChangeTo(const SVGPathData& aNewValue) 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 @@ -232,8 +232,8 @@ DOMSVGPathSegList::InternalListWillChangeTo(const SVGPathData& aNewValue) } } - 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 @@ -252,7 +252,7 @@ DOMSVGPathSegList::InternalList() const SVGAnimatedPathSegList& DOMSVGPathSegList::InternalAList() const { - NS_ABORT_IF_FALSE(mElement->GetAnimPathSegList(), "Internal error"); + MOZ_ASSERT(mElement->GetAnimPathSegList(), "Internal error"); return *mElement->GetAnimPathSegList(); } @@ -518,7 +518,7 @@ DOMSVGPathSegList:: 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 @@ -533,8 +533,8 @@ DOMSVGPathSegList:: 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)); @@ -546,7 +546,7 @@ 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 @@ -562,8 +562,8 @@ DOMSVGPathSegList:: 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(); diff --git a/dom/svg/DOMSVGPathSegList.h b/dom/svg/DOMSVGPathSegList.h index d6c3031368d..720faf12940 100644 --- a/dom/svg/DOMSVGPathSegList.h +++ b/dom/svg/DOMSVGPathSegList.h @@ -98,9 +98,9 @@ public: * 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(); } diff --git a/dom/svg/DOMSVGPoint.h b/dom/svg/DOMSVGPoint.h index 4c63e009cb6..63aa7c52034 100644 --- a/dom/svg/DOMSVGPoint.h +++ b/dom/svg/DOMSVGPoint.h @@ -57,10 +57,9 @@ public: 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) diff --git a/dom/svg/DOMSVGPointList.cpp b/dom/svg/DOMSVGPointList.cpp index b9adde93815..05b52edc3b1 100644 --- a/dom/svg/DOMSVGPointList.cpp +++ b/dom/svg/DOMSVGPointList.cpp @@ -194,7 +194,7 @@ DOMSVGPointList::InternalList() const SVGAnimatedPointList& DOMSVGPointList::InternalAList() const { - NS_ABORT_IF_FALSE(mElement->GetAnimatedPointList(), "Internal error"); + MOZ_ASSERT(mElement->GetAnimatedPointList(), "Internal error"); return *mElement->GetAnimatedPointList(); } @@ -414,7 +414,7 @@ DOMSVGPointList::GetItemAt(uint32_t aIndex) 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 @@ -429,8 +429,8 @@ DOMSVGPointList::MaybeInsertNullInAnimValListAt(uint32_t aIndex) 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(nullptr)); @@ -440,7 +440,7 @@ DOMSVGPointList::MaybeInsertNullInAnimValListAt(uint32_t aIndex) 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 @@ -456,8 +456,8 @@ DOMSVGPointList::MaybeRemoveItemFromAnimValListAt(uint32_t aIndex) 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(); diff --git a/dom/svg/DOMSVGPointList.h b/dom/svg/DOMSVGPointList.h index 42793674e72..b872cecf89b 100644 --- a/dom/svg/DOMSVGPointList.h +++ b/dom/svg/DOMSVGPointList.h @@ -100,9 +100,9 @@ public: * 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(); } diff --git a/dom/svg/DOMSVGTransformList.cpp b/dom/svg/DOMSVGTransformList.cpp index 456e9c97190..2bd026c7dea 100644 --- a/dom/svg/DOMSVGTransformList.cpp +++ b/dom/svg/DOMSVGTransformList.cpp @@ -393,7 +393,7 @@ DOMSVGTransformList::GetItemAt(uint32_t aIndex) 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; @@ -402,8 +402,8 @@ DOMSVGTransformList::MaybeInsertNullInAnimValListAt(uint32_t aIndex) 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(nullptr)); @@ -414,7 +414,7 @@ DOMSVGTransformList::MaybeInsertNullInAnimValListAt(uint32_t aIndex) 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. @@ -425,8 +425,8 @@ DOMSVGTransformList::MaybeRemoveItemFromAnimValListAt(uint32_t aIndex) 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(); diff --git a/dom/svg/DOMSVGTransformList.h b/dom/svg/DOMSVGTransformList.h index 0cc31d5a13e..90ceb75d8bc 100644 --- a/dom/svg/DOMSVGTransformList.h +++ b/dom/svg/DOMSVGTransformList.h @@ -76,9 +76,8 @@ public: * 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(); } @@ -135,8 +134,8 @@ private: /// 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; } diff --git a/dom/svg/SVGAnimationElement.cpp b/dom/svg/SVGAnimationElement.cpp index a61ca9dca7b..eabb9227dca 100644 --- a/dom/svg/SVGAnimationElement.cpp +++ b/dom/svg/SVGAnimationElement.cpp @@ -82,9 +82,9 @@ 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(); @@ -191,9 +191,8 @@ SVGAnimationElement::BindToTree(nsIDocument* aDocument, 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); @@ -314,8 +313,8 @@ SVGAnimationElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName, 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. diff --git a/dom/svg/SVGContentUtils.cpp b/dom/svg/SVGContentUtils.cpp index 9fef9b3bb73..5aab2030030 100644 --- a/dom/svg/SVGContentUtils.cpp +++ b/dom/svg/SVGContentUtils.cpp @@ -56,8 +56,8 @@ SVGContentUtils::GetOuterSVGElement(nsSVGElement *aSVGElement) 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(aContent)->ActivateByHyperlink(); } @@ -282,17 +282,17 @@ SVGContentUtils::GetFontSize(Element *aElement) 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) / @@ -320,17 +320,17 @@ SVGContentUtils::GetFontXHeight(Element *aElement) 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 fontMetrics; nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext, diff --git a/dom/svg/SVGFEImageElement.cpp b/dom/svg/SVGFEImageElement.cpp index 1db3cec8687..4acbe850e94 100644 --- a/dom/svg/SVGFEImageElement.cpp +++ b/dom/svg/SVGFEImageElement.cpp @@ -334,7 +334,7 @@ SVGFEImageElement::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* // Request a decode nsCOMPtr 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(); } diff --git a/dom/svg/SVGForeignObjectElement.cpp b/dom/svg/SVGForeignObjectElement.cpp index 7206aeb6975..cf0ea170197 100644 --- a/dom/svg/SVGForeignObjectElement.cpp +++ b/dom/svg/SVGForeignObjectElement.cpp @@ -89,7 +89,7 @@ SVGForeignObjectElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix, if (aWhich == eChildToUserSpace) { return toUserSpace * aMatrix; } - NS_ABORT_IF_FALSE(aWhich == eAllTransforms, "Unknown TransformTypes"); + MOZ_ASSERT(aWhich == eAllTransforms, "Unknown TransformTypes"); return toUserSpace * fromUserSpace; } diff --git a/dom/svg/SVGFragmentIdentifier.cpp b/dom/svg/SVGFragmentIdentifier.cpp index fd3a60f57b4..874e0f8145a 100644 --- a/dom/svg/SVGFragmentIdentifier.cpp +++ b/dom/svg/SVGFragmentIdentifier.cpp @@ -238,8 +238,8 @@ 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(aDocument->GetRootElement()); diff --git a/dom/svg/SVGIFrameElement.cpp b/dom/svg/SVGIFrameElement.cpp index 44b45d9f0df..0debbd3d230 100644 --- a/dom/svg/SVGIFrameElement.cpp +++ b/dom/svg/SVGIFrameElement.cpp @@ -78,7 +78,7 @@ SVGIFrameElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix, if (aWhich == eChildToUserSpace) { return toUserSpace; } - NS_ABORT_IF_FALSE(aWhich == eAllTransforms, "Unknown TransformTypes"); + MOZ_ASSERT(aWhich == eAllTransforms, "Unknown TransformTypes"); return toUserSpace * fromUserSpace; } diff --git a/dom/svg/SVGIntegerPairSMILType.cpp b/dom/svg/SVGIntegerPairSMILType.cpp index 41779327ba2..b20bb8d305d 100644 --- a/dom/svg/SVGIntegerPairSMILType.cpp +++ b/dom/svg/SVGIntegerPairSMILType.cpp @@ -13,7 +13,7 @@ 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; diff --git a/dom/svg/SVGLength.cpp b/dom/svg/SVGLength.cpp index 08a340d2037..8dbd0e723bc 100644 --- a/dom/svg/SVGLength.cpp +++ b/dom/svg/SVGLength.cpp @@ -77,8 +77,8 @@ IsAbsoluteUnit(uint8_t aUnit) */ 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...: diff --git a/dom/svg/SVGLengthList.h b/dom/svg/SVGLengthList.h index 5997ef00a0a..bb8d91b72d0 100644 --- a/dom/svg/SVGLengthList.h +++ b/dom/svg/SVGLengthList.h @@ -110,14 +110,14 @@ private: } 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); } @@ -203,14 +203,14 @@ public: */ 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; } diff --git a/dom/svg/SVGLengthListSMILType.cpp b/dom/svg/SVGLengthListSMILType.cpp index 7c8718c12e6..62f54d979f9 100644 --- a/dom/svg/SVGLengthListSMILType.cpp +++ b/dom/svg/SVGLengthListSMILType.cpp @@ -21,7 +21,7 @@ namespace mozilla { 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(); @@ -110,8 +110,8 @@ SVGLengthListSMILType::Add(nsSMILValue& aDest, 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()) { @@ -120,8 +120,8 @@ SVGLengthListSMILType::Add(nsSMILValue& aDest, 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())) { diff --git a/dom/svg/SVGMPathElement.cpp b/dom/svg/SVGMPathElement.cpp index 3ea94dcf0c6..b3031768942 100644 --- a/dom/svg/SVGMPathElement.cpp +++ b/dom/svg/SVGMPathElement.cpp @@ -86,9 +86,8 @@ SVGMPathElement::BindToTree(nsIDocument* aDocument, 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); @@ -181,9 +180,9 @@ 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; } diff --git a/dom/svg/SVGMarkerElement.cpp b/dom/svg/SVGMarkerElement.cpp index 82560d54165..528ce8dc936 100644 --- a/dom/svg/SVGMarkerElement.cpp +++ b/dom/svg/SVGMarkerElement.cpp @@ -346,8 +346,8 @@ SVGMarkerElement::GetViewBoxTransform() 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, diff --git a/dom/svg/SVGMotionSMILAnimationFunction.cpp b/dom/svg/SVGMotionSMILAnimationFunction.cpp index abe6b16b493..3f4630a0627 100644 --- a/dom/svg/SVGMotionSMILAnimationFunction.cpp +++ b/dom/svg/SVGMotionSMILAnimationFunction.cpp @@ -146,11 +146,11 @@ 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"); @@ -264,7 +264,7 @@ 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; @@ -297,7 +297,7 @@ SVGMotionSMILAnimationFunction:: FallibleTArray& 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. @@ -321,14 +321,14 @@ SVGMotionSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr, 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(); diff --git a/dom/svg/SVGMotionSMILPathUtils.cpp b/dom/svg/SVGMotionSMILPathUtils.cpp index 0dcced7fff8..40016375fcb 100644 --- a/dom/svg/SVGMotionSMILPathUtils.cpp +++ b/dom/svg/SVGMotionSMILPathUtils.cpp @@ -22,8 +22,8 @@ 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)); } @@ -33,8 +33,8 @@ 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; diff --git a/dom/svg/SVGMotionSMILPathUtils.h b/dom/svg/SVGMotionSMILPathUtils.h index 0369a3b2e12..9a7921cf807 100644 --- a/dom/svg/SVGMotionSMILPathUtils.h +++ b/dom/svg/SVGMotionSMILPathUtils.h @@ -86,8 +86,8 @@ public: 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 diff --git a/dom/svg/SVGMotionSMILType.cpp b/dom/svg/SVGMotionSMILType.cpp index 8448615ec95..a357f28ac73 100644 --- a/dom/svg/SVGMotionSMILType.cpp +++ b/dom/svg/SVGMotionSMILType.cpp @@ -168,7 +168,7 @@ ExtractMotionSegmentArray(const nsSMILValue& aValue) 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); @@ -177,7 +177,7 @@ SVGMotionSMILType::Init(nsSMILValue& aValue) const 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(aValue.mU.mPtr); delete arr; @@ -189,8 +189,8 @@ SVGMotionSMILType::Destroy(nsSMILValue& aValue) const 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); @@ -208,8 +208,8 @@ 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); @@ -257,9 +257,9 @@ 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); @@ -272,23 +272,23 @@ SVGMotionSMILType::Add(nsSMILValue& aDest, const nsSMILValue& aValueToAdd, // we don't do this for , 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. @@ -313,15 +313,15 @@ 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; @@ -335,30 +335,30 @@ 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; @@ -385,28 +385,28 @@ SVGMotionSMILType::Interpolate(const nsSMILValue& aStartVal, 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 @@ -421,14 +421,14 @@ SVGMotionSMILType::Interpolate(const nsSMILValue& aStartVal, 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; } @@ -456,9 +456,9 @@ SVGMotionSMILType::CreateMatrix(const nsSMILValue& aSMILVal) 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, diff --git a/dom/svg/SVGNumberList.h b/dom/svg/SVGNumberList.h index c5dd756fbfd..14d87a4b419 100644 --- a/dom/svg/SVGNumberList.h +++ b/dom/svg/SVGNumberList.h @@ -113,14 +113,14 @@ private: } 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); } diff --git a/dom/svg/SVGNumberListSMILType.cpp b/dom/svg/SVGNumberListSMILType.cpp index 86a738500f8..52a3ae886d4 100644 --- a/dom/svg/SVGNumberListSMILType.cpp +++ b/dom/svg/SVGNumberListSMILType.cpp @@ -37,7 +37,7 @@ namespace mozilla { 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(); @@ -93,17 +93,17 @@ SVGNumberListSMILType::Add(nsSMILValue& aDest, const SVGNumberListAndInfo& valueToAdd = *static_cast(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; } @@ -113,8 +113,8 @@ SVGNumberListSMILType::Add(nsSMILValue& aDest, 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 @@ -183,9 +183,9 @@ SVGNumberListSMILType::Interpolate(const nsSMILValue& aStartVal, SVGNumberListAndInfo& result = *static_cast(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()) { @@ -200,7 +200,7 @@ SVGNumberListSMILType::Interpolate(const nsSMILValue& aStartVal, 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]; } diff --git a/dom/svg/SVGNumberPairSMILType.cpp b/dom/svg/SVGNumberPairSMILType.cpp index 8ebff061141..c00befcb0c1 100644 --- a/dom/svg/SVGNumberPairSMILType.cpp +++ b/dom/svg/SVGNumberPairSMILType.cpp @@ -15,7 +15,7 @@ namespace mozilla { 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; diff --git a/dom/svg/SVGOrientSMILType.cpp b/dom/svg/SVGOrientSMILType.cpp index e8355f8ac75..207fb673a67 100644 --- a/dom/svg/SVGOrientSMILType.cpp +++ b/dom/svg/SVGOrientSMILType.cpp @@ -17,7 +17,7 @@ namespace mozilla { 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; diff --git a/dom/svg/SVGPathData.cpp b/dom/svg/SVGPathData.cpp index 87c228d22b4..1bf819a1f44 100644 --- a/dom/svg/SVGPathData.cpp +++ b/dom/svg/SVGPathData.cpp @@ -57,7 +57,7 @@ SVGPathData::GetValueAsString(nsAString& aValue) const 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(' '); @@ -106,7 +106,7 @@ SVGPathData::GetPathLength() const 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; } @@ -122,7 +122,7 @@ SVGPathData::CountItems() const 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; } @@ -145,7 +145,7 @@ SVGPathData::GetSegmentLengths(nsTArray *aLengths) const 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; } @@ -181,7 +181,7 @@ SVGPathData::GetDistancesFromOriginToEndsOfVisibleSegments(FallibleTArray *aMarks) const 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; } @@ -857,7 +857,7 @@ SVGPathData::GetMarkerPositioningData(nsTArray *aMarks) const 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) { diff --git a/dom/svg/SVGPathData.h b/dom/svg/SVGPathData.h index 3fd26b6bc07..da15187a3c7 100644 --- a/dom/svg/SVGPathData.h +++ b/dom/svg/SVGPathData.h @@ -263,7 +263,7 @@ public: */ 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; diff --git a/dom/svg/SVGPathElement.cpp b/dom/svg/SVGPathElement.cpp index 25bc7e82525..cfea5966e10 100644 --- a/dom/svg/SVGPathElement.cpp +++ b/dom/svg/SVGPathElement.cpp @@ -335,8 +335,8 @@ SVGPathElement::GetMarkPoints(nsTArray *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) { diff --git a/dom/svg/SVGPathSegListSMILType.cpp b/dom/svg/SVGPathSegListSMILType.cpp index 0e94e747416..f8b67d02cec 100644 --- a/dom/svg/SVGPathSegListSMILType.cpp +++ b/dom/svg/SVGPathSegListSMILType.cpp @@ -23,7 +23,7 @@ namespace mozilla { 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; } @@ -67,10 +67,10 @@ 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"); @@ -125,8 +125,8 @@ CanInterpolate(const SVGPathDataAndInfo& aStart, 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; @@ -176,12 +176,12 @@ AddWeightedPathSegs(double aCoeff1, 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 @@ -189,8 +189,8 @@ AddWeightedPathSegs(double aCoeff1, 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]; } @@ -237,16 +237,16 @@ 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()) { @@ -264,7 +264,7 @@ AddWeightedPathSegLists(double aCoeff1, const SVGPathDataAndInfo& aList1, // record that our first operand is an identity value.) if (aResult.IsIdentity()) { DebugOnly 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! } @@ -276,10 +276,10 @@ AddWeightedPathSegLists(double aCoeff1, const SVGPathDataAndInfo& aList1, 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 @@ -307,7 +307,7 @@ ConvertPathSegmentData(SVGPathDataAndInfo::const_iterator& aStart, return; } - NS_ABORT_IF_FALSE + MOZ_ASSERT (SVGPathSegUtils::SameTypeModuloRelativeness(startType, endType), "Incompatible path segment types passed to ConvertPathSegmentData!"); @@ -315,7 +315,7 @@ ConvertPathSegmentData(SVGPathDataAndInfo::const_iterator& aStart, 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!"); @@ -388,8 +388,8 @@ ConvertAllPathSegmentData(SVGPathDataAndInfo::const_iterator aStart, 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 @@ -411,8 +411,8 @@ SVGPathSegListSMILType::Add(nsSMILValue& aDest, 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) { @@ -466,8 +466,8 @@ SVGPathSegListSMILType::Interpolate(const nsSMILValue& aStartVal, *static_cast(aEndVal.mU.mPtr); SVGPathDataAndInfo& result = *static_cast(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); @@ -483,7 +483,7 @@ SVGPathSegListSMILType::Interpolate(const nsSMILValue& aStartVal, // 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 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(), diff --git a/dom/svg/SVGPathSegUtils.cpp b/dom/svg/SVGPathSegUtils.cpp index 418b303e33c..00f48cdd39a 100644 --- a/dom/svg/SVGPathSegUtils.cpp +++ b/dom/svg/SVGPathSegUtils.cpp @@ -69,7 +69,7 @@ SVGPathSegUtils::GetValueAsString(const float* aSeg, nsAString& aValue) break; default: - NS_ABORT_IF_FALSE(false, "Unknown segment type"); + MOZ_ASSERT(false, "Unknown segment type"); aValue = MOZ_UTF16(""); return; } diff --git a/dom/svg/SVGPathSegUtils.h b/dom/svg/SVGPathSegUtils.h index dc6c8b4eeca..d0625b78c7b 100644 --- a/dom/svg/SVGPathSegUtils.h +++ b/dom/svg/SVGPathSegUtils.h @@ -115,19 +115,19 @@ public: */ 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(&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(&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 @@ -157,7 +157,7 @@ public: } 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 @@ -219,7 +219,7 @@ public: } 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. @@ -230,7 +230,7 @@ public: } 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"); @@ -243,7 +243,7 @@ public: } 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"); diff --git a/dom/svg/SVGPointList.h b/dom/svg/SVGPointList.h index 4ded628c77b..39bfc1a0382 100644 --- a/dom/svg/SVGPointList.h +++ b/dom/svg/SVGPointList.h @@ -121,14 +121,14 @@ private: } 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); } @@ -181,7 +181,7 @@ public: */ 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; diff --git a/dom/svg/SVGPointListSMILType.cpp b/dom/svg/SVGPointListSMILType.cpp index 14d4d69c6c2..51456ecf7ac 100644 --- a/dom/svg/SVGPointListSMILType.cpp +++ b/dom/svg/SVGPointListSMILType.cpp @@ -20,7 +20,7 @@ namespace mozilla { 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(); @@ -76,8 +76,8 @@ SVGPointListSMILType::Add(nsSMILValue& aDest, const SVGPointListAndInfo& valueToAdd = *static_cast(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; @@ -92,8 +92,8 @@ SVGPointListSMILType::Add(nsSMILValue& aDest, 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 @@ -163,9 +163,9 @@ SVGPointListSMILType::Interpolate(const nsSMILValue& aStartVal, SVGPointListAndInfo& result = *static_cast(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()) { @@ -180,7 +180,7 @@ SVGPointListSMILType::Interpolate(const nsSMILValue& aStartVal, 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]; } diff --git a/dom/svg/SVGSVGElement.cpp b/dom/svg/SVGSVGElement.cpp index 9d60f6c04af..9962c636758 100644 --- a/dom/svg/SVGSVGElement.cpp +++ b/dom/svg/SVGSVGElement.cpp @@ -685,9 +685,8 @@ 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; @@ -963,7 +962,7 @@ SVGSVGElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix, // 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; } @@ -1027,8 +1026,8 @@ SVGSVGElement::HasViewBoxRect() const 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 && @@ -1045,8 +1044,8 @@ SVGSVGElement::SetPreserveAspectRatioProperty(const SVGPreserveAspectRatio& aPAR pAROverridePtr, nsINode::DeleteProperty, 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) @@ -1079,8 +1078,8 @@ 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(); @@ -1109,8 +1108,8 @@ 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; @@ -1129,9 +1128,9 @@ SVGSVGElement::ClearImageOverridePreserveAspectRatio() 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 called on root node"); + MOZ_ASSERT(OwnerDoc()->IsBeingUsedAsImage(), + "Should only be called on image documents"); if (mImageNeedsTransformInvalidation) { InvalidateTransformNotifyFrame(); @@ -1147,8 +1146,8 @@ SVGSVGElement::SetViewBoxProperty(const nsSVGViewBoxRect& aViewBox) pViewBoxOverridePtr, nsINode::DeleteProperty, 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) @@ -1182,8 +1181,8 @@ SVGSVGElement::SetZoomAndPanProperty(uint16_t aValue) nsresult rv = SetProperty(nsGkAtoms::zoomAndPan, reinterpret_cast(aValue), nullptr, 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...?"); return NS_SUCCEEDED(rv); } @@ -1212,8 +1211,8 @@ SVGSVGElement::SetTransformProperty(const SVGTransformList& aTransform) pTransformOverridePtr, nsINode::DeleteProperty, 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) diff --git a/dom/svg/SVGStringList.h b/dom/svg/SVGStringList.h index 9a50abf303f..a85092edad2 100644 --- a/dom/svg/SVGStringList.h +++ b/dom/svg/SVGStringList.h @@ -112,14 +112,14 @@ private: } void ReplaceItem(uint32_t aIndex, const nsAString &aString) { - NS_ABORT_IF_FALSE(aIndex < mStrings.Length(), - "DOM wrapper caller should have raised INDEX_SIZE_ERR"); + MOZ_ASSERT(aIndex < mStrings.Length(), + "DOM wrapper caller should have raised INDEX_SIZE_ERR"); mStrings[aIndex] = aString; } void RemoveItem(uint32_t aIndex) { - NS_ABORT_IF_FALSE(aIndex < mStrings.Length(), - "DOM wrapper caller should have raised INDEX_SIZE_ERR"); + MOZ_ASSERT(aIndex < mStrings.Length(), + "DOM wrapper caller should have raised INDEX_SIZE_ERR"); mStrings.RemoveElementAt(aIndex); } diff --git a/dom/svg/SVGTransform.cpp b/dom/svg/SVGTransform.cpp index 35548be6a53..25444abbdd2 100644 --- a/dom/svg/SVGTransform.cpp +++ b/dom/svg/SVGTransform.cpp @@ -113,10 +113,9 @@ SVGTransform::SVGTransform(DOMSVGTransformList *aList, , mTransform(nullptr) { // 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 DOMSVGNumber!"); + MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGNumber!"); } SVGTransform::SVGTransform() @@ -301,21 +300,21 @@ SVGTransform::InsertingIntoList(DOMSVGTransformList *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; mTransform = nullptr; - NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGLength!"); + MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGLength!"); } void SVGTransform::RemovingFromList() { - NS_ABORT_IF_FALSE(!mTransform, - "Item in list also has another non-list value associated with it"); + MOZ_ASSERT(!mTransform, + "Item in list also has another non-list value associated with it"); mTransform = new nsSVGTransform(InternalItem()); mList = nullptr; @@ -356,8 +355,8 @@ SVGTransform::IndexIsValid() void SVGTransform::SetMatrix(const gfxMatrix& aMatrix) { - NS_ABORT_IF_FALSE(!mIsAnimValItem, - "Attempting to modify read-only transform"); + MOZ_ASSERT(!mIsAnimValItem, + "Attempting to modify read-only transform"); if (Transform().Type() == SVG_TRANSFORM_MATRIX && nsSVGTransform::MatricesEqual(Matrixgfx(), aMatrix)) { diff --git a/dom/svg/SVGTransformList.h b/dom/svg/SVGTransformList.h index 9f0d34afc7f..9522e2e640b 100644 --- a/dom/svg/SVGTransformList.h +++ b/dom/svg/SVGTransformList.h @@ -117,14 +117,14 @@ private: } void ReplaceItem(uint32_t aIndex, const nsSVGTransform& aTransform) { - 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] = aTransform; } 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); } diff --git a/dom/svg/SVGTransformableElement.cpp b/dom/svg/SVGTransformableElement.cpp index f6f09a5b285..ae5c7832b8c 100644 --- a/dom/svg/SVGTransformableElement.cpp +++ b/dom/svg/SVGTransformableElement.cpp @@ -69,8 +69,8 @@ SVGTransformableElement::GetAttributeChangeHint(const nsIAtom* aAttribute, // Reconstruct the frame tree to handle stacking context changes: NS_UpdateHint(retval, nsChangeHint_ReconstructFrame); } else { - NS_ABORT_IF_FALSE(aModType == nsIDOMMutationEvent::MODIFICATION, - "Unknown modification type."); + MOZ_ASSERT(aModType == nsIDOMMutationEvent::MODIFICATION, + "Unknown modification type."); // We just assume the old and new transforms are different. NS_UpdateHint(retval, NS_CombineHint(nsChangeHint_UpdatePostTransformOverflow, nsChangeHint_UpdateTransformLayer)); @@ -102,8 +102,8 @@ SVGTransformableElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix, return result; } - NS_ABORT_IF_FALSE(aWhich == eAllTransforms || aWhich == eUserSpaceToParent, - "Unknown TransformTypes"); + MOZ_ASSERT(aWhich == eAllTransforms || aWhich == eUserSpaceToParent, + "Unknown TransformTypes"); // animateMotion's resulting transform is supposed to apply *on top of* // any transformations from the |transform| attribute. So since we're diff --git a/dom/svg/SVGUseElement.cpp b/dom/svg/SVGUseElement.cpp index b7ceed08598..aabf3ff2ff7 100644 --- a/dom/svg/SVGUseElement.cpp +++ b/dom/svg/SVGUseElement.cpp @@ -438,7 +438,7 @@ SVGUseElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix, if (aWhich == eChildToUserSpace) { return toUserSpace * aMatrix; } - NS_ABORT_IF_FALSE(aWhich == eAllTransforms, "Unknown TransformTypes"); + MOZ_ASSERT(aWhich == eAllTransforms, "Unknown TransformTypes"); return toUserSpace * fromUserSpace; } diff --git a/dom/svg/SVGViewBoxSMILType.cpp b/dom/svg/SVGViewBoxSMILType.cpp index 3725c235a03..839a29cbe27 100644 --- a/dom/svg/SVGViewBoxSMILType.cpp +++ b/dom/svg/SVGViewBoxSMILType.cpp @@ -16,7 +16,7 @@ namespace mozilla { void SVGViewBoxSMILType::Init(nsSMILValue& aValue) const { - NS_ABORT_IF_FALSE(aValue.IsNull(), "Unexpected value type"); + MOZ_ASSERT(aValue.IsNull(), "Unexpected value type"); aValue.mU.mPtr = new nsSVGViewBoxRect(); aValue.mType = this; diff --git a/dom/svg/nsISVGPoint.cpp b/dom/svg/nsISVGPoint.cpp index 1701ec0160b..4d94ce13925 100644 --- a/dom/svg/nsISVGPoint.cpp +++ b/dom/svg/nsISVGPoint.cpp @@ -52,14 +52,14 @@ nsISVGPoint::InsertingIntoList(DOMSVGPointList *aList, uint32_t aListIndex, bool aIsAnimValItem) { - NS_ABORT_IF_FALSE(!HasOwner(), "Inserting item that already has an owner"); + MOZ_ASSERT(!HasOwner(), "Inserting item that already has an owner"); mList = aList; mListIndex = aListIndex; mIsReadonly = false; mIsAnimValItem = aIsAnimValItem; - NS_ABORT_IF_FALSE(IndexIsValid(), "Bad index for DOMSVGPoint!"); + MOZ_ASSERT(IndexIsValid(), "Bad index for DOMSVGPoint!"); } void @@ -67,7 +67,7 @@ nsISVGPoint::RemovingFromList() { mPt = InternalItem(); mList = nullptr; - NS_ABORT_IF_FALSE(!mIsReadonly, "mIsReadonly set for list"); + MOZ_ASSERT(!mIsReadonly, "mIsReadonly set for list"); mIsAnimValItem = false; } diff --git a/dom/svg/nsSVGAnimatedTransformList.cpp b/dom/svg/nsSVGAnimatedTransformList.cpp index 3f82a63d663..bf35c7121c5 100644 --- a/dom/svg/nsSVGAnimatedTransformList.cpp +++ b/dom/svg/nsSVGAnimatedTransformList.cpp @@ -172,8 +172,8 @@ nsSVGAnimatedTransformList::SMILAnimatedTransformList::ValueFromString( bool& aPreventCachingOfSandwich) const { NS_ENSURE_TRUE(aSrcElement, NS_ERROR_FAILURE); - NS_ABORT_IF_FALSE(aValue.IsNull(), - "aValue should have been cleared before calling ValueFromString"); + MOZ_ASSERT(aValue.IsNull(), + "aValue should have been cleared before calling ValueFromString"); const nsAttrValue* typeAttr = aSrcElement->GetAnimAttr(nsGkAtoms::type); const nsIAtom* transformType = nsGkAtoms::translate; // default val @@ -198,7 +198,7 @@ nsSVGAnimatedTransformList::SMILAnimatedTransformList::ParseValue( const nsIAtom* aTransformType, nsSMILValue& aResult) { - NS_ABORT_IF_FALSE(aResult.IsNull(), "Unexpected type for SMIL value"); + MOZ_ASSERT(aResult.IsNull(), "Unexpected type for SMIL value"); static_assert(SVGTransformSMILData::NUM_SIMPLE_PARAMS == 3, "nsSVGSMILTransform constructor should be expecting array " @@ -292,9 +292,8 @@ nsresult nsSVGAnimatedTransformList::SMILAnimatedTransformList::SetAnimValue( const nsSMILValue& aNewAnimValue) { - NS_ABORT_IF_FALSE( - aNewAnimValue.mType == SVGTransformListSMILType::Singleton(), - "Unexpected type to assign animated value"); + MOZ_ASSERT(aNewAnimValue.mType == SVGTransformListSMILType::Singleton(), + "Unexpected type to assign animated value"); SVGTransformList animVal; if (!SVGTransformListSMILType::GetTransforms(aNewAnimValue, animVal.mItems)) { diff --git a/dom/svg/nsSVGAttrTearoffTable.h b/dom/svg/nsSVGAttrTearoffTable.h index fc8827e09b3..350e638b476 100644 --- a/dom/svg/nsSVGAttrTearoffTable.h +++ b/dom/svg/nsSVGAttrTearoffTable.h @@ -25,7 +25,7 @@ public: #ifdef DEBUG ~nsSVGAttrTearoffTable() { - NS_ABORT_IF_FALSE(!mTable, "Tear-off objects remain in hashtable at shutdown."); + MOZ_ASSERT(!mTable, "Tear-off objects remain in hashtable at shutdown."); } #endif @@ -55,8 +55,8 @@ nsSVGAttrTearoffTable::GetTearoff(SimpleType* aSimple) bool found = #endif mTable->Get(aSimple, &tearoff); - NS_ABORT_IF_FALSE(!found || tearoff, - "NULL pointer stored in attribute tear-off map"); + MOZ_ASSERT(!found || tearoff, + "null pointer stored in attribute tear-off map"); return tearoff; } @@ -73,7 +73,7 @@ nsSVGAttrTearoffTable::AddTearoff(SimpleType* aSimple, // We shouldn't be adding a tear-off if there already is one. If that happens, // something is wrong. if (mTable->Get(aSimple, nullptr)) { - NS_ABORT_IF_FALSE(false, "There is already a tear-off for this object."); + MOZ_ASSERT(false, "There is already a tear-off for this object."); return; } diff --git a/dom/svg/nsSVGElement.cpp b/dom/svg/nsSVGElement.cpp index df0e5be5c0d..78a0f64124d 100644 --- a/dom/svg/nsSVGElement.cpp +++ b/dom/svg/nsSVGElement.cpp @@ -288,8 +288,8 @@ nsSVGElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName, // whose data it points to (by virtue of being stored in // mAttrsAndChildren->mMappedAttributes, meaning it's shared between // elements), the pointer will dangle. See bug 724680. - NS_ABORT_IF_FALSE(!mAttrsAndChildren.HasMappedAttrs(), - "Unexpected use of nsMappedAttributes within SVG"); + MOZ_ASSERT(!mAttrsAndChildren.HasMappedAttrs(), + "Unexpected use of nsMappedAttributes within SVG"); // If this is an svg presentation attribute we need to map it into // the content stylerule. @@ -301,8 +301,8 @@ nsSVGElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName, } 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(GetEventNameForAttr(aName), aValue->GetStringValue()); NS_ENSURE_SUCCESS(rv, rv); @@ -1176,9 +1176,9 @@ MappedAttrParser::MappedAttrParser(css::Loader* aLoader, MappedAttrParser::~MappedAttrParser() { - NS_ABORT_IF_FALSE(!mDecl, - "If mDecl was initialized, it should have been converted " - "into a style rule (and had its pointer cleared)"); + MOZ_ASSERT(!mDecl, + "If mDecl was initialized, it should have been converted " + "into a style rule (and had its pointer cleared)"); } void @@ -1200,8 +1200,8 @@ MappedAttrParser::ParseMappedAttrValue(nsIAtom* aMappedAttrName, mNodePrincipal, mDecl, &changed, false, true); return; } - NS_ABORT_IF_FALSE(aMappedAttrName == nsGkAtoms::lang, - "Only 'lang' should be unrecognized!"); + MOZ_ASSERT(aMappedAttrName == nsGkAtoms::lang, + "Only 'lang' should be unrecognized!"); // nsCSSParser doesn't know about 'lang', so we need to handle it specially. if (aMappedAttrName == nsGkAtoms::lang) { propertyID = eCSSProperty__x_lang; @@ -1315,19 +1315,18 @@ ReleaseStyleRule(void* aObject, /* unused */ void* aPropertyValue, void* aData /* unused */) { - NS_ABORT_IF_FALSE(aPropertyName == SMIL_MAPPED_ATTR_STYLERULE_ATOM, - "unexpected property name, for " - "animated content style rule"); + MOZ_ASSERT(aPropertyName == SMIL_MAPPED_ATTR_STYLERULE_ATOM, + "unexpected property name, for animated content style rule"); css::StyleRule* styleRule = static_cast(aPropertyValue); - NS_ABORT_IF_FALSE(styleRule, "unexpected null style rule"); + MOZ_ASSERT(styleRule, "unexpected null style rule"); styleRule->Release(); } void nsSVGElement::UpdateAnimatedContentStyleRule() { - NS_ABORT_IF_FALSE(!GetAnimatedContentStyleRule(), - "Animated content style rule already set"); + MOZ_ASSERT(!GetAnimatedContentStyleRule(), + "Animated content style rule already set"); nsIDocument* doc = OwnerDoc(); if (!doc) { @@ -1352,8 +1351,8 @@ nsSVGElement::UpdateAnimatedContentStyleRule() animContentStyleRule.get(), ReleaseStyleRule); unused << animContentStyleRule.forget(); - NS_ABORT_IF_FALSE(rv == NS_OK, - "SetProperty failed (or overwrote something)"); + MOZ_ASSERT(rv == NS_OK, + "SetProperty failed (or overwrote something)"); } } @@ -1434,7 +1433,7 @@ nsSVGElement::WillChangeValue(nsIAtom* aName) // SVG elements aren't expected to overload BeforeSetAttr in such a way that // it may fail. So long as this is the case we don't need to check and pass on // the return value which simplifies the calling code significantly. - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Unexpected failure from BeforeSetAttr"); + MOZ_ASSERT(NS_SUCCEEDED(rv), "Unexpected failure from BeforeSetAttr"); // We only need to set the old value if we have listeners since otherwise it // isn't used. @@ -1577,7 +1576,7 @@ nsSVGElement::SetLength(nsIAtom* aName, const nsSVGLength2 &aLength) return; } } - NS_ABORT_IF_FALSE(false, "no length found to set"); + MOZ_ASSERT(false, "no length found to set"); } nsAttrValue @@ -1628,7 +1627,7 @@ nsSVGElement::GetAnimatedLength(const nsIAtom *aAttrName) return &lengthInfo.mLengths[i]; } } - NS_ABORT_IF_FALSE(false, "no matching length found"); + MOZ_ASSERT(false, "no matching length found"); return nullptr; } @@ -1759,7 +1758,7 @@ nsSVGElement::GetNumberListInfo() void nsSVGElement::NumberListAttributesInfo::Reset(uint8_t aAttrEnum) { - NS_ABORT_IF_FALSE(aAttrEnum < mNumberListCount, "Bad attr enum"); + MOZ_ASSERT(aAttrEnum < mNumberListCount, "Bad attr enum"); mNumberLists[aAttrEnum].ClearBaseValue(aAttrEnum); // caller notifies } @@ -1776,10 +1775,10 @@ nsSVGElement::DidChangeNumberList(uint8_t aAttrEnum, { NumberListAttributesInfo info = GetNumberListInfo(); - NS_ABORT_IF_FALSE(info.mNumberListCount > 0, - "DidChangeNumberList on element with no number list attribs"); - NS_ABORT_IF_FALSE(aAttrEnum < info.mNumberListCount, - "aAttrEnum out of range"); + MOZ_ASSERT(info.mNumberListCount > 0, + "DidChangeNumberList on element with no number list attribs"); + MOZ_ASSERT(aAttrEnum < info.mNumberListCount, + "aAttrEnum out of range"); nsAttrValue newValue; newValue.SetTo(info.mNumberLists[aAttrEnum].GetBaseValue(), nullptr); @@ -1795,7 +1794,7 @@ nsSVGElement::DidAnimateNumberList(uint8_t aAttrEnum) if (frame) { NumberListAttributesInfo info = GetNumberListInfo(); - NS_ABORT_IF_FALSE(aAttrEnum < info.mNumberListCount, "aAttrEnum out of range"); + MOZ_ASSERT(aAttrEnum < info.mNumberListCount, "aAttrEnum out of range"); frame->AttributeChanged(kNameSpaceID_None, *info.mNumberListInfo[aAttrEnum].mName, @@ -1810,7 +1809,7 @@ nsSVGElement::GetAnimatedNumberList(uint8_t aAttrEnum) if (aAttrEnum < info.mNumberListCount) { return &(info.mNumberLists[aAttrEnum]); } - NS_ABORT_IF_FALSE(false, "Bad attrEnum"); + MOZ_ASSERT(false, "Bad attrEnum"); return nullptr; } @@ -1823,23 +1822,23 @@ nsSVGElement::GetAnimatedNumberList(nsIAtom *aAttrName) return &info.mNumberLists[i]; } } - NS_ABORT_IF_FALSE(false, "Bad caller"); + MOZ_ASSERT(false, "Bad caller"); return nullptr; } nsAttrValue nsSVGElement::WillChangePointList() { - NS_ABORT_IF_FALSE(GetPointListAttrName(), - "Changing non-existent point list?"); + MOZ_ASSERT(GetPointListAttrName(), + "Changing non-existent point list?"); return WillChangeValue(GetPointListAttrName()); } void nsSVGElement::DidChangePointList(const nsAttrValue& aEmptyOrOldValue) { - NS_ABORT_IF_FALSE(GetPointListAttrName(), - "Changing non-existent point list?"); + MOZ_ASSERT(GetPointListAttrName(), + "Changing non-existent point list?"); nsAttrValue newValue; newValue.SetTo(GetAnimatedPointList()->GetBaseValue(), nullptr); @@ -1850,8 +1849,8 @@ nsSVGElement::DidChangePointList(const nsAttrValue& aEmptyOrOldValue) void nsSVGElement::DidAnimatePointList() { - NS_ABORT_IF_FALSE(GetPointListAttrName(), - "Animating non-existent path data?"); + MOZ_ASSERT(GetPointListAttrName(), + "Animating non-existent path data?"); ClearAnyCachedPath(); @@ -1867,16 +1866,16 @@ nsSVGElement::DidAnimatePointList() nsAttrValue nsSVGElement::WillChangePathSegList() { - NS_ABORT_IF_FALSE(GetPathDataAttrName(), - "Changing non-existent path seg list?"); + MOZ_ASSERT(GetPathDataAttrName(), + "Changing non-existent path seg list?"); return WillChangeValue(GetPathDataAttrName()); } void nsSVGElement::DidChangePathSegList(const nsAttrValue& aEmptyOrOldValue) { - NS_ABORT_IF_FALSE(GetPathDataAttrName(), - "Changing non-existent path seg list?"); + MOZ_ASSERT(GetPathDataAttrName(), + "Changing non-existent path seg list?"); nsAttrValue newValue; newValue.SetTo(GetAnimPathSegList()->GetBaseValue(), nullptr); @@ -1887,8 +1886,8 @@ nsSVGElement::DidChangePathSegList(const nsAttrValue& aEmptyOrOldValue) void nsSVGElement::DidAnimatePathSegList() { - NS_ABORT_IF_FALSE(GetPathDataAttrName(), - "Animating non-existent path data?"); + MOZ_ASSERT(GetPathDataAttrName(), + "Animating non-existent path data?"); ClearAnyCachedPath(); @@ -2336,8 +2335,8 @@ nsSVGElement::WillChangeTransformList() void nsSVGElement::DidChangeTransformList(const nsAttrValue& aEmptyOrOldValue) { - NS_ABORT_IF_FALSE(GetTransformListAttrName(), - "Changing non-existent transform list?"); + MOZ_ASSERT(GetTransformListAttrName(), + "Changing non-existent transform list?"); // The transform attribute is being set, so we must ensure that the // SVGAnimatedTransformList is/has been allocated: @@ -2350,8 +2349,8 @@ nsSVGElement::DidChangeTransformList(const nsAttrValue& aEmptyOrOldValue) void nsSVGElement::DidAnimateTransformList(int32_t aModType) { - NS_ABORT_IF_FALSE(GetTransformListAttrName(), - "Animating non-existent transform data?"); + MOZ_ASSERT(GetTransformListAttrName(), + "Animating non-existent transform data?"); nsIFrame* frame = GetPrimaryFrame(); @@ -2650,7 +2649,7 @@ nsSVGElement::GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName) NumberListAttributesInfo info = GetNumberListInfo(); for (uint32_t i = 0; i < info.mNumberListCount; i++) { if (aName == *info.mNumberListInfo[i].mName) { - NS_ABORT_IF_FALSE(i <= UCHAR_MAX, "Too many attributes"); + MOZ_ASSERT(i <= UCHAR_MAX, "Too many attributes"); return info.mNumberLists[i].ToSMILAttr(this, uint8_t(i)); } } @@ -2661,7 +2660,7 @@ nsSVGElement::GetAnimatedAttr(int32_t aNamespaceID, nsIAtom* aName) LengthListAttributesInfo info = GetLengthListInfo(); for (uint32_t i = 0; i < info.mLengthListCount; i++) { if (aName == *info.mLengthListInfo[i].mName) { - NS_ABORT_IF_FALSE(i <= UCHAR_MAX, "Too many attributes"); + MOZ_ASSERT(i <= UCHAR_MAX, "Too many attributes"); return info.mLengthLists[i].ToSMILAttr(this, uint8_t(i), info.mLengthListInfo[i].mAxis, diff --git a/dom/svg/nsSVGEnum.cpp b/dom/svg/nsSVGEnum.cpp index ca7c0b59d54..c8a949d1fcc 100644 --- a/dom/svg/nsSVGEnum.cpp +++ b/dom/svg/nsSVGEnum.cpp @@ -185,8 +185,8 @@ nsSVGEnum::SMILEnum::SetAnimValue(const nsSMILValue& aValue) NS_ASSERTION(aValue.mType == SMILEnumType::Singleton(), "Unexpected type to assign animated value"); if (aValue.mType == SMILEnumType::Singleton()) { - NS_ABORT_IF_FALSE(aValue.mU.mUint <= USHRT_MAX, - "Very large enumerated value - too big for uint16_t"); + MOZ_ASSERT(aValue.mU.mUint <= USHRT_MAX, + "Very large enumerated value - too big for uint16_t"); mVal->SetAnimValue(uint16_t(aValue.mU.mUint), mSVGElement); } return NS_OK; diff --git a/dom/svg/nsSVGTransform.cpp b/dom/svg/nsSVGTransform.cpp index f1739d73e65..1b5a5c54b63 100644 --- a/dom/svg/nsSVGTransform.cpp +++ b/dom/svg/nsSVGTransform.cpp @@ -155,10 +155,9 @@ nsSVGTransform::SetSkewY(float aAngle) SVGTransformSMILData::SVGTransformSMILData(const nsSVGTransform& aTransform) : mTransformType(aTransform.Type()) { - NS_ABORT_IF_FALSE( - mTransformType >= SVG_TRANSFORM_MATRIX && - mTransformType <= SVG_TRANSFORM_SKEWY, - "Unexpected transform type"); + MOZ_ASSERT(mTransformType >= SVG_TRANSFORM_MATRIX && + mTransformType <= SVG_TRANSFORM_SKEWY, + "Unexpected transform type"); for (uint32_t i = 0; i < NUM_STORED_PARAMS; ++i) { mParams[i] = 0.f; diff --git a/dom/svg/nsSVGTransform.h b/dom/svg/nsSVGTransform.h index 5610af140df..d3f5ac0a997 100644 --- a/dom/svg/nsSVGTransform.h +++ b/dom/svg/nsSVGTransform.h @@ -126,9 +126,8 @@ public: explicit SVGTransformSMILData(uint16_t aType) : mTransformType(aType) { - NS_ABORT_IF_FALSE(aType >= SVG_TRANSFORM_MATRIX && - aType <= SVG_TRANSFORM_SKEWY, - "Unexpected transform type"); + MOZ_ASSERT(aType >= SVG_TRANSFORM_MATRIX && aType <= SVG_TRANSFORM_SKEWY, + "Unexpected transform type"); for (uint32_t i = 0; i < NUM_STORED_PARAMS; ++i) { mParams[i] = 0.f; } @@ -137,9 +136,8 @@ public: SVGTransformSMILData(uint16_t aType, float (&aParams)[NUM_SIMPLE_PARAMS]) : mTransformType(aType) { - NS_ABORT_IF_FALSE(aType >= SVG_TRANSFORM_TRANSLATE && - aType <= SVG_TRANSFORM_SKEWY, - "Expected 'simple' transform type"); + MOZ_ASSERT(aType >= SVG_TRANSFORM_TRANSLATE && aType <= SVG_TRANSFORM_SKEWY, + "Expected 'simple' transform type"); for (uint32_t i = 0; i < NUM_SIMPLE_PARAMS; ++i) { mParams[i] = aParams[i]; } diff --git a/dom/xml/CDATASection.h b/dom/xml/CDATASection.h index 79f06576d79..47c03c8670a 100644 --- a/dom/xml/CDATASection.h +++ b/dom/xml/CDATASection.h @@ -19,8 +19,8 @@ class CDATASection MOZ_FINAL : public Text, private: void Init() { - NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::CDATA_SECTION_NODE, - "Bad NodeType in aNodeInfo"); + MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::CDATA_SECTION_NODE, + "Bad NodeType in aNodeInfo"); } virtual ~CDATASection(); diff --git a/dom/xml/ProcessingInstruction.cpp b/dom/xml/ProcessingInstruction.cpp index ac70e928cc4..930c721c9da 100644 --- a/dom/xml/ProcessingInstruction.cpp +++ b/dom/xml/ProcessingInstruction.cpp @@ -49,9 +49,8 @@ ProcessingInstruction::ProcessingInstruction(already_AddRefedNodeType() == - nsIDOMNode::PROCESSING_INSTRUCTION_NODE, - "Bad NodeType in aNodeInfo"); + MOZ_ASSERT(mNodeInfo->NodeType() == nsIDOMNode::PROCESSING_INSTRUCTION_NODE, + "Bad NodeType in aNodeInfo"); SetTextInternal(0, mText.GetLength(), aData.BeginReading(), aData.Length(), diff --git a/dom/xslt/xpath/txXPCOMExtensionFunction.cpp b/dom/xslt/xpath/txXPCOMExtensionFunction.cpp index 63ece9ad77c..75b5f15140b 100644 --- a/dom/xslt/xpath/txXPCOMExtensionFunction.cpp +++ b/dom/xslt/xpath/txXPCOMExtensionFunction.cpp @@ -325,10 +325,10 @@ txParamArrayHolder::~txParamArrayHolder() if (variant.type.TagPart() == nsXPTType::T_DOMSTRING) delete (nsAString*)variant.val.p; else { - NS_ABORT_IF_FALSE(variant.type.TagPart() == nsXPTType::T_INTERFACE || - variant.type.TagPart() == nsXPTType::T_INTERFACE_IS, - "We only support cleanup of strings and interfaces " - "here, and this looks like neither!"); + MOZ_ASSERT(variant.type.TagPart() == nsXPTType::T_INTERFACE || + variant.type.TagPart() == nsXPTType::T_INTERFACE_IS, + "We only support cleanup of strings and interfaces " + "here, and this looks like neither!"); static_cast(variant.val.p)->Release(); } } diff --git a/dom/xslt/xslt/txMozillaXMLOutput.cpp b/dom/xslt/xslt/txMozillaXMLOutput.cpp index 132f60de949..d72910eec48 100644 --- a/dom/xslt/xslt/txMozillaXMLOutput.cpp +++ b/dom/xslt/xslt/txMozillaXMLOutput.cpp @@ -300,7 +300,7 @@ txMozillaXMLOutput::endElement() } else if ((ns == kNameSpaceID_XHTML || ns == kNameSpaceID_SVG) && localName == nsGkAtoms::script) { nsCOMPtr sele = do_QueryInterface(element); - NS_ABORT_IF_FALSE(sele, "script elements need to implement nsIScriptElement"); + MOZ_ASSERT(sele, "script elements need to implement nsIScriptElement"); bool block = sele->AttemptToExecute(); // If the act of insertion evaluated the script, we're fine. // Else, add this script element to the array of loading scripts. diff --git a/dom/xul/XULDocument.cpp b/dom/xul/XULDocument.cpp index ee8d956cf89..894aeefd154 100644 --- a/dom/xul/XULDocument.cpp +++ b/dom/xul/XULDocument.cpp @@ -927,7 +927,7 @@ XULDocument::AttributeWillChange(nsIDocument* aDocument, Element* aElement, int32_t aNameSpaceID, nsIAtom* aAttribute, int32_t aModType) { - NS_ABORT_IF_FALSE(aElement, "Null content!"); + MOZ_ASSERT(aElement, "Null content!"); NS_PRECONDITION(aAttribute, "Must have an attribute that's changing!"); // XXXbz check aNameSpaceID, dammit! diff --git a/editor/libeditor/nsPlaintextEditor.cpp b/editor/libeditor/nsPlaintextEditor.cpp index 3ec22753619..554d6396537 100644 --- a/editor/libeditor/nsPlaintextEditor.cpp +++ b/editor/libeditor/nsPlaintextEditor.cpp @@ -840,7 +840,7 @@ nsPlaintextEditor::BeginIMEComposition(WidgetCompositionEvent* aEvent) nsresult nsPlaintextEditor::UpdateIMEComposition(nsIDOMEvent* aDOMTextEvent) { - NS_ABORT_IF_FALSE(aDOMTextEvent, "aDOMTextEvent must not be nullptr"); + MOZ_ASSERT(aDOMTextEvent, "aDOMTextEvent must not be nullptr"); WidgetCompositionEvent* compositionChangeEvent = aDOMTextEvent->GetInternalNSEvent()->AsCompositionEvent(); diff --git a/embedding/components/printingui/win/nsPrintDialogUtil.cpp b/embedding/components/printingui/win/nsPrintDialogUtil.cpp index 3bf32fe59e6..2370edb445a 100644 --- a/embedding/components/printingui/win/nsPrintDialogUtil.cpp +++ b/embedding/components/printingui/win/nsPrintDialogUtil.cpp @@ -494,8 +494,8 @@ static HWND CreateGroupBox(HINSTANCE aHInst, // Localizes and initializes the radio buttons and group static void InitializeExtendedDialog(HWND hdlg, int16_t aHowToEnableFrameUI) { - NS_ABORT_IF_FALSE(aHowToEnableFrameUI != nsIPrintSettings::kFrameEnableNone, - "should not be called"); + MOZ_ASSERT(aHowToEnableFrameUI != nsIPrintSettings::kFrameEnableNone, + "should not be called"); // Localize the new controls in the print dialog nsCOMPtr strBundle; diff --git a/gfx/gl/GLContextProviderGLX.cpp b/gfx/gl/GLContextProviderGLX.cpp index 4587b7d2e1d..bdbc984370d 100644 --- a/gfx/gl/GLContextProviderGLX.cpp +++ b/gfx/gl/GLContextProviderGLX.cpp @@ -834,8 +834,9 @@ GLContextGLX::~GLContextGLX() bool success = #endif mGLX->xMakeCurrent(mDisplay, None, nullptr); - NS_ABORT_IF_FALSE(success, - "glXMakeCurrent failed to release GL context before we call glXDestroyContext!"); + MOZ_ASSERT(success, + "glXMakeCurrent failed to release GL context before we call " + "glXDestroyContext!"); mGLX->xDestroyContext(mDisplay, mContext); @@ -1125,7 +1126,8 @@ CreateOffscreenPixmapContext(const gfxIntSize& size) } MOZ_ASSERT(numConfigs > 0, - "glXChooseFBConfig() failed to match our requested format and violated its spec!"); + "glXChooseFBConfig() failed to match our requested format and " + "violated its spec!"); int visid = None; int chosenIndex = 0; diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 0c4422d9682..a122a561e6e 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -2020,8 +2020,8 @@ LayerManager::InitLog() /*static*/ bool LayerManager::IsLogEnabled() { - NS_ABORT_IF_FALSE(!!sLog, - "layer manager must be created before logging is allowed"); + MOZ_ASSERT(!!sLog, + "layer manager must be created before logging is allowed"); return PR_LOG_TEST(sLog, PR_LOG_DEBUG); } diff --git a/gfx/layers/TiledLayerBuffer.h b/gfx/layers/TiledLayerBuffer.h index 5c9deb213f3..a61e3ef7f20 100644 --- a/gfx/layers/TiledLayerBuffer.h +++ b/gfx/layers/TiledLayerBuffer.h @@ -12,7 +12,7 @@ #include // for uint16_t, uint32_t #include // for int32_t #include "gfxPlatform.h" // for GetTileWidth/GetTileHeight -#include "nsDebug.h" // for NS_ABORT_IF_FALSE +#include "nsDebug.h" // for NS_ASSERTION #include "nsPoint.h" // for nsIntPoint #include "nsRect.h" // for nsIntRect #include "nsRegion.h" // for nsIntRegion @@ -446,12 +446,12 @@ TiledLayerBuffer::Update(const nsIntRegion& aNewValidRegion, } } - NS_ABORT_IF_FALSE(aNewValidRegion.Contains(aPaintRegion), "Painting a region outside the visible region"); + MOZ_ASSERT(aNewValidRegion.Contains(aPaintRegion), "Painting a region outside the visible region"); #ifdef DEBUG nsIntRegion oldAndPainted(oldValidRegion); oldAndPainted.Or(oldAndPainted, aPaintRegion); #endif - NS_ABORT_IF_FALSE(oldAndPainted.Contains(newValidRegion), "newValidRegion has not been fully painted"); + MOZ_ASSERT(oldAndPainted.Contains(newValidRegion), "newValidRegion has not been fully painted"); nsIntRegion regionToPaint(aPaintRegion); @@ -510,9 +510,9 @@ TiledLayerBuffer::Update(const nsIntRegion& aNewValidRegion, int tileX = floor_div(x - newBufferOrigin.x, scaledTileSize.width); int tileY = floor_div(y - newBufferOrigin.y, scaledTileSize.height); int index = tileX * mRetainedHeight + tileY; - NS_ABORT_IF_FALSE(index >= 0 && - static_cast(index) < newRetainedTiles.Length(), - "index out of range"); + MOZ_ASSERT(index >= 0 && + static_cast(index) < newRetainedTiles.Length(), + "index out of range"); Tile newTile = newRetainedTiles[index]; @@ -551,7 +551,7 @@ TiledLayerBuffer::Update(const nsIntRegion& aNewValidRegion, } // At this point, oldTileCount should be zero - NS_ABORT_IF_FALSE(oldTileCount == 0, "Failed to release old tiles"); + MOZ_ASSERT(oldTileCount == 0, "Failed to release old tiles"); mValidRegion = aNewValidRegion; mPaintedRegion.Or(mPaintedRegion, aPaintRegion); diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp index 657316ac98e..95f64f0d2f1 100644 --- a/gfx/layers/basic/BasicLayerManager.cpp +++ b/gfx/layers/basic/BasicLayerManager.cpp @@ -805,7 +805,7 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget, gfxMatrix transform; // Will return an identity matrix for 3d transforms, and is handled separately below. bool is2D = paintLayerContext.Setup2DTransform(); - NS_ABORT_IF_FALSE(is2D || needsGroup || !container, "Must PushGroup for 3d transforms!"); + MOZ_ASSERT(is2D || needsGroup || !container, "Must PushGroup for 3d transforms!"); bool needsSaveRestore = needsGroup || clipRect || needsClipToVisibleRegion || !is2D; @@ -865,8 +865,8 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget, // Temporary fast fix for bug 725886 // Revert these changes when 725886 is ready - NS_ABORT_IF_FALSE(untransformedDT, - "We should always allocate an untransformed surface with 3d transforms!"); + MOZ_ASSERT(untransformedDT, + "We should always allocate an untransformed surface with 3d transforms!"); gfxRect destRect; #ifdef DEBUG if (aLayer->GetDebugColorIndex() != 0) { diff --git a/gfx/layers/basic/BasicLayersImpl.cpp b/gfx/layers/basic/BasicLayersImpl.cpp index b1bf95f9c29..82c469859a4 100644 --- a/gfx/layers/basic/BasicLayersImpl.cpp +++ b/gfx/layers/basic/BasicLayersImpl.cpp @@ -183,8 +183,8 @@ bool ShouldShadow(Layer* aLayer) { if (!ToShadowable(aLayer)) { - NS_ABORT_IF_FALSE(aLayer->GetType() == Layer::TYPE_READBACK, - "Only expect not to shadow ReadbackLayers"); + MOZ_ASSERT(aLayer->GetType() == Layer::TYPE_READBACK, + "Only expect not to shadow ReadbackLayers"); return false; } return true; diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp index ec8c96e25c9..8b84bb47b6a 100644 --- a/gfx/layers/client/ClientLayerManager.cpp +++ b/gfx/layers/client/ClientLayerManager.cpp @@ -185,7 +185,7 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget) NS_ASSERTION(!InTransaction(), "Nested transactions not allowed"); mPhase = PHASE_CONSTRUCTION; - NS_ABORT_IF_FALSE(mKeepAlive.IsEmpty(), "uncommitted txn?"); + MOZ_ASSERT(mKeepAlive.IsEmpty(), "uncommitted txn?"); nsRefPtr targetContext = aTarget; // If the last transaction was incomplete (a failed DoEmptyTransaction), @@ -644,11 +644,11 @@ ClientLayerManager::ForwardTransaction(bool aScheduleComposite) ShadowableLayer* ClientLayerManager::Hold(Layer* aLayer) { - NS_ABORT_IF_FALSE(HasShadowManager(), - "top-level tree, no shadow tree to remote to"); + MOZ_ASSERT(HasShadowManager(), + "top-level tree, no shadow tree to remote to"); ShadowableLayer* shadowable = ClientLayer::ToClientLayer(aLayer); - NS_ABORT_IF_FALSE(shadowable, "trying to remote an unshadowable layer"); + MOZ_ASSERT(shadowable, "trying to remote an unshadowable layer"); mKeepAlive.AppendElement(aLayer); return shadowable; diff --git a/gfx/layers/client/ClientLayerManager.h b/gfx/layers/client/ClientLayerManager.h index df3943d5abc..43580503ddf 100644 --- a/gfx/layers/client/ClientLayerManager.h +++ b/gfx/layers/client/ClientLayerManager.h @@ -19,7 +19,6 @@ #include "mozilla/layers/APZTestData.h" // for APZTestData #include "nsAutoPtr.h" // for nsRefPtr #include "nsCOMPtr.h" // for already_AddRefed -#include "nsDebug.h" // for NS_ABORT_IF_FALSE #include "nsIObserver.h" // for nsIObserver #include "nsISupportsImpl.h" // for Layer::Release, etc #include "nsRect.h" // for nsIntRect @@ -358,7 +357,7 @@ public: void SetShadow(PLayerChild* aShadow) { - NS_ABORT_IF_FALSE(!mShadow, "can't have two shadows (yet)"); + MOZ_ASSERT(!mShadow, "can't have two shadows (yet)"); mShadow = aShadow; } @@ -396,7 +395,7 @@ CreateShadowFor(ClientLayer* aLayer, { PLayerChild* shadow = aMgr->AsShadowForwarder()->ConstructShadowFor(aLayer); // XXX error handling - NS_ABORT_IF_FALSE(shadow, "failed to create shadow"); + MOZ_ASSERT(shadow, "failed to create shadow"); aLayer->SetShadow(shadow); (aMgr->AsShadowForwarder()->*aMethod)(aLayer); diff --git a/gfx/layers/client/ContentClient.cpp b/gfx/layers/client/ContentClient.cpp index 8beacc458d5..05fa3f79f6a 100644 --- a/gfx/layers/client/ContentClient.cpp +++ b/gfx/layers/client/ContentClient.cpp @@ -290,8 +290,8 @@ ContentClientRemoteBuffer::BuildTextureClients(SurfaceFormat aFormat, // real transaction. That is kind of fragile, and this assert will catch // circumstances where we screw that up, e.g., by unnecessarily recreating our // buffers. - NS_ABORT_IF_FALSE(!mIsNewBuffer, - "Bad! Did we create a buffer twice without painting?"); + MOZ_ASSERT(!mIsNewBuffer, + "Bad! Did we create a buffer twice without painting?"); mIsNewBuffer = true; @@ -382,7 +382,7 @@ ContentClientRemoteBuffer::GetUpdatedRegion(const nsIntRegion& aRegionToDraw, NS_ASSERTION(BufferRect().Contains(aRegionToDraw.GetBounds()), "Update outside of buffer rect!"); - NS_ABORT_IF_FALSE(mTextureClient, "should have a back buffer by now"); + MOZ_ASSERT(mTextureClient, "should have a back buffer by now"); return updatedRegion; } diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index 37c6a49c684..bd3a7a114a9 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -479,9 +479,9 @@ SampleAnimations(Layer* aLayer, TimeStamp aPoint) dom::Animation::GetComputedTimingAt( Nullable(elapsedDuration), timing); - NS_ABORT_IF_FALSE(0.0 <= computedTiming.mTimeFraction && - computedTiming.mTimeFraction <= 1.0, - "time fraction should be in [0-1]"); + MOZ_ASSERT(0.0 <= computedTiming.mTimeFraction && + computedTiming.mTimeFraction <= 1.0, + "time fraction should be in [0-1]"); int segmentIndex = 0; AnimationSegment* segment = animation.segments().Elements(); diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index 286238553b4..5be48fc152a 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -45,7 +45,7 @@ #include "basic/X11BasicCompositor.h" // for X11BasicCompositor #endif #include "nsCOMPtr.h" // for already_AddRefed -#include "nsDebug.h" // for NS_ABORT_IF_FALSE, etc +#include "nsDebug.h" // for NS_ASSERTION, etc #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc #include "nsIWidget.h" // for nsIWidget #include "nsRect.h" // for nsIntRect @@ -471,8 +471,8 @@ CompositorParent::~CompositorParent() void CompositorParent::Destroy() { - NS_ABORT_IF_FALSE(ManagedPLayerTransactionParent().Length() == 0, - "CompositorParent destroyed before managed PLayerTransactionParent"); + MOZ_ASSERT(ManagedPLayerTransactionParent().Length() == 0, + "CompositorParent destroyed before managed PLayerTransactionParent"); MOZ_ASSERT(mPaused); // Ensure RecvWillStop was called // Ensure that the layer manager is destructed on the compositor thread. diff --git a/gfx/layers/ipc/ImageBridgeChild.cpp b/gfx/layers/ipc/ImageBridgeChild.cpp index a8f0af21bb8..68394fa70c8 100644 --- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -86,7 +86,7 @@ struct CompositableTransaction } void AddNoSwapEdit(const CompositableOperation& op) { - NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?"); + MOZ_ASSERT(!Finished(), "forgot BeginTransaction?"); mOperations.push_back(op); } void AddEdit(const CompositableOperation& op) @@ -205,8 +205,8 @@ static void ImageBridgeShutdownStep1(ReentrantMonitor *aBarrier, bool *aDone) { ReentrantMonitorAutoEnter autoMon(*aBarrier); - NS_ABORT_IF_FALSE(InImageBridgeChildThread(), - "Should be in ImageBridgeChild thread."); + MOZ_ASSERT(InImageBridgeChildThread(), + "Should be in ImageBridgeChild thread."); if (sImageBridgeChildSingleton) { // Force all managed protocols to shut themselves down cleanly InfallibleTArray compositables; @@ -233,8 +233,8 @@ static void ImageBridgeShutdownStep2(ReentrantMonitor *aBarrier, bool *aDone) { ReentrantMonitorAutoEnter autoMon(*aBarrier); - NS_ABORT_IF_FALSE(InImageBridgeChildThread(), - "Should be in ImageBridgeChild thread."); + MOZ_ASSERT(InImageBridgeChildThread(), + "Should be in ImageBridgeChild thread."); sImageBridgeChildSingleton->SendStop(); @@ -636,7 +636,7 @@ void ImageBridgeChild::ShutDown() bool ImageBridgeChild::StartUpOnThread(Thread* aThread) { - NS_ABORT_IF_FALSE(aThread, "ImageBridge needs a thread."); + MOZ_ASSERT(aThread, "ImageBridge needs a thread."); if (sImageBridgeChildSingleton == nullptr) { sImageBridgeChildThread = aThread; if (!aThread->IsRunning()) { diff --git a/gfx/layers/ipc/ImageBridgeParent.cpp b/gfx/layers/ipc/ImageBridgeParent.cpp index d956c2bafc7..e914562cbc8 100644 --- a/gfx/layers/ipc/ImageBridgeParent.cpp +++ b/gfx/layers/ipc/ImageBridgeParent.cpp @@ -148,7 +148,7 @@ ImageBridgeParent::RecvUpdateNoSwap(EditArray&& aEdits) { InfallibleTArray noReplies; bool success = RecvUpdate(Move(aEdits), &noReplies); - NS_ABORT_IF_FALSE(noReplies.Length() == 0, "RecvUpdateNoSwap requires a sync Update to carry Edits"); + MOZ_ASSERT(noReplies.Length() == 0, "RecvUpdateNoSwap requires a sync Update to carry Edits"); return success; } diff --git a/gfx/layers/ipc/LayerTransactionChild.cpp b/gfx/layers/ipc/LayerTransactionChild.cpp index 392e4d5330c..7951ec352cf 100644 --- a/gfx/layers/ipc/LayerTransactionChild.cpp +++ b/gfx/layers/ipc/LayerTransactionChild.cpp @@ -32,8 +32,8 @@ LayerTransactionChild::Destroy() // When it happens, IPCOpen() is still true. // See bug 1004191. mDestroyed = true; - NS_ABORT_IF_FALSE(0 == ManagedPLayerChild().Length(), - "layers should have been cleaned up by now"); + MOZ_ASSERT(0 == ManagedPLayerChild().Length(), + "layers should have been cleaned up by now"); for (size_t i = 0; i < ManagedPTextureChild().Length(); ++i) { TextureClient* texture = TextureClient::AsTextureClient(ManagedPTextureChild()[i]); diff --git a/gfx/layers/ipc/ShadowLayerChild.cpp b/gfx/layers/ipc/ShadowLayerChild.cpp index 490ad523032..8fd162e4aee 100644 --- a/gfx/layers/ipc/ShadowLayerChild.cpp +++ b/gfx/layers/ipc/ShadowLayerChild.cpp @@ -8,7 +8,6 @@ #include "ShadowLayerChild.h" #include "Layers.h" // for Layer #include "ShadowLayers.h" // for ShadowableLayer -#include "nsDebug.h" // for NS_ABORT_IF_FALSE namespace mozilla { namespace layers { @@ -23,8 +22,8 @@ ShadowLayerChild::~ShadowLayerChild() void ShadowLayerChild::ActorDestroy(ActorDestroyReason why) { - NS_ABORT_IF_FALSE(AncestorDeletion != why, - "shadowable layer should have been cleaned up by now"); + MOZ_ASSERT(AncestorDeletion != why, + "shadowable layer should have been cleaned up by now"); if (AbnormalShutdown == why) { // This is last-ditch emergency shutdown. Just have the layer diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index e5fbfd8409f..c8d749e3f7a 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -28,7 +28,6 @@ #include "mozilla/layers/TextureClient.h" // for TextureClient #include "mozilla/mozalloc.h" // for operator new, etc #include "nsAutoPtr.h" // for nsRefPtr, getter_AddRefs, etc -#include "nsDebug.h" // for NS_ABORT_IF_FALSE, etc #include "nsRect.h" // for nsIntRect #include "nsSize.h" // for nsIntSize #include "nsTArray.h" // for nsAutoTArray, nsTArray, etc @@ -84,7 +83,7 @@ public: } void AddEdit(const Edit& aEdit) { - NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?"); + MOZ_ASSERT(!Finished(), "forgot BeginTransaction?"); mCset.push_back(aEdit); } void AddEdit(const CompositableOperation& aEdit) @@ -104,17 +103,17 @@ public: void AddNoSwapPaint(const Edit& aPaint) { - NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?"); + MOZ_ASSERT(!Finished(), "forgot BeginTransaction?"); mPaints.push_back(aPaint); } void AddNoSwapPaint(const CompositableOperation& aPaint) { - NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?"); + MOZ_ASSERT(!Finished(), "forgot BeginTransaction?"); mPaints.push_back(Edit(aPaint)); } void AddMutant(ShadowableLayer* aLayer) { - NS_ABORT_IF_FALSE(!Finished(), "forgot BeginTransaction?"); + MOZ_ASSERT(!Finished(), "forgot BeginTransaction?"); mMutants.insert(aLayer); } void End() @@ -177,7 +176,7 @@ ShadowLayerForwarder::ShadowLayerForwarder() ShadowLayerForwarder::~ShadowLayerForwarder() { - NS_ABORT_IF_FALSE(mTxn->Finished(), "unfinished transaction?"); + MOZ_ASSERT(mTxn->Finished(), "unfinished transaction?"); delete mTxn; if (mShadowManager) { mShadowManager->SetForwarder(nullptr); @@ -190,8 +189,8 @@ ShadowLayerForwarder::BeginTransaction(const nsIntRect& aTargetBounds, ScreenRotation aRotation, dom::ScreenOrientation aOrientation) { - NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to"); - NS_ABORT_IF_FALSE(mTxn->Finished(), "uncommitted txn?"); + MOZ_ASSERT(HasShadowManager(), "no manager to forward to"); + MOZ_ASSERT(mTxn->Finished(), "uncommitted txn?"); mTxn->Begin(aTargetBounds, aRotation, aOrientation); } @@ -572,8 +571,8 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray* aReplies, js::ProfileEntry::Category::GRAPHICS); RenderTraceScope rendertrace("Foward Transaction", "000091"); - NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to"); - NS_ABORT_IF_FALSE(!mTxn->Finished(), "forgot BeginTransaction?"); + MOZ_ASSERT(HasShadowManager(), "no manager to forward to"); + MOZ_ASSERT(!mTxn->Finished(), "forgot BeginTransaction?"); DiagnosticTypes diagnostics = gfxPlatform::GetPlatform()->GetLayerDiagnosticTypes(); if (mDiagnosticTypes != diagnostics) { @@ -605,7 +604,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray* aReplies, continue; } Layer* mutant = shadow->AsLayer(); - NS_ABORT_IF_FALSE(!!mutant, "unshadowable layer?"); + MOZ_ASSERT(!!mutant, "unshadowable layer?"); LayerAttributes attrs; CommonLayerAttributes& common = attrs.common(); @@ -660,7 +659,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray* aReplies, AutoInfallibleTArray cset; size_t nCsets = mTxn->mCset.size() + mTxn->mPaints.size(); - NS_ABORT_IF_FALSE(nCsets > 0 || mWindowOverlayChanged || mTxn->RotationChanged(), "should have bailed by now"); + MOZ_ASSERT(nCsets > 0 || mWindowOverlayChanged || mTxn->RotationChanged(), "should have bailed by now"); cset.SetCapacity(nCsets); if (!mTxn->mCset.empty()) { @@ -728,7 +727,7 @@ ShadowLayerForwarder::AllocShmem(size_t aSize, ipc::SharedMemory::SharedMemoryType aType, ipc::Shmem* aShmem) { - NS_ABORT_IF_FALSE(HasShadowManager(), "no shadow manager"); + MOZ_ASSERT(HasShadowManager(), "no shadow manager"); if (!HasShadowManager() || !mShadowManager->IPCOpen()) { return false; @@ -740,7 +739,7 @@ ShadowLayerForwarder::AllocUnsafeShmem(size_t aSize, ipc::SharedMemory::SharedMemoryType aType, ipc::Shmem* aShmem) { - NS_ABORT_IF_FALSE(HasShadowManager(), "no shadow manager"); + MOZ_ASSERT(HasShadowManager(), "no shadow manager"); if (!HasShadowManager() || !mShadowManager->IPCOpen()) { return false; @@ -750,7 +749,7 @@ ShadowLayerForwarder::AllocUnsafeShmem(size_t aSize, void ShadowLayerForwarder::DeallocShmem(ipc::Shmem& aShmem) { - NS_ABORT_IF_FALSE(HasShadowManager(), "no shadow manager"); + MOZ_ASSERT(HasShadowManager(), "no shadow manager"); if (!HasShadowManager() || !mShadowManager->IPCOpen()) { return; @@ -781,7 +780,7 @@ ShadowLayerForwarder::IsSameProcess() const PLayerChild* ShadowLayerForwarder::ConstructShadowFor(ShadowableLayer* aLayer) { - NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to"); + MOZ_ASSERT(HasShadowManager(), "no manager to forward to"); if (!HasShadowManager() || !mShadowManager->IPCOpen()) { return nullptr; diff --git a/gfx/layers/ipc/SharedBufferManagerChild.cpp b/gfx/layers/ipc/SharedBufferManagerChild.cpp index d19801cf946..fe66296432b 100644 --- a/gfx/layers/ipc/SharedBufferManagerChild.cpp +++ b/gfx/layers/ipc/SharedBufferManagerChild.cpp @@ -52,8 +52,8 @@ DeleteSharedBufferManagerSync(ReentrantMonitor *aBarrier, bool *aDone) { ReentrantMonitorAutoEnter autoMon(*aBarrier); - NS_ABORT_IF_FALSE(InSharedBufferManagerChildThread(), - "Should be in SharedBufferManagerChild thread."); + MOZ_ASSERT(InSharedBufferManagerChildThread(), + "Should be in SharedBufferManagerChild thread."); SharedBufferManagerChild::sSharedBufferManagerChildSingleton = nullptr; SharedBufferManagerChild::sSharedBufferManagerParentSingleton = nullptr; *aDone = true; @@ -153,7 +153,7 @@ SharedBufferManagerChild::ShutDown() bool SharedBufferManagerChild::StartUpOnThread(base::Thread* aThread) { - NS_ABORT_IF_FALSE(aThread, "SharedBufferManager needs a thread."); + MOZ_ASSERT(aThread, "SharedBufferManager needs a thread."); if (sSharedBufferManagerChildSingleton != nullptr) { return false; } @@ -174,8 +174,8 @@ SharedBufferManagerChild::StartUpOnThread(base::Thread* aThread) void SharedBufferManagerChild::DestroyManager() { - NS_ABORT_IF_FALSE(!InSharedBufferManagerChildThread(), - "This method must not be called in this thread."); + MOZ_ASSERT(!InSharedBufferManagerChildThread(), + "This method must not be called in this thread."); // ...because we are about to dispatch synchronous messages to the // BufferManagerChild thread. diff --git a/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp b/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp index cbcb33bbbbb..69acfc78b6e 100644 --- a/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp +++ b/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp @@ -104,7 +104,7 @@ SharedPlanarYCbCrImage::SetData(const PlanarYCbCrData& aData) uint8_t* SharedPlanarYCbCrImage::AllocateAndGetNewBuffer(uint32_t aSize) { - NS_ABORT_IF_FALSE(!mTextureClient, "This image already has allocated data"); + MOZ_ASSERT(!mTextureClient, "This image already has allocated data"); size_t size = YCbCrImageDataSerializer::ComputeMinBufferSize(aSize); if (!size) { return nullptr; @@ -129,7 +129,7 @@ SharedPlanarYCbCrImage::AllocateAndGetNewBuffer(uint32_t aSize) void SharedPlanarYCbCrImage::SetDataNoCopy(const Data &aData) { - NS_ABORT_IF_FALSE(mTextureClient, "This Image should have already allocated data"); + MOZ_ASSERT(mTextureClient, "This Image should have already allocated data"); mData = aData; mSize = aData.mPicSize; /* SetDataNoCopy is used to update YUV plane offsets without (re)allocating @@ -156,8 +156,8 @@ SharedPlanarYCbCrImage::SetDataNoCopy(const Data &aData) uint8_t* SharedPlanarYCbCrImage::AllocateBuffer(uint32_t aSize) { - NS_ABORT_IF_FALSE(!mTextureClient, - "This image already has allocated data"); + MOZ_ASSERT(!mTextureClient, + "This image already has allocated data"); mTextureClient = TextureClient::CreateWithBufferSize(mCompositable->GetForwarder(), gfx::SurfaceFormat::YUV, aSize, mCompositable->GetTextureFlags()); @@ -175,8 +175,8 @@ SharedPlanarYCbCrImage::IsValid() { bool SharedPlanarYCbCrImage::Allocate(PlanarYCbCrData& aData) { - NS_ABORT_IF_FALSE(!mTextureClient, - "This image already has allocated data"); + MOZ_ASSERT(!mTextureClient, + "This image already has allocated data"); mTextureClient = TextureClient::CreateForYCbCr(mCompositable->GetForwarder(), aData.mYSize, aData.mCbCrSize, diff --git a/gfx/layers/opengl/CompositorOGL.cpp b/gfx/layers/opengl/CompositorOGL.cpp index ec7a9f3325f..bc78494c155 100644 --- a/gfx/layers/opengl/CompositorOGL.cpp +++ b/gfx/layers/opengl/CompositorOGL.cpp @@ -209,7 +209,7 @@ CompositorOGL::Initialize() ScopedGfxFeatureReporter reporter("GL Layers", force); // Do not allow double initialization - NS_ABORT_IF_FALSE(mGLContext == nullptr, "Don't reinitialize CompositorOGL"); + MOZ_ASSERT(mGLContext == nullptr, "Don't reinitialize CompositorOGL"); mGLContext = CreateContext(); diff --git a/gfx/src/nsColor.cpp b/gfx/src/nsColor.cpp index 50ca1b48a17..ea59ba64da2 100644 --- a/gfx/src/nsColor.cpp +++ b/gfx/src/nsColor.cpp @@ -168,8 +168,8 @@ NS_GFX_(bool) NS_LooseHexToRGB(const nsString& aColorSpec, nscolor* aResult) while (newdpc > 2) { bool haveNonzero = false; for (int c = 0; c < 3; ++c) { - NS_ABORT_IF_FALSE(c * dpc < nameLen, - "should not pass end of string while newdpc > 2"); + MOZ_ASSERT(c * dpc < nameLen, + "should not pass end of string while newdpc > 2"); char16_t ch = colorSpec[c * dpc]; if (('1' <= ch && ch <= '9') || ('A' <= ch && ch <= 'F') || diff --git a/gfx/src/nsCoord.h b/gfx/src/nsCoord.h index c38aba054dc..cd52244a66c 100644 --- a/gfx/src/nsCoord.h +++ b/gfx/src/nsCoord.h @@ -107,8 +107,8 @@ inline nscoord _nscoordSaturatingMultiply(nscoord aCoord, float aScale, bool requireNotNegative) { VERIFY_COORD(aCoord); if (requireNotNegative) { - NS_ABORT_IF_FALSE(aScale >= 0.0f, - "negative scaling factors must be handled manually"); + MOZ_ASSERT(aScale >= 0.0f, + "negative scaling factors must be handled manually"); } #ifdef NS_COORD_IS_FLOAT return floorf(aCoord * aScale); diff --git a/gfx/src/nsFontMetrics.cpp b/gfx/src/nsFontMetrics.cpp index b082d202057..a7d96280b03 100644 --- a/gfx/src/nsFontMetrics.cpp +++ b/gfx/src/nsFontMetrics.cpp @@ -12,13 +12,14 @@ #include "gfxRect.h" // for gfxRect #include "gfxTypes.h" // for gfxFloat #include "nsBoundingMetrics.h" // for nsBoundingMetrics -#include "nsDebug.h" // for NS_ERROR, NS_ABORT_IF_FALSE +#include "nsDebug.h" // for NS_ERROR #include "nsDeviceContext.h" // for nsDeviceContext #include "nsIAtom.h" // for nsIAtom #include "nsMathUtils.h" // for NS_round #include "nsRenderingContext.h" // for nsRenderingContext -#include "nsString.h" // for nsString +#include "nsString.h" // for nsString #include "nsStyleConsts.h" // for NS_STYLE_HYPHENS_NONE +#include "mozilla/Assertions.h" // for MOZ_ASSERT class gfxUserFontSet; @@ -126,7 +127,7 @@ nsFontMetrics::Init(const nsFont& aFont, gfxUserFontSet *aUserFontSet, gfxTextPerfMetrics *aTextPerf) { - NS_ABORT_IF_FALSE(mP2A == 0, "already initialized"); + MOZ_ASSERT(mP2A == 0, "already initialized"); mFont = aFont; mLanguage = aLanguage; diff --git a/gfx/thebes/gfx3DMatrix.h b/gfx/thebes/gfx3DMatrix.h index c25febda223..34c9685d0bf 100644 --- a/gfx/thebes/gfx3DMatrix.h +++ b/gfx/thebes/gfx3DMatrix.h @@ -66,12 +66,12 @@ public: Point4D& operator[](int aIndex) { - NS_ABORT_IF_FALSE(aIndex >= 0 && aIndex <= 3, "Invalid matrix array index"); + MOZ_ASSERT(aIndex >= 0 && aIndex <= 3, "Invalid matrix array index"); return *reinterpret_cast((&_11)+4*aIndex); } const Point4D& operator[](int aIndex) const { - NS_ABORT_IF_FALSE(aIndex >= 0 && aIndex <= 3, "Invalid matrix array index"); + MOZ_ASSERT(aIndex >= 0 && aIndex <= 3, "Invalid matrix array index"); return *reinterpret_cast((&_11)+4*aIndex); } diff --git a/gfx/thebes/gfxAlphaRecoverySSE2.cpp b/gfx/thebes/gfxAlphaRecoverySSE2.cpp index b282a10ad8f..a395cee6b77 100644 --- a/gfx/thebes/gfxAlphaRecoverySSE2.cpp +++ b/gfx/thebes/gfxAlphaRecoverySSE2.cpp @@ -230,7 +230,7 @@ gfxAlphaRecovery::AlignRectForSubimageRecovery(const nsIntRect& aRect, FOUND_SOLUTION: nsIntRect solution = nsIntRect(x - dx, y - dy, w + dr + dx, h + dy); - NS_ABORT_IF_FALSE(nsIntRect(0, 0, sw, surfaceSize.height).Contains(solution), - "'Solution' extends outside surface bounds!"); + MOZ_ASSERT(nsIntRect(0, 0, sw, surfaceSize.height).Contains(solution), + "'Solution' extends outside surface bounds!"); return solution; } diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index 6acb34511cd..671813b3d6d 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -631,8 +631,9 @@ public: PL_DHashTableInit(&mMap, &mOps, sizeof(FNCMapEntry), 0); - NS_ABORT_IF_FALSE(XRE_GetProcessType() == GeckoProcessType_Default, - "StartupCacheFontNameCache should only be used in chrome process"); + MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default, + "StartupCacheFontNameCache should only be used in chrome " + "process"); mCache = mozilla::scache::StartupCache::GetSingleton(); Init(); diff --git a/gfx/thebes/gfxFontEntry.cpp b/gfx/thebes/gfxFontEntry.cpp index 5235bda231a..2a4f66c37ac 100644 --- a/gfx/thebes/gfxFontEntry.cpp +++ b/gfx/thebes/gfxFontEntry.cpp @@ -336,10 +336,10 @@ bool gfxFontEntry::GetSVGGlyphExtents(gfxContext *aContext, uint32_t aGlyphId, gfxRect *aResult) { - NS_ABORT_IF_FALSE(mSVGInitialized, - "SVG data has not yet been loaded. TryGetSVGData() first."); - NS_ABORT_IF_FALSE(mUnitsPerEm >= kMinUPEM && mUnitsPerEm <= kMaxUPEM, - "font has invalid unitsPerEm"); + MOZ_ASSERT(mSVGInitialized, + "SVG data has not yet been loaded. TryGetSVGData() first."); + MOZ_ASSERT(mUnitsPerEm >= kMinUPEM && mUnitsPerEm <= kMaxUPEM, + "font has invalid unitsPerEm"); gfxContextAutoSaveRestore matrixRestore(aContext); cairo_matrix_t fontMatrix; diff --git a/gfx/thebes/gfxReusableSharedImageSurfaceWrapper.cpp b/gfx/thebes/gfxReusableSharedImageSurfaceWrapper.cpp index a0295557257..3ab4134b1f9 100644 --- a/gfx/thebes/gfxReusableSharedImageSurfaceWrapper.cpp +++ b/gfx/thebes/gfxReusableSharedImageSurfaceWrapper.cpp @@ -35,7 +35,7 @@ void gfxReusableSharedImageSurfaceWrapper::ReadUnlock() { int32_t readCount = mSurface->ReadUnlock(); - NS_ABORT_IF_FALSE(readCount >= 0, "Read count should not be negative"); + MOZ_ASSERT(readCount >= 0, "Read count should not be negative"); if (readCount == 0) { mAllocator->DeallocShmem(mSurface->GetShmem()); @@ -48,7 +48,7 @@ gfxReusableSharedImageSurfaceWrapper::GetWritable(gfxImageSurface** aSurface) NS_ASSERT_OWNINGTHREAD(gfxReusableSharedImageSurfaceWrapper); int32_t readCount = mSurface->GetReadCount(); - NS_ABORT_IF_FALSE(readCount > 0, "A ReadLock must be held when calling GetWritable"); + MOZ_ASSERT(readCount > 0, "A ReadLock must be held when calling GetWritable"); if (readCount == 1) { *aSurface = mSurface; return this; @@ -72,7 +72,7 @@ gfxReusableSharedImageSurfaceWrapper::GetWritable(gfxImageSurface** aSurface) const unsigned char* gfxReusableSharedImageSurfaceWrapper::GetReadOnlyData() const { - NS_ABORT_IF_FALSE(mSurface->GetReadCount() > 0, "Should have read lock"); + MOZ_ASSERT(mSurface->GetReadCount() > 0, "Should have read lock"); return mSurface->Data(); } diff --git a/image/decoders/nsBMPDecoder.cpp b/image/decoders/nsBMPDecoder.cpp index 35b0db92077..168364030f2 100644 --- a/image/decoders/nsBMPDecoder.cpp +++ b/image/decoders/nsBMPDecoder.cpp @@ -136,10 +136,10 @@ void nsBMPDecoder::FinishInternal() { // We shouldn't be called in error cases - NS_ABORT_IF_FALSE(!HasError(), "Can't call FinishInternal on error!"); + MOZ_ASSERT(!HasError(), "Can't call FinishInternal on error!"); // We should never make multiple frames - NS_ABORT_IF_FALSE(GetFrameCount() <= 1, "Multiple BMP frames?"); + MOZ_ASSERT(GetFrameCount() <= 1, "Multiple BMP frames?"); // Send notifications if appropriate if (!IsSizeDecode() && HasSize()) { @@ -201,7 +201,7 @@ nsBMPDecoder::CalcBitShift() void nsBMPDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) { - NS_ABORT_IF_FALSE(!HasError(), "Shouldn't call WriteInternal after error!"); + MOZ_ASSERT(!HasError(), "Shouldn't call WriteInternal after error!"); // aCount=0 means EOF, mCurLine=0 means we're past end of image if (!aCount || !mCurLine) { @@ -869,8 +869,7 @@ nsBMPDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) continue; default : - NS_ABORT_IF_FALSE(0, - "BMP RLE decompression: unknown state!"); + MOZ_ASSERT(0, "BMP RLE decompression: unknown state!"); PostDecoderError(NS_ERROR_UNEXPECTED); return; } diff --git a/image/decoders/nsGIFDecoder2.cpp b/image/decoders/nsGIFDecoder2.cpp index 3f193c550aa..f70ab06b9a5 100644 --- a/image/decoders/nsGIFDecoder2.cpp +++ b/image/decoders/nsGIFDecoder2.cpp @@ -100,7 +100,7 @@ nsGIFDecoder2::~nsGIFDecoder2() void nsGIFDecoder2::FinishInternal() { - NS_ABORT_IF_FALSE(!HasError(), "Shouldn't call FinishInternal after error!"); + MOZ_ASSERT(!HasError(), "Shouldn't call FinishInternal after error!"); // If the GIF got cut off, handle it anyway if (!IsSizeDecode() && mGIFOpen) { @@ -570,7 +570,7 @@ ConvertColormap(uint32_t* aColormap, uint32_t aColors) void nsGIFDecoder2::WriteInternal(const char* aBuffer, uint32_t aCount) { - NS_ABORT_IF_FALSE(!HasError(), "Shouldn't call WriteInternal after error!"); + MOZ_ASSERT(!HasError(), "Shouldn't call WriteInternal after error!"); // These variables changed names; renaming would make a much bigger patch :( const uint8_t* buf = (const uint8_t*)aBuffer; diff --git a/image/decoders/nsICODecoder.cpp b/image/decoders/nsICODecoder.cpp index 7322b42ba75..1ea16a21fb5 100644 --- a/image/decoders/nsICODecoder.cpp +++ b/image/decoders/nsICODecoder.cpp @@ -78,7 +78,7 @@ void nsICODecoder::FinishInternal() { // We shouldn't be called in error cases - NS_ABORT_IF_FALSE(!HasError(), "Shouldn't call FinishInternal after error!"); + MOZ_ASSERT(!HasError(), "Shouldn't call FinishInternal after error!"); // Finish the internally used decoder as well if (mContainedDecoder) { @@ -216,7 +216,7 @@ nsICODecoder::SetHotSpotIfCursor() void nsICODecoder::WriteInternal(const char* aBuffer, uint32_t aCount) { - NS_ABORT_IF_FALSE(!HasError(), "Shouldn't call WriteInternal after error!"); + MOZ_ASSERT(!HasError(), "Shouldn't call WriteInternal after error!"); if (!aCount) { if (mContainedDecoder) { @@ -538,7 +538,7 @@ nsICODecoder::WriteInternal(const char* aBuffer, uint32_t aCount) } // Ensure memory has been allocated before decoding. - NS_ABORT_IF_FALSE(mRow, "mRow is null"); + MOZ_ASSERT(mRow, "mRow is null"); if (!mRow) { PostDataError(); return; diff --git a/image/decoders/nsIconDecoder.cpp b/image/decoders/nsIconDecoder.cpp index f4c8335dba2..63bc7d8f35b 100644 --- a/image/decoders/nsIconDecoder.cpp +++ b/image/decoders/nsIconDecoder.cpp @@ -31,7 +31,7 @@ nsIconDecoder::~nsIconDecoder() void nsIconDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) { - NS_ABORT_IF_FALSE(!HasError(), "Shouldn't call WriteInternal after error!"); + MOZ_ASSERT(!HasError(), "Shouldn't call WriteInternal after error!"); // We put this here to avoid errors about crossing initialization with case // jumps on linux. diff --git a/image/decoders/nsJPEGDecoder.cpp b/image/decoders/nsJPEGDecoder.cpp index 41910229f0d..f8c3c10446d 100644 --- a/image/decoders/nsJPEGDecoder.cpp +++ b/image/decoders/nsJPEGDecoder.cpp @@ -211,7 +211,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) mSegment = (const JOCTET*)aBuffer; mSegmentLen = aCount; - NS_ABORT_IF_FALSE(!HasError(), "Shouldn't call WriteInternal after error!"); + MOZ_ASSERT(!HasError(), "Shouldn't call WriteInternal after error!"); // Return here if there is a fatal error within libjpeg. nsresult error_code; @@ -574,8 +574,9 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) break; case JPEG_ERROR: - NS_ABORT_IF_FALSE(0, "Should always return immediately after error and" - " not re-enter decoder"); + MOZ_ASSERT(false, + "Should always return immediately after error and not re-enter " + "decoder"); } PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, @@ -947,8 +948,8 @@ term_source (j_decompress_ptr jd) // This function shouldn't be called if we ran into an error we didn't // recover from. - NS_ABORT_IF_FALSE(decoder->mState != JPEG_ERROR, - "Calling term_source on a JPEG with mState == JPEG_ERROR!"); + MOZ_ASSERT(decoder->mState != JPEG_ERROR, + "Calling term_source on a JPEG with mState == JPEG_ERROR!"); // Notify using a helper method to get around protectedness issues. decoder->NotifyDone(); diff --git a/image/decoders/nsPNGDecoder.cpp b/image/decoders/nsPNGDecoder.cpp index 3a9bfe53903..769fb152b5f 100644 --- a/image/decoders/nsPNGDecoder.cpp +++ b/image/decoders/nsPNGDecoder.cpp @@ -316,7 +316,7 @@ nsPNGDecoder::InitInternal() void nsPNGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) { - NS_ABORT_IF_FALSE(!HasError(), "Shouldn't call WriteInternal after error!"); + MOZ_ASSERT(!HasError(), "Shouldn't call WriteInternal after error!"); // If we only want width/height, we don't need to go through libpng if (IsSizeDecode()) { @@ -873,7 +873,7 @@ nsPNGDecoder::end_callback(png_structp png_ptr, png_infop info_ptr) static_cast(png_get_progressive_ptr(png_ptr)); // We shouldn't get here if we've hit an error - NS_ABORT_IF_FALSE(!decoder->HasError(), "Finishing up PNG but hit error!"); + MOZ_ASSERT(!decoder->HasError(), "Finishing up PNG but hit error!"); int32_t loop_count = 0; #ifdef PNG_APNG_SUPPORTED diff --git a/image/src/Decoder.cpp b/image/src/Decoder.cpp index 4599414ddc4..cf8cff4976c 100644 --- a/image/src/Decoder.cpp +++ b/image/src/Decoder.cpp @@ -102,7 +102,7 @@ Decoder::InitSharedDecoder(uint8_t* aImageData, uint32_t aImageDataLength, RawAccessFrameRef&& aFrameRef) { // No re-initializing - NS_ABORT_IF_FALSE(!mInitialized, "Can't re-initialize a decoder!"); + MOZ_ASSERT(!mInitialized, "Can't re-initialize a decoder!"); mImageData = aImageData; mImageDataLength = aImageDataLength; @@ -570,8 +570,8 @@ Decoder::PostSize(int32_t aWidth, Orientation aOrientation /* = Orientation()*/) { // Validate - NS_ABORT_IF_FALSE(aWidth >= 0, "Width can't be negative!"); - NS_ABORT_IF_FALSE(aHeight >= 0, "Height can't be negative!"); + MOZ_ASSERT(aWidth >= 0, "Width can't be negative!"); + MOZ_ASSERT(aHeight >= 0, "Height can't be negative!"); // Tell the image mImageMetadata.SetSize(aWidth, aHeight, aOrientation); @@ -590,7 +590,7 @@ void Decoder::PostFrameStart() { // We shouldn't already be mid-frame - NS_ABORT_IF_FALSE(!mInFrame, "Starting new frame but not done with old one!"); + MOZ_ASSERT(!mInFrame, "Starting new frame but not done with old one!"); // Update our state to reflect the new frame mInFrame = true; @@ -634,8 +634,8 @@ Decoder::PostInvalidation(const nsIntRect& aRect, /* = Nothing() */) { // We should be mid-frame - NS_ABORT_IF_FALSE(mInFrame, "Can't invalidate when not mid-frame!"); - NS_ABORT_IF_FALSE(mCurrentFrame, "Can't invalidate when not mid-frame!"); + MOZ_ASSERT(mInFrame, "Can't invalidate when not mid-frame!"); + MOZ_ASSERT(mCurrentFrame, "Can't invalidate when not mid-frame!"); // Record this invalidation, unless we're not sending partial invalidations // or we're past the first frame. @@ -648,9 +648,9 @@ Decoder::PostInvalidation(const nsIntRect& aRect, void Decoder::PostDecodeDone(int32_t aLoopCount /* = 0 */) { - NS_ABORT_IF_FALSE(!IsSizeDecode(), "Can't be done with decoding with size decode!"); - NS_ABORT_IF_FALSE(!mInFrame, "Can't be done decoding if we're mid-frame!"); - NS_ABORT_IF_FALSE(!mDecodeDone, "Decode already done!"); + MOZ_ASSERT(!IsSizeDecode(), "Can't be done with decoding with size decode!"); + MOZ_ASSERT(!mInFrame, "Can't be done decoding if we're mid-frame!"); + MOZ_ASSERT(!mDecodeDone, "Decode already done!"); mDecodeDone = true; mImageMetadata.SetLoopCount(aLoopCount); @@ -671,7 +671,7 @@ Decoder::PostDataError() void Decoder::PostDecoderError(nsresult aFailureCode) { - NS_ABORT_IF_FALSE(NS_FAILED(aFailureCode), "Not a failure code!"); + MOZ_ASSERT(NS_FAILED(aFailureCode), "Not a failure code!"); mFailCode = aFailureCode; diff --git a/image/src/Image.cpp b/image/src/Image.cpp index b6f66300457..63850ba5e4f 100644 --- a/image/src/Image.cpp +++ b/image/src/Image.cpp @@ -83,7 +83,7 @@ ImageResource::DecrementAnimationConsumers() { MOZ_ASSERT(NS_IsMainThread(), "Main thread only to encourage serialization " "with IncrementAnimationConsumers"); - NS_ABORT_IF_FALSE(mAnimationConsumers >= 1, "Invalid no. of animation consumers!"); + MOZ_ASSERT(mAnimationConsumers >= 1, "Invalid no. of animation consumers!"); mAnimationConsumers--; } diff --git a/image/src/ProgressTracker.cpp b/image/src/ProgressTracker.cpp index 154ca9d6ada..ce3938b94c1 100644 --- a/image/src/ProgressTracker.cpp +++ b/image/src/ProgressTracker.cpp @@ -87,15 +87,15 @@ CheckProgressConsistency(Progress aProgress) void ProgressTracker::SetImage(Image* aImage) { - NS_ABORT_IF_FALSE(aImage, "Setting null image"); - NS_ABORT_IF_FALSE(!mImage, "Setting image when we already have one"); + MOZ_ASSERT(aImage, "Setting null image"); + MOZ_ASSERT(!mImage, "Setting image when we already have one"); mImage = aImage; } void ProgressTracker::ResetImage() { - NS_ABORT_IF_FALSE(mImage, "Resetting image when it's already null!"); + MOZ_ASSERT(mImage, "Resetting image when it's already null!"); mImage = nullptr; } diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index 9a9c8a7281b..8a00378e645 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -1010,7 +1010,7 @@ RasterImage::StartAnimation() if (mError) return NS_ERROR_FAILURE; - NS_ABORT_IF_FALSE(ShouldAnimate(), "Should not animate!"); + MOZ_ASSERT(ShouldAnimate(), "Should not animate!"); // If we don't have mAnim yet, then we're not ready to animate. Setting // mPendingAnimation will cause us to start animating as soon as we have a @@ -1038,7 +1038,7 @@ RasterImage::StartAnimation() nsresult RasterImage::StopAnimation() { - NS_ABORT_IF_FALSE(mAnimating, "Should be animating!"); + MOZ_ASSERT(mAnimating, "Should be animating!"); nsresult rv = NS_OK; if (mError) { @@ -1209,7 +1209,7 @@ RasterImage::OnImageDataAvailable(nsIRequest*, uint32_t bytesRead; rv = aInStr->ReadSegments(WriteToSourceBuffer, this, aCount, &bytesRead); - NS_ABORT_IF_FALSE(bytesRead == aCount || HasError() || NS_FAILED(rv), + MOZ_ASSERT(bytesRead == aCount || HasError() || NS_FAILED(rv), "WriteToSourceBuffer should consume everything if ReadSegments succeeds or " "the image must be in error!"); @@ -1866,8 +1866,8 @@ RasterImage::UnlockImage() return NS_ERROR_FAILURE; // It's an error to call this function if the lock count is 0 - NS_ABORT_IF_FALSE(mLockCount > 0, - "Calling UnlockImage with mLockCount == 0!"); + MOZ_ASSERT(mLockCount > 0, + "Calling UnlockImage with mLockCount == 0!"); if (mLockCount == 0) return NS_ERROR_ABORT; diff --git a/image/src/SVGDocumentWrapper.cpp b/image/src/SVGDocumentWrapper.cpp index dc2d6d894ab..ffce1b2c7c9 100644 --- a/image/src/SVGDocumentWrapper.cpp +++ b/image/src/SVGDocumentWrapper.cpp @@ -78,7 +78,7 @@ SVGDocumentWrapper::GetRootLayoutFrame() void SVGDocumentWrapper::UpdateViewportBounds(const nsIntSize& aViewportSize) { - NS_ABORT_IF_FALSE(!mIgnoreInvalidation, "shouldn't be reentrant"); + MOZ_ASSERT(!mIgnoreInvalidation, "shouldn't be reentrant"); mIgnoreInvalidation = true; nsIntRect currentBounds; @@ -96,7 +96,7 @@ SVGDocumentWrapper::UpdateViewportBounds(const nsIntSize& aViewportSize) void SVGDocumentWrapper::FlushImageTransformInvalidation() { - NS_ABORT_IF_FALSE(!mIgnoreInvalidation, "shouldn't be reentrant"); + MOZ_ASSERT(!mIgnoreInvalidation, "shouldn't be reentrant"); SVGSVGElement* svgElem = GetRootSVGElem(); if (!svgElem) @@ -346,8 +346,8 @@ SVGDocumentWrapper::SetupViewer(nsIRequest* aRequest, void SVGDocumentWrapper::RegisterForXPCOMShutdown() { - NS_ABORT_IF_FALSE(!mRegisteredForXPCOMShutdown, - "re-registering for XPCOM shutdown"); + MOZ_ASSERT(!mRegisteredForXPCOMShutdown, + "re-registering for XPCOM shutdown"); // Listen for xpcom-shutdown so that we can drop references to our // helper-document at that point. (Otherwise, we won't get cleaned up // until imgLoader::Shutdown, which can happen after the JAR service @@ -366,8 +366,8 @@ SVGDocumentWrapper::RegisterForXPCOMShutdown() void SVGDocumentWrapper::UnregisterForXPCOMShutdown() { - NS_ABORT_IF_FALSE(mRegisteredForXPCOMShutdown, - "unregistering for XPCOM shutdown w/out being registered"); + MOZ_ASSERT(mRegisteredForXPCOMShutdown, + "unregistering for XPCOM shutdown w/out being registered"); nsresult rv; nsCOMPtr obsSvc = do_GetService(OBSERVER_SVC_CID, &rv); diff --git a/image/src/imgFrame.cpp b/image/src/imgFrame.cpp index c4b8d6ad733..4a1d425f14f 100644 --- a/image/src/imgFrame.cpp +++ b/image/src/imgFrame.cpp @@ -1143,7 +1143,7 @@ imgFrame::SizeOfExcludingThis(gfxMemoryLocation aLocation, // aMallocSizeOf is only used if aLocation==gfxMemoryLocation::IN_PROCESS_HEAP. It // should be nullptr otherwise. - NS_ABORT_IF_FALSE( + MOZ_ASSERT( (aLocation == gfxMemoryLocation::IN_PROCESS_HEAP && aMallocSizeOf) || (aLocation != gfxMemoryLocation::IN_PROCESS_HEAP && !aMallocSizeOf), "mismatch between aLocation and aMallocSizeOf"); diff --git a/image/src/imgLoader.cpp b/image/src/imgLoader.cpp index 11267496c24..138b25b353d 100644 --- a/image/src/imgLoader.cpp +++ b/image/src/imgLoader.cpp @@ -1076,8 +1076,8 @@ void imgLoader::VerifyCacheSizes() uint32_t trackersize = 0; for (nsExpirationTracker::Iterator it(mCacheTracker); it.Next(); ) trackersize++; - NS_ABORT_IF_FALSE(queuesize == trackersize, "Queue and tracker sizes out of sync!"); - NS_ABORT_IF_FALSE(queuesize <= cachesize, "Queue has more elements than cache!"); + MOZ_ASSERT(queuesize == trackersize, "Queue and tracker sizes out of sync!"); + MOZ_ASSERT(queuesize <= cachesize, "Queue has more elements than cache!"); #endif } @@ -1190,7 +1190,7 @@ imgLoader::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aD // (Nothing else should bring us here) else { - NS_ABORT_IF_FALSE(0, "Invalid topic received"); + MOZ_ASSERT(0, "Invalid topic received"); } return NS_OK; @@ -1727,7 +1727,7 @@ bool imgLoader::RemoveFromCache(nsCString& spec, if (cache.Get(spec, getter_AddRefs(entry)) && entry) { cache.Remove(spec); - NS_ABORT_IF_FALSE(!entry->Evicted(), "Evicting an already-evicted cache entry!"); + MOZ_ASSERT(!entry->Evicted(), "Evicting an already-evicted cache entry!"); // Entries with no proxies are in the tracker. if (entry->HasNoProxies()) { @@ -1990,7 +1990,7 @@ nsresult imgLoader::LoadImage(nsIURI *aURI, // If this entry has no proxies, its request has no reference to the entry. if (entry->HasNoProxies()) { LOG_FUNC_WITH_PARAM(GetImgLog(), "imgLoader::LoadImage() adding proxyless entry", "uri", spec.get()); - NS_ABORT_IF_FALSE(!request->HasCacheEntry(), "Proxyless entry's request has cache entry!"); + MOZ_ASSERT(!request->HasCacheEntry(), "Proxyless entry's request has cache entry!"); request->SetCacheEntry(entry); if (mCacheTracker) @@ -2238,7 +2238,7 @@ nsresult imgLoader::LoadImageWithChannel(nsIChannel *channel, imgINotificationOb // If this entry has no proxies, its request has no reference to the entry. if (entry->HasNoProxies()) { LOG_FUNC_WITH_PARAM(GetImgLog(), "imgLoader::LoadImageWithChannel() adding proxyless entry", "uri", spec.get()); - NS_ABORT_IF_FALSE(!request->HasCacheEntry(), "Proxyless entry's request has cache entry!"); + MOZ_ASSERT(!request->HasCacheEntry(), "Proxyless entry's request has cache entry!"); request->SetCacheEntry(entry); if (mCacheTracker) @@ -2576,9 +2576,9 @@ NS_IMETHODIMP imgCacheValidator::OnStartRequest(nsIRequest *aRequest, nsISupport // Proxies waiting on cache validation should be deferring notifications. // Undefer them. - NS_ABORT_IF_FALSE(proxy->NotificationsDeferred(), - "Proxies waiting on cache validation should be " - "deferring notifications!"); + MOZ_ASSERT(proxy->NotificationsDeferred(), + "Proxies waiting on cache validation should be " + "deferring notifications!"); proxy->SetNotificationsDeferred(false); // Notify synchronously, because we're already in OnStartRequest, an diff --git a/image/src/imgLoader.h b/image/src/imgLoader.h index f90f8d2b80e..f5168e1c2d6 100644 --- a/image/src/imgLoader.h +++ b/image/src/imgLoader.h @@ -46,7 +46,7 @@ public: nsrefcnt AddRef() { NS_PRECONDITION(int32_t(mRefCnt) >= 0, "illegal refcnt"); - NS_ABORT_IF_FALSE(_mOwningThread.GetThread() == PR_GetCurrentThread(), "imgCacheEntry addref isn't thread-safe!"); + MOZ_ASSERT(_mOwningThread.GetThread() == PR_GetCurrentThread(), "imgCacheEntry addref isn't thread-safe!"); ++mRefCnt; NS_LOG_ADDREF(this, mRefCnt, "imgCacheEntry", sizeof(*this)); return mRefCnt; @@ -55,7 +55,7 @@ public: nsrefcnt Release() { NS_PRECONDITION(0 != mRefCnt, "dup release"); - NS_ABORT_IF_FALSE(_mOwningThread.GetThread() == PR_GetCurrentThread(), "imgCacheEntry release isn't thread-safe!"); + MOZ_ASSERT(_mOwningThread.GetThread() == PR_GetCurrentThread(), "imgCacheEntry release isn't thread-safe!"); --mRefCnt; NS_LOG_RELEASE(this, mRefCnt, "imgCacheEntry"); if (mRefCnt == 0) { diff --git a/image/src/imgRequest.cpp b/image/src/imgRequest.cpp index a8de88b0a9b..ec50f85a2c4 100644 --- a/image/src/imgRequest.cpp +++ b/image/src/imgRequest.cpp @@ -104,11 +104,11 @@ nsresult imgRequest::Init(nsIURI *aURI, LOG_FUNC(GetImgLog(), "imgRequest::Init"); - NS_ABORT_IF_FALSE(!mImage, "Multiple calls to init"); - NS_ABORT_IF_FALSE(aURI, "No uri"); - NS_ABORT_IF_FALSE(aCurrentURI, "No current uri"); - NS_ABORT_IF_FALSE(aRequest, "No request"); - NS_ABORT_IF_FALSE(aChannel, "No channel"); + MOZ_ASSERT(!mImage, "Multiple calls to init"); + MOZ_ASSERT(aURI, "No uri"); + MOZ_ASSERT(aCurrentURI, "No current uri"); + MOZ_ASSERT(aRequest, "No request"); + MOZ_ASSERT(aChannel, "No channel"); mProperties = do_CreateInstance("@mozilla.org/properties;1"); @@ -145,12 +145,12 @@ already_AddRefed imgRequest::GetProgressTracker() { if (mImage) { - NS_ABORT_IF_FALSE(!mProgressTracker, - "Should have given mProgressTracker to mImage"); + MOZ_ASSERT(!mProgressTracker, + "Should have given mProgressTracker to mImage"); return mImage->GetProgressTracker(); } else { - NS_ABORT_IF_FALSE(mProgressTracker, - "Should have mProgressTracker until we create mImage"); + MOZ_ASSERT(mProgressTracker, + "Should have mProgressTracker until we create mImage"); nsRefPtr progressTracker = mProgressTracker; MOZ_ASSERT(progressTracker); return progressTracker.forget(); @@ -183,7 +183,7 @@ void imgRequest::AddProxy(imgRequestProxy *proxy) // proxies. nsRefPtr progressTracker = GetProgressTracker(); if (progressTracker->ObserverCount() == 0) { - NS_ABORT_IF_FALSE(mURI, "Trying to SetHasProxies without key uri."); + MOZ_ASSERT(mURI, "Trying to SetHasProxies without key uri."); if (mLoader) { mLoader->SetHasProxies(this); } @@ -214,7 +214,7 @@ nsresult imgRequest::RemoveProxy(imgRequestProxy *proxy, nsresult aStatus) // been cancelled and thus removed from the cache, tell the image loader so // we can be evicted from the cache. if (mCacheEntry) { - NS_ABORT_IF_FALSE(mURI, "Removing last observer without key uri."); + MOZ_ASSERT(mURI, "Removing last observer without key uri."); if (mLoader) { mLoader->SetHasNoProxies(this, mCacheEntry); @@ -644,12 +644,12 @@ NS_IMETHODIMP imgRequest::OnStartRequest(nsIRequest *aRequest, nsISupports *ctxt if (mpchan) { mIsMultiPartChannel = true; } else { - NS_ABORT_IF_FALSE(!mIsMultiPartChannel, "Something went wrong"); + MOZ_ASSERT(!mIsMultiPartChannel, "Something went wrong"); } // If we're not multipart, we shouldn't have an image yet - NS_ABORT_IF_FALSE(mIsMultiPartChannel || !mImage, - "Already have an image for non-multipart request"); + MOZ_ASSERT(mIsMultiPartChannel || !mImage, + "Already have an image for non-multipart request"); /* * If mRequest is null here, then we need to set it so that we'll be able to diff --git a/image/src/imgRequestProxy.cpp b/image/src/imgRequestProxy.cpp index 823fa8f3b74..8cf735d2a37 100644 --- a/image/src/imgRequestProxy.cpp +++ b/image/src/imgRequestProxy.cpp @@ -157,7 +157,7 @@ nsresult imgRequestProxy::Init(imgRequest* aOwner, LOG_SCOPE_WITH_PARAM(GetImgLog(), "imgRequestProxy::Init", "request", aOwner); - NS_ABORT_IF_FALSE(mAnimationConsumers == 0, "Cannot have animation before Init"); + MOZ_ASSERT(mAnimationConsumers == 0, "Cannot have animation before Init"); mBehaviour->SetOwner(aOwner); mListener = aObserver; @@ -392,7 +392,7 @@ imgRequestProxy::LockImage() NS_IMETHODIMP imgRequestProxy::UnlockImage() { - NS_ABORT_IF_FALSE(mLockCount > 0, "calling unlock but no locks!"); + MOZ_ASSERT(mLockCount > 0, "calling unlock but no locks!"); mLockCount--; nsRefPtr image = GetImage(); @@ -921,8 +921,8 @@ void imgRequestProxy::NotifyListener() } else { // We don't have an imgRequest, so we can only notify the clone of our // current state, but we still have to do that asynchronously. - NS_ABORT_IF_FALSE(HasImage(), - "if we have no imgRequest, we should have an Image"); + MOZ_ASSERT(HasImage(), + "if we have no imgRequest, we should have an Image"); progressTracker->NotifyCurrentState(this); } } diff --git a/image/src/imgTools.cpp b/image/src/imgTools.cpp index 0f5341ccdf4..b81ac32deba 100644 --- a/image/src/imgTools.cpp +++ b/image/src/imgTools.cpp @@ -49,8 +49,8 @@ NS_IMETHODIMP imgTools::DecodeImageData(nsIInputStream* aInStr, const nsACString& aMimeType, imgIContainer **aContainer) { - NS_ABORT_IF_FALSE(*aContainer == nullptr, - "Cannot provide an existing image container to DecodeImageData"); + MOZ_ASSERT(*aContainer == nullptr, + "Cannot provide an existing image container to DecodeImageData"); return DecodeImage(aInStr, aMimeType, aContainer); } diff --git a/intl/uconv/util/nsUCSupport.cpp b/intl/uconv/util/nsUCSupport.cpp index dd666d50c95..54849578ec9 100644 --- a/intl/uconv/util/nsUCSupport.cpp +++ b/intl/uconv/util/nsUCSupport.cpp @@ -41,8 +41,8 @@ NS_IMPL_ISUPPORTS(nsBasicDecoderSupport, nsIUnicodeDecoder) void nsBasicDecoderSupport::SetInputErrorBehavior(int32_t aBehavior) { - NS_ABORT_IF_FALSE(aBehavior == kOnError_Recover || aBehavior == kOnError_Signal, - "Unknown behavior for SetInputErrorBehavior"); + MOZ_ASSERT(aBehavior == kOnError_Recover || aBehavior == kOnError_Signal, + "Unknown behavior for SetInputErrorBehavior"); mErrBehavior = aBehavior; } diff --git a/ipc/glue/MessageChannel.h b/ipc/glue/MessageChannel.h index a0e2ebbc875..471b8d9c962 100644 --- a/ipc/glue/MessageChannel.h +++ b/ipc/glue/MessageChannel.h @@ -405,8 +405,8 @@ class MessageChannel : HasResultCodes // Can be run on either thread void AssertWorkerThread() const { - NS_ABORT_IF_FALSE(mWorkerLoopID == MessageLoop::current()->id(), - "not on worker thread!"); + MOZ_ASSERT(mWorkerLoopID == MessageLoop::current()->id(), + "not on worker thread!"); } // The "link" thread is either the I/O thread (ProcessLink) or the @@ -414,8 +414,8 @@ class MessageChannel : HasResultCodes // NOT our worker thread. void AssertLinkThread() const { - NS_ABORT_IF_FALSE(mWorkerLoopID != MessageLoop::current()->id(), - "on worker thread but should not be!"); + MOZ_ASSERT(mWorkerLoopID != MessageLoop::current()->id(), + "on worker thread but should not be!"); } private: diff --git a/ipc/glue/MessageLink.h b/ipc/glue/MessageLink.h index a1d3cf7b02b..a9dfc48b7bc 100644 --- a/ipc/glue/MessageLink.h +++ b/ipc/glue/MessageLink.h @@ -143,8 +143,8 @@ class ProcessLink void AssertIOThread() const { - NS_ABORT_IF_FALSE(mIOLoop == MessageLoop::current(), - "not on I/O thread!"); + MOZ_ASSERT(mIOLoop == MessageLoop::current(), + "not on I/O thread!"); } public: diff --git a/ipc/glue/ProcessChild.cpp b/ipc/glue/ProcessChild.cpp index 2b12526d764..4e5b7f468e0 100644 --- a/ipc/glue/ProcessChild.cpp +++ b/ipc/glue/ProcessChild.cpp @@ -20,8 +20,8 @@ ProcessChild::ProcessChild(ProcessHandle parentHandle) , mUILoop(MessageLoop::current()) , mParentHandle(parentHandle) { - NS_ABORT_IF_FALSE(mUILoop, "UILoop should be created by now"); - NS_ABORT_IF_FALSE(!gProcessChild, "should only be one ProcessChild"); + MOZ_ASSERT(mUILoop, "UILoop should be created by now"); + MOZ_ASSERT(!gProcessChild, "should only be one ProcessChild"); gProcessChild = this; } diff --git a/ipc/glue/SharedMemory.cpp b/ipc/glue/SharedMemory.cpp index b8f0f423bc0..1b4d6c55227 100644 --- a/ipc/glue/SharedMemory.cpp +++ b/ipc/glue/SharedMemory.cpp @@ -82,8 +82,8 @@ SharedMemory::Mapped(size_t aNBytes) void SharedMemory::Unmapped() { - NS_ABORT_IF_FALSE(gShmemMapped >= mMappedSize, - "Can't unmap more than mapped"); + MOZ_ASSERT(gShmemMapped >= mMappedSize, + "Can't unmap more than mapped"); gShmemMapped -= mMappedSize; mMappedSize = 0; } @@ -91,8 +91,8 @@ SharedMemory::Unmapped() /*static*/ void SharedMemory::Destroyed() { - NS_ABORT_IF_FALSE(gShmemAllocated >= mAllocSize, - "Can't destroy more than allocated"); + MOZ_ASSERT(gShmemAllocated >= mAllocSize, + "Can't destroy more than allocated"); gShmemAllocated -= mAllocSize; mAllocSize = 0; } diff --git a/ipc/glue/SharedMemoryBasic_android.cpp b/ipc/glue/SharedMemoryBasic_android.cpp index e3a0cb0118d..87a47b4aa8f 100644 --- a/ipc/glue/SharedMemoryBasic_android.cpp +++ b/ipc/glue/SharedMemoryBasic_android.cpp @@ -54,7 +54,7 @@ SharedMemoryBasic::~SharedMemoryBasic() bool SharedMemoryBasic::Create(size_t aNbytes) { - NS_ABORT_IF_FALSE(-1 == mShmFd, "Already Create()d"); + MOZ_ASSERT(-1 == mShmFd, "Already Create()d"); // Carve a new instance off of /dev/ashmem int shmfd = open("/" ASHMEM_NAME_DEF, O_RDWR, 0600); @@ -77,7 +77,7 @@ SharedMemoryBasic::Create(size_t aNbytes) bool SharedMemoryBasic::Map(size_t nBytes) { - NS_ABORT_IF_FALSE(nullptr == mMemory, "Already Map()d"); + MOZ_ASSERT(nullptr == mMemory, "Already Map()d"); mMemory = mmap(nullptr, nBytes, PROT_READ | PROT_WRITE, @@ -98,7 +98,7 @@ bool SharedMemoryBasic::ShareToProcess(base::ProcessHandle/*unused*/, Handle* aNewHandle) { - NS_ABORT_IF_FALSE(mShmFd >= 0, "Should have been Create()d by now"); + MOZ_ASSERT(mShmFd >= 0, "Should have been Create()d by now"); int shmfdDup = dup(mShmFd); if (-1 == shmfdDup) { diff --git a/ipc/glue/SharedMemorySysV.h b/ipc/glue/SharedMemorySysV.h index 706b437c0df..dc0657ed637 100644 --- a/ipc/glue/SharedMemorySysV.h +++ b/ipc/glue/SharedMemorySysV.h @@ -103,8 +103,8 @@ public: if (shmctl(mHandle, IPC_STAT, &info) < 0) return false; - NS_ABORT_IF_FALSE(nBytes <= info.shm_segsz, - "Segment doesn't have enough space!"); + MOZ_ASSERT(nBytes <= info.shm_segsz, + "Segment doesn't have enough space!"); #endif Mapped(nBytes); @@ -123,7 +123,7 @@ public: Handle GetHandle() const { - NS_ABORT_IF_FALSE(IsHandleValid(mHandle), "invalid handle"); + MOZ_ASSERT(IsHandleValid(mHandle), "invalid handle"); return mHandle; } diff --git a/ipc/glue/Shmem.cpp b/ipc/glue/Shmem.cpp index 09731e366c4..9b730fabfa4 100644 --- a/ipc/glue/Shmem.cpp +++ b/ipc/glue/Shmem.cpp @@ -185,11 +185,11 @@ GetSections(Shmem::SharedMemory* aSegment, char** aData, char** aBackSentinel) { - NS_ABORT_IF_FALSE(aSegment && aFrontSentinel && aData && aBackSentinel, - "NULL param(s)"); + MOZ_ASSERT(aSegment && aFrontSentinel && aData && aBackSentinel, + "null param(s)"); *aFrontSentinel = reinterpret_cast(aSegment->memory()); - NS_ABORT_IF_FALSE(*aFrontSentinel, "NULL memory()"); + MOZ_ASSERT(*aFrontSentinel, "null memory()"); *aHeader = reinterpret_cast(*aFrontSentinel); @@ -211,7 +211,7 @@ GetHeader(Shmem::SharedMemory* aSegment) static void Protect(SharedMemory* aSegment) { - NS_ABORT_IF_FALSE(aSegment, "NULL segment"); + MOZ_ASSERT(aSegment, "null segment"); aSegment->Protect(reinterpret_cast(aSegment->memory()), aSegment->Size(), RightsNone); @@ -220,7 +220,7 @@ Protect(SharedMemory* aSegment) static void Unprotect(SharedMemory* aSegment) { - NS_ABORT_IF_FALSE(aSegment, "NULL segment"); + MOZ_ASSERT(aSegment, "null segment"); aSegment->Protect(reinterpret_cast(aSegment->memory()), aSegment->Size(), RightsRead | RightsWrite); @@ -281,8 +281,8 @@ Shmem::Shmem(IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead, mData(nullptr), mSize(0) { - NS_ABORT_IF_FALSE(mSegment, "NULL segment"); - NS_ABORT_IF_FALSE(aId != 0, "invalid ID"); + MOZ_ASSERT(mSegment, "null segment"); + MOZ_ASSERT(aId != 0, "invalid ID"); Unprotect(mSegment); @@ -296,8 +296,8 @@ Shmem::Shmem(IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead, char check = *frontSentinel; (void)check; - NS_ABORT_IF_FALSE(!strncmp(header->mMagic, sMagic, sizeof(sMagic)), - "invalid segment"); + MOZ_ASSERT(!strncmp(header->mMagic, sMagic, sizeof(sMagic)), + "invalid segment"); mSize = static_cast(header->mSize); size_t pageSize = SharedMemory::SystemPageSize(); @@ -314,9 +314,9 @@ Shmem::Shmem(IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead, void Shmem::AssertInvariants() const { - NS_ABORT_IF_FALSE(mSegment, "NULL segment"); - NS_ABORT_IF_FALSE(mData, "NULL data pointer"); - NS_ABORT_IF_FALSE(mSize > 0, "invalid size"); + MOZ_ASSERT(mSegment, "null segment"); + MOZ_ASSERT(mData, "null data pointer"); + MOZ_ASSERT(mSize > 0, "invalid size"); // if the segment isn't owned by the current process, these will // trigger SIGSEGV char checkMappingFront = *reinterpret_cast(mData); @@ -354,7 +354,7 @@ Shmem::Alloc(IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead, bool aProtect) { NS_ASSERTION(aNBytes <= UINT32_MAX, "Will truncate shmem segment size!"); - NS_ABORT_IF_FALSE(!aProtect || !aUnsafe, "protect => !unsafe"); + MOZ_ASSERT(!aProtect || !aUnsafe, "protect => !unsafe"); size_t pageSize = SharedMemory::SystemPageSize(); nsRefPtr segment; @@ -386,8 +386,8 @@ Shmem::Alloc(IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead, // NB: this can't be a static assert because technically pageSize // isn't known at compile time, event though in practice it's always // going to be 4KiB - NS_ABORT_IF_FALSE(sizeof(Header) <= pageSize, - "Shmem::Header has gotten too big"); + MOZ_ASSERT(sizeof(Header) <= pageSize, + "Shmem::Header has gotten too big"); memcpy(header->mMagic, sMagic, sizeof(sMagic)); header->mSize = static_cast(aNBytes); header->mUnsafe = aUnsafe; @@ -638,7 +638,7 @@ Shmem::ShareTo(IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead, } #endif else { - NS_ABORT_IF_FALSE(false, "unknown shmem type (here?!)"); + MOZ_ASSERT(false, "unknown shmem type (here?!)"); return nullptr; } diff --git a/ipc/ipdl/ipdl/lower.py b/ipc/ipdl/ipdl/lower.py index 1236001b293..f4a65413e29 100644 --- a/ipc/ipdl/ipdl/lower.py +++ b/ipc/ipdl/ipdl/lower.py @@ -310,7 +310,7 @@ function would return true for |Actor[]|.""" def _abortIfFalse(cond, msg): return StmtExpr(ExprCall( - ExprVar('NS_ABORT_IF_FALSE'), + ExprVar('MOZ_ASSERT'), [ cond, ExprLiteral.String(msg) ])) def _runtimeAbort(msg): diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index a2d22740874..affb0b80045 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -4371,9 +4371,8 @@ FrameLayerBuilder::RecomputeVisibilityForItems(nsTArray& aIt NS_ASSERTION(AppUnitsPerDevPixel(cdi->mItem) == aAppUnitsPerDevPixel, "a painted layer should contain items only at the same zoom"); - NS_ABORT_IF_FALSE(clip.HasClip() || - clip.GetRoundedRectCount() == 0, - "If we have rounded rects, we must have a clip rect"); + MOZ_ASSERT(clip.HasClip() || clip.GetRoundedRectCount() == 0, + "If we have rounded rects, we must have a clip rect"); if (!clip.IsRectAffectedByClip(visible.GetBounds())) { cdi->mItem->RecomputeVisibility(aBuilder, &visible); diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index f2c0680931a..fe55750d358 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -219,12 +219,12 @@ GetFrameForChildrenOnlyTransformHint(nsIFrame *aFrame) aFrame = aFrame->GetContent()->GetPrimaryFrame(); if (aFrame->GetType() == nsGkAtoms::svgOuterSVGFrame) { aFrame = aFrame->GetFirstPrincipalChild(); - NS_ABORT_IF_FALSE(aFrame->GetType() == nsGkAtoms::svgOuterSVGAnonChildFrame, - "Where is the nsSVGOuterSVGFrame's anon child??"); + MOZ_ASSERT(aFrame->GetType() == nsGkAtoms::svgOuterSVGAnonChildFrame, + "Where is the nsSVGOuterSVGFrame's anon child??"); } - NS_ABORT_IF_FALSE(aFrame->IsFrameOfType(nsIFrame::eSVG | - nsIFrame::eSVGContainer), - "Children-only transforms only expected on SVG frames"); + MOZ_ASSERT(aFrame->IsFrameOfType(nsIFrame::eSVG | + nsIFrame::eSVGContainer), + "Children-only transforms only expected on SVG frames"); return aFrame; } @@ -278,8 +278,7 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame, NS_ASSERTION(text, "expected to find an ancestor SVGTextFrame"); static_cast(text)->NotifyGlyphMetricsChange(); } else { - NS_ABORT_IF_FALSE(false, "unexpected frame got " - "nsChangeHint_UpdateTextPath"); + MOZ_ASSERT(false, "unexpected frame got nsChangeHint_UpdateTextPath"); } } if (aChange & nsChangeHint_UpdateOpacityLayer) { @@ -846,8 +845,8 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList) "SVG frames should not have continuations " "or ib-split siblings"); for ( ; childFrame; childFrame = childFrame->GetNextSibling()) { - NS_ABORT_IF_FALSE(childFrame->IsFrameOfType(nsIFrame::eSVG), - "Not expecting non-SVG children"); + MOZ_ASSERT(childFrame->IsFrameOfType(nsIFrame::eSVG), + "Not expecting non-SVG children"); // If |childFrame| is dirty or has dirty children, we don't bother // updating overflows since that will happen when it's reflowed. if (!(childFrame->GetStateBits() & @@ -1613,8 +1612,8 @@ RestyleManager::ProcessPendingRestyles() mPresContext->FrameConstructor()->CreateNeededFrames(); // Process non-animation restyles... - NS_ABORT_IF_FALSE(!mIsProcessingRestyles, - "Nesting calls to ProcessPendingRestyles?"); + MOZ_ASSERT(!mIsProcessingRestyles, + "Nesting calls to ProcessPendingRestyles?"); #ifdef DEBUG mIsProcessingRestyles = true; #endif diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index be4a9e25e8c..ff3497fb5f9 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -8991,7 +8991,7 @@ nsCSSFrameConstructor::MaybeRecreateFramesForElement(Element* aElement) static bool IsWhitespaceFrame(nsIFrame* aFrame) { - NS_ABORT_IF_FALSE(aFrame, "invalid argument"); + MOZ_ASSERT(aFrame, "invalid argument"); return aFrame->GetType() == nsGkAtoms::textFrame && aFrame->GetContent()->TextIsOnlyWhitespace(); } @@ -9599,9 +9599,9 @@ nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems( // else, we have a next child and it does not want to be wrapped. So, // we jump back to the beginning of the loop to skip over that child // (and anything else non-wrappable after it) - NS_ABORT_IF_FALSE(!iter.IsDone() && - !iter.item().NeedsAnonFlexOrGridItem(aState), - "hitEnd and/or nextChildNeedsAnonItem lied"); + MOZ_ASSERT(!iter.IsDone() && + !iter.item().NeedsAnonFlexOrGridItem(aState), + "hitEnd and/or nextChildNeedsAnonItem lied"); continue; } } @@ -9644,10 +9644,10 @@ nsCSSFrameConstructor::CreateNeededAnonFlexOrGridItems( newItem->mStyleContext->StyleDisplay()->IsInlineOutsideStyle(); newItem->mIsBlock = !newItem->mIsAllInline; - NS_ABORT_IF_FALSE(!newItem->mIsAllInline && newItem->mIsBlock, - "expecting anonymous flex/grid items to be block-level " - "(this will make a difference when we encounter " - "'align-items: baseline')"); + MOZ_ASSERT(!newItem->mIsAllInline && newItem->mIsBlock, + "expecting anonymous flex/grid items to be block-level " + "(this will make a difference when we encounter " + "'align-items: baseline')"); // Anonymous flex and grid items induce line boundaries around their // contents. @@ -10244,17 +10244,17 @@ nsCSSFrameConstructor::AddFCItemsForAnonymousContent( "ProcessChildren() codepath for this frame"); #endif // Assert some things about this content - NS_ABORT_IF_FALSE(!(content->GetFlags() & - (NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME)), - "Should not be marked as needing frames"); - NS_ABORT_IF_FALSE(!content->IsElement() || - !(content->GetFlags() & ELEMENT_ALL_RESTYLE_FLAGS), - "Should have no pending restyle flags"); - NS_ABORT_IF_FALSE(!content->GetPrimaryFrame(), - "Should have no existing frame"); - NS_ABORT_IF_FALSE(!content->IsNodeOfType(nsINode::eCOMMENT) && - !content->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION), - "Why is someone creating garbage anonymous content"); + MOZ_ASSERT(!(content->GetFlags() & + (NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME)), + "Should not be marked as needing frames"); + MOZ_ASSERT(!content->IsElement() || + !(content->GetFlags() & ELEMENT_ALL_RESTYLE_FLAGS), + "Should have no pending restyle flags"); + MOZ_ASSERT(!content->GetPrimaryFrame(), + "Should have no existing frame"); + MOZ_ASSERT(!content->IsNodeOfType(nsINode::eCOMMENT) && + !content->IsNodeOfType(nsINode::ePROCESSING_INSTRUCTION), + "Why is someone creating garbage anonymous content"); nsRefPtr styleContext; TreeMatchContext::AutoParentDisplayBasedStyleFixupSkipper @@ -10342,8 +10342,8 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState, GetAnonymousContent(aContent, aPossiblyLeafFrame, anonymousItems); #ifdef DEBUG for (uint32_t i = 0; i < anonymousItems.Length(); ++i) { - NS_ABORT_IF_FALSE(anonymousItems[i].mContent->IsRootOfAnonymousSubtree(), - "Content should know it's an anonymous subtree"); + MOZ_ASSERT(anonymousItems[i].mContent->IsRootOfAnonymousSubtree(), + "Content should know it's an anonymous subtree"); } #endif AddFCItemsForAnonymousContent(aState, aFrame, anonymousItems, diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 34f61551b6d..359a4da1c2c 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -1722,8 +1722,8 @@ SetupDirtyRects(const nsRect& aBGClipArea, const nsRect& aCallerDirtyRect, *aDirtyRectGfx = nsLayoutUtils::RectToGfxRect(*aDirtyRect, aAppUnitsPerPixel); NS_WARN_IF_FALSE(aDirtyRect->IsEmpty() || !aDirtyRectGfx->IsEmpty(), "converted dirty rect should not be empty"); - NS_ABORT_IF_FALSE(!aDirtyRect->IsEmpty() || aDirtyRectGfx->IsEmpty(), - "second should be empty if first is"); + MOZ_ASSERT(!aDirtyRect->IsEmpty() || aDirtyRectGfx->IsEmpty(), + "second should be empty if first is"); } /* static */ void @@ -2165,7 +2165,7 @@ ComputeRadialGradientLine(nsPresContext* aPresContext, } default: radiusX = radiusY = 0; - NS_ABORT_IF_FALSE(false, "unknown radial gradient sizing method"); + MOZ_ASSERT(false, "unknown radial gradient sizing method"); } *aRadiusX = radiusX; *aRadiusY = radiusY; @@ -2460,8 +2460,8 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext, gfxFloat lineLength = NS_hypot(lineEnd.x - lineStart.x, lineEnd.y - lineStart.y); - NS_ABORT_IF_FALSE(aGradient->mStops.Length() >= 2, - "The parser should reject gradients with less than two stops"); + MOZ_ASSERT(aGradient->mStops.Length() >= 2, + "The parser should reject gradients with less than two stops"); // Build color stop array and compute stop positions nsTArray stops; @@ -2507,7 +2507,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext, (NSAppUnitsToFloatPixels(calc->mLength, appUnitsPerDevPixel) / lineLength)); break; default: - NS_ABORT_IF_FALSE(false, "Unknown stop position type"); + MOZ_ASSERT(false, "Unknown stop position type"); } if (i > 0) { @@ -2581,7 +2581,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext, } } firstStop = stops[0].mPosition; - NS_ABORT_IF_FALSE(firstStop >= 0.0, "Failed to fix stop offsets"); + MOZ_ASSERT(firstStop >= 0.0, "Failed to fix stop offsets"); } if (aGradient->mShape != NS_STYLE_GRADIENT_SHAPE_LINEAR && !aGradient->mRepeating) { @@ -4629,9 +4629,9 @@ nsImageRenderer::PrepareImage() nsCOMPtr srcImage; DebugOnly rv = mImage->GetImageData()->GetImage(getter_AddRefs(srcImage)); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) && srcImage, - "If GetImage() is failing, mImage->IsComplete() " - "should have returned false"); + MOZ_ASSERT(NS_SUCCEEDED(rv) && srcImage, + "If GetImage() is failing, mImage->IsComplete() " + "should have returned false"); if (!mImage->GetCropRect()) { mImageContainer.swap(srcImage); diff --git a/layout/base/nsCSSRendering.h b/layout/base/nsCSSRendering.h index 12c05b6b2b6..e38164e407f 100644 --- a/layout/base/nsCSSRendering.h +++ b/layout/base/nsCSSRendering.h @@ -463,7 +463,7 @@ struct nsCSSRendering { static nsStyleContext* FindCanvasBackground(nsIFrame* aForFrame, nsIFrame* aRootElementFrame) { - NS_ABORT_IF_FALSE(IsCanvasFrame(aForFrame), "not a canvas frame"); + MOZ_ASSERT(IsCanvasFrame(aForFrame), "not a canvas frame"); if (aRootElementFrame) return FindRootFrameBackground(aRootElementFrame); diff --git a/layout/base/nsChangeHint.h b/layout/base/nsChangeHint.h index fb9b3a36b4a..65a7431c4a6 100644 --- a/layout/base/nsChangeHint.h +++ b/layout/base/nsChangeHint.h @@ -248,9 +248,9 @@ inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint) NS_UpdateHint(result, nsChangeHint_ClearAncestorIntrinsics); } - NS_ABORT_IF_FALSE(NS_IsHintSubset(result, - nsChangeHint_Hints_NotHandledForDescendants), - "something is inconsistent"); + MOZ_ASSERT(NS_IsHintSubset(result, + nsChangeHint_Hints_NotHandledForDescendants), + "something is inconsistent"); return result; } diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 66ad9706eef..b6d71616624 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -4641,7 +4641,7 @@ nsDisplayScrollLayer::GetScrollLayerCount() // layers were created or the property was deleted to early. If the latter, // make sure that nsDisplayScrollInfoLayer is on the bottom of the list so // that it is processed last. - NS_ABORT_IF_FALSE(hasCount, "nsDisplayScrollLayer should always be defined"); + MOZ_ASSERT(hasCount, "nsDisplayScrollLayer should always be defined"); return result; #else return reinterpret_cast(props.Get(nsIFrame::ScrollLayerCount())); @@ -4886,8 +4886,8 @@ nsDisplayTransform::nsDisplayTransform(nsDisplayListBuilder* aBuilder, , mIndex(aIndex) { MOZ_COUNT_CTOR(nsDisplayTransform); - NS_ABORT_IF_FALSE(aFrame, "Must have a frame!"); - NS_ABORT_IF_FALSE(!aFrame->IsTransformed(), "Can't specify a transform getter for a transformed frame!"); + MOZ_ASSERT(aFrame, "Must have a frame!"); + MOZ_ASSERT(!aFrame->IsTransformed(), "Can't specify a transform getter for a transformed frame!"); Init(aBuilder); } @@ -4930,7 +4930,7 @@ nsDisplayTransform::nsDisplayTransform(nsDisplayListBuilder* aBuilder, , mIndex(aIndex) { MOZ_COUNT_CTOR(nsDisplayTransform); - NS_ABORT_IF_FALSE(aFrame, "Must have a frame!"); + MOZ_ASSERT(aFrame, "Must have a frame!"); SetReferenceFrameToAncestor(aBuilder); Init(aBuilder); } @@ -4946,7 +4946,7 @@ nsDisplayTransform::nsDisplayTransform(nsDisplayListBuilder* aBuilder, , mIndex(aIndex) { MOZ_COUNT_CTOR(nsDisplayTransform); - NS_ABORT_IF_FALSE(aFrame, "Must have a frame!"); + MOZ_ASSERT(aFrame, "Must have a frame!"); SetReferenceFrameToAncestor(aBuilder); Init(aBuilder); } @@ -4998,7 +4998,7 @@ nsDisplayTransform::GetDeltaToTransformOrigin(const nsIFrame* aFrame, NSAppUnitsToFloatPixels(*dimensions[index], aAppUnitsPerPixel) * coord.GetPercentValue(); } else { - NS_ABORT_IF_FALSE(coord.GetUnit() == eStyleUnit_Coord, "unexpected unit"); + MOZ_ASSERT(coord.GetUnit() == eStyleUnit_Coord, "unexpected unit"); coords[index] = NSAppUnitsToFloatPixels(coord.GetCoordValue(), aAppUnitsPerPixel); } @@ -5082,7 +5082,7 @@ nsDisplayTransform::GetDeltaToPerspectiveOrigin(const nsIFrame* aFrame, NSAppUnitsToFloatPixels(*dimensions[index], aAppUnitsPerPixel) * coord.GetPercentValue(); } else { - NS_ABORT_IF_FALSE(coord.GetUnit() == eStyleUnit_Coord, "unexpected unit"); + MOZ_ASSERT(coord.GetUnit() == eStyleUnit_Coord, "unexpected unit"); *coords[index] = NSAppUnitsToFloatPixels(coord.GetCoordValue(), aAppUnitsPerPixel); } diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index d56b8a39c69..0ef8dfb4b20 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -1447,10 +1447,10 @@ nsDocumentViewer::Open(nsISupports *aState, nsISHEntry *aSHEntry) DetachFromTopLevelWidget(); nsViewManager *vm = GetViewManager(); - NS_ABORT_IF_FALSE(vm, "no view manager"); + MOZ_ASSERT(vm, "no view manager"); nsView* v = vm->GetRootView(); - NS_ABORT_IF_FALSE(v, "no root view"); - NS_ABORT_IF_FALSE(mParentWidget, "no mParentWidget to set"); + MOZ_ASSERT(v, "no root view"); + MOZ_ASSERT(mParentWidget, "no mParentWidget to set"); v->AttachToTopLevelWidget(mParentWidget); mAttachedToParent = true; @@ -3592,8 +3592,7 @@ nsDocViewerFocusListener::HandleEvent(nsIDOMEvent* aEvent) selCon->RepaintSelection(nsISelectionController::SELECTION_NORMAL); } } else { - NS_ABORT_IF_FALSE(eventType.EqualsLiteral("blur"), - "Unexpected event type"); + MOZ_ASSERT(eventType.EqualsLiteral("blur"), "Unexpected event type"); // If selection was on, disable it. if(selectionStatus == nsISelectionController::SELECTION_ON || selectionStatus == nsISelectionController::SELECTION_ATTENTION) { diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 45ccae6b15e..8afe89e91a3 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -779,8 +779,8 @@ nsLayoutUtils::FindOrCreateIDFor(nsIContent* aContent) nsIContent* nsLayoutUtils::FindContentFor(ViewID aId) { - NS_ABORT_IF_FALSE(aId != FrameMetrics::NULL_SCROLL_ID, - "Cannot find a content element in map for null IDs."); + MOZ_ASSERT(aId != FrameMetrics::NULL_SCROLL_ID, + "Cannot find a content element in map for null IDs."); nsIContent* content; bool exists = GetContentMap().Get(aId, &content); @@ -2189,10 +2189,10 @@ static bool CheckCorner(nscoord aXOffset, nscoord aYOffset, nscoord aXRadius, nscoord aYRadius) { - NS_ABORT_IF_FALSE(aXOffset > 0 && aYOffset > 0, - "must not pass nonpositives to CheckCorner"); - NS_ABORT_IF_FALSE(aXRadius >= 0 && aYRadius >= 0, - "must not pass negatives to CheckCorner"); + MOZ_ASSERT(aXOffset > 0 && aYOffset > 0, + "must not pass nonpositives to CheckCorner"); + MOZ_ASSERT(aXRadius >= 0 && aYRadius >= 0, + "must not pass negatives to CheckCorner"); // Avoid floating point math unless we're either (1) within the // quarter-ellipse area at the rounded corner or (2) outside the @@ -7291,7 +7291,7 @@ nsLayoutUtils::InflationMinFontSizeFor(const nsIFrame *aFrame) } } - NS_ABORT_IF_FALSE(false, "root should always be container"); + MOZ_ASSERT(false, "root should always be container"); return 0; } diff --git a/layout/base/nsPresArena.cpp b/layout/base/nsPresArena.cpp index 1a598e28c99..2beec9407dd 100644 --- a/layout/base/nsPresArena.cpp +++ b/layout/base/nsPresArena.cpp @@ -24,6 +24,8 @@ #include "nsArenaMemoryStats.h" #include "nsPrintfCString.h" +#include + // Size to use for PLArena block allocations. static const size_t ARENA_PAGE_SIZE = 8192; @@ -43,7 +45,7 @@ nsPresArena::~nsPresArena() void* nsPresArena::Allocate(uint32_t aCode, size_t aSize) { - NS_ABORT_IF_FALSE(aSize > 0, "PresArena cannot allocate zero bytes"); + MOZ_ASSERT(aSize > 0, "PresArena cannot allocate zero bytes"); // We only hand out aligned sizes aSize = PL_ARENA_ALIGN(&mPool, aSize); @@ -54,11 +56,11 @@ nsPresArena::Allocate(uint32_t aCode, size_t aSize) nsTArray::index_type len = list->mEntries.Length(); if (list->mEntrySize == 0) { - NS_ABORT_IF_FALSE(len == 0, "list with entries but no recorded size"); + MOZ_ASSERT(len == 0, "list with entries but no recorded size"); list->mEntrySize = aSize; } else { - NS_ABORT_IF_FALSE(list->mEntrySize == aSize, - "different sizes for same object type code"); + MOZ_ASSERT(list->mEntrySize == aSize, + "different sizes for same object type code"); } void* result; @@ -75,13 +77,12 @@ nsPresArena::Allocate(uint32_t aCode, size_t aSize) uintptr_t val = *reinterpret_cast(p); NS_ABORT_IF_FALSE(val == mozPoisonValue(), nsPrintfCString("PresArena: poison overwritten; " - "wanted %.16llx " - "found %.16llx " - "errors in bits %.16llx", + "wanted %.16" PRIx64 " " + "found %.16" PRIx64 " " + "errors in bits %.16" PRIx64 " ", uint64_t(mozPoisonValue()), uint64_t(val), - uint64_t(mozPoisonValue() ^ val) - ).get()); + uint64_t(mozPoisonValue() ^ val)).get()); } } #endif @@ -103,8 +104,8 @@ nsPresArena::Free(uint32_t aCode, void* aPtr) { // Try to recycle this entry. FreeList* list = mFreeLists.GetEntry(aCode); - NS_ABORT_IF_FALSE(list, "no free list for pres arena object"); - NS_ABORT_IF_FALSE(list->mEntrySize > 0, "PresArena cannot free zero bytes"); + MOZ_ASSERT(list, "no free list for pres arena object"); + MOZ_ASSERT(list->mEntrySize > 0, "PresArena cannot free zero bytes"); mozWritePoison(aPtr, list->mEntrySize); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index aa55a89e07b..82f389ee7d0 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -10885,9 +10885,8 @@ void PresShell::QueryIsActive() // Ok, we're an external resource document -- we need to use our display // document's docshell to determine "IsActive" status, since we lack // a container. - NS_ABORT_IF_FALSE(!container, - "external resource doc shouldn't have " - "its own container"); + MOZ_ASSERT(!container, + "external resource doc shouldn't have its own container"); nsIPresShell* displayPresShell = displayDoc->GetShell(); if (displayPresShell) { diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index 731eb3a6b9f..522ab8342fe 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -1027,9 +1027,9 @@ nsRefreshDriver::nsRefreshDriver(nsPresContext* aPresContext) nsRefreshDriver::~nsRefreshDriver() { - NS_ABORT_IF_FALSE(ObserverCount() == 0, - "observers should have unregistered"); - NS_ABORT_IF_FALSE(!mActiveTimer, "timer should be gone"); + MOZ_ASSERT(ObserverCount() == 0, + "observers should have unregistered"); + MOZ_ASSERT(!mActiveTimer, "timer should be gone"); if (mRootRefresh) { mRootRefresh->RemoveRefreshObserver(this, Flush_Style); @@ -1354,7 +1354,7 @@ nsRefreshDriver::ArrayFor(mozFlushType aFlushType) case Flush_Display: return mObservers[2]; default: - NS_ABORT_IF_FALSE(false, "bad flush type"); + MOZ_ASSERT(false, "bad flush type"); return *static_cast(nullptr); } } @@ -1739,7 +1739,7 @@ nsRefreshDriver::ImageRequestEnumerator(nsISupportsHashKey* aEntry, nsCOMArray* imagesToRefresh = static_cast*> (aUserArg); imgIRequest* req = static_cast(aEntry->GetKey()); - NS_ABORT_IF_FALSE(req, "Unable to retrieve the image request"); + MOZ_ASSERT(req, "Unable to retrieve the image request"); nsCOMPtr image; if (NS_SUCCEEDED(req->GetImage(getter_AddRefs(image)))) { imagesToRefresh->AppendElement(image); @@ -1756,7 +1756,7 @@ nsRefreshDriver::BeginRefreshingImages(nsISupportsHashKey* aEntry, static_cast (aUserArg); imgIRequest* req = static_cast(aEntry->GetKey()); - NS_ABORT_IF_FALSE(req, "Unable to retrieve the image request"); + MOZ_ASSERT(req, "Unable to retrieve the image request"); parms->mRequests->PutEntry(req); diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp index dfcb07bef7f..4348919f958 100644 --- a/layout/generic/nsBlockFrame.cpp +++ b/layout/generic/nsBlockFrame.cpp @@ -2691,7 +2691,7 @@ nsBlockFrame::ReflowLine(nsBlockReflowState& aState, line_iterator aLine, bool* aKeepReflowGoing) { - NS_ABORT_IF_FALSE(aLine->GetChildCount(), "reflowing empty line"); + MOZ_ASSERT(aLine->GetChildCount(), "reflowing empty line"); // Setup the line-layout for the new line aState.mCurrentLine = aLine; @@ -2742,9 +2742,9 @@ nsBlockFrame::PullFrameFrom(nsLineBox* aLine, nsLineList::iterator aFromLine) { nsLineBox* fromLine = aFromLine; - NS_ABORT_IF_FALSE(fromLine, "bad line to pull from"); - NS_ABORT_IF_FALSE(fromLine->GetChildCount(), "empty line"); - NS_ABORT_IF_FALSE(aLine->GetChildCount(), "empty line"); + MOZ_ASSERT(fromLine, "bad line to pull from"); + MOZ_ASSERT(fromLine->GetChildCount(), "empty line"); + MOZ_ASSERT(aLine->GetChildCount(), "empty line"); NS_ASSERTION(fromLine->IsBlock() == fromLine->mFirstChild->IsBlockOutside(), "Disagreement about whether it's a block or not"); @@ -2945,7 +2945,7 @@ IsNonAutoNonZeroBSize(const nsStyleCoord& aCoord) return nsRuleNode::ComputeCoordPercentCalc(aCoord, nscoord_MAX) > 0 || nsRuleNode::ComputeCoordPercentCalc(aCoord, 0) > 0; } - NS_ABORT_IF_FALSE(false, "unexpected unit for height or min-height"); + MOZ_ASSERT(false, "unexpected unit for height or min-height"); return true; } @@ -4125,8 +4125,8 @@ nsBlockFrame::SplitFloat(nsBlockReflowState& aState, if (aFloat->StyleDisplay()->mFloats == NS_STYLE_FLOAT_LEFT) { aState.mFloatManager->SetSplitLeftFloatAcrossBreak(); } else { - NS_ABORT_IF_FALSE(aFloat->StyleDisplay()->mFloats == - NS_STYLE_FLOAT_RIGHT, "unexpected float side"); + MOZ_ASSERT(aFloat->StyleDisplay()->mFloats == NS_STYLE_FLOAT_RIGHT, + "unexpected float side"); aState.mFloatManager->SetSplitRightFloatAcrossBreak(); } @@ -4171,10 +4171,10 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState, nsIFrame* aFrame, LineReflowStatus* aLineReflowStatus) { - NS_ABORT_IF_FALSE(aLine->IsInline(), "illegal SplitLine on block line"); + MOZ_ASSERT(aLine->IsInline(), "illegal SplitLine on block line"); int32_t pushCount = aLine->GetChildCount() - aLineLayout.GetCurrentSpanCount(); - NS_ABORT_IF_FALSE(pushCount >= 0, "bad push count"); + MOZ_ASSERT(pushCount >= 0, "bad push count"); #ifdef DEBUG if (gNoisyReflow) { @@ -4195,8 +4195,8 @@ nsBlockFrame::SplitLine(nsBlockReflowState& aState, #endif if (0 != pushCount) { - NS_ABORT_IF_FALSE(aLine->GetChildCount() > pushCount, "bad push"); - NS_ABORT_IF_FALSE(nullptr != aFrame, "whoops"); + MOZ_ASSERT(aLine->GetChildCount() > pushCount, "bad push"); + MOZ_ASSERT(nullptr != aFrame, "whoops"); #ifdef DEBUG { nsIFrame *f = aFrame; @@ -7346,7 +7346,7 @@ nsBlockFrame::VerifyLines(bool aFinalCheckOK) cursor = nullptr; } if (aFinalCheckOK) { - NS_ABORT_IF_FALSE(line->GetChildCount(), "empty line"); + MOZ_ASSERT(line->GetChildCount(), "empty line"); if (line->IsBlock()) { NS_ASSERTION(1 == line->GetChildCount(), "bad first line"); } diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index 8e2c727af24..67db7f064fd 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -417,8 +417,8 @@ nsBlockReflowState::ReconstructMarginBefore(nsLineList::iterator aLine) void nsBlockReflowState::SetupPushedFloatList() { - NS_ABORT_IF_FALSE(!GetFlag(BRS_PROPTABLE_FLOATCLIST) == !mPushedFloats, - "flag mismatch"); + MOZ_ASSERT(!GetFlag(BRS_PROPTABLE_FLOATCLIST) == !mPushedFloats, + "flag mismatch"); if (!GetFlag(BRS_PROPTABLE_FLOATCLIST)) { // If we're being re-Reflow'd without our next-in-flow having been // reflowed, some pushed floats from our previous reflow might @@ -558,13 +558,13 @@ nsBlockReflowState::AddFloat(nsLineLayout* aLineLayout, NS_PRECONDITION(aFloat->GetStateBits() & NS_FRAME_OUT_OF_FLOW, "aFloat must be an out-of-flow frame"); - NS_ABORT_IF_FALSE(aFloat->GetParent(), "float must have parent"); - NS_ABORT_IF_FALSE(aFloat->GetParent()->IsFrameOfType(nsIFrame::eBlockFrame), - "float's parent must be block"); - NS_ABORT_IF_FALSE(aFloat->GetParent() == mBlock || - (aFloat->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT), - "float should be in this block unless it was marked as " - "pushed float"); + MOZ_ASSERT(aFloat->GetParent(), "float must have parent"); + MOZ_ASSERT(aFloat->GetParent()->IsFrameOfType(nsIFrame::eBlockFrame), + "float's parent must be block"); + MOZ_ASSERT(aFloat->GetParent() == mBlock || + (aFloat->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT), + "float should be in this block unless it was marked as " + "pushed float"); if (aFloat->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT) { // If, in a previous reflow, the float was pushed entirely to // another column/page, we need to steal it back. (We might just @@ -948,7 +948,7 @@ nsBlockReflowState::FlowAndPlaceFloat(nsIFrame* aFloat) } DebugOnly rv = mFloatManager->AddFloat(aFloat, region, wm, mContainerWidth); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "bad float placement"); + MOZ_ASSERT(NS_SUCCEEDED(rv), "bad float placement"); // store region nsFloatManager::StoreRegionFor(wm, aFloat, region, mContainerWidth); @@ -1009,9 +1009,8 @@ nsBlockReflowState::PushFloatPastBreak(nsIFrame *aFloat) if (aFloat->StyleDisplay()->mFloats == NS_STYLE_FLOAT_LEFT) { mFloatManager->SetPushedLeftFloatPastBreak(); } else { - NS_ABORT_IF_FALSE(aFloat->StyleDisplay()->mFloats == - NS_STYLE_FLOAT_RIGHT, - "unexpected float value"); + MOZ_ASSERT(aFloat->StyleDisplay()->mFloats == NS_STYLE_FLOAT_RIGHT, + "unexpected float value"); mFloatManager->SetPushedRightFloatPastBreak(); } diff --git a/layout/generic/nsFloatManager.cpp b/layout/generic/nsFloatManager.cpp index fbe6c0a8348..55b3fe497f9 100644 --- a/layout/generic/nsFloatManager.cpp +++ b/layout/generic/nsFloatManager.cpp @@ -133,7 +133,7 @@ nsFloatManager::GetFlowArea(WritingMode aWM, nscoord aBOffset, if (aState) { // Use the provided state. floatCount = aState->mFloatInfoCount; - NS_ABORT_IF_FALSE(floatCount <= mFloats.Length(), "bad state"); + MOZ_ASSERT(floatCount <= mFloats.Length(), "bad state"); } else { // Use our current state. floatCount = mFloats.Length(); diff --git a/layout/generic/nsFontInflationData.cpp b/layout/generic/nsFontInflationData.cpp index 9e33034d19e..8093a62e33e 100644 --- a/layout/generic/nsFontInflationData.cpp +++ b/layout/generic/nsFontInflationData.cpp @@ -154,15 +154,15 @@ ComputeDescendantWidth(const nsHTMLReflowState& aAncestorReflowState, WritingMode wm = frame->GetWritingMode(); LogicalSize availSize = parentReflowState.ComputedSize(wm); availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE; - NS_ABORT_IF_FALSE(frame->GetParent()->FirstInFlow() == - parentReflowState.frame->FirstInFlow(), - "bad logic in this function"); + MOZ_ASSERT(frame->GetParent()->FirstInFlow() == + parentReflowState.frame->FirstInFlow(), + "bad logic in this function"); new (reflowStates + i) nsHTMLReflowState(presContext, parentReflowState, frame, availSize); } - NS_ABORT_IF_FALSE(reflowStates[len - 1].frame == aDescendantFrame, - "bad logic in this function"); + MOZ_ASSERT(reflowStates[len - 1].frame == aDescendantFrame, + "bad logic in this function"); nscoord result = reflowStates[len - 1].ComputedWidth(); for (uint32_t i = len; i-- != 0; ) { @@ -191,9 +191,9 @@ nsFontInflationData::UpdateWidth(const nsHTMLReflowState &aReflowState) } nsIFrame *lastInflatableDescendant = FindEdgeInflatableFrameIn(bfc, eFromEnd); - NS_ABORT_IF_FALSE(!firstInflatableDescendant == !lastInflatableDescendant, - "null-ness should match; NearestCommonAncestorFirstInFlow" - " will crash when passed null"); + MOZ_ASSERT(!firstInflatableDescendant == !lastInflatableDescendant, + "null-ness should match; NearestCommonAncestorFirstInFlow" + " will crash when passed null"); // Particularly when we're computing for the root BFC, the width of // nca might differ significantly for the width of bfc. diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 3aa83c90acd..eced5d560ee 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -5345,8 +5345,8 @@ nsIFrame::GetPositionIgnoringScrolling() nsRect nsIFrame::GetOverflowRect(nsOverflowType aType) const { - NS_ABORT_IF_FALSE(aType == eVisualOverflow || aType == eScrollableOverflow, - "unexpected type"); + MOZ_ASSERT(aType == eVisualOverflow || aType == eScrollableOverflow, + "unexpected type"); // Note that in some cases the overflow area might not have been // updated (yet) to reflect any outline set on the frame or the area diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index 29a54e8580c..9f0da9272e4 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -3128,8 +3128,8 @@ protected: private: nsOverflowAreas* GetOverflowAreasProperty(); nsRect GetVisualOverflowFromDeltas() const { - NS_ABORT_IF_FALSE(mOverflow.mType != NS_FRAME_OVERFLOW_LARGE, - "should not be called when overflow is in a property"); + MOZ_ASSERT(mOverflow.mType != NS_FRAME_OVERFLOW_LARGE, + "should not be called when overflow is in a property"); // Calculate the rect using deltas from the frame's border rect. // Note that the mOverflow.mDeltas fields are unsigned, but we will often // need to return negative values for the left and top, so take care diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index cd01682b0c9..757be6c08af 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -1246,7 +1246,7 @@ nsImageFrame::DisplayAltFeedback(nsRenderingContext& aRenderingContext, nsPoint aPt) { // We should definitely have a gIconLoad here. - NS_ABORT_IF_FALSE(gIconLoad, "How did we succeed in Init then?"); + MOZ_ASSERT(gIconLoad, "How did we succeed in Init then?"); // Calculate the inner area nsRect inner = GetInnerArea() + aPt; diff --git a/layout/generic/nsImageFrame.h b/layout/generic/nsImageFrame.h index f6f6f62a4cf..e88736c005c 100644 --- a/layout/generic/nsImageFrame.h +++ b/layout/generic/nsImageFrame.h @@ -326,14 +326,14 @@ private: NS_DECL_IMGINOTIFICATIONOBSERVER void AddIconObserver(nsImageFrame *frame) { - NS_ABORT_IF_FALSE(!mIconObservers.Contains(frame), - "Observer shouldn't aleady be in array"); + MOZ_ASSERT(!mIconObservers.Contains(frame), + "Observer shouldn't aleady be in array"); mIconObservers.AppendElement(frame); } void RemoveIconObserver(nsImageFrame *frame) { mozilla::DebugOnly didRemove = mIconObservers.RemoveElement(frame); - NS_ABORT_IF_FALSE(didRemove, "Observer not in array"); + MOZ_ASSERT(didRemove, "Observer not in array"); } private: diff --git a/layout/generic/nsImageMap.cpp b/layout/generic/nsImageMap.cpp index 5a62023f9ed..456f9e15bb1 100644 --- a/layout/generic/nsImageMap.cpp +++ b/layout/generic/nsImageMap.cpp @@ -985,8 +985,8 @@ nsImageMap::HandleEvent(nsIDOMEvent* aEvent) nsAutoString eventType; aEvent->GetType(eventType); bool focus = eventType.EqualsLiteral("focus"); - NS_ABORT_IF_FALSE(focus == !eventType.EqualsLiteral("blur"), - "Unexpected event type"); + MOZ_ASSERT(focus == !eventType.EqualsLiteral("blur"), + "Unexpected event type"); //Set which one of our areas changed focus nsCOMPtr targetContent = do_QueryInterface( diff --git a/layout/generic/nsLineBox.cpp b/layout/generic/nsLineBox.cpp index d279d2fdaa8..b8eee3e6808 100644 --- a/layout/generic/nsLineBox.cpp +++ b/layout/generic/nsLineBox.cpp @@ -485,7 +485,7 @@ nsLineBox::MaybeFreeData() nsFloatCache* nsLineBox::GetFirstFloat() { - NS_ABORT_IF_FALSE(IsInline(), "block line can't have floats"); + MOZ_ASSERT(IsInline(), "block line can't have floats"); return mInlineData ? mInlineData->mFloats.Head() : nullptr; } @@ -493,7 +493,7 @@ nsLineBox::GetFirstFloat() void nsLineBox::FreeFloats(nsFloatCacheFreeList& aFreeList) { - NS_ABORT_IF_FALSE(IsInline(), "block line can't have floats"); + MOZ_ASSERT(IsInline(), "block line can't have floats"); if (IsInline() && mInlineData) { if (mInlineData->mFloats.NotEmpty()) { aFreeList.Append(mInlineData->mFloats); @@ -505,7 +505,7 @@ nsLineBox::FreeFloats(nsFloatCacheFreeList& aFreeList) void nsLineBox::AppendFloats(nsFloatCacheFreeList& aFreeList) { - NS_ABORT_IF_FALSE(IsInline(), "block line can't have floats"); + MOZ_ASSERT(IsInline(), "block line can't have floats"); if (IsInline()) { if (aFreeList.NotEmpty()) { if (!mInlineData) { @@ -519,7 +519,7 @@ nsLineBox::AppendFloats(nsFloatCacheFreeList& aFreeList) bool nsLineBox::RemoveFloat(nsIFrame* aFrame) { - NS_ABORT_IF_FALSE(IsInline(), "block line can't have floats"); + MOZ_ASSERT(IsInline(), "block line can't have floats"); if (IsInline() && mInlineData) { nsFloatCache* fc = mInlineData->mFloats.Find(aFrame); if (fc) { diff --git a/layout/generic/nsLineBox.h b/layout/generic/nsLineBox.h index edc927b10a6..4756e491a89 100644 --- a/layout/generic/nsLineBox.h +++ b/layout/generic/nsLineBox.h @@ -776,44 +776,44 @@ class nsLineList_iterator { reference operator*() { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return *static_cast(mCurrent); } pointer operator->() { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } pointer get() { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } operator pointer() { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } const_reference operator*() const { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return *static_cast(mCurrent); } const_pointer operator->() const { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } #ifndef __MWERKS__ operator const_pointer() const { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } #endif /* !__MWERKS__ */ @@ -846,22 +846,22 @@ class nsLineList_iterator { // to keep AIX happy. bool operator==(const iterator_self_type aOther) const { - NS_ABORT_IF_FALSE(mListLink == aOther.mListLink, "comparing iterators over different lists"); + MOZ_ASSERT(mListLink == aOther.mListLink, "comparing iterators over different lists"); return mCurrent == aOther.mCurrent; } bool operator!=(const iterator_self_type aOther) const { - NS_ABORT_IF_FALSE(mListLink == aOther.mListLink, "comparing iterators over different lists"); + MOZ_ASSERT(mListLink == aOther.mListLink, "comparing iterators over different lists"); return mCurrent != aOther.mCurrent; } bool operator==(const iterator_self_type aOther) { - NS_ABORT_IF_FALSE(mListLink == aOther.mListLink, "comparing iterators over different lists"); + MOZ_ASSERT(mListLink == aOther.mListLink, "comparing iterators over different lists"); return mCurrent == aOther.mCurrent; } bool operator!=(const iterator_self_type aOther) { - NS_ABORT_IF_FALSE(mListLink == aOther.mListLink, "comparing iterators over different lists"); + MOZ_ASSERT(mListLink == aOther.mListLink, "comparing iterators over different lists"); return mCurrent != aOther.mCurrent; } @@ -935,44 +935,44 @@ class nsLineList_reverse_iterator { reference operator*() { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return *static_cast(mCurrent); } pointer operator->() { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } pointer get() { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } operator pointer() { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } const_reference operator*() const { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return *static_cast(mCurrent); } const_pointer operator->() const { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } #ifndef __MWERKS__ operator const_pointer() const { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } #endif /* !__MWERKS__ */ @@ -1075,26 +1075,26 @@ class nsLineList_const_iterator { const_reference operator*() const { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return *static_cast(mCurrent); } const_pointer operator->() const { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } const_pointer get() const { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } #ifndef __MWERKS__ operator const_pointer() const { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } #endif /* !__MWERKS__ */ @@ -1209,26 +1209,26 @@ class nsLineList_const_reverse_iterator { const_reference operator*() const { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return *static_cast(mCurrent); } const_pointer operator->() const { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } const_pointer get() const { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } #ifndef __MWERKS__ operator const_pointer() const { - NS_ABORT_IF_FALSE(mCurrent != mListLink, "running past end"); + MOZ_ASSERT(mCurrent != mListLink, "running past end"); return static_cast(mCurrent); } #endif /* !__MWERKS__ */ diff --git a/layout/generic/nsLineLayout.h b/layout/generic/nsLineLayout.h index 102b26681e9..15caf8f27d8 100644 --- a/layout/generic/nsLineLayout.h +++ b/layout/generic/nsLineLayout.h @@ -189,8 +189,9 @@ public: // provided to the line layout. However, floats should never be // associated with ruby text containers, hence this method should // not be called in that case. - NS_ABORT_IF_FALSE(mBlockRS, "Should not call this method " - "if there is no block reflow state available"); + MOZ_ASSERT(mBlockRS, + "Should not call this method if there is no block reflow state " + "available"); return mBlockRS->AddFloat(this, aFloat, aAvailableISize); } diff --git a/layout/generic/nsPluginFrame.cpp b/layout/generic/nsPluginFrame.cpp index 797322dd1e9..b6e211d80b2 100644 --- a/layout/generic/nsPluginFrame.cpp +++ b/layout/generic/nsPluginFrame.cpp @@ -1424,7 +1424,7 @@ nsPluginFrame::BuildLayer(nsDisplayListBuilder* aBuilder, } else { NS_ASSERTION(aItem->GetType() == nsDisplayItem::TYPE_PLUGIN_READBACK, "Unknown item type"); - NS_ABORT_IF_FALSE(!IsOpaque(), "Opaque plugins don't use backgrounds"); + MOZ_ASSERT(!IsOpaque(), "Opaque plugins don't use backgrounds"); if (!layer) { layer = aManager->CreateReadbackLayer(); diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp index 75a10cb0b9b..699c4b0bdbd 100644 --- a/layout/generic/nsTextFrame.cpp +++ b/layout/generic/nsTextFrame.cpp @@ -4372,7 +4372,7 @@ nsTextFrame::SetTextRun(gfxTextRun* aTextRun, TextRunType aWhichTextRun, } SetFontSizeInflation(aInflation); } else { - NS_ABORT_IF_FALSE(aInflation == 1.0f, "unexpected inflation"); + MOZ_ASSERT(aInflation == 1.0f, "unexpected inflation"); if (HasFontSizeInflation()) { Properties().Set(UninflatedTextRunProperty(), aTextRun); return; diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index a2500dee1d8..9cde024ed1d 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -354,21 +354,21 @@ RenderFrameParent::BuildLayer(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem, const ContainerLayerParameters& aContainerParameters) { - NS_ABORT_IF_FALSE(aFrame, - "makes no sense to have a shadow tree without a frame"); - NS_ABORT_IF_FALSE(!mContainer || - IsTempLayerManager(aManager) || - mContainer->Manager() == aManager, - "retaining manager changed out from under us ... HELP!"); + MOZ_ASSERT(aFrame, + "makes no sense to have a shadow tree without a frame"); + MOZ_ASSERT(!mContainer || + IsTempLayerManager(aManager) || + mContainer->Manager() == aManager, + "retaining manager changed out from under us ... HELP!"); if (IsTempLayerManager(aManager) || (mContainer && mContainer->Manager() != aManager)) { // This can happen if aManager is a "temporary" manager, or if the // widget's layer manager changed out from under us. We need to // FIXME handle the former case somehow, probably with an API to - // draw a manager's subtree. The latter is bad bad bad, but the - // the NS_ABORT_IF_FALSE() above will flag it. Returning nullptr - // here will just cause the shadow subtree not to be rendered. + // draw a manager's subtree. The latter is bad bad bad, but the the + // MOZ_ASSERT() above will flag it. Returning nullptr here will just + // cause the shadow subtree not to be rendered. NS_WARNING("Remote iframe not rendered"); return nullptr; } @@ -406,8 +406,8 @@ RenderFrameParent::BuildLayer(nsDisplayListBuilder* aBuilder, void RenderFrameParent::OwnerContentChanged(nsIContent* aContent) { - NS_ABORT_IF_FALSE(mFrameLoader->GetOwnerContent() == aContent, - "Don't build new map if owner is same!"); + MOZ_ASSERT(mFrameLoader->GetOwnerContent() == aContent, + "Don't build new map if owner is same!"); nsRefPtr lm = GetFrom(mFrameLoader); // Perhaps the document containing this frame currently has no presentation? diff --git a/layout/style/AnimationCommon.cpp b/layout/style/AnimationCommon.cpp index 212501e35ff..ced2e24b9cc 100644 --- a/layout/style/AnimationCommon.cpp +++ b/layout/style/AnimationCommon.cpp @@ -60,7 +60,7 @@ CommonAnimationManager::CommonAnimationManager(nsPresContext *aPresContext) CommonAnimationManager::~CommonAnimationManager() { - NS_ABORT_IF_FALSE(!mPresContext, "Disconnect should have been called"); + MOZ_ASSERT(!mPresContext, "Disconnect should have been called"); } void @@ -190,8 +190,8 @@ CommonAnimationManager::MediumFeaturesChanged(nsPresContext* aPresContext) /* virtual */ void CommonAnimationManager::RulesMatching(ElementRuleProcessorData* aData) { - NS_ABORT_IF_FALSE(aData->mPresContext == mPresContext, - "pres context mismatch"); + MOZ_ASSERT(aData->mPresContext == mPresContext, + "pres context mismatch"); nsIStyleRule *rule = GetAnimationRule(aData->mElement, nsCSSPseudoElements::ePseudo_NotPseudoElement); @@ -203,8 +203,8 @@ CommonAnimationManager::RulesMatching(ElementRuleProcessorData* aData) /* virtual */ void CommonAnimationManager::RulesMatching(PseudoElementRuleProcessorData* aData) { - NS_ABORT_IF_FALSE(aData->mPresContext == mPresContext, - "pres context mismatch"); + MOZ_ASSERT(aData->mPresContext == mPresContext, + "pres context mismatch"); if (aData->mPseudoType != nsCSSPseudoElements::ePseudo_before && aData->mPseudoType != nsCSSPseudoElements::ePseudo_after) { return; @@ -293,9 +293,9 @@ CommonAnimationManager::ExtractComputedValueForTransition( aStyleContext, aComputedValue); if (aProperty == eCSSProperty_visibility) { - NS_ABORT_IF_FALSE(aComputedValue.GetUnit() == - StyleAnimationValue::eUnit_Enumerated, - "unexpected unit"); + MOZ_ASSERT(aComputedValue.GetUnit() == + StyleAnimationValue::eUnit_Enumerated, + "unexpected unit"); aComputedValue.SetIntValue(aComputedValue.GetIntValue(), StyleAnimationValue::eUnit_Visibility); } @@ -354,7 +354,7 @@ nsIStyleRule* CommonAnimationManager::GetAnimationRule(mozilla::dom::Element* aElement, nsCSSPseudoElements::Type aPseudoType) { - NS_ABORT_IF_FALSE( + MOZ_ASSERT( aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement || aPseudoType == nsCSSPseudoElements::ePseudo_before || aPseudoType == nsCSSPseudoElements::ePseudo_after, @@ -435,7 +435,7 @@ AnimValuesStyleRule::MapRuleInfoInto(nsRuleData* aRuleData) bool ok = #endif StyleAnimationValue::UncomputeValue(cv.mProperty, cv.mValue, *prop); - NS_ABORT_IF_FALSE(ok, "could not store computed value"); + MOZ_ASSERT(ok, "could not store computed value"); } } } @@ -684,7 +684,7 @@ AnimationPlayerCollection::PropertyDtor(void *aObject, nsIAtom *aPropertyName, AnimationPlayerCollection* collection = static_cast(aPropertyValue); #ifdef DEBUG - NS_ABORT_IF_FALSE(!collection->mCalledPropertyDtor, "can't call dtor twice"); + MOZ_ASSERT(!collection->mCalledPropertyDtor, "can't call dtor twice"); collection->mCalledPropertyDtor = true; #endif delete collection; diff --git a/layout/style/AnimationCommon.h b/layout/style/AnimationCommon.h index 5a684df8bc3..7280ed3ed7e 100644 --- a/layout/style/AnimationCommon.h +++ b/layout/style/AnimationCommon.h @@ -225,8 +225,8 @@ struct AnimationPlayerCollection : public PRCList } ~AnimationPlayerCollection() { - NS_ABORT_IF_FALSE(mCalledPropertyDtor, - "must call destructor through element property dtor"); + MOZ_ASSERT(mCalledPropertyDtor, + "must call destructor through element property dtor"); MOZ_COUNT_DTOR(AnimationPlayerCollection); PR_REMOVE_LINK(this); mManager->ElementCollectionRemoved(); diff --git a/layout/style/CSSCalc.h b/layout/style/CSSCalc.h index 7670fa81f0e..9b71c05bb48 100644 --- a/layout/style/CSSCalc.h +++ b/layout/style/CSSCalc.h @@ -79,20 +79,20 @@ ComputeCalc(const typename CalcOps::input_type& aValue, CalcOps &aOps) switch (CalcOps::GetUnit(aValue)) { case eCSSUnit_Calc: { typename CalcOps::input_array_type *arr = aValue.GetArrayValue(); - NS_ABORT_IF_FALSE(arr->Count() == 1, "unexpected length"); + MOZ_ASSERT(arr->Count() == 1, "unexpected length"); return ComputeCalc(arr->Item(0), aOps); } case eCSSUnit_Calc_Plus: case eCSSUnit_Calc_Minus: { typename CalcOps::input_array_type *arr = aValue.GetArrayValue(); - NS_ABORT_IF_FALSE(arr->Count() == 2, "unexpected length"); + MOZ_ASSERT(arr->Count() == 2, "unexpected length"); typename CalcOps::result_type lhs = ComputeCalc(arr->Item(0), aOps), rhs = ComputeCalc(arr->Item(1), aOps); return aOps.MergeAdditive(CalcOps::GetUnit(aValue), lhs, rhs); } case eCSSUnit_Calc_Times_L: { typename CalcOps::input_array_type *arr = aValue.GetArrayValue(); - NS_ABORT_IF_FALSE(arr->Count() == 2, "unexpected length"); + MOZ_ASSERT(arr->Count() == 2, "unexpected length"); float lhs = aOps.ComputeNumber(arr->Item(0)); typename CalcOps::result_type rhs = ComputeCalc(arr->Item(1), aOps); return aOps.MergeMultiplicativeL(CalcOps::GetUnit(aValue), lhs, rhs); @@ -100,7 +100,7 @@ ComputeCalc(const typename CalcOps::input_type& aValue, CalcOps &aOps) case eCSSUnit_Calc_Times_R: case eCSSUnit_Calc_Divided: { typename CalcOps::input_array_type *arr = aValue.GetArrayValue(); - NS_ABORT_IF_FALSE(arr->Count() == 2, "unexpected length"); + MOZ_ASSERT(arr->Count() == 2, "unexpected length"); typename CalcOps::result_type lhs = ComputeCalc(arr->Item(0), aOps); float rhs = aOps.ComputeNumber(arr->Item(1)); return aOps.MergeMultiplicativeR(CalcOps::GetUnit(aValue), lhs, rhs); @@ -143,8 +143,8 @@ struct BasicCoordCalcOps if (aCalcFunction == eCSSUnit_Calc_Plus) { return NSCoordSaturatingAdd(aValue1, aValue2); } - NS_ABORT_IF_FALSE(aCalcFunction == eCSSUnit_Calc_Minus, - "unexpected unit"); + MOZ_ASSERT(aCalcFunction == eCSSUnit_Calc_Minus, + "unexpected unit"); return NSCoordSaturatingSubtract(aValue1, aValue2, 0); } @@ -152,8 +152,8 @@ struct BasicCoordCalcOps MergeMultiplicativeL(nsCSSUnit aCalcFunction, float aValue1, result_type aValue2) { - NS_ABORT_IF_FALSE(aCalcFunction == eCSSUnit_Calc_Times_L, - "unexpected unit"); + MOZ_ASSERT(aCalcFunction == eCSSUnit_Calc_Times_L, + "unexpected unit"); return NSCoordSaturatingMultiply(aValue2, aValue1); } @@ -161,9 +161,9 @@ struct BasicCoordCalcOps MergeMultiplicativeR(nsCSSUnit aCalcFunction, result_type aValue1, float aValue2) { - NS_ABORT_IF_FALSE(aCalcFunction == eCSSUnit_Calc_Times_R || - aCalcFunction == eCSSUnit_Calc_Divided, - "unexpected unit"); + MOZ_ASSERT(aCalcFunction == eCSSUnit_Calc_Times_R || + aCalcFunction == eCSSUnit_Calc_Divided, + "unexpected unit"); if (aCalcFunction == eCSSUnit_Calc_Divided) { aValue2 = 1.0f / aValue2; } @@ -182,8 +182,8 @@ struct BasicFloatCalcOps if (aCalcFunction == eCSSUnit_Calc_Plus) { return aValue1 + aValue2; } - NS_ABORT_IF_FALSE(aCalcFunction == eCSSUnit_Calc_Minus, - "unexpected unit"); + MOZ_ASSERT(aCalcFunction == eCSSUnit_Calc_Minus, + "unexpected unit"); return aValue1 - aValue2; } @@ -191,8 +191,8 @@ struct BasicFloatCalcOps MergeMultiplicativeL(nsCSSUnit aCalcFunction, float aValue1, result_type aValue2) { - NS_ABORT_IF_FALSE(aCalcFunction == eCSSUnit_Calc_Times_L, - "unexpected unit"); + MOZ_ASSERT(aCalcFunction == eCSSUnit_Calc_Times_L, + "unexpected unit"); return aValue1 * aValue2; } @@ -203,8 +203,8 @@ struct BasicFloatCalcOps if (aCalcFunction == eCSSUnit_Calc_Times_R) { return aValue1 * aValue2; } - NS_ABORT_IF_FALSE(aCalcFunction == eCSSUnit_Calc_Divided, - "unexpected unit"); + MOZ_ASSERT(aCalcFunction == eCSSUnit_Calc_Divided, + "unexpected unit"); return aValue1 / aValue2; } }; @@ -217,7 +217,7 @@ struct NumbersAlreadyNormalizedOps : public CSSValueInputCalcOps { float ComputeNumber(const nsCSSValue& aValue) { - NS_ABORT_IF_FALSE(aValue.GetUnit() == eCSSUnit_Number, "unexpected unit"); + MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Number, "unexpected unit"); return aValue.GetFloatValue(); } }; @@ -260,7 +260,7 @@ SerializeCalc(const typename CalcOps::input_type& aValue, CalcOps &aOps) nsCSSUnit unit = CalcOps::GetUnit(aValue); if (unit == eCSSUnit_Calc) { const typename CalcOps::input_array_type *array = aValue.GetArrayValue(); - NS_ABORT_IF_FALSE(array->Count() == 1, "unexpected length"); + MOZ_ASSERT(array->Count() == 1, "unexpected length"); SerializeCalcInternal(array->Item(0), aOps); } else { SerializeCalcInternal(aValue, aOps); @@ -292,14 +292,14 @@ SerializeCalcInternal(const typename CalcOps::input_type& aValue, CalcOps &aOps) nsCSSUnit unit = CalcOps::GetUnit(aValue); if (IsCalcAdditiveUnit(unit)) { const typename CalcOps::input_array_type *array = aValue.GetArrayValue(); - NS_ABORT_IF_FALSE(array->Count() == 2, "unexpected length"); + MOZ_ASSERT(array->Count() == 2, "unexpected length"); SerializeCalcInternal(array->Item(0), aOps); if (eCSSUnit_Calc_Plus == unit) { aOps.Append(" + "); } else { - NS_ABORT_IF_FALSE(eCSSUnit_Calc_Minus == unit, "unexpected unit"); + MOZ_ASSERT(eCSSUnit_Calc_Minus == unit, "unexpected unit"); aOps.Append(" - "); } @@ -313,7 +313,7 @@ SerializeCalcInternal(const typename CalcOps::input_type& aValue, CalcOps &aOps) } } else if (IsCalcMultiplicativeUnit(unit)) { const typename CalcOps::input_array_type *array = aValue.GetArrayValue(); - NS_ABORT_IF_FALSE(array->Count() == 2, "unexpected length"); + MOZ_ASSERT(array->Count() == 2, "unexpected length"); bool needParens = IsCalcAdditiveUnit(CalcOps::GetUnit(array->Item(0))); if (needParens) { @@ -331,7 +331,7 @@ SerializeCalcInternal(const typename CalcOps::input_type& aValue, CalcOps &aOps) if (eCSSUnit_Calc_Times_L == unit || eCSSUnit_Calc_Times_R == unit) { aOps.Append(" * "); } else { - NS_ABORT_IF_FALSE(eCSSUnit_Calc_Divided == unit, "unexpected unit"); + MOZ_ASSERT(eCSSUnit_Calc_Divided == unit, "unexpected unit"); aOps.Append(" / "); } diff --git a/layout/style/CSSStyleSheet.cpp b/layout/style/CSSStyleSheet.cpp index d25e0d6e8b3..cefb2561630 100644 --- a/layout/style/CSSStyleSheet.cpp +++ b/layout/style/CSSStyleSheet.cpp @@ -1490,8 +1490,8 @@ CSSStyleSheet::EnsureUniqueInner() { mDirty = true; - NS_ABORT_IF_FALSE(mInner->mSheets.Length() != 0, - "unexpected number of outers"); + MOZ_ASSERT(mInner->mSheets.Length() != 0, + "unexpected number of outers"); if (mInner->mSheets.Length() == 1) { return eUniqueInner_AlreadyUnique; } @@ -1614,8 +1614,8 @@ CSSStyleSheet::WillDirty() void CSSStyleSheet::DidDirty() { - NS_ABORT_IF_FALSE(!mInner->mComplete || mDirty, - "caller must have called WillDirty()"); + MOZ_ASSERT(!mInner->mComplete || mDirty, + "caller must have called WillDirty()"); ClearRuleCascades(); } diff --git a/layout/style/CounterStyleManager.cpp b/layout/style/CounterStyleManager.cpp index 3b54acdf0b6..5274e11dd1b 100644 --- a/layout/style/CounterStyleManager.cpp +++ b/layout/style/CounterStyleManager.cpp @@ -53,8 +53,8 @@ GetCyclicCounterText(CounterValue aOrdinal, nsSubstring& aResult, const nsTArray& aSymbols) { - NS_ABORT_IF_FALSE(aSymbols.Length() >= 1, - "No symbol available for cyclic counter."); + MOZ_ASSERT(aSymbols.Length() >= 1, + "No symbol available for cyclic counter."); auto n = aSymbols.Length(); CounterValue index = (aOrdinal - 1) % n; aResult = aSymbols[index >= 0 ? index : index + n]; @@ -81,9 +81,9 @@ GetSymbolicCounterText(CounterValue aOrdinal, nsSubstring& aResult, const nsTArray& aSymbols) { - NS_ABORT_IF_FALSE(aSymbols.Length() >= 1, - "No symbol available for symbolic counter."); - NS_ABORT_IF_FALSE(aOrdinal >= 0, "Invalid ordinal."); + MOZ_ASSERT(aSymbols.Length() >= 1, + "No symbol available for symbolic counter."); + MOZ_ASSERT(aOrdinal >= 0, "Invalid ordinal."); if (aOrdinal == 0) { return false; } @@ -110,9 +110,9 @@ GetAlphabeticCounterText(CounterValue aOrdinal, nsSubstring& aResult, const nsTArray& aSymbols) { - NS_ABORT_IF_FALSE(aSymbols.Length() >= 2, - "Too few symbols for alphabetic counter."); - NS_ABORT_IF_FALSE(aOrdinal >= 0, "Invalid ordinal."); + MOZ_ASSERT(aSymbols.Length() >= 2, + "Too few symbols for alphabetic counter."); + MOZ_ASSERT(aOrdinal >= 0, "Invalid ordinal."); if (aOrdinal == 0) { return false; } @@ -140,9 +140,9 @@ GetNumericCounterText(CounterValue aOrdinal, nsSubstring& aResult, const nsTArray& aSymbols) { - NS_ABORT_IF_FALSE(aSymbols.Length() >= 2, - "Too few symbols for numeric counter."); - NS_ABORT_IF_FALSE(aOrdinal >= 0, "Invalid ordinal."); + MOZ_ASSERT(aSymbols.Length() >= 2, + "Too few symbols for numeric counter."); + MOZ_ASSERT(aOrdinal >= 0, "Invalid ordinal."); if (aOrdinal == 0) { aResult = aSymbols[0]; @@ -168,7 +168,7 @@ GetAdditiveCounterText(CounterValue aOrdinal, nsSubstring& aResult, const nsTArray& aSymbols) { - NS_ABORT_IF_FALSE(aOrdinal >= 0, "Invalid ordinal."); + MOZ_ASSERT(aOrdinal >= 0, "Invalid ordinal."); if (aOrdinal == 0) { const AdditiveSymbol& last = aSymbols.LastElement(); @@ -545,8 +545,8 @@ EthiopicToText(CounterValue aOrdinal, nsSubstring& aResult) static uint8_t GetDefaultSpeakAsForSystem(uint8_t aSystem) { - NS_ABORT_IF_FALSE(aSystem != NS_STYLE_COUNTER_SYSTEM_EXTENDS, - "Extends system does not have static default speak-as"); + MOZ_ASSERT(aSystem != NS_STYLE_COUNTER_SYSTEM_EXTENDS, + "Extends system does not have static default speak-as"); switch (aSystem) { case NS_STYLE_COUNTER_SYSTEM_ALPHABETIC: return NS_STYLE_COUNTER_SPEAKAS_SPELL_OUT; @@ -560,8 +560,8 @@ GetDefaultSpeakAsForSystem(uint8_t aSystem) static bool SystemUsesNegativeSign(uint8_t aSystem) { - NS_ABORT_IF_FALSE(aSystem != NS_STYLE_COUNTER_SYSTEM_EXTENDS, - "Cannot check this for extending style"); + MOZ_ASSERT(aSystem != NS_STYLE_COUNTER_SYSTEM_EXTENDS, + "Cannot check this for extending style"); switch (aSystem) { case NS_STYLE_COUNTER_SYSTEM_SYMBOLIC: case NS_STYLE_COUNTER_SYSTEM_ALPHABETIC: @@ -960,7 +960,7 @@ public: mManager(aManager) { NS_ASSERTION(IsDependentStyle(), "Not a dependent builtin style"); - NS_ABORT_IF_FALSE(!IsCustomStyle(), "Not a builtin style"); + MOZ_ASSERT(!IsCustomStyle(), "Not a builtin style"); } virtual CounterStyle* GetFallback() MOZ_OVERRIDE; @@ -1261,8 +1261,8 @@ CustomCounterStyle::GetSpokenCounterText(CounterValue aOrdinal, CounterStyle::GetSpokenCounterText( aOrdinal, aWritingMode, aResult, aIsBullet); } else { - NS_ABORT_IF_FALSE(mSpeakAsCounter, - "mSpeakAsCounter should have been initialized."); + MOZ_ASSERT(mSpeakAsCounter, + "mSpeakAsCounter should have been initialized."); mSpeakAsCounter->GetSpokenCounterText( aOrdinal, aWritingMode, aResult, aIsBullet); } @@ -1961,7 +1961,7 @@ CounterStyleManager::CounterStyleManager(nsPresContext* aPresContext) CounterStyleManager::~CounterStyleManager() { - NS_ABORT_IF_FALSE(!mPresContext, "Disconnect should have been called"); + MOZ_ASSERT(!mPresContext, "Disconnect should have been called"); } /* static */ void @@ -2037,10 +2037,10 @@ CounterStyleManager::BuildCounterStyle(const nsCSSValue::Array* aParams) /* static */ CounterStyle* CounterStyleManager::GetBuiltinStyle(int32_t aStyle) { - NS_ABORT_IF_FALSE(0 <= aStyle && aStyle < NS_STYLE_LIST_STYLE__MAX, - "Require a valid builtin style constant"); - NS_ABORT_IF_FALSE(!gBuiltinStyleTable[aStyle].IsDependentStyle(), - "Cannot get dependent builtin style"); + MOZ_ASSERT(0 <= aStyle && aStyle < NS_STYLE_LIST_STYLE__MAX, + "Require a valid builtin style constant"); + MOZ_ASSERT(!gBuiltinStyleTable[aStyle].IsDependentStyle(), + "Cannot get dependent builtin style"); return &gBuiltinStyleTable[aStyle]; } diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index c004e29539a..6a0c7fa1a10 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -50,10 +50,10 @@ Declaration::~Declaration() void Declaration::ValueAppended(nsCSSProperty aProperty) { - NS_ABORT_IF_FALSE(!mData && !mImportantData, - "should only be called while expanded"); - NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(aProperty), - "shorthands forbidden"); + MOZ_ASSERT(!mData && !mImportantData, + "should only be called while expanded"); + MOZ_ASSERT(!nsCSSProps::IsShorthand(aProperty), + "shorthands forbidden"); // order IS important for CSS, so remove and add to the end mOrder.RemoveElement(static_cast(aProperty)); mOrder.AppendElement(static_cast(aProperty)); @@ -66,7 +66,7 @@ Declaration::RemoveProperty(nsCSSProperty aProperty) nsCSSExpandedDataBlock data; ExpandTo(&data); - NS_ABORT_IF_FALSE(!mData && !mImportantData, "Expand didn't null things out"); + MOZ_ASSERT(!mData && !mImportantData, "Expand didn't null things out"); if (nsCSSProps::IsShorthand(aProperty)) { CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(p, aProperty, @@ -85,9 +85,8 @@ Declaration::RemoveProperty(nsCSSProperty aProperty) bool Declaration::HasProperty(nsCSSProperty aProperty) const { - NS_ABORT_IF_FALSE(0 <= aProperty && - aProperty < eCSSProperty_COUNT_no_shorthands, - "property ID out of range"); + MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, + "property ID out of range"); nsCSSCompressedDataBlock *data = GetValueIsImportant(aProperty) ? mImportantData : mData; @@ -100,9 +99,8 @@ Declaration::AppendValueToString(nsCSSProperty aProperty, nsAString& aResult, nsCSSValue::Serialization aSerialization) const { - NS_ABORT_IF_FALSE(0 <= aProperty && - aProperty < eCSSProperty_COUNT_no_shorthands, - "property ID out of range"); + MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, + "property ID out of range"); nsCSSCompressedDataBlock *data = GetValueIsImportant(aProperty) ? mImportantData : mData; @@ -177,8 +175,8 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, } ++totalCount; const nsCSSValue *val = mData->ValueFor(*p); - NS_ABORT_IF_FALSE(!val || !mImportantData || !mImportantData->ValueFor(*p), - "can't be in both blocks"); + MOZ_ASSERT(!val || !mImportantData || !mImportantData->ValueFor(*p), + "can't be in both blocks"); if (!val && mImportantData) { ++importantCount; val = mImportantData->ValueFor(*p); @@ -249,14 +247,14 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, case eCSSProperty_border_width: { const nsCSSProperty* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); - NS_ABORT_IF_FALSE(nsCSSProps::GetStringValue(subprops[0]).Find("-top") != - kNotFound, "first subprop must be top"); - NS_ABORT_IF_FALSE(nsCSSProps::GetStringValue(subprops[1]).Find("-right") != - kNotFound, "second subprop must be right"); - NS_ABORT_IF_FALSE(nsCSSProps::GetStringValue(subprops[2]).Find("-bottom") != - kNotFound, "third subprop must be bottom"); - NS_ABORT_IF_FALSE(nsCSSProps::GetStringValue(subprops[3]).Find("-left") != - kNotFound, "fourth subprop must be left"); + MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[0]).Find("-top") != + kNotFound, "first subprop must be top"); + MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[1]).Find("-right") != + kNotFound, "second subprop must be right"); + MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[2]).Find("-bottom") != + kNotFound, "third subprop must be bottom"); + MOZ_ASSERT(nsCSSProps::GetStringValue(subprops[3]).Find("-left") != + kNotFound, "fourth subprop must be left"); const nsCSSValue* vals[4] = { data->ValueFor(subprops[0]), data->ValueFor(subprops[1]), @@ -375,9 +373,9 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, case eCSSProperty_outline: { const nsCSSProperty* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); - NS_ABORT_IF_FALSE(StringEndsWith(nsCSSProps::GetStringValue(subprops[2]), - NS_LITERAL_CSTRING("-color")), - "third subprop must be the color property"); + MOZ_ASSERT(StringEndsWith(nsCSSProps::GetStringValue(subprops[2]), + NS_LITERAL_CSTRING("-color")), + "third subprop must be the color property"); const nsCSSValue *colorValue = data->ValueFor(subprops[2]); bool isMozUseTextColor = colorValue->GetUnit() == eCSSUnit_Enumerated && @@ -458,9 +456,9 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, aSerialization); } - NS_ABORT_IF_FALSE(clip->mValue.GetUnit() == eCSSUnit_Enumerated && - origin->mValue.GetUnit() == eCSSUnit_Enumerated, - "should not have inherit/initial within list"); + MOZ_ASSERT(clip->mValue.GetUnit() == eCSSUnit_Enumerated && + origin->mValue.GetUnit() == eCSSUnit_Enumerated, + "should not have inherit/initial within list"); if (clip->mValue.GetIntValue() != NS_STYLE_BG_CLIP_BORDER || origin->mValue.GetIntValue() != NS_STYLE_BG_ORIGIN_PADDING) { @@ -822,8 +820,8 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, const nsCSSProperty* subprops = nsCSSProps::SubpropertyEntryFor(eCSSProperty_animation); static const size_t numProps = 8; - NS_ABORT_IF_FALSE(subprops[numProps] == eCSSProperty_UNKNOWN, - "unexpected number of subproperties"); + MOZ_ASSERT(subprops[numProps] == eCSSProperty_UNKNOWN, + "unexpected number of subproperties"); const nsCSSValue* values[numProps]; const nsCSSValueList* lists[numProps]; @@ -839,9 +837,8 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, for (;;) { // We must serialize 'animation-name' last in case it has // a value that conflicts with one of the other keyword properties. - NS_ABORT_IF_FALSE(subprops[numProps - 1] == - eCSSProperty_animation_name, - "animation-name must be last"); + MOZ_ASSERT(subprops[numProps - 1] == eCSSProperty_animation_name, + "animation-name must be last"); bool done = false; for (uint32_t i = 0;;) { lists[i]->mValue.AppendToString(subprops[i], aValue, aSerialization); @@ -904,8 +901,8 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, // flex-direction, flex-wrap, separated by single space const nsCSSProperty* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); - NS_ABORT_IF_FALSE(subprops[2] == eCSSProperty_UNKNOWN, - "must have exactly two subproperties"); + MOZ_ASSERT(subprops[2] == eCSSProperty_UNKNOWN, + "must have exactly two subproperties"); AppendValueToString(subprops[0], aValue, aSerialization); aValue.Append(char16_t(' ')); @@ -917,8 +914,8 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, // grid-{row,column}-start, grid-{row,column}-end, separated by a slash const nsCSSProperty* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); - NS_ABORT_IF_FALSE(subprops[2] == eCSSProperty_UNKNOWN, - "must have exactly two subproperties"); + MOZ_ASSERT(subprops[2] == eCSSProperty_UNKNOWN, + "must have exactly two subproperties"); // TODO: should we simplify when possible? AppendValueToString(subprops[0], aValue, aSerialization); @@ -929,8 +926,8 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, case eCSSProperty_grid_area: { const nsCSSProperty* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); - NS_ABORT_IF_FALSE(subprops[4] == eCSSProperty_UNKNOWN, - "must have exactly four subproperties"); + MOZ_ASSERT(subprops[4] == eCSSProperty_UNKNOWN, + "must have exactly four subproperties"); // TODO: should we simplify when possible? AppendValueToString(subprops[0], aValue, aSerialization); @@ -1082,8 +1079,8 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, // shorthands that are just aliases with different parsing rules const nsCSSProperty* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); - NS_ABORT_IF_FALSE(subprops[1] == eCSSProperty_UNKNOWN, - "must have exactly one subproperty"); + MOZ_ASSERT(subprops[1] == eCSSProperty_UNKNOWN, + "must have exactly one subproperty"); AppendValueToString(subprops[0], aValue, aSerialization); break; } @@ -1094,7 +1091,7 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, // so serialize as the empty string. break; default: - NS_ABORT_IF_FALSE(false, "no other shorthands"); + MOZ_ASSERT(false, "no other shorthands"); break; } } @@ -1145,11 +1142,10 @@ Declaration::AppendPropertyAndValueToString(nsCSSProperty aProperty, nsAutoString& aValue, nsAString& aResult) const { - NS_ABORT_IF_FALSE(0 <= aProperty && aProperty < eCSSProperty_COUNT, - "property enum out of range"); - NS_ABORT_IF_FALSE((aProperty < eCSSProperty_COUNT_no_shorthands) == - aValue.IsEmpty(), - "aValue should be given for shorthands but not longhands"); + MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT, + "property enum out of range"); + MOZ_ASSERT((aProperty < eCSSProperty_COUNT_no_shorthands) == aValue.IsEmpty(), + "aValue should be given for shorthands but not longhands"); AppendASCIItoUTF16(nsCSSProps::GetStringValue(aProperty), aResult); aResult.AppendLiteral(": "); if (aValue.IsEmpty()) @@ -1317,7 +1313,7 @@ Declaration::ToString(nsAString& aString) const if (doneProperty) continue; - NS_ABORT_IF_FALSE(value.IsEmpty(), "value should be empty now"); + MOZ_ASSERT(value.IsEmpty(), "value should be empty now"); AppendPropertyAndValueToString(property, value, aString); } if (! aString.IsEmpty()) { @@ -1366,14 +1362,14 @@ Declaration::GetNthProperty(uint32_t aIndex, nsAString& aReturn) const void Declaration::InitializeEmpty() { - NS_ABORT_IF_FALSE(!mData && !mImportantData, "already initialized"); + MOZ_ASSERT(!mData && !mImportantData, "already initialized"); mData = nsCSSCompressedDataBlock::CreateEmptyBlock(); } Declaration* Declaration::EnsureMutable() { - NS_ABORT_IF_FALSE(mData, "should only be called when not expanded"); + MOZ_ASSERT(mData, "should only be called when not expanded"); if (!IsMutable()) { return new Declaration(*this); } else { diff --git a/layout/style/Declaration.h b/layout/style/Declaration.h index 8dcdf46ad04..0f7ae3f2a91 100644 --- a/layout/style/Declaration.h +++ b/layout/style/Declaration.h @@ -143,8 +143,8 @@ public: * Callers must make sure mOrder is updated as necessary. */ void CompressFrom(nsCSSExpandedDataBlock *aExpandedData) { - NS_ABORT_IF_FALSE(!mData, "oops"); - NS_ABORT_IF_FALSE(!mImportantData, "oops"); + MOZ_ASSERT(!mData, "oops"); + MOZ_ASSERT(!mImportantData, "oops"); aExpandedData->Compress(getter_Transfers(mData), getter_Transfers(mImportantData), mOrder); @@ -162,7 +162,7 @@ public: AssertMutable(); aExpandedData->AssertInitialState(); - NS_ABORT_IF_FALSE(mData, "oops"); + MOZ_ASSERT(mData, "oops"); aExpandedData->Expand(mData.forget(), mImportantData.forget()); } @@ -171,16 +171,16 @@ public: * rule using this declaration for storage. */ void MapNormalRuleInfoInto(nsRuleData *aRuleData) const { - NS_ABORT_IF_FALSE(mData, "called while expanded"); + MOZ_ASSERT(mData, "called while expanded"); mData->MapRuleInfoInto(aRuleData); if (mVariables) { mVariables->MapRuleInfoInto(aRuleData); } } void MapImportantRuleInfoInto(nsRuleData *aRuleData) const { - NS_ABORT_IF_FALSE(mData, "called while expanded"); - NS_ABORT_IF_FALSE(mImportantData || mImportantVariables, - "must have important data or variables"); + MOZ_ASSERT(mData, "called while expanded"); + MOZ_ASSERT(mImportantData || mImportantVariables, + "must have important data or variables"); if (mImportantData) { mImportantData->MapRuleInfoInto(aRuleData); } @@ -204,7 +204,7 @@ public: bool* aChanged) { AssertMutable(); - NS_ABORT_IF_FALSE(mData, "called while expanded"); + MOZ_ASSERT(mData, "called while expanded"); if (nsCSSProps::IsShorthand(aProperty)) { *aChanged = false; @@ -220,16 +220,16 @@ public: #ifdef DEBUG { nsCSSCompressedDataBlock *other = aIsImportant ? mData : mImportantData; - NS_ABORT_IF_FALSE(!other || !other->ValueFor(aProperty) || - !block->ValueFor(aProperty), - "Property both important and not?"); + MOZ_ASSERT(!other || !other->ValueFor(aProperty) || + !block->ValueFor(aProperty), + "Property both important and not?"); } #endif return block->TryReplaceValue(aProperty, aFromBlock, aChanged); } bool HasNonImportantValueFor(nsCSSProperty aProperty) const { - NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(aProperty), "must be longhand"); + MOZ_ASSERT(!nsCSSProps::IsShorthand(aProperty), "must be longhand"); return !!mData->ValueFor(aProperty); } @@ -249,7 +249,7 @@ public: * Crash if |this| cannot be modified. */ void AssertMutable() const { - NS_ABORT_IF_FALSE(IsMutable(), "someone forgot to call EnsureMutable"); + MOZ_ASSERT(IsMutable(), "someone forgot to call EnsureMutable"); } /** diff --git a/layout/style/ErrorReporter.cpp b/layout/style/ErrorReporter.cpp index cf35e939dc3..f52550fb065 100644 --- a/layout/style/ErrorReporter.cpp +++ b/layout/style/ErrorReporter.cpp @@ -71,8 +71,8 @@ static ShortTermURISpecCache *sSpecCache; static bool InitGlobals() { - NS_ABORT_IF_FALSE(!sConsoleService && !sScriptErrorFactory && !sStringBundle, - "should not have been called"); + MOZ_ASSERT(!sConsoleService && !sScriptErrorFactory && !sStringBundle, + "should not have been called"); if (NS_FAILED(Preferences::AddBoolVarCache(&sReportErrors, CSS_ERRORS_PREF, true))) { diff --git a/layout/style/FontFaceSet.cpp b/layout/style/FontFaceSet.cpp index b424d5b60b5..817c44492ea 100644 --- a/layout/style/FontFaceSet.cpp +++ b/layout/style/FontFaceSet.cpp @@ -874,8 +874,8 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(const nsAString& aFamilyName, if (unit == eCSSUnit_Array) { unicodeRanges = new gfxCharacterMap(); const nsCSSValue::Array& sources = *val.GetArrayValue(); - NS_ABORT_IF_FALSE(sources.Count() % 2 == 0, - "odd number of entries in a unicode-range: array"); + MOZ_ASSERT(sources.Count() % 2 == 0, + "odd number of entries in a unicode-range: array"); for (uint32_t i = 0; i < sources.Count(); i += 2) { uint32_t min = sources[i].GetIntValue(); diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index 7dc0655ed31..bb25e35631d 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -1846,8 +1846,8 @@ Loader::DoSheetComplete(SheetLoadData* aLoadData, nsresult aStatus, // If mSheetAlreadyComplete, then the sheet could well be modified between // when we posted the async call to SheetComplete and now, since the sheet // was page-accessible during that whole time. - NS_ABORT_IF_FALSE(!data->mSheet->IsModified(), - "should not get marked modified during parsing"); + MOZ_ASSERT(!data->mSheet->IsModified(), + "should not get marked modified during parsing"); data->mSheet->SetComplete(); data->ScheduleLoadEventIfNeeded(aStatus); } @@ -2098,8 +2098,8 @@ HaveAncestorDataWithURI(SheetLoadData *aData, nsIURI *aURI) { if (!aData->mURI) { // Inline style; this won't have any ancestors - NS_ABORT_IF_FALSE(!aData->mParentData, - "How does inline style have a parent?"); + MOZ_ASSERT(!aData->mParentData, + "How does inline style have a parent?"); return false; } diff --git a/layout/style/MediaQueryList.cpp b/layout/style/MediaQueryList.cpp index 8b6a048d304..77ca6f95009 100644 --- a/layout/style/MediaQueryList.cpp +++ b/layout/style/MediaQueryList.cpp @@ -72,8 +72,8 @@ bool MediaQueryList::Matches() { if (!mMatchesValid) { - NS_ABORT_IF_FALSE(!HasListeners(), - "when listeners present, must keep mMatches current"); + MOZ_ASSERT(!HasListeners(), + "when listeners present, must keep mMatches current"); RecomputeMatches(); } @@ -91,8 +91,8 @@ MediaQueryList::AddListener(MediaQueryListListener& aListener) } if (!mMatchesValid) { - NS_ABORT_IF_FALSE(!HasListeners(), - "when listeners present, must keep mMatches current"); + MOZ_ASSERT(!HasListeners(), + "when listeners present, must keep mMatches current"); RecomputeMatches(); } diff --git a/layout/style/StyleAnimationValue.cpp b/layout/style/StyleAnimationValue.cpp index 796d2d4cc50..8736ba47dac 100644 --- a/layout/style/StyleAnimationValue.cpp +++ b/layout/style/StyleAnimationValue.cpp @@ -174,8 +174,8 @@ ToPrimitive(nsCSSValue::Array* aArray) switch(tfunc) { case eCSSKeyword_translate: { - NS_ABORT_IF_FALSE(aArray->Count() == 2 || aArray->Count() == 3, - "unexpected count"); + MOZ_ASSERT(aArray->Count() == 2 || aArray->Count() == 3, + "unexpected count"); arr->Item(1) = aArray->Item(1); arr->Item(2) = aArray->Count() == 3 ? aArray->Item(2) : zero; arr->Item(3) = zero; @@ -183,7 +183,7 @@ ToPrimitive(nsCSSValue::Array* aArray) } case eCSSKeyword_translatex: { - NS_ABORT_IF_FALSE(aArray->Count() == 2, "unexpected count"); + MOZ_ASSERT(aArray->Count() == 2, "unexpected count"); arr->Item(1) = aArray->Item(1); arr->Item(2) = zero; arr->Item(3) = zero; @@ -191,7 +191,7 @@ ToPrimitive(nsCSSValue::Array* aArray) } case eCSSKeyword_translatey: { - NS_ABORT_IF_FALSE(aArray->Count() == 2, "unexpected count"); + MOZ_ASSERT(aArray->Count() == 2, "unexpected count"); arr->Item(1) = zero; arr->Item(2) = aArray->Item(1); arr->Item(3) = zero; @@ -199,7 +199,7 @@ ToPrimitive(nsCSSValue::Array* aArray) } case eCSSKeyword_translatez: { - NS_ABORT_IF_FALSE(aArray->Count() == 2, "unexpected count"); + MOZ_ASSERT(aArray->Count() == 2, "unexpected count"); arr->Item(1) = zero; arr->Item(2) = zero; arr->Item(3) = aArray->Item(1); @@ -207,8 +207,8 @@ ToPrimitive(nsCSSValue::Array* aArray) } case eCSSKeyword_scale: { - NS_ABORT_IF_FALSE(aArray->Count() == 2 || aArray->Count() == 3, - "unexpected count"); + MOZ_ASSERT(aArray->Count() == 2 || aArray->Count() == 3, + "unexpected count"); arr->Item(1) = aArray->Item(1); arr->Item(2) = aArray->Count() == 3 ? aArray->Item(2) : aArray->Item(1); arr->Item(3) = one; @@ -216,7 +216,7 @@ ToPrimitive(nsCSSValue::Array* aArray) } case eCSSKeyword_scalex: { - NS_ABORT_IF_FALSE(aArray->Count() == 2, "unexpected count"); + MOZ_ASSERT(aArray->Count() == 2, "unexpected count"); arr->Item(1) = aArray->Item(1); arr->Item(2) = one; arr->Item(3) = one; @@ -224,7 +224,7 @@ ToPrimitive(nsCSSValue::Array* aArray) } case eCSSKeyword_scaley: { - NS_ABORT_IF_FALSE(aArray->Count() == 2, "unexpected count"); + MOZ_ASSERT(aArray->Count() == 2, "unexpected count"); arr->Item(1) = one; arr->Item(2) = aArray->Item(1); arr->Item(3) = one; @@ -232,7 +232,7 @@ ToPrimitive(nsCSSValue::Array* aArray) } case eCSSKeyword_scalez: { - NS_ABORT_IF_FALSE(aArray->Count() == 2, "unexpected count"); + MOZ_ASSERT(aArray->Count() == 2, "unexpected count"); arr->Item(1) = one; arr->Item(2) = one; arr->Item(3) = aArray->Item(1); @@ -255,7 +255,7 @@ static void AppendCSSShadowValue(const nsCSSShadowItem *aShadow, nsCSSValueList **&aResultTail) { - NS_ABORT_IF_FALSE(aShadow, "shadow expected"); + MOZ_ASSERT(aShadow, "shadow expected"); // X, Y, Radius, Spread, Color, Inset nsRefPtr arr = nsCSSValue::Array::Create(6); @@ -290,9 +290,9 @@ struct PixelCalcValue { static PixelCalcValue ExtractCalcValueInternal(const nsCSSValue& aValue) { - NS_ABORT_IF_FALSE(aValue.GetUnit() == eCSSUnit_Calc, "unexpected unit"); + MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Calc, "unexpected unit"); nsCSSValue::Array *arr = aValue.GetArrayValue(); - NS_ABORT_IF_FALSE(arr->Count() == 1, "unexpected length"); + MOZ_ASSERT(arr->Count() == 1, "unexpected length"); const nsCSSValue &topval = arr->Item(0); PixelCalcValue result; @@ -301,13 +301,13 @@ ExtractCalcValueInternal(const nsCSSValue& aValue) result.mPercent = 0.0f; result.mHasPercent = false; } else { - NS_ABORT_IF_FALSE(topval.GetUnit() == eCSSUnit_Calc_Plus, - "unexpected unit"); + MOZ_ASSERT(topval.GetUnit() == eCSSUnit_Calc_Plus, + "unexpected unit"); nsCSSValue::Array *arr2 = topval.GetArrayValue(); const nsCSSValue &len = arr2->Item(0); const nsCSSValue &pct = arr2->Item(1); - NS_ABORT_IF_FALSE(len.GetUnit() == eCSSUnit_Pixel, "unexpected unit"); - NS_ABORT_IF_FALSE(pct.GetUnit() == eCSSUnit_Percent, "unexpected unit"); + MOZ_ASSERT(len.GetUnit() == eCSSUnit_Pixel, "unexpected unit"); + MOZ_ASSERT(pct.GetUnit() == eCSSUnit_Percent, "unexpected unit"); result.mLength = len.GetFloatValue(); result.mPercent = pct.GetPercentValue(); result.mHasPercent = true; @@ -334,8 +334,8 @@ ExtractCalcValue(const StyleAnimationValue& aValue) result.mHasPercent = true; return result; } - NS_ABORT_IF_FALSE(aValue.GetUnit() == StyleAnimationValue::eUnit_Calc, - "unexpected unit"); + MOZ_ASSERT(aValue.GetUnit() == StyleAnimationValue::eUnit_Calc, + "unexpected unit"); nsCSSValue *val = aValue.GetCSSValueValue(); return ExtractCalcValueInternal(*val); } @@ -412,24 +412,24 @@ CalcPositionSquareDistance(const nsCSSValue& aPos1, PixelCalcValue calcVal[4]; nsCSSValue::Array* posArray = aPos1.GetArrayValue(); - NS_ABORT_IF_FALSE(posArray->Count() == 4, "Invalid position value"); + MOZ_ASSERT(posArray->Count() == 4, "Invalid position value"); NS_ASSERTION(posArray->Item(0).GetUnit() == eCSSUnit_Null && posArray->Item(2).GetUnit() == eCSSUnit_Null, "Invalid list used"); for (int i = 0; i < 2; ++i) { - NS_ABORT_IF_FALSE(posArray->Item(i*2+1).GetUnit() != eCSSUnit_Null, - "Invalid position value"); + MOZ_ASSERT(posArray->Item(i*2+1).GetUnit() != eCSSUnit_Null, + "Invalid position value"); calcVal[i] = ExtractCalcValue(posArray->Item(i*2+1)); } posArray = aPos2.GetArrayValue(); - NS_ABORT_IF_FALSE(posArray->Count() == 4, "Invalid position value"); + MOZ_ASSERT(posArray->Count() == 4, "Invalid position value"); NS_ASSERTION(posArray->Item(0).GetUnit() == eCSSUnit_Null && posArray->Item(2).GetUnit() == eCSSUnit_Null, "Invalid list used"); for (int i = 0; i < 2; ++i) { - NS_ABORT_IF_FALSE(posArray->Item(i*2+1).GetUnit() != eCSSUnit_Null, - "Invalid position value"); + MOZ_ASSERT(posArray->Item(i*2+1).GetUnit() != eCSSUnit_Null, + "Invalid position value"); calcVal[i+2] = ExtractCalcValue(posArray->Item(i*2+1)); } @@ -609,7 +609,7 @@ StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty, break; } default: - NS_ABORT_IF_FALSE(false, "unexpected unit"); + MOZ_ASSERT(false, "unexpected unit"); return false; } squareDistance += diffsquared; @@ -665,7 +665,7 @@ StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty, diffsquared = 0; break; default: - NS_ABORT_IF_FALSE(false, "unexpected unit"); + MOZ_ASSERT(false, "unexpected unit"); return false; } squareDistance += diffsquared; @@ -688,9 +688,8 @@ StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty, double squareDistance = 0.0; for (uint32_t i = 0; i < ArrayLength(nsCSSRect::sides); ++i) { nsCSSValue nsCSSRect::*member = nsCSSRect::sides[i]; - NS_ABORT_IF_FALSE((rect1->*member).GetUnit() == - (rect2->*member).GetUnit(), - "should have returned above"); + MOZ_ASSERT((rect1->*member).GetUnit() == (rect2->*member).GetUnit(), + "should have returned above"); double diff; switch ((rect1->*member).GetUnit()) { case eCSSUnit_Pixel: @@ -701,7 +700,7 @@ StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty, diff = 0; break; default: - NS_ABORT_IF_FALSE(false, "unexpected unit"); + MOZ_ASSERT(false, "unexpected unit"); return false; } squareDistance += diff * diff; @@ -729,13 +728,13 @@ StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty, const nsCSSValueList *list1 = normValue1.GetCSSValueListValue(); const nsCSSValueList *list2 = normValue2.GetCSSValueListValue(); - NS_ABORT_IF_FALSE(!list1 == !list2, "lists should be same length"); + MOZ_ASSERT(!list1 == !list2, "lists should be same length"); while (list1) { const nsCSSValue &val1 = list1->mValue; const nsCSSValue &val2 = list2->mValue; - NS_ABORT_IF_FALSE(val1.GetUnit() == val2.GetUnit(), - "unit match should be assured by AddWeighted"); + MOZ_ASSERT(val1.GetUnit() == val2.GetUnit(), + "unit match should be assured by AddWeighted"); double diff; switch (val1.GetUnit()) { case eCSSUnit_Percent: @@ -745,14 +744,14 @@ StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty, diff = val1.GetFloatValue() - val2.GetFloatValue(); break; default: - NS_ABORT_IF_FALSE(false, "unexpected unit"); + MOZ_ASSERT(false, "unexpected unit"); return false; } squareDistance += diff * diff; list1 = list1->mNext; list2 = list2->mNext; - NS_ABORT_IF_FALSE(!list1 == !list2, "lists should be same length"); + MOZ_ASSERT(!list1 == !list2, "lists should be same length"); } aDistance = sqrt(squareDistance); @@ -772,15 +771,15 @@ StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty, const nsCSSValueList *shadow2 = normValue2.GetCSSValueListValue(); double squareDistance = 0.0; - NS_ABORT_IF_FALSE(!shadow1 == !shadow2, "lists should be same length"); + MOZ_ASSERT(!shadow1 == !shadow2, "lists should be same length"); while (shadow1) { nsCSSValue::Array *array1 = shadow1->mValue.GetArrayValue(); nsCSSValue::Array *array2 = shadow2->mValue.GetArrayValue(); for (size_t i = 0; i < 4; ++i) { - NS_ABORT_IF_FALSE(array1->Item(i).GetUnit() == eCSSUnit_Pixel, - "unexpected unit"); - NS_ABORT_IF_FALSE(array2->Item(i).GetUnit() == eCSSUnit_Pixel, - "unexpected unit"); + MOZ_ASSERT(array1->Item(i).GetUnit() == eCSSUnit_Pixel, + "unexpected unit"); + MOZ_ASSERT(array2->Item(i).GetUnit() == eCSSUnit_Pixel, + "unexpected unit"); double diff = array1->Item(i).GetFloatValue() - array2->Item(i).GetFloatValue(); squareDistance += diff * diff; @@ -796,11 +795,11 @@ StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty, // (1) GetUnit() == eCSSUnit_Null // (2) GetUnit() == eCSSUnit_Enumerated && // GetIntValue() == NS_STYLE_BOX_SHADOW_INSET - NS_ABORT_IF_FALSE(((color1.IsNumericColorUnit() && - color2.IsNumericColorUnit()) || - (color1.GetUnit() == color2.GetUnit())) && - inset1 == inset2, - "AddWeighted should have failed"); + MOZ_ASSERT(((color1.IsNumericColorUnit() && + color2.IsNumericColorUnit()) || + (color1.GetUnit() == color2.GetUnit())) && + inset1 == inset2, + "AddWeighted should have failed"); } #endif @@ -817,13 +816,13 @@ StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty, StyleAnimationValue::ComputeDistance(eCSSProperty_color, color1Value, color2Value, colorDistance); - NS_ABORT_IF_FALSE(ok, "should not fail"); + MOZ_ASSERT(ok, "should not fail"); squareDistance += colorDistance * colorDistance; } shadow1 = shadow1->mNext; shadow2 = shadow2->mNext; - NS_ABORT_IF_FALSE(!shadow1 == !shadow2, "lists should be same length"); + MOZ_ASSERT(!shadow1 == !shadow2, "lists should be same length"); } aDistance = sqrt(squareDistance); return true; @@ -838,7 +837,7 @@ StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty, const nsCSSValueList *position2 = aEndValue.GetCSSValueListValue(); double squareDistance = 0.0; - NS_ABORT_IF_FALSE(!position1 == !position2, "lists should be same length"); + MOZ_ASSERT(!position1 == !position2, "lists should be same length"); while (position1 && position2) { squareDistance += CalcPositionSquareDistance(position1->mValue, @@ -911,7 +910,7 @@ StyleAnimationValue::ComputeDistance(nsCSSProperty aProperty, } } - NS_ABORT_IF_FALSE(false, "Can't compute distance using the given common unit"); + MOZ_ASSERT(false, "Can't compute distance using the given common unit"); return false; } @@ -968,7 +967,7 @@ RestrictValue(uint32_t aRestrictions, T aValue) } break; default: - NS_ABORT_IF_FALSE(false, "bad value restriction"); + MOZ_ASSERT(false, "bad value restriction"); break; } return result; @@ -986,8 +985,8 @@ AddCSSValuePixel(double aCoeff1, const nsCSSValue &aValue1, double aCoeff2, const nsCSSValue &aValue2, nsCSSValue &aResult, uint32_t aValueRestrictions = 0) { - NS_ABORT_IF_FALSE(aValue1.GetUnit() == eCSSUnit_Pixel, "unexpected unit"); - NS_ABORT_IF_FALSE(aValue2.GetUnit() == eCSSUnit_Pixel, "unexpected unit"); + MOZ_ASSERT(aValue1.GetUnit() == eCSSUnit_Pixel, "unexpected unit"); + MOZ_ASSERT(aValue2.GetUnit() == eCSSUnit_Pixel, "unexpected unit"); aResult.SetFloatValue(RestrictValue(aValueRestrictions, aCoeff1 * aValue1.GetFloatValue() + aCoeff2 * aValue2.GetFloatValue()), @@ -999,8 +998,8 @@ AddCSSValueNumber(double aCoeff1, const nsCSSValue &aValue1, double aCoeff2, const nsCSSValue &aValue2, nsCSSValue &aResult, uint32_t aValueRestrictions = 0) { - NS_ABORT_IF_FALSE(aValue1.GetUnit() == eCSSUnit_Number, "unexpected unit"); - NS_ABORT_IF_FALSE(aValue2.GetUnit() == eCSSUnit_Number, "unexpected unit"); + MOZ_ASSERT(aValue1.GetUnit() == eCSSUnit_Number, "unexpected unit"); + MOZ_ASSERT(aValue2.GetUnit() == eCSSUnit_Number, "unexpected unit"); aResult.SetFloatValue(RestrictValue(aValueRestrictions, aCoeff1 * aValue1.GetFloatValue() + aCoeff2 * aValue2.GetFloatValue()), @@ -1012,8 +1011,8 @@ AddCSSValuePercent(double aCoeff1, const nsCSSValue &aValue1, double aCoeff2, const nsCSSValue &aValue2, nsCSSValue &aResult, uint32_t aValueRestrictions = 0) { - NS_ABORT_IF_FALSE(aValue1.GetUnit() == eCSSUnit_Percent, "unexpected unit"); - NS_ABORT_IF_FALSE(aValue2.GetUnit() == eCSSUnit_Percent, "unexpected unit"); + MOZ_ASSERT(aValue1.GetUnit() == eCSSUnit_Percent, "unexpected unit"); + MOZ_ASSERT(aValue2.GetUnit() == eCSSUnit_Percent, "unexpected unit"); aResult.SetPercentValue(RestrictValue(aValueRestrictions, aCoeff1 * aValue1.GetPercentValue() + aCoeff2 * aValue2.GetPercentValue())); @@ -1081,8 +1080,8 @@ static inline float GetNumberOrPercent(const nsCSSValue &aValue) { nsCSSUnit unit = aValue.GetUnit(); - NS_ABORT_IF_FALSE(unit == eCSSUnit_Number || unit == eCSSUnit_Percent, - "unexpected unit"); + MOZ_ASSERT(unit == eCSSUnit_Number || unit == eCSSUnit_Percent, + "unexpected unit"); return (unit == eCSSUnit_Number) ? aValue.GetFloatValue() : aValue.GetPercentValue(); } @@ -1115,10 +1114,10 @@ AddShadowItems(double aCoeff1, const nsCSSValue &aValue1, nsCSSValueList **&aResultTail) { // X, Y, Radius, Spread, Color, Inset - NS_ABORT_IF_FALSE(aValue1.GetUnit() == eCSSUnit_Array, - "wrong unit"); - NS_ABORT_IF_FALSE(aValue2.GetUnit() == eCSSUnit_Array, - "wrong unit"); + MOZ_ASSERT(aValue1.GetUnit() == eCSSUnit_Array, + "wrong unit"); + MOZ_ASSERT(aValue2.GetUnit() == eCSSUnit_Array, + "wrong unit"); nsCSSValue::Array *array1 = aValue1.GetArrayValue(); nsCSSValue::Array *array2 = aValue2.GetArrayValue(); nsRefPtr resultArray = nsCSSValue::Array::Create(6); @@ -1154,11 +1153,11 @@ AddShadowItems(double aCoeff1, const nsCSSValue &aValue1, aCoeff1, color1Value, aCoeff2, color2Value, resultColorValue); - NS_ABORT_IF_FALSE(ok, "should not fail"); + MOZ_ASSERT(ok, "should not fail"); resultArray->Item(4).SetColorValue(resultColorValue.GetColorValue()); } - NS_ABORT_IF_FALSE(inset1 == inset2, "should match"); + MOZ_ASSERT(inset1 == inset2, "should match"); resultArray->Item(5) = inset1; nsCSSValueList *resultItem = new nsCSSValueList; @@ -1173,14 +1172,14 @@ AddTransformTranslate(double aCoeff1, const nsCSSValue &aValue1, double aCoeff2, const nsCSSValue &aValue2, nsCSSValue &aResult) { - NS_ABORT_IF_FALSE(aValue1.GetUnit() == eCSSUnit_Percent || - aValue1.GetUnit() == eCSSUnit_Pixel || - aValue1.IsCalcUnit(), - "unexpected unit"); - NS_ABORT_IF_FALSE(aValue2.GetUnit() == eCSSUnit_Percent || - aValue2.GetUnit() == eCSSUnit_Pixel || - aValue2.IsCalcUnit(), - "unexpected unit"); + MOZ_ASSERT(aValue1.GetUnit() == eCSSUnit_Percent || + aValue1.GetUnit() == eCSSUnit_Pixel || + aValue1.IsCalcUnit(), + "unexpected unit"); + MOZ_ASSERT(aValue2.GetUnit() == eCSSUnit_Percent || + aValue2.GetUnit() == eCSSUnit_Pixel || + aValue2.IsCalcUnit(), + "unexpected unit"); if (aValue1.GetUnit() != aValue2.GetUnit() || aValue1.IsCalcUnit()) { // different units; create a calc() expression @@ -1203,8 +1202,8 @@ AddTransformScale(double aCoeff1, const nsCSSValue &aValue1, // subtracting 1, multiplying by the coefficients, and then adding 1 // back. This gets the right AddWeighted behavior and gets us the // interpolation-against-identity behavior for free. - NS_ABORT_IF_FALSE(aValue1.GetUnit() == eCSSUnit_Number, "unexpected unit"); - NS_ABORT_IF_FALSE(aValue2.GetUnit() == eCSSUnit_Number, "unexpected unit"); + MOZ_ASSERT(aValue1.GetUnit() == eCSSUnit_Number, "unexpected unit"); + MOZ_ASSERT(aValue2.GetUnit() == eCSSUnit_Number, "unexpected unit"); float v1 = aValue1.GetFloatValue() - 1.0f, v2 = aValue2.GetFloatValue() - 1.0f; @@ -1632,12 +1631,12 @@ AddFilterFunctionImpl(double aCoeff1, const nsCSSValueList* aList1, { // AddFilterFunction should be our only caller, and it should ensure that both // args are non-null. - NS_ABORT_IF_FALSE(aList1, "expected filter list"); - NS_ABORT_IF_FALSE(aList2, "expected filter list"); - NS_ABORT_IF_FALSE(aList1->mValue.GetUnit() == eCSSUnit_Function, - "expected function"); - NS_ABORT_IF_FALSE(aList2->mValue.GetUnit() == eCSSUnit_Function, - "expected function"); + MOZ_ASSERT(aList1, "expected filter list"); + MOZ_ASSERT(aList2, "expected filter list"); + MOZ_ASSERT(aList1->mValue.GetUnit() == eCSSUnit_Function, + "expected function"); + MOZ_ASSERT(aList2->mValue.GetUnit() == eCSSUnit_Function, + "expected function"); nsRefPtr a1 = aList1->mValue.GetArrayValue(), a2 = aList2->mValue.GetArrayValue(); nsCSSKeyword filterFunction = a1->Item(0).GetKeywordValue(); @@ -1696,9 +1695,9 @@ AddFilterFunctionImpl(double aCoeff1, const nsCSSValueList* aList1, nsCSSValueList* resultShadow = resultArg.SetListValue(); nsAutoPtr shadowValue; nsCSSValueList **shadowTail = getter_Transfers(shadowValue); - NS_ABORT_IF_FALSE(!funcArg1.GetListValue()->mNext && - !funcArg2.GetListValue()->mNext, - "drop-shadow filter func doesn't support lists"); + MOZ_ASSERT(!funcArg1.GetListValue()->mNext && + !funcArg2.GetListValue()->mNext, + "drop-shadow filter func doesn't support lists"); if (!AddShadowItems(aCoeff1, funcArg1.GetListValue()->mValue, aCoeff2, funcArg2.GetListValue()->mValue, shadowTail)) { @@ -1708,7 +1707,7 @@ AddFilterFunctionImpl(double aCoeff1, const nsCSSValueList* aList1, break; } default: - NS_ABORT_IF_FALSE(false, "unknown filter function"); + MOZ_ASSERT(false, "unknown filter function"); return false; } @@ -1723,8 +1722,8 @@ AddFilterFunction(double aCoeff1, const nsCSSValueList* aList1, double aCoeff2, const nsCSSValueList* aList2, nsCSSValueList**& aResultTail) { - NS_ABORT_IF_FALSE(aList1 || aList2, - "one function list item must not be null"); + MOZ_ASSERT(aList1 || aList2, + "one function list item must not be null"); // Note that one of our arguments could be null, indicating that // it's the initial value. Rather than adding special null-handling // logic, we just check for null values and replace them with @@ -1750,11 +1749,12 @@ AddTransformLists(double aCoeff1, const nsCSSValueList* aList1, do { nsRefPtr a1 = ToPrimitive(aList1->mValue.GetArrayValue()), a2 = ToPrimitive(aList2->mValue.GetArrayValue()); - NS_ABORT_IF_FALSE(TransformFunctionsMatch(nsStyleTransformMatrix::TransformFunctionOf(a1), - nsStyleTransformMatrix::TransformFunctionOf(a2)), - "transform function mismatch"); - NS_ABORT_IF_FALSE(!*resultTail, - "resultTail isn't pointing to the tail (may leak)"); + MOZ_ASSERT( + TransformFunctionsMatch(nsStyleTransformMatrix::TransformFunctionOf(a1), + nsStyleTransformMatrix::TransformFunctionOf(a2)), + "transform function mismatch"); + MOZ_ASSERT(!*resultTail, + "resultTail isn't pointing to the tail (may leak)"); nsCSSKeyword tfunc = nsStyleTransformMatrix::TransformFunctionOf(a1); nsRefPtr arr; @@ -1768,8 +1768,8 @@ AddTransformLists(double aCoeff1, const nsCSSValueList* aList1, switch (tfunc) { case eCSSKeyword_translate3d: { - NS_ABORT_IF_FALSE(a1->Count() == 4, "unexpected count"); - NS_ABORT_IF_FALSE(a2->Count() == 4, "unexpected count"); + MOZ_ASSERT(a1->Count() == 4, "unexpected count"); + MOZ_ASSERT(a2->Count() == 4, "unexpected count"); AddTransformTranslate(aCoeff1, a1->Item(1), aCoeff2, a2->Item(1), arr->Item(1)); AddTransformTranslate(aCoeff1, a1->Item(2), aCoeff2, a2->Item(2), @@ -1779,8 +1779,8 @@ AddTransformLists(double aCoeff1, const nsCSSValueList* aList1, break; } case eCSSKeyword_scale3d: { - NS_ABORT_IF_FALSE(a1->Count() == 4, "unexpected count"); - NS_ABORT_IF_FALSE(a2->Count() == 4, "unexpected count"); + MOZ_ASSERT(a1->Count() == 4, "unexpected count"); + MOZ_ASSERT(a2->Count() == 4, "unexpected count"); AddTransformScale(aCoeff1, a1->Item(1), aCoeff2, a2->Item(1), arr->Item(1)); @@ -1797,10 +1797,10 @@ AddTransformLists(double aCoeff1, const nsCSSValueList* aList1, // drastically when crossing such skews (since the direction of // animation flips), so interop is probably more important here. case eCSSKeyword_skew: { - NS_ABORT_IF_FALSE(a1->Count() == 2 || a1->Count() == 3, - "unexpected count"); - NS_ABORT_IF_FALSE(a2->Count() == 2 || a2->Count() == 3, - "unexpected count"); + MOZ_ASSERT(a1->Count() == 2 || a1->Count() == 3, + "unexpected count"); + MOZ_ASSERT(a2->Count() == 2 || a2->Count() == 3, + "unexpected count"); nsCSSValue zero(0.0f, eCSSUnit_Radian); // Add Y component of skew. @@ -1823,8 +1823,8 @@ AddTransformLists(double aCoeff1, const nsCSSValueList* aList1, case eCSSKeyword_rotatex: case eCSSKeyword_rotatey: case eCSSKeyword_rotatez: { - NS_ABORT_IF_FALSE(a1->Count() == 2, "unexpected count"); - NS_ABORT_IF_FALSE(a2->Count() == 2, "unexpected count"); + MOZ_ASSERT(a1->Count() == 2, "unexpected count"); + MOZ_ASSERT(a2->Count() == 2, "unexpected count"); AddCSSValueAngle(aCoeff1, a1->Item(1), aCoeff2, a2->Item(1), arr->Item(1)); @@ -1886,15 +1886,15 @@ AddTransformLists(double aCoeff1, const nsCSSValueList* aList1, break; } default: - NS_ABORT_IF_FALSE(false, "unknown transform function"); + MOZ_ASSERT(false, "unknown transform function"); } aList1 = aList1->mNext; aList2 = aList2->mNext; } while (aList1); - NS_ABORT_IF_FALSE(!aList2, "list length mismatch"); - NS_ABORT_IF_FALSE(!*resultTail, - "resultTail isn't pointing to the tail"); + MOZ_ASSERT(!aList2, "list length mismatch"); + MOZ_ASSERT(!*resultTail, + "resultTail isn't pointing to the tail"); return result.forget(); } @@ -2109,7 +2109,7 @@ StyleAnimationValue::AddWeighted(nsCSSProperty aProperty, aCoeff1, pair1->*member, aCoeff2, pair2->*member, result->*member) ) { - NS_ABORT_IF_FALSE(false, "unexpected unit"); + MOZ_ASSERT(false, "unexpected unit"); return false; } } @@ -2145,7 +2145,7 @@ StyleAnimationValue::AddWeighted(nsCSSProperty aProperty, aCoeff1, &triplet1->*member, aCoeff2, &triplet2->*member, result->*member) ) { - NS_ABORT_IF_FALSE(false, "unexpected unit"); + MOZ_ASSERT(false, "unexpected unit"); return false; } } @@ -2155,8 +2155,8 @@ StyleAnimationValue::AddWeighted(nsCSSProperty aProperty, return true; } case eUnit_CSSRect: { - NS_ABORT_IF_FALSE(nsCSSProps::ValueRestrictions(aProperty) == 0, - "must add code for handling value restrictions"); + MOZ_ASSERT(nsCSSProps::ValueRestrictions(aProperty) == 0, + "must add code for handling value restrictions"); const nsCSSRect *rect1 = aValue1.GetCSSRectValue(); const nsCSSRect *rect2 = aValue2.GetCSSRectValue(); if (rect1->mTop.GetUnit() != rect2->mTop.GetUnit() || @@ -2170,9 +2170,8 @@ StyleAnimationValue::AddWeighted(nsCSSProperty aProperty, nsAutoPtr result(new nsCSSRect); for (uint32_t i = 0; i < ArrayLength(nsCSSRect::sides); ++i) { nsCSSValue nsCSSRect::*member = nsCSSRect::sides[i]; - NS_ABORT_IF_FALSE((rect1->*member).GetUnit() == - (rect2->*member).GetUnit(), - "should have returned above"); + MOZ_ASSERT((rect1->*member).GetUnit() == (rect2->*member).GetUnit(), + "should have returned above"); switch ((rect1->*member).GetUnit()) { case eCSSUnit_Pixel: AddCSSValuePixel(aCoeff1, rect1->*member, aCoeff2, rect2->*member, @@ -2187,7 +2186,7 @@ StyleAnimationValue::AddWeighted(nsCSSProperty aProperty, (result->*member).SetAutoValue(); break; default: - NS_ABORT_IF_FALSE(false, "unexpected unit"); + MOZ_ASSERT(false, "unexpected unit"); return false; } } @@ -2206,11 +2205,11 @@ StyleAnimationValue::AddWeighted(nsCSSProperty aProperty, for (const nsCSSValueList *v = list2; v; v = v->mNext) { ++len2; } - NS_ABORT_IF_FALSE(len1 > 0 && len2 > 0, "unexpected length"); + MOZ_ASSERT(len1 > 0 && len2 > 0, "unexpected length"); if (list1->mValue.GetUnit() == eCSSUnit_None || list2->mValue.GetUnit() == eCSSUnit_None) { // One of our values is "none". Can't do addition with that. - NS_ABORT_IF_FALSE( + MOZ_ASSERT( (list1->mValue.GetUnit() != eCSSUnit_None || len1 == 1) && (list2->mValue.GetUnit() != eCSSUnit_None || len2 == 1), "multi-value valuelist with 'none' as first element"); @@ -2222,10 +2221,10 @@ StyleAnimationValue::AddWeighted(nsCSSProperty aProperty, for (uint32_t i = 0, i_end = EuclidLCM(len1, len2); i != i_end; ++i) { const nsCSSValue &v1 = list1->mValue; const nsCSSValue &v2 = list2->mValue; - NS_ABORT_IF_FALSE(v1.GetUnit() == eCSSUnit_Number || - v1.GetUnit() == eCSSUnit_Percent, "unexpected"); - NS_ABORT_IF_FALSE(v2.GetUnit() == eCSSUnit_Number || - v2.GetUnit() == eCSSUnit_Percent, "unexpected"); + MOZ_ASSERT(v1.GetUnit() == eCSSUnit_Number || + v1.GetUnit() == eCSSUnit_Percent, "unexpected"); + MOZ_ASSERT(v2.GetUnit() == eCSSUnit_Number || + v2.GetUnit() == eCSSUnit_Percent, "unexpected"); if (v1.GetUnit() != v2.GetUnit()) { // Can't animate between lengths and percentages (until calc()). return false; @@ -2310,7 +2309,7 @@ StyleAnimationValue::AddWeighted(nsCSSProperty aProperty, nsAutoPtr result; nsCSSValueList **resultTail = getter_Transfers(result); while (list1 || list2) { - NS_ABORT_IF_FALSE(!*resultTail, + MOZ_ASSERT(!*resultTail, "resultTail isn't pointing to the tail (may leak)"); if ((list1 && list1->mValue.GetUnit() != eCSSUnit_Function) || (list2 && list2->mValue.GetUnit() != eCSSUnit_Function)) { @@ -2332,8 +2331,8 @@ StyleAnimationValue::AddWeighted(nsCSSProperty aProperty, list2 = list2->mNext; } } - NS_ABORT_IF_FALSE(!*resultTail, - "resultTail isn't pointing to the tail (may leak)"); + MOZ_ASSERT(!*resultTail, + "resultTail isn't pointing to the tail (may leak)"); aResultValue.SetAndAdoptCSSValueListValue(result.forget(), eUnit_Filter); @@ -2473,7 +2472,7 @@ StyleAnimationValue::AddWeighted(nsCSSProperty aProperty, } } - NS_ABORT_IF_FALSE(false, "Can't interpolate using the given common unit"); + MOZ_ASSERT(false, "Can't interpolate using the given common unit"); return false; } @@ -2534,10 +2533,10 @@ StyleAnimationValue::ComputeValue(nsCSSProperty aProperty, StyleAnimationValue& aComputedValue, bool* aIsContextSensitive) { - NS_ABORT_IF_FALSE(aTargetElement, "null target element"); - NS_ABORT_IF_FALSE(aTargetElement->GetCurrentDoc(), - "we should only be able to actively animate nodes that " - "are in a document"); + MOZ_ASSERT(aTargetElement, "null target element"); + MOZ_ASSERT(aTargetElement->GetCurrentDoc(), + "we should only be able to actively animate nodes that " + "are in a document"); // Parse specified value into a temporary css::StyleRule nsRefPtr styleRule = @@ -2829,7 +2828,7 @@ StyleCoordToCSSValue(const nsStyleCoord& aCoord, nsCSSValue& aCSSValue) aCSSValue.SetFloatValue(aCoord.GetAngleValue(), eCSSUnit_Turn); break; default: - NS_ABORT_IF_FALSE(false, "unexpected unit"); + MOZ_ASSERT(false, "unexpected unit"); return false; } return true; @@ -2900,15 +2899,14 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty, nsStyleContext* aStyleContext, StyleAnimationValue& aComputedValue) { - NS_ABORT_IF_FALSE(0 <= aProperty && - aProperty < eCSSProperty_COUNT_no_shorthands, - "bad property"); + MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, + "bad property"); const void* styleStruct = aStyleContext->StyleData(nsCSSProps::kSIDTable[aProperty]); ptrdiff_t ssOffset = nsCSSProps::kStyleStructOffsetTable[aProperty]; nsStyleAnimType animType = nsCSSProps::kAnimTypeTable[aProperty]; - NS_ABORT_IF_FALSE(0 <= ssOffset || animType == eStyleAnimType_Custom, - "must be dealing with animatable property"); + MOZ_ASSERT(0 <= ssOffset || animType == eStyleAnimType_Custom, + "must be dealing with animatable property"); switch (animType) { case eStyleAnimType_Custom: switch (aProperty) { @@ -3060,13 +3058,13 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty, case eCSSProperty_stroke_dasharray: { const nsStyleSVG *svg = static_cast(styleStruct); - NS_ABORT_IF_FALSE((svg->mStrokeDasharray != nullptr) == - (svg->mStrokeDasharrayLength != 0), - "pointer/length mismatch"); + MOZ_ASSERT((svg->mStrokeDasharray != nullptr) == + (svg->mStrokeDasharrayLength != 0), + "pointer/length mismatch"); nsAutoPtr result; if (svg->mStrokeDasharray) { - NS_ABORT_IF_FALSE(svg->mStrokeDasharrayLength > 0, - "non-null list should have positive length"); + MOZ_ASSERT(svg->mStrokeDasharrayLength > 0, + "non-null list should have positive length"); nsCSSValueList **resultTail = getter_Transfers(result); for (uint32_t i = 0, i_end = svg->mStrokeDasharrayLength; i != i_end; ++i) { @@ -3093,7 +3091,7 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty, value.SetPercentValue(coord.GetPercentValue()); break; default: - NS_ABORT_IF_FALSE(false, "unexpected unit"); + MOZ_ASSERT(false, "unexpected unit"); return false; } } @@ -3198,7 +3196,7 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty, static_cast(styleStruct); nsAutoPtr result; nsCSSValueList **resultTail = getter_Transfers(result); - NS_ABORT_IF_FALSE(bg->mPositionCount > 0, "unexpected count"); + MOZ_ASSERT(bg->mPositionCount > 0, "unexpected count"); for (uint32_t i = 0, i_end = bg->mPositionCount; i != i_end; ++i) { nsCSSValueList *item = new nsCSSValueList; *resultTail = item; @@ -3216,7 +3214,7 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty, static_cast(styleStruct); nsAutoPtr result; nsCSSValuePairList **resultTail = getter_Transfers(result); - NS_ABORT_IF_FALSE(bg->mSizeCount > 0, "unexpected count"); + MOZ_ASSERT(bg->mSizeCount > 0, "unexpected count"); for (uint32_t i = 0, i_end = bg->mSizeCount; i != i_end; ++i) { nsCSSValuePairList *item = new nsCSSValuePairList; *resultTail = item; @@ -3238,8 +3236,8 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty, if (!size.mWidth.mHasPercent && // negative values must have come from calc() size.mWidth.mLength >= 0) { - NS_ABORT_IF_FALSE(size.mWidth.mPercent == 0.0f, - "Shouldn't have mPercent"); + MOZ_ASSERT(size.mWidth.mPercent == 0.0f, + "Shouldn't have mPercent"); nscoordToCSSValue(size.mWidth.mLength, item->mXValue); } else if (size.mWidth.mLength == 0 && // negative values must have come from calc() @@ -3265,8 +3263,8 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty, if (!size.mHeight.mHasPercent && // negative values must have come from calc() size.mHeight.mLength >= 0) { - NS_ABORT_IF_FALSE(size.mHeight.mPercent == 0.0f, - "Shouldn't have mPercent"); + MOZ_ASSERT(size.mHeight.mPercent == 0.0f, + "Shouldn't have mPercent"); nscoordToCSSValue(size.mHeight.mLength, item->mYValue); } else if (size.mHeight.mLength == 0 && // negative values must have come from calc() @@ -3322,8 +3320,8 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty, nsAutoPtr tmpShadowValue; nsCSSValueList **tmpShadowResultTail = getter_Transfers(tmpShadowValue); nsCSSShadowArray* shadowArray = filter.GetDropShadow(); - NS_ABORT_IF_FALSE(shadowArray->Length() == 1, - "expected exactly one shadow"); + MOZ_ASSERT(shadowArray->Length() == 1, + "expected exactly one shadow"); AppendCSSShadowValue(shadowArray->ShadowAt(0), tmpShadowResultTail); *shadowResult = *tmpShadowValue; } else { @@ -3366,7 +3364,7 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty, } default: - NS_ABORT_IF_FALSE(false, "missing property implementation"); + MOZ_ASSERT(false, "missing property implementation"); return false; }; return true; @@ -3494,8 +3492,8 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty, eUnit_CSSValuePair); return true; } - NS_ABORT_IF_FALSE(paint.mType == eStyleSVGPaintType_None, - "Unexpected SVG paint type"); + MOZ_ASSERT(paint.mType == eStyleSVGPaintType_None, + "Unexpected SVG paint type"); aComputedValue.SetNoneValue(); return true; } @@ -3587,32 +3585,32 @@ StyleAnimationValue::operator=(const StyleAnimationValue& aOther) break; case eUnit_Calc: case eUnit_ObjectPosition: - NS_ABORT_IF_FALSE(IsCSSValueUnit(mUnit), - "This clause is for handling nsCSSValue-backed units"); - NS_ABORT_IF_FALSE(aOther.mValue.mCSSValue, "values may not be null"); + MOZ_ASSERT(IsCSSValueUnit(mUnit), + "This clause is for handling nsCSSValue-backed units"); + MOZ_ASSERT(aOther.mValue.mCSSValue, "values may not be null"); mValue.mCSSValue = new nsCSSValue(*aOther.mValue.mCSSValue); break; case eUnit_CSSValuePair: - NS_ABORT_IF_FALSE(aOther.mValue.mCSSValuePair, - "value pairs may not be null"); + MOZ_ASSERT(aOther.mValue.mCSSValuePair, + "value pairs may not be null"); mValue.mCSSValuePair = new nsCSSValuePair(*aOther.mValue.mCSSValuePair); break; case eUnit_CSSValueTriplet: - NS_ABORT_IF_FALSE(aOther.mValue.mCSSValueTriplet, - "value triplets may not be null"); + MOZ_ASSERT(aOther.mValue.mCSSValueTriplet, + "value triplets may not be null"); mValue.mCSSValueTriplet = new nsCSSValueTriplet(*aOther.mValue.mCSSValueTriplet); break; case eUnit_CSSRect: - NS_ABORT_IF_FALSE(aOther.mValue.mCSSRect, "rects may not be null"); + MOZ_ASSERT(aOther.mValue.mCSSRect, "rects may not be null"); mValue.mCSSRect = new nsCSSRect(*aOther.mValue.mCSSRect); break; case eUnit_Dasharray: case eUnit_Shadow: case eUnit_Filter: case eUnit_BackgroundPosition: - NS_ABORT_IF_FALSE(mUnit == eUnit_Shadow || mUnit == eUnit_Filter || - aOther.mValue.mCSSValueList, - "value lists other than shadows and filters may not be null"); + MOZ_ASSERT(mUnit == eUnit_Shadow || mUnit == eUnit_Filter || + aOther.mValue.mCSSValueList, + "value lists other than shadows and filters may not be null"); if (aOther.mValue.mCSSValueList) { mValue.mCSSValueList = aOther.mValue.mCSSValueList->Clone(); } else { @@ -3624,12 +3622,12 @@ StyleAnimationValue::operator=(const StyleAnimationValue& aOther) mValue.mCSSValueSharedList->AddRef(); break; case eUnit_CSSValuePairList: - NS_ABORT_IF_FALSE(aOther.mValue.mCSSValuePairList, - "value pair lists may not be null"); + MOZ_ASSERT(aOther.mValue.mCSSValuePairList, + "value pair lists may not be null"); mValue.mCSSValuePairList = aOther.mValue.mCSSValuePairList->Clone(); break; case eUnit_UnparsedString: - NS_ABORT_IF_FALSE(aOther.mValue.mString, "expecting non-null string"); + MOZ_ASSERT(aOther.mValue.mString, "expecting non-null string"); mValue.mString = aOther.mValue.mString; mValue.mString->AddRef(); break; @@ -3715,8 +3713,8 @@ StyleAnimationValue::SetAndAdoptCSSValueValue(nsCSSValue *aValue, Unit aUnit) { FreeValue(); - NS_ABORT_IF_FALSE(IsCSSValueUnit(aUnit), "bad unit"); - NS_ABORT_IF_FALSE(aValue != nullptr, "values may not be null"); + MOZ_ASSERT(IsCSSValueUnit(aUnit), "bad unit"); + MOZ_ASSERT(aValue != nullptr, "values may not be null"); mUnit = aUnit; mValue.mCSSValue = aValue; // take ownership } @@ -3726,8 +3724,8 @@ StyleAnimationValue::SetAndAdoptCSSValuePairValue(nsCSSValuePair *aValuePair, Unit aUnit) { FreeValue(); - NS_ABORT_IF_FALSE(IsCSSValuePairUnit(aUnit), "bad unit"); - NS_ABORT_IF_FALSE(aValuePair != nullptr, "value pairs may not be null"); + MOZ_ASSERT(IsCSSValuePairUnit(aUnit), "bad unit"); + MOZ_ASSERT(aValuePair != nullptr, "value pairs may not be null"); mUnit = aUnit; mValue.mCSSValuePair = aValuePair; // take ownership } @@ -3737,8 +3735,8 @@ StyleAnimationValue::SetAndAdoptCSSValueTripletValue( nsCSSValueTriplet *aValueTriplet, Unit aUnit) { FreeValue(); - NS_ABORT_IF_FALSE(IsCSSValueTripletUnit(aUnit), "bad unit"); - NS_ABORT_IF_FALSE(aValueTriplet != nullptr, "value pairs may not be null"); + MOZ_ASSERT(IsCSSValueTripletUnit(aUnit), "bad unit"); + MOZ_ASSERT(aValueTriplet != nullptr, "value pairs may not be null"); mUnit = aUnit; mValue.mCSSValueTriplet = aValueTriplet; // take ownership } @@ -3747,8 +3745,8 @@ void StyleAnimationValue::SetAndAdoptCSSRectValue(nsCSSRect *aRect, Unit aUnit) { FreeValue(); - NS_ABORT_IF_FALSE(IsCSSRectUnit(aUnit), "bad unit"); - NS_ABORT_IF_FALSE(aRect != nullptr, "value pairs may not be null"); + MOZ_ASSERT(IsCSSRectUnit(aUnit), "bad unit"); + MOZ_ASSERT(aRect != nullptr, "value pairs may not be null"); mUnit = aUnit; mValue.mCSSRect = aRect; // take ownership } @@ -3758,10 +3756,10 @@ StyleAnimationValue::SetAndAdoptCSSValueListValue(nsCSSValueList *aValueList, Unit aUnit) { FreeValue(); - NS_ABORT_IF_FALSE(IsCSSValueListUnit(aUnit), "bad unit"); - NS_ABORT_IF_FALSE(aUnit == eUnit_Shadow || aUnit == eUnit_Filter || - aValueList != nullptr, - "value lists other than shadows and filters may not be null"); + MOZ_ASSERT(IsCSSValueListUnit(aUnit), "bad unit"); + MOZ_ASSERT(aUnit == eUnit_Shadow || aUnit == eUnit_Filter || + aValueList != nullptr, + "value lists other than shadows and filters may not be null"); mUnit = aUnit; mValue.mCSSValueList = aValueList; // take ownership } @@ -3780,7 +3778,7 @@ StyleAnimationValue::SetAndAdoptCSSValuePairListValue( nsCSSValuePairList *aValuePairList) { FreeValue(); - NS_ABORT_IF_FALSE(aValuePairList, "may not be null"); + MOZ_ASSERT(aValuePairList, "may not be null"); mUnit = eUnit_CSSValuePairList; mValue.mCSSValuePairList = aValuePairList; // take ownership } @@ -3803,7 +3801,7 @@ StyleAnimationValue::FreeValue() } else if (IsCSSValuePairListUnit(mUnit)) { delete mValue.mCSSValuePairList; } else if (IsStringUnit(mUnit)) { - NS_ABORT_IF_FALSE(mValue.mString, "expecting non-null string"); + MOZ_ASSERT(mValue.mString, "expecting non-null string"); mValue.mString->Release(); } } @@ -3834,8 +3832,8 @@ StyleAnimationValue::operator==(const StyleAnimationValue& aOther) const return mValue.mColor == aOther.mValue.mColor; case eUnit_Calc: case eUnit_ObjectPosition: - NS_ABORT_IF_FALSE(IsCSSValueUnit(mUnit), - "This clause is for handling nsCSSValue-backed units"); + MOZ_ASSERT(IsCSSValueUnit(mUnit), + "This clause is for handling nsCSSValue-backed units"); return *mValue.mCSSValue == *aOther.mValue.mCSSValue; case eUnit_CSSValuePair: return *mValue.mCSSValuePair == *aOther.mValue.mCSSValuePair; diff --git a/layout/style/StyleRule.cpp b/layout/style/StyleRule.cpp index 77bfdbab2ac..812986ee507 100644 --- a/layout/style/StyleRule.cpp +++ b/layout/style/StyleRule.cpp @@ -706,8 +706,8 @@ nsCSSSelector::AppendToStringWithoutCombinatorsOrNegations if (mClassList) { if (isPseudoElement) { #ifdef MOZ_XUL - NS_ABORT_IF_FALSE(nsCSSAnonBoxes::IsTreePseudoElement(mLowercaseTag), - "must be tree pseudo-element"); + MOZ_ASSERT(nsCSSAnonBoxes::IsTreePseudoElement(mLowercaseTag), + "must be tree pseudo-element"); aString.Append(char16_t('(')); for (nsAtomList* list = mClassList; list; list = list->mNext) { @@ -1396,7 +1396,7 @@ void StyleRule::RuleMatched() { if (!mWasMatched) { - NS_ABORT_IF_FALSE(!mImportantRule, "should not have important rule yet"); + MOZ_ASSERT(!mImportantRule, "should not have important rule yet"); mWasMatched = true; mDeclaration->SetImmutable(); @@ -1465,8 +1465,8 @@ StyleRule::DeclarationChanged(Declaration* aDecl, /* virtual */ void StyleRule::MapRuleInfoInto(nsRuleData* aRuleData) { - NS_ABORT_IF_FALSE(mWasMatched, - "somebody forgot to call css::StyleRule::RuleMatched"); + MOZ_ASSERT(mWasMatched, + "somebody forgot to call css::StyleRule::RuleMatched"); mDeclaration->MapNormalRuleInfoInto(aRuleData); } diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index d85f0beb0c1..ed4b0d4a279 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -422,7 +422,7 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext, dom::AnimationTimeline* aTimeline, AnimationPlayerPtrArray& aPlayers) { - NS_ABORT_IF_FALSE(aPlayers.IsEmpty(), "expect empty array"); + MOZ_ASSERT(aPlayers.IsEmpty(), "expect empty array"); ResolvedStyleCache resolvedStyles; @@ -483,9 +483,9 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext, for (uint32_t ruleIdx = 0, ruleEnd = rule->StyleRuleCount(); ruleIdx != ruleEnd; ++ruleIdx) { css::Rule* cssRule = rule->GetStyleRuleAt(ruleIdx); - NS_ABORT_IF_FALSE(cssRule, "must have rule"); - NS_ABORT_IF_FALSE(cssRule->GetType() == css::Rule::KEYFRAME_RULE, - "must be keyframe rule"); + MOZ_ASSERT(cssRule, "must have rule"); + MOZ_ASSERT(cssRule->GetType() == css::Rule::KEYFRAME_RULE, + "must be keyframe rule"); nsCSSKeyframeRule *kfRule = static_cast(cssRule); const nsTArray &keys = kfRule->GetKeys(); @@ -656,9 +656,9 @@ nsAnimationManager::BuildSegment(InfallibleTArray& /* virtual */ void nsAnimationManager::WillRefresh(mozilla::TimeStamp aTime) { - NS_ABORT_IF_FALSE(mPresContext, - "refresh driver should not notify additional observers " - "after pres context has been destroyed"); + MOZ_ASSERT(mPresContext, + "refresh driver should not notify additional observers " + "after pres context has been destroyed"); if (!mPresContext->GetPresShell()) { // Someone might be keeping mPresContext alive past the point // where it has been torn down; don't bother doing anything in diff --git a/layout/style/nsCSSDataBlock.cpp b/layout/style/nsCSSDataBlock.cpp index ca515a8b7e1..13bcd30b018 100644 --- a/layout/style/nsCSSDataBlock.cpp +++ b/layout/style/nsCSSDataBlock.cpp @@ -74,7 +74,7 @@ TryToStartImageLoadOnValue(const nsCSSValue& aValue, nsIDocument* aDocument, } else if (aValue.EqualsFunction(eCSSKeyword__moz_image_rect)) { nsCSSValue::Array* arguments = aValue.GetArrayValue(); - NS_ABORT_IF_FALSE(arguments->Count() == 6, "unexpected num of arguments"); + MOZ_ASSERT(arguments->Count() == 6, "unexpected num of arguments"); const nsCSSValue& image = arguments->Item(1); TryToStartImageLoadOnValue(image, aDocument, aTokenStream); @@ -121,7 +121,7 @@ MapSinglePropertyInto(nsCSSProperty aProp, nsCSSValue* aTarget, nsRuleData* aRuleData) { - NS_ABORT_IF_FALSE(aValue->GetUnit() != eCSSUnit_Null, "oops"); + MOZ_ASSERT(aValue->GetUnit() != eCSSUnit_Null, "oops"); // Although aTarget is the nsCSSValue we are going to write into, // we also look at its value before writing into it. This is done @@ -131,10 +131,10 @@ MapSinglePropertyInto(nsCSSProperty aProp, // then records any resulting ImageValue objects on the // nsCSSValueTokenStream object we found on aTarget. See the comment // above nsCSSValueTokenStream::mImageValues for why. - NS_ABORT_IF_FALSE(aTarget->GetUnit() == eCSSUnit_TokenStream || - aTarget->GetUnit() == eCSSUnit_Null, - "aTarget must only be a token stream (when re-parsing " - "properties with variable references) or null"); + MOZ_ASSERT(aTarget->GetUnit() == eCSSUnit_TokenStream || + aTarget->GetUnit() == eCSSUnit_Null, + "aTarget must only be a token stream (when re-parsing " + "properties with variable references) or null"); nsCSSValueTokenStream* tokenStream = aTarget->GetUnit() == eCSSUnit_TokenStream ? @@ -267,8 +267,8 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const const nsCSSValue* nsCSSCompressedDataBlock::ValueFor(nsCSSProperty aProperty) const { - NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(aProperty), - "Don't call for shorthands"); + MOZ_ASSERT(!nsCSSProps::IsShorthand(aProperty), + "Don't call for shorthands"); // If we have no data for this struct, then return immediately. // This optimization should make us return most of the time, so we @@ -293,8 +293,8 @@ nsCSSCompressedDataBlock::TryReplaceValue(nsCSSProperty aProperty, bool *aChanged) { nsCSSValue* newValue = aFromBlock.PropertyAt(aProperty); - NS_ABORT_IF_FALSE(newValue && newValue->GetUnit() != eCSSUnit_Null, - "cannot replace with empty value"); + MOZ_ASSERT(newValue && newValue->GetUnit() != eCSSUnit_Null, + "cannot replace with empty value"); const nsCSSValue* oldValue = ValueFor(aProperty); if (!oldValue) { @@ -330,7 +330,7 @@ nsCSSCompressedDataBlock::~nsCSSCompressedDataBlock() (void)PropertyAtIndex(i); // this checks the property is in range #endif const nsCSSValue* val = ValueAtIndex(i); - NS_ABORT_IF_FALSE(val->GetUnit() != eCSSUnit_Null, "oops"); + MOZ_ASSERT(val->GetUnit() != eCSSUnit_Null, "oops"); val->~nsCSSValue(); } } @@ -409,18 +409,18 @@ nsCSSExpandedDataBlock::DoExpand(nsCSSCompressedDataBlock *aBlock, */ for (uint32_t i = 0; i < aBlock->mNumProps; i++) { nsCSSProperty iProp = aBlock->PropertyAtIndex(i); - NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(iProp), "out of range"); - NS_ABORT_IF_FALSE(!HasPropertyBit(iProp), - "compressed block has property multiple times"); + MOZ_ASSERT(!nsCSSProps::IsShorthand(iProp), "out of range"); + MOZ_ASSERT(!HasPropertyBit(iProp), + "compressed block has property multiple times"); SetPropertyBit(iProp); if (aImportant) SetImportantBit(iProp); const nsCSSValue* val = aBlock->ValueAtIndex(i); nsCSSValue* dest = PropertyAt(iProp); - NS_ABORT_IF_FALSE(val->GetUnit() != eCSSUnit_Null, "oops"); - NS_ABORT_IF_FALSE(dest->GetUnit() == eCSSUnit_Null, - "expanding into non-empty block"); + MOZ_ASSERT(val->GetUnit() != eCSSUnit_Null, "oops"); + MOZ_ASSERT(dest->GetUnit() == eCSSUnit_Null, + "expanding into non-empty block"); #ifdef NS_BUILD_REFCNT_LOGGING dest->~nsCSSValue(); #endif @@ -437,7 +437,7 @@ void nsCSSExpandedDataBlock::Expand(nsCSSCompressedDataBlock *aNormalBlock, nsCSSCompressedDataBlock *aImportantBlock) { - NS_ABORT_IF_FALSE(aNormalBlock, "unexpected null block"); + MOZ_ASSERT(aNormalBlock, "unexpected null block"); AssertInitialState(); DoExpand(aNormalBlock, false); @@ -460,9 +460,9 @@ nsCSSExpandedDataBlock::ComputeNumProps(uint32_t* aNumPropsNormal, #ifdef DEBUG nsCSSProperty iProp = nsCSSPropertySet::CSSPropertyAt(iHigh, iLow); #endif - NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(iProp), "out of range"); - NS_ABORT_IF_FALSE(PropertyAt(iProp)->GetUnit() != eCSSUnit_Null, - "null value while computing size"); + MOZ_ASSERT(!nsCSSProps::IsShorthand(iProp), "out of range"); + MOZ_ASSERT(PropertyAt(iProp)->GetUnit() != eCSSUnit_Null, + "null value while computing size"); if (mPropertiesImportant.HasPropertyAt(iHigh, iLow)) (*aNumPropsImportant)++; else @@ -503,17 +503,17 @@ nsCSSExpandedDataBlock::Compress(nsCSSCompressedDataBlock **aNormalBlock, // a custom property continue; } - NS_ABORT_IF_FALSE(mPropertiesSet.HasProperty(iProp), - "aOrder identifies a property not in the expanded " - "data block"); - NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(iProp), "out of range"); + MOZ_ASSERT(mPropertiesSet.HasProperty(iProp), + "aOrder identifies a property not in the expanded " + "data block"); + MOZ_ASSERT(!nsCSSProps::IsShorthand(iProp), "out of range"); bool important = mPropertiesImportant.HasProperty(iProp); nsCSSCompressedDataBlock *result = important ? result_important : result_normal; uint32_t* ip = important ? &i_important : &i_normal; nsCSSValue* val = PropertyAt(iProp); - NS_ABORT_IF_FALSE(val->GetUnit() != eCSSUnit_Null, - "Null value while compressing"); + MOZ_ASSERT(val->GetUnit() != eCSSUnit_Null, + "Null value while compressing"); result->SetPropertyAtIndex(*ip, iProp); result->RawCopyValueToIndex(*ip, val); new (val) nsCSSValue(); @@ -522,10 +522,10 @@ nsCSSExpandedDataBlock::Compress(nsCSSCompressedDataBlock **aNormalBlock, nsCachedStyleData::GetBitForSID(nsCSSProps::kSIDTable[iProp]); } - NS_ABORT_IF_FALSE(numPropsNormal == i_normal, "bad numProps"); + MOZ_ASSERT(numPropsNormal == i_normal, "bad numProps"); if (result_important) { - NS_ABORT_IF_FALSE(numPropsImportant == i_important, "bad numProps"); + MOZ_ASSERT(numPropsImportant == i_important, "bad numProps"); } #ifdef DEBUG @@ -543,9 +543,8 @@ nsCSSExpandedDataBlock::Compress(nsCSSCompressedDataBlock **aNormalBlock, } } } - NS_ABORT_IF_FALSE(numPropsNormal + numPropsImportant == numPropsInSet, - "aOrder missing properties from the expanded data " - "block"); + MOZ_ASSERT(numPropsNormal + numPropsImportant == numPropsInSet, + "aOrder missing properties from the expanded data block"); } #endif @@ -559,8 +558,8 @@ void nsCSSExpandedDataBlock::AddLonghandProperty(nsCSSProperty aProperty, const nsCSSValue& aValue) { - NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(aProperty), - "property out of range"); + MOZ_ASSERT(!nsCSSProps::IsShorthand(aProperty), + "property out of range"); nsCSSValue& storage = *static_cast(PropertyAt(aProperty)); storage = aValue; SetPropertyBit(aProperty); @@ -599,7 +598,7 @@ nsCSSExpandedDataBlock::ClearProperty(nsCSSProperty aPropID) void nsCSSExpandedDataBlock::ClearLonghandProperty(nsCSSProperty aPropID) { - NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(aPropID), "out of range"); + MOZ_ASSERT(!nsCSSProps::IsShorthand(aPropID), "out of range"); ClearPropertyBit(aPropID); ClearImportantBit(aPropID); @@ -644,7 +643,7 @@ nsCSSExpandedDataBlock::DoTransferFromBlock(nsCSSExpandedDataBlock& aFromBlock, css::Declaration* aDeclaration) { bool changed = false; - NS_ABORT_IF_FALSE(aFromBlock.HasPropertyBit(aPropID), "oops"); + MOZ_ASSERT(aFromBlock.HasPropertyBit(aPropID), "oops"); if (aIsImportant) { if (!HasImportantBit(aPropID)) changed = true; @@ -712,8 +711,8 @@ nsCSSExpandedDataBlock::DoAssertInitialState() for (uint32_t i = 0; i < eCSSProperty_COUNT_no_shorthands; ++i) { nsCSSProperty prop = nsCSSProperty(i); - NS_ABORT_IF_FALSE(PropertyAt(prop)->GetUnit() == eCSSUnit_Null, - "not initial state"); + MOZ_ASSERT(PropertyAt(prop)->GetUnit() == eCSSUnit_Null, + "not initial state"); } } #endif diff --git a/layout/style/nsCSSDataBlock.h b/layout/style/nsCSSDataBlock.h index 8143722b293..bea69897677 100644 --- a/layout/style/nsCSSDataBlock.h +++ b/layout/style/nsCSSDataBlock.h @@ -93,8 +93,8 @@ public: private: void* operator new(size_t aBaseSize, uint32_t aNumProps) { - NS_ABORT_IF_FALSE(aBaseSize == sizeof(nsCSSCompressedDataBlock), - "unexpected size for nsCSSCompressedDataBlock"); + MOZ_ASSERT(aBaseSize == sizeof(nsCSSCompressedDataBlock), + "unexpected size for nsCSSCompressedDataBlock"); return ::operator new(aBaseSize + DataSize(aNumProps)); } @@ -131,14 +131,14 @@ private: } nsCSSValue* ValueAtIndex(uint32_t i) const { - NS_ABORT_IF_FALSE(i < mNumProps, "value index out of range"); + MOZ_ASSERT(i < mNumProps, "value index out of range"); return Values() + i; } nsCSSProperty PropertyAtIndex(uint32_t i) const { - NS_ABORT_IF_FALSE(i < mNumProps, "property index out of range"); + MOZ_ASSERT(i < mNumProps, "property index out of range"); nsCSSProperty prop = (nsCSSProperty)CompressedProperties()[i]; - NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(prop), "out of range"); + MOZ_ASSERT(!nsCSSProps::IsShorthand(prop), "out of range"); return prop; } @@ -151,7 +151,7 @@ private: } void SetPropertyAtIndex(uint32_t i, nsCSSProperty aProperty) { - NS_ABORT_IF_FALSE(i < mNumProps, "set property index out of range"); + MOZ_ASSERT(i < mNumProps, "set property index out of range"); CompressedProperties()[i] = (CompressedCSSProperty)aProperty; } @@ -313,15 +313,15 @@ private: * property |aProperty|. */ nsCSSValue* PropertyAt(nsCSSProperty aProperty) { - NS_ABORT_IF_FALSE(0 <= aProperty && - aProperty < eCSSProperty_COUNT_no_shorthands, - "property out of range"); + MOZ_ASSERT(0 <= aProperty && + aProperty < eCSSProperty_COUNT_no_shorthands, + "property out of range"); return &mValues[aProperty]; } const nsCSSValue* PropertyAt(nsCSSProperty aProperty) const { - NS_ABORT_IF_FALSE(0 <= aProperty && - aProperty < eCSSProperty_COUNT_no_shorthands, - "property out of range"); + MOZ_ASSERT(0 <= aProperty && + aProperty < eCSSProperty_COUNT_no_shorthands, + "property out of range"); return &mValues[aProperty]; } diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 0b1d8d67ee0..b48cad90c5d 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1837,7 +1837,7 @@ CSSParserImpl::ParseKeyframeSelectorString(const nsSubstring& aSelectorString, uint32_t aLineNumber, // for error reporting InfallibleTArray& aSelectorList) { - NS_ABORT_IF_FALSE(aSelectorList.IsEmpty(), "given list should start empty"); + MOZ_ASSERT(aSelectorList.IsEmpty(), "given list should start empty"); nsCSSScanner scanner(aSelectorString, aLineNumber); css::ErrorReporter reporter(scanner, mSheet, mChildLoader, aURI); @@ -3866,8 +3866,8 @@ CSSParserImpl::ParsePageRule(RuleAppendFunc aAppendFunc, void* aData) eParseDeclaration_AllowImportant; // Forbid viewport units in @page rules. See bug 811391. - NS_ABORT_IF_FALSE(mViewportUnitsEnabled, - "Viewport units should be enabled outside of @page rules."); + MOZ_ASSERT(mViewportUnitsEnabled, + "Viewport units should be enabled outside of @page rules."); mViewportUnitsEnabled = false; nsAutoPtr declaration( ParseDeclarationBlock(parseFlags, @@ -5523,8 +5523,8 @@ CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask, ParsePseudoClassWithNthPairArg(aSelector, pseudoClassType); } else { - NS_ABORT_IF_FALSE(nsCSSPseudoClasses::HasSelectorListArg(pseudoClassType), - "unexpected pseudo with function token"); + MOZ_ASSERT(nsCSSPseudoClasses::HasSelectorListArg(pseudoClassType), + "unexpected pseudo with function token"); parsingStatus = ParsePseudoClassWithSelectorListArg(aSelector, pseudoClassType); } @@ -6808,12 +6808,12 @@ CSSParserImpl::ParseNonNegativeVariant(nsCSSValue& aValue, { // The variant mask must only contain non-numeric variants or the ones // that we specifically handle. - NS_ABORT_IF_FALSE((aVariantMask & ~(VARIANT_ALL_NONNUMERIC | - VARIANT_NUMBER | - VARIANT_LENGTH | - VARIANT_PERCENT | - VARIANT_INTEGER)) == 0, - "need to update code below to handle additional variants"); + MOZ_ASSERT((aVariantMask & ~(VARIANT_ALL_NONNUMERIC | + VARIANT_NUMBER | + VARIANT_LENGTH | + VARIANT_PERCENT | + VARIANT_INTEGER)) == 0, + "need to update code below to handle additional variants"); if (ParseVariant(aValue, aVariantMask, aKeywordTable)) { if (eCSSUnit_Number == aValue.GetUnit() || @@ -6850,10 +6850,10 @@ CSSParserImpl::ParseOneOrLargerVariant(nsCSSValue& aValue, { // The variant mask must only contain non-numeric variants or the ones // that we specifically handle. - NS_ABORT_IF_FALSE((aVariantMask & ~(VARIANT_ALL_NONNUMERIC | - VARIANT_NUMBER | - VARIANT_INTEGER)) == 0, - "need to update code below to handle additional variants"); + MOZ_ASSERT((aVariantMask & ~(VARIANT_ALL_NONNUMERIC | + VARIANT_NUMBER | + VARIANT_INTEGER)) == 0, + "need to update code below to handle additional variants"); if (ParseVariant(aValue, aVariantMask, aKeywordTable)) { if (aValue.GetUnit() == eCSSUnit_Integer) { @@ -6887,10 +6887,10 @@ CSSParserImpl::ParseVariant(nsCSSValue& aValue, NS_ASSERTION(!(mUnitlessLengthQuirk && (aVariantMask & VARIANT_LENGTH)) || !(aVariantMask & VARIANT_NUMBER), "can't distinguish lengths from numbers"); - NS_ABORT_IF_FALSE(!(aVariantMask & VARIANT_IDENTIFIER) || - !(aVariantMask & VARIANT_IDENTIFIER_NO_INHERIT), - "must not set both VARIANT_IDENTIFIER and " - "VARIANT_IDENTIFIER_NO_INHERIT"); + MOZ_ASSERT(!(aVariantMask & VARIANT_IDENTIFIER) || + !(aVariantMask & VARIANT_IDENTIFIER_NO_INHERIT), + "must not set both VARIANT_IDENTIFIER and " + "VARIANT_IDENTIFIER_NO_INHERIT"); if (!GetToken(true)) { return false; @@ -9485,10 +9485,10 @@ bool CSSParserImpl::ParseProperty(nsCSSProperty aPropID) { // Can't use AutoRestore because it's a bitfield. - NS_ABORT_IF_FALSE(!mHashlessColorQuirk, - "hashless color quirk should not be set"); - NS_ABORT_IF_FALSE(!mUnitlessLengthQuirk, - "unitless length quirk should not be set"); + MOZ_ASSERT(!mHashlessColorQuirk, + "hashless color quirk should not be set"); + MOZ_ASSERT(!mUnitlessLengthQuirk, + "unitless length quirk should not be set"); MOZ_ASSERT(aPropID != eCSSPropertyExtra_variable); if (mNavQuirkMode) { @@ -9537,9 +9537,9 @@ CSSParserImpl::ParseProperty(nsCSSProperty aPropID) default: { result = false; allowVariables = false; - NS_ABORT_IF_FALSE(false, - "Property's flags field in nsCSSPropList.h is missing " - "one of the CSS_PROPERTY_PARSE_* constants"); + MOZ_ASSERT(false, + "Property's flags field in nsCSSPropList.h is missing " + "one of the CSS_PROPERTY_PARSE_* constants"); break; } } @@ -9866,7 +9866,7 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSProperty aPropID) case eCSSProperty_all: return ParseAll(); default: - NS_ABORT_IF_FALSE(false, "should not be called"); + MOZ_ASSERT(false, "should not be called"); return false; } } @@ -9895,7 +9895,7 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue, } if (aPropID < 0 || aPropID >= eCSSProperty_COUNT_no_shorthands) { - NS_ABORT_IF_FALSE(false, "not a single value property"); + MOZ_ASSERT(false, "not a single value property"); return false; } @@ -9936,14 +9936,14 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue, case eCSSProperty_touch_action: return ParseTouchAction(aValue); default: - NS_ABORT_IF_FALSE(false, "should not reach here"); + MOZ_ASSERT(false, "should not reach here"); return false; } } uint32_t variant = nsCSSProps::ParserVariant(aPropID); if (variant == 0) { - NS_ABORT_IF_FALSE(false, "not a single value property"); + MOZ_ASSERT(false, "not a single value property"); return false; } @@ -9959,7 +9959,7 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue, const KTableValue *kwtable = nsCSSProps::kKeywordTableTable[aPropID]; switch (nsCSSProps::ValueRestrictions(aPropID)) { default: - NS_ABORT_IF_FALSE(false, "should not be reached"); + MOZ_ASSERT(false, "should not be reached"); case 0: return ParseVariant(aValue, variant, kwtable); case CSS_PROPERTY_VALUE_NONNEGATIVE: @@ -11177,7 +11177,7 @@ CSSParserImpl::ParseCalc(nsCSSValue &aValue, int32_t aVariantMask) // This can be done without lookahead when we assume that the property // values cannot themselves be numbers. NS_ASSERTION(!(aVariantMask & VARIANT_NUMBER), "unexpected variant mask"); - NS_ABORT_IF_FALSE(aVariantMask != 0, "unexpected variant mask"); + MOZ_ASSERT(aVariantMask != 0, "unexpected variant mask"); bool oldUnitlessLengthQuirk = mUnitlessLengthQuirk; mUnitlessLengthQuirk = false; @@ -11220,7 +11220,7 @@ bool CSSParserImpl::ParseCalcAdditiveExpression(nsCSSValue& aValue, int32_t& aVariantMask) { - NS_ABORT_IF_FALSE(aVariantMask != 0, "unexpected variant mask"); + MOZ_ASSERT(aVariantMask != 0, "unexpected variant mask"); nsCSSValue *storage = &aValue; for (;;) { bool haveWS; @@ -11253,7 +11253,7 @@ struct ReduceNumberCalcOps : public mozilla::css::BasicFloatCalcOps, { result_type ComputeLeafValue(const nsCSSValue& aValue) { - NS_ABORT_IF_FALSE(aValue.GetUnit() == eCSSUnit_Number, "unexpected unit"); + MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Number, "unexpected unit"); return aValue.GetFloatValue(); } @@ -11281,7 +11281,7 @@ CSSParserImpl::ParseCalcMultiplicativeExpression(nsCSSValue& aValue, int32_t& aVariantMask, bool *aHadFinalWS) { - NS_ABORT_IF_FALSE(aVariantMask != 0, "unexpected variant mask"); + MOZ_ASSERT(aVariantMask != 0, "unexpected variant mask"); bool gotValue = false; // already got the part with the unit bool afterDivision = false; @@ -11295,11 +11295,11 @@ CSSParserImpl::ParseCalcMultiplicativeExpression(nsCSSValue& aValue, } if (!ParseCalcTerm(*storage, variantMask)) return false; - NS_ABORT_IF_FALSE(variantMask != 0, - "ParseCalcTerm did not set variantMask appropriately"); - NS_ABORT_IF_FALSE(!(variantMask & VARIANT_NUMBER) || - !(variantMask & ~int32_t(VARIANT_NUMBER)), - "ParseCalcTerm did not set variantMask appropriately"); + MOZ_ASSERT(variantMask != 0, + "ParseCalcTerm did not set variantMask appropriately"); + MOZ_ASSERT(!(variantMask & VARIANT_NUMBER) || + !(variantMask & ~int32_t(VARIANT_NUMBER)), + "ParseCalcTerm did not set variantMask appropriately"); if (variantMask & VARIANT_NUMBER) { // Simplify the value immediately so we can check for division by @@ -11315,8 +11315,8 @@ CSSParserImpl::ParseCalcMultiplicativeExpression(nsCSSValue& aValue, if (storage != &aValue) { // Simplify any numbers in the Times_L position (which are // not simplified by the check above). - NS_ABORT_IF_FALSE(storage == &aValue.GetArrayValue()->Item(1), - "unexpected relationship to current storage"); + MOZ_ASSERT(storage == &aValue.GetArrayValue()->Item(1), + "unexpected relationship to current storage"); nsCSSValue &leftValue = aValue.GetArrayValue()->Item(0); ReduceNumberCalcOps ops; float number = mozilla::css::ComputeCalc(leftValue, ops); @@ -11377,7 +11377,7 @@ CSSParserImpl::ParseCalcMultiplicativeExpression(nsCSSValue& aValue, bool CSSParserImpl::ParseCalcTerm(nsCSSValue& aValue, int32_t& aVariantMask) { - NS_ABORT_IF_FALSE(aVariantMask != 0, "unexpected variant mask"); + MOZ_ASSERT(aVariantMask != 0, "unexpected variant mask"); if (!GetToken(true)) return false; // Either an additive expression in parentheses... @@ -11538,14 +11538,13 @@ CSSParserImpl::ParseContent() // Verify that these two lists add up to the size of // nsCSSProps::kContentKTable. - NS_ABORT_IF_FALSE(nsCSSProps::kContentKTable[ - ArrayLength(kContentListKWs) + - ArrayLength(kContentSolitaryKWs) - 4] == - eCSSKeyword_UNKNOWN && - nsCSSProps::kContentKTable[ - ArrayLength(kContentListKWs) + - ArrayLength(kContentSolitaryKWs) - 3] == -1, - "content keyword tables out of sync"); + MOZ_ASSERT(nsCSSProps::kContentKTable[ + ArrayLength(kContentListKWs) + + ArrayLength(kContentSolitaryKWs) - 4] == eCSSKeyword_UNKNOWN && + nsCSSProps::kContentKTable[ + ArrayLength(kContentListKWs) + + ArrayLength(kContentSolitaryKWs) - 3] == -1, + "content keyword tables out of sync"); nsCSSValue value; // 'inherit', 'initial', 'unset', 'normal', 'none', and 'alt-content' must @@ -13837,8 +13836,8 @@ bool CSSParserImpl::ParseTransformOrigin(bool aPerspective) if (position.mXValue.GetUnit() == eCSSUnit_Inherit || position.mXValue.GetUnit() == eCSSUnit_Initial || position.mXValue.GetUnit() == eCSSUnit_Unset) { - NS_ABORT_IF_FALSE(position.mXValue == position.mYValue, - "inherit/initial/unset only half?"); + MOZ_ASSERT(position.mXValue == position.mYValue, + "inherit/initial/unset only half?"); AppendValue(prop, position.mXValue); } else { nsCSSValue value; @@ -13967,12 +13966,12 @@ CSSParserImpl::ParseSingleFilter(nsCSSValue* aValue) } // Get the first and only argument to the filter function. - NS_ABORT_IF_FALSE(aValue->GetUnit() == eCSSUnit_Function, - "expected a filter function"); - NS_ABORT_IF_FALSE(aValue->UnitHasArrayValue(), - "filter function should be an array"); - NS_ABORT_IF_FALSE(aValue->GetArrayValue()->Count() == 2, - "filter function should have exactly one argument"); + MOZ_ASSERT(aValue->GetUnit() == eCSSUnit_Function, + "expected a filter function"); + MOZ_ASSERT(aValue->UnitHasArrayValue(), + "filter function should be an array"); + MOZ_ASSERT(aValue->GetArrayValue()->Count() == 2, + "filter function should have exactly one argument"); nsCSSValue& arg = aValue->GetArrayValue()->Item(1); if (rejectNegativeArgument && @@ -14172,11 +14171,11 @@ AppendValueToList(nsCSSValue& aContainer, { nsCSSValueList* entry; if (aContainer.GetUnit() == eCSSUnit_Null) { - NS_ABORT_IF_FALSE(!aTail, "should not have an entry"); + MOZ_ASSERT(!aTail, "should not have an entry"); entry = aContainer.SetListValue(); } else { - NS_ABORT_IF_FALSE(!aTail->mNext, "should not have a next entry"); - NS_ABORT_IF_FALSE(aContainer.GetUnit() == eCSSUnit_List, "not a list"); + MOZ_ASSERT(!aTail->mNext, "should not have a next entry"); + MOZ_ASSERT(aContainer.GetUnit() == eCSSUnit_List, "not a list"); entry = new nsCSSValueList; aTail->mNext = entry; } @@ -14203,8 +14202,8 @@ CSSParserImpl::ParseAnimationOrTransitionShorthand( } static const size_t maxNumProperties = 8; - NS_ABORT_IF_FALSE(aNumProperties <= maxNumProperties, - "can't handle this many properties"); + MOZ_ASSERT(aNumProperties <= maxNumProperties, + "can't handle this many properties"); nsCSSValueList *cur[maxNumProperties]; bool parsedProperty[maxNumProperties]; @@ -14316,9 +14315,8 @@ CSSParserImpl::ParseTransition() // 'none'. // + None of the items can be 'inherit', 'initial' or 'unset'. { - NS_ABORT_IF_FALSE(kTransitionProperties[3] == - eCSSProperty_transition_property, - "array index mismatch"); + MOZ_ASSERT(kTransitionProperties[3] == eCSSProperty_transition_property, + "array index mismatch"); nsCSSValueList *l = values[3].GetListValue(); bool multipleItems = !!l->mNext; do { diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 9e96b3d317e..a1367f5ed14 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -127,10 +127,10 @@ CreateStaticTable(const char* const aRawTable[], int32_t aLength) nsAutoCString temp1(aRawTable[index]); nsAutoCString temp2(aRawTable[index]); ToLowerCase(temp1); - NS_ABORT_IF_FALSE(temp1.Equals(temp2), - "upper case char in case insensitive name table"); - NS_ABORT_IF_FALSE(-1 == temp1.FindChar('_'), - "underscore char in case insensitive name table"); + MOZ_ASSERT(temp1.Equals(temp2), + "upper case char in case insensitive name table"); + MOZ_ASSERT(-1 == temp1.FindChar('_'), + "underscore char in case insensitive name table"); } #endif table->Init(aRawTable, aLength); @@ -142,10 +142,10 @@ void nsCSSProps::AddRefTable(void) { if (0 == gPropertyTableRefCount++) { - NS_ABORT_IF_FALSE(!gPropertyTable, "pre existing array!"); - NS_ABORT_IF_FALSE(!gFontDescTable, "pre existing array!"); - NS_ABORT_IF_FALSE(!gCounterDescTable, "pre existing array!"); - NS_ABORT_IF_FALSE(!gPredefinedCounterStyleTable, "pre existing array!"); + MOZ_ASSERT(!gPropertyTable, "pre existing array!"); + MOZ_ASSERT(!gFontDescTable, "pre existing array!"); + MOZ_ASSERT(!gCounterDescTable, "pre existing array!"); + MOZ_ASSERT(!gPredefinedCounterStyleTable, "pre existing array!"); gPropertyTable = CreateStaticTable( kCSSRawProperties, eCSSProperty_COUNT_with_aliases); @@ -251,9 +251,8 @@ nsCSSProps::BuildShorthandsContainingTable() for (const nsCSSProperty* subprops = SubpropertyEntryFor(shorthand); *subprops != eCSSProperty_UNKNOWN; ++subprops) { - NS_ABORT_IF_FALSE(0 <= *subprops && - *subprops < eCSSProperty_COUNT_no_shorthands, - "subproperty must be a longhand"); + MOZ_ASSERT(0 <= *subprops && *subprops < eCSSProperty_COUNT_no_shorthands, + "subproperty must be a longhand"); ++occurrenceCounts[*subprops]; ++subpropCountsEntry.count; } @@ -290,7 +289,7 @@ nsCSSProps::BuildShorthandsContainingTable() gShorthandsContainingTable[longhand] = lastTerminator; } } - NS_ABORT_IF_FALSE(poolCursor == lastTerminator, "miscalculation"); + MOZ_ASSERT(poolCursor == lastTerminator, "miscalculation"); } // Sort with lowest count at the start and highest at the end, and @@ -357,9 +356,9 @@ nsCSSProps::BuildShorthandsContainingTable() if (*shcont == shorthand) ++count; } - NS_ABORT_IF_FALSE(count == 1, - "subproperty of shorthand should have shorthand" - " in its ShorthandsContaining() table"); + MOZ_ASSERT(count == 1, + "subproperty of shorthand should have shorthand" + " in its ShorthandsContaining() table"); } } @@ -377,9 +376,9 @@ nsCSSProps::BuildShorthandsContainingTable() if (*subprops == longhand) ++count; } - NS_ABORT_IF_FALSE(count == 1, - "longhand should be in subproperty table of " - "property in its ShorthandsContaining() table"); + MOZ_ASSERT(count == 1, + "longhand should be in subproperty table of " + "property in its ShorthandsContaining() table"); } } #endif @@ -436,7 +435,7 @@ nsCSSProperty nsCSSProps::LookupProperty(const nsACString& aProperty, EnabledState aEnabled) { - NS_ABORT_IF_FALSE(gPropertyTable, "no lookup table, needs addref"); + MOZ_ASSERT(gPropertyTable, "no lookup table, needs addref"); if (nsLayoutUtils::CSSVariablesEnabled() && IsCustomPropertyName(aProperty)) { @@ -456,8 +455,8 @@ nsCSSProps::LookupProperty(const nsACString& aProperty, // for aliases yet because it's unlikely there will be a need for it. if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) { res = gAliases[res - eCSSProperty_COUNT]; - NS_ABORT_IF_FALSE(0 <= res && res < eCSSProperty_COUNT, - "aliases must not point to other aliases"); + MOZ_ASSERT(0 <= res && res < eCSSProperty_COUNT, + "aliases must not point to other aliases"); if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) { return res; } @@ -476,7 +475,7 @@ nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled) // This is faster than converting and calling // LookupProperty(nsACString&). The table will do its own // converting and avoid a PromiseFlatCString() call. - NS_ABORT_IF_FALSE(gPropertyTable, "no lookup table, needs addref"); + MOZ_ASSERT(gPropertyTable, "no lookup table, needs addref"); nsCSSProperty res = nsCSSProperty(gPropertyTable->Lookup(aProperty)); if (MOZ_LIKELY(res < eCSSProperty_COUNT)) { if (res != eCSSProperty_UNKNOWN && !IsEnabled(res, aEnabled)) { @@ -490,8 +489,8 @@ nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled) // because it's unlikely there will be a need for it. if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) { res = gAliases[res - eCSSProperty_COUNT]; - NS_ABORT_IF_FALSE(0 <= res && res < eCSSProperty_COUNT, - "aliases must not point to other aliases"); + MOZ_ASSERT(0 <= res && res < eCSSProperty_COUNT, + "aliases must not point to other aliases"); if (IsEnabled(res) || aEnabled == eIgnoreEnabledState) { return res; } @@ -502,14 +501,14 @@ nsCSSProps::LookupProperty(const nsAString& aProperty, EnabledState aEnabled) nsCSSFontDesc nsCSSProps::LookupFontDesc(const nsACString& aFontDesc) { - NS_ABORT_IF_FALSE(gFontDescTable, "no lookup table, needs addref"); + MOZ_ASSERT(gFontDescTable, "no lookup table, needs addref"); return nsCSSFontDesc(gFontDescTable->Lookup(aFontDesc)); } nsCSSFontDesc nsCSSProps::LookupFontDesc(const nsAString& aFontDesc) { - NS_ABORT_IF_FALSE(gFontDescTable, "no lookup table, needs addref"); + MOZ_ASSERT(gFontDescTable, "no lookup table, needs addref"); nsCSSFontDesc which = nsCSSFontDesc(gFontDescTable->Lookup(aFontDesc)); // check for unprefixed font-feature-settings/font-language-override @@ -525,22 +524,22 @@ nsCSSProps::LookupFontDesc(const nsAString& aFontDesc) nsCSSCounterDesc nsCSSProps::LookupCounterDesc(const nsAString& aProperty) { - NS_ABORT_IF_FALSE(gCounterDescTable, "no lookup table, needs addref"); + MOZ_ASSERT(gCounterDescTable, "no lookup table, needs addref"); return nsCSSCounterDesc(gCounterDescTable->Lookup(aProperty)); } nsCSSCounterDesc nsCSSProps::LookupCounterDesc(const nsACString& aProperty) { - NS_ABORT_IF_FALSE(gCounterDescTable, "no lookup table, needs addref"); + MOZ_ASSERT(gCounterDescTable, "no lookup table, needs addref"); return nsCSSCounterDesc(gCounterDescTable->Lookup(aProperty)); } bool nsCSSProps::IsPredefinedCounterStyle(const nsAString& aStyle) { - NS_ABORT_IF_FALSE(gPredefinedCounterStyleTable, - "no lookup table, needs addref"); + MOZ_ASSERT(gPredefinedCounterStyleTable, + "no lookup table, needs addref"); return gPredefinedCounterStyleTable->Lookup(aStyle) != nsStaticCaseInsensitiveNameTable::NOT_FOUND; } @@ -548,8 +547,8 @@ nsCSSProps::IsPredefinedCounterStyle(const nsAString& aStyle) bool nsCSSProps::IsPredefinedCounterStyle(const nsACString& aStyle) { - NS_ABORT_IF_FALSE(gPredefinedCounterStyleTable, - "no lookup table, needs addref"); + MOZ_ASSERT(gPredefinedCounterStyleTable, + "no lookup table, needs addref"); return gPredefinedCounterStyleTable->Lookup(aStyle) != nsStaticCaseInsensitiveNameTable::NOT_FOUND; } @@ -557,7 +556,7 @@ nsCSSProps::IsPredefinedCounterStyle(const nsACString& aStyle) const nsAFlatCString& nsCSSProps::GetStringValue(nsCSSProperty aProperty) { - NS_ABORT_IF_FALSE(gPropertyTable, "no lookup table, needs addref"); + MOZ_ASSERT(gPropertyTable, "no lookup table, needs addref"); if (gPropertyTable) { return gPropertyTable->GetStringValue(int32_t(aProperty)); } else { @@ -569,7 +568,7 @@ nsCSSProps::GetStringValue(nsCSSProperty aProperty) const nsAFlatCString& nsCSSProps::GetStringValue(nsCSSFontDesc aFontDescID) { - NS_ABORT_IF_FALSE(gFontDescTable, "no lookup table, needs addref"); + MOZ_ASSERT(gFontDescTable, "no lookup table, needs addref"); if (gFontDescTable) { return gFontDescTable->GetStringValue(int32_t(aFontDescID)); } else { @@ -581,7 +580,7 @@ nsCSSProps::GetStringValue(nsCSSFontDesc aFontDescID) const nsAFlatCString& nsCSSProps::GetStringValue(nsCSSCounterDesc aCounterDesc) { - NS_ABORT_IF_FALSE(gCounterDescTable, "no lookup table, needs addref"); + MOZ_ASSERT(gCounterDescTable, "no lookup table, needs addref"); if (gCounterDescTable) { return gCounterDescTable->GetStringValue(int32_t(aCounterDesc)); } else { @@ -2125,8 +2124,8 @@ nsCSSProps::kKeywordTableTable[eCSSProperty_COUNT_no_shorthands] = { const nsAFlatCString& nsCSSProps::LookupPropertyValue(nsCSSProperty aProp, int32_t aValue) { - NS_ABORT_IF_FALSE(aProp >= 0 && aProp < eCSSProperty_COUNT, - "property out of range"); + MOZ_ASSERT(aProp >= 0 && aProp < eCSSProperty_COUNT, + "property out of range"); NS_ASSERTION(KTableValue(aValue) == aValue, "Value out of range"); const KTableValue* kwtable = nullptr; @@ -2641,11 +2640,10 @@ static const int gLogicalGroupMappingTable[] = { /* static */ const nsCSSProperty* nsCSSProps::LogicalGroup(nsCSSProperty aProperty) { - NS_ABORT_IF_FALSE(0 <= aProperty && - aProperty < eCSSProperty_COUNT_no_shorthands, - "out of range"); - NS_ABORT_IF_FALSE(nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_LOGICAL), - "aProperty must be a logical longhand property"); + MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, + "out of range"); + MOZ_ASSERT(nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_LOGICAL), + "aProperty must be a logical longhand property"); for (size_t i = 0; i < ArrayLength(gLogicalGroupMappingTable); i += 2) { if (gLogicalGroupMappingTable[i] == aProperty) { @@ -2653,7 +2651,7 @@ nsCSSProps::LogicalGroup(nsCSSProperty aProperty) } } - NS_ABORT_IF_FALSE(false, "missing gLogicalGroupMappingTable entry"); + MOZ_ASSERT(false, "missing gLogicalGroupMappingTable entry"); return nullptr; } diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h index f767588f05c..aec3c9bad70 100644 --- a/layout/style/nsCSSProps.h +++ b/layout/style/nsCSSProps.h @@ -317,8 +317,8 @@ public: static bool IsCustomPropertyName(const nsACString& aProperty); static inline bool IsShorthand(nsCSSProperty aProperty) { - NS_ABORT_IF_FALSE(0 <= aProperty && aProperty < eCSSProperty_COUNT, - "out of range"); + MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT, + "out of range"); return (aProperty >= eCSSProperty_COUNT_no_shorthands); } @@ -381,8 +381,8 @@ private: public: static inline bool PropHasFlags(nsCSSProperty aProperty, uint32_t aFlags) { - NS_ABORT_IF_FALSE(0 <= aProperty && aProperty < eCSSProperty_COUNT, - "out of range"); + MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT, + "out of range"); MOZ_ASSERT(!(aFlags & CSS_PROPERTY_PARSE_PROPERTY_MASK), "The CSS_PROPERTY_PARSE_* values are not bitflags; don't pass " "them to PropHasFlags. You probably want PropertyParseType " @@ -392,16 +392,16 @@ public: static inline uint32_t PropertyParseType(nsCSSProperty aProperty) { - NS_ABORT_IF_FALSE(0 <= aProperty && aProperty < eCSSProperty_COUNT, - "out of range"); + MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT, + "out of range"); return nsCSSProps::kFlagsTable[aProperty] & CSS_PROPERTY_PARSE_PROPERTY_MASK; } static inline uint32_t ValueRestrictions(nsCSSProperty aProperty) { - NS_ABORT_IF_FALSE(0 <= aProperty && aProperty < eCSSProperty_COUNT, - "out of range"); + MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT, + "out of range"); return nsCSSProps::kFlagsTable[aProperty] & CSS_PROPERTY_VALUE_RESTRICTION_MASK; } @@ -412,9 +412,8 @@ private: public: static inline uint32_t ParserVariant(nsCSSProperty aProperty) { - NS_ABORT_IF_FALSE(0 <= aProperty && - aProperty < eCSSProperty_COUNT_no_shorthands, - "out of range"); + MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, + "out of range"); return nsCSSProps::kParserVariantTable[aProperty]; } @@ -427,9 +426,9 @@ private: public: static inline const nsCSSProperty * SubpropertyEntryFor(nsCSSProperty aProperty) { - NS_ABORT_IF_FALSE(eCSSProperty_COUNT_no_shorthands <= aProperty && - aProperty < eCSSProperty_COUNT, - "out of range"); + MOZ_ASSERT(eCSSProperty_COUNT_no_shorthands <= aProperty && + aProperty < eCSSProperty_COUNT, + "out of range"); return nsCSSProps::kSubpropertyTable[aProperty - eCSSProperty_COUNT_no_shorthands]; } @@ -438,10 +437,9 @@ public: // properties containing |aProperty|, sorted from those that contain // the most properties to those that contain the least. static const nsCSSProperty * ShorthandsContaining(nsCSSProperty aProperty) { - NS_ABORT_IF_FALSE(gShorthandsContainingPool, "uninitialized"); - NS_ABORT_IF_FALSE(0 <= aProperty && - aProperty < eCSSProperty_COUNT_no_shorthands, - "out of range"); + MOZ_ASSERT(gShorthandsContainingPool, "uninitialized"); + MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, + "out of range"); return gShorthandsContainingTable[aProperty]; } private: @@ -463,8 +461,8 @@ public: * nsRuleNode builds the nsStyle* for aSID. */ static size_t PropertyCountInStruct(nsStyleStructID aSID) { - NS_ABORT_IF_FALSE(0 <= aSID && aSID < nsStyleStructID_Length, - "out of range"); + MOZ_ASSERT(0 <= aSID && aSID < nsStyleStructID_Length, + "out of range"); return gPropertyCountInStruct[aSID]; } /** @@ -472,9 +470,8 @@ public: * the range 0 <= index < PropertyCountInStruct(aSID). */ static size_t PropertyIndexInStruct(nsCSSProperty aProperty) { - NS_ABORT_IF_FALSE(0 <= aProperty && - aProperty < eCSSProperty_COUNT_no_shorthands, - "out of range"); + MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands, + "out of range"); return gPropertyIndexInStruct[aProperty]; } @@ -511,9 +508,8 @@ private: public: static bool IsEnabled(nsCSSProperty aProperty) { - NS_ABORT_IF_FALSE(0 <= aProperty && - aProperty < eCSSProperty_COUNT_with_aliases, - "out of range"); + MOZ_ASSERT(0 <= aProperty && aProperty < eCSSProperty_COUNT_with_aliases, + "out of range"); return gPropertyEnabled[aProperty]; } diff --git a/layout/style/nsCSSPseudoClasses.cpp b/layout/style/nsCSSPseudoClasses.cpp index 72321369c49..c4de55ece4a 100644 --- a/layout/style/nsCSSPseudoClasses.cpp +++ b/layout/style/nsCSSPseudoClasses.cpp @@ -85,8 +85,8 @@ nsCSSPseudoClasses::HasNthPairArg(Type aType) void nsCSSPseudoClasses::PseudoTypeToString(Type aType, nsAString& aString) { - NS_ABORT_IF_FALSE(aType < ePseudoClass_Count, "Unexpected type"); - NS_ABORT_IF_FALSE(aType >= 0, "Very unexpected type"); + MOZ_ASSERT(aType < ePseudoClass_Count, "Unexpected type"); + MOZ_ASSERT(aType >= 0, "Very unexpected type"); (*CSSPseudoClasses_info[aType].mAtom)->ToString(aString); } diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index d6b0497df34..76e2510f94e 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -676,7 +676,7 @@ void RuleHash::EnumerateAllRules(Element* aElement, ElementDependentRuleProcesso nsIAtom* id = aElement->GetID(); const nsAttrValue* classList = aElement->GetClasses(); - NS_ABORT_IF_FALSE(tag, "How could we not have a tag?"); + MOZ_ASSERT(tag, "How could we not have a tag?"); int32_t classCount = classList ? classList->GetAtomCount() : 0; @@ -1339,7 +1339,7 @@ nsCSSRuleProcessor::GetContentStateForVisitedHandling( { EventStates contentState = GetContentState(aElement, aTreeMatchContext); if (contentState.HasAtLeastOneOfStates(NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)) { - NS_ABORT_IF_FALSE(IsLink(aElement), "IsLink() should match state"); + MOZ_ASSERT(IsLink(aElement), "IsLink() should match state"); contentState &= ~(NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED); if (aIsRelevantLink) { switch (aVisitedHandling) { @@ -1756,11 +1756,11 @@ static bool SelectorMatches(Element* aElement, { NS_PRECONDITION(!aSelector->IsPseudoElement(), "Pseudo-element snuck into SelectorMatches?"); - NS_ABORT_IF_FALSE(aTreeMatchContext.mForStyling || - !aNodeMatchContext.mIsRelevantLink, - "mIsRelevantLink should be set to false when mForStyling " - "is false since we don't know how to set it correctly in " - "Has(Attribute|State)DependentStyle"); + MOZ_ASSERT(aTreeMatchContext.mForStyling || + !aNodeMatchContext.mIsRelevantLink, + "mIsRelevantLink should be set to false when mForStyling " + "is false since we don't know how to set it correctly in " + "Has(Attribute|State)DependentStyle"); // namespace/tag match // optimization : bail out early if we can @@ -1965,8 +1965,8 @@ static bool SelectorMatches(Element* aElement, nsCSSSelectorList *l; for (l = pseudoClass->u.mSelectors; l; l = l->mNext) { nsCSSSelector *s = l->mSelectors; - NS_ABORT_IF_FALSE(!s->mNext && !s->IsPseudoElement(), - "parser failed"); + MOZ_ASSERT(!s->mNext && !s->IsPseudoElement(), + "parser failed"); if (SelectorMatches( aElement, s, aNodeMatchContext, aTreeMatchContext, SelectorMatchesFlags::IS_PSEUDO_CLASS_ARGUMENT)) { @@ -2236,7 +2236,7 @@ static bool SelectorMatches(Element* aElement, break; default: - NS_ABORT_IF_FALSE(false, "How did that happen?"); + MOZ_ASSERT(false, "How did that happen?"); } } else { if (!StateSelectorMatches(aElement, aSelector, aNodeMatchContext, diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index 7ae1b47f1ff..e141246bb76 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -48,7 +48,7 @@ using namespace mozilla::dom; { return this; } #define IMPL_STYLE_RULE_INHERIT_MAP_RULE_INFO_INTO(class_, super_) \ /* virtual */ void class_::MapRuleInfoInto(nsRuleData* aRuleData) \ - { NS_ABORT_IF_FALSE(false, "should not be called"); } + { MOZ_ASSERT(false, "should not be called"); } #define IMPL_STYLE_RULE_INHERIT(class_, super_) \ IMPL_STYLE_RULE_INHERIT_GET_DOM_RULE_WEAK(class_, super_) \ @@ -541,7 +541,7 @@ GroupRule::GroupRule(const GroupRule& aCopy) GroupRule::~GroupRule() { - NS_ABORT_IF_FALSE(!mSheet, "SetStyleSheet should have been called"); + MOZ_ASSERT(!mSheet, "SetStyleSheet should have been called"); mRules.EnumerateForwards(SetParentRuleReference, nullptr); if (mRuleCollection) { mRuleCollection->DropReference(); @@ -2130,7 +2130,7 @@ nsCSSKeyframeStyleDeclaration::GetParentRule(nsIDOMCSSRule **aParent) nsresult nsCSSKeyframeStyleDeclaration::SetCSSDeclaration(css::Declaration* aDecl) { - NS_ABORT_IF_FALSE(aDecl, "must be non-null"); + MOZ_ASSERT(aDecl, "must be non-null"); mRule->ChangeDeclaration(aDecl); return NS_OK; } @@ -2295,7 +2295,7 @@ nsCSSKeyframeRule::DoGetKeyText(nsAString& aKeyText) const { aKeyText.Truncate(); uint32_t i = 0, i_end = mKeys.Length(); - NS_ABORT_IF_FALSE(i_end != 0, "must have some keys"); + MOZ_ASSERT(i_end != 0, "must have some keys"); for (;;) { aKeyText.AppendFloat(mKeys[i] * 100.0f); aKeyText.Append(char16_t('%')); @@ -2623,7 +2623,7 @@ nsCSSKeyframesRule::FindRule(const nsAString& aKey, nsCSSKeyframesRule::UseForPresentation(nsPresContext* aPresContext, nsMediaQueryResultCacheKey& aKey) { - NS_ABORT_IF_FALSE(false, "should not be called"); + MOZ_ASSERT(false, "should not be called"); return false; } @@ -2691,7 +2691,7 @@ nsCSSPageStyleDeclaration::GetParentRule(nsIDOMCSSRule** aParent) nsresult nsCSSPageStyleDeclaration::SetCSSDeclaration(css::Declaration* aDecl) { - NS_ABORT_IF_FALSE(aDecl, "must be non-null"); + MOZ_ASSERT(aDecl, "must be non-null"); mRule->ChangeDeclaration(aDecl); return NS_OK; } @@ -3211,16 +3211,16 @@ const nsCSSValue& nsCSSCounterStyleRule::GetSystemArgument() const { const nsCSSValue& system = GetDesc(eCSSCounterDesc_System); - NS_ABORT_IF_FALSE(system.GetUnit() == eCSSUnit_Pair, - "Invalid system value"); + MOZ_ASSERT(system.GetUnit() == eCSSUnit_Pair, + "Invalid system value"); return system.GetPairValue().mYValue; } void nsCSSCounterStyleRule::SetDesc(nsCSSCounterDesc aDescID, const nsCSSValue& aValue) { - NS_ABORT_IF_FALSE(aDescID >= 0 && aDescID < eCSSCounterDesc_COUNT, - "descriptor ID out of range"); + MOZ_ASSERT(aDescID >= 0 && aDescID < eCSSCounterDesc_COUNT, + "descriptor ID out of range"); nsIDocument* doc = GetDocument(); MOZ_AUTO_DOC_UPDATE(doc, UPDATE_STYLE, true); diff --git a/layout/style/nsCSSRules.h b/layout/style/nsCSSRules.h index 08661b416ea..f153893f782 100644 --- a/layout/style/nsCSSRules.h +++ b/layout/style/nsCSSRules.h @@ -714,8 +714,8 @@ public: const nsCSSValue& GetDesc(nsCSSCounterDesc aDescID) const { - NS_ABORT_IF_FALSE(aDescID >= 0 && aDescID < eCSSCounterDesc_COUNT, - "descriptor ID out of range"); + MOZ_ASSERT(aDescID >= 0 && aDescID < eCSSCounterDesc_COUNT, + "descriptor ID out of range"); return mValues[aDescID]; } diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp index 4909994eb17..ebfb48fad60 100644 --- a/layout/style/nsCSSValue.cpp +++ b/layout/style/nsCSSValue.cpp @@ -29,8 +29,9 @@ using namespace mozilla; nsCSSValue::nsCSSValue(int32_t aValue, nsCSSUnit aUnit) : mUnit(aUnit) { - NS_ABORT_IF_FALSE(aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated || - aUnit == eCSSUnit_EnumColor, "not an int value"); + MOZ_ASSERT(aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated || + aUnit == eCSSUnit_EnumColor, + "not an int value"); if (aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated || aUnit == eCSSUnit_EnumColor) { mValue.mInt = aValue; @@ -44,7 +45,7 @@ nsCSSValue::nsCSSValue(int32_t aValue, nsCSSUnit aUnit) nsCSSValue::nsCSSValue(float aValue, nsCSSUnit aUnit) : mUnit(aUnit) { - NS_ABORT_IF_FALSE(eCSSUnit_Percent <= aUnit, "not a float value"); + MOZ_ASSERT(eCSSUnit_Percent <= aUnit, "not a float value"); if (eCSSUnit_Percent <= aUnit) { mValue.mFloat = aValue; MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat)); @@ -58,7 +59,7 @@ nsCSSValue::nsCSSValue(float aValue, nsCSSUnit aUnit) nsCSSValue::nsCSSValue(const nsString& aValue, nsCSSUnit aUnit) : mUnit(aUnit) { - NS_ABORT_IF_FALSE(UnitHasStringValue(), "not a string value"); + MOZ_ASSERT(UnitHasStringValue(), "not a string value"); if (UnitHasStringValue()) { mValue.mString = BufferFromString(aValue).take(); } @@ -71,7 +72,7 @@ nsCSSValue::nsCSSValue(const nsString& aValue, nsCSSUnit aUnit) nsCSSValue::nsCSSValue(nsCSSValue::Array* aValue, nsCSSUnit aUnit) : mUnit(aUnit) { - NS_ABORT_IF_FALSE(UnitHasArrayValue(), "bad unit"); + MOZ_ASSERT(UnitHasArrayValue(), "bad unit"); mValue.mArray = aValue; mValue.mArray->AddRef(); } @@ -201,7 +202,7 @@ nsCSSValue::nsCSSValue(const nsCSSValue& aCopy) mValue.mFontFamilyList->AddRef(); } else { - NS_ABORT_IF_FALSE(false, "unknown unit"); + MOZ_ASSERT(false, "unknown unit"); } } @@ -216,11 +217,11 @@ nsCSSValue& nsCSSValue::operator=(const nsCSSValue& aCopy) bool nsCSSValue::operator==(const nsCSSValue& aOther) const { - NS_ABORT_IF_FALSE(mUnit != eCSSUnit_ListDep && - aOther.mUnit != eCSSUnit_ListDep && - mUnit != eCSSUnit_PairListDep && - aOther.mUnit != eCSSUnit_PairListDep, - "don't use operator== with dependent lists"); + MOZ_ASSERT(mUnit != eCSSUnit_ListDep && + aOther.mUnit != eCSSUnit_ListDep && + mUnit != eCSSUnit_PairListDep && + aOther.mUnit != eCSSUnit_PairListDep, + "don't use operator== with dependent lists"); if (mUnit == aOther.mUnit) { if (mUnit <= eCSSUnit_DummyInherit) { @@ -297,21 +298,21 @@ double nsCSSValue::GetAngleValueInRadians() const case eCSSUnit_Grad: return angle * M_PI / 200.0; default: - NS_ABORT_IF_FALSE(false, "unrecognized angular unit"); + MOZ_ASSERT(false, "unrecognized angular unit"); return 0.0; } } imgRequestProxy* nsCSSValue::GetImageValue(nsIDocument* aDocument) const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_Image, "not an Image value"); + MOZ_ASSERT(mUnit == eCSSUnit_Image, "not an Image value"); return mValue.mImage->mRequests.GetWeak(aDocument); } nscoord nsCSSValue::GetFixedLength(nsPresContext* aPresContext) const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_PhysicalMillimeter, - "not a fixed length unit"); + MOZ_ASSERT(mUnit == eCSSUnit_PhysicalMillimeter, + "not a fixed length unit"); float inches = mValue.mFloat / MM_PER_INCH_FLOAT; return NSToCoordFloorClamped(inches * @@ -320,7 +321,7 @@ nscoord nsCSSValue::GetFixedLength(nsPresContext* aPresContext) const nscoord nsCSSValue::GetPixelLength() const { - NS_ABORT_IF_FALSE(IsPixelLengthUnit(), "not a fixed length unit"); + MOZ_ASSERT(IsPixelLengthUnit(), "not a fixed length unit"); double scaleFactor; switch (mUnit) { @@ -375,8 +376,9 @@ void nsCSSValue::DoReset() void nsCSSValue::SetIntValue(int32_t aValue, nsCSSUnit aUnit) { - NS_ABORT_IF_FALSE(aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated || - aUnit == eCSSUnit_EnumColor, "not an int value"); + MOZ_ASSERT(aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated || + aUnit == eCSSUnit_EnumColor, + "not an int value"); Reset(); if (aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated || aUnit == eCSSUnit_EnumColor) { @@ -395,7 +397,7 @@ void nsCSSValue::SetPercentValue(float aValue) void nsCSSValue::SetFloatValue(float aValue, nsCSSUnit aUnit) { - NS_ABORT_IF_FALSE(eCSSUnit_Number <= aUnit, "not a float value"); + MOZ_ASSERT(eCSSUnit_Number <= aUnit, "not a float value"); Reset(); if (eCSSUnit_Number <= aUnit) { mUnit = aUnit; @@ -409,7 +411,7 @@ void nsCSSValue::SetStringValue(const nsString& aValue, { Reset(); mUnit = aUnit; - NS_ABORT_IF_FALSE(UnitHasStringValue(), "not a string unit"); + MOZ_ASSERT(UnitHasStringValue(), "not a string unit"); if (UnitHasStringValue()) { mValue.mString = BufferFromString(aValue).take(); } else @@ -425,7 +427,7 @@ void nsCSSValue::SetIntegerColorValue(nscolor aValue, nsCSSUnit aUnit) { Reset(); mUnit = aUnit; - NS_ABORT_IF_FALSE(IsIntegerColorUnit(), "bad unit"); + MOZ_ASSERT(IsIntegerColorUnit(), "bad unit"); mValue.mColor = aValue; } @@ -437,7 +439,7 @@ void nsCSSValue::SetFloatColorValue(float aComponent1, { Reset(); mUnit = aUnit; - NS_ABORT_IF_FALSE(IsFloatColorUnit(), "bad unit"); + MOZ_ASSERT(IsFloatColorUnit(), "bad unit"); mValue.mFloatColor = new nsCSSValueFloatColor(aComponent1, aComponent2, aComponent3, aAlpha); mValue.mFloatColor->AddRef(); @@ -447,7 +449,7 @@ void nsCSSValue::SetArrayValue(nsCSSValue::Array* aValue, nsCSSUnit aUnit) { Reset(); mUnit = aUnit; - NS_ABORT_IF_FALSE(UnitHasArrayValue(), "bad unit"); + MOZ_ASSERT(UnitHasArrayValue(), "bad unit"); mValue.mArray = aValue; mValue.mArray->AddRef(); } @@ -503,16 +505,16 @@ void nsCSSValue::SetFontFamilyListValue(css::FontFamilyListRefCnt* aValue) void nsCSSValue::SetPairValue(const nsCSSValuePair* aValue) { // pairs should not be used for null/inherit/initial values - NS_ABORT_IF_FALSE(aValue && - aValue->mXValue.GetUnit() != eCSSUnit_Null && - aValue->mYValue.GetUnit() != eCSSUnit_Null && - aValue->mXValue.GetUnit() != eCSSUnit_Inherit && - aValue->mYValue.GetUnit() != eCSSUnit_Inherit && - aValue->mXValue.GetUnit() != eCSSUnit_Initial && - aValue->mYValue.GetUnit() != eCSSUnit_Initial && - aValue->mXValue.GetUnit() != eCSSUnit_Unset && - aValue->mYValue.GetUnit() != eCSSUnit_Unset, - "missing or inappropriate pair value"); + MOZ_ASSERT(aValue && + aValue->mXValue.GetUnit() != eCSSUnit_Null && + aValue->mYValue.GetUnit() != eCSSUnit_Null && + aValue->mXValue.GetUnit() != eCSSUnit_Inherit && + aValue->mYValue.GetUnit() != eCSSUnit_Inherit && + aValue->mXValue.GetUnit() != eCSSUnit_Initial && + aValue->mYValue.GetUnit() != eCSSUnit_Initial && + aValue->mXValue.GetUnit() != eCSSUnit_Unset && + aValue->mYValue.GetUnit() != eCSSUnit_Unset, + "missing or inappropriate pair value"); Reset(); mUnit = eCSSUnit_Pair; mValue.mPair = new nsCSSValuePair_heap(aValue->mXValue, aValue->mYValue); @@ -522,15 +524,15 @@ void nsCSSValue::SetPairValue(const nsCSSValuePair* aValue) void nsCSSValue::SetPairValue(const nsCSSValue& xValue, const nsCSSValue& yValue) { - NS_ABORT_IF_FALSE(xValue.GetUnit() != eCSSUnit_Null && - yValue.GetUnit() != eCSSUnit_Null && - xValue.GetUnit() != eCSSUnit_Inherit && - yValue.GetUnit() != eCSSUnit_Inherit && - xValue.GetUnit() != eCSSUnit_Initial && - yValue.GetUnit() != eCSSUnit_Initial && - xValue.GetUnit() != eCSSUnit_Unset && - yValue.GetUnit() != eCSSUnit_Unset, - "inappropriate pair value"); + MOZ_ASSERT(xValue.GetUnit() != eCSSUnit_Null && + yValue.GetUnit() != eCSSUnit_Null && + xValue.GetUnit() != eCSSUnit_Inherit && + yValue.GetUnit() != eCSSUnit_Inherit && + xValue.GetUnit() != eCSSUnit_Initial && + yValue.GetUnit() != eCSSUnit_Initial && + xValue.GetUnit() != eCSSUnit_Unset && + yValue.GetUnit() != eCSSUnit_Unset, + "inappropriate pair value"); Reset(); mUnit = eCSSUnit_Pair; mValue.mPair = new nsCSSValuePair_heap(xValue, yValue); @@ -540,20 +542,20 @@ void nsCSSValue::SetPairValue(const nsCSSValue& xValue, void nsCSSValue::SetTripletValue(const nsCSSValueTriplet* aValue) { // triplet should not be used for null/inherit/initial values - NS_ABORT_IF_FALSE(aValue && - aValue->mXValue.GetUnit() != eCSSUnit_Null && - aValue->mYValue.GetUnit() != eCSSUnit_Null && - aValue->mZValue.GetUnit() != eCSSUnit_Null && - aValue->mXValue.GetUnit() != eCSSUnit_Inherit && - aValue->mYValue.GetUnit() != eCSSUnit_Inherit && - aValue->mZValue.GetUnit() != eCSSUnit_Inherit && - aValue->mXValue.GetUnit() != eCSSUnit_Initial && - aValue->mYValue.GetUnit() != eCSSUnit_Initial && - aValue->mZValue.GetUnit() != eCSSUnit_Initial && - aValue->mXValue.GetUnit() != eCSSUnit_Unset && - aValue->mYValue.GetUnit() != eCSSUnit_Unset && - aValue->mZValue.GetUnit() != eCSSUnit_Unset, - "missing or inappropriate triplet value"); + MOZ_ASSERT(aValue && + aValue->mXValue.GetUnit() != eCSSUnit_Null && + aValue->mYValue.GetUnit() != eCSSUnit_Null && + aValue->mZValue.GetUnit() != eCSSUnit_Null && + aValue->mXValue.GetUnit() != eCSSUnit_Inherit && + aValue->mYValue.GetUnit() != eCSSUnit_Inherit && + aValue->mZValue.GetUnit() != eCSSUnit_Inherit && + aValue->mXValue.GetUnit() != eCSSUnit_Initial && + aValue->mYValue.GetUnit() != eCSSUnit_Initial && + aValue->mZValue.GetUnit() != eCSSUnit_Initial && + aValue->mXValue.GetUnit() != eCSSUnit_Unset && + aValue->mYValue.GetUnit() != eCSSUnit_Unset && + aValue->mZValue.GetUnit() != eCSSUnit_Unset, + "missing or inappropriate triplet value"); Reset(); mUnit = eCSSUnit_Triplet; mValue.mTriplet = new nsCSSValueTriplet_heap(aValue->mXValue, aValue->mYValue, aValue->mZValue); @@ -565,18 +567,18 @@ void nsCSSValue::SetTripletValue(const nsCSSValue& xValue, const nsCSSValue& zValue) { // Only allow Null for the z component - NS_ABORT_IF_FALSE(xValue.GetUnit() != eCSSUnit_Null && - yValue.GetUnit() != eCSSUnit_Null && - xValue.GetUnit() != eCSSUnit_Inherit && - yValue.GetUnit() != eCSSUnit_Inherit && - zValue.GetUnit() != eCSSUnit_Inherit && - xValue.GetUnit() != eCSSUnit_Initial && - yValue.GetUnit() != eCSSUnit_Initial && - zValue.GetUnit() != eCSSUnit_Initial && - xValue.GetUnit() != eCSSUnit_Unset && - yValue.GetUnit() != eCSSUnit_Unset && - zValue.GetUnit() != eCSSUnit_Unset, - "inappropriate triplet value"); + MOZ_ASSERT(xValue.GetUnit() != eCSSUnit_Null && + yValue.GetUnit() != eCSSUnit_Null && + xValue.GetUnit() != eCSSUnit_Inherit && + yValue.GetUnit() != eCSSUnit_Inherit && + zValue.GetUnit() != eCSSUnit_Inherit && + xValue.GetUnit() != eCSSUnit_Initial && + yValue.GetUnit() != eCSSUnit_Initial && + zValue.GetUnit() != eCSSUnit_Initial && + xValue.GetUnit() != eCSSUnit_Unset && + yValue.GetUnit() != eCSSUnit_Unset && + zValue.GetUnit() != eCSSUnit_Unset, + "inappropriate triplet value"); Reset(); mUnit = eCSSUnit_Triplet; mValue.mTriplet = new nsCSSValueTriplet_heap(xValue, yValue, zValue); @@ -698,7 +700,7 @@ void nsCSSValue::SetDummyInheritValue() void nsCSSValue::StartImageLoad(nsIDocument* aDocument) const { - NS_ABORT_IF_FALSE(eCSSUnit_URL == mUnit, "Not a URL value!"); + MOZ_ASSERT(eCSSUnit_URL == mUnit, "Not a URL value!"); mozilla::css::ImageValue* image = new mozilla::css::ImageValue(mValue.mURL->GetURI(), mValue.mURL->mString, @@ -712,7 +714,7 @@ void nsCSSValue::StartImageLoad(nsIDocument* aDocument) const nscolor nsCSSValue::GetColorValue() const { - NS_ABORT_IF_FALSE(IsNumericColorUnit(), "not a color value"); + MOZ_ASSERT(IsNumericColorUnit(), "not a color value"); if (IsFloatColorUnit()) { return mValue.mFloatColor->GetColorValue(mUnit); } @@ -750,9 +752,9 @@ nsCSSValue::EqualsFunction(nsCSSKeyword aFunctionId) const } nsCSSValue::Array* func = mValue.mArray; - NS_ABORT_IF_FALSE(func && func->Count() >= 1 && - func->Item(0).GetUnit() == eCSSUnit_Enumerated, - "illegally structured function value"); + MOZ_ASSERT(func && func->Count() >= 1 && + func->Item(0).GetUnit() == eCSSUnit_Enumerated, + "illegally structured function value"); nsCSSKeyword thisFunctionId = func->Item(0).GetKeywordValue(); return thisFunctionId == aFunctionId; @@ -809,14 +811,14 @@ struct CSSValueSerializeCalcOps { void AppendLeafValue(const input_type& aValue) { - NS_ABORT_IF_FALSE(aValue.GetUnit() == eCSSUnit_Percent || - aValue.IsLengthUnit(), "unexpected unit"); + MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Percent || aValue.IsLengthUnit(), + "unexpected unit"); aValue.AppendToString(mProperty, mResult, mValueSerialization); } void AppendNumber(const input_type& aValue) { - NS_ABORT_IF_FALSE(aValue.GetUnit() == eCSSUnit_Number, "unexpected unit"); + MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Number, "unexpected unit"); aValue.AppendToString(mProperty, mResult, mValueSerialization); } @@ -833,8 +835,8 @@ nsCSSValue::AppendPolygonToString(nsCSSProperty aProperty, nsAString& aResult, Serialization aSerialization) const { const nsCSSValue::Array* array = GetArrayValue(); - NS_ABORT_IF_FALSE(array->Count() > 1 && array->Count() <= 3, - "Polygons must have name and at least one more value."); + MOZ_ASSERT(array->Count() > 1 && array->Count() <= 3, + "Polygons must have name and at least one more value."); // When the array has 2 elements, the item on index 1 is the coordinate // pair list. // When the array has 3 elements, the item on index 1 is a fill-rule @@ -842,8 +844,8 @@ nsCSSValue::AppendPolygonToString(nsCSSProperty aProperty, nsAString& aResult, size_t index = 1; if (array->Count() == 3) { const nsCSSValue& fillRuleValue = array->Item(index); - NS_ABORT_IF_FALSE(fillRuleValue.GetUnit() == eCSSUnit_Enumerated, - "Expected polygon fill rule."); + MOZ_ASSERT(fillRuleValue.GetUnit() == eCSSUnit_Enumerated, + "Expected polygon fill rule."); int32_t fillRule = fillRuleValue.GetIntValue(); AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(fillRule, nsCSSProps::kFillRuleKTable), @@ -876,7 +878,7 @@ nsCSSValue::AppendCircleOrEllipseToString(nsCSSKeyword aFunctionId, { const nsCSSValue::Array* array = GetArrayValue(); size_t count = aFunctionId == eCSSKeyword_circle ? 2 : 3; - NS_ABORT_IF_FALSE(array->Count() == count + 1, "wrong number of arguments"); + MOZ_ASSERT(array->Count() == count + 1, "wrong number of arguments"); bool hasRadii = array->Item(1).GetUnit() != eCSSUnit_Null; @@ -891,8 +893,8 @@ nsCSSValue::AppendCircleOrEllipseToString(nsCSSKeyword aFunctionId, // Any position specified? if (array->Item(count).GetUnit() != eCSSUnit_Array) { - NS_ABORT_IF_FALSE(array->Item(count).GetUnit() == eCSSUnit_Null, - "unexpected value"); + MOZ_ASSERT(array->Item(count).GetUnit() == eCSSUnit_Null, + "unexpected value"); return; } @@ -918,19 +920,19 @@ nsCSSValue::AppendSidesShorthandToString(const nsCSSProperty aProperties[], const nsCSSValue& value3 = *aValues[2]; const nsCSSValue& value4 = *aValues[3]; - NS_ABORT_IF_FALSE(value1.GetUnit() != eCSSUnit_Null, "null value 1"); + MOZ_ASSERT(value1.GetUnit() != eCSSUnit_Null, "null value 1"); value1.AppendToString(aProperties[0], aString, aSerialization); if (value1 != value2 || value1 != value3 || value1 != value4) { aString.Append(char16_t(' ')); - NS_ABORT_IF_FALSE(value2.GetUnit() != eCSSUnit_Null, "null value 2"); + MOZ_ASSERT(value2.GetUnit() != eCSSUnit_Null, "null value 2"); value2.AppendToString(aProperties[1], aString, aSerialization); if (value1 != value3 || value2 != value4) { aString.Append(char16_t(' ')); - NS_ABORT_IF_FALSE(value3.GetUnit() != eCSSUnit_Null, "null value 3"); + MOZ_ASSERT(value3.GetUnit() != eCSSUnit_Null, "null value 3"); value3.AppendToString(aProperties[2], aString, aSerialization); if (value2 != value4) { aString.Append(char16_t(' ')); - NS_ABORT_IF_FALSE(value4.GetUnit() != eCSSUnit_Null, "null value 4"); + MOZ_ASSERT(value4.GetUnit() != eCSSUnit_Null, "null value 4"); value4.AppendToString(aProperties[3], aString, aSerialization); } } @@ -968,8 +970,8 @@ nsCSSValue::AppendInsetToString(nsCSSProperty aProperty, nsAString& aResult, Serialization aSerialization) const { const nsCSSValue::Array* array = GetArrayValue(); - NS_ABORT_IF_FALSE(array->Count() == 6, - "inset function has wrong number of arguments"); + MOZ_ASSERT(array->Count() == 6, + "inset function has wrong number of arguments"); if (array->Item(1).GetUnit() != eCSSUnit_Null) { array->Item(1).AppendToString(aProperty, aResult, aSerialization); if (array->Item(2).GetUnit() != eCSSUnit_Null) { @@ -990,7 +992,7 @@ nsCSSValue::AppendInsetToString(nsCSSProperty aProperty, nsAString& aResult, const nsCSSProperty* subprops = nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_radius); const nsCSSValue::Array* radius = array->Item(5).GetArrayValue(); - NS_ABORT_IF_FALSE(radius->Count() == 4, "expected 4 radii values"); + MOZ_ASSERT(radius->Count() == 4, "expected 4 radii values"); const nsCSSValue* vals[4] = { &(radius->Item(0)), &(radius->Item(1)), @@ -1001,8 +1003,8 @@ nsCSSValue::AppendInsetToString(nsCSSProperty aProperty, nsAString& aResult, AppendBasicShapeRadiusToString(subprops, vals, aResult, aSerialization); } else { - NS_ABORT_IF_FALSE(array->Item(5).GetUnit() == eCSSUnit_Null, - "unexpected value"); + MOZ_ASSERT(array->Item(5).GetUnit() == eCSSUnit_Null, + "unexpected value"); } } @@ -1011,10 +1013,10 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, Serialization aSerialization) const { // eCSSProperty_UNKNOWN gets used for some recursive calls below. - NS_ABORT_IF_FALSE((0 <= aProperty && - aProperty <= eCSSProperty_COUNT_no_shorthands) || - aProperty == eCSSProperty_UNKNOWN, - "property ID out of range"); + MOZ_ASSERT((0 <= aProperty && + aProperty <= eCSSProperty_COUNT_no_shorthands) || + aProperty == eCSSProperty_UNKNOWN, + "property ID out of range"); nsCSSUnit unit = GetUnit(); if (unit == eCSSUnit_Null) { @@ -1055,12 +1057,12 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, aResult.AppendLiteral(", "); } if (unit == eCSSUnit_Steps && i == 1) { - NS_ABORT_IF_FALSE(array->Item(i).GetUnit() == eCSSUnit_Enumerated && - (array->Item(i).GetIntValue() == - NS_STYLE_TRANSITION_TIMING_FUNCTION_STEP_START || - array->Item(i).GetIntValue() == - NS_STYLE_TRANSITION_TIMING_FUNCTION_STEP_END), - "unexpected value"); + MOZ_ASSERT(array->Item(i).GetUnit() == eCSSUnit_Enumerated && + (array->Item(i).GetIntValue() == + NS_STYLE_TRANSITION_TIMING_FUNCTION_STEP_START || + array->Item(i).GetIntValue() == + NS_STYLE_TRANSITION_TIMING_FUNCTION_STEP_END), + "unexpected value"); if (array->Item(i).GetIntValue() == NS_STYLE_TRANSITION_TIMING_FUNCTION_STEP_START) { aResult.AppendLiteral("start"); @@ -1070,8 +1072,8 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, continue; } if (unit == eCSSUnit_Symbols && i == 0) { - NS_ABORT_IF_FALSE(array->Item(i).GetUnit() == eCSSUnit_Enumerated, - "unexpected value"); + MOZ_ASSERT(array->Item(i).GetUnit() == eCSSUnit_Enumerated, + "unexpected value"); int32_t system = array->Item(i).GetIntValue(); if (system != NS_STYLE_COUNTER_SYSTEM_SYMBOLIC) { AppendASCIItoUTF16(nsCSSProps::ValueToKeyword( @@ -1099,12 +1101,12 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, */ else if (eCSSUnit_Function == unit) { const nsCSSValue::Array* array = GetArrayValue(); - NS_ABORT_IF_FALSE(array->Count() >= 1, - "Functions must have at least one element for the name."); + MOZ_ASSERT(array->Count() >= 1, + "Functions must have at least one element for the name."); const nsCSSValue& functionName = array->Item(0); - NS_ABORT_IF_FALSE(functionName.GetUnit() == eCSSUnit_Enumerated, - "Functions must have an enumerated name."); + MOZ_ASSERT(functionName.GetUnit() == eCSSUnit_Enumerated, + "Functions must have an enumerated name."); /* Append the function name. */ // The first argument is always of nsCSSKeyword type. @@ -1173,7 +1175,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, aResult.Append(')'); } else if (IsCalcUnit()) { - NS_ABORT_IF_FALSE(GetUnit() == eCSSUnit_Calc, "unexpected unit"); + MOZ_ASSERT(GetUnit() == eCSSUnit_Calc, "unexpected unit"); CSSValueSerializeCalcOps ops(aProperty, aResult, aSerialization); css::SerializeCalc(*this, ops); } @@ -1303,7 +1305,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, if (nsCSSProps::GetColorName(GetIntValue(), str)){ AppendASCIItoUTF16(str, aResult); } else { - NS_ABORT_IF_FALSE(false, "bad color value"); + MOZ_ASSERT(false, "bad color value"); } } else if (IsNumericColorUnit(unit)) { @@ -1396,12 +1398,12 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, if (gradient->mIsRadial && !gradient->mIsLegacySyntax) { if (!gradient->mIsExplicitSize) { if (gradient->GetRadialShape().GetUnit() != eCSSUnit_None) { - NS_ABORT_IF_FALSE(gradient->GetRadialShape().GetUnit() == - eCSSUnit_Enumerated, - "bad unit for radial gradient shape"); + MOZ_ASSERT(gradient->GetRadialShape().GetUnit() == + eCSSUnit_Enumerated, + "bad unit for radial gradient shape"); int32_t intValue = gradient->GetRadialShape().GetIntValue(); - NS_ABORT_IF_FALSE(intValue != NS_STYLE_GRADIENT_SHAPE_LINEAR, - "radial gradient with linear shape?!"); + MOZ_ASSERT(intValue != NS_STYLE_GRADIENT_SHAPE_LINEAR, + "radial gradient with linear shape?!"); AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(intValue, nsCSSProps::kRadialGradientShapeKTable), aResult); @@ -1412,9 +1414,8 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, if (needSep) { aResult.Append(' '); } - NS_ABORT_IF_FALSE(gradient->GetRadialSize().GetUnit() == - eCSSUnit_Enumerated, - "bad unit for radial gradient size"); + MOZ_ASSERT(gradient->GetRadialSize().GetUnit() == eCSSUnit_Enumerated, + "bad unit for radial gradient size"); int32_t intValue = gradient->GetRadialSize().GetIntValue(); AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(intValue, nsCSSProps::kRadialGradientSizeKTable), @@ -1422,8 +1423,8 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, needSep = true; } } else { - NS_ABORT_IF_FALSE(gradient->GetRadiusX().GetUnit() != eCSSUnit_None, - "bad unit for radial gradient explicit size"); + MOZ_ASSERT(gradient->GetRadiusX().GetUnit() != eCSSUnit_None, + "bad unit for radial gradient explicit size"); gradient->GetRadiusX().AppendToString(aProperty, aResult, aSerialization); if (gradient->GetRadiusY().GetUnit() != eCSSUnit_None) { @@ -1438,9 +1439,9 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, if (gradient->mBgPos.mXValue.GetUnit() != eCSSUnit_None || gradient->mBgPos.mYValue.GetUnit() != eCSSUnit_None) { MOZ_ASSERT(gradient->mAngle.GetUnit() == eCSSUnit_None); - NS_ABORT_IF_FALSE(gradient->mBgPos.mXValue.GetUnit() == eCSSUnit_Enumerated && - gradient->mBgPos.mYValue.GetUnit() == eCSSUnit_Enumerated, - "unexpected unit"); + MOZ_ASSERT(gradient->mBgPos.mXValue.GetUnit() == eCSSUnit_Enumerated && + gradient->mBgPos.mYValue.GetUnit() == eCSSUnit_Enumerated, + "unexpected unit"); aResult.AppendLiteral("to"); if (!(gradient->mBgPos.mXValue.GetIntValue() & NS_STYLE_BG_POSITION_CENTER)) { aResult.Append(' '); @@ -1477,8 +1478,8 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, aResult.Append(' '); } if (gradient->mAngle.GetUnit() != eCSSUnit_None) { - NS_ABORT_IF_FALSE(gradient->mIsLegacySyntax, - "angle is allowed only for legacy syntax"); + MOZ_ASSERT(gradient->mIsLegacySyntax, + "angle is allowed only for legacy syntax"); gradient->mAngle.AppendToString(aProperty, aResult, aSerialization); } needSep = true; @@ -1492,12 +1493,11 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, aResult.AppendLiteral(", "); } if (gradient->GetRadialShape().GetUnit() != eCSSUnit_None) { - NS_ABORT_IF_FALSE(gradient->GetRadialShape().GetUnit() == - eCSSUnit_Enumerated, - "bad unit for radial gradient shape"); + MOZ_ASSERT(gradient->GetRadialShape().GetUnit() == eCSSUnit_Enumerated, + "bad unit for radial gradient shape"); int32_t intValue = gradient->GetRadialShape().GetIntValue(); - NS_ABORT_IF_FALSE(intValue != NS_STYLE_GRADIENT_SHAPE_LINEAR, - "radial gradient with linear shape?!"); + MOZ_ASSERT(intValue != NS_STYLE_GRADIENT_SHAPE_LINEAR, + "radial gradient with linear shape?!"); AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(intValue, nsCSSProps::kRadialGradientShapeKTable), aResult); @@ -1505,9 +1505,8 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, } if (gradient->GetRadialSize().GetUnit() != eCSSUnit_None) { - NS_ABORT_IF_FALSE(gradient->GetRadialSize().GetUnit() == - eCSSUnit_Enumerated, - "bad unit for radial gradient size"); + MOZ_ASSERT(gradient->GetRadialSize().GetUnit() == eCSSUnit_Enumerated, + "bad unit for radial gradient size"); int32_t intValue = gradient->GetRadialSize().GetIntValue(); AppendASCIItoUTF16(nsCSSProps::ValueToKeyword(intValue, nsCSSProps::kRadialGradientSizeKTable), @@ -1614,7 +1613,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult, case eCSSUnit_All: aResult.AppendLiteral("all"); break; case eCSSUnit_Dummy: case eCSSUnit_DummyInherit: - NS_ABORT_IF_FALSE(false, "should never serialize"); + MOZ_ASSERT(false, "should never serialize"); break; case eCSSUnit_FontFamilyList: break; @@ -1864,7 +1863,7 @@ nsCSSValue::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const break; default: - NS_ABORT_IF_FALSE(false, "bad nsCSSUnit"); + MOZ_ASSERT(false, "bad nsCSSUnit"); break; } @@ -2086,11 +2085,11 @@ void nsCSSRect::AppendToString(nsCSSProperty aProperty, nsAString& aResult, nsCSSValue::Serialization aSerialization) const { - NS_ABORT_IF_FALSE(mTop.GetUnit() != eCSSUnit_Null && - mTop.GetUnit() != eCSSUnit_Inherit && - mTop.GetUnit() != eCSSUnit_Initial && - mTop.GetUnit() != eCSSUnit_Unset, - "parser should have used a bare value"); + MOZ_ASSERT(mTop.GetUnit() != eCSSUnit_Null && + mTop.GetUnit() != eCSSUnit_Inherit && + mTop.GetUnit() != eCSSUnit_Initial && + mTop.GetUnit() != eCSSUnit_Unset, + "parser should have used a bare value"); if (eCSSProperty_border_image_slice == aProperty || eCSSProperty_border_image_width == aProperty || @@ -2240,8 +2239,8 @@ nsCSSValuePairList::AppendToString(nsCSSProperty aProperty, { const nsCSSValuePairList* item = this; for (;;) { - NS_ABORT_IF_FALSE(item->mXValue.GetUnit() != eCSSUnit_Null, - "unexpected null unit"); + MOZ_ASSERT(item->mXValue.GetUnit() != eCSSUnit_Null, + "unexpected null unit"); item->mXValue.AppendToString(aProperty, aResult, aSerialization); if (item->mXValue.GetUnit() != eCSSUnit_Inherit && item->mXValue.GetUnit() != eCSSUnit_Initial && @@ -2321,7 +2320,7 @@ css::URLValue::URLValue(nsIURI* aURI, nsStringBuffer* aString, mOriginPrincipal(aOriginPrincipal), mURIResolved(true) { - NS_ABORT_IF_FALSE(aOriginPrincipal, "Must have an origin principal"); + MOZ_ASSERT(aOriginPrincipal, "Must have an origin principal"); mString->AddRef(); } @@ -2333,7 +2332,7 @@ css::URLValue::URLValue(nsStringBuffer* aString, nsIURI* aBaseURI, mOriginPrincipal(aOriginPrincipal), mURIResolved(false) { - NS_ABORT_IF_FALSE(aOriginPrincipal, "Must have an origin principal"); + MOZ_ASSERT(aOriginPrincipal, "Must have an origin principal"); mString->AddRef(); } @@ -2360,8 +2359,8 @@ css::URLValue::operator==(const URLValue& aOther) const bool css::URLValue::URIEquals(const URLValue& aOther) const { - NS_ABORT_IF_FALSE(mURIResolved && aOther.mURIResolved, - "How do you know the URIs aren't null?"); + MOZ_ASSERT(mURIResolved && aOther.mURIResolved, + "How do you know the URIs aren't null?"); bool eq; // Worth comparing GetURI() to aOther.GetURI() and mOriginPrincipal to // aOther.mOriginPrincipal, because in the (probably common) case when this diff --git a/layout/style/nsCSSValue.h b/layout/style/nsCSSValue.h index d2072d9c918..39574b08e0c 100644 --- a/layout/style/nsCSSValue.h +++ b/layout/style/nsCSSValue.h @@ -395,7 +395,7 @@ public: explicit nsCSSValue(nsCSSUnit aUnit = eCSSUnit_Null) : mUnit(aUnit) { - NS_ABORT_IF_FALSE(aUnit <= eCSSUnit_DummyInherit, "not a valueless unit"); + MOZ_ASSERT(aUnit <= eCSSUnit_DummyInherit, "not a valueless unit"); } nsCSSValue(int32_t aValue, nsCSSUnit aUnit); @@ -500,36 +500,36 @@ public: int32_t GetIntValue() const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_Integer || - mUnit == eCSSUnit_Enumerated || - mUnit == eCSSUnit_EnumColor, - "not an int value"); + MOZ_ASSERT(mUnit == eCSSUnit_Integer || + mUnit == eCSSUnit_Enumerated || + mUnit == eCSSUnit_EnumColor, + "not an int value"); return mValue.mInt; } nsCSSKeyword GetKeywordValue() const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_Enumerated, "not a keyword value"); + MOZ_ASSERT(mUnit == eCSSUnit_Enumerated, "not a keyword value"); return static_cast(mValue.mInt); } float GetPercentValue() const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_Percent, "not a percent value"); + MOZ_ASSERT(mUnit == eCSSUnit_Percent, "not a percent value"); return mValue.mFloat; } float GetFloatValue() const { - NS_ABORT_IF_FALSE(eCSSUnit_Number <= mUnit, "not a float value"); + MOZ_ASSERT(eCSSUnit_Number <= mUnit, "not a float value"); MOZ_ASSERT(!mozilla::IsNaN(mValue.mFloat)); return mValue.mFloat; } float GetAngleValue() const { - NS_ABORT_IF_FALSE(eCSSUnit_Degree <= mUnit && - mUnit <= eCSSUnit_Turn, "not an angle value"); + MOZ_ASSERT(eCSSUnit_Degree <= mUnit && mUnit <= eCSSUnit_Turn, + "not an angle value"); return mValue.mFloat; } @@ -538,7 +538,7 @@ public: nsAString& GetStringValue(nsAString& aBuffer) const { - NS_ABORT_IF_FALSE(UnitHasStringValue(), "not a string value"); + MOZ_ASSERT(UnitHasStringValue(), "not a string value"); aBuffer.Truncate(); uint32_t len = NS_strlen(GetBufferValue(mValue.mString)); mValue.mString->ToString(len, aBuffer); @@ -547,7 +547,7 @@ public: const char16_t* GetStringBufferValue() const { - NS_ABORT_IF_FALSE(UnitHasStringValue(), "not a string value"); + MOZ_ASSERT(UnitHasStringValue(), "not a string value"); return GetBufferValue(mValue.mString); } @@ -556,40 +556,40 @@ public: Array* GetArrayValue() const { - NS_ABORT_IF_FALSE(UnitHasArrayValue(), "not an array value"); + MOZ_ASSERT(UnitHasArrayValue(), "not an array value"); return mValue.mArray; } nsIURI* GetURLValue() const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_URL || mUnit == eCSSUnit_Image, - "not a URL value"); + MOZ_ASSERT(mUnit == eCSSUnit_URL || mUnit == eCSSUnit_Image, + "not a URL value"); return mUnit == eCSSUnit_URL ? mValue.mURL->GetURI() : mValue.mImage->GetURI(); } nsCSSValueGradient* GetGradientValue() const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_Gradient, "not a gradient value"); + MOZ_ASSERT(mUnit == eCSSUnit_Gradient, "not a gradient value"); return mValue.mGradient; } nsCSSValueTokenStream* GetTokenStreamValue() const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_TokenStream, "not a token stream value"); + MOZ_ASSERT(mUnit == eCSSUnit_TokenStream, "not a token stream value"); return mValue.mTokenStream; } nsCSSValueSharedList* GetSharedListValue() const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_SharedList, "not a shared list value"); + MOZ_ASSERT(mUnit == eCSSUnit_SharedList, "not a shared list value"); return mValue.mSharedList; } mozilla::FontFamilyList* GetFontFamilyListValue() const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_FontFamilyList, - "not a font family list value"); + MOZ_ASSERT(mUnit == eCSSUnit_FontFamilyList, + "not a font family list value"); NS_ASSERTION(mValue.mFontFamilyList != nullptr, "font family list value should never be null"); return mValue.mFontFamilyList; @@ -616,27 +616,27 @@ public: { // Not allowing this for Image values, because if the caller takes // a ref to them they won't be able to delete them properly. - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_URL, "not a URL value"); + MOZ_ASSERT(mUnit == eCSSUnit_URL, "not a URL value"); return mValue.mURL; } mozilla::css::ImageValue* GetImageStructValue() const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_Image, "not an Image value"); + MOZ_ASSERT(mUnit == eCSSUnit_Image, "not an Image value"); return mValue.mImage; } mozilla::css::GridTemplateAreasValue* GetGridTemplateAreas() const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_GridTemplateAreas, - "not a grid-template-areas value"); + MOZ_ASSERT(mUnit == eCSSUnit_GridTemplateAreas, + "not a grid-template-areas value"); return mValue.mGridTemplateAreas; } const char16_t* GetOriginalURLValue() const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_URL || mUnit == eCSSUnit_Image, - "not a URL value"); + MOZ_ASSERT(mUnit == eCSSUnit_URL || mUnit == eCSSUnit_Image, + "not a URL value"); return GetBufferValue(mUnit == eCSSUnit_URL ? mValue.mURL->mString : mValue.mImage->mString); @@ -777,12 +777,12 @@ struct nsCSSValue::Array MOZ_FINAL { } nsCSSValue& operator[](size_t aIndex) { - NS_ABORT_IF_FALSE(aIndex < mCount, "out of range"); + MOZ_ASSERT(aIndex < mCount, "out of range"); return mArray[aIndex]; } const nsCSSValue& operator[](size_t aIndex) const { - NS_ABORT_IF_FALSE(aIndex < mCount, "out of range"); + MOZ_ASSERT(aIndex < mCount, "out of range"); return mArray[aIndex]; } @@ -837,7 +837,7 @@ private: nsCSSValue mArray[1]; void* operator new(size_t aSelfSize, size_t aItemCount) CPP_THROW_NEW { - NS_ABORT_IF_FALSE(aItemCount > 0, "cannot have a 0 item count"); + MOZ_ASSERT(aItemCount > 0, "cannot have a 0 item count"); return ::operator new(aSelfSize + sizeof(nsCSSValue) * (aItemCount - 1)); } @@ -970,7 +970,7 @@ nsCSSValue::GetListValue() if (mUnit == eCSSUnit_List) return mValue.mList; else { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_ListDep, "not a pairlist value"); + MOZ_ASSERT(mUnit == eCSSUnit_ListDep, "not a pairlist value"); return mValue.mListDependent; } } @@ -981,7 +981,7 @@ nsCSSValue::GetListValue() const if (mUnit == eCSSUnit_List) return mValue.mList; else { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_ListDep, "not a pairlist value"); + MOZ_ASSERT(mUnit == eCSSUnit_ListDep, "not a pairlist value"); return mValue.mListDependent; } } @@ -1061,14 +1061,14 @@ private: inline nsCSSRect& nsCSSValue::GetRectValue() { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_Rect, "not a rect value"); + MOZ_ASSERT(mUnit == eCSSUnit_Rect, "not a rect value"); return *mValue.mRect; } inline const nsCSSRect& nsCSSValue::GetRectValue() const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_Rect, "not a rect value"); + MOZ_ASSERT(mUnit == eCSSUnit_Rect, "not a rect value"); return *mValue.mRect; } @@ -1252,28 +1252,28 @@ private: inline nsCSSValuePair& nsCSSValue::GetPairValue() { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_Pair, "not a pair value"); + MOZ_ASSERT(mUnit == eCSSUnit_Pair, "not a pair value"); return *mValue.mPair; } inline const nsCSSValuePair& nsCSSValue::GetPairValue() const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_Pair, "not a pair value"); + MOZ_ASSERT(mUnit == eCSSUnit_Pair, "not a pair value"); return *mValue.mPair; } inline nsCSSValueTriplet& nsCSSValue::GetTripletValue() { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_Triplet, "not a triplet value"); + MOZ_ASSERT(mUnit == eCSSUnit_Triplet, "not a triplet value"); return *mValue.mTriplet; } inline const nsCSSValueTriplet& nsCSSValue::GetTripletValue() const { - NS_ABORT_IF_FALSE(mUnit == eCSSUnit_Triplet, "not a triplet value"); + MOZ_ASSERT(mUnit == eCSSUnit_Triplet, "not a triplet value"); return *mValue.mTriplet; } @@ -1332,7 +1332,7 @@ nsCSSValue::GetPairListValue() if (mUnit == eCSSUnit_PairList) return mValue.mPairList; else { - NS_ABORT_IF_FALSE (mUnit == eCSSUnit_PairListDep, "not a pairlist value"); + MOZ_ASSERT (mUnit == eCSSUnit_PairListDep, "not a pairlist value"); return mValue.mPairListDependent; } } @@ -1343,7 +1343,7 @@ nsCSSValue::GetPairListValue() const if (mUnit == eCSSUnit_PairList) return mValue.mPairList; else { - NS_ABORT_IF_FALSE (mUnit == eCSSUnit_PairListDep, "not a pairlist value"); + MOZ_ASSERT (mUnit == eCSSUnit_PairListDep, "not a pairlist value"); return mValue.mPairListDependent; } } diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 4bc47a7bb2e..d1c2916e508 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -419,7 +419,7 @@ nsComputedDOMStyle::GetStyleContextForElementNoFlush(Element* aElement, nsIPresShell* aPresShell, StyleType aStyleType) { - NS_ABORT_IF_FALSE(aElement, "NULL element"); + MOZ_ASSERT(aElement, "NULL element"); // If the content has a pres shell, we must use it. Otherwise we'd // potentially mix rule trees by using the wrong pres shell's style // set. Using the pres shell from the content also means that any @@ -652,9 +652,8 @@ nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush) // mExposeVisitedStyle is set to true only by testing APIs that // require chrome privilege. - NS_ABORT_IF_FALSE(!mExposeVisitedStyle || - nsContentUtils::IsCallerChrome(), - "mExposeVisitedStyle set incorrectly"); + MOZ_ASSERT(!mExposeVisitedStyle || nsContentUtils::IsCallerChrome(), + "mExposeVisitedStyle set incorrectly"); if (mExposeVisitedStyle && mStyleContextHolder->RelevantLinkVisited()) { nsStyleContext *styleIfVisited = mStyleContextHolder->GetStyleIfVisited(); if (styleIfVisited) { @@ -696,8 +695,8 @@ nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorRes if (prop != eCSSProperty_UNKNOWN && nsCSSProps::PropHasFlags(prop, CSS_PROPERTY_IS_ALIAS)) { const nsCSSProperty* subprops = nsCSSProps::SubpropertyEntryFor(prop); - NS_ABORT_IF_FALSE(subprops[1] == eCSSProperty_UNKNOWN, - "must have list of length 1"); + MOZ_ASSERT(subprops[1] == eCSSProperty_UNKNOWN, + "must have list of length 1"); prop = subprops[0]; } @@ -1061,8 +1060,8 @@ nsComputedDOMStyle::DoGetContent() nsStyleUtil::AppendEscapedCSSString( nsDependentString(a->Item(1).GetStringBufferValue()), str); } - NS_ABORT_IF_FALSE(eCSSUnit_None != a->Item(typeItem).GetUnit(), - "'none' should be handled as identifier value"); + MOZ_ASSERT(eCSSUnit_None != a->Item(typeItem).GetUnit(), + "'none' should be handled as identifier value"); nsString type; a->Item(typeItem).AppendToString(eCSSProperty_list_style_type, type, nsCSSValue::eNormalized); @@ -2064,8 +2063,8 @@ nsComputedDOMStyle::SetValueToPositionCoord(const PositionCoord& aCoord, nsROCSSPrimitiveValue* aValue) { if (!aCoord.mHasPercent) { - NS_ABORT_IF_FALSE(aCoord.mPercent == 0.0f, - "Shouldn't have mPercent!"); + MOZ_ASSERT(aCoord.mPercent == 0.0f, + "Shouldn't have mPercent!"); aValue->SetAppUnits(aCoord.mLength); } else if (aCoord.mLength == 0) { aValue->SetPercent(aCoord.mPercent); @@ -2165,8 +2164,8 @@ nsComputedDOMStyle::DoGetBackgroundSize() switch (size.mWidthType) { case nsStyleBackground::Size::eContain: case nsStyleBackground::Size::eCover: { - NS_ABORT_IF_FALSE(size.mWidthType == size.mHeightType, - "unsynced types"); + MOZ_ASSERT(size.mWidthType == size.mHeightType, + "unsynced types"); nsCSSKeyword keyword = size.mWidthType == nsStyleBackground::Size::eContain ? eCSSKeyword_contain : eCSSKeyword_cover; @@ -2187,14 +2186,14 @@ nsComputedDOMStyle::DoGetBackgroundSize() if (size.mWidthType == nsStyleBackground::Size::eAuto) { valX->SetIdent(eCSSKeyword_auto); } else { - NS_ABORT_IF_FALSE(size.mWidthType == - nsStyleBackground::Size::eLengthPercentage, - "bad mWidthType"); + MOZ_ASSERT(size.mWidthType == + nsStyleBackground::Size::eLengthPercentage, + "bad mWidthType"); if (!size.mWidth.mHasPercent && // negative values must have come from calc() size.mWidth.mLength >= 0) { - NS_ABORT_IF_FALSE(size.mWidth.mPercent == 0.0f, - "Shouldn't have mPercent"); + MOZ_ASSERT(size.mWidth.mPercent == 0.0f, + "Shouldn't have mPercent"); valX->SetAppUnits(size.mWidth.mLength); } else if (size.mWidth.mLength == 0 && // negative values must have come from calc() @@ -2208,14 +2207,14 @@ nsComputedDOMStyle::DoGetBackgroundSize() if (size.mHeightType == nsStyleBackground::Size::eAuto) { valY->SetIdent(eCSSKeyword_auto); } else { - NS_ABORT_IF_FALSE(size.mHeightType == - nsStyleBackground::Size::eLengthPercentage, - "bad mHeightType"); + MOZ_ASSERT(size.mHeightType == + nsStyleBackground::Size::eLengthPercentage, + "bad mHeightType"); if (!size.mHeight.mHasPercent && // negative values must have come from calc() size.mHeight.mLength >= 0) { - NS_ABORT_IF_FALSE(size.mHeight.mPercent == 0.0f, - "Shouldn't have mPercent"); + MOZ_ASSERT(size.mHeight.mPercent == 0.0f, + "Shouldn't have mPercent"); valY->SetAppUnits(size.mHeight.mLength); } else if (size.mHeight.mLength == 0 && // negative values must have come from calc() @@ -3701,8 +3700,8 @@ nsComputedDOMStyle::DoGetAlignSelf() } } - NS_ABORT_IF_FALSE(computedAlignSelf != NS_STYLE_ALIGN_SELF_AUTO, - "Should have swapped out 'auto' for something non-auto"); + MOZ_ASSERT(computedAlignSelf != NS_STYLE_ALIGN_SELF_AUTO, + "Should have swapped out 'auto' for something non-auto"); val->SetIdent( nsCSSProps::ValueToKeywordEnum(computedAlignSelf, nsCSSProps::kAlignSelfKTable)); @@ -4659,8 +4658,8 @@ nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue, if (!aCoord.CalcHasPercent()) { nscoord val = nsRuleNode::ComputeCoordPercentCalc(aCoord, 0); if (aClampNegativeCalc && val < 0) { - NS_ABORT_IF_FALSE(aCoord.IsCalcUnit(), - "parser should have rejected value"); + MOZ_ASSERT(aCoord.IsCalcUnit(), + "parser should have rejected value"); val = 0; } aValue->SetAppUnits(std::max(aMinAppUnits, std::min(val, aMaxAppUnits))); @@ -4669,8 +4668,8 @@ nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue, nscoord val = nsRuleNode::ComputeCoordPercentCalc(aCoord, percentageBase); if (aClampNegativeCalc && val < 0) { - NS_ABORT_IF_FALSE(aCoord.IsCalcUnit(), - "parser should have rejected value"); + MOZ_ASSERT(aCoord.IsCalcUnit(), + "parser should have rejected value"); val = 0; } aValue->SetAppUnits(std::max(aMinAppUnits, std::min(val, aMaxAppUnits))); @@ -4726,8 +4725,8 @@ nsComputedDOMStyle::StyleCoordToNSCoord(const nsStyleCoord& aCoord, nscoord result = nsRuleNode::ComputeCoordPercentCalc(aCoord, percentageBase); if (aClampNegativeCalc && result < 0) { - NS_ABORT_IF_FALSE(aCoord.IsCalcUnit(), - "parser should have rejected value"); + MOZ_ASSERT(aCoord.IsCalcUnit(), + "parser should have rejected value"); result = 0; } return result; @@ -5223,7 +5222,7 @@ void nsComputedDOMStyle::BoxValuesToString(nsAString& aString, const nsTArray& aBoxValues) { - NS_ABORT_IF_FALSE(aBoxValues.Length() == 4, "wrong number of box values"); + MOZ_ASSERT(aBoxValues.Length() == 4, "wrong number of box values"); nsAutoString value1, value2, value3, value4; SetCssTextToCoord(value1, aBoxValues[0]); SetCssTextToCoord(value2, aBoxValues[1]); @@ -5306,9 +5305,8 @@ nsComputedDOMStyle::CreatePrimitiveValueForClipPath( case nsStyleBasicShape::Type::eCircle: case nsStyleBasicShape::Type::eEllipse: { const nsTArray& radii = aStyleBasicShape->Coordinates(); - NS_ABORT_IF_FALSE(radii.Length() == - (nsStyleBasicShape::Type::eCircle ? 1 : 2), - "wrong number of radii"); + MOZ_ASSERT(radii.Length() == (nsStyleBasicShape::Type::eCircle ? 1 : 2), + "wrong number of radii"); for (size_t i = 0; i < radii.Length(); ++i) { nsAutoString radius; nsRefPtr value = new nsROCSSPrimitiveValue; @@ -5503,8 +5501,8 @@ nsComputedDOMStyle::DoGetTransitionDelay() nsDOMCSSValueList *valueList = GetROCSSValueList(true); - NS_ABORT_IF_FALSE(display->mTransitionDelayCount > 0, - "first item must be explicit"); + MOZ_ASSERT(display->mTransitionDelayCount > 0, + "first item must be explicit"); uint32_t i = 0; do { const StyleTransition *transition = &display->mTransitions[i]; @@ -5523,8 +5521,8 @@ nsComputedDOMStyle::DoGetTransitionDuration() nsDOMCSSValueList *valueList = GetROCSSValueList(true); - NS_ABORT_IF_FALSE(display->mTransitionDurationCount > 0, - "first item must be explicit"); + MOZ_ASSERT(display->mTransitionDurationCount > 0, + "first item must be explicit"); uint32_t i = 0; do { const StyleTransition *transition = &display->mTransitions[i]; @@ -5544,8 +5542,8 @@ nsComputedDOMStyle::DoGetTransitionProperty() nsDOMCSSValueList *valueList = GetROCSSValueList(true); - NS_ABORT_IF_FALSE(display->mTransitionPropertyCount > 0, - "first item must be explicit"); + MOZ_ASSERT(display->mTransitionPropertyCount > 0, + "first item must be explicit"); uint32_t i = 0; do { const StyleTransition *transition = &display->mTransitions[i]; @@ -5610,8 +5608,8 @@ nsComputedDOMStyle::DoGetTransitionTimingFunction() nsDOMCSSValueList *valueList = GetROCSSValueList(true); - NS_ABORT_IF_FALSE(display->mTransitionTimingFunctionCount > 0, - "first item must be explicit"); + MOZ_ASSERT(display->mTransitionTimingFunctionCount > 0, + "first item must be explicit"); uint32_t i = 0; do { AppendTimingFunction(valueList, @@ -5628,8 +5626,8 @@ nsComputedDOMStyle::DoGetAnimationName() nsDOMCSSValueList *valueList = GetROCSSValueList(true); - NS_ABORT_IF_FALSE(display->mAnimationNameCount > 0, - "first item must be explicit"); + MOZ_ASSERT(display->mAnimationNameCount > 0, + "first item must be explicit"); uint32_t i = 0; do { const StyleAnimation *animation = &display->mAnimations[i]; @@ -5656,8 +5654,8 @@ nsComputedDOMStyle::DoGetAnimationDelay() nsDOMCSSValueList *valueList = GetROCSSValueList(true); - NS_ABORT_IF_FALSE(display->mAnimationDelayCount > 0, - "first item must be explicit"); + MOZ_ASSERT(display->mAnimationDelayCount > 0, + "first item must be explicit"); uint32_t i = 0; do { const StyleAnimation *animation = &display->mAnimations[i]; @@ -5676,8 +5674,8 @@ nsComputedDOMStyle::DoGetAnimationDuration() nsDOMCSSValueList *valueList = GetROCSSValueList(true); - NS_ABORT_IF_FALSE(display->mAnimationDurationCount > 0, - "first item must be explicit"); + MOZ_ASSERT(display->mAnimationDurationCount > 0, + "first item must be explicit"); uint32_t i = 0; do { const StyleAnimation *animation = &display->mAnimations[i]; @@ -5697,8 +5695,8 @@ nsComputedDOMStyle::DoGetAnimationTimingFunction() nsDOMCSSValueList *valueList = GetROCSSValueList(true); - NS_ABORT_IF_FALSE(display->mAnimationTimingFunctionCount > 0, - "first item must be explicit"); + MOZ_ASSERT(display->mAnimationTimingFunctionCount > 0, + "first item must be explicit"); uint32_t i = 0; do { AppendTimingFunction(valueList, @@ -5715,8 +5713,8 @@ nsComputedDOMStyle::DoGetAnimationDirection() nsDOMCSSValueList *valueList = GetROCSSValueList(true); - NS_ABORT_IF_FALSE(display->mAnimationDirectionCount > 0, - "first item must be explicit"); + MOZ_ASSERT(display->mAnimationDirectionCount > 0, + "first item must be explicit"); uint32_t i = 0; do { const StyleAnimation *animation = &display->mAnimations[i]; @@ -5737,8 +5735,8 @@ nsComputedDOMStyle::DoGetAnimationFillMode() nsDOMCSSValueList *valueList = GetROCSSValueList(true); - NS_ABORT_IF_FALSE(display->mAnimationFillModeCount > 0, - "first item must be explicit"); + MOZ_ASSERT(display->mAnimationFillModeCount > 0, + "first item must be explicit"); uint32_t i = 0; do { const StyleAnimation *animation = &display->mAnimations[i]; @@ -5759,8 +5757,8 @@ nsComputedDOMStyle::DoGetAnimationIterationCount() nsDOMCSSValueList *valueList = GetROCSSValueList(true); - NS_ABORT_IF_FALSE(display->mAnimationIterationCountCount > 0, - "first item must be explicit"); + MOZ_ASSERT(display->mAnimationIterationCountCount > 0, + "first item must be explicit"); uint32_t i = 0; do { const StyleAnimation *animation = &display->mAnimations[i]; @@ -5793,8 +5791,8 @@ nsComputedDOMStyle::DoGetAnimationPlayState() nsDOMCSSValueList *valueList = GetROCSSValueList(true); - NS_ABORT_IF_FALSE(display->mAnimationPlayStateCount > 0, - "first item must be explicit"); + MOZ_ASSERT(display->mAnimationPlayStateCount > 0, + "first item must be explicit"); uint32_t i = 0; do { const StyleAnimation *animation = &display->mAnimations[i]; diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp index 63d597cd270..30cbbb28b88 100644 --- a/layout/style/nsMediaFeatures.cpp +++ b/layout/style/nsMediaFeatures.cpp @@ -307,8 +307,8 @@ static nsresult GetSystemMetric(nsPresContext* aPresContext, const nsMediaFeature* aFeature, nsCSSValue& aResult) { - NS_ABORT_IF_FALSE(aFeature->mValueType == nsMediaFeature::eBoolInteger, - "unexpected type"); + MOZ_ASSERT(aFeature->mValueType == nsMediaFeature::eBoolInteger, + "unexpected type"); nsIAtom *metricAtom = *aFeature->mData.mMetric; bool hasMetric = nsCSSRuleProcessor::HasSystemMetric(metricAtom); aResult.SetIntValue(hasMetric ? 1 : 0, eCSSUnit_Integer); diff --git a/layout/style/nsRuleData.cpp b/layout/style/nsRuleData.cpp index dac610a17de..7c8c419abc1 100644 --- a/layout/style/nsRuleData.cpp +++ b/layout/style/nsRuleData.cpp @@ -48,9 +48,8 @@ nsRuleData::~nsRuleData() // assert nothing in mSIDs has poison value size_t framePoisonOffset = GetPoisonOffset(); for (size_t i = 0; i < nsStyleStructID_Length; ++i) { - NS_ABORT_IF_FALSE(!(mSIDs & (1 << i)) || - mValueOffsets[i] != framePoisonOffset, - "value in SIDs was left with poison offset"); + MOZ_ASSERT(!(mSIDs & (1 << i)) || mValueOffsets[i] != framePoisonOffset, + "value in SIDs was left with poison offset"); } #endif } diff --git a/layout/style/nsRuleData.h b/layout/style/nsRuleData.h index 7b9d7ec0ac3..1b1a7bbb160 100644 --- a/layout/style/nsRuleData.h +++ b/layout/style/nsRuleData.h @@ -65,19 +65,18 @@ struct nsRuleData */ nsCSSValue* ValueFor(nsCSSProperty aProperty) { - NS_ABORT_IF_FALSE(aProperty < eCSSProperty_COUNT_no_shorthands, - "invalid or shorthand property"); + MOZ_ASSERT(aProperty < eCSSProperty_COUNT_no_shorthands, + "invalid or shorthand property"); nsStyleStructID sid = nsCSSProps::kSIDTable[aProperty]; size_t indexInStruct = nsCSSProps::PropertyIndexInStruct(aProperty); // This should really be nsCachedStyleData::GetBitForSID, but we can't // include that here since it includes us. - NS_ABORT_IF_FALSE(mSIDs & (1 << sid), - "calling nsRuleData::ValueFor on property not in mSIDs"); - NS_ABORT_IF_FALSE(sid != eStyleStruct_BackendOnly && - indexInStruct != size_t(-1), - "backend-only or logical property"); + MOZ_ASSERT(mSIDs & (1 << sid), + "calling nsRuleData::ValueFor on property not in mSIDs"); + MOZ_ASSERT(sid != eStyleStruct_BackendOnly && indexInStruct != size_t(-1), + "backend-only or logical property"); return mValueStorage + mValueOffsets[sid] + indexInStruct; } @@ -99,15 +98,15 @@ struct nsRuleData #define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, \ kwtable_, stylestruct_, stylestructoffset_, animtype_) \ nsCSSValue* ValueFor##method_() { \ - NS_ABORT_IF_FALSE(mSIDs & NS_STYLE_INHERIT_BIT(stylestruct_), \ - "Calling nsRuleData::ValueFor" #method_ " without " \ - "NS_STYLE_INHERIT_BIT(" #stylestruct_ " in mSIDs."); \ + MOZ_ASSERT(mSIDs & NS_STYLE_INHERIT_BIT(stylestruct_), \ + "Calling nsRuleData::ValueFor" #method_ " without " \ + "NS_STYLE_INHERIT_BIT(" #stylestruct_ " in mSIDs."); \ nsStyleStructID sid = eStyleStruct_##stylestruct_; \ size_t indexInStruct = \ nsCSSProps::PropertyIndexInStruct(eCSSProperty_##id_); \ - NS_ABORT_IF_FALSE(sid != eStyleStruct_BackendOnly && \ - indexInStruct != size_t(-1), \ - "backend-only property"); \ + MOZ_ASSERT(sid != eStyleStruct_BackendOnly && \ + indexInStruct != size_t(-1), \ + "backend-only property"); \ return mValueStorage + mValueOffsets[sid] + indexInStruct; \ } \ const nsCSSValue* ValueFor##method_() const { \ diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 78c7c6150e9..104348023dd 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -594,9 +594,8 @@ struct LengthPercentPairCalcOps : public css::NumbersAlreadyNormalizedOps aValue2.mLength), aValue1.mPercent + aValue2.mPercent); } - NS_ABORT_IF_FALSE(aCalcFunction == eCSSUnit_Calc_Minus, - "min() and max() are not allowed in calc() on " - "transform"); + MOZ_ASSERT(aCalcFunction == eCSSUnit_Calc_Minus, + "min() and max() are not allowed in calc() on transform"); return result_type(NSCoordSaturatingSubtract(aValue1.mLength, aValue2.mLength, 0), aValue1.mPercent - aValue2.mPercent); @@ -606,8 +605,8 @@ struct LengthPercentPairCalcOps : public css::NumbersAlreadyNormalizedOps MergeMultiplicativeL(nsCSSUnit aCalcFunction, float aValue1, result_type aValue2) { - NS_ABORT_IF_FALSE(aCalcFunction == eCSSUnit_Calc_Times_L, - "unexpected unit"); + MOZ_ASSERT(aCalcFunction == eCSSUnit_Calc_Times_L, + "unexpected unit"); return result_type(NSCoordSaturatingMultiply(aValue2.mLength, aValue1), aValue1 * aValue2.mPercent); } @@ -616,9 +615,9 @@ struct LengthPercentPairCalcOps : public css::NumbersAlreadyNormalizedOps MergeMultiplicativeR(nsCSSUnit aCalcFunction, result_type aValue1, float aValue2) { - NS_ABORT_IF_FALSE(aCalcFunction == eCSSUnit_Calc_Times_R || - aCalcFunction == eCSSUnit_Calc_Divided, - "unexpected unit"); + MOZ_ASSERT(aCalcFunction == eCSSUnit_Calc_Times_R || + aCalcFunction == eCSSUnit_Calc_Divided, + "unexpected unit"); if (aCalcFunction == eCSSUnit_Calc_Divided) { aValue2 = 1.0f / aValue2; } @@ -680,7 +679,7 @@ nsRuleNode::ComputeCoordPercentCalc(const nsStyleCoord& aCoord, case eStyleUnit_Calc: return ComputeComputedCalc(aCoord, aPercentageBasis); default: - NS_ABORT_IF_FALSE(false, "unexpected unit"); + MOZ_ASSERT(false, "unexpected unit"); return 0; } } @@ -876,10 +875,10 @@ static inline bool SetAbsCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord, int32_t aMask) { - NS_ABORT_IF_FALSE((aMask & (SETCOORD_LH | SETCOORD_UNSET_INHERIT | - SETCOORD_UNSET_INITIAL)) == 0, - "does not handle SETCOORD_LENGTH, SETCOORD_INHERIT and " - "SETCOORD_UNSET_*"); + MOZ_ASSERT((aMask & (SETCOORD_LH | SETCOORD_UNSET_INHERIT | + SETCOORD_UNSET_INITIAL)) == 0, + "does not handle SETCOORD_LENGTH, SETCOORD_INHERIT and " + "SETCOORD_UNSET_*"); // The values of the following variables will never be used; so it does not // matter what to set. @@ -891,8 +890,8 @@ static inline bool SetAbsCoord(const nsCSSValue& aValue, bool rv = SetCoord(aValue, aCoord, dummyParentCoord, aMask, dummyStyleContext, dummyPresContext, dummyCanStoreInRuleTree); - NS_ABORT_IF_FALSE(dummyCanStoreInRuleTree, - "SetCoord() should not modify dummyCanStoreInRuleTree."); + MOZ_ASSERT(dummyCanStoreInRuleTree, + "SetCoord() should not modify dummyCanStoreInRuleTree."); return rv; } @@ -916,7 +915,7 @@ SetPairCoords(const nsCSSValue& aValue, aPresContext, aCanStoreInRuleTree); mozilla::DebugOnly cY = SetCoord(valY, aCoordY, aParentY, aMask, aStyleContext, aPresContext, aCanStoreInRuleTree); - NS_ABORT_IF_FALSE(cX == cY, "changed one but not the other"); + MOZ_ASSERT(cX == cY, "changed one but not the other"); return cX; } @@ -1033,8 +1032,8 @@ static void SetGradient(const nsCSSValue& aValue, nsPresContext* aPresContext, nsStyleContext* aContext, nsStyleGradient& aResult, bool& aCanStoreInRuleTree) { - NS_ABORT_IF_FALSE(aValue.GetUnit() == eCSSUnit_Gradient, - "The given data is not a gradient"); + MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Gradient, + "The given data is not a gradient"); const nsCSSValueGradient* gradient = aValue.GetGradientValue(); @@ -1131,12 +1130,12 @@ static void SetStyleImageToImageRect(nsStyleContext* aStyleContext, const nsCSSValue& aValue, nsStyleImage& aResult) { - NS_ABORT_IF_FALSE(aValue.GetUnit() == eCSSUnit_Function && - aValue.EqualsFunction(eCSSKeyword__moz_image_rect), - "the value is not valid -moz-image-rect()"); + MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Function && + aValue.EqualsFunction(eCSSKeyword__moz_image_rect), + "the value is not valid -moz-image-rect()"); nsCSSValue::Array* arr = aValue.GetArrayValue(); - NS_ABORT_IF_FALSE(arr && arr->Count() == 6, "invalid number of arguments"); + MOZ_ASSERT(arr && arr->Count() == 6, "invalid number of arguments"); // if (arr->Item(1).GetUnit() == eCSSUnit_Image) { @@ -1157,7 +1156,7 @@ static void SetStyleImageToImageRect(nsStyleContext* aStyleContext, bool unitOk = #endif SetAbsCoord(val, coord, SETCOORD_FACTOR | SETCOORD_PERCENT); - NS_ABORT_IF_FALSE(unitOk, "Incorrect data structure created by CSS parser"); + MOZ_ASSERT(unitOk, "Incorrect data structure created by CSS parser"); cropRect.Set(side, coord); } aResult.SetCropRect(&cropRect); @@ -1475,8 +1474,8 @@ nsRuleNode::nsRuleNode(nsPresContext* aContext, nsRuleNode* aParent, mRefCnt(0) { MOZ_ASSERT(aContext); - NS_ABORT_IF_FALSE(IsRoot() == !aRule, - "non-root rule nodes must have a rule"); + MOZ_ASSERT(IsRoot() == !aRule, + "non-root rule nodes must have a rule"); mChildren.asVoid = nullptr; MOZ_COUNT_CTOR(nsRuleNode); @@ -1497,10 +1496,10 @@ nsRuleNode::nsRuleNode(nsPresContext* aContext, nsRuleNode* aParent, // nsStyleSet::GetContext depends on there being only one animation // rule. - NS_ABORT_IF_FALSE(IsRoot() || GetLevel() != nsStyleSet::eAnimationSheet || - mParent->IsRoot() || - mParent->GetLevel() != nsStyleSet::eAnimationSheet, - "must be only one rule at animation level"); + MOZ_ASSERT(IsRoot() || GetLevel() != nsStyleSet::eAnimationSheet || + mParent->IsRoot() || + mParent->GetLevel() != nsStyleSet::eAnimationSheet, + "must be only one rule at animation level"); } nsRuleNode::~nsRuleNode() @@ -2010,8 +2009,8 @@ nsRuleNode::CheckSpecifiedProperties(const nsStyleStructID aSID, unset = 0; // number that were 'unset' // See comment in nsRuleData.h above mValueOffsets. - NS_ABORT_IF_FALSE(aRuleData->mValueOffsets[aSID] == 0, - "we assume the value offset is zero instead of adding it"); + MOZ_ASSERT(aRuleData->mValueOffsets[aSID] == 0, + "we assume the value offset is zero instead of adding it"); for (nsCSSValue *values = aRuleData->mValueStorage, *values_end = values + nsCSSProps::PropertyCountInStruct(aSID); values != values_end; ++values) { @@ -2105,8 +2104,8 @@ UnsetPropertiesWithoutFlags(const nsStyleStructID aSID, const uint32_t *flagData = gFlagsByStruct[aSID]; // See comment in nsRuleData.h above mValueOffsets. - NS_ABORT_IF_FALSE(aRuleData->mValueOffsets[aSID] == 0, - "we assume the value offset is zero instead of adding it"); + MOZ_ASSERT(aRuleData->mValueOffsets[aSID] == 0, + "we assume the value offset is zero instead of adding it"); nsCSSValue *values = aRuleData->mValueStorage; for (size_t i = 0, i_end = nsCSSProps::PropertyCountInStruct(aSID); @@ -2131,8 +2130,8 @@ struct AutoCSSValueArray { * aStorage must be the result of alloca(aCount * sizeof(nsCSSValue)) */ AutoCSSValueArray(void* aStorage, size_t aCount) { - NS_ABORT_IF_FALSE(size_t(aStorage) % NS_ALIGNMENT_OF(nsCSSValue) == 0, - "bad alignment from alloca"); + MOZ_ASSERT(size_t(aStorage) % NS_ALIGNMENT_OF(nsCSSValue) == 0, + "bad alignment from alloca"); mCount = aCount; // Don't use placement new[], since it might store extra data // for the count (on Windows!). @@ -2562,7 +2561,7 @@ nsRuleNode::SetDefaultOnRoot(const nsStyleStructID aSID, nsStyleContext* aContex * unhandled case: nsStyleStructID_Length. * last item of nsStyleStructID, to know its length. */ - NS_ABORT_IF_FALSE(false, "unexpected SID"); + MOZ_ASSERT(false, "unexpected SID"); return nullptr; } return nullptr; @@ -3109,7 +3108,7 @@ struct SetFontSizeCalcOps : public css::BasicCoordCalcOps, // aValue.GetPercentValue() may be negative for, e.g., calc(-50%) size = NSCoordSaturatingMultiply(mParentSize, aValue.GetPercentValue()); } else { - NS_ABORT_IF_FALSE(false, "unexpected value"); + MOZ_ASSERT(false, "unexpected value"); size = mParentSize; } @@ -3189,9 +3188,8 @@ nsRuleNode::SetFontSize(nsPresContext* aPresContext, aCanStoreInRuleTree); *aSize = css::ComputeCalc(*sizeValue, ops); if (*aSize < 0) { - NS_ABORT_IF_FALSE(sizeValue->IsCalcUnit(), - "negative lengths and percents should be rejected " - "by parser"); + MOZ_ASSERT(sizeValue->IsCalcUnit(), + "negative lengths and percents should be rejected by parser"); *aSize = 0; } // The calc ops will always zoom its result according to the value @@ -3702,7 +3700,7 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext, break; default: - NS_ABORT_IF_FALSE(false, "unexpected value unit"); + MOZ_ASSERT(false, "unexpected value unit"); break; } @@ -3786,8 +3784,8 @@ nsRuleNode::ComputeFontFeatures(const nsCSSValuePairList *aFeaturesList, for (const nsCSSValuePairList* p = aFeaturesList; p; p = p->mNext) { gfxFontFeature feat = {0, 0}; - NS_ABORT_IF_FALSE(aFeaturesList->mXValue.GetUnit() == eCSSUnit_String, - "unexpected value unit"); + MOZ_ASSERT(aFeaturesList->mXValue.GetUnit() == eCSSUnit_String, + "unexpected value unit"); // tag is a 4-byte ASCII sequence nsAutoString tag; @@ -4036,8 +4034,8 @@ nsRuleNode::GetShadowData(const nsCSSValueList* aList, { uint32_t arrayLength = ListLength(aList); - NS_ABORT_IF_FALSE(arrayLength > 0, - "Non-null text-shadow list, yet we counted 0 items."); + MOZ_ASSERT(arrayLength > 0, + "Non-null text-shadow list, yet we counted 0 items."); nsRefPtr shadowList = new(arrayLength) nsCSSShadowArray(arrayLength); @@ -4049,8 +4047,8 @@ nsRuleNode::GetShadowData(const nsCSSValueList* aList, for (nsCSSShadowItem* item = shadowList->ShadowAt(0); aList; aList = aList->mNext, ++item) { - NS_ABORT_IF_FALSE(aList->mValue.GetUnit() == eCSSUnit_Array, - "expecting a plain array value"); + MOZ_ASSERT(aList->mValue.GetUnit() == eCSSUnit_Array, + "expecting a plain array value"); nsCSSValue::Array *arr = aList->mValue.GetArrayValue(); // OK to pass bad aParentCoord since we're not passing SETCOORD_INHERIT unitOK = SetCoord(arr->Item(0), tempCoord, nsStyleCoord(), @@ -4417,10 +4415,10 @@ nsRuleNode::ComputeTextResetData(void* aStartStruct, else if (eCSSUnit_Initial == decorationColorValue->GetUnit() || eCSSUnit_Unset == decorationColorValue->GetUnit() || eCSSUnit_Enumerated == decorationColorValue->GetUnit()) { - NS_ABORT_IF_FALSE(eCSSUnit_Enumerated != decorationColorValue->GetUnit() || - decorationColorValue->GetIntValue() == - NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR, - "unexpected enumerated value"); + MOZ_ASSERT(eCSSUnit_Enumerated != decorationColorValue->GetUnit() || + decorationColorValue->GetIntValue() == + NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR, + "unexpected enumerated value"); text->SetDecorationColorToForeground(); } @@ -4876,10 +4874,10 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, // FIXME (Bug 522599) (for all transition properties): write a test that // detects when this was wrong for i >= delay.num if parent had // count for this property not equal to length - NS_ABORT_IF_FALSE(i < parentDisplay->mTransitionDelayCount, - "delay.num computed incorrectly"); - NS_ABORT_IF_FALSE(!canStoreInRuleTree, - "should have made canStoreInRuleTree false above"); + MOZ_ASSERT(i < parentDisplay->mTransitionDelayCount, + "delay.num computed incorrectly"); + MOZ_ASSERT(!canStoreInRuleTree, + "should have made canStoreInRuleTree false above"); transition->SetDelay(parentDisplay->mTransitions[i].GetDelay()); } else if (delay.unit == eCSSUnit_Initial || delay.unit == eCSSUnit_Unset) { @@ -4902,10 +4900,10 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, transition->SetDuration( display->mTransitions[i % duration.num].GetDuration()); } else if (duration.unit == eCSSUnit_Inherit) { - NS_ABORT_IF_FALSE(i < parentDisplay->mTransitionDurationCount, - "duration.num computed incorrectly"); - NS_ABORT_IF_FALSE(!canStoreInRuleTree, - "should have made canStoreInRuleTree false above"); + MOZ_ASSERT(i < parentDisplay->mTransitionDurationCount, + "duration.num computed incorrectly"); + MOZ_ASSERT(!canStoreInRuleTree, + "should have made canStoreInRuleTree false above"); transition->SetDuration(parentDisplay->mTransitions[i].GetDuration()); } else if (duration.unit == eCSSUnit_Initial || duration.unit == eCSSUnit_Unset) { @@ -4927,10 +4925,10 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, if (i >= property.num) { transition->CopyPropertyFrom(display->mTransitions[i % property.num]); } else if (property.unit == eCSSUnit_Inherit) { - NS_ABORT_IF_FALSE(i < parentDisplay->mTransitionPropertyCount, - "property.num computed incorrectly"); - NS_ABORT_IF_FALSE(!canStoreInRuleTree, - "should have made canStoreInRuleTree false above"); + MOZ_ASSERT(i < parentDisplay->mTransitionPropertyCount, + "property.num computed incorrectly"); + MOZ_ASSERT(!canStoreInRuleTree, + "should have made canStoreInRuleTree false above"); transition->CopyPropertyFrom(parentDisplay->mTransitions[i]); } else if (property.unit == eCSSUnit_Initial || property.unit == eCSSUnit_Unset) { @@ -4963,10 +4961,10 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, transition->SetTimingFunction( display->mTransitions[i % timingFunction.num].GetTimingFunction()); } else if (timingFunction.unit == eCSSUnit_Inherit) { - NS_ABORT_IF_FALSE(i < parentDisplay->mTransitionTimingFunctionCount, - "timingFunction.num computed incorrectly"); - NS_ABORT_IF_FALSE(!canStoreInRuleTree, - "should have made canStoreInRuleTree false above"); + MOZ_ASSERT(i < parentDisplay->mTransitionTimingFunctionCount, + "timingFunction.num computed incorrectly"); + MOZ_ASSERT(!canStoreInRuleTree, + "should have made canStoreInRuleTree false above"); transition->SetTimingFunction( parentDisplay->mTransitions[i].GetTimingFunction()); } else if (timingFunction.unit == eCSSUnit_Initial || @@ -5033,10 +5031,10 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, // FIXME (Bug 522599) (for all animation properties): write a test that // detects when this was wrong for i >= animDelay.num if parent had // count for this property not equal to length - NS_ABORT_IF_FALSE(i < parentDisplay->mAnimationDelayCount, - "animDelay.num computed incorrectly"); - NS_ABORT_IF_FALSE(!canStoreInRuleTree, - "should have made canStoreInRuleTree false above"); + MOZ_ASSERT(i < parentDisplay->mAnimationDelayCount, + "animDelay.num computed incorrectly"); + MOZ_ASSERT(!canStoreInRuleTree, + "should have made canStoreInRuleTree false above"); animation->SetDelay(parentDisplay->mAnimations[i].GetDelay()); } else if (animDelay.unit == eCSSUnit_Initial || animDelay.unit == eCSSUnit_Unset) { @@ -5059,10 +5057,10 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, animation->SetDuration( display->mAnimations[i % animDuration.num].GetDuration()); } else if (animDuration.unit == eCSSUnit_Inherit) { - NS_ABORT_IF_FALSE(i < parentDisplay->mAnimationDurationCount, - "animDuration.num computed incorrectly"); - NS_ABORT_IF_FALSE(!canStoreInRuleTree, - "should have made canStoreInRuleTree false above"); + MOZ_ASSERT(i < parentDisplay->mAnimationDurationCount, + "animDuration.num computed incorrectly"); + MOZ_ASSERT(!canStoreInRuleTree, + "should have made canStoreInRuleTree false above"); animation->SetDuration(parentDisplay->mAnimations[i].GetDuration()); } else if (animDuration.unit == eCSSUnit_Initial || animDuration.unit == eCSSUnit_Unset) { @@ -5084,10 +5082,10 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, if (i >= animName.num) { animation->SetName(display->mAnimations[i % animName.num].GetName()); } else if (animName.unit == eCSSUnit_Inherit) { - NS_ABORT_IF_FALSE(i < parentDisplay->mAnimationNameCount, - "animName.num computed incorrectly"); - NS_ABORT_IF_FALSE(!canStoreInRuleTree, - "should have made canStoreInRuleTree false above"); + MOZ_ASSERT(i < parentDisplay->mAnimationNameCount, + "animName.num computed incorrectly"); + MOZ_ASSERT(!canStoreInRuleTree, + "should have made canStoreInRuleTree false above"); animation->SetName(parentDisplay->mAnimations[i].GetName()); } else if (animName.unit == eCSSUnit_Initial || animName.unit == eCSSUnit_Unset) { @@ -5106,8 +5104,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, } default: NS_ABORT_IF_FALSE(false, - nsPrintfCString("Invalid animation-name unit %d", - animName.list->mValue.GetUnit()).get()); + nsPrintfCString("Invalid animation-name unit %d", + animName.list->mValue.GetUnit()).get()); } } @@ -5115,10 +5113,10 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, animation->SetTimingFunction( display->mAnimations[i % animTimingFunction.num].GetTimingFunction()); } else if (animTimingFunction.unit == eCSSUnit_Inherit) { - NS_ABORT_IF_FALSE(i < parentDisplay->mAnimationTimingFunctionCount, - "animTimingFunction.num computed incorrectly"); - NS_ABORT_IF_FALSE(!canStoreInRuleTree, - "should have made canStoreInRuleTree false above"); + MOZ_ASSERT(i < parentDisplay->mAnimationTimingFunctionCount, + "animTimingFunction.num computed incorrectly"); + MOZ_ASSERT(!canStoreInRuleTree, + "should have made canStoreInRuleTree false above"); animation->SetTimingFunction( parentDisplay->mAnimations[i].GetTimingFunction()); } else if (animTimingFunction.unit == eCSSUnit_Initial || @@ -5133,16 +5131,17 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, if (i >= animDirection.num) { animation->SetDirection(display->mAnimations[i % animDirection.num].GetDirection()); } else if (animDirection.unit == eCSSUnit_Inherit) { - NS_ABORT_IF_FALSE(i < parentDisplay->mAnimationDirectionCount, - "animDirection.num computed incorrectly"); - NS_ABORT_IF_FALSE(!canStoreInRuleTree, - "should have made canStoreInRuleTree false above"); + MOZ_ASSERT(i < parentDisplay->mAnimationDirectionCount, + "animDirection.num computed incorrectly"); + MOZ_ASSERT(!canStoreInRuleTree, + "should have made canStoreInRuleTree false above"); animation->SetDirection(parentDisplay->mAnimations[i].GetDirection()); } else if (animDirection.unit == eCSSUnit_Initial || animDirection.unit == eCSSUnit_Unset) { animation->SetDirection(NS_STYLE_ANIMATION_DIRECTION_NORMAL); } else if (animDirection.list) { - NS_ABORT_IF_FALSE(animDirection.list->mValue.GetUnit() == eCSSUnit_Enumerated, + NS_ABORT_IF_FALSE(animDirection.list->mValue.GetUnit() == + eCSSUnit_Enumerated, nsPrintfCString("Invalid animation-direction unit %d", animDirection.list->mValue.GetUnit()).get()); @@ -5152,16 +5151,17 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, if (i >= animFillMode.num) { animation->SetFillMode(display->mAnimations[i % animFillMode.num].GetFillMode()); } else if (animFillMode.unit == eCSSUnit_Inherit) { - NS_ABORT_IF_FALSE(i < parentDisplay->mAnimationFillModeCount, - "animFillMode.num computed incorrectly"); - NS_ABORT_IF_FALSE(!canStoreInRuleTree, - "should have made canStoreInRuleTree false above"); + MOZ_ASSERT(i < parentDisplay->mAnimationFillModeCount, + "animFillMode.num computed incorrectly"); + MOZ_ASSERT(!canStoreInRuleTree, + "should have made canStoreInRuleTree false above"); animation->SetFillMode(parentDisplay->mAnimations[i].GetFillMode()); } else if (animFillMode.unit == eCSSUnit_Initial || animFillMode.unit == eCSSUnit_Unset) { animation->SetFillMode(NS_STYLE_ANIMATION_FILL_MODE_NONE); } else if (animFillMode.list) { - NS_ABORT_IF_FALSE(animFillMode.list->mValue.GetUnit() == eCSSUnit_Enumerated, + NS_ABORT_IF_FALSE(animFillMode.list->mValue.GetUnit() == + eCSSUnit_Enumerated, nsPrintfCString("Invalid animation-fill-mode unit %d", animFillMode.list->mValue.GetUnit()).get()); @@ -5171,16 +5171,17 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, if (i >= animPlayState.num) { animation->SetPlayState(display->mAnimations[i % animPlayState.num].GetPlayState()); } else if (animPlayState.unit == eCSSUnit_Inherit) { - NS_ABORT_IF_FALSE(i < parentDisplay->mAnimationPlayStateCount, - "animPlayState.num computed incorrectly"); - NS_ABORT_IF_FALSE(!canStoreInRuleTree, - "should have made canStoreInRuleTree false above"); + MOZ_ASSERT(i < parentDisplay->mAnimationPlayStateCount, + "animPlayState.num computed incorrectly"); + MOZ_ASSERT(!canStoreInRuleTree, + "should have made canStoreInRuleTree false above"); animation->SetPlayState(parentDisplay->mAnimations[i].GetPlayState()); } else if (animPlayState.unit == eCSSUnit_Initial || animPlayState.unit == eCSSUnit_Unset) { animation->SetPlayState(NS_STYLE_ANIMATION_PLAY_STATE_RUNNING); } else if (animPlayState.list) { - NS_ABORT_IF_FALSE(animPlayState.list->mValue.GetUnit() == eCSSUnit_Enumerated, + NS_ABORT_IF_FALSE(animPlayState.list->mValue.GetUnit() == + eCSSUnit_Enumerated, nsPrintfCString("Invalid animation-play-state unit %d", animPlayState.list->mValue.GetUnit()).get()); @@ -5190,10 +5191,10 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, if (i >= animIterationCount.num) { animation->SetIterationCount(display->mAnimations[i % animIterationCount.num].GetIterationCount()); } else if (animIterationCount.unit == eCSSUnit_Inherit) { - NS_ABORT_IF_FALSE(i < parentDisplay->mAnimationIterationCountCount, - "animIterationCount.num computed incorrectly"); - NS_ABORT_IF_FALSE(!canStoreInRuleTree, - "should have made canStoreInRuleTree false above"); + MOZ_ASSERT(i < parentDisplay->mAnimationIterationCountCount, + "animIterationCount.num computed incorrectly"); + MOZ_ASSERT(!canStoreInRuleTree, + "should have made canStoreInRuleTree false above"); animation->SetIterationCount(parentDisplay->mAnimations[i].GetIterationCount()); } else if (animIterationCount.unit == eCSSUnit_Initial || animIterationCount.unit == eCSSUnit_Unset) { @@ -5201,9 +5202,9 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, } else if (animIterationCount.list) { switch (animIterationCount.list->mValue.GetUnit()) { case eCSSUnit_Enumerated: - NS_ABORT_IF_FALSE(animIterationCount.list->mValue.GetIntValue() == - NS_STYLE_ANIMATION_ITERATION_COUNT_INFINITE, - "unexpected value"); + MOZ_ASSERT(animIterationCount.list->mValue.GetIntValue() == + NS_STYLE_ANIMATION_ITERATION_COUNT_INFINITE, + "unexpected value"); animation->SetIterationCount(NS_IEEEPositiveInfinity()); break; case eCSSUnit_Number: @@ -5211,8 +5212,8 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, animIterationCount.list->mValue.GetFloatValue()); break; default: - NS_ABORT_IF_FALSE(false, - "unexpected animation-iteration-count unit"); + MOZ_ASSERT(false, + "unexpected animation-iteration-count unit"); } } @@ -5492,7 +5493,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, } default: - NS_ABORT_IF_FALSE(false, "unrecognized clip unit"); + MOZ_ASSERT(false, "unrecognized clip unit"); } if (display->mDisplay != NS_STYLE_DISPLAY_NONE) { @@ -5576,7 +5577,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, MOZ_ASSERT(head, "transform list must have at least one item"); // can get a _None in here from transform animation if (head->mValue.GetUnit() == eCSSUnit_None) { - NS_ABORT_IF_FALSE(head->mNext == nullptr, "none must be alone"); + MOZ_ASSERT(head->mNext == nullptr, "none must be alone"); display->mSpecifiedTransform = nullptr; } else { display->mSpecifiedTransform = list; @@ -5585,7 +5586,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, } default: - NS_ABORT_IF_FALSE(false, "unrecognized transform unit"); + MOZ_ASSERT(false, "unrecognized transform unit"); } /* Convert the nsCSSValueList into a will-change bitfield for fast lookup */ @@ -5689,9 +5690,9 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct, SETCOORD_LH | SETCOORD_INITIAL_ZERO | SETCOORD_STORE_CALC | SETCOORD_UNSET_INITIAL, aContext, mPresContext, canStoreInRuleTree); - NS_ABORT_IF_FALSE(cY == cZ, "changed one but not the other"); + MOZ_ASSERT(cY == cZ, "changed one but not the other"); } - NS_ABORT_IF_FALSE(cX == cY, "changed one but not the other"); + MOZ_ASSERT(cX == cY, "changed one but not the other"); NS_ASSERTION(cX, "Malformed -moz-transform-origin parse!"); } @@ -6088,27 +6089,27 @@ struct BackgroundItemComputer nsStyleBackground::Size::eCover == NS_STYLE_BG_SIZE_COVER, "background size constants out of sync"); - NS_ABORT_IF_FALSE(specified.GetIntValue() == NS_STYLE_BG_SIZE_CONTAIN || - specified.GetIntValue() == NS_STYLE_BG_SIZE_COVER, - "invalid enumerated value for size coordinate"); + MOZ_ASSERT(specified.GetIntValue() == NS_STYLE_BG_SIZE_CONTAIN || + specified.GetIntValue() == NS_STYLE_BG_SIZE_COVER, + "invalid enumerated value for size coordinate"); size.*(axis->type) = specified.GetIntValue(); } else if (eCSSUnit_Null == specified.GetUnit()) { - NS_ABORT_IF_FALSE(axis == gBGSizeAxes + 1, - "null allowed only as height value, and only " - "for contain/cover/initial/inherit"); + MOZ_ASSERT(axis == gBGSizeAxes + 1, + "null allowed only as height value, and only " + "for contain/cover/initial/inherit"); #ifdef DEBUG { const nsCSSValue &widthValue = aSpecifiedValue->mXValue; - NS_ABORT_IF_FALSE(widthValue.GetUnit() != eCSSUnit_Inherit && - widthValue.GetUnit() != eCSSUnit_Initial && - widthValue.GetUnit() != eCSSUnit_Unset, - "initial/inherit/unset should already have been handled"); - NS_ABORT_IF_FALSE(widthValue.GetUnit() == eCSSUnit_Enumerated && - (widthValue.GetIntValue() == NS_STYLE_BG_SIZE_CONTAIN || - widthValue.GetIntValue() == NS_STYLE_BG_SIZE_COVER), - "null height value not corresponding to allowable " - "non-null width value"); + MOZ_ASSERT(widthValue.GetUnit() != eCSSUnit_Inherit && + widthValue.GetUnit() != eCSSUnit_Initial && + widthValue.GetUnit() != eCSSUnit_Unset, + "initial/inherit/unset should already have been handled"); + MOZ_ASSERT(widthValue.GetUnit() == eCSSUnit_Enumerated && + (widthValue.GetIntValue() == NS_STYLE_BG_SIZE_CONTAIN || + widthValue.GetIntValue() == NS_STYLE_BG_SIZE_COVER), + "null height value not corresponding to allowable " + "non-null width value"); } #endif size.*(axis->type) = size.mWidthType; @@ -6127,7 +6128,7 @@ struct BackgroundItemComputer (size.*(axis->result)).mHasPercent = false; size.*(axis->type) = nsStyleBackground::Size::eLengthPercentage; } else { - NS_ABORT_IF_FALSE(specified.IsCalcUnit(), "unexpected unit"); + MOZ_ASSERT(specified.IsCalcUnit(), "unexpected unit"); LengthPercentPairCalcOps ops(aStyleContext, aStyleContext->PresContext(), aCanStoreInRuleTree); @@ -6139,14 +6140,14 @@ struct BackgroundItemComputer } } - NS_ABORT_IF_FALSE(size.mWidthType < nsStyleBackground::Size::eDimensionType_COUNT, - "bad width type"); - NS_ABORT_IF_FALSE(size.mHeightType < nsStyleBackground::Size::eDimensionType_COUNT, - "bad height type"); - NS_ABORT_IF_FALSE((size.mWidthType != nsStyleBackground::Size::eContain && - size.mWidthType != nsStyleBackground::Size::eCover) || - size.mWidthType == size.mHeightType, - "contain/cover apply to both dimensions or to neither"); + MOZ_ASSERT(size.mWidthType < nsStyleBackground::Size::eDimensionType_COUNT, + "bad width type"); + MOZ_ASSERT(size.mHeightType < nsStyleBackground::Size::eDimensionType_COUNT, + "bad height type"); + MOZ_ASSERT((size.mWidthType != nsStyleBackground::Size::eContain && + size.mWidthType != nsStyleBackground::Size::eCover) || + size.mWidthType == size.mHeightType, + "contain/cover apply to both dimensions or to neither"); } }; @@ -6636,8 +6637,8 @@ nsRuleNode::ComputeBorderData(void* aStartStruct, NS_FOR_CSS_SIDES(side) { const nsCSSValue& value = *aRuleData->ValueFor(subprops[side]); nsCSSUnit unit = value.GetUnit(); - NS_ABORT_IF_FALSE(eCSSUnit_None != unit, - "'none' should be handled as enumerated value"); + MOZ_ASSERT(eCSSUnit_None != unit, + "'none' should be handled as enumerated value"); if (eCSSUnit_Enumerated == unit) { border->SetBorderStyle(side, value.GetIntValue()); } @@ -6709,7 +6710,7 @@ nsRuleNode::ComputeBorderData(void* aStartStruct, } default: - NS_ABORT_IF_FALSE(false, "unrecognized border color unit"); + MOZ_ASSERT(false, "unrecognized border color unit"); } } @@ -7004,8 +7005,8 @@ nsRuleNode::ComputeOutlineData(void* aStartStruct, // cannot use SetDiscrete because of SetOutlineStyle const nsCSSValue* outlineStyleValue = aRuleData->ValueForOutlineStyle(); nsCSSUnit unit = outlineStyleValue->GetUnit(); - NS_ABORT_IF_FALSE(eCSSUnit_None != unit && eCSSUnit_Auto != unit, - "'none' and 'auto' should be handled as enumerated values"); + MOZ_ASSERT(eCSSUnit_None != unit && eCSSUnit_Auto != unit, + "'none' and 'auto' should be handled as enumerated values"); if (eCSSUnit_Enumerated == unit) { outline->SetOutlineStyle(outlineStyleValue->GetIntValue()); } else if (eCSSUnit_Initial == unit || @@ -7162,7 +7163,7 @@ nsRuleNode::ComputeListData(void* aStartStruct, } default: - NS_ABORT_IF_FALSE(false, "unrecognized image-region unit"); + MOZ_ASSERT(false, "unrecognized image-region unit"); } COMPUTE_END_INHERITED(List, list) @@ -7843,9 +7844,8 @@ nsRuleNode::ComputeContentData(void* aStartStruct, break; case eCSSUnit_Enumerated: { - NS_ABORT_IF_FALSE(contentValue->GetIntValue() == - NS_STYLE_CONTENT_ALT_CONTENT, - "unrecognized solitary content keyword"); + MOZ_ASSERT(contentValue->GetIntValue() == NS_STYLE_CONTENT_ALT_CONTENT, + "unrecognized solitary content keyword"); content->AllocateContents(1); nsStyleContentData& data = content->ContentAt(0); data.mType = eStyleContentType_AltContent; @@ -7953,8 +7953,8 @@ nsRuleNode::ComputeContentData(void* aStartStruct, case eCSSUnit_PairListDep: { const nsCSSValuePairList* ourIncrement = counterIncrementValue->GetPairListValue(); - NS_ABORT_IF_FALSE(ourIncrement->mXValue.GetUnit() == eCSSUnit_Ident, - "unexpected value unit"); + MOZ_ASSERT(ourIncrement->mXValue.GetUnit() == eCSSUnit_Ident, + "unexpected value unit"); count = ListLength(ourIncrement); if (NS_FAILED(content->AllocateCounterIncrements(count))) { break; @@ -7975,7 +7975,7 @@ nsRuleNode::ComputeContentData(void* aStartStruct, } default: - NS_ABORT_IF_FALSE(false, "unexpected value unit"); + MOZ_ASSERT(false, "unexpected value unit"); } // counter-reset: [string [int]]+, none, inherit @@ -8006,8 +8006,8 @@ nsRuleNode::ComputeContentData(void* aStartStruct, case eCSSUnit_PairListDep: { const nsCSSValuePairList* ourReset = counterResetValue->GetPairListValue(); - NS_ABORT_IF_FALSE(ourReset->mXValue.GetUnit() == eCSSUnit_Ident, - "unexpected value unit"); + MOZ_ASSERT(ourReset->mXValue.GetUnit() == eCSSUnit_Ident, + "unexpected value unit"); count = ListLength(ourReset); if (NS_FAILED(content->AllocateCounterResets(count))) { break; @@ -8028,7 +8028,7 @@ nsRuleNode::ComputeContentData(void* aStartStruct, } default: - NS_ABORT_IF_FALSE(false, "unexpected value unit"); + MOZ_ASSERT(false, "unexpected value unit"); } // marker-offset: length, auto, inherit @@ -8086,9 +8086,9 @@ nsRuleNode::ComputeQuotesData(void* aStartStruct, } count = 0; while (ourQuotes) { - NS_ABORT_IF_FALSE(ourQuotes->mXValue.GetUnit() == eCSSUnit_String && - ourQuotes->mYValue.GetUnit() == eCSSUnit_String, - "improper list contents for quotes"); + MOZ_ASSERT(ourQuotes->mXValue.GetUnit() == eCSSUnit_String && + ourQuotes->mYValue.GetUnit() == eCSSUnit_String, + "improper list contents for quotes"); ourQuotes->mXValue.GetStringValue(buffer); ourQuotes->mYValue.GetStringValue(closeBuffer); quotes->SetQuotesAt(count++, buffer, closeBuffer); @@ -8097,7 +8097,7 @@ nsRuleNode::ComputeQuotesData(void* aStartStruct, break; } default: - NS_ABORT_IF_FALSE(false, "unexpected value unit"); + MOZ_ASSERT(false, "unexpected value unit"); } COMPUTE_END_INHERITED(Quotes, quotes) @@ -8250,8 +8250,8 @@ nsRuleNode::ComputeColumnData(void* aStartStruct, // column-rule-style: enum, inherit const nsCSSValue& styleValue = *aRuleData->ValueForColumnRuleStyle(); - NS_ABORT_IF_FALSE(eCSSUnit_None != styleValue.GetUnit(), - "'none' should be handled as enumerated value"); + MOZ_ASSERT(eCSSUnit_None != styleValue.GetUnit(), + "'none' should be handled as enumerated value"); if (eCSSUnit_Enumerated == styleValue.GetUnit()) { column->mColumnRuleStyle = styleValue.GetIntValue(); } @@ -8350,14 +8350,14 @@ SetSVGPaint(const nsCSSValue& aValue, const nsStyleSVGPaint& parentPaint, if (pair.mYValue.GetUnit() == eCSSUnit_None) { aResult.mFallbackColor = NS_RGBA(0, 0, 0, 0); } else { - NS_ABORT_IF_FALSE(pair.mYValue.GetUnit() != eCSSUnit_Inherit, - "cannot inherit fallback colour"); + MOZ_ASSERT(pair.mYValue.GetUnit() != eCSSUnit_Inherit, + "cannot inherit fallback colour"); SetColor(pair.mYValue, NS_RGB(0, 0, 0), aPresContext, aContext, aResult.mFallbackColor, aCanStoreInRuleTree); } } else { - NS_ABORT_IF_FALSE(aValue.GetUnit() == eCSSUnit_Null, - "malformed paint server value"); + MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Null, + "malformed paint server value"); } } @@ -8555,9 +8555,9 @@ nsRuleNode::ComputeSVGData(void* aStartStruct, break; case eCSSUnit_Enumerated: - NS_ABORT_IF_FALSE(strokeDasharrayValue->GetIntValue() == - NS_STYLE_STROKE_PROP_CONTEXT_VALUE, - "Unknown keyword for stroke-dasharray"); + MOZ_ASSERT(strokeDasharrayValue->GetIntValue() == + NS_STYLE_STROKE_PROP_CONTEXT_VALUE, + "Unknown keyword for stroke-dasharray"); svg->mStrokeDasharrayFromObject = true; delete [] svg->mStrokeDasharray; svg->mStrokeDasharray = nullptr; @@ -8603,7 +8603,7 @@ nsRuleNode::ComputeSVGData(void* aStartStruct, } default: - NS_ABORT_IF_FALSE(false, "unrecognized dasharray unit"); + MOZ_ASSERT(false, "unrecognized dasharray unit"); } // stroke-dashoffset: , inherit @@ -8654,9 +8654,9 @@ nsRuleNode::ComputeSVGData(void* aStartStruct, const nsCSSValue* strokeWidthValue = aRuleData->ValueForStrokeWidth(); switch (strokeWidthValue->GetUnit()) { case eCSSUnit_Enumerated: - NS_ABORT_IF_FALSE(strokeWidthValue->GetIntValue() == - NS_STYLE_STROKE_PROP_CONTEXT_VALUE, - "Unrecognized keyword for stroke-width"); + MOZ_ASSERT(strokeWidthValue->GetIntValue() == + NS_STYLE_STROKE_PROP_CONTEXT_VALUE, + "Unrecognized keyword for stroke-width"); svg->mStrokeWidthFromObject = true; svg->mStrokeWidth.SetCoordValue(nsPresContext::CSSPixelsToAppUnits(1)); break; @@ -8698,9 +8698,9 @@ nsRuleNode::SetStyleClipPathToCSSValue(nsStyleClipPath* aStyleClipPath, nsPresContext* aPresContext, bool& aCanStoreInRuleTree) { - NS_ABORT_IF_FALSE(aValue->GetUnit() != eCSSUnit_ListDep || - aValue->GetUnit() != eCSSUnit_List, - "expected a basic shape or reference box"); + MOZ_ASSERT(aValue->GetUnit() != eCSSUnit_ListDep || + aValue->GetUnit() != eCSSUnit_List, + "expected a basic shape or reference box"); const nsCSSValueList* cur = aValue->GetListValue(); @@ -8715,10 +8715,10 @@ nsRuleNode::SetStyleClipPathToCSSValue(nsStyleClipPath* aStyleClipPath, nsCSSKeyword functionName = (nsCSSKeyword)shapeFunction->Item(0).GetIntValue(); if (functionName == eCSSKeyword_polygon) { - NS_ABORT_IF_FALSE(!basicShape, "did not expect value"); + MOZ_ASSERT(!basicShape, "did not expect value"); basicShape = new nsStyleBasicShape(nsStyleBasicShape::ePolygon); - NS_ABORT_IF_FALSE(shapeFunction->Count() > 1, - "polygon has wrong number of arguments"); + MOZ_ASSERT(shapeFunction->Count() > 1, + "polygon has wrong number of arguments"); size_t j = 1; if (shapeFunction->Item(j).GetUnit() == eCSSUnit_Enumerated) { basicShape->SetFillRule(shapeFunction->Item(j).GetIntValue()); @@ -8736,13 +8736,13 @@ nsRuleNode::SetStyleClipPathToCSSValue(nsStyleClipPath* aStyleClipPath, aStyleContext, aPresContext, aCanStoreInRuleTree); coordinates.AppendElement(xCoord); - NS_ABORT_IF_FALSE(didSetCoordX, "unexpected x coordinate unit"); + MOZ_ASSERT(didSetCoordX, "unexpected x coordinate unit"); DebugOnly didSetCoordY = SetCoord(curPair->mYValue, yCoord, nsStyleCoord(), mask, aStyleContext, aPresContext, aCanStoreInRuleTree); coordinates.AppendElement(yCoord); - NS_ABORT_IF_FALSE(didSetCoordY, "unexpected y coordinate unit"); + MOZ_ASSERT(didSetCoordY, "unexpected y coordinate unit"); curPair = curPair->mNext; } } else if (functionName == eCSSKeyword_circle || @@ -8750,17 +8750,17 @@ nsRuleNode::SetStyleClipPathToCSSValue(nsStyleClipPath* aStyleClipPath, nsStyleBasicShape::Type type = functionName == eCSSKeyword_circle ? nsStyleBasicShape::eCircle : nsStyleBasicShape::eEllipse; - NS_ABORT_IF_FALSE(!basicShape, "did not expect value"); + MOZ_ASSERT(!basicShape, "did not expect value"); basicShape = new nsStyleBasicShape(type); const int32_t mask = SETCOORD_PERCENT | SETCOORD_LENGTH | SETCOORD_STORE_CALC | SETCOORD_ENUMERATED; size_t count = type == nsStyleBasicShape::eCircle ? 2 : 3; - NS_ABORT_IF_FALSE(shapeFunction->Count() == count + 1, - "unexpected arguments count"); - NS_ABORT_IF_FALSE(type == nsStyleBasicShape::eCircle || - (shapeFunction->Item(1).GetUnit() == eCSSUnit_Null) == - (shapeFunction->Item(2).GetUnit() == eCSSUnit_Null), - "ellipse should have two radii or none"); + MOZ_ASSERT(shapeFunction->Count() == count + 1, + "unexpected arguments count"); + MOZ_ASSERT(type == nsStyleBasicShape::eCircle || + (shapeFunction->Item(1).GetUnit() == eCSSUnit_Null) == + (shapeFunction->Item(2).GetUnit() == eCSSUnit_Null), + "ellipse should have two radii or none"); for (size_t j = 1; j < count; ++j) { const nsCSSValue& val = shapeFunction->Item(j); nsStyleCoord radius; @@ -8770,7 +8770,7 @@ nsRuleNode::SetStyleClipPathToCSSValue(nsStyleClipPath* aStyleClipPath, aStyleContext, aPresContext, aCanStoreInRuleTree); - NS_ABORT_IF_FALSE(didSetRadius, "unexpected radius unit"); + MOZ_ASSERT(didSetRadius, "unexpected radius unit"); } else { radius.SetIntValue(NS_RADIUS_CLOSEST_SIDE, eStyleUnit_Enumerated); } @@ -8782,16 +8782,16 @@ nsRuleNode::SetStyleClipPathToCSSValue(nsStyleClipPath* aStyleClipPath, basicShape->GetPosition(), aCanStoreInRuleTree); } else { - NS_ABORT_IF_FALSE(positionVal.GetUnit() == eCSSUnit_Null, - "expected no value"); + MOZ_ASSERT(positionVal.GetUnit() == eCSSUnit_Null, + "expected no value"); } } else if (functionName == eCSSKeyword_inset) { - NS_ABORT_IF_FALSE(!basicShape, "did not expect value"); + MOZ_ASSERT(!basicShape, "did not expect value"); basicShape = new nsStyleBasicShape(nsStyleBasicShape::eInset); - NS_ABORT_IF_FALSE(shapeFunction->Count() == 6, - "inset function has wrong number of arguments"); - NS_ABORT_IF_FALSE(shapeFunction->Item(1).GetUnit() != eCSSUnit_Null, - "no shape arguments defined"); + MOZ_ASSERT(shapeFunction->Count() == 6, + "inset function has wrong number of arguments"); + MOZ_ASSERT(shapeFunction->Item(1).GetUnit() != eCSSUnit_Null, + "no shape arguments defined"); const int32_t mask = SETCOORD_PERCENT | SETCOORD_LENGTH | SETCOORD_STORE_CALC; nsTArray& coords = basicShape->Coordinates(); @@ -8803,7 +8803,7 @@ nsRuleNode::SetStyleClipPathToCSSValue(nsStyleClipPath* aStyleClipPath, if (j == 4) { inset = coords[1]; } else { - NS_ABORT_IF_FALSE(j != 1, "first argument not specified"); + MOZ_ASSERT(j != 1, "first argument not specified"); inset = coords[0]; } } else { @@ -8811,7 +8811,7 @@ nsRuleNode::SetStyleClipPathToCSSValue(nsStyleClipPath* aStyleClipPath, nsStyleCoord(), mask, aStyleContext, aPresContext, aCanStoreInRuleTree); - NS_ABORT_IF_FALSE(didSetInset, "unexpected inset unit"); + MOZ_ASSERT(didSetInset, "unexpected inset unit"); } coords.AppendElement(inset); } @@ -8830,13 +8830,13 @@ nsRuleNode::SetStyleClipPathToCSSValue(nsStyleClipPath* aStyleClipPath, aStyleContext, aPresContext, aCanStoreInRuleTree); - NS_ABORT_IF_FALSE(didSetRadii, "unexpected radius unit"); + MOZ_ASSERT(didSetRadii, "unexpected radius unit"); insetRadius.Set(cx, coordX); insetRadius.Set(cy, coordY); } } else { - NS_ABORT_IF_FALSE(shapeFunction->Item(5).GetUnit() == - eCSSUnit_Null, "unexpected value"); + MOZ_ASSERT(shapeFunction->Item(5).GetUnit() == eCSSUnit_Null, + "unexpected value"); // Initialize border-radius nsStyleCoord zero; zero.SetCoordValue(0); @@ -8887,7 +8887,7 @@ nsRuleNode::SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter, return true; } - NS_ABORT_IF_FALSE(unit == eCSSUnit_Function, "expected a filter function"); + MOZ_ASSERT(unit == eCSSUnit_Function, "expected a filter function"); nsCSSValue::Array* filterFunction = aValue.GetArrayValue(); nsCSSKeyword functionName = @@ -8898,7 +8898,7 @@ nsRuleNode::SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter, nsCSSProps::FindKeyword(functionName, nsCSSProps::kFilterFunctionKTable, type); - NS_ABORT_IF_FALSE(foundKeyword, "unknown filter type"); + MOZ_ASSERT(foundKeyword, "unknown filter type"); if (type == NS_STYLE_FILTER_DROP_SHADOW) { nsRefPtr shadowArray = GetShadowData( filterFunction->Item(1).GetListValue(), @@ -8918,9 +8918,8 @@ nsRuleNode::SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter, mask = SETCOORD_ANGLE; } - NS_ABORT_IF_FALSE(filterFunction->Count() == 2, - "all filter functions should have " - "exactly one argument"); + MOZ_ASSERT(filterFunction->Count() == 2, + "all filter functions should have exactly one argument"); nsCSSValue& arg = filterFunction->Item(1); nsStyleCoord filterParameter; @@ -8929,7 +8928,7 @@ nsRuleNode::SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter, aStyleContext, aPresContext, aCanStoreInRuleTree); aStyleFilter->SetFilterParameter(filterParameter, type); - NS_ABORT_IF_FALSE(didSetCoord, "unexpected unit"); + MOZ_ASSERT(didSetCoord, "unexpected unit"); return true; } @@ -9060,8 +9059,8 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct, svgReset->mFilters.Clear(); break; } - NS_ABORT_IF_FALSE(styleFilter.GetType() != NS_STYLE_FILTER_NONE, - "filter should be set"); + MOZ_ASSERT(styleFilter.GetType() != NS_STYLE_FILTER_NONE, + "filter should be set"); svgReset->mFilters.AppendElement(styleFilter); cur = cur->mNext; } @@ -9138,7 +9137,7 @@ nsRuleNode::GetStyleData(nsStyleStructID aSID, // Nothing is cached. We'll have to delve further and examine our rules. data = WalkRuleTree(aSID, aContext); - NS_ABORT_IF_FALSE(data, "should have aborted on out-of-memory"); + MOZ_ASSERT(data, "should have aborted on out-of-memory"); return data; } @@ -9164,7 +9163,7 @@ nsRuleNode::GetStyle##name_(nsStyleContext* aContext, bool aComputeData) \ data = static_cast \ (WalkRuleTree(eStyleStruct_##name_, aContext)); \ \ - NS_ABORT_IF_FALSE(data, "should have aborted on out-of-memory"); \ + MOZ_ASSERT(data, "should have aborted on out-of-memory"); \ return data; \ } #include "nsStyleStructList.h" diff --git a/layout/style/nsRuleNode.h b/layout/style/nsRuleNode.h index 075c9e1e10f..6665410c27d 100644 --- a/layout/style/nsRuleNode.h +++ b/layout/style/nsRuleNode.h @@ -32,14 +32,14 @@ private: void* mArray[Count]; public: void*& operator[](nsStyleStructID aIndex) { - NS_ABORT_IF_FALSE(MinIndex <= aIndex && aIndex < (MinIndex + Count), - "out of range"); + MOZ_ASSERT(MinIndex <= aIndex && aIndex < (MinIndex + Count), + "out of range"); return mArray[aIndex - MinIndex]; } const void* operator[](nsStyleStructID aIndex) const { - NS_ABORT_IF_FALSE(MinIndex <= aIndex && aIndex < (MinIndex + Count), - "out of range"); + MOZ_ASSERT(MinIndex <= aIndex && aIndex < (MinIndex + Count), + "out of range"); return mArray[aIndex - MinIndex]; } }; @@ -124,8 +124,8 @@ struct nsCachedStyleData nsResetStyleData* mResetData; static bool IsReset(const nsStyleStructID aSID) { - NS_ABORT_IF_FALSE(0 <= aSID && aSID < nsStyleStructID_Length, - "must be an inherited or reset SID"); + MOZ_ASSERT(0 <= aSID && aSID < nsStyleStructID_Length, + "must be an inherited or reset SID"); return nsStyleStructID_Reset_Start <= aSID; } diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp index a1298f75cb0..ba767028c94 100644 --- a/layout/style/nsStyleContext.cpp +++ b/layout/style/nsStyleContext.cpp @@ -652,9 +652,9 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther, PROFILER_LABEL("nsStyleContext", "CalcStyleDifference", js::ProfileEntry::Category::CSS); - NS_ABORT_IF_FALSE(NS_IsHintSubset(aParentHintsNotHandledForDescendants, - nsChangeHint_Hints_NotHandledForDescendants), - "caller is passing inherited hints, but shouldn't be"); + MOZ_ASSERT(NS_IsHintSubset(aParentHintsNotHandledForDescendants, + nsChangeHint_Hints_NotHandledForDescendants), + "caller is passing inherited hints, but shouldn't be"); static_assert(nsStyleStructID_Length <= 32, "aEqualStructs is not big enough"); @@ -1037,8 +1037,8 @@ ExtractAnimationValue(nsCSSProperty aProperty, DebugOnly success = StyleAnimationValue::ExtractComputedValue(aProperty, aStyleContext, aResult); - NS_ABORT_IF_FALSE(success, - "aProperty must be extractable by StyleAnimationValue"); + MOZ_ASSERT(success, + "aProperty must be extractable by StyleAnimationValue"); } static nscolor diff --git a/layout/style/nsStyleContext.h b/layout/style/nsStyleContext.h index eefb28880b4..c4668c52733 100644 --- a/layout/style/nsStyleContext.h +++ b/layout/style/nsStyleContext.h @@ -186,15 +186,15 @@ public: // To be called only from nsStyleSet. void SetStyleIfVisited(already_AddRefed aStyleIfVisited) { - NS_ABORT_IF_FALSE(!IsStyleIfVisited(), "this context is not visited data"); + MOZ_ASSERT(!IsStyleIfVisited(), "this context is not visited data"); NS_ASSERTION(!mStyleIfVisited, "should only be set once"); mStyleIfVisited = aStyleIfVisited; - NS_ABORT_IF_FALSE(mStyleIfVisited->IsStyleIfVisited(), - "other context is visited data"); - NS_ABORT_IF_FALSE(!mStyleIfVisited->GetStyleIfVisited(), - "other context does not have visited data"); + MOZ_ASSERT(mStyleIfVisited->IsStyleIfVisited(), + "other context is visited data"); + MOZ_ASSERT(!mStyleIfVisited->GetStyleIfVisited(), + "other context does not have visited data"); NS_ASSERTION(GetStyleIfVisited()->GetPseudo() == GetPseudo(), "pseudo tag mismatch"); if (GetParent() && GetParent()->GetStyleIfVisited()) { diff --git a/layout/style/nsStyleCoord.cpp b/layout/style/nsStyleCoord.cpp index f014e57ae6b..27bf436942f 100644 --- a/layout/style/nsStyleCoord.cpp +++ b/layout/style/nsStyleCoord.cpp @@ -74,7 +74,7 @@ bool nsStyleCoord::operator==(const nsStyleCoord& aOther) const case eStyleUnit_Calc: return *this->GetCalcValue() == *aOther.GetCalcValue(); } - NS_ABORT_IF_FALSE(false, "unexpected unit"); + MOZ_ASSERT(false, "unexpected unit"); return false; } @@ -108,7 +108,7 @@ uint32_t nsStyleCoord::HashValue(uint32_t aHash = 0) const } return aHash; } - NS_ABORT_IF_FALSE(false, "unexpected unit"); + MOZ_ASSERT(false, "unexpected unit"); return aHash; } diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp index bb9f219f577..9a1bac10a0b 100644 --- a/layout/style/nsStyleSet.cpp +++ b/layout/style/nsStyleSet.cpp @@ -39,6 +39,8 @@ #include "nsIFrame.h" #include "RestyleManager.h" +#include + using namespace mozilla; using namespace mozilla::dom; @@ -755,16 +757,15 @@ ReplaceAnimationRule(nsRuleNode *aOldRuleNode, } if (aOldAnimRule) { - NS_ABORT_IF_FALSE(n->GetRule() == aOldAnimRule, "wrong rule"); - NS_ABORT_IF_FALSE(n->GetLevel() == nsStyleSet::eAnimationSheet, - "wrong level"); + MOZ_ASSERT(n->GetRule() == aOldAnimRule, "wrong rule"); + MOZ_ASSERT(n->GetLevel() == nsStyleSet::eAnimationSheet, + "wrong level"); n = n->GetParent(); } - NS_ABORT_IF_FALSE(!IsMoreSpecificThanAnimation(n) && - (n->IsRoot() || - n->GetLevel() != nsStyleSet::eAnimationSheet), - "wrong level"); + MOZ_ASSERT(!IsMoreSpecificThanAnimation(n) && + (n->IsRoot() || n->GetLevel() != nsStyleSet::eAnimationSheet), + "wrong level"); if (aNewAnimRule) { n = n->Transition(aNewAnimRule, nsStyleSet::eAnimationSheet, false); @@ -887,27 +888,26 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext, nsIStyleRule *oldAnimRule = GetAnimationRule(aRuleNode); nsIStyleRule *animRule = PresContext()->AnimationManager()-> CheckAnimationRule(result, aElementForAnimation); - NS_ABORT_IF_FALSE(result->RuleNode() == aRuleNode, - "unexpected rule node"); - NS_ABORT_IF_FALSE(!result->GetStyleIfVisited() == !aVisitedRuleNode, - "unexpected visited rule node"); - NS_ABORT_IF_FALSE(!aVisitedRuleNode || - result->GetStyleIfVisited()->RuleNode() == - aVisitedRuleNode, - "unexpected visited rule node"); - NS_ABORT_IF_FALSE(!aVisitedRuleNode || - oldAnimRule == GetAnimationRule(aVisitedRuleNode), - "animation rule mismatch between rule nodes"); + MOZ_ASSERT(result->RuleNode() == aRuleNode, + "unexpected rule node"); + MOZ_ASSERT(!result->GetStyleIfVisited() == !aVisitedRuleNode, + "unexpected visited rule node"); + MOZ_ASSERT(!aVisitedRuleNode || + result->GetStyleIfVisited()->RuleNode() == aVisitedRuleNode, + "unexpected visited rule node"); + MOZ_ASSERT(!aVisitedRuleNode || + oldAnimRule == GetAnimationRule(aVisitedRuleNode), + "animation rule mismatch between rule nodes"); if (oldAnimRule != animRule) { nsRuleNode *ruleNode = ReplaceAnimationRule(aRuleNode, oldAnimRule, animRule); nsRuleNode *visitedRuleNode = aVisitedRuleNode ? ReplaceAnimationRule(aVisitedRuleNode, oldAnimRule, animRule) : nullptr; - NS_ABORT_IF_FALSE(!visitedRuleNode || - GetAnimationRule(ruleNode) == - GetAnimationRule(visitedRuleNode), - "animation rule mismatch between rule nodes"); + MOZ_ASSERT(!visitedRuleNode || + GetAnimationRule(ruleNode) == + GetAnimationRule(visitedRuleNode), + "animation rule mismatch between rule nodes"); result = GetContext(aParentContext, ruleNode, visitedRuleNode, aPseudoTag, aPseudoType, nullptr, aFlags & ~eDoAnimation); @@ -1408,7 +1408,7 @@ nsStyleSet::RuleNodeWithReplacement(Element* aElement, eRestyle_ForceDescendants)), // FIXME: Once bug 979133 lands we'll have a better // way to print these. - nsPrintfCString("unexpected replacement bits 0x%lX", + nsPrintfCString("unexpected replacement bits 0x%" PRIX32, uint32_t(aReplacements)).get()); // If we're changing animation phase, we have to reconsider what rules @@ -2132,9 +2132,9 @@ SkipAnimationRules(nsRuleNode* aRuleNode, Element* aElementOrPseudoElement, ruleNode->GetLevel() == nsStyleSet::eTransitionSheet) { ruleNode = ruleNode->GetParent(); } - NS_ABORT_IF_FALSE(ruleNode->IsRoot() || - ruleNode->GetLevel() != nsStyleSet::eTransitionSheet, - "can't have more than one transition rule"); + MOZ_ASSERT(ruleNode->IsRoot() || + ruleNode->GetLevel() != nsStyleSet::eTransitionSheet, + "can't have more than one transition rule"); // Use our existing ReplaceAnimationRule function to replace the // animation rule, if present. diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 5670b5d6b8d..1e507646f46 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -268,7 +268,7 @@ static nscoord CalcCoord(const nsStyleCoord& aCoord, int32_t aNumEnums) { if (aCoord.GetUnit() == eStyleUnit_Enumerated) { - NS_ABORT_IF_FALSE(aEnumTable, "must have enum table"); + MOZ_ASSERT(aEnumTable, "must have enum table"); int32_t value = aCoord.GetIntValue(); if (0 <= value && value < aNumEnums) { return aEnumTable[aCoord.GetIntValue()]; @@ -276,7 +276,7 @@ static nscoord CalcCoord(const nsStyleCoord& aCoord, NS_NOTREACHED("unexpected enum value"); return 0; } - NS_ABORT_IF_FALSE(aCoord.ConvertsToLength(), "unexpected unit"); + MOZ_ASSERT(aCoord.ConvertsToLength(), "unexpected unit"); return nsRuleNode::ComputeCoordPercentCalc(aCoord, 0); } @@ -512,10 +512,10 @@ nsChangeHint nsStyleBorder::CalcDifference(const nsStyleBorder& aOther) const { nsChangeHint shadowDifference = CalcShadowDifference(mBoxShadow, aOther.mBoxShadow); - NS_ABORT_IF_FALSE(shadowDifference == unsigned(NS_STYLE_HINT_REFLOW) || - shadowDifference == unsigned(NS_STYLE_HINT_VISUAL) || - shadowDifference == unsigned(NS_STYLE_HINT_NONE), - "should do more with shadowDifference"); + MOZ_ASSERT(shadowDifference == unsigned(NS_STYLE_HINT_REFLOW) || + shadowDifference == unsigned(NS_STYLE_HINT_VISUAL) || + shadowDifference == unsigned(NS_STYLE_HINT_NONE), + "should do more with shadowDifference"); // XXXbz we should be able to return a more specific change hint for // at least GetComputedBorder() differences... @@ -1746,12 +1746,12 @@ nsChangeHint nsStyleColor::CalcDifference(const nsStyleColor& aOther) const bool nsStyleGradient::operator==(const nsStyleGradient& aOther) const { - NS_ABORT_IF_FALSE(mSize == NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER || - mShape != NS_STYLE_GRADIENT_SHAPE_LINEAR, - "incorrect combination of shape and size"); - NS_ABORT_IF_FALSE(aOther.mSize == NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER || - aOther.mShape != NS_STYLE_GRADIENT_SHAPE_LINEAR, - "incorrect combination of shape and size"); + MOZ_ASSERT(mSize == NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER || + mShape != NS_STYLE_GRADIENT_SHAPE_LINEAR, + "incorrect combination of shape and size"); + MOZ_ASSERT(aOther.mSize == NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER || + aOther.mShape != NS_STYLE_GRADIENT_SHAPE_LINEAR, + "incorrect combination of shape and size"); if (mShape != aOther.mShape || mSize != aOther.mSize || @@ -1869,8 +1869,8 @@ nsStyleImage::DoCopy(const nsStyleImage& aOther) void nsStyleImage::SetNull() { - NS_ABORT_IF_FALSE(!mImageTracked, - "Calling SetNull() with image tracked!"); + MOZ_ASSERT(!mImageTracked, + "Calling SetNull() with image tracked!"); if (mType == eStyleImageType_Gradient) mGradient->Release(); @@ -1886,8 +1886,8 @@ nsStyleImage::SetNull() void nsStyleImage::SetImageData(imgRequestProxy* aImage) { - NS_ABORT_IF_FALSE(!mImageTracked, - "Setting a new image without untracking the old one!"); + MOZ_ASSERT(!mImageTracked, + "Setting a new image without untracking the old one!"); NS_IF_ADDREF(aImage); @@ -1905,9 +1905,9 @@ void nsStyleImage::TrackImage(nsPresContext* aContext) { // Sanity - NS_ABORT_IF_FALSE(!mImageTracked, "Already tracking image!"); - NS_ABORT_IF_FALSE(mType == eStyleImageType_Image, - "Can't track image when there isn't one!"); + MOZ_ASSERT(!mImageTracked, "Already tracking image!"); + MOZ_ASSERT(mType == eStyleImageType_Image, + "Can't track image when there isn't one!"); // Register the image with the document nsIDocument* doc = aContext->Document(); @@ -1924,9 +1924,9 @@ void nsStyleImage::UntrackImage(nsPresContext* aContext) { // Sanity - NS_ABORT_IF_FALSE(mImageTracked, "Image not tracked!"); - NS_ABORT_IF_FALSE(mType == eStyleImageType_Image, - "Can't untrack image when there isn't one!"); + MOZ_ASSERT(mImageTracked, "Image not tracked!"); + MOZ_ASSERT(mType == eStyleImageType_Image, + "Can't untrack image when there isn't one!"); // Unregister the image with the document nsIDocument* doc = aContext->Document(); @@ -1992,7 +1992,7 @@ ConvertToPixelCoord(const nsStyleCoord& aCoord, int32_t aPercentScale) NS_NOTREACHED("unexpected unit for image crop rect"); return 0; } - NS_ABORT_IF_FALSE(pixelValue >= 0, "we ensured non-negative while parsing"); + MOZ_ASSERT(pixelValue >= 0, "we ensured non-negative while parsing"); pixelValue = std::min(pixelValue, double(INT32_MAX)); // avoid overflow return NS_lround(pixelValue); } @@ -2050,11 +2050,11 @@ nsStyleImage::IsOpaque() const if (mType == eStyleImageType_Element) return false; - NS_ABORT_IF_FALSE(mType == eStyleImageType_Image, "unexpected image type"); + MOZ_ASSERT(mType == eStyleImageType_Image, "unexpected image type"); nsCOMPtr imageContainer; mImage->GetImage(getter_AddRefs(imageContainer)); - NS_ABORT_IF_FALSE(imageContainer, "IsComplete() said image container is ready"); + MOZ_ASSERT(imageContainer, "IsComplete() said image container is ready"); // Check if the crop region of the image is opaque. if (imageContainer->IsOpaque()) { @@ -2282,8 +2282,8 @@ nsStyleBackground::Position::SetInitialPercentValues(float aPercentVal) bool nsStyleBackground::Size::DependsOnPositioningAreaSize(const nsStyleImage& aImage) const { - NS_ABORT_IF_FALSE(aImage.GetType() != eStyleImageType_Null, - "caller should have handled this"); + MOZ_ASSERT(aImage.GetType() != eStyleImageType_Null, + "caller should have handled this"); // If either dimension contains a non-zero percentage, rendering for that // dimension straightforwardly depends on frame size. @@ -2302,10 +2302,10 @@ nsStyleBackground::Size::DependsOnPositioningAreaSize(const nsStyleImage& aImage return false; } - NS_ABORT_IF_FALSE((mWidthType == eLengthPercentage && mHeightType == eAuto) || - (mWidthType == eAuto && mHeightType == eLengthPercentage) || - (mWidthType == eAuto && mHeightType == eAuto), - "logic error"); + MOZ_ASSERT((mWidthType == eLengthPercentage && mHeightType == eAuto) || + (mWidthType == eAuto && mHeightType == eLengthPercentage) || + (mWidthType == eAuto && mHeightType == eAuto), + "logic error"); nsStyleImageType type = aImage.GetType(); @@ -2367,14 +2367,14 @@ nsStyleBackground::Size::SetInitialValues() bool nsStyleBackground::Size::operator==(const Size& aOther) const { - NS_ABORT_IF_FALSE(mWidthType < eDimensionType_COUNT, - "bad mWidthType for this"); - NS_ABORT_IF_FALSE(mHeightType < eDimensionType_COUNT, - "bad mHeightType for this"); - NS_ABORT_IF_FALSE(aOther.mWidthType < eDimensionType_COUNT, - "bad mWidthType for aOther"); - NS_ABORT_IF_FALSE(aOther.mHeightType < eDimensionType_COUNT, - "bad mHeightType for aOther"); + MOZ_ASSERT(mWidthType < eDimensionType_COUNT, + "bad mWidthType for this"); + MOZ_ASSERT(mHeightType < eDimensionType_COUNT, + "bad mHeightType for this"); + MOZ_ASSERT(aOther.mWidthType < eDimensionType_COUNT, + "bad mWidthType for aOther"); + MOZ_ASSERT(aOther.mHeightType < eDimensionType_COUNT, + "bad mHeightType for aOther"); return mWidthType == aOther.mWidthType && mHeightType == aOther.mHeightType && @@ -2469,8 +2469,8 @@ void nsTimingFunction::AssignFromKeyword(int32_t aTimingFunctionType) { 0.42f, 0.00f, 0.58f, 1.00f } // ease-in-out }; - NS_ABORT_IF_FALSE(0 <= aTimingFunctionType && aTimingFunctionType < 5, - "keyword out of range"); + MOZ_ASSERT(0 <= aTimingFunctionType && aTimingFunctionType < 5, + "keyword out of range"); mFunc.mX1 = timingFunctionValues[aTimingFunctionType][0]; mFunc.mY1 = timingFunctionValues[aTimingFunctionType][1]; mFunc.mX2 = timingFunctionValues[aTimingFunctionType][2]; @@ -2592,8 +2592,8 @@ nsStyleDisplay::nsStyleDisplay() mScrollBehavior = NS_STYLE_SCROLL_BEHAVIOR_AUTO; mTransitions.AppendElement(); - NS_ABORT_IF_FALSE(mTransitions.Length() == 1, - "appending within auto buffer should never fail"); + MOZ_ASSERT(mTransitions.Length() == 1, + "appending within auto buffer should never fail"); mTransitions[0].SetInitialValues(); mTransitionTimingFunctionCount = 1; mTransitionDurationCount = 1; @@ -2601,8 +2601,8 @@ nsStyleDisplay::nsStyleDisplay() mTransitionPropertyCount = 1; mAnimations.AppendElement(); - NS_ABORT_IF_FALSE(mAnimations.Length() == 1, - "appending within auto buffer should never fail"); + MOZ_ASSERT(mAnimations.Length() == 1, + "appending within auto buffer should never fail"); mAnimations[0].SetInitialValues(); mAnimationTimingFunctionCount = 1; mAnimationDurationCount = 1; @@ -2936,8 +2936,8 @@ nsChangeHint nsStyleVisibility::CalcDifference(const nsStyleVisibility& aOther) nsStyleContentData::~nsStyleContentData() { - NS_ABORT_IF_FALSE(!mImageTracked, - "nsStyleContentData being destroyed while still tracking image!"); + MOZ_ASSERT(!mImageTracked, + "nsStyleContentData being destroyed while still tracking image!"); if (mType == eStyleContentType_Image) { NS_IF_RELEASE(mContent.mImage); } else if (mType == eStyleContentType_Counter || @@ -2997,11 +2997,11 @@ void nsStyleContentData::TrackImage(nsPresContext* aContext) { // Sanity - NS_ABORT_IF_FALSE(!mImageTracked, "Already tracking image!"); - NS_ABORT_IF_FALSE(mType == eStyleContentType_Image, - "Trying to do image tracking on non-image!"); - NS_ABORT_IF_FALSE(mContent.mImage, - "Can't track image when there isn't one!"); + MOZ_ASSERT(!mImageTracked, "Already tracking image!"); + MOZ_ASSERT(mType == eStyleContentType_Image, + "Trying to do image tracking on non-image!"); + MOZ_ASSERT(mContent.mImage, + "Can't track image when there isn't one!"); // Register the image with the document nsIDocument* doc = aContext->Document(); @@ -3018,11 +3018,11 @@ void nsStyleContentData::UntrackImage(nsPresContext* aContext) { // Sanity - NS_ABORT_IF_FALSE(mImageTracked, "Image not tracked!"); - NS_ABORT_IF_FALSE(mType == eStyleContentType_Image, - "Trying to do image tracking on non-image!"); - NS_ABORT_IF_FALSE(mContent.mImage, - "Can't untrack image when there isn't one!"); + MOZ_ASSERT(mImageTracked, "Image not tracked!"); + MOZ_ASSERT(mType == eStyleContentType_Image, + "Trying to do image tracking on non-image!"); + MOZ_ASSERT(mContent.mImage, + "Can't untrack image when there isn't one!"); // Unregister the image with the document nsIDocument* doc = aContext->Document(); diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index a1abe1f4d89..741561b5e3b 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -219,9 +219,9 @@ struct nsStyleImage { return mType; } imgRequestProxy* GetImageData() const { - NS_ABORT_IF_FALSE(mType == eStyleImageType_Image, "Data is not an image!"); - NS_ABORT_IF_FALSE(mImageTracked, - "Should be tracking any image we're going to use!"); + MOZ_ASSERT(mType == eStyleImageType_Image, "Data is not an image!"); + MOZ_ASSERT(mImageTracked, + "Should be tracking any image we're going to use!"); return mImage; } nsStyleGradient* GetGradientData() const { @@ -419,14 +419,14 @@ struct nsStyleBackground { Dimension mWidth, mHeight; nscoord ResolveWidthLengthPercentage(const nsSize& aBgPositioningArea) const { - NS_ABORT_IF_FALSE(mWidthType == eLengthPercentage, - "resolving non-length/percent dimension!"); + MOZ_ASSERT(mWidthType == eLengthPercentage, + "resolving non-length/percent dimension!"); return mWidth.ResolveLengthPercentage(aBgPositioningArea.width); } nscoord ResolveHeightLengthPercentage(const nsSize& aBgPositioningArea) const { - NS_ABORT_IF_FALSE(mHeightType == eLengthPercentage, - "resolving non-length/percent dimension!"); + MOZ_ASSERT(mHeightType == eLengthPercentage, + "resolving non-length/percent dimension!"); return mHeight.ResolveLengthPercentage(aBgPositioningArea.height); } @@ -763,11 +763,11 @@ private: public: uint32_t Length() const { return mLength; } nsCSSShadowItem* ShadowAt(uint32_t i) { - NS_ABORT_IF_FALSE(i < mLength, "Accessing too high an index in the text shadow array!"); + MOZ_ASSERT(i < mLength, "Accessing too high an index in the text shadow array!"); return &mArray[i]; } const nsCSSShadowItem* ShadowAt(uint32_t i) const { - NS_ABORT_IF_FALSE(i < mLength, "Accessing too high an index in the text shadow array!"); + MOZ_ASSERT(i < mLength, "Accessing too high an index in the text shadow array!"); return &mArray[i]; } @@ -1507,8 +1507,8 @@ struct nsStyleTextReset { void SetDecorationStyle(uint8_t aStyle) { - NS_ABORT_IF_FALSE((aStyle & BORDER_STYLE_MASK) == aStyle, - "style doesn't fit"); + MOZ_ASSERT((aStyle & BORDER_STYLE_MASK) == aStyle, + "style doesn't fit"); mTextDecorationStyle &= ~BORDER_STYLE_MASK; mTextDecorationStyle |= (aStyle & BORDER_STYLE_MASK); } @@ -1816,7 +1816,7 @@ struct nsTimingFunction { nsTimingFunction(Type aType, uint32_t aSteps) : mType(aType) { - NS_ABORT_IF_FALSE(mType == StepStart || mType == StepEnd, "wrong type"); + MOZ_ASSERT(mType == StepStart || mType == StepEnd, "wrong type"); mSteps = aSteps; } @@ -2316,9 +2316,9 @@ struct nsStyleContentData { void SetImage(imgRequestProxy* aRequest) { - NS_ABORT_IF_FALSE(!mImageTracked, - "Setting a new image without untracking the old one!"); - NS_ABORT_IF_FALSE(mType == eStyleContentType_Image, "Wrong type!"); + MOZ_ASSERT(!mImageTracked, + "Setting a new image without untracking the old one!"); + MOZ_ASSERT(mType == eStyleContentType_Image, "Wrong type!"); NS_IF_ADDREF(mContent.mImage = aRequest); } private: diff --git a/layout/style/nsStyleUtil.cpp b/layout/style/nsStyleUtil.cpp index af6ca246c0a..90329bfa774 100644 --- a/layout/style/nsStyleUtil.cpp +++ b/layout/style/nsStyleUtil.cpp @@ -216,7 +216,7 @@ nsStyleUtil::AppendBitmaskCSSValue(nsCSSProperty aProperty, } } } - NS_ABORT_IF_FALSE(aMaskedValue == 0, "unexpected bit remaining in bitfield"); + MOZ_ASSERT(aMaskedValue == 0, "unexpected bit remaining in bitfield"); } /* static */ void @@ -487,8 +487,8 @@ nsStyleUtil::AppendUnicodeRange(const nsCSSValue& aValue, nsAString& aResult) nsCSSValue::Array const & sources = *aValue.GetArrayValue(); nsAutoCString buf; - NS_ABORT_IF_FALSE(sources.Count() % 2 == 0, - "odd number of entries in a unicode-range: array"); + MOZ_ASSERT(sources.Count() % 2 == 0, + "odd number of entries in a unicode-range: array"); for (uint32_t i = 0; i < sources.Count(); i += 2) { uint32_t min = sources[i].GetIntValue(); diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index 782ac6f6a9c..5bbd21c35cb 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -281,7 +281,7 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement, AnimationPlayerPtrArray& players = collection->mPlayers; size_t i = players.Length(); - NS_ABORT_IF_FALSE(i != 0, "empty transitions list?"); + MOZ_ASSERT(i != 0, "empty transitions list?"); StyleAnimationValue currentValue; do { --i; @@ -318,8 +318,8 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement, return nullptr; } - NS_ABORT_IF_FALSE(collection, "must have element transitions if we started " - "any transitions"); + MOZ_ASSERT(collection, + "must have element transitions if we started any transitions"); // In the CSS working group discussion (2009 Jul 15 telecon, // http://www.w3.org/mid/4A5E1470.4030904@inkedblade.net ) of @@ -371,8 +371,8 @@ nsTransitionManager::ConsiderStartingTransition( nsCSSPropertySet* aWhichStarted) { // IsShorthand itself will assert if aProperty is not a property. - NS_ABORT_IF_FALSE(!nsCSSProps::IsShorthand(aProperty), - "property out of range"); + MOZ_ASSERT(!nsCSSProps::IsShorthand(aProperty), + "property out of range"); NS_ASSERTION(!aElementTransitions || aElementTransitions->mElement == aElement, "Element mismatch"); @@ -562,14 +562,14 @@ nsTransitionManager::ConsiderStartingTransition( AnimationPlayerPtrArray& players = aElementTransitions->mPlayers; #ifdef DEBUG for (size_t i = 0, i_end = players.Length(); i < i_end; ++i) { - NS_ABORT_IF_FALSE(players[i]->GetSource() && - players[i]->GetSource()->Properties().Length() == 1, - "Should have one animation property for a transition"); - NS_ABORT_IF_FALSE(i == currentIndex || - (players[i]->GetSource() && - players[i]->GetSource()->Properties()[0].mProperty - != aProperty), - "duplicate transitions for property"); + MOZ_ASSERT(players[i]->GetSource() && + players[i]->GetSource()->Properties().Length() == 1, + "Should have one animation property for a transition"); + MOZ_ASSERT( + i == currentIndex || + (players[i]->GetSource() && + players[i]->GetSource()->Properties()[0].mProperty != aProperty), + "duplicate transitions for property"); } #endif if (haveCurrentTransition) { @@ -632,9 +632,9 @@ struct TransitionEventInfo { /* virtual */ void nsTransitionManager::WillRefresh(mozilla::TimeStamp aTime) { - NS_ABORT_IF_FALSE(mPresContext, - "refresh driver should not notify additional observers " - "after pres context has been destroyed"); + MOZ_ASSERT(mPresContext, + "refresh driver should not notify additional observers " + "after pres context has been destroyed"); if (!mPresContext->GetPresShell()) { // Someone might be keeping mPresContext alive past the point // where it has been torn down; don't bother doing anything in @@ -673,13 +673,13 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags) AnimationPlayerCollection::CanAnimateFlags(0)) && collection->CanThrottleAnimation(now); - NS_ABORT_IF_FALSE(collection->mElement->GetCrossShadowCurrentDoc() == - mPresContext->Document(), - "Element::UnbindFromTree should have " - "destroyed the element transitions object"); + MOZ_ASSERT(collection->mElement->GetCrossShadowCurrentDoc() == + mPresContext->Document(), + "Element::UnbindFromTree should have " + "destroyed the element transitions object"); size_t i = collection->mPlayers.Length(); - NS_ABORT_IF_FALSE(i != 0, "empty transitions list?"); + MOZ_ASSERT(i != 0, "empty transitions list?"); bool transitionStartedOrEnded = false; do { --i; diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp index 31fa9ee3c5d..a546baa9c94 100644 --- a/layout/svg/SVGTextFrame.cpp +++ b/layout/svg/SVGTextFrame.cpp @@ -3121,7 +3121,7 @@ public: mDisableSubpixelAA(false) { MOZ_COUNT_CTOR(nsDisplaySVGText); - NS_ABORT_IF_FALSE(aFrame, "Must have a frame!"); + MOZ_ASSERT(aFrame, "Must have a frame!"); } #ifdef NS_BUILD_REFCNT_LOGGING virtual ~nsDisplaySVGText() { @@ -3513,8 +3513,8 @@ SVGTextFrame::FindCloserFrameForSelection( void SVGTextFrame::NotifySVGChanged(uint32_t aFlags) { - NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), - "Invalidation logic may need adjusting"); + MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), + "Invalidation logic may need adjusting"); bool needNewBounds = false; bool needGlyphMetricsUpdate = false; @@ -3832,8 +3832,8 @@ SVGTextFrame::ReflowSVG() NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this), "This call is probaby a wasteful mistake"); - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), - "ReflowSVG mechanism not designed for this"); + MOZ_ASSERT(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), + "ReflowSVG mechanism not designed for this"); if (!nsSVGUtils::NeedsReflowSVG(this)) { NS_ASSERTION(!(mState & NS_STATE_SVG_POSITIONING_DIRTY), "How did this happen?"); diff --git a/layout/svg/nsSVGAFrame.cpp b/layout/svg/nsSVGAFrame.cpp index ce0ca26430d..9dbd4c47e87 100644 --- a/layout/svg/nsSVGAFrame.cpp +++ b/layout/svg/nsSVGAFrame.cpp @@ -116,8 +116,8 @@ nsSVGAFrame::GetType() const void nsSVGAFrame::NotifySVGChanged(uint32_t aFlags) { - NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), - "Invalidation logic may need adjusting"); + MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), + "Invalidation logic may need adjusting"); if (aFlags & TRANSFORM_CHANGED) { // make sure our cached transform matrix gets (lazily) updated diff --git a/layout/svg/nsSVGContainerFrame.cpp b/layout/svg/nsSVGContainerFrame.cpp index 1c2277da006..7d8eb5579bd 100644 --- a/layout/svg/nsSVGContainerFrame.cpp +++ b/layout/svg/nsSVGContainerFrame.cpp @@ -175,8 +175,8 @@ nsSVGDisplayContainerFrame::InsertFrames(ChildListID aListID, kid = kid->GetNextSibling()) { nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); if (SVGFrame) { - NS_ABORT_IF_FALSE(!(kid->GetStateBits() & NS_FRAME_IS_NONDISPLAY), - "Check for this explicitly in the |if|, then"); + MOZ_ASSERT(!(kid->GetStateBits() & NS_FRAME_IS_NONDISPLAY), + "Check for this explicitly in the |if|, then"); bool isFirstReflow = (kid->GetStateBits() & NS_FRAME_FIRST_REFLOW); // Remove bits so that ScheduleBoundsUpdate will work: kid->RemoveStateBits(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY | @@ -318,11 +318,11 @@ nsSVGDisplayContainerFrame::ReflowSVG() NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this), "This call is probably a wasteful mistake"); - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), - "ReflowSVG mechanism not designed for this"); + MOZ_ASSERT(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), + "ReflowSVG mechanism not designed for this"); - NS_ABORT_IF_FALSE(GetType() != nsGkAtoms::svgOuterSVGFrame, - "Do not call on outer-"); + MOZ_ASSERT(GetType() != nsGkAtoms::svgOuterSVGFrame, + "Do not call on outer-"); if (!nsSVGUtils::NeedsReflowSVG(this)) { return; @@ -350,8 +350,8 @@ nsSVGDisplayContainerFrame::ReflowSVG() kid = kid->GetNextSibling()) { nsISVGChildFrame* SVGFrame = do_QueryFrame(kid); if (SVGFrame) { - NS_ABORT_IF_FALSE(!(kid->GetStateBits() & NS_FRAME_IS_NONDISPLAY), - "Check for this explicitly in the |if|, then"); + MOZ_ASSERT(!(kid->GetStateBits() & NS_FRAME_IS_NONDISPLAY), + "Check for this explicitly in the |if|, then"); kid->AddStateBits(mState & NS_FRAME_IS_DIRTY); SVGFrame->ReflowSVG(); @@ -381,11 +381,11 @@ nsSVGDisplayContainerFrame::ReflowSVG() // come from transforms, which are accounted for by nsDisplayTransform. // Note that we rely on |overflow:visible| to allow display list items to be // created for our children. - NS_ABORT_IF_FALSE(mContent->Tag() == nsGkAtoms::svg || - (mContent->Tag() == nsGkAtoms::use && - mRect.Size() == nsSize(0,0)) || - mRect.IsEqualEdges(nsRect()), - "Only inner-/ is expected to have mRect set"); + MOZ_ASSERT(mContent->Tag() == nsGkAtoms::svg || + (mContent->Tag() == nsGkAtoms::use && + mRect.Size() == nsSize(0,0)) || + mRect.IsEqualEdges(nsRect()), + "Only inner-/ is expected to have mRect set"); if (isFirstReflow) { // Make sure we have our filter property (if any) before calling @@ -405,8 +405,8 @@ nsSVGDisplayContainerFrame::ReflowSVG() void nsSVGDisplayContainerFrame::NotifySVGChanged(uint32_t aFlags) { - NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), - "Invalidation logic may need adjusting"); + MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), + "Invalidation logic may need adjusting"); nsSVGUtils::NotifyChildrenOfSVGChange(this, aFlags); } diff --git a/layout/svg/nsSVGEffects.cpp b/layout/svg/nsSVGEffects.cpp index 376e1e9c5fd..f91b2363e55 100644 --- a/layout/svg/nsSVGEffects.cpp +++ b/layout/svg/nsSVGEffects.cpp @@ -491,9 +491,9 @@ nsSVGMarkerProperty * nsSVGEffects::GetMarkerProperty(nsIURI *aURI, nsIFrame *aFrame, const FramePropertyDescriptor *aProp) { - NS_ABORT_IF_FALSE(aFrame->GetType() == nsGkAtoms::svgPathGeometryFrame && - static_cast(aFrame->GetContent())->IsMarkable(), - "Bad frame"); + MOZ_ASSERT(aFrame->GetType() == nsGkAtoms::svgPathGeometryFrame && + static_cast(aFrame->GetContent())->IsMarkable(), + "Bad frame"); return static_cast( GetEffectProperty(aURI, aFrame, aProp, CreateMarkerProperty)); } diff --git a/layout/svg/nsSVGFilterFrame.cpp b/layout/svg/nsSVGFilterFrame.cpp index 1fe8f3d2d47..74ac8c7ada7 100644 --- a/layout/svg/nsSVGFilterFrame.cpp +++ b/layout/svg/nsSVGFilterFrame.cpp @@ -36,7 +36,7 @@ public: MOZ_GUARD_OBJECT_NOTIFIER_INIT; // Reference loops should normally be detected in advance and handled, so // we're not expecting to encounter them here - NS_ABORT_IF_FALSE(!mFrame->mLoopFlag, "Undetected reference loop!"); + MOZ_ASSERT(!mFrame->mLoopFlag, "Undetected reference loop!"); mFrame->mLoopFlag = true; } ~AutoFilterReferencer() { diff --git a/layout/svg/nsSVGFilterInstance.cpp b/layout/svg/nsSVGFilterInstance.cpp index 0a7e3259340..0124753db01 100644 --- a/layout/svg/nsSVGFilterInstance.cpp +++ b/layout/svg/nsSVGFilterInstance.cpp @@ -76,8 +76,8 @@ nsSVGFilterInstance::ComputeBounds() // Set the user space bounds (i.e. the filter region in user space). nsSVGLength2 XYWH[4]; - NS_ABORT_IF_FALSE(sizeof(mFilterElement->mLengthAttributes) == sizeof(XYWH), - "XYWH size incorrect"); + static_assert(sizeof(mFilterElement->mLengthAttributes) == sizeof(XYWH), + "XYWH size incorrect"); memcpy(XYWH, mFilterElement->mLengthAttributes, sizeof(mFilterElement->mLengthAttributes)); XYWH[0] = *mFilterFrame->GetLengthValue(SVGFilterElement::ATTR_X); diff --git a/layout/svg/nsSVGForeignObjectFrame.cpp b/layout/svg/nsSVGForeignObjectFrame.cpp index 2b8a8b1cc05..734875b9c81 100644 --- a/layout/svg/nsSVGForeignObjectFrame.cpp +++ b/layout/svg/nsSVGForeignObjectFrame.cpp @@ -128,8 +128,8 @@ nsSVGForeignObjectFrame::Reflow(nsPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), - "Should not have been called"); + MOZ_ASSERT(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), + "Should not have been called"); // Only InvalidateAndScheduleBoundsUpdate marks us with NS_FRAME_IS_DIRTY, // so if that bit is still set we still have a resize pending. If we hit @@ -335,8 +335,8 @@ nsSVGForeignObjectFrame::ReflowSVG() NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this), "This call is probably a wasteful mistake"); - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), - "ReflowSVG mechanism not designed for this"); + MOZ_ASSERT(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), + "ReflowSVG mechanism not designed for this"); if (!nsSVGUtils::NeedsReflowSVG(this)) { return; @@ -394,8 +394,8 @@ nsSVGForeignObjectFrame::ReflowSVG() void nsSVGForeignObjectFrame::NotifySVGChanged(uint32_t aFlags) { - NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), - "Invalidation logic may need adjusting"); + MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), + "Invalidation logic may need adjusting"); bool needNewBounds = false; // i.e. mRect or visual overflow rect bool needReflow = false; diff --git a/layout/svg/nsSVGGFrame.cpp b/layout/svg/nsSVGGFrame.cpp index 3c4e7a7380f..0c23a7d2c57 100644 --- a/layout/svg/nsSVGGFrame.cpp +++ b/layout/svg/nsSVGGFrame.cpp @@ -53,8 +53,8 @@ nsSVGGFrame::GetType() const void nsSVGGFrame::NotifySVGChanged(uint32_t aFlags) { - NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), - "Invalidation logic may need adjusting"); + MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), + "Invalidation logic may need adjusting"); if (aFlags & TRANSFORM_CHANGED) { // make sure our cached transform matrix gets (lazily) updated diff --git a/layout/svg/nsSVGGradientFrame.cpp b/layout/svg/nsSVGGradientFrame.cpp index e27e4cbfc54..51cfe827c86 100644 --- a/layout/svg/nsSVGGradientFrame.cpp +++ b/layout/svg/nsSVGGradientFrame.cpp @@ -34,7 +34,7 @@ public: MOZ_GUARD_OBJECT_NOTIFIER_INIT; // Reference loops should normally be detected in advance and handled, so // we're not expecting to encounter them here - NS_ABORT_IF_FALSE(!mFrame->mLoopFlag, "Undetected reference loop!"); + MOZ_ASSERT(!mFrame->mLoopFlag, "Undetected reference loop!"); mFrame->mLoopFlag = true; } ~AutoGradientReferencer() { @@ -450,7 +450,7 @@ nsSVGLinearGradientFrame::GetLengthValue(uint32_t aIndex) static_cast(mContent)); // We passed in mContent as a fallback, so, assuming mContent is non-null, the // return value should also be non-null. - NS_ABORT_IF_FALSE(lengthElement, + MOZ_ASSERT(lengthElement, "Got unexpected null element from GetLinearGradientWithLength"); const nsSVGLength2 &length = lengthElement->mLengthAttributes[aIndex]; @@ -560,7 +560,7 @@ nsSVGRadialGradientFrame::GetLengthValue(uint32_t aIndex) static_cast(mContent)); // We passed in mContent as a fallback, so, assuming mContent is non-null, // the return value should also be non-null. - NS_ABORT_IF_FALSE(lengthElement, + MOZ_ASSERT(lengthElement, "Got unexpected null element from GetRadialGradientWithLength"); return GetLengthValueFromElement(aIndex, *lengthElement); } diff --git a/layout/svg/nsSVGImageFrame.cpp b/layout/svg/nsSVGImageFrame.cpp index b5bafc96586..ccd2bb45061 100644 --- a/layout/svg/nsSVGImageFrame.cpp +++ b/layout/svg/nsSVGImageFrame.cpp @@ -471,8 +471,8 @@ nsSVGImageFrame::ReflowSVG() NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this), "This call is probably a wasteful mistake"); - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), - "ReflowSVG mechanism not designed for this"); + MOZ_ASSERT(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), + "ReflowSVG mechanism not designed for this"); if (!nsSVGUtils::NeedsReflowSVG(this)) { return; diff --git a/layout/svg/nsSVGInnerSVGFrame.cpp b/layout/svg/nsSVGInnerSVGFrame.cpp index d1468023775..9be678fcda6 100644 --- a/layout/svg/nsSVGInnerSVGFrame.cpp +++ b/layout/svg/nsSVGInnerSVGFrame.cpp @@ -130,8 +130,8 @@ nsSVGInnerSVGFrame::ReflowSVG() void nsSVGInnerSVGFrame::NotifySVGChanged(uint32_t aFlags) { - NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), - "Invalidation logic may need adjusting"); + MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), + "Invalidation logic may need adjusting"); if (aFlags & COORD_CONTEXT_CHANGED) { diff --git a/layout/svg/nsSVGMarkerFrame.cpp b/layout/svg/nsSVGMarkerFrame.cpp index 11ead5a0e59..3f5fe80d406 100644 --- a/layout/svg/nsSVGMarkerFrame.cpp +++ b/layout/svg/nsSVGMarkerFrame.cpp @@ -265,8 +265,8 @@ nsSVGMarkerAnonChildFrame::Init(nsIContent* aContent, nsContainerFrame* aParent, nsIFrame* aPrevInFlow) { - NS_ABORT_IF_FALSE(aParent->GetType() == nsGkAtoms::svgMarkerFrame, - "Unexpected parent"); + MOZ_ASSERT(aParent->GetType() == nsGkAtoms::svgMarkerFrame, + "Unexpected parent"); nsSVGMarkerAnonChildFrameBase::Init(aContent, aParent, aPrevInFlow); } #endif diff --git a/layout/svg/nsSVGMarkerFrame.h b/layout/svg/nsSVGMarkerFrame.h index b751a684315..56e454477d0 100644 --- a/layout/svg/nsSVGMarkerFrame.h +++ b/layout/svg/nsSVGMarkerFrame.h @@ -76,10 +76,10 @@ public: virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE { // Any children must be added to our single anonymous inner frame kid. - NS_ABORT_IF_FALSE(GetFirstPrincipalChild() && - GetFirstPrincipalChild()->GetType() == - nsGkAtoms::svgMarkerAnonChildFrame, - "Where is our anonymous child?"); + MOZ_ASSERT(GetFirstPrincipalChild() && + GetFirstPrincipalChild()->GetType() == + nsGkAtoms::svgMarkerAnonChildFrame, + "Where is our anonymous child?"); return GetFirstPrincipalChild()->GetContentInsertionFrame(); } diff --git a/layout/svg/nsSVGOuterSVGFrame.cpp b/layout/svg/nsSVGOuterSVGFrame.cpp index c4a25a2b573..1526def6751 100644 --- a/layout/svg/nsSVGOuterSVGFrame.cpp +++ b/layout/svg/nsSVGOuterSVGFrame.cpp @@ -306,9 +306,8 @@ nsSVGOuterSVGFrame::ComputeSize(nsRenderingContext *aRenderingContext, nsSVGLength2 &width = content->mLengthAttributes[SVGSVGElement::ATTR_WIDTH]; if (width.IsPercentage()) { - NS_ABORT_IF_FALSE(intrinsicSize.width.GetUnit() == eStyleUnit_None, - "GetIntrinsicSize should have reported no " - "intrinsic width"); + MOZ_ASSERT(intrinsicSize.width.GetUnit() == eStyleUnit_None, + "GetIntrinsicSize should have reported no intrinsic width"); float val = width.GetAnimValInSpecifiedUnits() / 100.0f; if (val < 0.0f) val = 0.0f; intrinsicSize.width.SetCoordValue(val * cbSize.Width(aWM)); @@ -319,17 +318,16 @@ nsSVGOuterSVGFrame::ComputeSize(nsRenderingContext *aRenderingContext, NS_ASSERTION(aCBSize.BSize(aWM) != NS_AUTOHEIGHT, "root should not have auto-height containing block"); if (height.IsPercentage()) { - NS_ABORT_IF_FALSE(intrinsicSize.height.GetUnit() == eStyleUnit_None, - "GetIntrinsicSize should have reported no " - "intrinsic height"); + MOZ_ASSERT(intrinsicSize.height.GetUnit() == eStyleUnit_None, + "GetIntrinsicSize should have reported no intrinsic height"); float val = height.GetAnimValInSpecifiedUnits() / 100.0f; if (val < 0.0f) val = 0.0f; intrinsicSize.height.SetCoordValue(val * cbSize.Height(aWM)); } - NS_ABORT_IF_FALSE(intrinsicSize.height.GetUnit() == eStyleUnit_Coord && - intrinsicSize.width.GetUnit() == eStyleUnit_Coord, - "We should have just handled the only situation where" - "we lack an intrinsic height or width."); + MOZ_ASSERT(intrinsicSize.height.GetUnit() == eStyleUnit_Coord && + intrinsicSize.width.GetUnit() == eStyleUnit_Coord, + "We should have just handled the only situation where" + "we lack an intrinsic height or width."); } return nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(aWM, @@ -436,8 +434,9 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext, // including our anonymous wrapper kid: anonKid->AddStateBits(mState & NS_FRAME_IS_DIRTY); anonKid->ReflowSVG(); - NS_ABORT_IF_FALSE(!anonKid->GetNextSibling(), - "We should have one anonymous child frame wrapping our real children"); + MOZ_ASSERT(!anonKid->GetNextSibling(), + "We should have one anonymous child frame wrapping our real " + "children"); } mCallingReflowSVG = false; @@ -759,10 +758,10 @@ nsSVGOuterSVGFrame::GetType() const void nsSVGOuterSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags) { - NS_ABORT_IF_FALSE(aFlags && - !(aFlags & ~(COORD_CONTEXT_CHANGED | TRANSFORM_CHANGED | - FULL_ZOOM_CHANGED)), - "Unexpected aFlags value"); + MOZ_ASSERT(aFlags && + !(aFlags & ~(COORD_CONTEXT_CHANGED | TRANSFORM_CHANGED | + FULL_ZOOM_CHANGED)), + "Unexpected aFlags value"); // No point in doing anything when were not init'ed yet: if (!mViewportInitialized) { @@ -944,8 +943,8 @@ nsSVGOuterSVGAnonChildFrame::Init(nsIContent* aContent, nsContainerFrame* aParent, nsIFrame* aPrevInFlow) { - NS_ABORT_IF_FALSE(aParent->GetType() == nsGkAtoms::svgOuterSVGFrame, - "Unexpected parent"); + MOZ_ASSERT(aParent->GetType() == nsGkAtoms::svgOuterSVGFrame, + "Unexpected parent"); nsSVGOuterSVGAnonChildFrameBase::Init(aContent, aParent, aPrevInFlow); } #endif diff --git a/layout/svg/nsSVGOuterSVGFrame.h b/layout/svg/nsSVGOuterSVGFrame.h index a77577cd54a..90de7c525f6 100644 --- a/layout/svg/nsSVGOuterSVGFrame.h +++ b/layout/svg/nsSVGOuterSVGFrame.h @@ -96,10 +96,10 @@ public: virtual nsContainerFrame* GetContentInsertionFrame() MOZ_OVERRIDE { // Any children must be added to our single anonymous inner frame kid. - NS_ABORT_IF_FALSE(GetFirstPrincipalChild() && - GetFirstPrincipalChild()->GetType() == - nsGkAtoms::svgOuterSVGAnonChildFrame, - "Where is our anonymous child?"); + MOZ_ASSERT(GetFirstPrincipalChild() && + GetFirstPrincipalChild()->GetType() == + nsGkAtoms::svgOuterSVGAnonChildFrame, + "Where is our anonymous child?"); return GetFirstPrincipalChild()->GetContentInsertionFrame(); } diff --git a/layout/svg/nsSVGPathGeometryFrame.cpp b/layout/svg/nsSVGPathGeometryFrame.cpp index d038dd513b0..0f25b405c12 100644 --- a/layout/svg/nsSVGPathGeometryFrame.cpp +++ b/layout/svg/nsSVGPathGeometryFrame.cpp @@ -62,7 +62,7 @@ public: : nsDisplayItem(aBuilder, aFrame) { MOZ_COUNT_CTOR(nsDisplaySVGPathGeometry); - NS_ABORT_IF_FALSE(aFrame, "Must have a frame!"); + MOZ_ASSERT(aFrame, "Must have a frame!"); } #ifdef NS_BUILD_REFCNT_LOGGING virtual ~nsDisplaySVGPathGeometry() { @@ -360,8 +360,8 @@ nsSVGPathGeometryFrame::ReflowSVG() NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this), "This call is probably a wasteful mistake"); - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), - "ReflowSVG mechanism not designed for this"); + MOZ_ASSERT(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), + "ReflowSVG mechanism not designed for this"); if (!nsSVGUtils::NeedsReflowSVG(this)) { return; @@ -411,8 +411,8 @@ nsSVGPathGeometryFrame::ReflowSVG() void nsSVGPathGeometryFrame::NotifySVGChanged(uint32_t aFlags) { - NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), - "Invalidation logic may need adjusting"); + MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED), + "Invalidation logic may need adjusting"); // Changes to our ancestors may affect how we render when we are rendered as // part of our ancestor (specifically, if our coordinate context changes size diff --git a/layout/svg/nsSVGPatternFrame.cpp b/layout/svg/nsSVGPatternFrame.cpp index a6f2e63ac04..dc06cc019ca 100644 --- a/layout/svg/nsSVGPatternFrame.cpp +++ b/layout/svg/nsSVGPatternFrame.cpp @@ -42,7 +42,7 @@ public: MOZ_GUARD_OBJECT_NOTIFIER_INIT; // Reference loops should normally be detected in advance and handled, so // we're not expecting to encounter them here - NS_ABORT_IF_FALSE(!mFrame->mLoopFlag, "Undetected reference loop!"); + MOZ_ASSERT(!mFrame->mLoopFlag, "Undetected reference loop!"); mFrame->mLoopFlag = true; } ~AutoPatternReferencer() { diff --git a/layout/svg/nsSVGSwitchFrame.cpp b/layout/svg/nsSVGSwitchFrame.cpp index 59a9f421d61..dc150a19fbc 100644 --- a/layout/svg/nsSVGSwitchFrame.cpp +++ b/layout/svg/nsSVGSwitchFrame.cpp @@ -179,8 +179,8 @@ nsSVGSwitchFrame::ReflowSVG() NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this), "This call is probably a wasteful mistake"); - NS_ABORT_IF_FALSE(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), - "ReflowSVG mechanism not designed for this"); + MOZ_ASSERT(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY), + "ReflowSVG mechanism not designed for this"); if (!nsSVGUtils::NeedsReflowSVG(this)) { return; @@ -207,8 +207,8 @@ nsSVGSwitchFrame::ReflowSVG() nsIFrame *child = GetActiveChildFrame(); nsISVGChildFrame* svgChild = do_QueryFrame(child); if (svgChild) { - NS_ABORT_IF_FALSE(!(child->GetStateBits() & NS_FRAME_IS_NONDISPLAY), - "Check for this explicitly in the |if|, then"); + MOZ_ASSERT(!(child->GetStateBits() & NS_FRAME_IS_NONDISPLAY), + "Check for this explicitly in the |if|, then"); svgChild->ReflowSVG(); // We build up our child frame overflows here instead of using diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index 8b52e6af392..945763544b4 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -167,8 +167,8 @@ nsRect nsSVGUtils::GetPostFilterVisualOverflowRect(nsIFrame *aFrame, const nsRect &aPreFilterRect) { - NS_ABORT_IF_FALSE(aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT, - "Called on invalid frame type"); + MOZ_ASSERT(aFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT, + "Called on invalid frame type"); nsSVGFilterProperty *property = nsSVGEffects::GetFilterProperty(aFrame); if (!property || !property->ReferencesValidResources()) { @@ -200,8 +200,8 @@ nsSVGUtils::AnyOuterSVGIsCallingReflowSVG(nsIFrame* aFrame) void nsSVGUtils::ScheduleReflowSVG(nsIFrame *aFrame) { - NS_ABORT_IF_FALSE(aFrame->IsFrameOfType(nsIFrame::eSVG), - "Passed bad frame!"); + MOZ_ASSERT(aFrame->IsFrameOfType(nsIFrame::eSVG), + "Passed bad frame!"); // If this is triggered, the callers should be fixed to call us before // ReflowSVG is called. If we try to mark dirty bits on frames while we're @@ -242,15 +242,15 @@ nsSVGUtils::ScheduleReflowSVG(nsIFrame *aFrame) } f->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN); f = f->GetParent(); - NS_ABORT_IF_FALSE(f->IsFrameOfType(nsIFrame::eSVG), - "NS_STATE_IS_OUTER_SVG check above not valid!"); + MOZ_ASSERT(f->IsFrameOfType(nsIFrame::eSVG), + "NS_STATE_IS_OUTER_SVG check above not valid!"); } outerSVGFrame = static_cast(f); - NS_ABORT_IF_FALSE(outerSVGFrame && - outerSVGFrame->GetType() == nsGkAtoms::svgOuterSVGFrame, - "Did not find nsSVGOuterSVGFrame!"); + MOZ_ASSERT(outerSVGFrame && + outerSVGFrame->GetType() == nsGkAtoms::svgOuterSVGFrame, + "Did not find nsSVGOuterSVGFrame!"); } if (outerSVGFrame->GetStateBits() & NS_FRAME_IN_REFLOW) { @@ -270,8 +270,8 @@ nsSVGUtils::ScheduleReflowSVG(nsIFrame *aFrame) bool nsSVGUtils::NeedsReflowSVG(nsIFrame *aFrame) { - NS_ABORT_IF_FALSE(aFrame->IsFrameOfType(nsIFrame::eSVG), - "SVG uses bits differently!"); + MOZ_ASSERT(aFrame->IsFrameOfType(nsIFrame::eSVG), + "SVG uses bits differently!"); // The flags we test here may change, hence why we have this separate // function. @@ -281,8 +281,8 @@ nsSVGUtils::NeedsReflowSVG(nsIFrame *aFrame) void nsSVGUtils::NotifyAncestorsOfFilterRegionChange(nsIFrame *aFrame) { - NS_ABORT_IF_FALSE(!(aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG), - "Not expecting to be called on the outer SVG Frame"); + MOZ_ASSERT(!(aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG), + "Not expecting to be called on the outer SVG Frame"); aFrame = aFrame->GetParent(); @@ -911,7 +911,7 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags) // needs investigation to check that we won't break too much content. // NOTE: When changing this to apply to other frame types, make sure to // also update nsSVGUtils::FrameSpaceInCSSPxToUserSpaceOffset. - NS_ABORT_IF_FALSE(content->IsSVG(), "bad cast"); + MOZ_ASSERT(content->IsSVG(), "bad cast"); nsSVGElement *element = static_cast(content); matrix = element->PrependLocalTransformsTo(matrix, nsSVGElement::eChildToUserSpace); @@ -1114,7 +1114,7 @@ nsSVGUtils::GetNonScalingStrokeTransform(nsIFrame *aFrame, } nsIContent *content = aFrame->GetContent(); - NS_ABORT_IF_FALSE(content->IsSVG(), "bad cast"); + MOZ_ASSERT(content->IsSVG(), "bad cast"); *aUserToOuterSVG = ThebesMatrix(SVGContentUtils::GetCTM( static_cast(content), true)); diff --git a/layout/tables/nsCellMap.cpp b/layout/tables/nsCellMap.cpp index 2c39886c3fe..7ffdb4717b4 100644 --- a/layout/tables/nsCellMap.cpp +++ b/layout/tables/nsCellMap.cpp @@ -1172,7 +1172,7 @@ nsCellMap::~nsCellMap() void nsCellMap::Init() { - NS_ABORT_IF_FALSE(!sEmptyRow, "How did that happen?"); + MOZ_ASSERT(!sEmptyRow, "How did that happen?"); sEmptyRow = new nsCellMap::CellDataArray(); } @@ -2898,8 +2898,8 @@ nsCellMapColumnIterator::GetNextFrame(int32_t* aRow, int32_t* aColSpan) ++mFoundCells; - NS_ABORT_IF_FALSE(cellData == mMap->GetDataAt(*aRow, mCol), - "Giving caller bogus row?"); + MOZ_ASSERT(cellData == mMap->GetDataAt(*aRow, mCol), + "Giving caller bogus row?"); return cellFrame; } diff --git a/media/mtransport/transportlayer.h b/media/mtransport/transportlayer.h index d85bfc0d265..85afad7fd9a 100644 --- a/media/mtransport/transportlayer.h +++ b/media/mtransport/transportlayer.h @@ -91,7 +91,7 @@ class TransportLayer : public sigslot::has_slots<> { virtual void SetState(State state, const char *file, unsigned line); // Check if we are on the right thread void CheckThread() const { - NS_ABORT_IF_FALSE(CheckThreadInt(), "Wrong thread"); + MOZ_ASSERT(CheckThreadInt(), "Wrong thread"); } State state_; diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h index e82a2a725ed..9b75587a7fc 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.h @@ -618,7 +618,7 @@ private: nsresult CloseInt(); nsresult CheckApiState(bool assert_ice_ready) const; void CheckThread() const { - NS_ABORT_IF_FALSE(CheckThreadInt(), "Wrong thread"); + MOZ_ASSERT(CheckThreadInt(), "Wrong thread"); } bool CheckThreadInt() const { #ifdef MOZILLA_INTERNAL_API diff --git a/modules/libjar/nsJARInputStream.cpp b/modules/libjar/nsJARInputStream.cpp index 62d24d7edd6..d191aeafdd7 100644 --- a/modules/libjar/nsJARInputStream.cpp +++ b/modules/libjar/nsJARInputStream.cpp @@ -32,8 +32,8 @@ nsresult nsJARInputStream::InitFile(nsJAR *aJar, nsZipItem *item) { nsresult rv = NS_OK; - NS_ABORT_IF_FALSE(aJar, "Argument may not be null"); - NS_ABORT_IF_FALSE(item, "Argument may not be null"); + MOZ_ASSERT(aJar, "Argument may not be null"); + MOZ_ASSERT(item, "Argument may not be null"); // Mark it as closed, in case something fails in initialisation mMode = MODE_CLOSED; @@ -72,8 +72,8 @@ nsJARInputStream::InitDirectory(nsJAR* aJar, const nsACString& aJarDirSpec, const char* aDir) { - NS_ABORT_IF_FALSE(aJar, "Argument may not be null"); - NS_ABORT_IF_FALSE(aDir, "Argument may not be null"); + MOZ_ASSERT(aJar, "Argument may not be null"); + MOZ_ASSERT(aDir, "Argument may not be null"); // Mark it as closed, in case something fails in initialisation mMode = MODE_CLOSED; diff --git a/netwerk/base/ProxyAutoConfig.cpp b/netwerk/base/ProxyAutoConfig.cpp index 49777733d4d..fa7d45cecff 100644 --- a/netwerk/base/ProxyAutoConfig.cpp +++ b/netwerk/base/ProxyAutoConfig.cpp @@ -640,7 +640,7 @@ nsresult ProxyAutoConfig::SetupJS() { mJSNeedsSetup = false; - NS_ABORT_IF_FALSE(!GetRunning(), "JIT is running"); + MOZ_ASSERT(!GetRunning(), "JIT is running"); delete mJSRuntime; mJSRuntime = nullptr; @@ -768,7 +768,7 @@ ProxyAutoConfig::~ProxyAutoConfig() void ProxyAutoConfig::Shutdown() { - NS_ABORT_IF_FALSE(!NS_IsMainThread(), "wrong thread for shutdown"); + MOZ_ASSERT(!NS_IsMainThread(), "wrong thread for shutdown"); if (GetRunning() || mShutdown) return; diff --git a/netwerk/base/nsPACMan.cpp b/netwerk/base/nsPACMan.cpp index 3615a9bb641..67f9de158d1 100644 --- a/netwerk/base/nsPACMan.cpp +++ b/netwerk/base/nsPACMan.cpp @@ -104,7 +104,7 @@ public: NS_IMETHODIMP Run() { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(NS_IsMainThread(), "wrong thread"); mThread->Shutdown(); return NS_OK; } @@ -125,7 +125,7 @@ public: NS_IMETHODIMP Run() { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(NS_IsMainThread(), "wrong thread"); if (mPACMan->mPACThread) { mPACMan->mPACThread->Shutdown(); mPACMan->mPACThread = nullptr; @@ -153,7 +153,7 @@ public: NS_IMETHODIMP Run() { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(NS_IsMainThread(), "wrong thread"); mPACMan->mLoader = nullptr; mPACMan->PostProcessPendingQ(); return NS_OK; @@ -194,7 +194,7 @@ public: NS_IMETHODIMP Run() { - NS_ABORT_IF_FALSE(!NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(!NS_IsMainThread(), "wrong thread"); if (mCancel) { mPACMan->CancelPendingQ(mCancelStatus); mCancel = false; @@ -272,7 +272,7 @@ PendingPACQuery::UseAlternatePACFile(const nsCString &pacURL) NS_IMETHODIMP PendingPACQuery::Run() { - NS_ABORT_IF_FALSE(!NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(!NS_IsMainThread(), "wrong thread"); mPACMan->PostQuery(this); return NS_OK; } @@ -288,7 +288,7 @@ nsPACMan::nsPACMan() , mLoadFailureCount(0) , mInProgress(false) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "pacman must be created on main thread"); + MOZ_ASSERT(NS_IsMainThread(), "pacman must be created on main thread"); if (!sThreadLocalSetup){ sThreadLocalSetup = true; PR_NewThreadPrivateIndex(&sThreadLocalIndex, nullptr); @@ -315,7 +315,7 @@ nsPACMan::~nsPACMan() void nsPACMan::Shutdown() { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "pacman must be shutdown on main thread"); + MOZ_ASSERT(NS_IsMainThread(), "pacman must be shutdown on main thread"); if (mShutdown) { return; } @@ -331,7 +331,7 @@ nsresult nsPACMan::AsyncGetProxyForURI(nsIURI *uri, nsPACManCallback *callback, bool mainThreadResponse) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(NS_IsMainThread(), "wrong thread"); if (mShutdown) return NS_ERROR_NOT_AVAILABLE; @@ -355,7 +355,7 @@ nsPACMan::AsyncGetProxyForURI(nsIURI *uri, nsPACManCallback *callback, nsresult nsPACMan::PostQuery(PendingPACQuery *query) { - NS_ABORT_IF_FALSE(!NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(!NS_IsMainThread(), "wrong thread"); if (mShutdown) { query->Complete(NS_ERROR_NOT_AVAILABLE, EmptyCString()); @@ -412,7 +412,7 @@ nsPACMan::LoadPACFromURI(const nsCString &spec) void nsPACMan::StartLoading() { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(NS_IsMainThread(), "wrong thread"); mLoadPending = false; // CancelExistingLoad was called... @@ -493,7 +493,7 @@ nsPACMan::CancelExistingLoad() void nsPACMan::PostProcessPendingQ() { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(NS_IsMainThread(), "wrong thread"); nsRefPtr pending = new ExecutePACThreadAction(this); if (mPACThread) @@ -503,7 +503,7 @@ nsPACMan::PostProcessPendingQ() void nsPACMan::PostCancelPendingQ(nsresult status) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(NS_IsMainThread(), "wrong thread"); nsRefPtr pending = new ExecutePACThreadAction(this); pending->CancelQueue(status); @@ -514,7 +514,7 @@ nsPACMan::PostCancelPendingQ(nsresult status) void nsPACMan::CancelPendingQ(nsresult status) { - NS_ABORT_IF_FALSE(!NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(!NS_IsMainThread(), "wrong thread"); nsRefPtr query; while (!mPendingQ.isEmpty()) { @@ -529,7 +529,7 @@ nsPACMan::CancelPendingQ(nsresult status) void nsPACMan::ProcessPendingQ() { - NS_ABORT_IF_FALSE(!NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(!NS_IsMainThread(), "wrong thread"); while (ProcessPending()); if (mShutdown) { @@ -604,7 +604,7 @@ nsPACMan::OnStreamComplete(nsIStreamLoader *loader, uint32_t dataLen, const uint8_t *data) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(NS_IsMainThread(), "wrong thread"); if (mLoader != loader) { // If this happens, then it means that LoadPACFromURI was called more // than once before the initial call completed. In this case, status @@ -687,7 +687,7 @@ nsPACMan::AsyncOnChannelRedirect(nsIChannel *oldChannel, nsIChannel *newChannel, uint32_t flags, nsIAsyncVerifyRedirectCallback *callback) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(NS_IsMainThread(), "wrong thread"); nsresult rv = NS_OK; nsCOMPtr pacURI; @@ -714,7 +714,7 @@ nsPACMan::AsyncOnChannelRedirect(nsIChannel *oldChannel, nsIChannel *newChannel, void nsPACMan::NamePACThread() { - NS_ABORT_IF_FALSE(!NS_IsMainThread(), "wrong thread"); + MOZ_ASSERT(!NS_IsMainThread(), "wrong thread"); PR_SetCurrentThreadName("Proxy Resolution"); #ifdef MOZ_NUWA_PROCESS if (IsNuwaProcess()) { diff --git a/netwerk/base/nsSimpleURI.cpp b/netwerk/base/nsSimpleURI.cpp index 1139b41de64..2a8e1ede1cf 100644 --- a/netwerk/base/nsSimpleURI.cpp +++ b/netwerk/base/nsSimpleURI.cpp @@ -169,7 +169,7 @@ nsSimpleURI::GetSpec(nsACString &result) if (mIsRefValid) { result += NS_LITERAL_CSTRING("#") + mRef; } else { - NS_ABORT_IF_FALSE(mRef.IsEmpty(), "mIsRefValid/mRef invariant broken"); + MOZ_ASSERT(mRef.IsEmpty(), "mIsRefValid/mRef invariant broken"); } return NS_OK; } @@ -375,7 +375,7 @@ NS_IMETHODIMP nsSimpleURI::GetRef(nsACString &result) { if (!mIsRefValid) { - NS_ABORT_IF_FALSE(mRef.IsEmpty(), "mIsRefValid/mRef invariant broken"); + MOZ_ASSERT(mRef.IsEmpty(), "mIsRefValid/mRef invariant broken"); result.Truncate(); } else { result = mRef; diff --git a/netwerk/base/nsSocketTransport2.cpp b/netwerk/base/nsSocketTransport2.cpp index b54990f8219..24944b7d7f1 100644 --- a/netwerk/base/nsSocketTransport2.cpp +++ b/netwerk/base/nsSocketTransport2.cpp @@ -1001,8 +1001,8 @@ nsSocketTransport::ResolveHost() if (!mProxyHost.IsEmpty()) { if (!mProxyTransparent || mProxyTransparentResolvesHost) { #if defined(XP_UNIX) - NS_ABORT_IF_FALSE(!mNetAddrIsSet || mNetAddr.raw.family != AF_LOCAL, - "Unix domain sockets can't be used with proxies"); + MOZ_ASSERT(!mNetAddrIsSet || mNetAddr.raw.family != AF_LOCAL, + "Unix domain sockets can't be used with proxies"); #endif // When not resolving mHost locally, we still want to ensure that // it only contains valid characters. See bug 304904 for details. @@ -1072,8 +1072,8 @@ nsSocketTransport::BuildSocket(PRFileDesc *&fd, bool &proxyTransparent, bool &us } else { #if defined(XP_UNIX) - NS_ABORT_IF_FALSE(!mNetAddrIsSet || mNetAddr.raw.family != AF_LOCAL, - "Unix domain sockets can't be used with socket types"); + MOZ_ASSERT(!mNetAddrIsSet || mNetAddr.raw.family != AF_LOCAL, + "Unix domain sockets can't be used with socket types"); #endif fd = nullptr; diff --git a/netwerk/base/nsSocketTransportService2.cpp b/netwerk/base/nsSocketTransportService2.cpp index 9b9d46c8bcb..2bdc7b8e55b 100644 --- a/netwerk/base/nsSocketTransportService2.cpp +++ b/netwerk/base/nsSocketTransportService2.cpp @@ -180,8 +180,8 @@ nsresult nsSocketTransportService::DetachSocket(SocketContext *listHead, SocketContext *sock) { SOCKET_LOG(("nsSocketTransportService::DetachSocket [handler=%p]\n", sock->mHandler)); - NS_ABORT_IF_FALSE((listHead == mActiveList) || (listHead == mIdleList), - "DetachSocket invalid head"); + MOZ_ASSERT((listHead == mActiveList) || (listHead == mIdleList), + "DetachSocket invalid head"); // inform the handler that this socket is going away sock->mHandler->OnSocketDetached(sock->mFD); @@ -213,8 +213,8 @@ nsSocketTransportService::DetachSocket(SocketContext *listHead, SocketContext *s nsresult nsSocketTransportService::AddToPollList(SocketContext *sock) { - NS_ABORT_IF_FALSE(!(((uint32_t)(sock - mActiveList)) < mActiveListSize), - "AddToPollList Socket Already Active"); + MOZ_ASSERT(!(static_cast(sock - mActiveList) < mActiveListSize), + "AddToPollList Socket Already Active"); SOCKET_LOG(("nsSocketTransportService::AddToPollList [handler=%p]\n", sock->mHandler)); if (mActiveCount == mActiveListSize) { @@ -250,7 +250,7 @@ nsSocketTransportService::RemoveFromPollList(SocketContext *sock) SOCKET_LOG(("nsSocketTransportService::RemoveFromPollList [handler=%p]\n", sock->mHandler)); uint32_t index = sock - mActiveList; - NS_ABORT_IF_FALSE(index < mActiveListSize, "invalid index"); + MOZ_ASSERT(index < mActiveListSize, "invalid index"); SOCKET_LOG((" index=%u mActiveCount=%u\n", index, mActiveCount)); @@ -266,8 +266,8 @@ nsSocketTransportService::RemoveFromPollList(SocketContext *sock) nsresult nsSocketTransportService::AddToIdleList(SocketContext *sock) { - NS_ABORT_IF_FALSE(!(((uint32_t)(sock - mIdleList)) < mIdleListSize), - "AddToIdlelList Socket Already Idle"); + MOZ_ASSERT(!(static_cast(sock - mIdleList) < mIdleListSize), + "AddToIdlelList Socket Already Idle"); SOCKET_LOG(("nsSocketTransportService::AddToIdleList [handler=%p]\n", sock->mHandler)); if (mIdleCount == mIdleListSize) { diff --git a/netwerk/base/nsStandardURL.cpp b/netwerk/base/nsStandardURL.cpp index d21e25e8c35..40a318928e4 100644 --- a/netwerk/base/nsStandardURL.cpp +++ b/netwerk/base/nsStandardURL.cpp @@ -534,7 +534,7 @@ nsStandardURL::BuildNormalizedSpec(const char *spec) if (mPassword.mLen >= 0) approxLen += 1 + encoder.EncodeSegmentCount(spec, mPassword, esc_Password, encPassword, useEncPassword); // mHost is handled differently below due to encoding differences - NS_ABORT_IF_FALSE(mPort >= -1, "Invalid negative mPort"); + MOZ_ASSERT(mPort >= -1, "Invalid negative mPort"); if (mPort != -1 && mPort != mDefaultPort) { // :port @@ -615,7 +615,7 @@ nsStandardURL::BuildNormalizedSpec(const char *spec) if (mHost.mLen > 0) { i = AppendSegmentToBuf(buf, i, spec, mHost, &encHost, useEncHost); net_ToLowerCase(buf + mHost.mPos, mHost.mLen); - NS_ABORT_IF_FALSE(mPort >= -1, "Invalid negative mPort"); + MOZ_ASSERT(mPort >= -1, "Invalid negative mPort"); if (mPort != -1 && mPort != mDefaultPort) { buf[i++] = ':'; // Already formatted while building approxLen diff --git a/netwerk/base/nsUnicharStreamLoader.cpp b/netwerk/base/nsUnicharStreamLoader.cpp index 383bed9d0df..8e4c2c1d23e 100644 --- a/netwerk/base/nsUnicharStreamLoader.cpp +++ b/netwerk/base/nsUnicharStreamLoader.cpp @@ -87,8 +87,8 @@ nsUnicharStreamLoader::OnStopRequest(nsIRequest *aRequest, nsresult rv = NS_OK; if (mRawData.Length() > 0 && NS_SUCCEEDED(aStatus)) { - NS_ABORT_IF_FALSE(mBuffer.Length() == 0, - "should not have both decoded and raw data"); + MOZ_ASSERT(mBuffer.Length() == 0, + "should not have both decoded and raw data"); rv = DetermineCharset(); } @@ -152,7 +152,7 @@ nsUnicharStreamLoader::OnDataAvailable(nsIRequest *aRequest, aInputStream->ReadSegments(WriteSegmentFun, this, aCount - n, &dummy); } } else { - NS_ABORT_IF_FALSE(n == aCount, "didn't read as much as was available"); + MOZ_ASSERT(n == aCount, "didn't read as much as was available"); } } } diff --git a/netwerk/cache/nsCacheMetaData.cpp b/netwerk/cache/nsCacheMetaData.cpp index d7dc37a32e7..71025ad96f8 100644 --- a/netwerk/cache/nsCacheMetaData.cpp +++ b/netwerk/cache/nsCacheMetaData.cpp @@ -16,14 +16,14 @@ nsCacheMetaData::GetElement(const char * key) while (data < limit) { // Point to the value part const char * value = data + strlen(data) + 1; - NS_ABORT_IF_FALSE(value < limit, "Cache Metadata corrupted"); + MOZ_ASSERT(value < limit, "Cache Metadata corrupted"); if (strcmp(data, key) == 0) return value; // Skip value part data = value + strlen(value) + 1; } - NS_ABORT_IF_FALSE(data == limit, "Metadata corrupted"); + MOZ_ASSERT(data == limit, "Metadata corrupted"); return nullptr; } @@ -134,7 +134,7 @@ nsCacheMetaData::VisitElements(nsICacheMetaDataVisitor * visitor) const char * key = data; // Skip key part data += strlen(data) + 1; - NS_ABORT_IF_FALSE(data < limit, "Metadata corrupted"); + MOZ_ASSERT(data < limit, "Metadata corrupted"); bool keepGoing; nsresult rv = visitor->VisitMetaDataElement(key, data, &keepGoing); if (NS_FAILED(rv) || !keepGoing) @@ -143,7 +143,7 @@ nsCacheMetaData::VisitElements(nsICacheMetaDataVisitor * visitor) // Skip value part data += strlen(data) + 1; } - NS_ABORT_IF_FALSE(data == limit, "Metadata corrupted"); + MOZ_ASSERT(data == limit, "Metadata corrupted"); return NS_OK; } diff --git a/netwerk/ipc/ChannelEventQueue.h b/netwerk/ipc/ChannelEventQueue.h index d7ec87349e0..c7972455f8d 100644 --- a/netwerk/ipc/ChannelEventQueue.h +++ b/netwerk/ipc/ChannelEventQueue.h @@ -105,8 +105,8 @@ ChannelEventQueue::ShouldEnqueue() { bool answer = mForced || mSuspended || mFlushing; - NS_ABORT_IF_FALSE(answer == true || mEventQueue.IsEmpty(), - "Should always enqueue if ChannelEventQueue not empty"); + MOZ_ASSERT(answer == true || mEventQueue.IsEmpty(), + "Should always enqueue if ChannelEventQueue not empty"); return answer; } diff --git a/netwerk/ipc/NeckoChild.cpp b/netwerk/ipc/NeckoChild.cpp index 3162414c173..76e72c109f2 100644 --- a/netwerk/ipc/NeckoChild.cpp +++ b/netwerk/ipc/NeckoChild.cpp @@ -48,7 +48,7 @@ NeckoChild::~NeckoChild() void NeckoChild::InitNeckoChild() { - NS_ABORT_IF_FALSE(IsNeckoChild(), "InitNeckoChild called by non-child!"); + MOZ_ASSERT(IsNeckoChild(), "InitNeckoChild called by non-child!"); if (!gNeckoChild) { mozilla::dom::ContentChild * cpc = @@ -63,9 +63,9 @@ void NeckoChild::InitNeckoChild() // automatically destroyed at exit. void NeckoChild::DestroyNeckoChild() { - NS_ABORT_IF_FALSE(IsNeckoChild(), "DestroyNeckoChild called by non-child!"); + MOZ_ASSERT(IsNeckoChild(), "DestroyNeckoChild called by non-child!"); static bool alreadyDestroyed = false; - NS_ABORT_IF_FALSE(!alreadyDestroyed, "DestroyNeckoChild already called!"); + MOZ_ASSERT(!alreadyDestroyed, "DestroyNeckoChild already called!"); if (!alreadyDestroyed) { Send__delete__(gNeckoChild); @@ -88,7 +88,7 @@ NeckoChild::AllocPHttpChannelChild(const PBrowserOrId& browser, bool NeckoChild::DeallocPHttpChannelChild(PHttpChannelChild* channel) { - NS_ABORT_IF_FALSE(IsNeckoChild(), "DeallocPHttpChannelChild called by non-child!"); + MOZ_ASSERT(IsNeckoChild(), "DeallocPHttpChannelChild called by non-child!"); HttpChannelChild* child = static_cast(channel); child->ReleaseIPDLReference(); @@ -108,7 +108,7 @@ NeckoChild::AllocPFTPChannelChild(const PBrowserOrId& aBrowser, bool NeckoChild::DeallocPFTPChannelChild(PFTPChannelChild* channel) { - NS_ABORT_IF_FALSE(IsNeckoChild(), "DeallocPFTPChannelChild called by non-child!"); + MOZ_ASSERT(IsNeckoChild(), "DeallocPFTPChannelChild called by non-child!"); FTPChannelChild* child = static_cast(channel); child->ReleaseIPDLReference(); @@ -144,7 +144,7 @@ NeckoChild::AllocPWyciwygChannelChild() bool NeckoChild::DeallocPWyciwygChannelChild(PWyciwygChannelChild* channel) { - NS_ABORT_IF_FALSE(IsNeckoChild(), "DeallocPWyciwygChannelChild called by non-child!"); + MOZ_ASSERT(IsNeckoChild(), "DeallocPWyciwygChannelChild called by non-child!"); WyciwygChannelChild *p = static_cast(channel); p->ReleaseIPDLReference(); diff --git a/netwerk/protocol/ftp/FTPChannelChild.cpp b/netwerk/protocol/ftp/FTPChannelChild.cpp index 88434cfbbf6..ed387705007 100644 --- a/netwerk/protocol/ftp/FTPChannelChild.cpp +++ b/netwerk/protocol/ftp/FTPChannelChild.cpp @@ -59,7 +59,7 @@ FTPChannelChild::~FTPChannelChild() void FTPChannelChild::AddIPDLReference() { - NS_ABORT_IF_FALSE(!mIPCOpen, "Attempt to retain more than one IPDL reference"); + MOZ_ASSERT(!mIPCOpen, "Attempt to retain more than one IPDL reference"); mIPCOpen = true; AddRef(); } @@ -67,7 +67,7 @@ FTPChannelChild::AddIPDLReference() void FTPChannelChild::ReleaseIPDLReference() { - NS_ABORT_IF_FALSE(mIPCOpen, "Attempt to release nonexistent IPDL reference"); + MOZ_ASSERT(mIPCOpen, "Attempt to release nonexistent IPDL reference"); mIPCOpen = false; Release(); } diff --git a/netwerk/protocol/rtsp/RtspChannelChild.cpp b/netwerk/protocol/rtsp/RtspChannelChild.cpp index e06e0b1ccb1..8454d9466c1 100644 --- a/netwerk/protocol/rtsp/RtspChannelChild.cpp +++ b/netwerk/protocol/rtsp/RtspChannelChild.cpp @@ -47,8 +47,8 @@ RtspChannelChild::ReleaseController() void RtspChannelChild::AddIPDLReference() { - NS_ABORT_IF_FALSE(!mIPCOpen, - "Attempt to retain more than one IPDL reference"); + MOZ_ASSERT(!mIPCOpen, + "Attempt to retain more than one IPDL reference"); mIPCOpen = true; AddRef(); } @@ -56,7 +56,7 @@ RtspChannelChild::AddIPDLReference() void RtspChannelChild::ReleaseIPDLReference() { - NS_ABORT_IF_FALSE(mIPCOpen, "Attempt to release nonexistent IPDL reference"); + MOZ_ASSERT(mIPCOpen, "Attempt to release nonexistent IPDL reference"); mIPCOpen = false; Release(); } diff --git a/netwerk/protocol/rtsp/controller/RtspControllerChild.cpp b/netwerk/protocol/rtsp/controller/RtspControllerChild.cpp index 9655e46c259..22db4625146 100644 --- a/netwerk/protocol/rtsp/controller/RtspControllerChild.cpp +++ b/netwerk/protocol/rtsp/controller/RtspControllerChild.cpp @@ -219,8 +219,8 @@ RtspControllerChild::RecvAsyncOpenFailed(const nsresult& reason) void RtspControllerChild::AddIPDLReference() { - NS_ABORT_IF_FALSE(!mIPCOpen, - "Attempt to retain more than one IPDL reference"); + MOZ_ASSERT(!mIPCOpen, + "Attempt to retain more than one IPDL reference"); mIPCOpen = true; AllowIPC(); AddRef(); @@ -229,7 +229,7 @@ RtspControllerChild::AddIPDLReference() void RtspControllerChild::ReleaseIPDLReference() { - NS_ABORT_IF_FALSE(mIPCOpen, "Attempt to release nonexistent IPDL reference"); + MOZ_ASSERT(mIPCOpen, "Attempt to release nonexistent IPDL reference"); mIPCOpen = false; DisallowIPC(); Release(); diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index 0187ffbb2a5..cf542f29bac 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -338,7 +338,7 @@ public: // delay/queue the connection (returns false) static void ConditionallyConnect(WebSocketChannel *ws) { - NS_ABORT_IF_FALSE(ws->mConnecting == NOT_CONNECTING, "opening state"); + MOZ_ASSERT(ws->mConnecting == NOT_CONNECTING, "opening state"); StaticMutexAutoLock lock(sLock); if (!sManager) { @@ -362,8 +362,8 @@ public: static void OnConnected(WebSocketChannel *aChannel) { - NS_ABORT_IF_FALSE(aChannel->mConnecting == CONNECTING_IN_PROGRESS, - "Channel completed connect, but not connecting?"); + MOZ_ASSERT(aChannel->mConnecting == CONNECTING_IN_PROGRESS, + "Channel completed connect, but not connecting?"); StaticMutexAutoLock lock(sLock); if (!sManager) { @@ -418,9 +418,9 @@ public: if (aChannel->mConnecting) { // Only way a connecting channel may get here w/o failing is if it was // closed with GOING_AWAY (1001) because of navigation, tab close, etc. - NS_ABORT_IF_FALSE(NS_FAILED(aReason) || - aChannel->mScriptCloseCode == CLOSE_GOING_AWAY, - "websocket closed while connecting w/o failing?"); + MOZ_ASSERT(NS_FAILED(aReason) || + aChannel->mScriptCloseCode == CLOSE_GOING_AWAY, + "websocket closed while connecting w/o failing?"); sManager->RemoveFromQueue(aChannel); @@ -489,8 +489,8 @@ private: if (index >= 0) { WebSocketChannel *chan = mQueue[index]->mChannel; - NS_ABORT_IF_FALSE(chan->mConnecting == CONNECTING_QUEUED, - "transaction not queued but in queue"); + MOZ_ASSERT(chan->mConnecting == CONNECTING_QUEUED, + "transaction not queued but in queue"); LOG(("WebSocket: ConnectNext: found channel [this=%p] in queue", chan)); mFailures.DelayOrBegin(chan); @@ -500,7 +500,7 @@ private: void RemoveFromQueue(WebSocketChannel *aChannel) { int32_t index = IndexOf(aChannel); - NS_ABORT_IF_FALSE(index >= 0, "connection to remove not in queue"); + MOZ_ASSERT(index >= 0, "connection to remove not in queue"); if (index >= 0) { nsOpenConn *olddata = mQueue[index]; mQueue.RemoveElementAt(index); @@ -981,20 +981,20 @@ public: int32_t OrigLength() const { return mDeflated ? mOrigLength : mLength; } uint8_t* BeginWriting() { - NS_ABORT_IF_FALSE(mMsgType != kMsgTypeStream, - "Stream should have been converted to string by now"); + MOZ_ASSERT(mMsgType != kMsgTypeStream, + "Stream should have been converted to string by now"); return (uint8_t *)(mMsg.pString ? mMsg.pString->BeginWriting() : nullptr); } uint8_t* BeginReading() { - NS_ABORT_IF_FALSE(mMsgType != kMsgTypeStream, - "Stream should have been converted to string by now"); + MOZ_ASSERT(mMsgType != kMsgTypeStream, + "Stream should have been converted to string by now"); return (uint8_t *)(mMsg.pString ? mMsg.pString->BeginReading() : nullptr); } nsresult ConvertStreamToString() { - NS_ABORT_IF_FALSE(mMsgType == kMsgTypeStream, "Not a stream!"); + MOZ_ASSERT(mMsgType == kMsgTypeStream, "Not a stream!"); #ifdef DEBUG // Make sure we got correct length from Blob @@ -1018,8 +1018,8 @@ public: bool DeflatePayload(PMCECompression *aCompressor) { - NS_ABORT_IF_FALSE(mMsgType != kMsgTypeStream, - "Stream should have been converted to string by now"); + MOZ_ASSERT(mMsgType != kMsgTypeStream, + "Stream should have been converted to string by now"); MOZ_ASSERT(!mDeflated); nsresult rv; @@ -1142,7 +1142,7 @@ WebSocketChannel::WebSocketChannel() : mCountSent(0), mAppId(NECKO_NO_APP_ID) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); LOG(("WebSocketChannel::WebSocketChannel() %p\n", this)); @@ -1381,9 +1381,9 @@ WebSocketChannel::UpdateReadBuffer(uint8_t *buffer, uint32_t count, if (!mBuffered) mFramePtr = mBuffer; - NS_ABORT_IF_FALSE(IsPersistentFramePtr(), "update read buffer bad mFramePtr"); - NS_ABORT_IF_FALSE(mFramePtr - accumulatedFragments >= mBuffer, - "reserved FramePtr bad"); + MOZ_ASSERT(IsPersistentFramePtr(), "update read buffer bad mFramePtr"); + MOZ_ASSERT(mFramePtr - accumulatedFragments >= mBuffer, + "reserved FramePtr bad"); if (mBuffered + count <= mBufferSize) { // append to existing buffer @@ -1421,7 +1421,7 @@ nsresult WebSocketChannel::ProcessInput(uint8_t *buffer, uint32_t count) { LOG(("WebSocketChannel::ProcessInput %p [%d %d]\n", this, count, mBuffered)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "not socket thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread, "not socket thread"); nsresult rv; @@ -1553,8 +1553,8 @@ WebSocketChannel::ProcessInput(uint8_t *buffer, uint32_t count) // For frag > 1 move the data body back on top of the headers // so we have contiguous stream of data - NS_ABORT_IF_FALSE(mFramePtr + framingLength == payload, - "payload offset from frameptr wrong"); + MOZ_ASSERT(mFramePtr + framingLength == payload, + "payload offset from frameptr wrong"); ::memmove(mFramePtr, payload, avail); payload = mFramePtr; if (mBuffered) @@ -1692,8 +1692,8 @@ WebSocketChannel::ProcessInput(uint8_t *buffer, uint32_t count) // Remove the control frame from the stream so we have a contiguous // data buffer of reassembled fragments LOG(("WebSocketChannel:: Removing Control From Read buffer\n")); - NS_ABORT_IF_FALSE(mFramePtr + framingLength == payload, - "payload offset from frameptr wrong"); + MOZ_ASSERT(mFramePtr + framingLength == payload, + "payload offset from frameptr wrong"); ::memmove(mFramePtr, payload + payloadLength, avail - payloadLength); payload = mFramePtr; avail -= payloadLength; @@ -1852,7 +1852,7 @@ void WebSocketChannel::EnqueueOutgoingMessage(nsDeque &aQueue, OutboundMessage *aMsg) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "not socket thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread, "not socket thread"); LOG(("WebSocketChannel::EnqueueOutgoingMessage %p " "queueing msg %p [type=%s len=%d]\n", @@ -1886,20 +1886,20 @@ void WebSocketChannel::PrimeNewOutgoingMessage() { LOG(("WebSocketChannel::PrimeNewOutgoingMessage() %p\n", this)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "not socket thread"); - NS_ABORT_IF_FALSE(!mCurrentOut, "Current message in progress"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread, "not socket thread"); + MOZ_ASSERT(!mCurrentOut, "Current message in progress"); nsresult rv = NS_OK; mCurrentOut = (OutboundMessage *)mOutgoingPongMessages.PopFront(); if (mCurrentOut) { - NS_ABORT_IF_FALSE(mCurrentOut->GetMsgType() == kMsgTypePong, - "Not pong message!"); + MOZ_ASSERT(mCurrentOut->GetMsgType() == kMsgTypePong, + "Not pong message!"); } else { mCurrentOut = (OutboundMessage *)mOutgoingPingMessages.PopFront(); if (mCurrentOut) - NS_ABORT_IF_FALSE(mCurrentOut->GetMsgType() == kMsgTypePing, - "Not ping message!"); + MOZ_ASSERT(mCurrentOut->GetMsgType() == kMsgTypePing, + "Not ping message!"); else mCurrentOut = (OutboundMessage *)mOutgoingMessages.PopFront(); } @@ -1942,8 +1942,8 @@ WebSocketChannel::PrimeNewOutgoingMessage() mOutHeader[1] += 2; mHdrOutToSend = 8; if (!mScriptCloseReason.IsEmpty()) { - NS_ABORT_IF_FALSE(mScriptCloseReason.Length() <= 123, - "Close Reason Too Long"); + MOZ_ASSERT(mScriptCloseReason.Length() <= 123, + "Close Reason Too Long"); mOutHeader[1] += mScriptCloseReason.Length(); mHdrOutToSend += mScriptCloseReason.Length(); memcpy (payload + 2, @@ -2007,7 +2007,7 @@ WebSocketChannel::PrimeNewOutgoingMessage() mOutHeader[0] = kFinalFragBit | kBinary; break; case kMsgTypeFin: - NS_ABORT_IF_FALSE(false, "unreachable"); // avoid compiler warning + MOZ_ASSERT(false, "unreachable"); // avoid compiler warning break; } @@ -2040,7 +2040,7 @@ WebSocketChannel::PrimeNewOutgoingMessage() payload = mOutHeader + mHdrOutToSend; } - NS_ABORT_IF_FALSE(payload, "payload offset not found"); + MOZ_ASSERT(payload, "payload offset not found"); // Perform the sending mask. Never use a zero mask uint32_t mask; @@ -2297,7 +2297,7 @@ WebSocketChannel::AbortSession(nsresult reason) mTCPClosed = true; if (mLingeringCloseTimer) { - NS_ABORT_IF_FALSE(mStopped, "Lingering without Stop"); + MOZ_ASSERT(mStopped, "Lingering without Stop"); LOG(("WebSocketChannel:: Cleanup connection based on TCP Close")); CleanupConnection(); return; @@ -2325,7 +2325,7 @@ WebSocketChannel::ReleaseSession() { LOG(("WebSocketChannel::ReleaseSession() %p stopped = %d\n", this, mStopped)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "not socket thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread, "not socket thread"); if (mStopped) return; @@ -2362,7 +2362,7 @@ WebSocketChannel::HandleExtensions() nsresult rv; nsAutoCString extensions; - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); rv = mHttpChannel->GetResponseHeader( NS_LITERAL_CSTRING("Sec-WebSocket-Extensions"), extensions); @@ -2581,7 +2581,7 @@ WebSocketChannel::StartWebsocketData() } LOG(("WebSocketChannel::StartWebsocketData() %p", this)); - NS_ABORT_IF_FALSE(!mDataStarted, "StartWebsocketData twice"); + MOZ_ASSERT(!mDataStarted, "StartWebsocketData twice"); mDataStarted = 1; // We're now done CONNECTING, which means we can now open another, @@ -2653,7 +2653,7 @@ WebSocketChannel::OnLookupComplete(nsICancelable *aRequest, LOG(("WebSocketChannel::OnLookupComplete() %p [%p %p %x]\n", this, aRequest, aRecord, aStatus)); - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); if (mStopped) { LOG(("WebSocketChannel::OnLookupComplete: Request Already Stopped\n")); @@ -2861,9 +2861,9 @@ WebSocketChannel::Notify(nsITimer *timer) LOG(("WebSocketChannel::Notify() %p [%p]\n", this, timer)); if (timer == mCloseTimer) { - NS_ABORT_IF_FALSE(mClientClosed, "Close Timeout without local close"); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, - "not socket thread"); + MOZ_ASSERT(mClientClosed, "Close Timeout without local close"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread, + "not socket thread"); mCloseTimer = nullptr; if (mStopped || mServerClosed) /* no longer relevant */ @@ -2872,9 +2872,9 @@ WebSocketChannel::Notify(nsITimer *timer) LOG(("WebSocketChannel:: Expecting Server Close - Timed Out\n")); AbortSession(NS_ERROR_NET_TIMEOUT); } else if (timer == mOpenTimer) { - NS_ABORT_IF_FALSE(!mGotUpgradeOK, - "Open Timer after open complete"); - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(!mGotUpgradeOK, + "Open Timer after open complete"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); mOpenTimer = nullptr; LOG(("WebSocketChannel:: Connection Timed Out\n")); @@ -2883,15 +2883,15 @@ WebSocketChannel::Notify(nsITimer *timer) AbortSession(NS_ERROR_NET_TIMEOUT); } else if (timer == mReconnectDelayTimer) { - NS_ABORT_IF_FALSE(mConnecting == CONNECTING_DELAYED, - "woke up from delay w/o being delayed?"); + MOZ_ASSERT(mConnecting == CONNECTING_DELAYED, + "woke up from delay w/o being delayed?"); mReconnectDelayTimer = nullptr; LOG(("WebSocketChannel: connecting [this=%p] after reconnect delay", this)); BeginOpen(); } else if (timer == mPingTimer) { - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, - "not socket thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread, + "not socket thread"); if (mClientClosed || mServerClosed || mRequestedClose) { // no point in worrying about ping now @@ -2919,7 +2919,7 @@ WebSocketChannel::Notify(nsITimer *timer) LOG(("WebSocketChannel:: Lingering Close Timer")); CleanupConnection(); } else { - NS_ABORT_IF_FALSE(0, "Unknown Timer"); + MOZ_ASSERT(0, "Unknown Timer"); } return NS_OK; @@ -2931,7 +2931,7 @@ NS_IMETHODIMP WebSocketChannel::GetSecurityInfo(nsISupports **aSecurityInfo) { LOG(("WebSocketChannel::GetSecurityInfo() %p\n", this)); - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); if (mTransport) { if (NS_FAILED(mTransport->GetSecurityInfo(aSecurityInfo))) @@ -2949,7 +2949,7 @@ WebSocketChannel::AsyncOpen(nsIURI *aURI, { LOG(("WebSocketChannel::AsyncOpen() %p\n", this)); - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); if (!aURI || !aListener) { LOG(("WebSocketChannel::AsyncOpen() Uri or Listener null")); @@ -3132,7 +3132,7 @@ NS_IMETHODIMP WebSocketChannel::Close(uint16_t code, const nsACString & reason) { LOG(("WebSocketChannel::Close() %p\n", this)); - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); // save the networkstats (bug 855949) SaveNetworkStats(true); @@ -3195,7 +3195,7 @@ nsresult WebSocketChannel::SendMsgCommon(const nsACString *aMsg, bool aIsBinary, uint32_t aLength, nsIInputStream *aStream) { - NS_ABORT_IF_FALSE(IsOnTargetThread(), "not target thread"); + MOZ_ASSERT(IsOnTargetThread(), "not target thread"); if (mRequestedClose) { LOG(("WebSocketChannel:: Error: send when closed\n")); @@ -3207,7 +3207,7 @@ WebSocketChannel::SendMsgCommon(const nsACString *aMsg, bool aIsBinary, return NS_ERROR_NOT_CONNECTED; } - NS_ABORT_IF_FALSE(mMaxMessageSize >= 0, "max message size negative"); + MOZ_ASSERT(mMaxMessageSize >= 0, "max message size negative"); if (aLength > static_cast(mMaxMessageSize)) { LOG(("WebSocketChannel:: Error: message too big\n")); return NS_ERROR_FILE_TOO_BIG; @@ -3249,9 +3249,9 @@ WebSocketChannel::OnTransportAvailable(nsISocketTransport *aTransport, return NS_OK; } - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); - NS_ABORT_IF_FALSE(!mRecvdHttpUpgradeTransport, "OTA duplicated"); - NS_ABORT_IF_FALSE(aSocketIn, "OTA with invalid socketIn"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(!mRecvdHttpUpgradeTransport, "OTA duplicated"); + MOZ_ASSERT(aSocketIn, "OTA with invalid socketIn"); mTransport = aTransport; mSocketIn = aSocketIn; @@ -3277,8 +3277,8 @@ WebSocketChannel::OnStartRequest(nsIRequest *aRequest, { LOG(("WebSocketChannel::OnStartRequest(): %p [%p %p] recvdhttpupgrade=%d\n", this, aRequest, aContext, mRecvdHttpUpgradeTransport)); - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); - NS_ABORT_IF_FALSE(!mGotUpgradeOK, "OTA duplicated"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(!mGotUpgradeOK, "OTA duplicated"); if (mOpenTimer) { mOpenTimer->Cancel(); @@ -3432,7 +3432,7 @@ WebSocketChannel::OnStopRequest(nsIRequest *aRequest, { LOG(("WebSocketChannel::OnStopRequest() %p [%p %p %x]\n", this, aRequest, aContext, aStatusCode)); - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); ReportConnectionTelemetry(); @@ -3453,7 +3453,7 @@ NS_IMETHODIMP WebSocketChannel::OnInputStreamReady(nsIAsyncInputStream *aStream) { LOG(("WebSocketChannel::OnInputStreamReady() %p\n", this)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "not socket thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread, "not socket thread"); if (!mSocketIn) // did we we clean up the socket after scheduling InputReady? return NS_OK; @@ -3508,7 +3508,7 @@ NS_IMETHODIMP WebSocketChannel::OnOutputStreamReady(nsIAsyncOutputStream *aStream) { LOG(("WebSocketChannel::OnOutputStreamReady() %p\n", this)); - NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "not socket thread"); + MOZ_ASSERT(PR_GetCurrentThread() == gSocketThread, "not socket thread"); nsresult rv; if (!mCurrentOut) diff --git a/netwerk/protocol/websocket/WebSocketChannelChild.cpp b/netwerk/protocol/websocket/WebSocketChannelChild.cpp index 8eea79098bf..2b9840b5a09 100644 --- a/netwerk/protocol/websocket/WebSocketChannelChild.cpp +++ b/netwerk/protocol/websocket/WebSocketChannelChild.cpp @@ -53,7 +53,7 @@ WebSocketChannelChild::WebSocketChannelChild(bool aEncrypted) : mIPCState(Closed) , mMutex("WebSocketChannelChild::mMutex") { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); LOG(("WebSocketChannelChild::WebSocketChannelChild() %p\n", this)); mEncrypted = aEncrypted; @@ -72,7 +72,7 @@ WebSocketChannelChild::AddIPDLReference() { MutexAutoLock lock(mMutex); - NS_ABORT_IF_FALSE(mIPCState == Closed, "Attempt to retain more than one IPDL reference"); + MOZ_ASSERT(mIPCState == Closed, "Attempt to retain more than one IPDL reference"); mIPCState = Opened; } @@ -86,7 +86,7 @@ WebSocketChannelChild::ReleaseIPDLReference() { MutexAutoLock lock(mMutex); - NS_ABORT_IF_FALSE(mIPCState != Closed, "Attempt to release nonexistent IPDL reference"); + MOZ_ASSERT(mIPCState != Closed, "Attempt to release nonexistent IPDL reference"); mIPCState = Closed; } @@ -460,9 +460,9 @@ WebSocketChannelChild::AsyncOpen(nsIURI *aURI, { LOG(("WebSocketChannelChild::AsyncOpen() %p\n", this)); - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); - NS_ABORT_IF_FALSE(aURI && aListener && !mListenerMT, - "Invalid state for WebSocketChannelChild::AsyncOpen"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(aURI && aListener && !mListenerMT, + "Invalid state for WebSocketChannelChild::AsyncOpen"); mozilla::dom::TabChild* tabChild = nullptr; nsCOMPtr iTabChild; diff --git a/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp b/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp index 292d486eaea..acde58b38a3 100644 --- a/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp +++ b/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp @@ -66,7 +66,7 @@ WyciwygChannelChild::~WyciwygChannelChild() void WyciwygChannelChild::AddIPDLReference() { - NS_ABORT_IF_FALSE(!mIPCOpen, "Attempt to retain more than one IPDL reference"); + MOZ_ASSERT(!mIPCOpen, "Attempt to retain more than one IPDL reference"); mIPCOpen = true; AddRef(); } @@ -74,7 +74,7 @@ WyciwygChannelChild::AddIPDLReference() void WyciwygChannelChild::ReleaseIPDLReference() { - NS_ABORT_IF_FALSE(mIPCOpen, "Attempt to release nonexistent IPDL reference"); + MOZ_ASSERT(mIPCOpen, "Attempt to release nonexistent IPDL reference"); mIPCOpen = false; Release(); } diff --git a/netwerk/socket/nsSOCKSIOLayer.cpp b/netwerk/socket/nsSOCKSIOLayer.cpp index 63703edc587..50232f0f590 100644 --- a/netwerk/socket/nsSOCKSIOLayer.cpp +++ b/netwerk/socket/nsSOCKSIOLayer.cpp @@ -357,8 +357,8 @@ nsSOCKSSocketInfo::HandshakeFinished(PRErrorCode err) PRStatus nsSOCKSSocketInfo::StartDNS(PRFileDesc *fd) { - NS_ABORT_IF_FALSE(!mDnsRec && mState == SOCKS_INITIAL, - "Must be in initial state to make DNS Lookup"); + MOZ_ASSERT(!mDnsRec && mState == SOCKS_INITIAL, + "Must be in initial state to make DNS Lookup"); nsCOMPtr dns = do_GetService(NS_DNSSERVICE_CONTRACTID); if (!dns) @@ -384,7 +384,7 @@ nsSOCKSSocketInfo::OnLookupComplete(nsICancelable *aRequest, nsIDNSRecord *aRecord, nsresult aStatus) { - NS_ABORT_IF_FALSE(aRequest == mLookup, "wrong DNS query"); + MOZ_ASSERT(aRequest == mLookup, "wrong DNS query"); mLookup = nullptr; mLookupStatus = aStatus; mDnsRec = aRecord; @@ -402,8 +402,8 @@ nsSOCKSSocketInfo::ConnectToProxy(PRFileDesc *fd) PRStatus status; nsresult rv; - NS_ABORT_IF_FALSE(mState == SOCKS_DNS_COMPLETE, - "Must have DNS to make connection!"); + MOZ_ASSERT(mState == SOCKS_DNS_COMPLETE, + "Must have DNS to make connection!"); if (NS_FAILED(mLookupStatus)) { PR_SetError(PR_BAD_ADDRESS_ERROR, 0); @@ -514,8 +514,8 @@ nsSOCKSSocketInfo::ContinueConnectingToProxy(PRFileDesc *fd, int16_t oflags) { PRStatus status; - NS_ABORT_IF_FALSE(mState == SOCKS_CONNECTING_TO_PROXY, - "Continuing connection in wrong state!"); + MOZ_ASSERT(mState == SOCKS_CONNECTING_TO_PROXY, + "Continuing connection in wrong state!"); LOGDEBUG(("socks: continuing connection to proxy")); @@ -544,8 +544,8 @@ nsSOCKSSocketInfo::WriteV4ConnectRequest() NetAddr *addr = &mDestinationAddr; int32_t proxy_resolve; - NS_ABORT_IF_FALSE(mState == SOCKS_CONNECTING_TO_PROXY, - "Invalid state!"); + MOZ_ASSERT(mState == SOCKS_CONNECTING_TO_PROXY, + "Invalid state!"); proxy_resolve = mFlags & nsISocketProvider::PROXY_RESOLVES_HOST; @@ -595,10 +595,10 @@ nsSOCKSSocketInfo::WriteV4ConnectRequest() PRStatus nsSOCKSSocketInfo::ReadV4ConnectResponse() { - NS_ABORT_IF_FALSE(mState == SOCKS4_READ_CONNECT_RESPONSE, - "Handling SOCKS 4 connection reply in wrong state!"); - NS_ABORT_IF_FALSE(mDataLength == 8, - "SOCKS 4 connection reply must be 8 bytes!"); + MOZ_ASSERT(mState == SOCKS4_READ_CONNECT_RESPONSE, + "Handling SOCKS 4 connection reply in wrong state!"); + MOZ_ASSERT(mDataLength == 8, + "SOCKS 4 connection reply must be 8 bytes!"); LOGDEBUG(("socks4: checking connection reply")); @@ -623,7 +623,7 @@ nsSOCKSSocketInfo::ReadV4ConnectResponse() PRStatus nsSOCKSSocketInfo::WriteV5AuthRequest() { - NS_ABORT_IF_FALSE(mVersion == 5, "SOCKS version must be 5!"); + MOZ_ASSERT(mVersion == 5, "SOCKS version must be 5!"); mState = SOCKS5_WRITE_AUTH_REQUEST; @@ -641,10 +641,10 @@ nsSOCKSSocketInfo::WriteV5AuthRequest() PRStatus nsSOCKSSocketInfo::ReadV5AuthResponse() { - NS_ABORT_IF_FALSE(mState == SOCKS5_READ_AUTH_RESPONSE, - "Handling SOCKS 5 auth method reply in wrong state!"); - NS_ABORT_IF_FALSE(mDataLength == 2, - "SOCKS 5 auth method reply must be 2 bytes!"); + MOZ_ASSERT(mState == SOCKS5_READ_AUTH_RESPONSE, + "Handling SOCKS 5 auth method reply in wrong state!"); + MOZ_ASSERT(mDataLength == 2, + "SOCKS 5 auth method reply must be 2 bytes!"); LOGDEBUG(("socks5: checking auth method reply")); @@ -721,11 +721,11 @@ nsSOCKSSocketInfo::WriteV5ConnectRequest() PRStatus nsSOCKSSocketInfo::ReadV5AddrTypeAndLength(uint8_t *type, uint32_t *len) { - NS_ABORT_IF_FALSE(mState == SOCKS5_READ_CONNECT_RESPONSE_TOP || - mState == SOCKS5_READ_CONNECT_RESPONSE_BOTTOM, - "Invalid state!"); - NS_ABORT_IF_FALSE(mDataLength >= 5, - "SOCKS 5 connection reply must be at least 5 bytes!"); + MOZ_ASSERT(mState == SOCKS5_READ_CONNECT_RESPONSE_TOP || + mState == SOCKS5_READ_CONNECT_RESPONSE_BOTTOM, + "Invalid state!"); + MOZ_ASSERT(mDataLength >= 5, + "SOCKS 5 connection reply must be at least 5 bytes!"); // Seek to the address location mReadOffset = 3; @@ -756,10 +756,10 @@ nsSOCKSSocketInfo::ReadV5ConnectResponseTop() uint8_t res; uint32_t len; - NS_ABORT_IF_FALSE(mState == SOCKS5_READ_CONNECT_RESPONSE_TOP, - "Invalid state!"); - NS_ABORT_IF_FALSE(mDataLength == 5, - "SOCKS 5 connection reply must be exactly 5 bytes!"); + MOZ_ASSERT(mState == SOCKS5_READ_CONNECT_RESPONSE_TOP, + "Invalid state!"); + MOZ_ASSERT(mDataLength == 5, + "SOCKS 5 connection reply must be exactly 5 bytes!"); LOGDEBUG(("socks5: checking connection reply")); @@ -833,16 +833,16 @@ nsSOCKSSocketInfo::ReadV5ConnectResponseBottom() uint8_t type; uint32_t len; - NS_ABORT_IF_FALSE(mState == SOCKS5_READ_CONNECT_RESPONSE_BOTTOM, - "Invalid state!"); + MOZ_ASSERT(mState == SOCKS5_READ_CONNECT_RESPONSE_BOTTOM, + "Invalid state!"); if (ReadV5AddrTypeAndLength(&type, &len) != PR_SUCCESS) { HandshakeFinished(PR_BAD_ADDRESS_ERROR); return PR_FAILURE; } - NS_ABORT_IF_FALSE(mDataLength == 7+len, - "SOCKS 5 unexpected length of connection reply!"); + MOZ_ASSERT(mDataLength == 7+len, + "SOCKS 5 unexpected length of connection reply!"); LOGDEBUG(("socks5: loading source addr and port")); // Read what the proxy says is our source address @@ -971,8 +971,8 @@ inline uint8_t nsSOCKSSocketInfo::ReadUint8() { uint8_t rv; - NS_ABORT_IF_FALSE(mReadOffset + sizeof(rv) <= mDataLength, - "Not enough space to pop a uint8_t!"); + MOZ_ASSERT(mReadOffset + sizeof(rv) <= mDataLength, + "Not enough space to pop a uint8_t!"); rv = mData[mReadOffset]; mReadOffset += sizeof(rv); return rv; @@ -982,8 +982,8 @@ inline uint16_t nsSOCKSSocketInfo::ReadUint16() { uint16_t rv; - NS_ABORT_IF_FALSE(mReadOffset + sizeof(rv) <= mDataLength, - "Not enough space to pop a uint16_t!"); + MOZ_ASSERT(mReadOffset + sizeof(rv) <= mDataLength, + "Not enough space to pop a uint16_t!"); memcpy(&rv, mData + mReadOffset, sizeof(rv)); mReadOffset += sizeof(rv); return rv; @@ -993,8 +993,8 @@ inline uint32_t nsSOCKSSocketInfo::ReadUint32() { uint32_t rv; - NS_ABORT_IF_FALSE(mReadOffset + sizeof(rv) <= mDataLength, - "Not enough space to pop a uint32_t!"); + MOZ_ASSERT(mReadOffset + sizeof(rv) <= mDataLength, + "Not enough space to pop a uint32_t!"); memcpy(&rv, mData + mReadOffset, sizeof(rv)); mReadOffset += sizeof(rv); return rv; @@ -1009,13 +1009,13 @@ nsSOCKSSocketInfo::ReadNetAddr(NetAddr *addr, uint16_t fam) addr->raw.family = fam; if (fam == AF_INET) { amt = sizeof(addr->inet.ip); - NS_ABORT_IF_FALSE(mReadOffset + amt <= mDataLength, - "Not enough space to pop an ipv4 addr!"); + MOZ_ASSERT(mReadOffset + amt <= mDataLength, + "Not enough space to pop an ipv4 addr!"); memcpy(&addr->inet.ip, ip, amt); } else if (fam == AF_INET6) { amt = sizeof(addr->inet6.ip.u8); - NS_ABORT_IF_FALSE(mReadOffset + amt <= mDataLength, - "Not enough space to pop an ipv6 addr!"); + MOZ_ASSERT(mReadOffset + amt <= mDataLength, + "Not enough space to pop an ipv6 addr!"); memcpy(addr->inet6.ip.u8, ip, amt); } @@ -1031,10 +1031,10 @@ nsSOCKSSocketInfo::ReadNetPort(NetAddr *addr) void nsSOCKSSocketInfo::WantRead(uint32_t sz) { - NS_ABORT_IF_FALSE(mDataIoPtr == nullptr, - "WantRead() called while I/O already in progress!"); - NS_ABORT_IF_FALSE(mDataLength + sz <= BUFFER_SIZE, - "Can't read that much data!"); + MOZ_ASSERT(mDataIoPtr == nullptr, + "WantRead() called while I/O already in progress!"); + MOZ_ASSERT(mDataLength + sz <= BUFFER_SIZE, + "Can't read that much data!"); mAmountToRead = sz; } diff --git a/parser/html/nsHtml5Module.cpp b/parser/html/nsHtml5Module.cpp index 257dfed8e70..148fe030ced 100644 --- a/parser/html/nsHtml5Module.cpp +++ b/parser/html/nsHtml5Module.cpp @@ -71,7 +71,7 @@ nsHtml5Module::ReleaseStatics() already_AddRefed nsHtml5Module::NewHtml5Parser() { - NS_ABORT_IF_FALSE(sNsHtml5ModuleInitialized, "nsHtml5Module not initialized."); + MOZ_ASSERT(sNsHtml5ModuleInitialized, "nsHtml5Module not initialized."); nsCOMPtr rv = new nsHtml5Parser(); return rv.forget(); } @@ -80,7 +80,7 @@ nsHtml5Module::NewHtml5Parser() nsresult nsHtml5Module::Initialize(nsIParser* aParser, nsIDocument* aDoc, nsIURI* aURI, nsISupports* aContainer, nsIChannel* aChannel) { - NS_ABORT_IF_FALSE(sNsHtml5ModuleInitialized, "nsHtml5Module not initialized."); + MOZ_ASSERT(sNsHtml5ModuleInitialized, "nsHtml5Module not initialized."); nsHtml5Parser* parser = static_cast (aParser); return parser->Initialize(aDoc, aURI, aContainer, aChannel); } diff --git a/parser/htmlparser/nsParser.cpp b/parser/htmlparser/nsParser.cpp index 6c7f138de17..43a48d2eaba 100644 --- a/parser/htmlparser/nsParser.cpp +++ b/parser/htmlparser/nsParser.cpp @@ -752,8 +752,9 @@ FindSuitableDTD(CParserContext& aParserContext) aParserContext.mAutoDetectStatus = ePrimaryDetect; // Quick check for view source. - NS_ABORT_IF_FALSE(aParserContext.mParserCommand != eViewSource, - "The old parser is not supposed to be used for View Source anymore."); + MOZ_ASSERT(aParserContext.mParserCommand != eViewSource, + "The old parser is not supposed to be used for View Source " + "anymore."); // Now see if we're parsing HTML (which, as far as we're concerned, simply // means "not XML"). diff --git a/security/manager/ssl/src/CryptoTask.cpp b/security/manager/ssl/src/CryptoTask.cpp index 016d997b2a7..9affae5f901 100644 --- a/security/manager/ssl/src/CryptoTask.cpp +++ b/security/manager/ssl/src/CryptoTask.cpp @@ -84,8 +84,8 @@ CryptoTask::Run() void CryptoTask::virtualDestroyNSSReference() { - NS_ABORT_IF_FALSE(NS_IsMainThread(), - "virtualDestroyNSSReference called off the main thread"); + MOZ_ASSERT(NS_IsMainThread(), + "virtualDestroyNSSReference called off the main thread"); if (!mReleasedNSSResources) { mReleasedNSSResources = true; ReleaseNSSResources(); diff --git a/storage/public/mozIStorageStatement.idl b/storage/public/mozIStorageStatement.idl index ead16297a92..329ce280dc4 100644 --- a/storage/public/mozIStorageStatement.idl +++ b/storage/public/mozIStorageStatement.idl @@ -234,24 +234,24 @@ interface mozIStorageStatement : mozIStorageBaseStatement { inline int32_t AsInt32(uint32_t idx) { int32_t v = 0; mozilla::DebugOnly rv = GetInt32(idx, &v); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx), - "Getting value failed, wrong column index?"); + MOZ_ASSERT(NS_SUCCEEDED(rv) || IsNull(idx), + "Getting value failed, wrong column index?"); return v; } inline int64_t AsInt64(uint32_t idx) { int64_t v = 0; mozilla::DebugOnly rv = GetInt64(idx, &v); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx), - "Getting value failed, wrong column index?"); + MOZ_ASSERT(NS_SUCCEEDED(rv) || IsNull(idx), + "Getting value failed, wrong column index?"); return v; } inline double AsDouble(uint32_t idx) { double v = 0.0; mozilla::DebugOnly rv = GetDouble(idx, &v); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx), - "Getting value failed, wrong column index?"); + MOZ_ASSERT(NS_SUCCEEDED(rv) || IsNull(idx), + "Getting value failed, wrong column index?"); return v; } @@ -259,8 +259,8 @@ interface mozIStorageStatement : mozIStorageBaseStatement { const char *str = nullptr; *len = 0; mozilla::DebugOnly rv = GetSharedUTF8String(idx, len, &str); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx), - "Getting value failed, wrong column index?"); + MOZ_ASSERT(NS_SUCCEEDED(rv) || IsNull(idx), + "Getting value failed, wrong column index?"); return str; } @@ -268,8 +268,8 @@ interface mozIStorageStatement : mozIStorageBaseStatement { const char16_t *str = nullptr; *len = 0; mozilla::DebugOnly rv = GetSharedString(idx, len, &str); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx), - "Getting value failed, wrong column index?"); + MOZ_ASSERT(NS_SUCCEEDED(rv) || IsNull(idx), + "Getting value failed, wrong column index?"); return str; } @@ -277,16 +277,16 @@ interface mozIStorageStatement : mozIStorageBaseStatement { const uint8_t *blob = nullptr; *len = 0; mozilla::DebugOnly rv = GetSharedBlob(idx, len, &blob); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx), - "Getting value failed, wrong column index?"); + MOZ_ASSERT(NS_SUCCEEDED(rv) || IsNull(idx), + "Getting value failed, wrong column index?"); return blob; } inline bool IsNull(uint32_t idx) { bool b = false; mozilla::DebugOnly rv = GetIsNull(idx, &b); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), - "Getting value failed, wrong column index?"); + MOZ_ASSERT(NS_SUCCEEDED(rv), + "Getting value failed, wrong column index?"); return b; } diff --git a/storage/public/mozIStorageValueArray.idl b/storage/public/mozIStorageValueArray.idl index ce702ae2c11..fd1de2a9d4a 100644 --- a/storage/public/mozIStorageValueArray.idl +++ b/storage/public/mozIStorageValueArray.idl @@ -82,24 +82,24 @@ interface mozIStorageValueArray : nsISupports { inline int32_t AsInt32(uint32_t idx) { int32_t v = 0; mozilla::DebugOnly rv = GetInt32(idx, &v); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx), - "Getting value failed, wrong column index?"); + MOZ_ASSERT(NS_SUCCEEDED(rv) || IsNull(idx), + "Getting value failed, wrong column index?"); return v; } inline int64_t AsInt64(uint32_t idx) { int64_t v = 0; mozilla::DebugOnly rv = GetInt64(idx, &v); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx), - "Getting value failed, wrong column index?"); + MOZ_ASSERT(NS_SUCCEEDED(rv) || IsNull(idx), + "Getting value failed, wrong column index?"); return v; } inline double AsDouble(uint32_t idx) { double v = 0.0; mozilla::DebugOnly rv = GetDouble(idx, &v); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx), - "Getting value failed, wrong column index?"); + MOZ_ASSERT(NS_SUCCEEDED(rv) || IsNull(idx), + "Getting value failed, wrong column index?"); return v; } @@ -107,8 +107,8 @@ interface mozIStorageValueArray : nsISupports { const char *str = nullptr; *len = 0; mozilla::DebugOnly rv = GetSharedUTF8String(idx, len, &str); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx), - "Getting value failed, wrong column index?"); + MOZ_ASSERT(NS_SUCCEEDED(rv) || IsNull(idx), + "Getting value failed, wrong column index?"); return str; } @@ -116,8 +116,8 @@ interface mozIStorageValueArray : nsISupports { const char16_t *str = nullptr; *len = 0; mozilla::DebugOnly rv = GetSharedString(idx, len, &str); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx), - "Getting value failed, wrong column index?"); + MOZ_ASSERT(NS_SUCCEEDED(rv) || IsNull(idx), + "Getting value failed, wrong column index?"); return str; } @@ -125,16 +125,16 @@ interface mozIStorageValueArray : nsISupports { const uint8_t *blob = nullptr; *len = 0; mozilla::DebugOnly rv = GetSharedBlob(idx, len, &blob); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv) || IsNull(idx), - "Getting value failed, wrong column index?"); + MOZ_ASSERT(NS_SUCCEEDED(rv) || IsNull(idx), + "Getting value failed, wrong column index?"); return blob; } inline bool IsNull(uint32_t idx) { bool b = false; mozilla::DebugOnly rv = GetIsNull(idx, &b); - NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), - "Getting value failed, wrong column index?"); + MOZ_ASSERT(NS_SUCCEEDED(rv), + "Getting value failed, wrong column index?"); return b; } diff --git a/toolkit/components/places/Helpers.cpp b/toolkit/components/places/Helpers.cpp index 5688b73d8ed..e83ae24dca0 100644 --- a/toolkit/components/places/Helpers.cpp +++ b/toolkit/components/places/Helpers.cpp @@ -28,7 +28,7 @@ NS_IMPL_ISUPPORTS( NS_IMETHODIMP AsyncStatementCallback::HandleResult(mozIStorageResultSet *aResultSet) { - NS_ABORT_IF_FALSE(false, "Was not expecting a resultset, but got it."); + MOZ_ASSERT(false, "Was not expecting a resultset, but got it."); return NS_OK; } diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index 0c90faa0586..82ca4b91da8 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -2027,8 +2027,8 @@ History::NotifyVisited(nsIURI* aURI) link->SetLinkState(eLinkState_Visited); // Verify that the observers hash doesn't mutate while looping through // the links associated with this URI. - NS_ABORT_IF_FALSE(key == mObservers.GetEntry(aURI), - "The URIs hash mutated!"); + MOZ_ASSERT(key == mObservers.GetEntry(aURI), + "The URIs hash mutated!"); } } @@ -2349,7 +2349,7 @@ History::GetService() } nsCOMPtr service(do_GetService(NS_IHISTORY_CONTRACTID)); - NS_ABORT_IF_FALSE(service, "Cannot obtain IHistory service!"); + MOZ_ASSERT(service, "Cannot obtain IHistory service!"); NS_ASSERTION(gService, "Our constructor was not run?!"); return gService; diff --git a/toolkit/components/places/nsNavBookmarks.cpp b/toolkit/components/places/nsNavBookmarks.cpp index a2bb1510d7a..cbf8310802a 100644 --- a/toolkit/components/places/nsNavBookmarks.cpp +++ b/toolkit/components/places/nsNavBookmarks.cpp @@ -2707,7 +2707,7 @@ nsNavBookmarks::OnDeleteURI(nsIURI* aURI, nsNavHistory* history = nsNavHistory::GetHistoryService(); int64_t placeId; nsAutoCString placeGuid; - NS_ABORT_IF_FALSE( + MOZ_ASSERT( history && NS_SUCCEEDED(history->GetIdForPage(aURI, &placeId, placeGuid)) && !placeId, "OnDeleteURI was notified for a page that still exists?" ); diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index efda666f969..743804aa11c 100644 --- a/toolkit/components/telemetry/Telemetry.cpp +++ b/toolkit/components/telemetry/Telemetry.cpp @@ -2919,7 +2919,7 @@ TelemetryImpl::GetCanSend(bool *ret) { already_AddRefed TelemetryImpl::CreateTelemetryInstance() { - NS_ABORT_IF_FALSE(sTelemetry == nullptr, "CreateTelemetryInstance may only be called once, via GetService()"); + MOZ_ASSERT(sTelemetry == nullptr, "CreateTelemetryInstance may only be called once, via GetService()"); sTelemetry = new TelemetryImpl(); // AddRef for the local reference NS_ADDREF(sTelemetry); diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp index 62ad8db35f4..6d96002a675 100644 --- a/toolkit/crashreporter/nsExceptionHandler.cpp +++ b/toolkit/crashreporter/nsExceptionHandler.cpp @@ -2714,8 +2714,8 @@ OOPInit() MOZ_ASSERT(NS_IsMainThread()); - NS_ABORT_IF_FALSE(gExceptionHandler != nullptr, - "attempt to initialize OOP crash reporter before in-process crashreporter!"); + MOZ_ASSERT(gExceptionHandler != nullptr, + "attempt to initialize OOP crash reporter before in-process crashreporter!"); #if defined(XP_WIN) childCrashNotifyPipe = @@ -2959,7 +2959,7 @@ SetRemoteExceptionHandler(const nsACString& crashPipe) if (crashPipe.Equals(kNullNotifyPipe)) return true; - NS_ABORT_IF_FALSE(!gExceptionHandler, "crash client already init'd"); + MOZ_ASSERT(!gExceptionHandler, "crash client already init'd"); gExceptionHandler = new google_breakpad:: ExceptionHandler(L"", @@ -3003,7 +3003,7 @@ CreateNotificationPipeForChild(int* childCrashFd, int* childCrashRemapFd) bool SetRemoteExceptionHandler() { - NS_ABORT_IF_FALSE(!gExceptionHandler, "crash client already init'd"); + MOZ_ASSERT(!gExceptionHandler, "crash client already init'd"); #ifndef XP_LINUX xpstring path = ""; @@ -3040,7 +3040,7 @@ SetRemoteExceptionHandler(const nsACString& crashPipe) if (crashPipe.Equals(kNullNotifyPipe)) return true; - NS_ABORT_IF_FALSE(!gExceptionHandler, "crash client already init'd"); + MOZ_ASSERT(!gExceptionHandler, "crash client already init'd"); gExceptionHandler = new google_breakpad:: ExceptionHandler("", diff --git a/toolkit/system/gnome/nsAlertsIconListener.cpp b/toolkit/system/gnome/nsAlertsIconListener.cpp index 1957f8306d9..f0d06f73418 100644 --- a/toolkit/system/gnome/nsAlertsIconListener.cpp +++ b/toolkit/system/gnome/nsAlertsIconListener.cpp @@ -43,7 +43,7 @@ static void notify_closed_marshal(GClosure* closure, gpointer invocation_hint, gpointer marshal_data) { - NS_ABORT_IF_FALSE(n_param_values >= 1, "No object in params"); + MOZ_ASSERT(n_param_values >= 1, "No object in params"); nsAlertsIconListener* alert = static_cast(closure->data); diff --git a/toolkit/xre/EventTracer.cpp b/toolkit/xre/EventTracer.cpp index 06363687843..9e4927d4d0c 100644 --- a/toolkit/xre/EventTracer.cpp +++ b/toolkit/xre/EventTracer.cpp @@ -236,7 +236,7 @@ bool InitEventTracing(bool aLog) // Create a thread that will fire events back at the // main thread to measure responsiveness. - NS_ABORT_IF_FALSE(!sTracerThread, "Event tracing already initialized!"); + MOZ_ASSERT(!sTracerThread, "Event tracing already initialized!"); sTracerThread = PR_CreateThread(PR_USER_THREAD, TracerThread, args, diff --git a/toolkit/xre/ProfileReset.cpp b/toolkit/xre/ProfileReset.cpp index ff736efda5d..6a2d962880b 100644 --- a/toolkit/xre/ProfileReset.cpp +++ b/toolkit/xre/ProfileReset.cpp @@ -33,7 +33,7 @@ static const char kProfileProperties[] = nsresult CreateResetProfile(nsIToolkitProfileService* aProfileSvc, nsIToolkitProfile* *aNewProfile) { - NS_ABORT_IF_FALSE(aProfileSvc, "NULL profile service"); + MOZ_ASSERT(aProfileSvc, "NULL profile service"); nsCOMPtr newProfile; // Make the new profile "default-" + the time in seconds since epoch for uniqueness. diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 886e293d79f..967fbcd8205 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -438,7 +438,7 @@ static void RemoveArg(char **argv) static ArgResult CheckArg(const char* aArg, bool aCheckOSInt = false, const char **aParam = nullptr, bool aRemArg = true) { - NS_ABORT_IF_FALSE(gArgv, "gArgv must be initialized before CheckArg()"); + MOZ_ASSERT(gArgv, "gArgv must be initialized before CheckArg()"); char **curarg = gArgv + 1; // skip argv[0] ArgResult ar = ARG_NONE; diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp index 38f7418285f..48a232929ad 100644 --- a/toolkit/xre/nsEmbedFunctions.cpp +++ b/toolkit/xre/nsEmbedFunctions.cpp @@ -446,19 +446,19 @@ XRE_InitChildProcess(int aArgc, // child processes launched by GeckoChildProcessHost get this magic // argument appended to their command lines const char* const parentPIDString = aArgv[aArgc-1]; - NS_ABORT_IF_FALSE(parentPIDString, "NULL parent PID"); + MOZ_ASSERT(parentPIDString, "NULL parent PID"); --aArgc; char* end = 0; base::ProcessId parentPID = strtol(parentPIDString, &end, 10); - NS_ABORT_IF_FALSE(!*end, "invalid parent PID"); + MOZ_ASSERT(!*end, "invalid parent PID"); // Retrieve the parent process handle. We need this for shared memory use and // for creating new transports in the child. base::ProcessHandle parentHandle = 0; if (XRE_GetProcessType() != GeckoProcessType_GMPlugin) { mozilla::DebugOnly ok = base::OpenProcessHandle(parentPID, &parentHandle); - NS_ABORT_IF_FALSE(ok, "can't open handle to parent"); + MOZ_ASSERT(ok, "can't open handle to parent"); } #if defined(XP_WIN) @@ -748,10 +748,10 @@ struct RunnableMethodTraits void XRE_ShutdownChildProcess() { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "Wrong thread!"); + MOZ_ASSERT(NS_IsMainThread(), "Wrong thread!"); mozilla::DebugOnly ioLoop = XRE_GetIOMessageLoop(); - NS_ABORT_IF_FALSE(!!ioLoop, "Bad shutdown order"); + MOZ_ASSERT(!!ioLoop, "Bad shutdown order"); // Quit() sets off the following chain of events // (1) UI loop starts quitting diff --git a/toolkit/xre/nsUpdateDriver.cpp b/toolkit/xre/nsUpdateDriver.cpp index 16f50ea99d6..1744721fb14 100644 --- a/toolkit/xre/nsUpdateDriver.cpp +++ b/toolkit/xre/nsUpdateDriver.cpp @@ -1172,7 +1172,7 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate) mUpdate = aUpdate; - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); return NS_NewThread(getter_AddRefs(mProcessWatcher), NS_NewRunnableMethod(this, &nsUpdateProcessor::StartStagedUpdate)); } @@ -1182,7 +1182,7 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate) void nsUpdateProcessor::StartStagedUpdate() { - NS_ABORT_IF_FALSE(!NS_IsMainThread(), "main thread"); + MOZ_ASSERT(!NS_IsMainThread(), "main thread"); nsresult rv = ProcessUpdates(mInfo.mGREDir, mInfo.mAppDir, @@ -1212,7 +1212,7 @@ nsUpdateProcessor::StartStagedUpdate() void nsUpdateProcessor::ShutdownWatcherThread() { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); mProcessWatcher->Shutdown(); mProcessWatcher = nullptr; mUpdate = nullptr; @@ -1221,7 +1221,7 @@ nsUpdateProcessor::ShutdownWatcherThread() void nsUpdateProcessor::WaitForProcess() { - NS_ABORT_IF_FALSE(!NS_IsMainThread(), "main thread"); + MOZ_ASSERT(!NS_IsMainThread(), "main thread"); ::WaitForProcess(mUpdaterPID); NS_DispatchToMainThread(NS_NewRunnableMethod(this, &nsUpdateProcessor::UpdateDone)); } @@ -1229,7 +1229,7 @@ nsUpdateProcessor::WaitForProcess() void nsUpdateProcessor::UpdateDone() { - NS_ABORT_IF_FALSE(NS_IsMainThread(), "not main thread"); + MOZ_ASSERT(NS_IsMainThread(), "not main thread"); nsCOMPtr um = do_GetService("@mozilla.org/updates/update-manager;1"); diff --git a/view/nsView.cpp b/view/nsView.cpp index d9e9715175d..6f9c3ea7b7f 100644 --- a/view/nsView.cpp +++ b/view/nsView.cpp @@ -553,9 +553,9 @@ nsresult nsView::CreateWidget(nsWidgetInitData *aWidgetInitData, bool aResetVisibility) { AssertNoWindow(); - NS_ABORT_IF_FALSE(!aWidgetInitData || - aWidgetInitData->mWindowType != eWindowType_popup, - "Use CreateWidgetForPopup"); + MOZ_ASSERT(!aWidgetInitData || + aWidgetInitData->mWindowType != eWindowType_popup, + "Use CreateWidgetForPopup"); DefaultWidgetInitData defaultInitData; bool initDataPassedIn = !!aWidgetInitData; @@ -591,10 +591,10 @@ nsresult nsView::CreateWidgetForParent(nsIWidget* aParentWidget, bool aResetVisibility) { AssertNoWindow(); - NS_ABORT_IF_FALSE(!aWidgetInitData || - aWidgetInitData->mWindowType != eWindowType_popup, - "Use CreateWidgetForPopup"); - NS_ABORT_IF_FALSE(aParentWidget, "Parent widget required"); + MOZ_ASSERT(!aWidgetInitData || + aWidgetInitData->mWindowType != eWindowType_popup, + "Use CreateWidgetForPopup"); + MOZ_ASSERT(aParentWidget, "Parent widget required"); DefaultWidgetInitData defaultInitData; aWidgetInitData = aWidgetInitData ? aWidgetInitData : &defaultInitData; @@ -618,9 +618,9 @@ nsresult nsView::CreateWidgetForPopup(nsWidgetInitData *aWidgetInitData, bool aResetVisibility) { AssertNoWindow(); - NS_ABORT_IF_FALSE(aWidgetInitData, "Widget init data required"); - NS_ABORT_IF_FALSE(aWidgetInitData->mWindowType == eWindowType_popup, - "Use one of the other CreateWidget methods"); + MOZ_ASSERT(aWidgetInitData, "Widget init data required"); + MOZ_ASSERT(aWidgetInitData->mWindowType == eWindowType_popup, + "Use one of the other CreateWidget methods"); nsIntRect trect = CalcWidgetBounds(aWidgetInitData->mWindowType); @@ -656,7 +656,7 @@ nsresult nsView::CreateWidgetForPopup(nsWidgetInitData *aWidgetInitData, void nsView::InitializeWindow(bool aEnableDragDrop, bool aResetVisibility) { - NS_ABORT_IF_FALSE(mWindow, "Must have a window to initialize"); + MOZ_ASSERT(mWindow, "Must have a window to initialize"); mWindow->SetWidgetListener(this); @@ -804,9 +804,8 @@ nsPoint nsView::GetOffsetTo(const nsView* aOther) const nsPoint nsView::GetOffsetTo(const nsView* aOther, const int32_t aAPD) const { - NS_ABORT_IF_FALSE(GetParent() || !aOther || aOther->GetParent() || - this == aOther, "caller of (outer) GetOffsetTo must not " - "pass unrelated views"); + MOZ_ASSERT(GetParent() || !aOther || aOther->GetParent() || this == aOther, + "caller of (outer) GetOffsetTo must not pass unrelated views"); // We accumulate the final result in offset nsPoint offset(0, 0); // The offset currently accumulated at the current APD diff --git a/widget/InputData.cpp b/widget/InputData.cpp index 4fd584258ba..002ac15ef16 100644 --- a/widget/InputData.cpp +++ b/widget/InputData.cpp @@ -18,8 +18,8 @@ using namespace dom; already_AddRefed SingleTouchData::ToNewDOMTouch() const { - NS_ABORT_IF_FALSE(NS_IsMainThread(), - "Can only create dom::Touch instances on main thread"); + MOZ_ASSERT(NS_IsMainThread(), + "Can only create dom::Touch instances on main thread"); nsRefPtr touch = new Touch(mIdentifier, LayoutDeviceIntPoint(mScreenPoint.x, mScreenPoint.y), nsIntPoint(mRadius.width, mRadius.height), @@ -32,8 +32,8 @@ MultiTouchInput::MultiTouchInput(const WidgetTouchEvent& aTouchEvent) : InputData(MULTITOUCH_INPUT, aTouchEvent.time, aTouchEvent.timeStamp, aTouchEvent.modifiers) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), - "Can only copy from WidgetTouchEvent on main thread"); + MOZ_ASSERT(NS_IsMainThread(), + "Can only copy from WidgetTouchEvent on main thread"); switch (aTouchEvent.message) { case NS_TOUCH_START: @@ -78,8 +78,8 @@ MultiTouchInput::MultiTouchInput(const WidgetTouchEvent& aTouchEvent) WidgetTouchEvent MultiTouchInput::ToWidgetTouchEvent(nsIWidget* aWidget) const { - NS_ABORT_IF_FALSE(NS_IsMainThread(), - "Can only convert To WidgetTouchEvent on main thread"); + MOZ_ASSERT(NS_IsMainThread(), + "Can only convert To WidgetTouchEvent on main thread"); uint32_t touchType = NS_EVENT_NULL; switch (mType) { @@ -119,8 +119,8 @@ MultiTouchInput::ToWidgetTouchEvent(nsIWidget* aWidget) const WidgetMouseEvent MultiTouchInput::ToWidgetMouseEvent(nsIWidget* aWidget) const { - NS_ABORT_IF_FALSE(NS_IsMainThread(), - "Can only convert To WidgetMouseEvent on main thread"); + MOZ_ASSERT(NS_IsMainThread(), + "Can only convert To WidgetMouseEvent on main thread"); uint32_t mouseEventType = NS_EVENT_NULL; switch (mType) { @@ -179,8 +179,8 @@ MultiTouchInput::MultiTouchInput(const WidgetMouseEvent& aMouseEvent) : InputData(MULTITOUCH_INPUT, aMouseEvent.time, aMouseEvent.timeStamp, aMouseEvent.modifiers) { - NS_ABORT_IF_FALSE(NS_IsMainThread(), - "Can only copy from WidgetMouseEvent on main thread"); + MOZ_ASSERT(NS_IsMainThread(), + "Can only copy from WidgetMouseEvent on main thread"); switch (aMouseEvent.message) { case NS_MOUSE_BUTTON_DOWN: mType = MULTITOUCH_START; diff --git a/widget/InputData.h b/widget/InputData.h index 6229eabcc04..671a239d1f9 100644 --- a/widget/InputData.h +++ b/widget/InputData.h @@ -48,12 +48,12 @@ class ScrollWheelInput; #define INPUTDATA_AS_CHILD_TYPE(type, enumID) \ const type& As##type() const \ { \ - NS_ABORT_IF_FALSE(mInputType == enumID, "Invalid cast of InputData."); \ + MOZ_ASSERT(mInputType == enumID, "Invalid cast of InputData."); \ return (const type&) *this; \ } \ type& As##type() \ { \ - NS_ABORT_IF_FALSE(mInputType == enumID, "Invalid cast of InputData."); \ + MOZ_ASSERT(mInputType == enumID, "Invalid cast of InputData."); \ return (type&) *this; \ } diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp index 792fa92a479..d1194ff8c7f 100644 --- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -39,8 +39,8 @@ InvalidateRegion(nsIWidget* aWidget, const nsIntRegion& aRegion) /*static*/ already_AddRefed nsIWidget::CreatePuppetWidget(TabChild* aTabChild) { - NS_ABORT_IF_FALSE(!aTabChild || nsIWidget::UsePuppetWidgets(), - "PuppetWidgets not allowed in this configuration"); + MOZ_ASSERT(!aTabChild || nsIWidget::UsePuppetWidgets(), + "PuppetWidgets not allowed in this configuration"); nsCOMPtr widget = new PuppetWidget(aTabChild); return widget.forget(); @@ -98,7 +98,7 @@ PuppetWidget::Create(nsIWidget *aParent, const nsIntRect &aRect, nsWidgetInitData *aInitData) { - NS_ABORT_IF_FALSE(!aNativeParent, "got a non-Puppet native parent"); + MOZ_ASSERT(!aNativeParent, "got a non-Puppet native parent"); BaseCreate(nullptr, aRect, aInitData); @@ -292,8 +292,8 @@ PuppetWidget::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus) nsAutoCString("PuppetWidget"), 0); #endif - NS_ABORT_IF_FALSE(!mChild || mChild->mWindowType == eWindowType_popup, - "Unexpected event dispatch!"); + MOZ_ASSERT(!mChild || mChild->mWindowType == eWindowType_popup, + "Unexpected event dispatch!"); AutoCacheNativeKeyCommands autoCache(this); if (event->mFlags.mIsSynthesizedForTests && !mNativeKeyCommandsValid) { @@ -804,7 +804,7 @@ PuppetWidget::SetCursor(nsCursor aCursor) nsresult PuppetWidget::Paint() { - NS_ABORT_IF_FALSE(!mDirtyRegion.IsEmpty(), "paint event logic messed up"); + MOZ_ASSERT(!mDirtyRegion.IsEmpty(), "paint event logic messed up"); if (!mAttachedWidgetListener) return NS_OK; @@ -853,9 +853,9 @@ PuppetWidget::Paint() void PuppetWidget::SetChild(PuppetWidget* aChild) { - NS_ABORT_IF_FALSE(this != aChild, "can't parent a widget to itself"); - NS_ABORT_IF_FALSE(!aChild->mChild, - "fake widget 'hierarchy' only expected to have one level"); + MOZ_ASSERT(this != aChild, "can't parent a widget to itself"); + MOZ_ASSERT(!aChild->mChild, + "fake widget 'hierarchy' only expected to have one level"); mChild = aChild; } @@ -916,7 +916,7 @@ PuppetWidget::GetNativeData(uint32_t aDataType) { switch (aDataType) { case NS_NATIVE_SHAREABLE_WINDOW: { - NS_ABORT_IF_FALSE(mTabChild, "Need TabChild to get the nativeWindow from!"); + MOZ_ASSERT(mTabChild, "Need TabChild to get the nativeWindow from!"); mozilla::WindowsHandle nativeData = 0; if (mTabChild) { mTabChild->SendGetWidgetNativeData(&nativeData); diff --git a/widget/android/AndroidBridge.cpp b/widget/android/AndroidBridge.cpp index 5c48e3270d8..89f71b22391 100644 --- a/widget/android/AndroidBridge.cpp +++ b/widget/android/AndroidBridge.cpp @@ -1468,7 +1468,7 @@ AndroidBridge::SyncViewportInfo(const LayerIntRect& aDisplayPort, const CSSToLay aDisplayPort.width, aDisplayPort.height, aDisplayResolution.scale, aLayersUpdated); - NS_ABORT_IF_FALSE(viewTransform, "No view transform object!"); + MOZ_ASSERT(viewTransform, "No view transform object!"); aScrollOffset = ParentLayerPoint(viewTransform->X(), viewTransform->Y()); aScale.scale = viewTransform->Scale(); @@ -1500,7 +1500,7 @@ void AndroidBridge::SyncFrameMetrics(const ParentLayerPoint& aScrollOffset, floa aLayersUpdated, dp.x, dp.y, dp.width, dp.height, aDisplayResolution.scale, aIsFirstPaint); - NS_ABORT_IF_FALSE(viewTransform, "No view transform object!"); + MOZ_ASSERT(viewTransform, "No view transform object!"); aFixedLayerMargins.top = viewTransform->FixedLayerMarginTop(); aFixedLayerMargins.right = viewTransform->FixedLayerMarginRight(); diff --git a/widget/android/nsDeviceContextAndroid.cpp b/widget/android/nsDeviceContextAndroid.cpp index 14b0cbf5c5e..9e1c66736c3 100644 --- a/widget/android/nsDeviceContextAndroid.cpp +++ b/widget/android/nsDeviceContextAndroid.cpp @@ -36,7 +36,7 @@ nsDeviceContextSpecAndroid::GetSurfaceForPrinter(gfxASurface** aSurface) surface = new gfxPDFSurface(stream, surfaceSize); - NS_ABORT_IF_FALSE(surface, "valid address expected"); + MOZ_ASSERT(surface, "valid address expected"); surface.swap(*aSurface); return NS_OK; } diff --git a/widget/cocoa/WidgetTraceEvent.mm b/widget/cocoa/WidgetTraceEvent.mm index 7ea8313be6d..ff51fc04e99 100644 --- a/widget/cocoa/WidgetTraceEvent.mm +++ b/widget/cocoa/WidgetTraceEvent.mm @@ -53,7 +53,7 @@ void SignalTracerThread() // This function is called from the background tracer thread. bool FireAndWaitForTracerEvent() { - NS_ABORT_IF_FALSE(sMutex && sCondVar, "Tracing not initialized!"); + MOZ_ASSERT(sMutex && sCondVar, "Tracing not initialized!"); NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; MutexAutoLock lock(*sMutex); if (sTracerProcessed) { diff --git a/widget/gtk/WidgetTraceEvent.cpp b/widget/gtk/WidgetTraceEvent.cpp index 4bc7f510b7a..248d599797b 100644 --- a/widget/gtk/WidgetTraceEvent.cpp +++ b/widget/gtk/WidgetTraceEvent.cpp @@ -48,12 +48,12 @@ void CleanUpWidgetTracing() // This function is called from the background tracer thread. bool FireAndWaitForTracerEvent() { - NS_ABORT_IF_FALSE(sMutex && sCondVar, "Tracing not initialized!"); + MOZ_ASSERT(sMutex && sCondVar, "Tracing not initialized!"); // Send a default-priority idle event through the // event loop, and wait for it to finish. MutexAutoLock lock(*sMutex); - NS_ABORT_IF_FALSE(!sTracerProcessed, "Tracer synchronization state is wrong"); + MOZ_ASSERT(!sTracerProcessed, "Tracer synchronization state is wrong"); g_idle_add_full(G_PRIORITY_DEFAULT, TracerCallback, nullptr, diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp index 078bba2382b..fddfe019979 100644 --- a/widget/gtk/nsLookAndFeel.cpp +++ b/widget/gtk/nsLookAndFeel.cpp @@ -797,7 +797,7 @@ GetSystemFontInfo(LookAndFeel::FontID aID, gtk_widget_destroy(window); // no unref, windows are different } else { - NS_ABORT_IF_FALSE(aID == LookAndFeel::eFont_Menu, "unexpected font ID"); + MOZ_ASSERT(aID == LookAndFeel::eFont_Menu, "unexpected font ID"); GtkWidget *accel_label = gtk_accel_label_new("M"); GtkWidget *menuitem = gtk_menu_item_new(); GtkWidget *menu = gtk_menu_new(); diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index c81a0c0cc47..3d78a48a555 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -681,14 +681,14 @@ nsWindow::Destroy(void) gtk_widget_destroy(mShell); mShell = nullptr; mContainer = nullptr; - NS_ABORT_IF_FALSE(!mGdkWindow, - "mGdkWindow should be NULL when mContainer is destroyed"); + MOZ_ASSERT(!mGdkWindow, + "mGdkWindow should be NULL when mContainer is destroyed"); } else if (mContainer) { gtk_widget_destroy(GTK_WIDGET(mContainer)); mContainer = nullptr; - NS_ABORT_IF_FALSE(!mGdkWindow, - "mGdkWindow should be NULL when mContainer is destroyed"); + MOZ_ASSERT(!mGdkWindow, + "mGdkWindow should be NULL when mContainer is destroyed"); } else if (mGdkWindow) { // Destroy child windows to ensure that their mThebesSurfaces are @@ -763,8 +763,8 @@ nsWindow::SetParent(nsIWidget *aNewParent) if (!oldContainer) { // The GdkWindows have been destroyed so there is nothing else to // reparent. - NS_ABORT_IF_FALSE(gdk_window_is_destroyed(mGdkWindow), - "live GdkWindow with no widget"); + MOZ_ASSERT(gdk_window_is_destroyed(mGdkWindow), + "live GdkWindow with no widget"); return NS_OK; } @@ -795,12 +795,12 @@ nsWindow::ReparentNativeWidget(nsIWidget* aNewParent) if (!oldContainer) { // The GdkWindows have been destroyed so there is nothing else to // reparent. - NS_ABORT_IF_FALSE(gdk_window_is_destroyed(mGdkWindow), - "live GdkWindow with no widget"); + MOZ_ASSERT(gdk_window_is_destroyed(mGdkWindow), + "live GdkWindow with no widget"); return NS_OK; } - NS_ABORT_IF_FALSE(!gdk_window_is_destroyed(mGdkWindow), - "destroyed GdkWindow with widget"); + MOZ_ASSERT(!gdk_window_is_destroyed(mGdkWindow), + "destroyed GdkWindow with widget"); nsWindow* newParent = static_cast(aNewParent); GdkWindow* newParentWindow = newParent->mGdkWindow; @@ -826,14 +826,14 @@ nsWindow::ReparentNativeWidgetInternal(nsIWidget* aNewParent, { if (!aNewContainer) { // The new parent GdkWindow has been destroyed. - NS_ABORT_IF_FALSE(!aNewParentWindow || - gdk_window_is_destroyed(aNewParentWindow), - "live GdkWindow with no widget"); + MOZ_ASSERT(!aNewParentWindow || + gdk_window_is_destroyed(aNewParentWindow), + "live GdkWindow with no widget"); Destroy(); } else { if (aNewContainer != aOldContainer) { - NS_ABORT_IF_FALSE(!gdk_window_is_destroyed(aNewParentWindow), - "destroyed GdkWindow with widget"); + MOZ_ASSERT(!gdk_window_is_destroyed(aNewParentWindow), + "destroyed GdkWindow with widget"); SetWidgetForHierarchy(mGdkWindow, aOldContainer, aNewContainer); if (aOldContainer == gInvisibleContainer) { @@ -6317,12 +6317,19 @@ nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent, if (!gdk_window) { return false; } - NS_ABORT_IF_FALSE(GDK_IS_WINDOW(gdk_window), "must really be window"); +#ifdef DEBUG + // GDK_IS_WINDOW(...) expands to a statement-expression, and + // statement-expressions are not allowed in template-argument lists. So we + // have to make the MOZ_ASSERT condition indirect. + if (!GDK_IS_WINDOW(gdk_window)) { + MOZ_ASSERT(false, "must really be window"); + } +#endif // find the top-level window gdk_window = gdk_window_get_toplevel(gdk_window); - NS_ABORT_IF_FALSE(gdk_window, - "gdk_window_get_toplevel should not return null"); + MOZ_ASSERT(gdk_window, + "gdk_window_get_toplevel should not return null"); *aWindow = gdk_window; if (!aMouseEvent->widget) { @@ -6344,9 +6351,9 @@ nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent, NS_IMETHODIMP nsWindow::BeginMoveDrag(WidgetMouseEvent* aEvent) { - NS_ABORT_IF_FALSE(aEvent, "must have event"); - NS_ABORT_IF_FALSE(aEvent->mClass == eMouseEventClass, - "event must have correct struct type"); + MOZ_ASSERT(aEvent, "must have event"); + MOZ_ASSERT(aEvent->mClass == eMouseEventClass, + "event must have correct struct type"); GdkWindow *gdk_window; gint button, screenX, screenY; diff --git a/widget/nsBaseScreen.cpp b/widget/nsBaseScreen.cpp index 9ddbeb8ac00..eafb52f97aa 100644 --- a/widget/nsBaseScreen.cpp +++ b/widget/nsBaseScreen.cpp @@ -36,12 +36,11 @@ nsBaseScreen::GetAvailRectDisplayPix(int32_t *outLeft, int32_t *outTop, NS_IMETHODIMP nsBaseScreen::LockMinimumBrightness(uint32_t aBrightness) { - NS_ABORT_IF_FALSE( - aBrightness < nsIScreen::BRIGHTNESS_LEVELS, - "Invalid brightness level to lock"); + MOZ_ASSERT(aBrightness < nsIScreen::BRIGHTNESS_LEVELS, + "Invalid brightness level to lock"); mBrightnessLocks[aBrightness]++; - NS_ABORT_IF_FALSE(mBrightnessLocks[aBrightness] > 0, - "Overflow after locking brightness level"); + MOZ_ASSERT(mBrightnessLocks[aBrightness] > 0, + "Overflow after locking brightness level"); CheckMinimumBrightness(); @@ -51,11 +50,10 @@ nsBaseScreen::LockMinimumBrightness(uint32_t aBrightness) NS_IMETHODIMP nsBaseScreen::UnlockMinimumBrightness(uint32_t aBrightness) { - NS_ABORT_IF_FALSE( - aBrightness < nsIScreen::BRIGHTNESS_LEVELS, - "Invalid brightness level to lock"); - NS_ABORT_IF_FALSE(mBrightnessLocks[aBrightness] > 0, - "Unlocking a brightness level with no corresponding lock"); + MOZ_ASSERT(aBrightness < nsIScreen::BRIGHTNESS_LEVELS, + "Invalid brightness level to lock"); + MOZ_ASSERT(mBrightnessLocks[aBrightness] > 0, + "Unlocking a brightness level with no corresponding lock"); mBrightnessLocks[aBrightness]--; CheckMinimumBrightness(); diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index 56d1264786b..c8d08a1fd28 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -319,7 +319,7 @@ nsBaseWidget::CreateChild(const nsIntRect &aRect, // nativeWidget parameter. nativeParent = parent ? parent->GetNativeData(NS_NATIVE_WIDGET) : nullptr; parent = nativeParent ? nullptr : parent; - NS_ABORT_IF_FALSE(!parent || !nativeParent, "messed up logic"); + MOZ_ASSERT(!parent || !nativeParent, "messed up logic"); } nsCOMPtr widget; diff --git a/widget/qt/nsDeviceContextSpecQt.cpp b/widget/qt/nsDeviceContextSpecQt.cpp index 66a7e7a467c..b1f0fce57e6 100644 --- a/widget/qt/nsDeviceContextSpecQt.cpp +++ b/widget/qt/nsDeviceContextSpecQt.cpp @@ -124,7 +124,7 @@ NS_IMETHODIMP nsDeviceContextSpecQt::GetSurfaceForPrinter( return NS_ERROR_NOT_IMPLEMENTED; } - NS_ABORT_IF_FALSE(surface, "valid address expected"); + MOZ_ASSERT(surface, "valid address expected"); surface.swap(*aSurface); return NS_OK; diff --git a/widget/windows/AudioSession.cpp b/widget/windows/AudioSession.cpp index 55eb7dca3f2..7a9ad140c7b 100644 --- a/widget/windows/AudioSession.cpp +++ b/widget/windows/AudioSession.cpp @@ -174,10 +174,10 @@ AudioSession::QueryInterface(REFIID iid, void **ppv) nsresult AudioSession::Start() { - NS_ABORT_IF_FALSE(mState == UNINITIALIZED || - mState == CLONED || - mState == AUDIO_SESSION_DISCONNECTED, - "State invariants violated"); + MOZ_ASSERT(mState == UNINITIALIZED || + mState == CLONED || + mState == AUDIO_SESSION_DISCONNECTED, + "State invariants violated"); const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator); const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator); @@ -196,8 +196,8 @@ AudioSession::Start() if (XRE_GetProcessType() == GeckoProcessType_Content) return NS_ERROR_FAILURE; - NS_ABORT_IF_FALSE(XRE_GetProcessType() == GeckoProcessType_Default, - "Should only get here in a chrome process!"); + MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default, + "Should only get here in a chrome process!"); nsCOMPtr bundleService = do_GetService(NS_STRINGBUNDLE_CONTRACTID); @@ -225,8 +225,8 @@ AudioSession::Start() mState = FAILED; - NS_ABORT_IF_FALSE(!mDisplayName.IsEmpty() || !mIconPath.IsEmpty(), - "Should never happen ..."); + MOZ_ASSERT(!mDisplayName.IsEmpty() || !mIconPath.IsEmpty(), + "Should never happen ..."); nsRefPtr enumerator; hr = ::CoCreateInstance(CLSID_MMDeviceEnumerator, @@ -306,10 +306,10 @@ AudioSession::StopInternal() nsresult AudioSession::Stop() { - NS_ABORT_IF_FALSE(mState == STARTED || - mState == UNINITIALIZED || // XXXremove this - mState == FAILED, - "State invariants violated"); + MOZ_ASSERT(mState == STARTED || + mState == UNINITIALIZED || // XXXremove this + mState == FAILED, + "State invariants violated"); mState = STOPPED; nsRefPtr kungFuDeathGrip; @@ -340,10 +340,10 @@ AudioSession::GetSessionData(nsID& aID, nsString& aSessionName, nsString& aIconPath) { - NS_ABORT_IF_FALSE(mState == FAILED || - mState == STARTED || - mState == CLONED, - "State invariants violated"); + MOZ_ASSERT(mState == FAILED || + mState == STARTED || + mState == CLONED, + "State invariants violated"); CopynsID(aID, mSessionGroupingParameter); aSessionName = mDisplayName; @@ -360,10 +360,10 @@ AudioSession::SetSessionData(const nsID& aID, const nsString& aSessionName, const nsString& aIconPath) { - NS_ABORT_IF_FALSE(mState == UNINITIALIZED, - "State invariants violated"); - NS_ABORT_IF_FALSE(XRE_GetProcessType() != GeckoProcessType_Default, - "Should never get here in a chrome process!"); + MOZ_ASSERT(mState == UNINITIALIZED, + "State invariants violated"); + MOZ_ASSERT(XRE_GetProcessType() != GeckoProcessType_Default, + "Should never get here in a chrome process!"); mState = CLONED; CopynsID(mSessionGroupingParameter, aID); diff --git a/widget/windows/WidgetTraceEvent.cpp b/widget/windows/WidgetTraceEvent.cpp index ca319ee1771..1485e759db5 100644 --- a/widget/windows/WidgetTraceEvent.cpp +++ b/widget/windows/WidgetTraceEvent.cpp @@ -111,7 +111,7 @@ void SignalTracerThread() // This function is called from the background tracer thread. bool FireAndWaitForTracerEvent() { - NS_ABORT_IF_FALSE(sEventHandle, "Tracing not initialized!"); + MOZ_ASSERT(sEventHandle, "Tracing not initialized!"); // First, try to find the hidden window. static HWND hidden_window = nullptr; diff --git a/widget/windows/WinMouseScrollHandler.cpp b/widget/windows/WinMouseScrollHandler.cpp index 8bfb06a67c5..b1e123706fa 100644 --- a/widget/windows/WinMouseScrollHandler.cpp +++ b/widget/windows/WinMouseScrollHandler.cpp @@ -607,7 +607,7 @@ MouseScrollHandler::HandleMouseWheelMessage(nsWindowBase* aWidget, WPARAM aWParam, LPARAM aLParam) { - NS_ABORT_IF_FALSE( + MOZ_ASSERT( (aMessage == MOZ_WM_MOUSEVWHEEL || aMessage == MOZ_WM_MOUSEHWHEEL), "HandleMouseWheelMessage must be called with " "MOZ_WM_MOUSEVWHEEL or MOZ_WM_MOUSEHWHEEL"); @@ -672,7 +672,7 @@ MouseScrollHandler::HandleScrollMessageAsMouseWheelMessage(nsWindowBase* aWidget WPARAM aWParam, LPARAM aLParam) { - NS_ABORT_IF_FALSE( + MOZ_ASSERT( (aMessage == MOZ_WM_VSCROLL || aMessage == MOZ_WM_HSCROLL), "HandleScrollMessageAsMouseWheelMessage must be called with " "MOZ_WM_VSCROLL or MOZ_WM_HSCROLL"); @@ -743,7 +743,7 @@ MouseScrollHandler::EventInfo::EventInfo(nsWindowBase* aWidget, UINT aMessage, WPARAM aWParam, LPARAM aLParam) { - NS_ABORT_IF_FALSE(aMessage == WM_MOUSEWHEEL || aMessage == WM_MOUSEHWHEEL, + MOZ_ASSERT(aMessage == WM_MOUSEWHEEL || aMessage == WM_MOUSEHWHEEL, "EventInfo must be initialized with WM_MOUSEWHEEL or WM_MOUSEHWHEEL"); MouseScrollHandler::GetInstance()->mSystemSettings.Init(); diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index a8f94a25a96..37a72d1c0a2 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -1026,7 +1026,7 @@ public: void StartBlock(Block* aBlock) { - NS_ABORT_IF_FALSE(!mFreeList, "should not have free list"); + MOZ_ASSERT(!mFreeList, "should not have free list"); // Put all the entries in the block on the free list. nsPurpleBufferEntry* entries = aBlock->mEntries; diff --git a/xpcom/build/Omnijar.cpp b/xpcom/build/Omnijar.cpp index 3a5fea6f008..9477b98050f 100644 --- a/xpcom/build/Omnijar.cpp +++ b/xpcom/build/Omnijar.cpp @@ -120,7 +120,7 @@ Omnijar::CleanUp() already_AddRefed Omnijar::GetReader(nsIFile* aPath) { - NS_ABORT_IF_FALSE(IsInitialized(), "Omnijar not initialized"); + MOZ_ASSERT(IsInitialized(), "Omnijar not initialized"); bool equals; nsresult rv; @@ -143,7 +143,7 @@ Omnijar::GetReader(nsIFile* aPath) nsresult Omnijar::GetURIString(Type aType, nsACString& aResult) { - NS_ABORT_IF_FALSE(IsInitialized(), "Omnijar not initialized"); + MOZ_ASSERT(IsInitialized(), "Omnijar not initialized"); aResult.Truncate(); diff --git a/xpcom/build/Omnijar.h b/xpcom/build/Omnijar.h index 5c18447f7c4..777115b6d6d 100644 --- a/xpcom/build/Omnijar.h +++ b/xpcom/build/Omnijar.h @@ -71,7 +71,7 @@ public: */ static inline already_AddRefed GetPath(Type aType) { - NS_ABORT_IF_FALSE(IsInitialized(), "Omnijar not initialized"); + MOZ_ASSERT(IsInitialized(), "Omnijar not initialized"); nsCOMPtr path = sPath[aType]; return path.forget(); } @@ -82,7 +82,7 @@ public: */ static inline bool HasOmnijar(Type aType) { - NS_ABORT_IF_FALSE(IsInitialized(), "Omnijar not initialized"); + MOZ_ASSERT(IsInitialized(), "Omnijar not initialized"); return !!sPath[aType]; } @@ -92,7 +92,7 @@ public: */ static inline already_AddRefed GetReader(Type aType) { - NS_ABORT_IF_FALSE(IsInitialized(), "Omnijar not initialized"); + MOZ_ASSERT(IsInitialized(), "Omnijar not initialized"); nsRefPtr reader = sReader[aType]; return reader.forget(); } diff --git a/xpcom/ds/TimeStamp_darwin.cpp b/xpcom/ds/TimeStamp_darwin.cpp index 071d0d5a77f..6f92e879527 100644 --- a/xpcom/ds/TimeStamp_darwin.cpp +++ b/xpcom/ds/TimeStamp_darwin.cpp @@ -84,14 +84,14 @@ namespace mozilla { double BaseTimeDurationPlatformUtils::ToSeconds(int64_t aTicks) { - NS_ABORT_IF_FALSE(gInitialized, "calling TimeDuration too early"); + MOZ_ASSERT(gInitialized, "calling TimeDuration too early"); return (aTicks * sNsPerTick) / kNsPerSecd; } double BaseTimeDurationPlatformUtils::ToSecondsSigDigits(int64_t aTicks) { - NS_ABORT_IF_FALSE(gInitialized, "calling TimeDuration too early"); + MOZ_ASSERT(gInitialized, "calling TimeDuration too early"); // don't report a value < mResolution ... int64_t valueSigDigs = sResolution * (aTicks / sResolution); // and chop off insignificant digits @@ -102,7 +102,7 @@ BaseTimeDurationPlatformUtils::ToSecondsSigDigits(int64_t aTicks) int64_t BaseTimeDurationPlatformUtils::TicksFromMilliseconds(double aMilliseconds) { - NS_ABORT_IF_FALSE(gInitialized, "calling TimeDuration too early"); + MOZ_ASSERT(gInitialized, "calling TimeDuration too early"); double result = (aMilliseconds * kNsPerMsd) / sNsPerTick; if (result > INT64_MAX) { return INT64_MAX; @@ -116,7 +116,7 @@ BaseTimeDurationPlatformUtils::TicksFromMilliseconds(double aMilliseconds) int64_t BaseTimeDurationPlatformUtils::ResolutionInTicks() { - NS_ABORT_IF_FALSE(gInitialized, "calling TimeDuration too early"); + MOZ_ASSERT(gInitialized, "calling TimeDuration too early"); return static_cast(sResolution); } diff --git a/xpcom/glue/BlockingResourceBase.cpp b/xpcom/glue/BlockingResourceBase.cpp index a9170a0b07a..d141b9812c2 100644 --- a/xpcom/glue/BlockingResourceBase.cpp +++ b/xpcom/glue/BlockingResourceBase.cpp @@ -212,7 +212,7 @@ BlockingResourceBase::BlockingResourceBase( , mAcquired() #endif { - NS_ABORT_IF_FALSE(mName, "Name must be nonnull"); + MOZ_ASSERT(mName, "Name must be nonnull"); // PR_CallOnce guaranatees that InitStatics is called in a // thread-safe way if (PR_SUCCESS != PR_CallOnce(&sCallOnce, InitStatics)) { diff --git a/xpcom/glue/nsCOMPtr.h b/xpcom/glue/nsCOMPtr.h index bda07de659b..859503981da 100644 --- a/xpcom/glue/nsCOMPtr.h +++ b/xpcom/glue/nsCOMPtr.h @@ -26,7 +26,7 @@ #include "mozilla/Move.h" #include "mozilla/TypeTraits.h" -#include "nsDebug.h" // for |NS_ABORT_IF_FALSE|, |NS_ASSERTION| +#include "nsDebug.h" // for |NS_ASSERTION| #include "nsISupportsUtils.h" // for |nsresult|, |NS_ADDREF|, |NS_GET_TEMPLATE_IID| et al #include "nsCycleCollectionNoteChild.h" @@ -694,8 +694,8 @@ public: T* operator->() const MOZ_NO_ADDREF_RELEASE_ON_RETURN { - NS_ABORT_IF_FALSE(mRawPtr != 0, - "You can't dereference a NULL nsCOMPtr with operator->()."); + MOZ_ASSERT(mRawPtr != 0, + "You can't dereference a NULL nsCOMPtr with operator->()."); return get(); } @@ -706,8 +706,8 @@ public: public: T& operator*() const { - NS_ABORT_IF_FALSE(mRawPtr != 0, - "You can't dereference a NULL nsCOMPtr with operator*()."); + MOZ_ASSERT(mRawPtr != 0, + "You can't dereference a NULL nsCOMPtr with operator*()."); return *get(); } @@ -973,8 +973,8 @@ public: nsISupports* operator->() const MOZ_NO_ADDREF_RELEASE_ON_RETURN { - NS_ABORT_IF_FALSE(mRawPtr != 0, - "You can't dereference a NULL nsCOMPtr with operator->()."); + MOZ_ASSERT(mRawPtr != 0, + "You can't dereference a NULL nsCOMPtr with operator->()."); return get(); } @@ -986,8 +986,8 @@ public: nsISupports& operator*() const { - NS_ABORT_IF_FALSE(mRawPtr != 0, - "You can't dereference a NULL nsCOMPtr with operator*()."); + MOZ_ASSERT(mRawPtr != 0, + "You can't dereference a NULL nsCOMPtr with operator*()."); return *get(); } diff --git a/xpcom/glue/nsStringAPI.h b/xpcom/glue/nsStringAPI.h index e5e052f409e..d6ee4982876 100644 --- a/xpcom/glue/nsStringAPI.h +++ b/xpcom/glue/nsStringAPI.h @@ -1446,8 +1446,8 @@ Substring(const nsAString& aStr, uint32_t aStartPos, uint32_t aLength) inline const nsDependentSubstring Substring(const char16_t* aStart, const char16_t* aEnd) { - NS_ABORT_IF_FALSE(uint32_t(aEnd - aStart) == uintptr_t(aEnd - aStart), - "string too long"); + MOZ_ASSERT(uint32_t(aEnd - aStart) == uintptr_t(aEnd - aStart), + "string too long"); return nsDependentSubstring(aStart, uint32_t(aEnd - aStart)); } @@ -1485,8 +1485,8 @@ Substring(const nsACString& aStr, uint32_t aStartPos, uint32_t aLength) inline const nsDependentCSubstring Substring(const char* aStart, const char* aEnd) { - NS_ABORT_IF_FALSE(uint32_t(aEnd - aStart) == uintptr_t(aEnd - aStart), - "string too long"); + MOZ_ASSERT(uint32_t(aEnd - aStart) == uintptr_t(aEnd - aStart), + "string too long"); return nsDependentCSubstring(aStart, uint32_t(aEnd - aStart)); } diff --git a/xpcom/glue/nsTArray-inl.h b/xpcom/glue/nsTArray-inl.h index 16da3e93c21..4f4d05f752d 100644 --- a/xpcom/glue/nsTArray-inl.h +++ b/xpcom/glue/nsTArray-inl.h @@ -45,8 +45,8 @@ nsTArray_base::GetAutoArrayBufferUnsafe(size_t aElemAlign) const "auto array padding wasn't what we expected"); // We don't support alignments greater than 8 bytes. - NS_ABORT_IF_FALSE(aElemAlign <= 4 || aElemAlign == 8, - "unsupported alignment."); + MOZ_ASSERT(aElemAlign <= 4 || aElemAlign == 8, + "unsupported alignment."); if (sizeof(void*) == 4 && aElemAlign == 8) { autoBuf = reinterpret_cast(autoBuf) + 4; } @@ -97,8 +97,8 @@ nsTArray_base::UsesAutoArrayBuffer() const #ifdef DEBUG ptrdiff_t diff = reinterpret_cast(GetAutoArrayBuffer(8)) - reinterpret_cast(GetAutoArrayBuffer(4)); - NS_ABORT_IF_FALSE(diff >= 0 && diff <= 4, - "GetAutoArrayBuffer doesn't do what we expect."); + MOZ_ASSERT(diff >= 0 && diff <= 4, + "GetAutoArrayBuffer doesn't do what we expect."); #endif return mHdr == GetAutoArrayBuffer(4) || mHdr == GetAutoArrayBuffer(8); @@ -378,9 +378,8 @@ nsTArray_base::SwapArrayElements(nsTArray_base::SwapArrayElements(nsTArray_basemLength = aOther.Length(); aOther.mHdr->mLength = tempLength; diff --git a/xpcom/glue/nsTArray.h b/xpcom/glue/nsTArray.h index a45e9630866..b0dbc807131 100644 --- a/xpcom/glue/nsTArray.h +++ b/xpcom/glue/nsTArray.h @@ -1530,8 +1530,8 @@ public: void TruncateLength(size_type aNewLen) { size_type oldLen = Length(); - NS_ABORT_IF_FALSE(aNewLen <= oldLen, - "caller should use SetLength instead"); + MOZ_ASSERT(aNewLen <= oldLen, + "caller should use SetLength instead"); RemoveElementsAt(aNewLen, oldLen - aNewLen); } diff --git a/xpcom/glue/nsTPriorityQueue.h b/xpcom/glue/nsTPriorityQueue.h index 2fcfcc4206a..20a0fc8a557 100644 --- a/xpcom/glue/nsTPriorityQueue.h +++ b/xpcom/glue/nsTPriorityQueue.h @@ -61,7 +61,7 @@ public: */ const T& Top() const { - NS_ABORT_IF_FALSE(!mElements.IsEmpty(), "Empty queue"); + MOZ_ASSERT(!mElements.IsEmpty(), "Empty queue"); return mElements[0]; } @@ -99,7 +99,7 @@ public: */ T Pop() { - NS_ABORT_IF_FALSE(!mElements.IsEmpty(), "Empty queue"); + MOZ_ASSERT(!mElements.IsEmpty(), "Empty queue"); T pop = mElements[0]; // Move last to front diff --git a/xpcom/io/Base64.cpp b/xpcom/io/Base64.cpp index 91f1d54710e..afa28656b63 100644 --- a/xpcom/io/Base64.cpp +++ b/xpcom/io/Base64.cpp @@ -131,8 +131,8 @@ EncodeInputStream_Encoder(nsIInputStream* aStream, // Encode the bulk of the uint32_t encodeLength = countRemaining - countRemaining % 3; - NS_ABORT_IF_FALSE(encodeLength % 3 == 0, - "Should have an exact number of triplets!"); + MOZ_ASSERT(encodeLength % 3 == 0, + "Should have an exact number of triplets!"); Encode(src, encodeLength, state->buffer); state->buffer += (encodeLength / 3) * 4; src += encodeLength; @@ -143,7 +143,7 @@ EncodeInputStream_Encoder(nsIInputStream* aStream, if (countRemaining) { // We should never have a full triplet left at this point. - NS_ABORT_IF_FALSE(countRemaining < 3, "We should have encoded more!"); + MOZ_ASSERT(countRemaining < 3, "We should have encoded more!"); state->c[0] = src[0]; state->c[1] = (countRemaining == 2) ? src[1] : '\0'; state->charsOnStack = countRemaining; diff --git a/xpcom/io/nsInputStreamTee.cpp b/xpcom/io/nsInputStreamTee.cpp index 3ac142985e5..cc8345cafd0 100644 --- a/xpcom/io/nsInputStreamTee.cpp +++ b/xpcom/io/nsInputStreamTee.cpp @@ -95,7 +95,7 @@ public: "memory not allocated\n"); return NS_OK; } - NS_ABORT_IF_FALSE(mSink, "mSink is null!"); + MOZ_ASSERT(mSink, "mSink is null!"); // The output stream could have been invalidated between when // this event was dispatched and now, so check before writing. diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index e647e82112c..35db72fac00 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -554,7 +554,7 @@ IsShortcutPath(const nsAString& aPath) // Under Windows, the shortcuts are just files with a ".lnk" extension. // Note also that we don't resolve links in the middle of paths. // i.e. "c:\foo.lnk\bar.txt" is invalid. - NS_ABORT_IF_FALSE(!aPath.IsEmpty(), "don't pass an empty string"); + MOZ_ASSERT(!aPath.IsEmpty(), "don't pass an empty string"); int32_t len = aPath.Length(); return len >= 4 && (StringTail(aPath, 4).LowerCaseEqualsASCII(".lnk")); } diff --git a/xpcom/string/nsAlgorithm.h b/xpcom/string/nsAlgorithm.h index b269393a9f8..a9a6f6e4aa7 100644 --- a/xpcom/string/nsAlgorithm.h +++ b/xpcom/string/nsAlgorithm.h @@ -40,8 +40,8 @@ template inline const T& clamped(const T& aA, const T& aMin, const T& aMax) { - NS_ABORT_IF_FALSE(aMax >= aMin, - "clamped(): aMax must be greater than or equal to aMin"); + MOZ_ASSERT(aMax >= aMin, + "clamped(): aMax must be greater than or equal to aMin"); return XPCOM_MIN(XPCOM_MAX(aA, aMin), aMax); } diff --git a/xpcom/string/nsTDependentString.cpp b/xpcom/string/nsTDependentString.cpp index a32c8f2547d..2f3a095d15f 100644 --- a/xpcom/string/nsTDependentString.cpp +++ b/xpcom/string/nsTDependentString.cpp @@ -7,7 +7,7 @@ void nsTDependentString_CharT::Rebind(const string_type& str, uint32_t startPos) { - NS_ABORT_IF_FALSE(str.Flags() & F_TERMINATED, "Unterminated flat string"); + MOZ_ASSERT(str.Flags() & F_TERMINATED, "Unterminated flat string"); // If we currently own a buffer, release it. Finalize(); diff --git a/xpcom/string/nsTSubstring.cpp b/xpcom/string/nsTSubstring.cpp index 29f36dd57c7..723df6c1855 100644 --- a/xpcom/string/nsTSubstring.cpp +++ b/xpcom/string/nsTSubstring.cpp @@ -399,7 +399,7 @@ nsTSubstring_CharT::Assign(const self_type& aStr, const fallible_t& aFallible) nsStringBuffer::FromData(mData)->AddRef(); return true; } else if (aStr.mFlags & F_LITERAL) { - NS_ABORT_IF_FALSE(aStr.mFlags & F_TERMINATED, "Unterminated literal"); + MOZ_ASSERT(aStr.mFlags & F_TERMINATED, "Unterminated literal"); AssignLiteral(aStr.mData, aStr.mLength); return true; diff --git a/xpcom/threads/TimerThread.h b/xpcom/threads/TimerThread.h index d361c0ee75d..1dce61f9936 100644 --- a/xpcom/threads/TimerThread.h +++ b/xpcom/threads/TimerThread.h @@ -92,7 +92,7 @@ struct TimerAdditionComparator bool LessThan(nsTimerImpl* aFromArray, nsTimerImpl* aNewTimer) const { - NS_ABORT_IF_FALSE(aNewTimer == timerToInsert, "Unexpected timer ordering"); + MOZ_ASSERT(aNewTimer == timerToInsert, "Unexpected timer ordering"); // Skip any overdue timers. return aFromArray->mTimeout <= now ||