Bug 924188 - Use MOZ_ASSERT where appropriate in WebGL code - r=jgilbert
authorBenoit Jacob <bjacob@mozilla.com>
Fri, 11 Oct 2013 09:16:43 -0400
changeset 164280 1632bbff03ad552628cee3b1d4ce86b18938f12f
parent 164279 96835ec2de1d198593dfd9d28f206477b166b198
child 164281 110789fb8722a8fe2988bcba2f55cfb272aea01f
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs924188
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 924188 - Use MOZ_ASSERT where appropriate in WebGL code - r=jgilbert
content/canvas/src/CanvasRenderingContext2D.cpp
content/canvas/src/WebGLContextBuffers.cpp
content/canvas/src/WebGLContextGL.cpp
content/canvas/src/WebGLContextUtils.cpp
content/canvas/src/WebGLContextValidate.cpp
content/canvas/src/WebGLFramebuffer.cpp
content/canvas/src/WebGLObjectModel.h
content/canvas/src/WebGLTexelConversions.cpp
content/canvas/src/WebGLTexelConversions.h
content/canvas/src/WebGLUniformInfo.h
--- a/content/canvas/src/CanvasRenderingContext2D.cpp
+++ b/content/canvas/src/CanvasRenderingContext2D.cpp
@@ -1037,17 +1037,17 @@ CanvasRenderingContext2D::Render(gfxCont
   ctx->Fill();
 
   if (mOpaque)
       ctx->SetOperator(op);
 
   if (!(aFlags & RenderFlagPremultAlpha)) {
       nsRefPtr<gfxASurface> curSurface = ctx->CurrentSurface();
       nsRefPtr<gfxImageSurface> gis = curSurface->GetAsImageSurface();
-      NS_ABORT_IF_FALSE(gis, "If non-premult alpha, must be able to get image surface!");
+      MOZ_ASSERT(gis, "If non-premult alpha, must be able to get image surface!");
 
       gfxUtils::UnpremultiplyImageSurface(gis);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
@@ -3579,17 +3579,17 @@ CanvasRenderingContext2D::GetImageDataAr
 void
 CanvasRenderingContext2D::EnsureErrorTarget()
 {
   if (sErrorTarget) {
     return;
   }
 
   RefPtr<DrawTarget> errorTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(IntSize(1, 1), FORMAT_B8G8R8A8);
-  NS_ABORT_IF_FALSE(errorTarget, "Failed to allocate the error target!");
+  MOZ_ASSERT(errorTarget, "Failed to allocate the error target!");
 
   sErrorTarget = errorTarget;
   NS_ADDREF(sErrorTarget);
 }
 
 void
 CanvasRenderingContext2D::FillRuleChanged()
 {
--- a/content/canvas/src/WebGLContextBuffers.cpp
+++ b/content/canvas/src/WebGLContextBuffers.cpp
@@ -476,17 +476,17 @@ WebGLContext::CheckedBufferData(GLenum t
     }
 #endif
     WebGLBuffer *boundBuffer = nullptr;
     if (target == LOCAL_GL_ARRAY_BUFFER) {
         boundBuffer = mBoundArrayBuffer;
     } else if (target == LOCAL_GL_ELEMENT_ARRAY_BUFFER) {
         boundBuffer = mBoundVertexArray->mBoundElementArrayBuffer;
     }
-    NS_ABORT_IF_FALSE(boundBuffer != nullptr, "no buffer bound for this target");
+    MOZ_ASSERT(boundBuffer != nullptr, "no buffer bound for this target");
 
     bool sizeChanges = uint32_t(size) != boundBuffer->ByteLength();
     if (sizeChanges) {
         UpdateWebGLErrorAndClearGLError();
         gl->fBufferData(target, size, data, usage);
         GLenum error = LOCAL_GL_NO_ERROR;
         UpdateWebGLErrorAndClearGLError(&error);
         return error;
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -2152,17 +2152,17 @@ WebGLContext::LinkProgram(WebGLProgram *
 
                 const char *shaderTypeName = nullptr;
                 if (shader->ShaderType() == LOCAL_GL_VERTEX_SHADER) {
                     shaderTypeName = "vertex";
                 } else if (shader->ShaderType() == LOCAL_GL_FRAGMENT_SHADER) {
                     shaderTypeName = "fragment";
                 } else {
                     // should have been validated earlier
-                    NS_ABORT();
+                    MOZ_ASSERT(false);
                     shaderTypeName = "<unknown>";
                 }
 
                 GetShaderInfoLog(shader, log);
 
                 GenerateWarning("linkProgram: a %s shader used in this program failed to "
                                 "compile, with this log:\n%s\n",
                                 shaderTypeName,
@@ -3661,17 +3661,17 @@ GLenum WebGLContext::CheckedTexImage2D(G
                                        GLsizei width,
                                        GLsizei height,
                                        GLint border,
                                        GLenum format,
                                        GLenum type,
                                        const GLvoid *data)
 {
     WebGLTexture *tex = activeBoundTextureForTarget(target);
-    NS_ABORT_IF_FALSE(tex != nullptr, "no texture bound");
+    MOZ_ASSERT(tex != nullptr, "no texture bound");
 
     bool sizeMayChange = true;
     
     if (tex->HasImageInfoAt(target, level)) {
         const WebGLTexture::ImageInfo& imageInfo = tex->ImageInfoAt(target, level);
         sizeMayChange = width != imageInfo.Width() ||
                         height != imageInfo.Height() ||
                         format != imageInfo.Format() ||
@@ -4157,46 +4157,46 @@ WebGLTexelFormat mozilla::GetWebGLTexelF
                 return WebGLTexelConversions::RGB8;
             case LOCAL_GL_ALPHA:
                 return WebGLTexelConversions::A8;
             case LOCAL_GL_LUMINANCE:
                 return WebGLTexelConversions::R8;
             case LOCAL_GL_LUMINANCE_ALPHA:
                 return WebGLTexelConversions::RA8;
             default:
-                NS_ABORT_IF_FALSE(false, "Coding mistake?! Should never reach this point.");
+                MOZ_ASSERT(false, "Coding mistake?! Should never reach this point.");
                 return WebGLTexelConversions::BadFormat;
         }
     } else if (type == LOCAL_GL_FLOAT) {
         // OES_texture_float
         switch (format) {
             case LOCAL_GL_RGBA:
                 return WebGLTexelConversions::RGBA32F;
             case LOCAL_GL_RGB:
                 return WebGLTexelConversions::RGB32F;
             case LOCAL_GL_ALPHA:
                 return WebGLTexelConversions::A32F;
             case LOCAL_GL_LUMINANCE:
                 return WebGLTexelConversions::R32F;
             case LOCAL_GL_LUMINANCE_ALPHA:
                 return WebGLTexelConversions::RA32F;
             default:
-                NS_ABORT_IF_FALSE(false, "Coding mistake?! Should never reach this point.");
+                MOZ_ASSERT(false, "Coding mistake?! Should never reach this point.");
                 return WebGLTexelConversions::BadFormat;
         }
     } else {
         switch (type) {
             case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4:
                 return WebGLTexelConversions::RGBA4444;
             case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1:
                 return WebGLTexelConversions::RGBA5551;
             case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
                 return WebGLTexelConversions::RGB565;
             default:
-                NS_ABORT_IF_FALSE(false, "Coding mistake?! Should never reach this point.");
+                MOZ_ASSERT(false, "Coding mistake?! Should never reach this point.");
                 return WebGLTexelConversions::BadFormat;
         }
     }
 }
 
 GLenum
 InternalFormatForFormatAndType(GLenum format, GLenum type, bool isGLES2)
 {
--- a/content/canvas/src/WebGLContextUtils.cpp
+++ b/content/canvas/src/WebGLContextUtils.cpp
@@ -184,17 +184,17 @@ WebGLContext::ErrorName(GLenum error)
             return "INVALID_VALUE";
         case LOCAL_GL_OUT_OF_MEMORY:
             return "OUT_OF_MEMORY";
         case LOCAL_GL_INVALID_FRAMEBUFFER_OPERATION:
             return "INVALID_FRAMEBUFFER_OPERATION";
         case LOCAL_GL_NO_ERROR:
             return "NO_ERROR";
         default:
-            NS_ABORT();
+            MOZ_ASSERT(false);
             return "[unknown WebGL error!]";
     }
 }
 
 bool
 WebGLContext::IsTextureFormatCompressed(GLenum format)
 {
     switch(format) {
@@ -216,18 +216,17 @@ WebGLContext::IsTextureFormatCompressed(
         case LOCAL_GL_ATC_RGBA_INTERPOLATED_ALPHA:
         case LOCAL_GL_COMPRESSED_RGB_PVRTC_4BPPV1:
         case LOCAL_GL_COMPRESSED_RGB_PVRTC_2BPPV1:
         case LOCAL_GL_COMPRESSED_RGBA_PVRTC_4BPPV1:
         case LOCAL_GL_COMPRESSED_RGBA_PVRTC_2BPPV1:
             return true;
     }
 
-    NS_NOTREACHED("Invalid WebGL texture format?");
-    NS_ABORT();
+    MOZ_ASSERT(false, "Invalid WebGL texture format?");
     return false;
 }
 
 void
 WebGLContext::UpdateWebGLErrorAndClearGLError(GLenum *currentGLError)
 {
     // get and clear GL error in ALL cases
     GLenum error = gl->GetAndClearError();
--- a/content/canvas/src/WebGLContextValidate.cpp
+++ b/content/canvas/src/WebGLContextValidate.cpp
@@ -60,17 +60,17 @@ WebGLProgram::UpdateInfo()
 
     for (int i = 0; i < attribCount; ++i) {
         GLint attrnamelen;
         GLint attrsize;
         GLenum attrtype;
         mContext->gl->fGetActiveAttrib(mGLName, i, mAttribMaxNameLength, &attrnamelen, &attrsize, &attrtype, nameBuf);
         if (attrnamelen > 0) {
             GLint loc = mContext->gl->fGetAttribLocation(mGLName, nameBuf);
-            NS_ABORT_IF_FALSE(loc >= 0, "major oops in managing the attributes of a WebGL program");
+            MOZ_ASSERT(loc >= 0, "major oops in managing the attributes of a WebGL program");
             if (loc < mContext->mGLMaxVertexAttribs) {
                 mAttribsInUse[loc] = true;
             } else {
                 mContext->GenerateWarning("program exceeds MAX_VERTEX_ATTRIBS");
                 return false;
             }
         }
     }
@@ -486,17 +486,17 @@ uint32_t WebGLContext::GetBitsPerTexel(G
         }
     } else if (type == LOCAL_GL_UNSIGNED_SHORT_4_4_4_4 ||
                type == LOCAL_GL_UNSIGNED_SHORT_5_5_5_1 ||
                type == LOCAL_GL_UNSIGNED_SHORT_5_6_5)
     {
         return 16;
     }
 
-    NS_ABORT();
+    MOZ_ASSERT(false);
     return 0;
 }
 
 bool WebGLContext::ValidateTexFormatAndType(GLenum format, GLenum type, int jsArrayType,
                                               uint32_t *texelSize, const char *info)
 {
     if (IsExtensionEnabled(WEBGL_depth_texture)) {
         if (format == LOCAL_GL_DEPTH_COMPONENT) {
--- a/content/canvas/src/WebGLFramebuffer.cpp
+++ b/content/canvas/src/WebGLFramebuffer.cpp
@@ -153,17 +153,17 @@ WebGLFramebuffer::Attachment::IsComplete
                  mAttachmentPoint < GLenum(LOCAL_GL_COLOR_ATTACHMENT0 + WebGLContext::sMaxColorAttachments)) {
             return (format == LOCAL_GL_RGB565 ||
                     format == LOCAL_GL_RGB5_A1 ||
                     format == LOCAL_GL_RGBA4);
         }
         MOZ_CRASH("Invalid WebGL attachment poin?");
     }
 
-    NS_ABORT(); // should never get there
+    MOZ_ASSERT(false); // should never get there
     return false;
 }
 
 void
 WebGLFramebuffer::Attachment::FinalizeAttachment(GLenum attachmentLoc) const {
     if (Texture()) {
         GLContext* gl = Texture()->Context()->gl;
         if (attachmentLoc == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) {
@@ -325,24 +325,24 @@ WebGLFramebuffer::GetAttachment(GLenum a
     if (attachment == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT)
         return mDepthStencilAttachment;
     if (attachment == LOCAL_GL_DEPTH_ATTACHMENT)
         return mDepthAttachment;
     if (attachment == LOCAL_GL_STENCIL_ATTACHMENT)
         return mStencilAttachment;
 
     if (!CheckColorAttachementNumber(attachment, "getAttachment")) {
-        NS_ABORT();
+        MOZ_ASSERT(false);
         return mColorAttachments[0];
     }
 
     uint32_t colorAttachmentId = uint32_t(attachment - LOCAL_GL_COLOR_ATTACHMENT0);
 
     if (colorAttachmentId >= mColorAttachments.Length()) {
-        NS_ABORT();
+        MOZ_ASSERT(false);
         return mColorAttachments[0];
     }
 
     return mColorAttachments[colorAttachmentId];
 }
 
 void
 WebGLFramebuffer::DetachTexture(const WebGLTexture *tex) {
--- a/content/canvas/src/WebGLObjectModel.h
+++ b/content/canvas/src/WebGLObjectModel.h
@@ -97,28 +97,28 @@ class WebGLRefCountedObject
 public:
     enum DeletionStatus { Default, DeleteRequested, Deleted };
 
     WebGLRefCountedObject()
       : mDeletionStatus(Default)
     { }
 
     ~WebGLRefCountedObject() {
-        NS_ABORT_IF_FALSE(mWebGLRefCnt == 0, "destroying WebGL object still referenced by other WebGL objects");
-        NS_ABORT_IF_FALSE(mDeletionStatus == Deleted, "Derived class destructor must call DeleteOnce()");
+        MOZ_ASSERT(mWebGLRefCnt == 0, "destroying WebGL object still referenced by other WebGL objects");
+        MOZ_ASSERT(mDeletionStatus == Deleted, "Derived class destructor must call DeleteOnce()");
     }
 
     // called by WebGLRefPtr
     void WebGLAddRef() {
         ++mWebGLRefCnt;
     }
 
     // called by WebGLRefPtr
     void WebGLRelease() {
-        NS_ABORT_IF_FALSE(mWebGLRefCnt > 0, "releasing WebGL object with WebGL refcnt already zero");
+        MOZ_ASSERT(mWebGLRefCnt > 0, "releasing WebGL object with WebGL refcnt already zero");
         --mWebGLRefCnt;
         MaybeDelete();
     }
 
     // this is the function that WebGL.deleteXxx() functions want to call
     void RequestDelete() {
         if (mDeletionStatus == Default)
             mDeletionStatus = DeleteRequested;
@@ -210,22 +210,22 @@ public:
         return static_cast<T*>(mRawPtr);
     }
 
     operator T*() const {
         return get();
     }
 
     T* operator->() const {
-        NS_ABORT_IF_FALSE(mRawPtr != 0, "You can't dereference a nullptr WebGLRefPtr with operator->()!");
+        MOZ_ASSERT(mRawPtr != 0, "You can't dereference a nullptr WebGLRefPtr with operator->()!");
         return get();
     }
 
     T& operator*() const {
-        NS_ABORT_IF_FALSE(mRawPtr != 0, "You can't dereference a nullptr WebGLRefPtr with operator*()!");
+        MOZ_ASSERT(mRawPtr != 0, "You can't dereference a nullptr WebGLRefPtr with operator*()!");
         return *get();
     }
 
 private:
 
     static void AddRefOnPtr(T* rawPtr) {
         if (rawPtr) {
             rawPtr->WebGLAddRef();
--- a/content/canvas/src/WebGLTexelConversions.cpp
+++ b/content/canvas/src/WebGLTexelConversions.cpp
@@ -55,17 +55,17 @@ class WebGLImageConverter
             case RGB32F:
                 return 3;
             case RGBA8:
             case BGRA8:
             case BGRX8:
             case RGBA32F:
                 return 4;
             default:
-                NS_ABORT_IF_FALSE(false, "Unknown texel format. Coding mistake?");
+                MOZ_ASSERT(false, "Unknown texel format. Coding mistake?");
                 return 0;
         }
     }
 
     /*
      * This is the completely format-specific templatized conversion function,
      * that will be instantiated hundreds of times for all different combinations.
      * It is important to avoid generating useless code here. In particular, many
@@ -129,17 +129,17 @@ class WebGLImageConverter
             if (PremultiplicationOp != NoPremultiplicationOp)
             {
                 return;
             }
         }
 
         // end of early return cases.
 
-        NS_ABORT_IF_FALSE(!mAlreadyRun, "converter should be run only once!");
+        MOZ_ASSERT(!mAlreadyRun, "converter should be run only once!");
         mAlreadyRun = true;
 
         // gather some compile-time meta-data about the formats at hand.
 
         typedef
             typename DataTypeForFormat<SrcFormat>::Type
             SrcType;
         typedef
@@ -155,28 +155,28 @@ class WebGLImageConverter
             IntermediateSrcType;
         typedef
             typename DataTypeForFormat<IntermediateDstFormat>::Type
             IntermediateDstType;
 
         const size_t NumElementsPerSrcTexel = NumElementsPerTexelForFormat<SrcFormat>();
         const size_t NumElementsPerDstTexel = NumElementsPerTexelForFormat<DstFormat>();
         const size_t MaxElementsPerTexel = 4;
-        NS_ABORT_IF_FALSE(NumElementsPerSrcTexel <= MaxElementsPerTexel, "unhandled format");
-        NS_ABORT_IF_FALSE(NumElementsPerDstTexel <= MaxElementsPerTexel, "unhandled format");
+        MOZ_ASSERT(NumElementsPerSrcTexel <= MaxElementsPerTexel, "unhandled format");
+        MOZ_ASSERT(NumElementsPerDstTexel <= MaxElementsPerTexel, "unhandled format");
 
         // we assume that the strides are multiples of the sizeof of respective types.
         // this assumption will allow us to iterate over src and dst images using typed
         // pointers, e.g. uint8_t* or uint16_t* or float*, instead of untyped pointers.
         // So this assumption allows us to write cleaner and safer code, but it might
         // not be true forever and if it eventually becomes wrong, we'll have to revert
         // to always iterating using uint8_t* pointers regardless of the types at hand.
-        NS_ABORT_IF_FALSE(mSrcStride % sizeof(SrcType) == 0 &&
-                          mDstStride % sizeof(DstType) == 0,
-                          "Unsupported: texture stride is not a multiple of sizeof(type)");
+        MOZ_ASSERT(mSrcStride % sizeof(SrcType) == 0 &&
+                   mDstStride % sizeof(DstType) == 0,
+                   "Unsupported: texture stride is not a multiple of sizeof(type)");
         const ptrdiff_t srcStrideInElements = mSrcStride / sizeof(SrcType);
         const ptrdiff_t dstStrideInElements = mDstStride / sizeof(DstType);
 
         const SrcType *srcRowStart = static_cast<const SrcType*>(mSrcStart);
         DstType *dstRowStart = static_cast<DstType*>(mDstStart);
 
         // the loop performing the texture format conversion
         for (size_t i = 0; i < mHeight; ++i) {
@@ -220,17 +220,17 @@ class WebGLImageConverter
             case PremultiplicationOp: \
                 return run<SrcFormat, DstFormat, PremultiplicationOp>();
 
         switch (premultiplicationOp) {
             WEBGLIMAGECONVERTER_CASE_PREMULTIPLICATIONOP(NoPremultiplicationOp)
             WEBGLIMAGECONVERTER_CASE_PREMULTIPLICATIONOP(Premultiply)
             WEBGLIMAGECONVERTER_CASE_PREMULTIPLICATIONOP(Unpremultiply)
             default:
-                NS_ABORT_IF_FALSE(false, "unhandled case. Coding mistake?");
+                MOZ_ASSERT(false, "unhandled case. Coding mistake?");
         }
 
         #undef WEBGLIMAGECONVERTER_CASE_PREMULTIPLICATIONOP
     }
 
     template<WebGLTexelFormat SrcFormat>
     void run(WebGLTexelFormat dstFormat,
              WebGLTexelPremultiplicationOp premultiplicationOp)
@@ -249,17 +249,17 @@ class WebGLImageConverter
             WEBGLIMAGECONVERTER_CASE_DSTFORMAT(RGB8)
             WEBGLIMAGECONVERTER_CASE_DSTFORMAT(RGB565)
             WEBGLIMAGECONVERTER_CASE_DSTFORMAT(RGB32F)
             WEBGLIMAGECONVERTER_CASE_DSTFORMAT(RGBA8)
             WEBGLIMAGECONVERTER_CASE_DSTFORMAT(RGBA5551)
             WEBGLIMAGECONVERTER_CASE_DSTFORMAT(RGBA4444)
             WEBGLIMAGECONVERTER_CASE_DSTFORMAT(RGBA32F)
             default:
-                NS_ABORT_IF_FALSE(false, "unhandled case. Coding mistake?");
+                MOZ_ASSERT(false, "unhandled case. Coding mistake?");
         }
 
         #undef WEBGLIMAGECONVERTER_CASE_DSTFORMAT
     }
 
 public:
 
     void run(WebGLTexelFormat srcFormat,
@@ -282,17 +282,17 @@ public:
             WEBGLIMAGECONVERTER_CASE_SRCFORMAT(RGB565)
             WEBGLIMAGECONVERTER_CASE_SRCFORMAT(RGB32F)
             WEBGLIMAGECONVERTER_CASE_SRCFORMAT(RGBA8)
             WEBGLIMAGECONVERTER_CASE_SRCFORMAT(BGRA8)
             WEBGLIMAGECONVERTER_CASE_SRCFORMAT(RGBA5551)
             WEBGLIMAGECONVERTER_CASE_SRCFORMAT(RGBA4444)
             WEBGLIMAGECONVERTER_CASE_SRCFORMAT(RGBA32F)
             default:
-                NS_ABORT_IF_FALSE(false, "unhandled case. Coding mistake?");
+                MOZ_ASSERT(false, "unhandled case. Coding mistake?");
         }
 
         #undef WEBGLIMAGECONVERTER_CASE_SRCFORMAT
     }
 
     WebGLImageConverter(size_t width, size_t height,
                         const void* srcStart, void* dstStart,
                         ptrdiff_t srcStride, ptrdiff_t dstStride)
@@ -330,17 +330,17 @@ WebGLContext::ConvertImage(size_t width,
         // fast exit path: we just have to memcpy all the rows.
         //
         // The case where absolutely nothing needs to be done is supposed to have
         // been handled earlier (in TexImage2D_base, etc).
         //
         // So the case we're handling here is when even though no format conversion is needed,
         // we still might have to flip vertically and/or to adjust to a different stride.
 
-        NS_ABORT_IF_FALSE(mPixelStoreFlipY || srcStride != dstStride, "Performance trap -- should handle this case earlier, to avoid memcpy");
+        MOZ_ASSERT(mPixelStoreFlipY || srcStride != dstStride, "Performance trap -- should handle this case earlier, to avoid memcpy");
 
         size_t row_size = width * dstTexelSize; // doesn't matter, src and dst formats agree
         const uint8_t* ptr = src;
         const uint8_t* src_end = src + height * srcStride;
 
         uint8_t* dst_row = mPixelStoreFlipY
                            ? dst + (height-1) * dstStride
                            : dst;
--- a/content/canvas/src/WebGLTexelConversions.h
+++ b/content/canvas/src/WebGLTexelConversions.h
@@ -123,17 +123,17 @@ inline size_t TexelBytesForFormat(int fo
             return 4;
         case WebGLTexelConversions::RA32F:
             return 8;
         case WebGLTexelConversions::RGB32F:
             return 12;
         case WebGLTexelConversions::RGBA32F:
             return 16;
         default:
-            NS_ABORT_IF_FALSE(false, "Unknown texel format. Coding mistake?");
+            MOZ_ASSERT(false, "Unknown texel format. Coding mistake?");
             return 0;
     }
 }
 
 FORCE_INLINE bool HasAlpha(int format) {
     return format == A8 ||
            format == A32F ||
            format == RA8 ||
@@ -170,17 +170,17 @@ FORCE_INLINE bool HasColor(int format) {
 //----------------------------------------------------------------------
 // Pixel unpacking routines.
 
 template<int Format, typename SrcType, typename DstType>
 FORCE_INLINE void
 unpack(const SrcType* __restrict src,
        DstType* __restrict dst)
 {
-    NS_ABORT_IF_FALSE(false, "Unimplemented texture format conversion");
+    MOZ_ASSERT(false, "Unimplemented texture format conversion");
 }
 
 template<> FORCE_INLINE void
 unpack<RGBA8, uint8_t, uint8_t>(const uint8_t* __restrict src, uint8_t* __restrict dst)
 {
     dst[0] = src[0];
     dst[1] = src[1];
     dst[2] = src[2];
@@ -330,17 +330,17 @@ unpack<A32F, float, float>(const float* 
 // Pixel packing routines.
 //
 
 template<int Format, int PremultiplicationOp, typename SrcType, typename DstType>
 FORCE_INLINE void
 pack(const SrcType* __restrict src,
      DstType* __restrict dst)
 {
-    NS_ABORT_IF_FALSE(false, "Unimplemented texture format conversion");
+    MOZ_ASSERT(false, "Unimplemented texture format conversion");
 }
 
 template<> FORCE_INLINE void
 pack<A8, NoPremultiplicationOp, uint8_t, uint8_t>(const uint8_t* __restrict src, uint8_t* __restrict dst)
 {
     dst[0] = src[3];
 }
 
@@ -653,17 +653,17 @@ pack<RA32F, Premultiply, float, float>(c
     dst[1] = scaleFactor;
 }
 
 /****** END CODE SHARED WITH WEBKIT ******/
 
 template<typename SrcType, typename DstType> FORCE_INLINE void
 convertType(const SrcType* __restrict src, DstType* __restrict dst)
 {
-    NS_ABORT_IF_FALSE(false, "Unimplemented texture format conversion");
+    MOZ_ASSERT(false, "Unimplemented texture format conversion");
 }
 
 template<> FORCE_INLINE void
 convertType<uint8_t, uint8_t>(const uint8_t* __restrict src, uint8_t* __restrict dst)
 {
     dst[0] = src[0];
     dst[1] = src[1];
     dst[2] = src[2];
--- a/content/canvas/src/WebGLUniformInfo.h
+++ b/content/canvas/src/WebGLUniformInfo.h
@@ -39,17 +39,17 @@ struct WebGLUniformInfo {
             case SH_BOOL_VEC4:
             case SH_FLOAT_MAT2:
                 return 4;
             case SH_FLOAT_MAT3:
                 return 9;
             case SH_FLOAT_MAT4:
                 return 16;
             default:
-                NS_ABORT(); // should never get here
+                MOZ_ASSERT(false); // should never get here
                 return 0;
         }
     }
 };
 
 } // namespace mozilla
 
 #endif