Bug 757526 - Use stdint instead of PRInt types in WebGL implementation - r=Ms2ger
authorBenoit Jacob <bjacob@mozilla.com>
Wed, 23 May 2012 12:07:01 -0400
changeset 94696 dd6c4f6a244814e6c0d80ae625abea6b21f4c000
parent 94695 7ffffcb45b9402c0b2cb12e8fdd0d8293a7e48fb
child 94697 69423dd75eb60e518ab0ee667e614c81ab26ba20
push id9755
push userbjacob@mozilla.com
push dateWed, 23 May 2012 16:16:21 +0000
treeherdermozilla-inbound@5f14275bb276 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
bugs757526
milestone15.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 757526 - Use stdint instead of PRInt types in WebGL implementation - r=Ms2ger
content/canvas/src/WebGLContext.h
content/canvas/src/WebGLContextGL.cpp
content/canvas/src/WebGLContextReporter.cpp
content/canvas/src/WebGLContextUtils.cpp
content/canvas/src/WebGLContextValidate.cpp
dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
--- a/content/canvas/src/WebGLContext.h
+++ b/content/canvas/src/WebGLContext.h
@@ -381,17 +381,17 @@ private:
         mRawPtr = newPtr;
         ReleasePtr(oldPtr);
     }
 
 protected:
     T *mRawPtr;
 };
 
-typedef PRUint64 WebGLMonotonicHandle;
+typedef uint64_t WebGLMonotonicHandle;
 
 /* WebGLFastArray offers a fast array for the use case where all what one needs is to append
  * and remove elements. Removal is fast because the array is always kept sorted with respect
  * to "monotonic handles". Appending an element returns such a "monotonic handle" which the
  * user needs to keep for future use for when it will want to remove the element.
  */
 template<typename ElementType>
 class WebGLFastArray
@@ -596,17 +596,17 @@ public:
 
     void SynthesizeGLError(WebGLenum err);
     void SynthesizeGLError(WebGLenum err, const char *fmt, ...);
 
     void ErrorInvalidEnum(const char *fmt = 0, ...);
     void ErrorInvalidOperation(const char *fmt = 0, ...);
     void ErrorInvalidValue(const char *fmt = 0, ...);
     void ErrorInvalidFramebufferOperation(const char *fmt = 0, ...);
-    void ErrorInvalidEnumInfo(const char *info, PRUint32 enumvalue) {
+    void ErrorInvalidEnumInfo(const char *info, WebGLenum enumvalue) {
         return ErrorInvalidEnum("%s: invalid enum value 0x%x", info, enumvalue);
     }
     void ErrorOutOfMemory(const char *fmt = 0, ...);
 
     const char *ErrorName(GLenum error);
     bool IsTextureFormatCompressed(GLenum format);
 
     void DummyFramebufferOperation(const char *info);
@@ -618,24 +618,24 @@ public:
 
     already_AddRefed<CanvasLayer> GetCanvasLayer(nsDisplayListBuilder* aBuilder,
                                                  CanvasLayer *aOldLayer,
                                                  LayerManager *aManager);
     void MarkContextClean() { mInvalidated = false; }
 
     // a number that increments every time we have an event that causes
     // all context resources to be lost.
-    PRUint32 Generation() { return mGeneration.value(); }
+    uint32_t Generation() { return mGeneration.value(); }
 
     const WebGLRectangleObject *FramebufferRectangleObject() const;
 
     // this is similar to GLContext::ClearSafely, but is more comprehensive
     // (takes care of scissor, stencil write mask, dithering, viewport...)
     // WebGL has more complex needs than GLContext as content controls GL state.
-    void ForceClearFramebufferWithDefaultValues(PRUint32 mask, const nsIntRect& viewportRect);
+    void ForceClearFramebufferWithDefaultValues(uint32_t mask, const nsIntRect& viewportRect);
 
     // if the preserveDrawingBuffer context option is false, we need to clear the back buffer
     // after it's been presented to the compositor. This function does that if needed.
     // See section 2.2 in the WebGL spec.
     void EnsureBackbufferClearedAsNeeded();
 
     // checks for GL errors, clears any pending GL error, stores the current GL error in currentGLError,
     // and copies it into mWebGLError if it doesn't already have an error set
@@ -1089,18 +1089,18 @@ protected:
 
     int WhatDoesVertexAttrib0Need();
     bool DoFakeVertexAttrib0(WebGLuint vertexCount);
     void UndoFakeVertexAttrib0();
     void InvalidateFakeVertexAttrib0();
 
     static CheckedUint32 GetImageSize(WebGLsizei height, 
                                       WebGLsizei width, 
-                                      PRUint32 pixelSize,
-                                      PRUint32 alignment);
+                                      uint32_t pixelSize,
+                                      uint32_t alignment);
 
     // Returns x rounded to the next highest multiple of y.
     static CheckedUint32 RoundedToNextMultipleOf(CheckedUint32 x, CheckedUint32 y) {
         return ((x + y - 1) / y) * y;
     }
 
     nsCOMPtr<nsIDOMHTMLCanvasElement> mCanvasElement;
 
@@ -1123,25 +1123,25 @@ protected:
 
     WebGLuint mActiveTexture;
     WebGLenum mWebGLError;
 
     // whether shader validation is supported
     bool mShaderValidation;
 
     // some GL constants
-    PRInt32 mGLMaxVertexAttribs;
-    PRInt32 mGLMaxTextureUnits;
-    PRInt32 mGLMaxTextureSize;
-    PRInt32 mGLMaxCubeMapTextureSize;
-    PRInt32 mGLMaxTextureImageUnits;
-    PRInt32 mGLMaxVertexTextureImageUnits;
-    PRInt32 mGLMaxVaryingVectors;
-    PRInt32 mGLMaxFragmentUniformVectors;
-    PRInt32 mGLMaxVertexUniformVectors;
+    int32_t mGLMaxVertexAttribs;
+    int32_t mGLMaxTextureUnits;
+    int32_t mGLMaxTextureSize;
+    int32_t mGLMaxCubeMapTextureSize;
+    int32_t mGLMaxTextureImageUnits;
+    int32_t mGLMaxVertexTextureImageUnits;
+    int32_t mGLMaxVaryingVectors;
+    int32_t mGLMaxFragmentUniformVectors;
+    int32_t mGLMaxVertexUniformVectors;
 
     // Represents current status, or state, of the context. That is, is it lost
     // or stable and what part of the context lost process are we currently at.
     // This is used to support the WebGL spec's asyncronous nature in handling
     // context loss.
     enum ContextStatus {
         // The context is stable; there either are none or we don't know of any.
         ContextStable,
@@ -1171,67 +1171,67 @@ protected:
         NS_ABORT_IF_FALSE(ext >= 0 && ext < WebGLExtensionID_Max, "bogus index!");
         return mEnabledExtensions[ext] != nsnull;
     }
     bool IsExtensionSupported(WebGLExtensionID ei);
 
     nsTArray<WebGLenum> mCompressedTextureFormats;
 
     bool InitAndValidateGL();
-    bool ValidateBuffers(PRInt32* maxAllowedCount, const char *info);
+    bool ValidateBuffers(int32_t *maxAllowedCount, const char *info);
     bool ValidateCapabilityEnum(WebGLenum cap, const char *info);
     bool ValidateBlendEquationEnum(WebGLenum cap, const char *info);
     bool ValidateBlendFuncDstEnum(WebGLenum mode, const char *info);
     bool ValidateBlendFuncSrcEnum(WebGLenum mode, const char *info);
     bool ValidateBlendFuncEnumsCompatibility(WebGLenum sfactor, WebGLenum dfactor, const char *info);
     bool ValidateTextureTargetEnum(WebGLenum target, const char *info);
     bool ValidateComparisonEnum(WebGLenum target, const char *info);
     bool ValidateStencilOpEnum(WebGLenum action, const char *info);
     bool ValidateFaceEnum(WebGLenum face, const char *info);
     bool ValidateBufferUsageEnum(WebGLenum target, const char *info);
     bool ValidateTexFormatAndType(WebGLenum format, WebGLenum type, int jsArrayType,
-                                      PRUint32 *texelSize, const char *info);
+                                      uint32_t *texelSize, const char *info);
     bool ValidateDrawModeEnum(WebGLenum mode, const char *info);
     bool ValidateAttribIndex(WebGLuint index, const char *info);
     bool ValidateStencilParamsForDrawCall();
     
     bool ValidateGLSLVariableName(const nsAString& name, const char *info);
     bool ValidateGLSLCharacter(PRUnichar c);
     bool ValidateGLSLString(const nsAString& string, const char *info);
 
     bool ValidateTexImage2DTarget(WebGLenum target, WebGLsizei width, WebGLsizei height, const char* info);
     bool ValidateCompressedTextureSize(WebGLint level, WebGLenum format, WebGLsizei width, WebGLsizei height, uint32_t byteLength, const char* info);
     bool ValidateLevelWidthHeightForTarget(WebGLenum target, WebGLint level, WebGLsizei width, WebGLsizei height, const char* info);
 
-    static PRUint32 GetBitsPerTexel(WebGLenum format, WebGLenum type);
+    static uint32_t GetBitsPerTexel(WebGLenum format, WebGLenum type);
 
     void Invalidate();
     void DestroyResourcesAndContext();
 
     void MakeContextCurrent() { gl->MakeCurrent(); }
 
     // helpers
     void TexImage2D_base(WebGLenum target, WebGLint level, WebGLenum internalformat,
                          WebGLsizei width, WebGLsizei height, WebGLsizei srcStrideOrZero, WebGLint border,
                          WebGLenum format, WebGLenum type,
-                         void *data, PRUint32 byteLength,
+                         void *data, uint32_t byteLength,
                          int jsArrayType,
                          WebGLTexelFormat srcFormat, bool srcPremultiplied);
     void TexSubImage2D_base(WebGLenum target, WebGLint level,
                             WebGLint xoffset, WebGLint yoffset,
                             WebGLsizei width, WebGLsizei height, WebGLsizei srcStrideOrZero,
                             WebGLenum format, WebGLenum type,
-                            void *pixels, PRUint32 byteLength,
+                            void *pixels, uint32_t byteLength,
                             int jsArrayType,
                             WebGLTexelFormat srcFormat, bool srcPremultiplied);
     void TexParameter_base(WebGLenum target, WebGLenum pname,
                            WebGLint *intParamPtr, WebGLfloat *floatParamPtr);
 
     void ConvertImage(size_t width, size_t height, size_t srcStride, size_t dstStride,
-                      const PRUint8*src, PRUint8 *dst,
+                      const uint8_t* src, uint8_t *dst,
                       WebGLTexelFormat srcFormat, bool srcPremultiplied,
                       WebGLTexelFormat dstFormat, bool dstPremultiplied,
                       size_t dstTexelSize);
 
     nsresult DOMElementToImageSurface(dom::Element* imageOrCanvas,
                                       gfxImageSurface **imageOut,
                                       WebGLTexelFormat *format);
 
@@ -1262,17 +1262,17 @@ protected:
     bool ValidateObjectAllowDeleted(const char* info, ObjectType *aObject);
 private:
     // Like ValidateObject, but only for cases when aObject is known
     // to not be null already.
     template<class ObjectType>
     bool ValidateObjectAssumeNonNull(const char* info, ObjectType *aObject);
 
 protected:
-    PRInt32 MaxTextureSizeForTarget(WebGLenum target) const {
+    int32_t MaxTextureSizeForTarget(WebGLenum target) const {
         return target == LOCAL_GL_TEXTURE_2D ? mGLMaxTextureSize : mGLMaxCubeMapTextureSize;
     }
     
     /** like glBufferData but if the call may change the buffer size, checks any GL error generated
      * by this glBufferData call and returns it */
     GLenum CheckedBufferData(GLenum target,
                              GLsizeiptr size,
                              const GLvoid *data,
@@ -1302,31 +1302,31 @@ protected:
     nsTArray<WebGLRefPtr<WebGLTexture> > mBound2DTextures;
     nsTArray<WebGLRefPtr<WebGLTexture> > mBoundCubeMapTextures;
 
     WebGLRefPtr<WebGLBuffer> mBoundArrayBuffer;
     WebGLRefPtr<WebGLBuffer> mBoundElementArrayBuffer;
 
     WebGLRefPtr<WebGLProgram> mCurrentProgram;
 
-    PRUint32 mMaxFramebufferColorAttachments;
+    uint32_t mMaxFramebufferColorAttachments;
 
     WebGLRefPtr<WebGLFramebuffer> mBoundFramebuffer;
     WebGLRefPtr<WebGLRenderbuffer> mBoundRenderbuffer;
 
     WebGLFastArray<WebGLTexture*> mTextures;
     WebGLFastArray<WebGLBuffer*> mBuffers;
     WebGLFastArray<WebGLProgram*> mPrograms;
     WebGLFastArray<WebGLShader*> mShaders;
     WebGLFastArray<WebGLRenderbuffer*> mRenderbuffers;
     WebGLFastArray<WebGLFramebuffer*> mFramebuffers;
     WebGLFastArray<WebGLUniformLocation*> mUniformLocations;
 
     // PixelStore parameters
-    PRUint32 mPixelStorePackAlignment, mPixelStoreUnpackAlignment, mPixelStoreColorspaceConversion;
+    uint32_t mPixelStorePackAlignment, mPixelStoreUnpackAlignment, mPixelStoreColorspaceConversion;
     bool mPixelStoreFlipY, mPixelStorePremultiplyAlpha;
 
     FakeBlackStatus mFakeBlackStatus;
 
     WebGLuint mBlackTexture2D, mBlackTextureCubeMap;
     bool mBlackTexturesAreInitialized;
 
     WebGLfloat mVertexAttrib0Vector[4];
@@ -1397,17 +1397,17 @@ public:
         return mContext == other &&
             mContextGeneration == other->Generation();
     }
 
     WebGLContext *Context() const { return mContext; }
 
 protected:
     WebGLContext *mContext;
-    PRUint32 mContextGeneration;
+    uint32_t mContextGeneration;
 };
 
 struct WebGLVertexAttribData {
     // note that these initial values are what GL initializes vertex attribs to
     WebGLVertexAttribData()
         : buf(0), stride(0), size(4), byteOffset(0),
           type(LOCAL_GL_FLOAT), enabled(false), normalized(false)
     { }
@@ -1528,45 +1528,45 @@ public:
     void CopySubDataIfElementArray(GLuint byteOffset, GLuint byteLength, const void* data) {
         if (mTarget == LOCAL_GL_ELEMENT_ARRAY_BUFFER && mByteLength) {
             memcpy((void*) (size_t(mData)+byteOffset), data, byteLength);
         }
     }
 
     // this method too is only for element array buffers. It returns the maximum value in the part of
     // the buffer starting at given offset, consisting of given count of elements. The type T is the type
-    // to interprete the array elements as, must be GLushort or GLubyte.
+    // to interpret the array elements as, must be GLushort or GLubyte.
     template<typename T>
-    PRInt32 FindMaxElementInSubArray(GLuint count, GLuint byteOffset)
+    T FindMaxElementInSubArray(GLuint count, GLuint byteOffset)
     {
         const T* start = reinterpret_cast<T*>(reinterpret_cast<size_t>(mData) + byteOffset);
         const T* stop = start + count;
         T result = 0;
         for(const T* ptr = start; ptr != stop; ++ptr) {
             if (*ptr > result) result = *ptr;
         }
         return result;
     }
 
     void InvalidateCachedMaxElements() {
       mHasCachedMaxUbyteElement = false;
       mHasCachedMaxUshortElement = false;
     }
 
-    PRInt32 FindMaxUbyteElement() {
+    int32_t FindMaxUbyteElement() {
       if (mHasCachedMaxUbyteElement) {
         return mCachedMaxUbyteElement;
       } else {
         mHasCachedMaxUbyteElement = true;
         mCachedMaxUbyteElement = FindMaxElementInSubArray<GLubyte>(mByteLength, 0);
         return mCachedMaxUbyteElement;
       }
     }
 
-    PRInt32 FindMaxUshortElement() {
+    int32_t FindMaxUshortElement() {
       if (mHasCachedMaxUshortElement) {
         return mCachedMaxUshortElement;
       } else {
         mHasCachedMaxUshortElement = true;
         mCachedMaxUshortElement = FindMaxElementInSubArray<GLushort>(mByteLength>>1, 0);
         return mCachedMaxUshortElement;
       }
     }
@@ -1577,19 +1577,19 @@ public:
 protected:
 
     WebGLuint mGLName;
     bool mHasEverBeenBound;
     GLuint mByteLength;
     GLenum mTarget;
     WebGLMonotonicHandle mMonotonicHandle;
 
-    PRUint8 mCachedMaxUbyteElement;
+    uint8_t mCachedMaxUbyteElement;
     bool mHasCachedMaxUbyteElement;
-    PRUint16 mCachedMaxUshortElement;
+    uint16_t mCachedMaxUshortElement;
     bool mHasCachedMaxUshortElement;
 
     void* mData; // in the case of an Element Array Buffer, we keep a copy.
 };
 
 // NOTE: When this class is switched to new DOM bindings, update the (then-slow)
 // WrapObject calls in GetParameter and GetFramebufferAttachmentParameter.
 class WebGLTexture MOZ_FINAL
@@ -1679,21 +1679,21 @@ public:
         }
         bool IsPositive() const {
             return mWidth > 0 && mHeight > 0;
         }
         bool IsPowerOfTwo() const {
             return is_pot_assuming_nonnegative(mWidth) &&
                    is_pot_assuming_nonnegative(mHeight); // negative sizes should never happen (caught in texImage2D...)
         }
-        PRInt64 MemoryUsage() const {
+        int64_t MemoryUsage() const {
             if (!mIsDefined)
                 return 0;
-            PRInt64 texelSizeInBits = WebGLContext::GetBitsPerTexel(mFormat, mType);
-            return PRInt64(mWidth) * PRInt64(mHeight) * texelSizeInBits / 8;
+            int64_t texelSizeInBits = WebGLContext::GetBitsPerTexel(mFormat, mType);
+            return int64_t(mWidth) * int64_t(mHeight) * texelSizeInBits / 8;
         }
         WebGLenum Format() const { return mFormat; }
         WebGLenum Type() const { return mType; }
     protected:
         WebGLenum mFormat, mType;
         bool mIsDefined;
 
         friend class WebGLTexture;
@@ -1718,20 +1718,20 @@ public:
                checked_index.value() < mImageInfos.Length() &&
                ImageInfoAt(level, face).mIsDefined;
     }
 
     static size_t FaceForTarget(WebGLenum target) {
         return target == LOCAL_GL_TEXTURE_2D ? 0 : target - LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X;
     }
 
-    PRInt64 MemoryUsage() const {
+    int64_t MemoryUsage() const {
         if (IsDeleted())
             return 0;
-        PRInt64 result = 0;
+        int64_t result = 0;
         for(size_t face = 0; face < mFacesCount; face++) {
             if (mHaveGeneratedMipmap) {
                 // Each mipmap level is 1/4 the size of the previous level
                 // 1 + x + x^2 + ... = 1/(1-x)
                 // for x = 1/4, we get 1/(1-1/4) = 4/3
                 result += ImageInfoAt(0, face).MemoryUsage() * 4 / 3;
             } else {
                 for(size_t level = 0; level <= mMaxLevelWithCustomImages; level++)
@@ -2055,21 +2055,21 @@ public:
 };
 
 struct WebGLMappedIdentifier {
     nsCString original, mapped; // ASCII strings
     WebGLMappedIdentifier(const nsACString& o, const nsACString& m) : original(o), mapped(m) {}
 };
 
 struct WebGLUniformInfo {
-    PRUint32 arraySize;
+    uint32_t arraySize;
     bool isArray;
     ShDataType type;
 
-    WebGLUniformInfo(PRUint32 s = 0, bool a = false, ShDataType t = SH_NONE)
+    WebGLUniformInfo(uint32_t s = 0, bool a = false, ShDataType t = SH_NONE)
         : arraySize(s), isArray(a), type(t) {}
 
     int ElementSize() const {
         switch (type) {
             case SH_INT:
             case SH_FLOAT:
             case SH_BOOL:
             case SH_SAMPLER_2D:
@@ -2242,17 +2242,17 @@ public:
 
     void DetachShaders() {
         mAttachedShaders.Clear();
     }
 
     WebGLuint GLName() { return mGLName; }
     const nsTArray<WebGLRefPtr<WebGLShader> >& AttachedShaders() const { return mAttachedShaders; }
     bool LinkStatus() { return mLinkStatus; }
-    PRUint32 Generation() const { return mGeneration.value(); }
+    uint32_t Generation() const { return mGeneration.value(); }
     void SetLinkStatus(bool val) { mLinkStatus = val; }
 
     bool ContainsShader(WebGLShader *shader) {
         return mAttachedShaders.Contains(shader);
     }
 
     // return true if the shader wasn't already attached
     bool AttachShader(WebGLShader *shader) {
@@ -2273,17 +2273,17 @@ public:
 
         mContext->MakeContextCurrent();
         mContext->gl->fDetachShader(GLName(), shader->GLName());
 
         return true;
     }
 
     bool HasAttachedShaderOfType(GLenum shaderType) {
-        for (PRUint32 i = 0; i < mAttachedShaders.Length(); ++i) {
+        for (uint32_t i = 0; i < mAttachedShaders.Length(); ++i) {
             if (mAttachedShaders[i] && mAttachedShaders[i]->ShaderType() == shaderType) {
                 return true;
             }
         }
         return false;
     }
 
     bool HasBothShaderTypesAttached() {
@@ -2499,18 +2499,18 @@ public:
     void SetInitialized(bool aInitialized) { mInitialized = aInitialized; }
 
     WebGLenum InternalFormat() const { return mInternalFormat; }
     void SetInternalFormat(WebGLenum aInternalFormat) { mInternalFormat = aInternalFormat; }
     
     WebGLenum InternalFormatForGL() const { return mInternalFormatForGL; }
     void SetInternalFormatForGL(WebGLenum aInternalFormatForGL) { mInternalFormatForGL = aInternalFormatForGL; }
     
-    PRInt64 MemoryUsage() const {
-        PRInt64 pixels = PRInt64(Width()) * PRInt64(Height());
+    int64_t MemoryUsage() const {
+        int64_t pixels = int64_t(Width()) * int64_t(Height());
         switch (mInternalFormatForGL) {
             case LOCAL_GL_STENCIL_INDEX8:
                 return pixels;
             case LOCAL_GL_RGBA4:
             case LOCAL_GL_RGB5_A1:
             case LOCAL_GL_RGB565:
             case LOCAL_GL_DEPTH_COMPONENT16:
                 return 2 * pixels;
@@ -2903,17 +2903,17 @@ public:
 
         mContext->MakeContextCurrent();
 
         WebGLenum status;
         mContext->CheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER, &status);
         if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE)
             return false;
 
-        PRUint32 mask = 0;
+        uint32_t mask = 0;
 
         if (mColorAttachment.HasUninitializedRenderbuffer())
             mask |= LOCAL_GL_COLOR_BUFFER_BIT;
 
         if (mDepthAttachment.HasUninitializedRenderbuffer() ||
             mDepthStencilAttachment.HasUninitializedRenderbuffer())
         {
             mask |= LOCAL_GL_DEPTH_BUFFER_BIT;
@@ -2980,27 +2980,27 @@ public:
         mProgram = nsnull;
         mContext->mUniformLocations.RemoveElement(mMonotonicHandle);
     }
 
     const WebGLUniformInfo &Info() const { return mInfo; }
 
     WebGLProgram *Program() const { return mProgram; }
     GLint Location() const { return mLocation; }
-    PRUint32 ProgramGeneration() const { return mProgramGeneration; }
+    uint32_t ProgramGeneration() const { return mProgramGeneration; }
     int ElementSize() const { return mElementSize; }
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIWEBGLUNIFORMLOCATION
 protected:
     // nsRefPtr, not WebGLRefPtr, so that we don't prevent the program from being explicitly deleted.
     // we just want to avoid having a dangling pointer.
     nsRefPtr<WebGLProgram> mProgram;
 
-    PRUint32 mProgramGeneration;
+    uint32_t mProgramGeneration;
     GLint mLocation;
     WebGLUniformInfo mInfo;
     int mElementSize;
     WebGLMonotonicHandle mMonotonicHandle;
     friend class WebGLProgram;
 };
 
 class WebGLActiveInfo MOZ_FINAL
@@ -3163,80 +3163,80 @@ class WebGLMemoryMultiReporterWrapper
         ContextsArrayType & contexts = Contexts();
         contexts.RemoveElement(c);
         if (contexts.IsEmpty()) {
             delete sUniqueInstance; 
             sUniqueInstance = nsnull;
         }
     }
 
-    static PRInt64 GetTextureMemoryUsed() {
+    static int64_t GetTextureMemoryUsed() {
         const ContextsArrayType & contexts = Contexts();
-        PRInt64 result = 0;
+        int64_t result = 0;
         for(size_t i = 0; i < contexts.Length(); ++i)
             for (size_t j = 0; j < contexts[i]->mTextures.Length(); ++j)
               result += contexts[i]->mTextures[j]->MemoryUsage();
         return result;
     }
 
-    static PRInt64 GetTextureCount() {
+    static int64_t GetTextureCount() {
         const ContextsArrayType & contexts = Contexts();
-        PRInt64 result = 0;
+        int64_t result = 0;
         for(size_t i = 0; i < contexts.Length(); ++i)
             result += contexts[i]->mTextures.Length();
         return result;
     }
 
-    static PRInt64 GetBufferMemoryUsed() {
+    static int64_t GetBufferMemoryUsed() {
         const ContextsArrayType & contexts = Contexts();
-        PRInt64 result = 0;
+        int64_t result = 0;
         for(size_t i = 0; i < contexts.Length(); ++i)
             for (size_t j = 0; j < contexts[i]->mBuffers.Length(); ++j)
                 result += contexts[i]->mBuffers[j]->ByteLength();
         return result;
     }
 
-    static PRInt64 GetBufferCacheMemoryUsed();
-
-    static PRInt64 GetBufferCount() {
+    static int64_t GetBufferCacheMemoryUsed();
+
+    static int64_t GetBufferCount() {
         const ContextsArrayType & contexts = Contexts();
-        PRInt64 result = 0;
+        int64_t result = 0;
         for(size_t i = 0; i < contexts.Length(); ++i)
             result += contexts[i]->mBuffers.Length();
         return result;
     }
 
-    static PRInt64 GetRenderbufferMemoryUsed() {
+    static int64_t GetRenderbufferMemoryUsed() {
         const ContextsArrayType & contexts = Contexts();
-        PRInt64 result = 0;
+        int64_t result = 0;
         for(size_t i = 0; i < contexts.Length(); ++i)
             for (size_t j = 0; j < contexts[i]->mRenderbuffers.Length(); ++j)
               result += contexts[i]->mRenderbuffers[j]->MemoryUsage();
         return result;
     }
 
-    static PRInt64 GetRenderbufferCount() {
+    static int64_t GetRenderbufferCount() {
         const ContextsArrayType & contexts = Contexts();
-        PRInt64 result = 0;
+        int64_t result = 0;
         for(size_t i = 0; i < contexts.Length(); ++i)
             result += contexts[i]->mRenderbuffers.Length();
         return result;
     }
 
-    static PRInt64 GetShaderSize();
-
-    static PRInt64 GetShaderCount() {
+    static int64_t GetShaderSize();
+
+    static int64_t GetShaderCount() {
         const ContextsArrayType & contexts = Contexts();
-        PRInt64 result = 0;
+        int64_t result = 0;
         for(size_t i = 0; i < contexts.Length(); ++i)
             result += contexts[i]->mShaders.Length();
         return result;
     }
 
-    static PRInt64 GetContextCount() {
+    static int64_t GetContextCount() {
         return Contexts().Length();
     }
 };
 
 class WebGLMemoryPressureObserver MOZ_FINAL
     : public nsIObserver
 {
 public:
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -86,17 +86,17 @@ WebGLContext::MozActiveTexture(WebGLenum
 
 void
 WebGLContext::ActiveTexture(WebGLenum texture)
 {
     if (!IsContextStable())
         return;
 
     if (texture < LOCAL_GL_TEXTURE0 ||
-        texture >= LOCAL_GL_TEXTURE0 + PRUint32(mGLMaxTextureUnits))
+        texture >= LOCAL_GL_TEXTURE0 + uint32_t(mGLMaxTextureUnits))
     {
         return ErrorInvalidEnum(
             "ActiveTexture: texture unit %d out of range. "
             "Accepted values range from TEXTURE0 to TEXTURE0 + %d. "
             "Notice that TEXTURE0 != 0.",
             texture, mGLMaxTextureUnits);
     }
 
@@ -420,31 +420,31 @@ GLenum WebGLContext::CheckedBufferData(G
     WebGLBuffer *boundBuffer = NULL;
     if (target == LOCAL_GL_ARRAY_BUFFER) {
         boundBuffer = mBoundArrayBuffer;
     } else if (target == LOCAL_GL_ELEMENT_ARRAY_BUFFER) {
         boundBuffer = mBoundElementArrayBuffer;
     }
     NS_ABORT_IF_FALSE(boundBuffer != nsnull, "no buffer bound for this target");
     
-    bool sizeChanges = PRUint32(size) != boundBuffer->ByteLength();
+    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;
     } else {
         gl->fBufferData(target, size, data, usage);
         return LOCAL_GL_NO_ERROR;
     }
 }
 
 NS_IMETHODIMP
-WebGLContext::BufferData(PRInt32 target, const JS::Value& data, PRInt32 usage,
+WebGLContext::BufferData(WebGLenum target, const JS::Value& data, GLenum usage,
                          JSContext* cx)
 {
     if (data.isNull()) {
         BufferData(target, static_cast<ArrayBuffer*>(nsnull), usage);
         return NS_OK;
     }
 
     if (data.isObject()) {
@@ -588,17 +588,17 @@ WebGLContext::BufferData(WebGLenum targe
 
     boundBuffer->SetByteLength(data.mLength);
     boundBuffer->InvalidateCachedMaxElements();
     if (!boundBuffer->CopyDataIfElementArray(data.mData))
         return ErrorOutOfMemory("bufferData: out of memory");
 }
 
 NS_IMETHODIMP
-WebGLContext::BufferSubData(PRInt32 target, PRInt32 offset, const JS::Value& data, JSContext *cx)
+WebGLContext::BufferSubData(WebGLenum target, WebGLintptr offset, const JS::Value& data, JSContext *cx)
 {
     if (!IsContextStable())
         return NS_OK;
 
     if (data.isNull()) {
         BufferSubData(target, offset, nsnull);
         return NS_OK;
     }
@@ -736,31 +736,31 @@ WebGLContext::CheckFramebufferStatus(Web
     if(mBoundFramebuffer->HasIncompleteAttachment())
         return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
     if(mBoundFramebuffer->HasAttachmentsOfMismatchedDimensions())
         return LOCAL_GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS;
     return gl->fCheckFramebufferStatus(target);
 }
 
 NS_IMETHODIMP
-WebGLContext::MozClear(PRUint32 mask)
+WebGLContext::MozClear(uint32_t mask)
 {
     Clear(mask);
     return NS_OK;
 }
 
 void
 WebGLContext::Clear(WebGLbitfield mask)
 {
     if (!IsContextStable())
         return;
 
     MakeContextCurrent();
 
-    PRUint32 m = mask & (LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT | LOCAL_GL_STENCIL_BUFFER_BIT);
+    uint32_t m = mask & (LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT | LOCAL_GL_STENCIL_BUFFER_BIT);
     if (mask != m)
         return ErrorInvalidValue("clear: invalid mask bits");
 
     bool needClearCallHere = true;
 
     if (mBoundFramebuffer) {
         if (!mBoundFramebuffer->CheckAndInitializeRenderbuffers())
             return ErrorInvalidFramebufferOperation("clear: incomplete framebuffer");
@@ -894,27 +894,27 @@ WebGLContext::CopyTexSubImage2D_base(Web
     } else {
 
         // the rect doesn't fit in the framebuffer
 
         /*** first, we initialize the texture as black ***/
 
         // first, compute the size of the buffer we should allocate to initialize the texture as black
 
-        PRUint32 texelSize = 0;
+        uint32_t texelSize = 0;
         if (!ValidateTexFormatAndType(internalformat, LOCAL_GL_UNSIGNED_BYTE, -1, &texelSize, info))
             return;
 
         CheckedUint32 checked_neededByteLength = 
             GetImageSize(height, width, texelSize, mPixelStoreUnpackAlignment);
 
         if (!checked_neededByteLength.isValid())
             return ErrorInvalidOperation("%s: integer overflow computing the needed buffer size", info);
 
-        PRUint32 bytesNeeded = checked_neededByteLength.value();
+        uint32_t bytesNeeded = checked_neededByteLength.value();
 
         // now that the size is known, create the buffer
 
         // We need some zero pages, because GL doesn't guarantee the
         // contents of a texture allocated with NULL data.
         // Hopefully calloc will just mmap zero pages here.
         void *tempZeroData = calloc(1, bytesNeeded);
         if (!tempZeroData)
@@ -1244,17 +1244,17 @@ WebGLContext::DeleteBuffer(WebGLBuffer *
 
     if (mBoundArrayBuffer == buf)
         BindBuffer(LOCAL_GL_ARRAY_BUFFER,
                    static_cast<WebGLBuffer*>(nsnull));
     if (mBoundElementArrayBuffer == buf)
         BindBuffer(LOCAL_GL_ELEMENT_ARRAY_BUFFER,
                    static_cast<WebGLBuffer*>(nsnull));
 
-    for (int i = 0; i < mGLMaxVertexAttribs; i++) {
+    for (int32_t i = 0; i < mGLMaxVertexAttribs; i++) {
         if (mAttribBuffers[i].buf == buf)
             mAttribBuffers[i].buf = nsnull;
     }
 
     buf->RequestDelete();
 }
 
 NS_IMETHODIMP
@@ -1329,17 +1329,17 @@ WebGLContext::DeleteTexture(WebGLTexture
         return;
 
     if (!tex || tex->IsDeleted())
         return;
 
     if (mBoundFramebuffer)
         mBoundFramebuffer->DetachTexture(tex);
 
-    for (int i = 0; i < mGLMaxTextureUnits; i++) {
+    for (int32_t i = 0; i < mGLMaxTextureUnits; i++) {
         if ((tex->Target() == LOCAL_GL_TEXTURE_2D && mBound2DTextures[i] == tex) ||
             (tex->Target() == LOCAL_GL_TEXTURE_CUBE_MAP && mBoundCubeMapTextures[i] == tex))
         {
             ActiveTexture(LOCAL_GL_TEXTURE0 + i);
             BindTexture(tex->Target(), static_cast<WebGLTexture*>(nsnull));
         }
     }
     ActiveTexture(LOCAL_GL_TEXTURE0 + mActiveTexture);
@@ -1617,17 +1617,17 @@ WebGLContext::UndoFakeVertexAttrib0()
 bool
 WebGLContext::NeedFakeBlack()
 {
     // handle this case first, it's the generic case
     if (mFakeBlackStatus == DoNotNeedFakeBlack)
         return false;
 
     if (mFakeBlackStatus == DontKnowIfNeedFakeBlack) {
-        for (PRInt32 i = 0; i < mGLMaxTextureUnits; ++i) {
+        for (int32_t i = 0; i < mGLMaxTextureUnits; ++i) {
             if ((mBound2DTextures[i] && mBound2DTextures[i]->NeedFakeBlack()) ||
                 (mBoundCubeMapTextures[i] && mBoundCubeMapTextures[i]->NeedFakeBlack()))
             {
                 mFakeBlackStatus = DoNeedFakeBlack;
                 break;
             }
         }
 
@@ -1648,17 +1648,17 @@ WebGLContext::BindFakeBlackTextures()
         return;
 
     if (!mBlackTexturesAreInitialized) {
         GLuint bound2DTex = 0;
         GLuint boundCubeTex = 0;
         gl->fGetIntegerv(LOCAL_GL_TEXTURE_BINDING_2D, (GLint*) &bound2DTex);
         gl->fGetIntegerv(LOCAL_GL_TEXTURE_BINDING_CUBE_MAP, (GLint*) &boundCubeTex);
 
-        const PRUint8 black[] = {0, 0, 0, 255};
+        const uint8_t black[] = {0, 0, 0, 255};
 
         gl->fGenTextures(1, &mBlackTexture2D);
         gl->fBindTexture(LOCAL_GL_TEXTURE_2D, mBlackTexture2D);
         gl->fTexImage2D(LOCAL_GL_TEXTURE_2D, 0, LOCAL_GL_RGBA, 1, 1,
                         0, LOCAL_GL_RGBA, LOCAL_GL_UNSIGNED_BYTE, &black);
 
         gl->fGenTextures(1, &mBlackTextureCubeMap);
         gl->fBindTexture(LOCAL_GL_TEXTURE_CUBE_MAP, mBlackTextureCubeMap);
@@ -1669,17 +1669,17 @@ WebGLContext::BindFakeBlackTextures()
 
         // Reset bound textures
         gl->fBindTexture(LOCAL_GL_TEXTURE_2D, bound2DTex);
         gl->fBindTexture(LOCAL_GL_TEXTURE_CUBE_MAP, boundCubeTex);
 
         mBlackTexturesAreInitialized = true;
     }
 
-    for (PRInt32 i = 0; i < mGLMaxTextureUnits; ++i) {
+    for (int32_t i = 0; i < mGLMaxTextureUnits; ++i) {
         if (mBound2DTextures[i] && mBound2DTextures[i]->NeedFakeBlack()) {
             gl->fActiveTexture(LOCAL_GL_TEXTURE0 + i);
             gl->fBindTexture(LOCAL_GL_TEXTURE_2D, mBlackTexture2D);
         }
         if (mBoundCubeMapTextures[i] && mBoundCubeMapTextures[i]->NeedFakeBlack()) {
             gl->fActiveTexture(LOCAL_GL_TEXTURE0 + i);
             gl->fBindTexture(LOCAL_GL_TEXTURE_CUBE_MAP, mBlackTextureCubeMap);
         }
@@ -1688,17 +1688,17 @@ WebGLContext::BindFakeBlackTextures()
 
 void
 WebGLContext::UnbindFakeBlackTextures()
 {
     // this is the generic case: try to return early
     if (!NeedFakeBlack())
         return;
 
-    for (PRInt32 i = 0; i < mGLMaxTextureUnits; ++i) {
+    for (int32_t i = 0; i < mGLMaxTextureUnits; ++i) {
         if (mBound2DTextures[i] && mBound2DTextures[i]->NeedFakeBlack()) {
             gl->fActiveTexture(LOCAL_GL_TEXTURE0 + i);
             gl->fBindTexture(LOCAL_GL_TEXTURE_2D, mBound2DTextures[i]->GLName());
         }
         if (mBoundCubeMapTextures[i] && mBoundCubeMapTextures[i]->NeedFakeBlack()) {
             gl->fActiveTexture(LOCAL_GL_TEXTURE0 + i);
             gl->fBindTexture(LOCAL_GL_TEXTURE_CUBE_MAP, mBoundCubeMapTextures[i]->GLName());
         }
@@ -1733,17 +1733,17 @@ WebGLContext::DrawArrays(GLenum mode, We
     if (count == 0)
         return;
 
     // If there is no current program, this is silently ignored.
     // Any checks below this depend on a program being available.
     if (!mCurrentProgram)
         return;
 
-    PRInt32 maxAllowedCount = 0;
+    int32_t maxAllowedCount = 0;
     if (!ValidateBuffers(&maxAllowedCount, "drawArrays"))
         return;
 
     CheckedInt32 checked_firstPlusCount = CheckedInt32(first) + count;
 
     if (!checked_firstPlusCount.isValid())
         return ErrorInvalidOperation("drawArrays: overflow in first+count");
 
@@ -1829,34 +1829,34 @@ WebGLContext::DrawElements(WebGLenum mod
     CheckedUint32 checked_neededByteCount = checked_byteCount + byteOffset;
 
     if (!checked_neededByteCount.isValid())
         return ErrorInvalidOperation("DrawElements: overflow in byteOffset+byteCount");
 
     if (checked_neededByteCount.value() > mBoundElementArrayBuffer->ByteLength())
         return ErrorInvalidOperation("DrawElements: bound element array buffer is too small for given count and offset");
 
-    PRInt32 maxAllowedCount = 0;
+    int32_t maxAllowedCount = 0;
     if (!ValidateBuffers(&maxAllowedCount, "drawElements"))
       return;
 
-    PRInt32 maxIndex
+    int32_t maxIndex
       = type == LOCAL_GL_UNSIGNED_SHORT
         ? mBoundElementArrayBuffer->FindMaxUshortElement()
         : mBoundElementArrayBuffer->FindMaxUbyteElement();
 
     CheckedInt32 checked_maxIndexPlusOne = CheckedInt32(maxIndex) + 1;
 
     if (!checked_maxIndexPlusOne.isValid() ||
         checked_maxIndexPlusOne.value() > maxAllowedCount)
     {
         // the index array contains invalid indices for the current drawing state, but they
         // might not be used by the present drawElements call, depending on first and count.
 
-        PRInt32 maxIndexInSubArray
+        int32_t maxIndexInSubArray
           = type == LOCAL_GL_UNSIGNED_SHORT
             ? mBoundElementArrayBuffer->FindMaxElementInSubArray<GLushort>(count, byteOffset)
             : mBoundElementArrayBuffer->FindMaxElementInSubArray<GLubyte>(count, byteOffset);
 
         CheckedInt32 checked_maxIndexInSubArrayPlusOne = CheckedInt32(maxIndexInSubArray) + 1;
 
         if (!checked_maxIndexInSubArrayPlusOne.isValid() ||
             checked_maxIndexInSubArrayPlusOne.value() > maxAllowedCount)
@@ -2042,24 +2042,24 @@ WebGLContext::FrontFace(WebGLenum mode)
     }
 
     MakeContextCurrent();
     gl->fFrontFace(mode);
 }
 
 // returns an object: { size: ..., type: ..., name: ... }
 NS_IMETHODIMP
-WebGLContext::GetActiveAttrib(nsIWebGLProgram *pobj, PRUint32 index, nsIWebGLActiveInfo **retval)
+WebGLContext::GetActiveAttrib(nsIWebGLProgram *pobj, uint32_t index, nsIWebGLActiveInfo **retval)
 {
     *retval = GetActiveAttrib(static_cast<WebGLProgram*>(pobj), index).get();
     return NS_OK;
 }
 
 already_AddRefed<WebGLActiveInfo>
-WebGLContext::GetActiveAttrib(WebGLProgram *prog, PRUint32 index)
+WebGLContext::GetActiveAttrib(WebGLProgram *prog, uint32_t index)
 {
     if (!IsContextStable())
         return nsnull;
 
     if (!ValidateObject("getActiveAttrib: program", prog))
         return nsnull;
 
     MakeContextCurrent();
@@ -2135,24 +2135,24 @@ WebGLContext::GenerateMipmap(WebGLenum t
         gl->fGenerateMipmap(target);
         gl->fTexParameteri(target, LOCAL_GL_TEXTURE_MIN_FILTER, tex->MinFilter());
     } else {
         gl->fGenerateMipmap(target);
     }
 }
 
 NS_IMETHODIMP
-WebGLContext::GetActiveUniform(nsIWebGLProgram *pobj, PRUint32 index, nsIWebGLActiveInfo **retval)
+WebGLContext::GetActiveUniform(nsIWebGLProgram *pobj, uint32_t index, nsIWebGLActiveInfo **retval)
 {
     *retval = GetActiveUniform(static_cast<WebGLProgram*>(pobj), index).get();
     return NS_OK;
 }
 
 already_AddRefed<WebGLActiveInfo>
-WebGLContext::GetActiveUniform(WebGLProgram *prog, PRUint32 index)
+WebGLContext::GetActiveUniform(WebGLProgram *prog, uint32_t index)
 {
     if (!IsContextStable())
         return nsnull;
 
     if (!ValidateObject("getActiveUniform: program", prog))
         return nsnull;
 
     MakeContextCurrent();
@@ -2249,17 +2249,17 @@ WebGLContext::GetAttachedShaders(WebGLPr
     } else {
         retval.SetValue().AppendElements(prog->AttachedShaders());
     }
 }
 
 NS_IMETHODIMP
 WebGLContext::GetAttribLocation(nsIWebGLProgram *pobj,
                                 const nsAString& name,
-                                PRInt32 *retval)
+                                WebGLint *retval)
 {
     *retval = GetAttribLocation(static_cast<WebGLProgram*>(pobj), name);
     return NS_OK;
 }
 
 WebGLint
 WebGLContext::GetAttribLocation(WebGLProgram *prog, const nsAString& name)
 {
@@ -2278,17 +2278,17 @@ WebGLContext::GetAttribLocation(WebGLPro
 
     WebGLuint progname = prog->GLName();
 
     MakeContextCurrent();
     return gl->fGetAttribLocation(progname, mappedName.get());
 }
 
 NS_IMETHODIMP
-WebGLContext::GetParameter(PRUint32 pname, JSContext* cx, JS::Value *retval)
+WebGLContext::GetParameter(uint32_t pname, JSContext* cx, JS::Value *retval)
 {
     ErrorResult rv;
     JS::Value v = GetParameter(cx, pname, rv);
     if (rv.Failed())
         return rv.ErrorCode();
     *retval = v;
     return NS_OK;
 }
@@ -2442,17 +2442,17 @@ WebGLContext::GetParameter(JSContext* cx
 
         case LOCAL_GL_MAX_VARYING_VECTORS:
             return JS::Int32Value(mGLMaxVaryingVectors);
 
         case LOCAL_GL_NUM_COMPRESSED_TEXTURE_FORMATS:
             return JS::Int32Value(0);
         case LOCAL_GL_COMPRESSED_TEXTURE_FORMATS:
         {
-            PRUint32 length = mCompressedTextureFormats.Length();
+            uint32_t length = mCompressedTextureFormats.Length();
             JSObject* obj = Uint32Array::Create(cx, length, mCompressedTextureFormats.Elements());
             if (!obj) {
                 rv = NS_ERROR_OUT_OF_MEMORY;
             }
             return JS::ObjectOrNullValue(obj);
         }
 
 // unsigned int. here we may have to return very large values like 2^32-1 that can't be represented as
@@ -2922,17 +2922,17 @@ WebGLContext::GetError()
     }
 
     WebGLenum err = mWebGLError;
     mWebGLError = LOCAL_GL_NO_ERROR;
     return err;
 }
 
 NS_IMETHODIMP
-WebGLContext::GetProgramParameter(nsIWebGLProgram *pobj, PRUint32 pname, JS::Value *retval)
+WebGLContext::GetProgramParameter(nsIWebGLProgram *pobj, uint32_t pname, JS::Value *retval)
 {
     *retval = GetProgramParameter(static_cast<WebGLProgram*>(pobj), pname);
     return NS_OK;
 }
 
 JS::Value
 WebGLContext::GetProgramParameter(WebGLProgram *prog, WebGLenum pname)
 {
@@ -3791,37 +3791,37 @@ WebGLContext::ReadPixels(WebGLint x, Web
     if (width < 0 || height < 0)
         return ErrorInvalidValue("ReadPixels: negative size passed");
 
     const WebGLRectangleObject *framebufferRect = FramebufferRectangleObject();
     WebGLsizei framebufferWidth = framebufferRect ? framebufferRect->Width() : 0;
     WebGLsizei framebufferHeight = framebufferRect ? framebufferRect->Height() : 0;
 
     void* data = pixels->mData;
-    PRUint32 dataByteLen = JS_GetTypedArrayByteLength(pixels->mObj, NULL);
+    uint32_t dataByteLen = JS_GetTypedArrayByteLength(pixels->mObj, NULL);
     int dataType = JS_GetTypedArrayType(pixels->mObj, NULL);
 
-    PRUint32 channels = 0;
+    uint32_t channels = 0;
 
     // Check the format param
     switch (format) {
         case LOCAL_GL_ALPHA:
             channels = 1;
             break;
         case LOCAL_GL_RGB:
             channels = 3;
             break;
         case LOCAL_GL_RGBA:
             channels = 4;
             break;
         default:
             return ErrorInvalidEnum("readPixels: Bad format");
     }
 
-    PRUint32 bytesPerPixel = 0;
+    uint32_t bytesPerPixel = 0;
     int requiredDataType = 0;
 
     // Check the type param
     switch (type) {
         case LOCAL_GL_UNSIGNED_BYTE:
             bytesPerPixel = 1 * channels;
             requiredDataType = js::ArrayBufferView::TYPE_UINT8;
             break;
@@ -3920,21 +3920,21 @@ WebGLContext::ReadPixels(WebGLint x, Web
         if (subrect_width < 0 || subrect_height < 0 ||
             subrect_width > width || subrect_height > height)
             return ErrorInvalidOperation("ReadPixels: integer overflow computing clipped rect size");
 
         // now we know that subrect_width is in the [0..width] interval, and same for heights.
 
         // now, same computation as above to find the size of the intermediate buffer to allocate for the subrect
         // no need to check again for integer overflow here, since we already know the sizes aren't greater than before
-        PRUint32 subrect_plainRowSize = subrect_width * bytesPerPixel;
+        uint32_t subrect_plainRowSize = subrect_width * bytesPerPixel;
 	// There are checks above to ensure that this doesn't overflow.
-        PRUint32 subrect_alignedRowSize = 
+        uint32_t subrect_alignedRowSize = 
             RoundedToNextMultipleOf(subrect_plainRowSize, mPixelStorePackAlignment).value();
-        PRUint32 subrect_byteLength = (subrect_height-1)*subrect_alignedRowSize + subrect_plainRowSize;
+        uint32_t subrect_byteLength = (subrect_height-1)*subrect_alignedRowSize + subrect_plainRowSize;
 
         // create subrect buffer, call glReadPixels, copy pixels into destination buffer, delete subrect buffer
         GLubyte *subrect_data = new GLubyte[subrect_byteLength];
         gl->fReadPixels(subrect_x, subrect_y, subrect_width, subrect_height, format, type, subrect_data);
 
         // notice that this for loop terminates because we already checked that subrect_height is at most height
         for (GLint y_inside_subrect = 0; y_inside_subrect < subrect_height; ++y_inside_subrect) {
             GLint subrect_x_in_dest_buffer = subrect_x - x;
@@ -3958,32 +3958,32 @@ WebGLContext::ReadPixels(WebGLint x, Web
             needAlphaFixup = !mBoundFramebuffer->ColorAttachment().HasAlpha();
         } else {
             needAlphaFixup = gl->ActualFormat().alpha == 0;
         }
 
         if (needAlphaFixup) {
             if (format == LOCAL_GL_ALPHA && type == LOCAL_GL_UNSIGNED_BYTE) {
                 // this is easy; it's an 0xff memset per row
-                PRUint8 *row = (PRUint8*)data;
+                uint8_t *row = static_cast<uint8_t*>(data);
                 for (GLint j = 0; j < height; ++j) {
                     memset(row, 0xff, checked_plainRowSize.value());
                     row += checked_alignedRowSize.value();
                 }
             } else if (format == LOCAL_GL_RGBA && type == LOCAL_GL_UNSIGNED_BYTE) {
                 // this is harder, we need to just set the alpha byte here
-                PRUint8 *row = (PRUint8*)data;
+                uint8_t *row = static_cast<uint8_t*>(data);
                 for (GLint j = 0; j < height; ++j) {
-                    PRUint8 *rowp = row;
+                    uint8_t *rowp = row;
 #ifdef IS_LITTLE_ENDIAN
                     // offset to get the alpha byte; we're always going to
                     // move by 4 bytes
                     rowp += 3;
 #endif
-                    PRUint8 *endrowp = rowp + 4 * width;
+                    uint8_t *endrowp = rowp + 4 * width;
                     while (rowp != endrowp) {
                         *rowp = 0xff;
                         rowp += 4;
                     }
 
                     row += checked_alignedRowSize.value();
                 }
             } else {
@@ -4264,17 +4264,17 @@ WebGLContext::StencilOpSeparate(WebGLenu
 nsresult
 WebGLContext::DOMElementToImageSurface(Element* imageOrCanvas,
                                        gfxImageSurface **imageOut, WebGLTexelFormat *format)
 {
     if (!imageOrCanvas) {
         return NS_ERROR_FAILURE;
     }        
 
-    PRUint32 flags =
+    uint32_t flags =
         nsLayoutUtils::SFE_WANT_NEW_SURFACE |
         nsLayoutUtils::SFE_WANT_IMAGE_SURFACE;
 
     if (mPixelStoreColorspaceConversion == LOCAL_GL_NONE)
         flags |= nsLayoutUtils::SFE_NO_COLORSPACE_CONVERSION;
     if (!mPixelStorePremultiplyAlpha)
         flags |= nsLayoutUtils::SFE_NO_PREMULTIPLY_ALPHA;
 
@@ -4437,17 +4437,17 @@ WebGLContext::name##_base(WebGLUniformLo
         return ErrorInvalidOperation("%s: expected an array of length exactly %d" \
                                      " (since this uniform is not an array uniform)," \
                                      " got an array of length %d",              \
                                  #name,                                         \
                                  expectedElemSize,                           \
                                  arrayLength);                                  \
     }                                                                           \
                                                                                 \
-    PRUint32 numElementsToUpload = NS_MIN(info.arraySize, arrayLength/expectedElemSize);     \
+    uint32_t numElementsToUpload = NS_MIN(info.arraySize, arrayLength/expectedElemSize);     \
     gl->f##name(location, numElementsToUpload, data);    \
 }
 
 #define SIMPLE_MATRIX_METHOD_UNIFORM(name, dim)                                 \
 NS_IMETHODIMP                                                                   \
 WebGLContext::name(nsIWebGLUniformLocation* aLocation, bool aTranspose,         \
                    const JS::Value& aValue, JSContext* aCx)                     \
 {                                                                               \
@@ -4459,23 +4459,23 @@ WebGLContext::name(nsIWebGLUniformLocati
     name(static_cast<WebGLUniformLocation*>(aLocation), aTranspose, arr);       \
     return NS_OK;                                                               \
 }                                                                               \
 void                                                                            \
 WebGLContext::name##_base(WebGLUniformLocation* location_object,                \
                           WebGLboolean aTranspose, uint32_t arrayLength,        \
                           float* data)                                          \
 {                                                                               \
-    PRUint32 expectedElemSize = (dim)*(dim);                                                     \
+    uint32_t expectedElemSize = (dim)*(dim);                                                     \
     if (!IsContextStable()) {                                                   \
         return;                                                                 \
     }                                                                           \
                                                                                 \
     OBTAIN_UNIFORM_LOCATION(#name ": location")                                 \
-    PRUint32 uniformElemSize = location_object->ElementSize();                           \
+    uint32_t uniformElemSize = location_object->ElementSize();                           \
     if (expectedElemSize != uniformElemSize) {                                               \
         return ErrorInvalidOperation(                                           \
             #name ": this function expected a uniform of element size %d,"      \
             " got a uniform of element size %d",                                \
             expectedElemSize,                                                            \
             uniformElemSize);                                                       \
     }                                                                           \
     const WebGLUniformInfo& info = location_object->Info();                     \
@@ -4498,17 +4498,17 @@ WebGLContext::name##_base(WebGLUniformLo
                                  arrayLength);                                  \
     }                                                                           \
     if (aTranspose) {                                                           \
         return ErrorInvalidValue(#name ": transpose must be FALSE as per the "  \
                                  "OpenGL ES 2.0 spec");                         \
     }                                                                           \
                                                                                 \
     MakeContextCurrent();                                                       \
-    PRUint32 numElementsToUpload = NS_MIN(info.arraySize, arrayLength/(expectedElemSize));  \
+    uint32_t numElementsToUpload = NS_MIN(info.arraySize, arrayLength/(expectedElemSize));  \
     gl->f##name(location, numElementsToUpload, false, data); \
 }
 
 #define SIMPLE_METHOD_UNIFORM_1(glname, name, t1)        \
 NS_IMETHODIMP WebGLContext::name(nsIWebGLUniformLocation *ploc, t1 a1) {      \
     name(static_cast<WebGLUniformLocation*>(ploc), a1);                 \
     return NS_OK;                                                       \
 }                                                                       \
@@ -4575,17 +4575,17 @@ SIMPLE_ARRAY_METHOD_UNIFORM(Uniform2fv, 
 SIMPLE_ARRAY_METHOD_UNIFORM(Uniform3fv, 3, Float32, WebGLfloat)
 SIMPLE_ARRAY_METHOD_UNIFORM(Uniform4fv, 4, Float32, WebGLfloat)
 
 SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix2fv, 2)
 SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix3fv, 3)
 SIMPLE_MATRIX_METHOD_UNIFORM(UniformMatrix4fv, 4)
 
 NS_IMETHODIMP
-WebGLContext::MozVertexAttrib1f(PRUint32 index, WebGLfloat x0)
+WebGLContext::MozVertexAttrib1f(uint32_t index, WebGLfloat x0)
 {
     VertexAttrib1f(index, x0);
     return NS_OK;
 }
 
 void
 WebGLContext::VertexAttrib1f(WebGLuint index, WebGLfloat x0)
 {
@@ -4602,17 +4602,17 @@ WebGLContext::VertexAttrib1f(WebGLuint i
         mVertexAttrib0Vector[2] = 0;
         mVertexAttrib0Vector[3] = 1;
         if (gl->IsGLES2())
             gl->fVertexAttrib1f(index, x0);
     }
 }
 
 NS_IMETHODIMP
-WebGLContext::MozVertexAttrib2f(PRUint32 index, WebGLfloat x0, WebGLfloat x1)
+WebGLContext::MozVertexAttrib2f(uint32_t index, WebGLfloat x0, WebGLfloat x1)
 {
     VertexAttrib2f(index, x0, x1);
     return NS_OK;
 }
 
 void
 WebGLContext::VertexAttrib2f(WebGLuint index, WebGLfloat x0, WebGLfloat x1)
 {
@@ -4629,17 +4629,17 @@ WebGLContext::VertexAttrib2f(WebGLuint i
         mVertexAttrib0Vector[2] = 0;
         mVertexAttrib0Vector[3] = 1;
         if (gl->IsGLES2())
             gl->fVertexAttrib2f(index, x0, x1);
     }
 }
 
 NS_IMETHODIMP
-WebGLContext::MozVertexAttrib3f(PRUint32 index, WebGLfloat x0, WebGLfloat x1, WebGLfloat x2)
+WebGLContext::MozVertexAttrib3f(uint32_t index, WebGLfloat x0, WebGLfloat x1, WebGLfloat x2)
 {
     VertexAttrib3f(index, x0, x1, x2);
     return NS_OK;
 }
 
 void
 WebGLContext::VertexAttrib3f(WebGLuint index, WebGLfloat x0, WebGLfloat x1, WebGLfloat x2)
 {
@@ -4656,17 +4656,17 @@ WebGLContext::VertexAttrib3f(WebGLuint i
         mVertexAttrib0Vector[2] = x2;
         mVertexAttrib0Vector[3] = 1;
         if (gl->IsGLES2())
             gl->fVertexAttrib3f(index, x0, x1, x2);
     }
 }
 
 NS_IMETHODIMP
-WebGLContext::MozVertexAttrib4f(PRUint32 index, WebGLfloat x0, WebGLfloat x1,
+WebGLContext::MozVertexAttrib4f(uint32_t index, WebGLfloat x0, WebGLfloat x1,
                                                 WebGLfloat x2, WebGLfloat x3)
 {
     VertexAttrib4f(index, x0, x1, x2, x3);
     return NS_OK;
 }
 
 void
 WebGLContext::VertexAttrib4f(WebGLuint index, WebGLfloat x0, WebGLfloat x1,
@@ -4890,17 +4890,17 @@ WebGLContext::CompileShader(WebGLShader 
 
         const nsPromiseFlatString& flatSource = PromiseFlatString(cleanSource);
 
         // shaderSource() already checks that the source stripped of comments is in the
         // 7-bit ASCII range, so we can skip the NS_IsAscii() check.
         const nsCString& sourceCString = NS_LossyConvertUTF16toASCII(flatSource);
 
         if (gl->WorkAroundDriverBugs()) {
-            const PRUint32 maxSourceLength = (PRUint32(1)<<18) - 1;
+            const uint32_t maxSourceLength = 0x3ffff;
             if (sourceCString.Length() > maxSourceLength)
                 return ErrorInvalidValue("compileShader: source has more than %d characters", 
                                          maxSourceLength);
         }
 
         const char *s = sourceCString.get();
 
         compiler = ShConstructCompiler((ShShaderType) shader->ShaderType(),
@@ -5460,17 +5460,17 @@ WebGLContext::VertexAttribPointer(WebGLu
     MakeContextCurrent();
 
     gl->fVertexAttribPointer(index, size, type, normalized,
                              stride,
                              reinterpret_cast<void*>(byteOffset));
 }
 
 NS_IMETHODIMP
-WebGLContext::TexImage2D(PRInt32)
+WebGLContext::TexImage2D(int32_t)
 {
     if (!IsContextStable())
         return NS_OK;
 
     return NS_ERROR_FAILURE;
 }
 
 GLenum WebGLContext::CheckedTexImage2D(GLenum target,
@@ -5509,17 +5509,17 @@ GLenum WebGLContext::CheckedTexImage2D(G
     }
 }
 
 void
 WebGLContext::TexImage2D_base(WebGLenum target, WebGLint level, WebGLenum internalformat,
                               WebGLsizei width, WebGLsizei height, WebGLsizei srcStrideOrZero,
                               WebGLint border,
                               WebGLenum format, WebGLenum type,
-                              void *data, PRUint32 byteLength,
+                              void *data, uint32_t byteLength,
                               int jsArrayType, // a TypedArray format enum, or -1 if not relevant
                               WebGLTexelFormat srcFormat, bool srcPremultiplied)
 {
     if (!ValidateTexImage2DTarget(target, width, height, "texImage2D")) {
         return;
     }
 
     switch (format) {
@@ -5544,37 +5544,37 @@ WebGLContext::TexImage2D_base(WebGLenum 
         if (!(is_pot_assuming_nonnegative(width) &&
               is_pot_assuming_nonnegative(height)))
             return ErrorInvalidValue("texImage2D: with level > 0, width and height must be powers of two");
     }
 
     if (border != 0)
         return ErrorInvalidValue("TexImage2D: border must be 0");
 
-    PRUint32 dstTexelSize = 0;
+    uint32_t dstTexelSize = 0;
     if (!ValidateTexFormatAndType(format, type, jsArrayType, &dstTexelSize, "texImage2D"))
         return;
 
     WebGLTexelFormat dstFormat = GetWebGLTexelFormat(format, type);
     WebGLTexelFormat actualSrcFormat = srcFormat == WebGLTexelConversions::Auto ? dstFormat : srcFormat;
 
-    PRUint32 srcTexelSize = WebGLTexelConversions::TexelBytesForFormat(actualSrcFormat);
+    uint32_t srcTexelSize = WebGLTexelConversions::TexelBytesForFormat(actualSrcFormat);
 
     CheckedUint32 checked_neededByteLength = 
         GetImageSize(height, width, srcTexelSize, mPixelStoreUnpackAlignment);
 
     CheckedUint32 checked_plainRowSize = CheckedUint32(width) * srcTexelSize;
 
     CheckedUint32 checked_alignedRowSize =
         RoundedToNextMultipleOf(checked_plainRowSize.value(), mPixelStoreUnpackAlignment);
 
     if (!checked_neededByteLength.isValid())
         return ErrorInvalidOperation("texImage2D: integer overflow computing the needed buffer size");
 
-    PRUint32 bytesNeeded = checked_neededByteLength.value();
+    uint32_t bytesNeeded = checked_neededByteLength.value();
 
     if (byteLength && byteLength < bytesNeeded)
         return ErrorInvalidOperation("TexImage2D: not enough data for operation (need %d, have %d)",
                                  bytesNeeded, byteLength);
 
     WebGLTexture *tex = activeBoundTextureForTarget(target);
 
     if (!tex)
@@ -5602,19 +5602,19 @@ WebGLContext::TexImage2D_base(WebGLenum 
         {
             // no conversion, no flipping, so we avoid copying anything and just pass the source pointer
             error = CheckedTexImage2D(target, level, internalformat,
                                       width, height, border, format, type, data);
         }
         else
         {
             size_t convertedDataSize = height * dstStride;
-            nsAutoArrayPtr<PRUint8> convertedData(new PRUint8[convertedDataSize]);
+            nsAutoArrayPtr<uint8_t> convertedData(new uint8_t[convertedDataSize]);
             ConvertImage(width, height, srcStride, dstStride,
-                        (PRUint8*)data, convertedData,
+                        static_cast<uint8_t*>(data), convertedData,
                         actualSrcFormat, srcPremultiplied,
                         dstFormat, mPixelStorePremultiplyAlpha, dstTexelSize);
             error = CheckedTexImage2D(target, level, internalformat,
                                       width, height, border, format, type, convertedData);
         }
     } else {
         // We need some zero pages, because GL doesn't guarantee the
         // contents of a texture allocated with NULL data.
@@ -5731,41 +5731,41 @@ WebGLContext::TexImage2D(JSContext* /* u
 
     nsRefPtr<gfxImageSurface> isurf;
 
     WebGLTexelFormat srcFormat;
     rv = DOMElementToImageSurface(elt, getter_AddRefs(isurf), &srcFormat);
     if (rv.Failed())
         return;
 
-    PRUint32 byteLength = isurf->Stride() * isurf->Height();
+    uint32_t byteLength = isurf->Stride() * isurf->Height();
 
     return TexImage2D_base(target, level, internalformat,
                            isurf->Width(), isurf->Height(), isurf->Stride(), 0,
                            format, type,
                            isurf->Data(), byteLength,
                            -1,
                            srcFormat, mPixelStorePremultiplyAlpha);
 }
 
 NS_IMETHODIMP
-WebGLContext::TexSubImage2D(PRInt32)
+WebGLContext::TexSubImage2D(int32_t)
 {
     if (!IsContextStable())
         return NS_OK;
 
     return NS_ERROR_FAILURE;
 }
 
 void
 WebGLContext::TexSubImage2D_base(WebGLenum target, WebGLint level,
                                  WebGLint xoffset, WebGLint yoffset,
                                  WebGLsizei width, WebGLsizei height, WebGLsizei srcStrideOrZero,
                                  WebGLenum format, WebGLenum type,
-                                 void *pixels, PRUint32 byteLength,
+                                 void *pixels, uint32_t byteLength,
                                  int jsArrayType,
                                  WebGLTexelFormat srcFormat, bool srcPremultiplied)
 {
     switch (target) {
         case LOCAL_GL_TEXTURE_2D:
         case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X:
         case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
         case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
@@ -5782,40 +5782,40 @@ WebGLContext::TexSubImage2D_base(WebGLen
     }
 
     if (level >= 1) {
         if (!(is_pot_assuming_nonnegative(width) &&
               is_pot_assuming_nonnegative(height)))
             return ErrorInvalidValue("texSubImage2D: with level > 0, width and height must be powers of two");
     }
 
-    PRUint32 dstTexelSize = 0;
+    uint32_t dstTexelSize = 0;
     if (!ValidateTexFormatAndType(format, type, jsArrayType, &dstTexelSize, "texSubImage2D"))
         return;
 
     WebGLTexelFormat dstFormat = GetWebGLTexelFormat(format, type);
     WebGLTexelFormat actualSrcFormat = srcFormat == WebGLTexelConversions::Auto ? dstFormat : srcFormat;
 
-    PRUint32 srcTexelSize = WebGLTexelConversions::TexelBytesForFormat(actualSrcFormat);
+    uint32_t srcTexelSize = WebGLTexelConversions::TexelBytesForFormat(actualSrcFormat);
 
     if (width == 0 || height == 0)
         return; // ES 2.0 says it has no effect, we better return right now
 
     CheckedUint32 checked_neededByteLength = 
         GetImageSize(height, width, srcTexelSize, mPixelStoreUnpackAlignment);
 
     CheckedUint32 checked_plainRowSize = CheckedUint32(width) * srcTexelSize;
 
     CheckedUint32 checked_alignedRowSize = 
         RoundedToNextMultipleOf(checked_plainRowSize.value(), mPixelStoreUnpackAlignment);
 
     if (!checked_neededByteLength.isValid())
         return ErrorInvalidOperation("texSubImage2D: integer overflow computing the needed buffer size");
 
-    PRUint32 bytesNeeded = checked_neededByteLength.value();
+    uint32_t bytesNeeded = checked_neededByteLength.value();
  
     if (byteLength < bytesNeeded)
         return ErrorInvalidOperation("texSubImage2D: not enough data for operation (need %d, have %d)", bytesNeeded, byteLength);
 
     WebGLTexture *tex = activeBoundTextureForTarget(target);
 
     if (!tex)
         return ErrorInvalidOperation("texSubImage2D: no texture is bound to this target");
@@ -5847,19 +5847,19 @@ WebGLContext::TexSubImage2D_base(WebGLen
         !mPixelStoreFlipY)
     {
         // no conversion, no flipping, so we avoid copying anything and just pass the source pointer
         gl->fTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
     }
     else
     {
         size_t convertedDataSize = height * dstStride;
-        nsAutoArrayPtr<PRUint8> convertedData(new PRUint8[convertedDataSize]);
+        nsAutoArrayPtr<uint8_t> convertedData(new uint8_t[convertedDataSize]);
         ConvertImage(width, height, srcStride, dstStride,
-                    (const PRUint8*)pixels, convertedData,
+                    static_cast<const uint8_t*>(pixels), convertedData,
                     actualSrcFormat, srcPremultiplied,
                     dstFormat, mPixelStorePremultiplyAlpha, dstTexelSize);
 
         gl->fTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, convertedData);
     }
 }
 
 NS_IMETHODIMP
@@ -5970,17 +5970,17 @@ WebGLContext::TexSubImage2D(JSContext* /
 
     nsRefPtr<gfxImageSurface> isurf;
 
     WebGLTexelFormat srcFormat;
     rv = DOMElementToImageSurface(elt, getter_AddRefs(isurf), &srcFormat);
     if (rv.Failed())
         return;
 
-    PRUint32 byteLength = isurf->Stride() * isurf->Height();
+    uint32_t byteLength = isurf->Stride() * isurf->Height();
 
     return TexSubImage2D_base(target, level,
                               xoffset, yoffset,
                               isurf->Width(), isurf->Height(), isurf->Stride(),
                               format, type,
                               isurf->Data(), byteLength,
                               -1,
                               srcFormat, mPixelStorePremultiplyAlpha);
--- a/content/canvas/src/WebGLContextReporter.cpp
+++ b/content/canvas/src/WebGLContextReporter.cpp
@@ -136,32 +136,32 @@ WebGLMemoryMultiReporterWrapper::WebGLMe
 
 WebGLMemoryMultiReporterWrapper::~WebGLMemoryMultiReporterWrapper()
 {
     NS_UnregisterMemoryMultiReporter(mReporter);
 }
 
 NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLBufferMallocSizeOfFun, "webgl-buffer")
 
-PRInt64 
+int64_t 
 WebGLMemoryMultiReporterWrapper::GetBufferCacheMemoryUsed() {
     const ContextsArrayType & contexts = Contexts();
-    PRInt64 result = 0;
+    int64_t result = 0;
     for (size_t i = 0; i < contexts.Length(); ++i) {
         for (size_t j = 0; j < contexts[i]->mBuffers.Length(); ++j) 
             if (contexts[i]->mBuffers[j]->Target() == LOCAL_GL_ELEMENT_ARRAY_BUFFER)
                result += contexts[i]->mBuffers[j]->SizeOfIncludingThis(WebGLBufferMallocSizeOfFun);
     }
     return result;
 }
 
 NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(WebGLShaderMallocSizeOfFun, "webgl-shader")
 
-PRInt64 
+int64_t 
 WebGLMemoryMultiReporterWrapper::GetShaderSize() {
     const ContextsArrayType & contexts = Contexts();
-    PRInt64 result = 0;
+    int64_t result = 0;
     for (size_t i = 0; i < contexts.Length(); ++i) {
         for (size_t j = 0; j < contexts[i]->mShaders.Length(); ++j) 
             result += contexts[i]->mShaders[j]->SizeOfIncludingThis(WebGLShaderMallocSizeOfFun);
     }
     return result;
 }
--- a/content/canvas/src/WebGLContextUtils.cpp
+++ b/content/canvas/src/WebGLContextUtils.cpp
@@ -81,18 +81,18 @@ WebGLContext::LogMessageIfVerbose(const 
                    "go to about:config, set the webgl.verbose preference, and reload this page.");
 
     firstTime = false;
 }
 
 CheckedUint32
 WebGLContext::GetImageSize(WebGLsizei height, 
                            WebGLsizei width, 
-                           PRUint32 pixelSize,
-                           PRUint32 packOrUnpackAlignment)
+                           uint32_t pixelSize,
+                           uint32_t packOrUnpackAlignment)
 {
     CheckedUint32 checked_plainRowSize = CheckedUint32(width) * pixelSize;
 
     // alignedRowSize = row size rounded up to next multiple of packAlignment
     CheckedUint32 checked_alignedRowSize = RoundedToNextMultipleOf(checked_plainRowSize, packOrUnpackAlignment);
 
     // if height is 0, we don't need any memory to store this; without this check, we'll get an overflow
     CheckedUint32 checked_neededByteLength
--- a/content/canvas/src/WebGLContextValidate.cpp
+++ b/content/canvas/src/WebGLContextValidate.cpp
@@ -64,32 +64,32 @@ WebGLProgram::UpdateInfo()
 }
 
 /*
  * Verify that state is consistent for drawing, and compute max number of elements (maxAllowedCount)
  * that will be legal to be read from bound VBOs.
  */
 
 bool
-WebGLContext::ValidateBuffers(PRInt32 *maxAllowedCount, const char *info)
+WebGLContext::ValidateBuffers(int32_t *maxAllowedCount, const char *info)
 {
 #ifdef DEBUG
     GLint currentProgram = 0;
     MakeContextCurrent();
     gl->fGetIntegerv(LOCAL_GL_CURRENT_PROGRAM, &currentProgram);
     NS_ASSERTION(GLuint(currentProgram) == mCurrentProgram->GLName(),
                  "WebGL: current program doesn't agree with GL state");
     if (GLuint(currentProgram) != mCurrentProgram->GLName())
         return false;
 #endif
 
     *maxAllowedCount = -1;
 
-    PRUint32 attribs = mAttribBuffers.Length();
-    for (PRUint32 i = 0; i < attribs; ++i) {
+    uint32_t attribs = mAttribBuffers.Length();
+    for (uint32_t i = 0; i < attribs; ++i) {
         const WebGLVertexAttribData& vd = mAttribBuffers[i];
 
         // If the attrib array isn't enabled, there's nothing to check;
         // it's a static value.
         if (!vd.enabled)
             continue;
 
         if (vd.buf == nsnull) {
@@ -305,33 +305,33 @@ bool WebGLContext::ValidateDrawModeEnum(
         default:
             ErrorInvalidEnumInfo(info, mode);
             return false;
     }
 }
 
 bool WebGLContext::ValidateGLSLVariableName(const nsAString& name, const char *info)
 {
-    const PRUint32 maxSize = 256;
+    const uint32_t maxSize = 256;
     if (name.Length() > maxSize) {
         ErrorInvalidValue("%s: identifier is %d characters long, exceeds the maximum allowed length of %d characters",
                           info, name.Length(), maxSize);
         return false;
     }
 
     if (!ValidateGLSLString(name, info)) {
         return false;
     }
 
     return true;
 }
 
 bool WebGLContext::ValidateGLSLString(const nsAString& string, const char *info)
 {
-    for (PRUint32 i = 0; i < string.Length(); ++i) {
+    for (uint32_t i = 0; i < string.Length(); ++i) {
         if (!ValidateGLSLCharacter(string.CharAt(i))) {
              ErrorInvalidValue("%s: string contains the illegal character '%d'", info, string.CharAt(i));
              return false;
         }
     }
 
     return true;
 }
@@ -439,17 +439,17 @@ bool WebGLContext::ValidateLevelWidthHei
     if (width > maxTextureSize || height > maxTextureSize) {
         ErrorInvalidValue("%s: width or height exceeds maximum texture size");
         return false;
     }
 
     return true;
 }
 
-PRUint32 WebGLContext::GetBitsPerTexel(WebGLenum format, WebGLenum type)
+uint32_t WebGLContext::GetBitsPerTexel(WebGLenum format, WebGLenum type)
 {
     if (type == LOCAL_GL_UNSIGNED_BYTE || type == LOCAL_GL_FLOAT) {
         int multiplier = type == LOCAL_GL_FLOAT ? 32 : 8;
         switch (format) {
             case LOCAL_GL_ALPHA:
             case LOCAL_GL_LUMINANCE:
                 return 1 * multiplier;
             case LOCAL_GL_LUMINANCE_ALPHA:
@@ -474,17 +474,17 @@ PRUint32 WebGLContext::GetBitsPerTexel(W
         return 16;
     }
 
     NS_ABORT();
     return 0;
 }
 
 bool WebGLContext::ValidateTexFormatAndType(WebGLenum format, WebGLenum type, int jsArrayType,
-                                              PRUint32 *texelSize, const char *info)
+                                              uint32_t *texelSize, const char *info)
 {
     if (type == LOCAL_GL_UNSIGNED_BYTE ||
         (IsExtensionEnabled(WebGL_OES_texture_float) && type == LOCAL_GL_FLOAT))
     {
         if (jsArrayType != -1) {
             if ((type == LOCAL_GL_UNSIGNED_BYTE && jsArrayType != js::ArrayBufferView::TYPE_UINT8) ||
                 (type == LOCAL_GL_FLOAT && jsArrayType != js::ArrayBufferView::TYPE_FLOAT32))
             {
--- a/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
+++ b/dom/interfaces/canvas/nsIDOMWebGLRenderingContext.idl
@@ -607,19 +607,19 @@ interface nsIDOMWebGLRenderingContext : 
 
   [binaryname(MozBlendFunc)]
   void blendFunc(in WebGLenum sfactor, in WebGLenum dfactor);
 
   [binaryname(MozBlendFuncSeparate)]
   void blendFuncSeparate(in WebGLenum srcRGB, in WebGLenum dstRGB, in WebGLenum srcAlpha, in WebGLenum dstAlpha);
 
   // Modified: void glBufferData(WebGLenum target, long size, const void* data, WebGLenum usage);
-  [implicit_jscontext] void bufferData(in long target, in jsval data, in long usage);
+  [implicit_jscontext] void bufferData(in WebGLenum target, in jsval data, in WebGLenum usage);
 
-  [implicit_jscontext] void bufferSubData(in long target, in long offset, in jsval data);
+  [implicit_jscontext] void bufferSubData(in WebGLenum target, in WebGLintptr offset, in jsval data);
 
   WebGLenum checkFramebufferStatus(in WebGLenum target);
 
   [binaryname(MozClear)]
   void clear(in WebGLbitfield mask);
 
   [binaryname(MozClearColor)]
   void clearColor(in WebGLclampf red, in WebGLclampf green, in WebGLclampf blue, in WebGLclampf alpha);