Bug 791906: Replace NSPR integer limit constants with stdint ones; r=ehsan
authorIsaac Aggrey <isaac.aggrey@gmail.com>
Fri, 28 Sep 2012 01:57:33 -0500
changeset 108837 2c694d8bf7a59441faba5d6266862299fa354b03
parent 108836 3642f3259be64aff2dc4118787b6855084b34fbe
child 108838 d31d2479d685f203b45738dd92983b7eebd6f5f6
child 108966 b62b229a4d4191270e44bad30a8695c555eedadb
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersehsan
bugs791906
milestone18.0a1
Bug 791906: Replace NSPR integer limit constants with stdint ones; r=ehsan
accessible/src/base/nsAccessibilityService.cpp
accessible/src/generic/Accessible.h
accessible/src/generic/TextLeafAccessible.h
accessible/src/html/HTMLListAccessible.h
caps/idl/nsIScriptSecurityManager.idl
content/base/src/WebSocket.cpp
content/base/src/nsAttrValue.h
content/base/src/nsContentList.cpp
content/base/src/nsContentList.h
content/base/src/nsDOMFile.cpp
content/base/src/nsDOMFileReader.cpp
content/base/src/nsDocument.cpp
content/base/src/nsFrameMessageManager.cpp
content/base/src/nsNodeInfo.cpp
content/base/src/nsNodeInfo.h
content/base/src/nsSyncLoadService.cpp
content/base/src/nsXMLHttpRequest.cpp
content/events/src/nsContentEventHandler.cpp
content/events/src/nsEventStateManager.cpp
content/events/src/nsEventStateManager.h
content/html/content/src/nsHTMLCanvasElement.cpp
content/media/AudioSegment.cpp
content/media/FileBlockCache.cpp
content/media/MediaResource.cpp
content/media/MediaSegment.h
content/media/TimeVarying.h
content/media/VideoUtils.cpp
content/media/nsAudioStream.cpp
content/media/nsBuiltinDecoderReader.cpp
content/media/nsBuiltinDecoderStateMachine.cpp
content/media/nsMediaCache.cpp
content/media/ogg/nsOggCodecState.cpp
content/media/ogg/nsOggReader.cpp
content/media/wave/nsWaveReader.cpp
content/smil/nsSMILInstanceTime.cpp
content/svg/content/src/nsSVGFilters.cpp
content/svg/content/src/nsSVGFilters.h
content/xslt/src/xslt/txNodeSorter.cpp
content/xul/document/src/nsXULPrototypeCache.cpp
content/xul/document/src/nsXULPrototypeDocument.cpp
content/xul/templates/src/nsTemplateRule.h
content/xul/templates/src/nsXULTemplateBuilder.cpp
docshell/base/nsDocShell.cpp
dom/base/nsDOMClassInfo.cpp
dom/base/nsGlobalWindow.cpp
dom/base/nsJSEnvironment.cpp
dom/camera/GonkCameraControl.cpp
dom/devicestorage/nsDeviceStorage.cpp
dom/file/ArchiveZipFile.cpp
dom/file/MemoryStreams.cpp
dom/indexedDB/FileInfo.cpp
dom/indexedDB/FileStream.cpp
dom/indexedDB/IDBCursor.cpp
dom/indexedDB/IDBIndex.cpp
dom/indexedDB/IDBObjectStore.cpp
dom/plugins/base/nsNPAPIPlugin.cpp
dom/plugins/ipc/BrowserStreamParent.cpp
dom/plugins/ipc/PluginModuleChild.cpp
dom/plugins/ipc/PluginModuleParent.cpp
dom/src/json/nsJSON.cpp
dom/telephony/TelephonyCommon.h
dom/workers/ScriptLoader.cpp
dom/workers/WorkerPrivate.cpp
dom/workers/XMLHttpRequest.cpp
editor/libeditor/html/nsHTMLDataTransfer.cpp
embedding/browser/webBrowser/nsEmbedStream.cpp
embedding/components/windowwatcher/src/nsWindowWatcher.cpp
extensions/gio/nsGIOProtocolHandler.cpp
extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
extensions/pref/autoconfig/src/nsReadConfig.cpp
extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
gfx/gl/GLContextProviderEGL.cpp
gfx/layers/Layers.h
gfx/layers/basic/BasicLayerManager.cpp
gfx/layers/basic/BasicLayers.h
gfx/layers/opengl/LayerManagerOGL.cpp
gfx/src/nsCoord.h
gfx/src/nsRegion.cpp
gfx/tests/TestColorNames.cpp
gfx/thebes/gfxASurface.cpp
gfx/thebes/gfxDWriteShaper.cpp
gfx/thebes/gfxFont.cpp
gfx/thebes/gfxFont.h
gfx/thebes/gfxFontUtils.cpp
image/decoders/nsPNGDecoder.cpp
image/src/imgTools.cpp
intl/lwbrk/src/nsJISx4501LineBreaker.cpp
ipc/glue/Shmem.cpp
ipc/glue/SyncChannel.cpp
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/src/XPCConvert.cpp
js/xpconnect/src/XPCWrappedNative.cpp
layout/base/FrameLayerBuilder.cpp
layout/base/FrameLayerBuilder.h
layout/base/nsCounterManager.h
layout/base/nsDisplayList.h
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/base/nsPresShell.cpp
layout/base/nsQuoteList.h
layout/generic/nsBlockFrame.cpp
layout/generic/nsColumnSetFrame.cpp
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsIFrame.h
layout/generic/nsLineBox.h
layout/generic/nsLineLayout.cpp
layout/generic/nsLineLayout.h
layout/generic/nsObjectFrame.cpp
layout/generic/nsTextFrame.h
layout/generic/nsTextFrameThebes.cpp
layout/style/Declaration.cpp
layout/style/StyleRule.cpp
layout/style/StyleRule.h
layout/style/nsAnimationManager.cpp
layout/style/nsCSSDataBlock.h
layout/style/nsCSSRules.cpp
layout/style/nsCSSScanner.cpp
layout/style/nsCSSStyleSheet.cpp
layout/style/nsFontFaceLoader.cpp
layout/style/nsStyleContext.cpp
layout/style/nsStyleContext.h
layout/style/nsStyleStruct.cpp
layout/svg/nsSVGUtils.h
layout/xul/base/src/nsMenuPopupFrame.cpp
layout/xul/base/src/nsXULPopupManager.cpp
modules/libjar/nsJAR.cpp
modules/libjar/nsJARChannel.cpp
modules/libjar/nsZipArchive.cpp
modules/libpref/src/Preferences.cpp
netwerk/base/public/nsASocketHandler.h
netwerk/base/public/nsICryptoHMAC.idl
netwerk/base/public/nsICryptoHash.idl
netwerk/base/public/nsIProtocolProxyService.idl
netwerk/base/public/nsISocketTransport.idl
netwerk/base/public/nsNetUtil.h
netwerk/base/src/nsBaseChannel.cpp
netwerk/base/src/nsInputStreamPump.cpp
netwerk/base/src/nsProtocolProxyService.cpp
netwerk/base/src/nsProxyInfo.h
netwerk/base/src/nsSocketTransport2.cpp
netwerk/base/src/nsSocketTransportService2.cpp
netwerk/base/src/nsStandardURL.cpp
netwerk/base/src/nsStreamLoader.cpp
netwerk/base/src/nsSyncStreamListener.cpp
netwerk/cache/nsCacheEntryDescriptor.cpp
netwerk/cookie/nsCookieService.cpp
netwerk/protocol/about/nsAboutCacheEntry.cpp
netwerk/protocol/data/nsDataChannel.cpp
netwerk/protocol/device/GonkCaptureProvider.cpp
netwerk/protocol/file/nsFileChannel.cpp
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpConnectionMgr.cpp
netwerk/protocol/http/nsHttpHeaderArray.h
netwerk/protocol/http/nsHttpPipeline.cpp
netwerk/protocol/http/nsHttpTransaction.cpp
netwerk/protocol/websocket/WebSocketChannel.cpp
netwerk/streamconv/converters/nsFTPDirListingConv.cpp
netwerk/streamconv/test/Converters.cpp
netwerk/streamconv/test/TestStreamConv.cpp
parser/html/nsHtml5Highlighter.cpp
parser/html/nsHtml5MetaScanner.cpp
parser/html/nsHtml5Parser.cpp
parser/html/nsHtml5StringParser.cpp
parser/html/nsHtml5Tokenizer.cpp
parser/html/nsHtml5TreeBuilder.h
parser/html/nsHtml5TreeBuilderCppSupplement.h
parser/htmlparser/src/nsScannerString.cpp
parser/xml/src/nsSAXXMLReader.cpp
rdf/base/src/nsInMemoryDataSource.cpp
rdf/base/src/nsRDFXMLDataSource.cpp
security/manager/ssl/src/nsNSSComponent.cpp
startupcache/StartupCacheUtils.cpp
storage/src/Variant.h
toolkit/components/places/Helpers.cpp
toolkit/components/places/History.cpp
toolkit/components/places/nsFaviconService.cpp
toolkit/components/places/nsNavBookmarks.cpp
toolkit/components/places/nsNavHistoryResult.cpp
toolkit/components/places/nsNavHistoryResult.h
toolkit/components/places/nsPlacesExportService.cpp
toolkit/components/url-classifier/HashStore.cpp
uriloader/exthandler/ExternalHelperAppParent.cpp
view/src/nsViewManager.cpp
widget/android/nsWindow.cpp
widget/cocoa/nsChildView.mm
widget/cocoa/nsIdleServiceX.mm
widget/cocoa/nsNativeThemeCocoa.mm
widget/cocoa/nsPrintDialogX.mm
widget/gtk2/nsGtkIMModule.cpp
widget/gtk2/nsGtkKeyUtils.cpp
widget/gtk2/nsWindow.cpp
widget/nsGUIEvent.h
widget/nsIRollupListener.h
widget/os2/nsWindow.cpp
widget/os2/os2FrameWindow.cpp
widget/qt/nsWindow.cpp
widget/windows/WinUtils.cpp
widget/windows/nsIMM32Handler.cpp
widget/windows/nsTextStore.cpp
widget/windows/nsWindow.cpp
widget/xpwidgets/PuppetWidget.cpp
widget/xpwidgets/nsIdleService.cpp
widget/xpwidgets/nsNativeTheme.cpp
xpcom/base/nsCycleCollector.cpp
xpcom/build/FileLocation.cpp
xpcom/build/nsXPCOMStrings.cpp
xpcom/ds/nsArray.cpp
xpcom/ds/nsAtomTable.cpp
xpcom/glue/FileUtils.cpp
xpcom/glue/nsStringAPI.cpp
xpcom/glue/nsStringAPI.h
xpcom/glue/nsVersionComparator.cpp
xpcom/io/Base64.cpp
xpcom/io/nsEscape.cpp
xpcom/io/nsIPipe.idl
xpcom/io/nsIStorageStream.idl
xpcom/io/nsPipe3.cpp
xpcom/io/nsScriptableInputStream.cpp
xpcom/io/nsStreamUtils.cpp
xpcom/io/nsStreamUtils.h
xpcom/string/public/nsReadableUtils.h
xpcom/string/src/nsReadableUtils.cpp
xpcom/tests/TestPipes.cpp
xpcom/tests/TestStorageStream.cpp
xpcom/tests/TestStreamUtils.cpp
xpcom/tests/TestStrings.cpp
xpcom/tests/TestTArray.cpp
xpcom/tests/external/TestMinStringAPI.cpp
xpcom/threads/LazyIdleThread.cpp
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -950,17 +950,17 @@ nsAccessibilityService::GetOrCreateAcces
   }
 
   // Attempt to create an accessible based on what we know.
   nsRefPtr<Accessible> newAcc;
 
   // Create accessible for visible text frames.
   if (content->IsNodeOfType(nsINode::eTEXT)) {
     nsAutoString text;
-    weakFrame->GetRenderedText(&text, nullptr, nullptr, 0, PR_UINT32_MAX);
+    weakFrame->GetRenderedText(&text, nullptr, nullptr, 0, UINT32_MAX);
     if (text.IsEmpty()) {
       if (aIsSubtreeHidden)
         *aIsSubtreeHidden = true;
 
       return nullptr;
     }
 
     newAcc = weakFrame->CreateAccessible();
--- a/accessible/src/generic/Accessible.h
+++ b/accessible/src/generic/Accessible.h
@@ -447,17 +447,17 @@ public:
    *
    * @param aText         [in] returned text of the accessible
    * @param aStartOffset  [in, optional] start offset inside of the accessible,
    *                        if missed entire text is appended
    * @param aLength       [in, optional] required length of text, if missed
    *                        then text form start offset till the end is appended
    */
   virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
-                            uint32_t aLength = PR_UINT32_MAX);
+                            uint32_t aLength = UINT32_MAX);
 
   /**
    * Assert if child not in parent's cache if the cache was initialized at this
    * point.
    */
   void TestChildCache(Accessible* aCachedChild) const;
 
   /**
--- a/accessible/src/generic/TextLeafAccessible.h
+++ b/accessible/src/generic/TextLeafAccessible.h
@@ -18,17 +18,17 @@ class TextLeafAccessible : public Linkab
 {
 public:
   TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc);
   virtual ~TextLeafAccessible();
 
   // Accessible
   virtual mozilla::a11y::role NativeRole();
   virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
-                            uint32_t aLength = PR_UINT32_MAX);
+                            uint32_t aLength = UINT32_MAX);
   virtual ENameValueFlag Name(nsString& aName);
 
   // TextLeafAccessible
   void SetText(const nsAString& aText) { mText = aText; }
   const nsString& Text() const { return mText; }
 
 protected:
   // Accessible
--- a/accessible/src/html/HTMLListAccessible.h
+++ b/accessible/src/html/HTMLListAccessible.h
@@ -81,17 +81,17 @@ public:
   // nsAccessNode
   virtual nsIFrame* GetFrame() const;
 
   // Accessible
   virtual ENameValueFlag Name(nsString& aName);
   virtual a11y::role NativeRole();
   virtual uint64_t NativeState();
   virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
-                            uint32_t aLength = PR_UINT32_MAX);
+                            uint32_t aLength = UINT32_MAX);
 
   // HTMLListBulletAccessible
 
   /**
    * Return true if the bullet is inside of list item element boundaries.
    */
   bool IsInside() const;
 };
--- a/caps/idl/nsIScriptSecurityManager.idl
+++ b/caps/idl/nsIScriptSecurityManager.idl
@@ -266,17 +266,17 @@ interface nsIScriptSecurityManager : nsI
      * principal.
      */
     [noscript,notxpcom] nsIPrincipal getCxSubjectPrincipal(in JSContextPtr cx);
     [noscript,notxpcom] nsIPrincipal getCxSubjectPrincipalAndFrame(in JSContextPtr cx,
                                                                    out JSStackFramePtr fp);
 
 
     const unsigned long NO_APP_ID = 0;
-    const unsigned long UNKNOWN_APP_ID = 4294967295; // PR_UINT32_MAX
+    const unsigned long UNKNOWN_APP_ID = 4294967295; // UINT32_MAX
 
     /**
      * Returns the extended origin for the uri.
      * appId can be NO_APP_ID or a valid app id. appId should not be
      * UNKNOWN_APP_ID.
      * inMozBrowser has to be true if the uri is inside a mozbrowser iframe.
      */
     AUTF8String getExtendedOrigin(in nsIURI uri, in unsigned long appId,
--- a/content/base/src/WebSocket.cpp
+++ b/content/base/src/WebSocket.cpp
@@ -1259,17 +1259,17 @@ WebSocket::Send(nsIDOMBlob* aData,
 
   uint64_t msgLength;
   rv = aData->GetSize(&msgLength);
   if (NS_FAILED(rv)) {
     aRv.Throw(rv);
     return;
   }
 
-  if (msgLength > PR_UINT32_MAX) {
+  if (msgLength > UINT32_MAX) {
     aRv.Throw(NS_ERROR_FILE_TOO_BIG);
     return;
   }
 
   Send(msgStream, EmptyCString(), msgLength, true, aRv);
 }
 
 void
--- a/content/base/src/nsAttrValue.h
+++ b/content/base/src/nsAttrValue.h
@@ -274,29 +274,29 @@ public:
 
   /**
    * Parse a string value into an integer.
    *
    * @param aString the string to parse
    * @return whether the value could be parsed
    */
   bool ParseIntValue(const nsAString& aString) {
-    return ParseIntWithBounds(aString, PR_INT32_MIN, PR_INT32_MAX);
+    return ParseIntWithBounds(aString, INT32_MIN, INT32_MAX);
   }
 
   /**
    * Parse a string value into an integer with minimum value and maximum value.
    *
    * @param aString the string to parse
    * @param aMin the minimum value (if value is less it will be bumped up)
    * @param aMax the maximum value (if value is greater it will be chopped down)
    * @return whether the value could be parsed
    */
   bool ParseIntWithBounds(const nsAString& aString, int32_t aMin,
-                            int32_t aMax = PR_INT32_MAX);
+                            int32_t aMax = INT32_MAX);
 
   /**
    * Parse a string value into a non-negative integer.
    * This method follows the rules for parsing non-negative integer from:
    * http://dev.w3.org/html5/spec/infrastructure.html#rules-for-parsing-non-negative-integers
    *
    * @param  aString the string to parse
    * @return whether the value is valid
--- a/content/base/src/nsContentList.cpp
+++ b/content/base/src/nsContentList.cpp
@@ -572,17 +572,17 @@ nsContentList::Item(uint32_t aIndex, boo
     nsIDocument* doc = mRootNode->GetCurrentDoc();
     if (doc) {
       // Flush pending content changes Bug 4891.
       doc->FlushPendingNotifications(Flush_ContentAndNotify);
     }
   }
 
   if (mState != LIST_UP_TO_DATE)
-    PopulateSelf(NS_MIN(aIndex, PR_UINT32_MAX - 1) + 1);
+    PopulateSelf(NS_MIN(aIndex, UINT32_MAX - 1) + 1);
 
   ASSERT_IN_SYNC;
   NS_ASSERTION(!mRootNode || mState != LIST_DIRTY,
                "PopulateSelf left the list in a dirty (useless) state!");
 
   return mElements.SafeElementAt(aIndex);
 }
 
--- a/content/base/src/nsContentList.h
+++ b/content/base/src/nsContentList.h
@@ -23,17 +23,17 @@
 #include "nsINameSpaceManager.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsWrapperCache.h"
 #include "nsHashKeys.h"
 #include "mozilla/HashFunctions.h"
 
 // Magic namespace id that means "match all namespaces".  This is
 // negative so it won't collide with actual namespace constants.
-#define kNameSpaceID_Wildcard PR_INT32_MIN
+#define kNameSpaceID_Wildcard INT32_MIN
 
 // This is a callback function type that can be used to implement an
 // arbitrary matching algorithm.  aContent is the content that may
 // match the list, while aNamespaceID, aAtom, and aData are whatever
 // was passed to the list's constructor.
 typedef bool (*nsContentListMatchFunc)(nsIContent* aContent,
                                          int32_t aNamespaceID,
                                          nsIAtom* aAtom,
--- a/content/base/src/nsDOMFile.cpp
+++ b/content/base/src/nsDOMFile.cpp
@@ -648,17 +648,17 @@ nsDOMMemoryFile::CreateSlice(uint64_t aS
   nsCOMPtr<nsIDOMBlob> t =
     new nsDOMMemoryFile(this, aStart, aLength, aContentType);
   return t.forget();
 }
 
 NS_IMETHODIMP
 nsDOMMemoryFile::GetInternalStream(nsIInputStream **aStream)
 {
-  if (mLength > PR_INT32_MAX)
+  if (mLength > INT32_MAX)
     return NS_ERROR_FAILURE;
 
   return DataOwnerAdapter::Create(mDataOwner, mStart, mLength, aStream);
 }
 
 ////////////////////////////////////////////////////////////////////////////
 // nsDOMFileList implementation
 
--- a/content/base/src/nsDOMFileReader.cpp
+++ b/content/base/src/nsDOMFileReader.cpp
@@ -289,17 +289,17 @@ nsDOMFileReader::DoOnDataAvailable(nsIRe
                                    uint64_t aOffset,
                                    uint32_t aCount)
 {
   if (mDataFormat == FILE_AS_BINARY) {
     //Continuously update our binary string as data comes in
     NS_ASSERTION(mResult.Length() == aOffset,
                  "unexpected mResult length");
     uint32_t oldLen = mResult.Length();
-    if (uint64_t(oldLen) + aCount > PR_UINT32_MAX)
+    if (uint64_t(oldLen) + aCount > UINT32_MAX)
       return NS_ERROR_OUT_OF_MEMORY;
 
     PRUnichar *buf = nullptr;
     mResult.GetMutableData(&buf, oldLen + aCount, fallible_t());
     NS_ENSURE_TRUE(buf, NS_ERROR_OUT_OF_MEMORY);
 
     uint32_t bytesRead = 0;
     aInputStream->ReadSegments(ReadFuncBinaryString, buf + oldLen, aCount,
@@ -309,17 +309,17 @@ nsDOMFileReader::DoOnDataAvailable(nsIRe
   else if (mDataFormat == FILE_AS_ARRAYBUFFER) {
     uint32_t bytesRead = 0;
     aInputStream->Read((char*)JS_GetArrayBufferData(mResultArrayBuffer, NULL) + aOffset,
                        aCount, &bytesRead);
     NS_ASSERTION(bytesRead == aCount, "failed to read data");
   }
   else {
     //Update memory buffer to reflect the contents of the file
-    if (aOffset + aCount > PR_UINT32_MAX) {
+    if (aOffset + aCount > UINT32_MAX) {
       // PR_Realloc doesn't support over 4GB memory size even if 64-bit OS
       return NS_ERROR_OUT_OF_MEMORY;
     }
     mFileData = (char *)PR_Realloc(mFileData, aOffset + aCount);
     NS_ENSURE_TRUE(mFileData, NS_ERROR_OUT_OF_MEMORY);
 
     uint32_t bytesRead = 0;
     aInputStream->Read(mFileData + aOffset, aCount, &bytesRead);
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -8233,17 +8233,17 @@ nsIDocument::CreateStaticClone(nsISuppor
   mCreatingStaticClone = false;
   return clonedDoc.forget();
 }
 
 nsresult
 nsIDocument::ScheduleFrameRequestCallback(nsIFrameRequestCallback* aCallback,
                                           int32_t *aHandle)
 {
-  if (mFrameRequestCallbackCounter == PR_INT32_MAX) {
+  if (mFrameRequestCallbackCounter == INT32_MAX) {
     // Can't increment without overflowing; bail out
     return NS_ERROR_NOT_AVAILABLE;
   }
   int32_t newHandle = ++mFrameRequestCallbackCounter;
 
   bool alreadyRegistered = !mFrameRequestCallbacks.IsEmpty();
   DebugOnly<FrameRequest*> request =
     mFrameRequestCallbacks.AppendElement(FrameRequest(aCallback, newHandle));
--- a/content/base/src/nsFrameMessageManager.cpp
+++ b/content/base/src/nsFrameMessageManager.cpp
@@ -896,21 +896,21 @@ nsFrameScriptExecutor::TryCacheLoadAndCo
     return;
   }
 
   nsCOMPtr<nsIInputStream> input;
   channel->Open(getter_AddRefs(input));
   nsString dataString;
   uint64_t avail64 = 0;
   if (input && NS_SUCCEEDED(input->Available(&avail64)) && avail64) {
-    if (avail64 > PR_UINT32_MAX) {
+    if (avail64 > UINT32_MAX) {
       return;
     }
     nsCString buffer;
-    uint32_t avail = (uint32_t)NS_MIN(avail64, (uint64_t)PR_UINT32_MAX);
+    uint32_t avail = (uint32_t)NS_MIN(avail64, (uint64_t)UINT32_MAX);
     if (NS_FAILED(NS_ReadInputStreamToString(input, buffer, avail))) {
       return;
     }
     nsScriptLoader::ConvertToUTF16(channel, (uint8_t*)buffer.get(), avail,
                                    EmptyString(), nullptr, dataString);
   }
 
   if (!dataString.IsEmpty()) {
--- a/content/base/src/nsNodeInfo.cpp
+++ b/content/base/src/nsNodeInfo.cpp
@@ -129,17 +129,17 @@ nsNodeInfo::nsNodeInfo(nsIAtom *aName, n
       SetDOMStringToNull(mLocalName);
       break;
     case nsIDOMNode::PROCESSING_INSTRUCTION_NODE:
     case nsIDOMNode::DOCUMENT_TYPE_NODE:
       mInner.mExtraName->ToString(mNodeName);
       SetDOMStringToNull(mLocalName);
       break;
     default:
-      NS_ABORT_IF_FALSE(aNodeType == PR_UINT16_MAX,
+      NS_ABORT_IF_FALSE(aNodeType == UINT16_MAX,
                         "Unknown node type");
   }
 }
 
 
 // nsISupports
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsNodeInfo)
--- a/content/base/src/nsNodeInfo.h
+++ b/content/base/src/nsNodeInfo.h
@@ -76,25 +76,25 @@ CheckValidNodeInfo(uint16_t aNodeType, n
                     aNodeType == nsIDOMNode::ATTRIBUTE_NODE ||
                     aNodeType == nsIDOMNode::TEXT_NODE ||
                     aNodeType == nsIDOMNode::CDATA_SECTION_NODE ||
                     aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE ||
                     aNodeType == nsIDOMNode::COMMENT_NODE ||
                     aNodeType == nsIDOMNode::DOCUMENT_NODE ||
                     aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE ||
                     aNodeType == nsIDOMNode::DOCUMENT_FRAGMENT_NODE ||
-                    aNodeType == PR_UINT16_MAX,
+                    aNodeType == UINT16_MAX,
                     "Invalid nodeType");
   NS_ABORT_IF_FALSE((aNodeType == nsIDOMNode::PROCESSING_INSTRUCTION_NODE ||
                      aNodeType == nsIDOMNode::DOCUMENT_TYPE_NODE) ==
                     !!aExtraName,
                     "Supply aExtraName for and only for PIs and doctypes");
   NS_ABORT_IF_FALSE(aNodeType == nsIDOMNode::ELEMENT_NODE ||
                     aNodeType == nsIDOMNode::ATTRIBUTE_NODE ||
-                    aNodeType == PR_UINT16_MAX ||
+                    aNodeType == UINT16_MAX ||
                     aNamespaceID == kNameSpaceID_None,
                     "Only attributes and elements can be in a namespace");
   NS_ABORT_IF_FALSE(aName && aName != nsGkAtoms::_empty, "Invalid localName");
   NS_ABORT_IF_FALSE(((aNodeType == nsIDOMNode::TEXT_NODE) ==
                      (aName == nsGkAtoms::textTagName)) &&
                     ((aNodeType == nsIDOMNode::CDATA_SECTION_NODE) ==
                      (aName == nsGkAtoms::cdataTagName)) &&
                     ((aNodeType == nsIDOMNode::COMMENT_NODE) ==
--- a/content/base/src/nsSyncLoadService.cpp
+++ b/content/base/src/nsSyncLoadService.cpp
@@ -337,17 +337,17 @@ nsSyncLoadService::PushSyncStreamToListe
     nsresult rv;
     nsCOMPtr<nsIInputStream> bufferedStream;
     if (!NS_InputStreamIsBuffered(aIn)) {
         int32_t chunkSize;
         rv = aChannel->GetContentLength(&chunkSize);
         if (NS_FAILED(rv)) {
             chunkSize = 4096;
         }
-        chunkSize = NS_MIN(int32_t(PR_UINT16_MAX), chunkSize);
+        chunkSize = NS_MIN(int32_t(UINT16_MAX), chunkSize);
 
         rv = NS_NewBufferedInputStream(getter_AddRefs(bufferedStream), aIn,
                                        chunkSize);
         NS_ENSURE_SUCCESS(rv, rv);
 
         aIn = bufferedStream;
     }
 
@@ -361,21 +361,21 @@ nsSyncLoadService::PushSyncStreamToListe
             if (NS_FAILED(rv) || !readCount) {
                 if (rv == NS_BASE_STREAM_CLOSED) {
                     // End of file, but not an error
                     rv = NS_OK;
                 }
                 break;
             }
 
-            if (readCount > PR_UINT32_MAX)
-                readCount = PR_UINT32_MAX;
+            if (readCount > UINT32_MAX)
+                readCount = UINT32_MAX;
 
             rv = aListener->OnDataAvailable(aChannel, nullptr, aIn,
-                                            (uint32_t)NS_MIN(sourceOffset, (uint64_t)PR_UINT32_MAX),
+                                            (uint32_t)NS_MIN(sourceOffset, (uint64_t)UINT32_MAX),
                                             (uint32_t)readCount);
             if (NS_FAILED(rv)) {
                 break;
             }
             sourceOffset += readCount;
         }
     }
     if (NS_FAILED(rv)) {
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -2438,17 +2438,17 @@ GetRequestBody(nsIDOMDocument* aDoc, nsI
   // Serialize to a stream so that the encoding used will
   // match the document's.
   nsresult rv;
   nsCOMPtr<nsIDOMSerializer> serializer =
     do_CreateInstance(NS_XMLSERIALIZER_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIStorageStream> storStream;
-  rv = NS_NewStorageStream(4096, PR_UINT32_MAX, getter_AddRefs(storStream));
+  rv = NS_NewStorageStream(4096, UINT32_MAX, getter_AddRefs(storStream));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIOutputStream> output;
   rv = storStream->GetOutputStream(0, getter_AddRefs(output));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Make sure to use the encoding we'll send
   rv = serializer->SerializeToStream(aDoc, output, aCharset);
--- a/content/events/src/nsContentEventHandler.cpp
+++ b/content/events/src/nsContentEventHandler.cpp
@@ -176,17 +176,17 @@ static uint32_t CountNewlinesInXPLength(
 {
   NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT),
                "aContent is not a text node!");
   const nsTextFragment* text = aContent->GetText();
   if (!text)
     return 0;
   // For automated tests, we should abort on debug build.
   NS_ABORT_IF_FALSE(
-    (aXPLength == PR_UINT32_MAX || aXPLength <= text->GetLength()),
+    (aXPLength == UINT32_MAX || aXPLength <= text->GetLength()),
     "aXPLength is out-of-bounds");
   const uint32_t length = NS_MIN(aXPLength, text->GetLength());
   uint32_t newlines = 0;
   for (uint32_t i = 0; i < length; ++i) {
     if (text->CharAt(i) == '\n') {
       ++newlines;
     }
   }
@@ -199,17 +199,17 @@ static uint32_t CountNewlinesInNativeLen
   NS_ASSERTION(aContent->IsNodeOfType(nsINode::eTEXT),
                "aContent is not a text node!");
   const nsTextFragment* text = aContent->GetText();
   if (!text) {
     return 0;
   }
   // For automated tests, we should abort on debug build.
   NS_ABORT_IF_FALSE(
-    (aNativeLength == PR_UINT32_MAX || aNativeLength <= text->GetLength() * 2),
+    (aNativeLength == UINT32_MAX || aNativeLength <= text->GetLength() * 2),
     "aNativeLength is unexpected value");
   const uint32_t xpLength = text->GetLength();
   uint32_t newlines = 0;
   for (uint32_t i = 0, nativeOffset = 0;
        i < xpLength && nativeOffset < aNativeLength;
        ++i, ++nativeOffset) {
     // For automated tests, we should abort on debug build.
     NS_ABORT_IF_FALSE(i < text->GetLength(), "i is out-of-bounds");
@@ -217,17 +217,17 @@ static uint32_t CountNewlinesInNativeLen
       ++newlines;
       ++nativeOffset;
     }
   }
   return newlines;
 }
 #endif
 
-static uint32_t GetNativeTextLength(nsIContent* aContent, uint32_t aMaxLength = PR_UINT32_MAX)
+static uint32_t GetNativeTextLength(nsIContent* aContent, uint32_t aMaxLength = UINT32_MAX)
 {
   if (aContent->IsNodeOfType(nsINode::eTEXT)) {
     uint32_t textLengthDifference =
 #if defined(XP_MACOSX)
       // On Mac, the length of a native newline ("\r") is equal to the length of
       // the XP newline ("\n"), so the native length is the same as the XP length.
       0;
 #elif defined(XP_WIN)
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -5247,17 +5247,17 @@ nsEventStateManager::DeltaAccumulator::I
   mLastTime = TimeStamp::Now();
 }
 
 void
 nsEventStateManager::DeltaAccumulator::Reset()
 {
   mX = mY = 0.0;
   mPendingScrollAmountX = mPendingScrollAmountY = 0.0;
-  mHandlingDeltaMode = PR_UINT32_MAX;
+  mHandlingDeltaMode = UINT32_MAX;
   mHandlingPixelOnlyDevice = false;
 }
 
 nsIntPoint
 nsEventStateManager::DeltaAccumulator::ComputeScrollAmountForDefaultAction(
                        widget::WheelEvent* aEvent,
                        const nsIntSize& aScrollAmountInDevPixels)
 {
--- a/content/events/src/nsEventStateManager.h
+++ b/content/events/src/nsEventStateManager.h
@@ -553,17 +553,17 @@ protected:
     }
 
     static void Shutdown()
     {
       delete sInstance;
       sInstance = nullptr;
     }
 
-    bool IsInTransaction() { return mHandlingDeltaMode != PR_UINT32_MAX; }
+    bool IsInTransaction() { return mHandlingDeltaMode != UINT32_MAX; }
 
     /**
      * InitLineOrPageDelta() stores pixel delta values of WheelEvents which are
      * caused if it's needed.  And if the accumulated delta becomes a
      * line height, sets lineOrPageDeltaX and lineOrPageDeltaY automatically.
      */
     void InitLineOrPageDelta(nsIFrame* aTargetFrame,
                              nsEventStateManager* aESM,
@@ -580,17 +580,17 @@ protected:
      */
     nsIntPoint ComputeScrollAmountForDefaultAction(
                  mozilla::widget::WheelEvent* aEvent,
                  const nsIntSize& aScrollAmountInDevPixels);
 
   private:
     DeltaAccumulator() :
       mX(0.0), mY(0.0), mPendingScrollAmountX(0.0), mPendingScrollAmountY(0.0),
-      mHandlingDeltaMode(PR_UINT32_MAX), mHandlingPixelOnlyDevice(false)
+      mHandlingDeltaMode(UINT32_MAX), mHandlingPixelOnlyDevice(false)
     {
     }
 
     double mX;
     double mY;
 
     // When default action of a wheel event is scroll but some delta values
     // are ignored because the computed amount values are not integer, the
--- a/content/html/content/src/nsHTMLCanvasElement.cpp
+++ b/content/html/content/src/nsHTMLCanvasElement.cpp
@@ -540,17 +540,17 @@ nsHTMLCanvasElement::ToDataURLImpl(const
     aDataURL = NS_LITERAL_STRING("data:image/png;base64,");
   else
     aDataURL = NS_LITERAL_STRING("data:") + type +
       NS_LITERAL_STRING(";base64,");
 
   uint64_t count;
   rv = stream->Available(&count);
   NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_TRUE(count <= PR_UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
+  NS_ENSURE_TRUE(count <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
 
   return Base64EncodeInputStream(stream, aDataURL, (uint32_t)count, aDataURL.Length());
 }
 
 NS_IMETHODIMP
 nsHTMLCanvasElement::MozGetAsFile(const nsAString& aName,
                                   const nsAString& aType,
                                   uint8_t optional_argc,
@@ -580,17 +580,17 @@ nsHTMLCanvasElement::MozGetAsFileImpl(co
   nsAutoString type(aType);
   if (fallbackToPNG) {
     type.AssignLiteral("image/png");
   }
 
   uint64_t imgSize;
   rv = stream->Available(&imgSize);
   NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_TRUE(imgSize <= PR_UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
+  NS_ENSURE_TRUE(imgSize <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
 
   void* imgData = nullptr;
   rv = NS_ReadInputStreamToBuffer(stream, &imgData, (uint32_t)imgSize);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // The DOMFile takes ownership of the buffer
   nsRefPtr<nsDOMMemoryFile> file =
     new nsDOMMemoryFile(imgData, (uint32_t)imgSize, aName, type);
--- a/content/media/AudioSegment.cpp
+++ b/content/media/AudioSegment.cpp
@@ -156,17 +156,17 @@ static const int STATIC_AUDIO_BUFFER_BYT
 void
 AudioSegment::WriteTo(nsAudioStream* aOutput)
 {
   NS_ASSERTION(mChannels == aOutput->GetChannels(), "Wrong number of channels");
   nsAutoTArray<uint8_t,STATIC_AUDIO_BUFFER_BYTES> buf;
   uint32_t frameSize = GetSampleSize(aOutput->GetFormat())*mChannels;
   for (ChunkIterator ci(*this); !ci.IsEnded(); ci.Next()) {
     AudioChunk& c = *ci;
-    if (frameSize*c.mDuration > PR_UINT32_MAX) {
+    if (frameSize*c.mDuration > UINT32_MAX) {
       NS_ERROR("Buffer overflow");
       return;
     }
     buf.SetLength(int32_t(frameSize*c.mDuration));
     if (c.mBuffer) {
       InterleaveAndConvertBuffer(c.mBuffer->Data(), c.mBufferFormat, c.mBufferLength,
                                  c.mOffset, int32_t(c.mDuration),
                                  c.mVolume,
--- a/content/media/FileBlockCache.cpp
+++ b/content/media/FileBlockCache.cpp
@@ -233,17 +233,17 @@ nsresult FileBlockCache::Run()
 
 nsresult FileBlockCache::Read(int64_t aOffset,
                               uint8_t* aData,
                               int32_t aLength,
                               int32_t* aBytes)
 {
   MonitorAutoLock mon(mDataMonitor);
 
-  if (!mFD || (aOffset / BLOCK_SIZE) > PR_INT32_MAX)
+  if (!mFD || (aOffset / BLOCK_SIZE) > INT32_MAX)
     return NS_ERROR_FAILURE;
 
   int32_t bytesToRead = aLength;
   int64_t offset = aOffset;
   uint8_t* dst = aData;
   while (bytesToRead > 0) {
     int32_t blockIndex = static_cast<int32_t>(offset / BLOCK_SIZE);
     int32_t start = offset % BLOCK_SIZE;
--- a/content/media/MediaResource.cpp
+++ b/content/media/MediaResource.cpp
@@ -1064,17 +1064,17 @@ void FileMediaResource::EnsureSizeInitia
   NS_ASSERTION(mInput, "Must have file input stream");
   if (mSizeInitialized) {
     return;
   }
   mSizeInitialized = true;
   // Get the file size and inform the decoder.
   uint64_t size;
   nsresult res = mInput->Available(&size);
-  if (NS_SUCCEEDED(res) && size <= PR_INT64_MAX) {
+  if (NS_SUCCEEDED(res) && size <= INT64_MAX) {
     mSize = (int64_t)size;
     nsCOMPtr<nsIRunnable> event = new LoadedEvent(mDecoder);
     NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
   }
 }
 
 nsresult FileMediaResource::GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
 {
--- a/content/media/MediaSegment.h
+++ b/content/media/MediaSegment.h
@@ -11,17 +11,17 @@
 namespace mozilla {
 
 /**
  * We represent media times in 64-bit fixed point. So 1 MediaTime is
  * 1/(2^MEDIA_TIME_FRAC_BITS) seconds.
  */
 typedef int64_t MediaTime;
 const int64_t MEDIA_TIME_FRAC_BITS = 20;
-const int64_t MEDIA_TIME_MAX = PR_INT64_MAX;
+const int64_t MEDIA_TIME_MAX = INT64_MAX;
 
 inline MediaTime MillisecondsToMediaTime(int32_t aMS)
 {
   return (MediaTime(aMS) << MEDIA_TIME_FRAC_BITS)/1000;
 }
 
 inline MediaTime SecondsToMediaTime(double aS)
 {
@@ -36,17 +36,17 @@ inline double MediaTimeToSeconds(MediaTi
 }
 
 /**
  * A number of ticks at a rate determined by some underlying track (e.g.
  * audio sample rate). We want to make sure that multiplying TrackTicks by
  * 2^MEDIA_TIME_FRAC_BITS doesn't overflow, so we set its max accordingly.
  */
 typedef int64_t TrackTicks;
-const int64_t TRACK_TICKS_MAX = PR_INT64_MAX >> MEDIA_TIME_FRAC_BITS;
+const int64_t TRACK_TICKS_MAX = INT64_MAX >> MEDIA_TIME_FRAC_BITS;
 
 /**
  * A MediaSegment is a chunk of media data sequential in time. Different
  * types of data have different subclasses of MediaSegment, all inheriting
  * from MediaSegmentBase.
  * All MediaSegment data is timed using TrackTicks. The actual tick rate
  * is defined on a per-track basis. For some track types, this can be
  * a fixed constant for all tracks of that type (e.g. 1MHz for video).
--- a/content/media/TimeVarying.h
+++ b/content/media/TimeVarying.h
@@ -76,23 +76,23 @@ public:
       }
       mChanges.RemoveElementAt(i);
     }
     mChanges.InsertElementAt(0, Entry(aTime, aValue));
   }
   /**
    * Returns the final value of the function. If aTime is non-null,
    * sets aTime to the time at which the function changes to that final value.
-   * If there are no changes after the current time, returns PR_INT64_MIN in aTime.
+   * If there are no changes after the current time, returns INT64_MIN in aTime.
    */
   const T& GetLast(Time* aTime = nullptr) const
   {
     if (mChanges.IsEmpty()) {
       if (aTime) {
-        *aTime = PR_INT64_MIN;
+        *aTime = INT64_MIN;
       }
       return mCurrent;
     }
     if (aTime) {
       *aTime = mChanges[mChanges.Length() - 1].mTime;
     }
     return mChanges[mChanges.Length() - 1].mValue;
   }
@@ -114,39 +114,39 @@ public:
                      "Only changed values appear in array");
         return mChanges[i - 1].mValue;
       }
     }
   }
   /**
    * Returns the value of the function at time aTime.
    * If aEnd is non-null, sets *aEnd to the time at which the function will
-   * change from the returned value to a new value, or PR_INT64_MAX if that
+   * change from the returned value to a new value, or INT64_MAX if that
    * never happens.
    * If aStart is non-null, sets *aStart to the time at which the function
-   * changed to the returned value, or PR_INT64_MIN if that happened at or
+   * changed to the returned value, or INT64_MIN if that happened at or
    * before the current time.
    *
    * Currently uses a linear search, but could use a binary search.
    */
   const T& GetAt(Time aTime, Time* aEnd = nullptr, Time* aStart = nullptr) const
   {
     if (mChanges.IsEmpty() || aTime < mChanges[0].mTime) {
       if (aStart) {
-        *aStart = PR_INT64_MIN;
+        *aStart = INT64_MIN;
       }
       if (aEnd) {
-        *aEnd = mChanges.IsEmpty() ? PR_INT64_MAX : mChanges[0].mTime;
+        *aEnd = mChanges.IsEmpty() ? INT64_MAX : mChanges[0].mTime;
       }
       return mCurrent;
     }
     int32_t changesLength = mChanges.Length();
     if (mChanges[changesLength - 1].mTime <= aTime) {
       if (aEnd) {
-        *aEnd = PR_INT64_MAX;
+        *aEnd = INT64_MAX;
       }
       if (aStart) {
         *aStart = mChanges[changesLength - 1].mTime;
       }
       return mChanges[changesLength - 1].mValue;
     }
 
     for (uint32_t i = 1; ; ++i) {
--- a/content/media/VideoUtils.cpp
+++ b/content/media/VideoUtils.cpp
@@ -20,17 +20,17 @@ CheckedInt64 FramesToUsecs(int64_t aFram
 // audio rate.
 CheckedInt64 UsecsToFrames(int64_t aUsecs, uint32_t aRate) {
   return (CheckedInt64(aUsecs) * aRate) / USECS_PER_S;
 }
 
 static int32_t ConditionDimension(float aValue)
 {
   // This will exclude NaNs and too-big values.
-  if (aValue > 1.0 && aValue <= PR_INT32_MAX)
+  if (aValue > 1.0 && aValue <= INT32_MAX)
     return int32_t(NS_round(aValue));
   return 0;
 }
 
 void ScaleDisplayByAspectRatio(nsIntSize& aDisplay, float aAspectRatio)
 {
   if (aAspectRatio > 1.0) {
     // Increase the intrinsic width
--- a/content/media/nsAudioStream.cpp
+++ b/content/media/nsAudioStream.cpp
@@ -604,17 +604,17 @@ bool nsNativeAudioStream::IsPaused()
 
 int32_t nsNativeAudioStream::GetMinWriteSize()
 {
   size_t size;
   int r = sa_stream_get_min_write(static_cast<sa_stream_t*>(mAudioHandle),
                                   &size);
   if (r == SA_ERROR_NOT_SUPPORTED)
     return 1;
-  else if (r != SA_SUCCESS || size > PR_INT32_MAX)
+  else if (r != SA_SUCCESS || size > INT32_MAX)
     return -1;
 
   return static_cast<int32_t>(size / mChannels / sizeof(short));
 }
 
 #if defined(REMOTE_AUDIO)
 nsRemotedAudioStream::nsRemotedAudioStream()
  : mAudioChild(nullptr),
@@ -1147,17 +1147,17 @@ nsBufferedAudioStream::GetPositionInFram
   }
 
   // Adjust the reported position by the number of silent frames written
   // during stream underruns.
   uint64_t adjustedPosition = 0;
   if (position >= mLostFrames) {
     adjustedPosition = position - mLostFrames;
   }
-  return NS_MIN<uint64_t>(adjustedPosition, PR_INT64_MAX);
+  return NS_MIN<uint64_t>(adjustedPosition, INT64_MAX);
 }
 
 bool
 nsBufferedAudioStream::IsPaused()
 {
   MonitorAutoLock mon(mMonitor);
   return mState == STOPPED;
 }
--- a/content/media/nsBuiltinDecoderReader.cpp
+++ b/content/media/nsBuiltinDecoderReader.cpp
@@ -17,17 +17,17 @@
 using namespace mozilla;
 using mozilla::layers::ImageContainer;
 using mozilla::layers::PlanarYCbCrImage;
 
 // Verify these values are sane. Once we've checked the frame sizes, we then
 // can do less integer overflow checking.
 PR_STATIC_ASSERT(MAX_VIDEO_WIDTH < PlanarYCbCrImage::MAX_DIMENSION);
 PR_STATIC_ASSERT(MAX_VIDEO_HEIGHT < PlanarYCbCrImage::MAX_DIMENSION);
-PR_STATIC_ASSERT(PlanarYCbCrImage::MAX_DIMENSION < PR_UINT32_MAX / PlanarYCbCrImage::MAX_DIMENSION);
+PR_STATIC_ASSERT(PlanarYCbCrImage::MAX_DIMENSION < UINT32_MAX / PlanarYCbCrImage::MAX_DIMENSION);
 
 // Un-comment to enable logging of seek bisections.
 //#define SEEK_LOGGING
 
 #ifdef PR_LOGGING
 extern PRLogModuleInfo* gBuiltinDecoderLog;
 #define LOG(type, msg) PR_LOG(gBuiltinDecoderLog, type, msg)
 #ifdef SEEK_LOGGING
--- a/content/media/nsBuiltinDecoderStateMachine.cpp
+++ b/content/media/nsBuiltinDecoderStateMachine.cpp
@@ -583,17 +583,17 @@ void nsBuiltinDecoderStateMachine::SendS
 
   DecodedStreamData* stream = mDecoder->GetDecodedStream();
   if (!stream)
     return;
 
   if (mState == DECODER_STATE_DECODING_METADATA)
     return;
 
-  int64_t minLastAudioPacketTime = PR_INT64_MAX;
+  int64_t minLastAudioPacketTime = INT64_MAX;
   SourceMediaStream* mediaStream = stream->mStream;
   StreamTime endPosition = 0;
 
   if (!stream->mStreamInitialized) {
     if (mInfo.mHasAudio) {
       AudioSegment* audio = new AudioSegment();
       audio->Init(mInfo.mAudioChannels);
       mediaStream->AddTrack(TRACK_AUDIO, mInfo.mAudioRate, 0, audio);
@@ -1101,17 +1101,17 @@ void nsBuiltinDecoderStateMachine::Audio
         if (minWriteFrames > 1 && unplayedFrames > 0) {
           // Sound is written by libsydneyaudio to the hardware in blocks of
           // frames of size minWriteFrames. So if the number of frames we've
           // written isn't an exact multiple of minWriteFrames, we'll have
           // left over audio data which hasn't yet been written to the hardware,
           // and so that audio will not start playing. Write silence to ensure
           // the last block gets pushed to hardware, so that playback starts.
           int64_t framesToWrite = minWriteFrames - unplayedFrames;
-          if (framesToWrite < PR_UINT32_MAX / channels) {
+          if (framesToWrite < UINT32_MAX / channels) {
             // Write silence manually rather than using PlaySilence(), so that
             // the AudioAPI doesn't get a copy of the audio frames.
             ReentrantMonitorAutoExit exit(mDecoder->GetReentrantMonitor());
             WriteSilence(mAudioStream, framesToWrite);
           }
         }
 
         int64_t oldPosition = -1;
@@ -2340,17 +2340,17 @@ void nsBuiltinDecoderStateMachine::Wait(
   TimeStamp now;
   while ((now = TimeStamp::Now()) < end &&
          mState != DECODER_STATE_SHUTDOWN &&
          mState != DECODER_STATE_SEEKING &&
          !mStopAudioThread &&
          IsPlaying())
   {
     int64_t ms = static_cast<int64_t>(NS_round((end - now).ToSeconds() * 1000));
-    if (ms == 0 || ms > PR_UINT32_MAX) {
+    if (ms == 0 || ms > UINT32_MAX) {
       break;
     }
     mDecoder->GetReentrantMonitor().Wait(PR_MillisecondsToInterval(static_cast<uint32_t>(ms)));
   }
 }
 
 VideoData* nsBuiltinDecoderStateMachine::FindStartTime()
 {
--- a/content/media/nsMediaCache.cpp
+++ b/content/media/nsMediaCache.cpp
@@ -680,27 +680,27 @@ nsMediaCache::ReadCacheFileAllBytes(int6
 static int32_t GetMaxBlocks()
 {
   // We look up the cache size every time. This means dynamic changes
   // to the pref are applied.
   // Cache size is in KB
   int32_t cacheSize = Preferences::GetInt("media.cache_size", 500*1024);
   int64_t maxBlocks = static_cast<int64_t>(cacheSize)*1024/nsMediaCache::BLOCK_SIZE;
   maxBlocks = NS_MAX<int64_t>(maxBlocks, 1);
-  return int32_t(NS_MIN<int64_t>(maxBlocks, PR_INT32_MAX));
+  return int32_t(NS_MIN<int64_t>(maxBlocks, INT32_MAX));
 }
 
 int32_t
 nsMediaCache::FindBlockForIncomingData(TimeStamp aNow,
                                        nsMediaCacheStream* aStream)
 {
   mReentrantMonitor.AssertCurrentThreadIn();
 
   int32_t blockIndex = FindReusableBlock(aNow, aStream,
-      aStream->mChannelOffset/BLOCK_SIZE, PR_INT32_MAX);
+      aStream->mChannelOffset/BLOCK_SIZE, INT32_MAX);
 
   if (blockIndex < 0 || !IsBlockFree(blockIndex)) {
     // The block returned is already allocated.
     // Don't reuse it if a) there's room to expand the cache or
     // b) the data we're going to store in the free block is not higher
     // priority than the data already stored in the free block.
     // The latter can lead us to go over the cache limit a bit.
     if ((mIndex.Length() < uint32_t(GetMaxBlocks()) || blockIndex < 0 ||
@@ -984,17 +984,17 @@ nsMediaCache::PredictNextUse(TimeStamp a
     case READAHEAD_BLOCK: {
       int64_t bytesAhead =
         static_cast<int64_t>(bo->mStreamBlock)*BLOCK_SIZE - bo->mStream->mStreamOffset;
       NS_ASSERTION(bytesAhead >= 0,
                    "Readahead block before the current stream position?");
       int64_t millisecondsAhead =
         bytesAhead*1000/bo->mStream->mPlaybackBytesPerSecond;
       prediction = TimeDuration::FromMilliseconds(
-          NS_MIN<int64_t>(millisecondsAhead, PR_INT32_MAX));
+          NS_MIN<int64_t>(millisecondsAhead, INT32_MAX));
       break;
     }
     default:
       NS_ERROR("Invalid class for predicting next use");
       return TimeDuration(0);
     }
     if (i == 0 || prediction < result) {
       result = prediction;
@@ -1012,17 +1012,17 @@ nsMediaCache::PredictNextUseForIncomingD
   if (bytesAhead <= -BLOCK_SIZE) {
     // Hmm, no idea when data behind us will be used. Guess 24 hours.
     return TimeDuration::FromSeconds(24*60*60);
   }
   if (bytesAhead <= 0)
     return TimeDuration(0);
   int64_t millisecondsAhead = bytesAhead*1000/aStream->mPlaybackBytesPerSecond;
   return TimeDuration::FromMilliseconds(
-      NS_MIN<int64_t>(millisecondsAhead, PR_INT32_MAX));
+      NS_MIN<int64_t>(millisecondsAhead, INT32_MAX));
 }
 
 enum StreamAction { NONE, SEEK, SEEK_AND_RESUME, RESUME, SUSPEND };
 
 void
 nsMediaCache::Update()
 {
   NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
@@ -2093,17 +2093,17 @@ nsMediaCacheStream::Read(char* aBuffer, 
       // Don't try to read beyond the end of the stream
       int64_t bytesRemaining = mStreamLength - mStreamOffset;
       if (bytesRemaining <= 0) {
         // Get out of here and return NS_OK
         break;
       }
       size = NS_MIN(size, bytesRemaining);
       // Clamp size until 64-bit file size issues (bug 500784) are fixed.
-      size = NS_MIN(size, int64_t(PR_INT32_MAX));
+      size = NS_MIN(size, int64_t(INT32_MAX));
     }
 
     int32_t bytes;
     int32_t cacheBlock = streamBlock < mBlocks.Length() ? mBlocks[streamBlock] : -1;
     if (cacheBlock < 0) {
       // We don't have a complete cached block here.
 
       if (count > 0) {
@@ -2148,17 +2148,17 @@ nsMediaCacheStream::Read(char* aBuffer, 
         return NS_ERROR_FAILURE;
       }
       continue;
     }
 
     gMediaCache->NoteBlockUsage(this, cacheBlock, mCurrentMode, TimeStamp::Now());
 
     int64_t offset = cacheBlock*BLOCK_SIZE + offsetInStreamBlock;
-    NS_ABORT_IF_FALSE(size >= 0 && size <= PR_INT32_MAX, "Size out of range.");
+    NS_ABORT_IF_FALSE(size >= 0 && size <= INT32_MAX, "Size out of range.");
     nsresult rv = gMediaCache->ReadCacheFile(offset, aBuffer + count, int32_t(size), &bytes);
     if (NS_FAILED(rv)) {
       if (count == 0)
         return rv;
       // If we did successfully read some data, may as well return it
       break;
     }
     mStreamOffset += bytes;
@@ -2197,17 +2197,17 @@ nsMediaCacheStream::ReadFromCache(char* 
     if (mStreamLength >= 0) {
       // Don't try to read beyond the end of the stream
       int64_t bytesRemaining = mStreamLength - streamOffset;
       if (bytesRemaining <= 0) {
         return NS_ERROR_FAILURE;
       }
       size = NS_MIN(size, bytesRemaining);
       // Clamp size until 64-bit file size issues (bug 500784) are fixed.
-      size = NS_MIN(size, int64_t(PR_INT32_MAX));
+      size = NS_MIN(size, int64_t(INT32_MAX));
     }
 
     int32_t bytes;
     uint32_t channelBlock = uint32_t(mChannelOffset/BLOCK_SIZE);
     int32_t cacheBlock = streamBlock < mBlocks.Length() ? mBlocks[streamBlock] : -1;
     if (channelBlock == streamBlock && streamOffset < mChannelOffset) {
       // We can just use the data in mPartialBlockBuffer. In fact we should
       // use it rather than waiting for the block to fill and land in
@@ -2216,17 +2216,17 @@ nsMediaCacheStream::ReadFromCache(char* 
       memcpy(aBuffer + count,
         reinterpret_cast<char*>(mPartialBlockBuffer) + offsetInStreamBlock, bytes);
     } else {
       if (cacheBlock < 0) {
         // We expect all blocks to be cached! Fail!
         return NS_ERROR_FAILURE;
       }
       int64_t offset = cacheBlock*BLOCK_SIZE + offsetInStreamBlock;
-      NS_ABORT_IF_FALSE(size >= 0 && size <= PR_INT32_MAX, "Size out of range.");
+      NS_ABORT_IF_FALSE(size >= 0 && size <= INT32_MAX, "Size out of range.");
       nsresult rv = gMediaCache->ReadCacheFile(offset, aBuffer + count, int32_t(size), &bytes);
       if (NS_FAILED(rv)) {
         return rv;
       }
     }
     streamOffset += bytes;
     count += bytes;
   }
--- a/content/media/ogg/nsOggCodecState.cpp
+++ b/content/media/ogg/nsOggCodecState.cpp
@@ -928,17 +928,17 @@ bool nsOpusState::DecodeHeader(ogg_packe
 #endif
       mPreSkip = LEUint16(aPacket->packet + 10);
       mNominalRate = LEUint32(aPacket->packet + 12);
       double gain_dB = LEInt16(aPacket->packet + 16) / 256.0;
 #ifdef MOZ_SAMPLE_TYPE_FLOAT32
       mGain = static_cast<float>(pow(10,0.05*gain_dB));
 #else
       mGain_Q16 = static_cast<int32_t>(NS_MIN(65536*pow(10,0.05*gain_dB)+0.5,
-                                              static_cast<double>(PR_INT32_MAX)));
+                                              static_cast<double>(INT32_MAX)));
 #endif
       mChannelMapping = aPacket->packet[18];
 
       if (mChannelMapping == 0) {
         mStreams = 1;
         mCoupledStreams = mChannels - 1;
         mMappingTable[0] = 0;
         mMappingTable[1] = 1;
@@ -1136,17 +1136,17 @@ bool nsOpusState::ReconstructOpusGranule
       gp = mPrevPageGranulepos;
       // Loop through the packets forwards, adding the current packet's
       // duration to the previous granulepos to get the value for the
       // current packet.
       for (uint32_t i = 0; i < mUnstamped.Length() - 1; ++i) {
         ogg_packet* packet = mUnstamped[i];
         int offset = GetOpusDeltaGP(packet);
         // Check for error (negative offset) and overflow.
-        if (offset >= 0 && gp <= PR_INT64_MAX - offset) {
+        if (offset >= 0 && gp <= INT64_MAX - offset) {
           gp += offset;
           if (gp >= last_gp) {
             NS_WARNING("Opus end trimming removed more than a full packet.");
             // We were asked to remove a full packet's worth of data or more.
             // Encoders SHOULD NOT produce streams like this, but we'll handle
             // it for them anyway.
             gp = last_gp;
             for (uint32_t j = i+1; j < mUnstamped.Length(); ++j) {
--- a/content/media/ogg/nsOggReader.cpp
+++ b/content/media/ogg/nsOggReader.cpp
@@ -869,17 +869,17 @@ int64_t nsOggReader::RangeEndTime(int64_
         // an Ogg page into data we've previously scanned. Any data
         // between readLimitOffset and aEndOffset must be garbage
         // and we can ignore it thereafter.
         readLimitOffset = NS_MIN(readLimitOffset,
                                  readStartOffset + maxOggPageSize);
         readHead = NS_MAX(aStartOffset, readStartOffset);
       }
 
-      int64_t limit = NS_MIN(static_cast<int64_t>(PR_UINT32_MAX),
+      int64_t limit = NS_MIN(static_cast<int64_t>(UINT32_MAX),
                              aEndOffset - readHead);
       limit = NS_MAX(static_cast<int64_t>(0), limit);
       limit = NS_MIN(limit, static_cast<int64_t>(step));
       uint32_t bytesToRead = static_cast<uint32_t>(limit);
       uint32_t bytesRead = 0;
       char* buffer = ogg_sync_buffer(&sync.mState, bytesToRead);
       NS_ASSERTION(buffer, "Must have buffer");
       nsresult res;
@@ -1287,17 +1287,17 @@ PageSync(MediaResource* aResource,
     ret = ogg_sync_pageseek(aState, aPage);
     if (ret == 0) {
       char* buffer = ogg_sync_buffer(aState, PAGE_STEP);
       NS_ASSERTION(buffer, "Must have a buffer");
 
       // Read from the file into the buffer
       int64_t bytesToRead = NS_MIN(static_cast<int64_t>(PAGE_STEP),
                                    aEndOffset - readHead);
-      NS_ASSERTION(bytesToRead <= PR_UINT32_MAX, "bytesToRead range check");
+      NS_ASSERTION(bytesToRead <= UINT32_MAX, "bytesToRead range check");
       if (bytesToRead <= 0) {
         return PAGE_SYNC_END_OF_RANGE;
       }
       nsresult rv = NS_OK;
       if (aCachedDataOnly) {
         rv = aResource->ReadFromCache(buffer, readHead,
                                       static_cast<uint32_t>(bytesToRead));
         NS_ENSURE_SUCCESS(rv,PAGE_SYNC_ERROR);
@@ -1361,17 +1361,17 @@ nsresult nsOggReader::SeekBisection(int6
   ogg_int64_t endTime = aRange.mTimeEnd;
 
   ogg_int64_t seekTarget = aTarget;
   int64_t seekLowerBound = NS_MAX(static_cast<int64_t>(0), aTarget - aFuzz);
   int hops = 0;
   DebugOnly<ogg_int64_t> previousGuess = -1;
   int backsteps = 0;
   const int maxBackStep = 10;
-  NS_ASSERTION(static_cast<uint64_t>(PAGE_STEP) * pow(2.0, maxBackStep) < PR_INT32_MAX,
+  NS_ASSERTION(static_cast<uint64_t>(PAGE_STEP) * pow(2.0, maxBackStep) < INT32_MAX,
                "Backstep calculation must not overflow");
 
   // Seek via bisection search. Loop until we find the offset where the page
   // before the offset is before the seek target, and the page after the offset
   // is after the seek target.
   while (true) {
     ogg_int64_t duration = 0;
     double target = 0;
--- a/content/media/wave/nsWaveReader.cpp
+++ b/content/media/wave/nsWaveReader.cpp
@@ -174,37 +174,37 @@ bool nsWaveReader::DecodeAudioData()
   // convert data to samples
   const char* d = dataBuffer.get();
   AudioDataValue* s = sampleBuffer.get();
   for (int i = 0; i < frames; ++i) {
     for (unsigned int j = 0; j < mChannels; ++j) {
       if (mSampleFormat == nsAudioStream::FORMAT_U8) {
         uint8_t v =  ReadUint8(&d);
 #if defined(MOZ_SAMPLE_TYPE_S16)
-        *s++ = (v * (1.F/PR_UINT8_MAX)) * PR_UINT16_MAX + PR_INT16_MIN;
+        *s++ = (v * (1.F/UINT8_MAX)) * UINT16_MAX + INT16_MIN;
 #elif defined(MOZ_SAMPLE_TYPE_FLOAT32)
-        *s++ = (v * (1.F/PR_UINT8_MAX)) * 2.F - 1.F;
+        *s++ = (v * (1.F/UINT8_MAX)) * 2.F - 1.F;
 #endif
       }
       else if (mSampleFormat == nsAudioStream::FORMAT_S16) {
         int16_t v =  ReadInt16LE(&d);
 #if defined(MOZ_SAMPLE_TYPE_S16)
         *s++ = v;
 #elif defined(MOZ_SAMPLE_TYPE_FLOAT32)
-        *s++ = (int32_t(v) - PR_INT16_MIN) / float(PR_UINT16_MAX) * 2.F - 1.F;
+        *s++ = (int32_t(v) - INT16_MIN) / float(UINT16_MAX) * 2.F - 1.F;
 #endif
       }
     }
   }
 
   double posTime = BytesToTime(pos);
   double readSizeTime = BytesToTime(readSize);
   NS_ASSERTION(posTime <= INT64_MAX / USECS_PER_S, "posTime overflow");
   NS_ASSERTION(readSizeTime <= INT64_MAX / USECS_PER_S, "readSizeTime overflow");
-  NS_ASSERTION(frames < PR_INT32_MAX, "frames overflow");
+  NS_ASSERTION(frames < INT32_MAX, "frames overflow");
 
   mAudioQueue.Push(new AudioData(pos,
                                  static_cast<int64_t>(posTime * USECS_PER_S),
                                  static_cast<int64_t>(readSizeTime * USECS_PER_S),
                                  static_cast<int32_t>(frames),
                                  sampleBuffer.forget(),
                                  mChannels));
 
@@ -416,17 +416,17 @@ nsWaveReader::LoadFormatChunk()
     uint16_t extra = ReadUint16LE(&p);
     if (fmtSize - (WAVE_FORMAT_CHUNK_SIZE + 2) != extra) {
       NS_WARNING("Invalid extended format chunk size");
       return false;
     }
     extra += extra % 2;
 
     if (extra > 0) {
-      PR_STATIC_ASSERT(PR_UINT16_MAX + (PR_UINT16_MAX % 2) < UINT_MAX / sizeof(char));
+      PR_STATIC_ASSERT(UINT16_MAX + (UINT16_MAX % 2) < UINT_MAX / sizeof(char));
       nsAutoArrayPtr<char> chunkExtension(new char[extra]);
       if (!ReadAll(chunkExtension.get(), extra)) {
         return false;
       }
     }
   }
 
   // RIFF chunks are always word (two byte) aligned.
@@ -468,17 +468,17 @@ nsWaveReader::FindDataOffset()
   // The "data" chunk may not directly follow the "format" chunk, so skip
   // over any intermediate chunks.
   uint32_t length;
   if (!ScanForwardUntil(DATA_CHUNK_MAGIC, &length)) {
     return false;
   }
 
   int64_t offset = mDecoder->GetResource()->Tell();
-  if (offset <= 0 || offset > PR_UINT32_MAX) {
+  if (offset <= 0 || offset > UINT32_MAX) {
     NS_WARNING("PCM data offset out of range");
     return false;
   }
 
   ReentrantMonitorAutoEnter monitor(mDecoder->GetReentrantMonitor());
   mWaveLength = length;
   mWavePCMOffset = uint32_t(offset);
   return true;
--- a/content/smil/nsSMILInstanceTime.cpp
+++ b/content/smil/nsSMILInstanceTime.cpp
@@ -133,17 +133,17 @@ void
 nsSMILInstanceTime::UnmarkShouldPreserve()
 {
   mFlags &= ~kWasDynamicEndpoint;
 }
 
 void
 nsSMILInstanceTime::AddRefFixedEndpoint()
 {
-  NS_ABORT_IF_FALSE(mFixedEndpointRefCnt < PR_UINT16_MAX,
+  NS_ABORT_IF_FALSE(mFixedEndpointRefCnt < UINT16_MAX,
       "Fixed endpoint reference count upper limit reached");
   ++mFixedEndpointRefCnt;
   mFlags &= ~kMayUpdate; // Once fixed, always fixed
 }
 
 void
 nsSMILInstanceTime::ReleaseFixedEndpoint()
 {
--- a/content/svg/content/src/nsSVGFilters.cpp
+++ b/content/svg/content/src/nsSVGFilters.cpp
@@ -481,17 +481,17 @@ nsSVGFEGaussianBlurElement::SetStdDeviat
  * 66052
  * 
  * So this is fine for all reasonable values of N. For larger values of N
  * we may as well just use the same approximation and accept the fact that
  * the output channel values will be a little low.
  */
 static uint32_t ComputeScaledDivisor(uint32_t aDivisor)
 {
-  return PR_UINT32_MAX/(255*aDivisor);
+  return UINT32_MAX/(255*aDivisor);
 }
   
 static void
 BoxBlur(const uint8_t *aInput, uint8_t *aOutput,
         int32_t aStrideMinor, int32_t aStartMinor, int32_t aEndMinor,
         int32_t aLeftLobe, int32_t aRightLobe, bool aAlphaOnly)
 {
   int32_t boxSize = aLeftLobe + aRightLobe + 1;
--- a/content/svg/content/src/nsSVGFilters.h
+++ b/content/svg/content/src/nsSVGFilters.h
@@ -177,17 +177,17 @@ public:
   // returns true if changes to the attribute should cause us to
   // repaint the filter
   virtual bool AttributeAffectsRendering(
           int32_t aNameSpaceID, nsIAtom* aAttribute) const;
 
   static nsIntRect GetMaxRect() {
     // Try to avoid overflow errors dealing with this rect. It will
     // be intersected with some other reasonable-sized rect eventually.
-    return nsIntRect(PR_INT32_MIN/2, PR_INT32_MIN/2, PR_INT32_MAX, PR_INT32_MAX);
+    return nsIntRect(INT32_MIN/2, INT32_MIN/2, INT32_MAX, INT32_MAX);
   }
 
   operator nsISupports*() { return static_cast<nsIContent*>(this); }
   
 protected:
   virtual bool OperatesOnPremultipledAlpha(int32_t) { return true; }
 
   // Called either with aInputIndex >=0 in which case this is
--- a/content/xslt/src/xslt/txNodeSorter.cpp
+++ b/content/xslt/src/xslt/txNodeSorter.cpp
@@ -142,18 +142,18 @@ txNodeSorter::sortNodeSet(txNodeSet* aNo
     rv = aEs->pushEvalContext(evalContext);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Create and set up memoryblock for sort-values and indexarray
     uint32_t len = static_cast<uint32_t>(aNodes->size());
 
     // Limit resource use to something sane.
     uint32_t itemSize = sizeof(uint32_t) + mNKeys * sizeof(txObject*);
-    if (mNKeys > (PR_UINT32_MAX - sizeof(uint32_t)) / sizeof(txObject*) ||
-        len >= PR_UINT32_MAX / itemSize) {
+    if (mNKeys > (UINT32_MAX - sizeof(uint32_t)) / sizeof(txObject*) ||
+        len >= UINT32_MAX / itemSize) {
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     void* mem = PR_Malloc(len * itemSize);
     NS_ENSURE_TRUE(mem, NS_ERROR_OUT_OF_MEMORY);
 
     uint32_t* indexes = static_cast<uint32_t*>(mem);
     txObject** sortValues = reinterpret_cast<txObject**>(indexes + len);
--- a/content/xul/document/src/nsXULPrototypeCache.cpp
+++ b/content/xul/document/src/nsXULPrototypeCache.cpp
@@ -646,17 +646,17 @@ nsXULPrototypeCache::BeginCaching(nsIURI
               rv = tmp;
             }
         }
 
         if (NS_SUCCEEDED(rv)) {
             uint64_t len64;
             rv = inputStream->Available(&len64);
             if (NS_SUCCEEDED(rv)) {
-              if (len64 <= PR_UINT32_MAX)
+              if (len64 <= UINT32_MAX)
                 len = (uint32_t)len64;
               else
                 rv = NS_ERROR_FILE_TOO_BIG;
             }
         }
         
         if (NS_SUCCEEDED(rv)) {
             buf = new char[len];
--- a/content/xul/document/src/nsXULPrototypeDocument.cpp
+++ b/content/xul/document/src/nsXULPrototypeDocument.cpp
@@ -316,21 +316,21 @@ nsXULPrototypeDocument::Read(nsIObjectIn
             prefix = do_GetAtom(prefixStr);
         }
         tmp = aStream->ReadString(localName);
         if (NS_FAILED(tmp)) {
           rv = tmp;
         }
 
         nsCOMPtr<nsINodeInfo> nodeInfo;
-        // Using PR_UINT16_MAX here as we don't know which nodeinfos will be
+        // Using UINT16_MAX here as we don't know which nodeinfos will be
         // used for attributes and which for elements. And that doesn't really
         // matter.
         tmp = mNodeInfoManager->GetNodeInfo(localName, prefix, namespaceURI,
-                                            PR_UINT16_MAX,
+                                            UINT16_MAX,
                                             getter_AddRefs(nodeInfo));
         if (NS_FAILED(tmp)) {
           rv = tmp;
         }
         if (!nodeInfos.AppendObject(nodeInfo))
           rv = NS_ERROR_OUT_OF_MEMORY;
     }
 
--- a/content/xul/templates/src/nsTemplateRule.h
+++ b/content/xul/templates/src/nsTemplateRule.h
@@ -289,17 +289,17 @@ public:
     void SetTag(nsIAtom* aTag) { mTag = aTag; }
 
     nsTemplateRule* NewRule(nsIContent* aRuleNode,
                             nsIContent* aAction,
                             nsTemplateQuerySet* aQuerySet)
     {
         // nsTemplateMatch stores the index as a 16-bit value,
         // so check to make sure for overflow
-        if (mRules.Length() == PR_INT16_MAX)
+        if (mRules.Length() == INT16_MAX)
             return nullptr;
 
         return mRules.AppendElement(nsTemplateRule(aRuleNode, aAction,
                                     aQuerySet));
     }
     
     void RemoveRule(nsTemplateRule *aRule)
     {
--- a/content/xul/templates/src/nsXULTemplateBuilder.cpp
+++ b/content/xul/templates/src/nsXULTemplateBuilder.cpp
@@ -1825,17 +1825,17 @@ nsXULTemplateBuilder::CompileTemplate(ns
 
     for (nsIContent* rulenode = aTemplate->GetFirstChild();
          rulenode;
          rulenode = rulenode->GetNextSibling()) {
 
         nsINodeInfo *ni = rulenode->NodeInfo();
 
         // don't allow more queries than can be supported
-        if (*aPriority == PR_INT16_MAX)
+        if (*aPriority == INT16_MAX)
             return NS_ERROR_FAILURE;
 
         // XXXndeakin queryset isn't a good name for this tag since it only
         //            ever contains one query
         if (!aIsQuerySet && ni->Equals(nsGkAtoms::queryset, kNameSpaceID_XUL)) {
             if (hasRule || hasQuery) {
               nsXULContentUtils::LogTemplateError(ERROR_TEMPLATE_INVALID_QUERYSET);
               continue;
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -9367,17 +9367,17 @@ nsDocShell::AddHeadersToChannel(nsIInput
 {
     nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aGenericChannel);
     NS_ENSURE_STATE(httpChannel);
 
     uint32_t numRead;
     nsAutoCString headersString;
     nsresult rv = aHeadersData->ReadSegments(AppendSegmentToString,
                                              &headersString,
-                                             PR_UINT32_MAX,
+                                             UINT32_MAX,
                                              &numRead);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // used during the manipulation of the String from the InputStream
     nsAutoCString headerName;
     nsAutoCString headerValue;
     int32_t crlf;
     int32_t colon;
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -9202,17 +9202,17 @@ FlagsToPrivate(uint32_t flags)
   MOZ_ASSERT((flags & (1 << 31)) == 0);
   return reinterpret_cast<void*>(static_cast<uintptr_t>(flags << 1));
 }
 
 static inline uint32_t
 PrivateToFlags(void *priv)
 {
   uintptr_t intPriv = reinterpret_cast<uintptr_t>(priv);
-  MOZ_ASSERT(intPriv <= PR_UINT32_MAX && (intPriv & 1) == 0);
+  MOZ_ASSERT(intPriv <= UINT32_MAX && (intPriv & 1) == 0);
   return static_cast<uint32_t>(intPriv >> 1);
 }
 
 JSBool
 nsHTMLDocumentSH::DocumentAllHelperGetProperty(JSContext *cx, JSHandleObject obj,
                                                JSHandleId id, JSMutableHandleValue vp)
 {
   if (nsDOMClassInfo::sAll_id != id) {
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -8764,17 +8764,17 @@ nsGlobalWindow::RegisterIdleObserver(nsI
 
   MOZ_ASSERT(mIdleService);
   MOZ_ASSERT(mIdleTimer);
 
   IdleObserverHolder tmpIdleObserver;
   tmpIdleObserver.mIdleObserver = aIdleObserver;
   rv = aIdleObserver->GetTime(&tmpIdleObserver.mTimeInS);
   NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_ARG_MAX(tmpIdleObserver.mTimeInS, PR_UINT32_MAX / 1000);
+  NS_ENSURE_ARG_MAX(tmpIdleObserver.mTimeInS, UINT32_MAX / 1000);
   NS_ENSURE_ARG_MIN(tmpIdleObserver.mTimeInS, MIN_IDLE_NOTIFICATION_TIME_S);
 
   uint32_t insertAtIndex = FindInsertionIndex(&tmpIdleObserver);
   if (insertAtIndex == mIdleObservers.Length()) {
     mIdleObservers.AppendElement(tmpIdleObserver);
   }
   else {
     mIdleObservers.InsertElementAt(insertAtIndex, tmpIdleObserver);
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -157,24 +157,24 @@ static js::AnalysisPurgeCallback sPrevAn
 static uint32_t sPendingLoadCount;
 static bool sLoadingInProgress;
 
 static uint32_t sCCollectedWaitingForGC;
 static bool sPostGCEventsToConsole;
 static bool sPostGCEventsToObserver;
 static bool sDisableExplicitCompartmentGC;
 static uint32_t sCCTimerFireCount = 0;
-static uint32_t sMinForgetSkippableTime = PR_UINT32_MAX;
+static uint32_t sMinForgetSkippableTime = UINT32_MAX;
 static uint32_t sMaxForgetSkippableTime = 0;
 static uint32_t sTotalForgetSkippableTime = 0;
 static uint32_t sRemovedPurples = 0;
 static uint32_t sForgetSkippableBeforeCC = 0;
 static uint32_t sPreviousSuspectedCount = 0;
 static uint32_t sCompartmentGCCount = NS_MAX_COMPARTMENT_GC_COUNT;
-static uint32_t sCleanupsSinceLastGC = PR_UINT32_MAX;
+static uint32_t sCleanupsSinceLastGC = UINT32_MAX;
 static bool sNeedsFullCC = false;
 static nsJSContext *sContextList = nullptr;
 
 nsScriptNameSpaceManager *gNameSpaceManager;
 
 static nsIJSRuntimeService *sRuntimeService;
 JSRuntime *nsJSRuntime::sRuntime;
 
@@ -3090,17 +3090,17 @@ nsJSContext::CycleCollectNow(nsICycleCol
   sLastCCEndTime = now;
 
   Telemetry::Accumulate(Telemetry::FORGET_SKIPPABLE_MAX,
                         sMaxForgetSkippableTime / PR_USEC_PER_MSEC);
 
   PRTime delta = GetCollectionTimeDelta();
 
   uint32_t cleanups = sForgetSkippableBeforeCC ? sForgetSkippableBeforeCC : 1;
-  uint32_t minForgetSkippableTime = (sMinForgetSkippableTime == PR_UINT32_MAX)
+  uint32_t minForgetSkippableTime = (sMinForgetSkippableTime == UINT32_MAX)
     ? 0 : sMinForgetSkippableTime;
 
   if (sPostGCEventsToConsole) {
     nsCString mergeMsg;
     if (mergingCC) {
       mergeMsg.AssignLiteral(" merged");
     }
 
@@ -3167,17 +3167,17 @@ nsJSContext::CycleCollectNow(nsICycleCol
                                            PR_USEC_PER_MSEC,
                                          sTotalForgetSkippableTime / PR_USEC_PER_MSEC,
                                          sRemovedPurples));
     nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
     if (observerService) {
       observerService->NotifyObservers(nullptr, "cycle-collection-statistics", json.get());
     }
   }
-  sMinForgetSkippableTime = PR_UINT32_MAX;
+  sMinForgetSkippableTime = UINT32_MAX;
   sMaxForgetSkippableTime = 0;
   sTotalForgetSkippableTime = 0;
   sRemovedPurples = 0;
   sForgetSkippableBeforeCC = 0;
   sNeedsFullCC = false;
 }
 
 // static
@@ -3887,17 +3887,17 @@ ReadSourceFromFilename(JSContext *cx, co
   rv = scriptChannel->Open(getter_AddRefs(scriptStream));
   NS_ENSURE_SUCCESS(rv, rv);
 
   uint64_t rawLen;
   rv = scriptStream->Available(&rawLen);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!rawLen)
     return NS_ERROR_FAILURE;
-  if (rawLen > PR_UINT32_MAX)
+  if (rawLen > UINT32_MAX)
     return NS_ERROR_FILE_TOO_BIG;
 
   // Allocate an internal buf the size of the file.
   nsAutoArrayPtr<unsigned char> buf(new unsigned char[rawLen]);
   if (!buf)
     return NS_ERROR_OUT_OF_MEMORY;
 
   unsigned char *ptr = buf, *end = ptr + rawLen;
--- a/dom/camera/GonkCameraControl.cpp
+++ b/dom/camera/GonkCameraControl.cpp
@@ -752,17 +752,17 @@ nsGonkCameraControl::TakePictureComplete
 }
 
 void
 nsGonkCameraControl::SetPreviewSize(uint32_t aWidth, uint32_t aHeight)
 {
   Vector<Size> previewSizes;
   uint32_t bestWidth = aWidth;
   uint32_t bestHeight = aHeight;
-  uint32_t minSizeDelta = PR_UINT32_MAX;
+  uint32_t minSizeDelta = UINT32_MAX;
   uint32_t delta;
   Size size;
 
   mParams.getSupportedPreviewSizes(previewSizes);
 
   if (!aWidth && !aHeight) {
     // no size specified, take the first supported size
     size = previewSizes[0];
--- a/dom/devicestorage/nsDeviceStorage.cpp
+++ b/dom/devicestorage/nsDeviceStorage.cpp
@@ -362,17 +362,17 @@ DeviceStorageFile::Write(nsIInputStream*
   if (!bufferedOutputStream) {
     return NS_ERROR_FAILURE;
   }
 
   rv = NS_OK;
   while (bufSize) {
     uint32_t wrote;
     rv = bufferedOutputStream->WriteFrom(aInputStream,
-                                         static_cast<uint32_t>(NS_MIN<uint64_t>(bufSize, PR_UINT32_MAX)),
+                                         static_cast<uint32_t>(NS_MIN<uint64_t>(bufSize, UINT32_MAX)),
                                          &wrote);
     if (NS_FAILED(rv)) {
       break;
     }
     bufSize -= wrote;
   }
 
   iocomplete = new IOEventComplete(this, "modified");
--- a/dom/file/ArchiveZipFile.cpp
+++ b/dom/file/ArchiveZipFile.cpp
@@ -337,17 +337,17 @@ ArchiveInputStream::SetEOF()
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 // ArchiveZipFile
 
 NS_IMETHODIMP
 ArchiveZipFile::GetInternalStream(nsIInputStream** aStream)
 {
-  if (mLength > PR_INT32_MAX)
+  if (mLength > INT32_MAX)
     return NS_ERROR_FAILURE;
 
   uint64_t size;
   nsresult rv = mArchiveReader->GetSize(&size);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIInputStream> inputStream;
   rv = mArchiveReader->GetInputStream(getter_AddRefs(inputStream));
--- a/dom/file/MemoryStreams.cpp
+++ b/dom/file/MemoryStreams.cpp
@@ -11,17 +11,17 @@
 USING_FILE_NAMESPACE
 
 // static
 already_AddRefed<MemoryOutputStream>
 MemoryOutputStream::Create(uint64_t aSize)
 {
   NS_ASSERTION(aSize, "Passed zero size!");
 
-  NS_ENSURE_TRUE(aSize <= PR_UINT32_MAX, nullptr);
+  NS_ENSURE_TRUE(aSize <= UINT32_MAX, nullptr);
 
   nsRefPtr<MemoryOutputStream> stream = new MemoryOutputStream();
 
   char* dummy;
   uint32_t length = stream->mData.GetMutableData(&dummy, aSize, fallible_t());
   NS_ENSURE_TRUE(length == aSize, nullptr);
 
   return stream.forget();
--- a/dom/indexedDB/FileInfo.cpp
+++ b/dom/indexedDB/FileInfo.cpp
@@ -9,21 +9,21 @@
 USING_INDEXEDDB_NAMESPACE
 
 // static
 FileInfo*
 FileInfo::Create(FileManager* aFileManager, int64_t aId)
 {
   NS_ASSERTION(aId > 0, "Wrong id!");
 
-  if (aId <= PR_INT16_MAX) {
+  if (aId <= INT16_MAX) {
     return new FileInfo16(aFileManager, aId);
   }
 
-  if (aId <= PR_INT32_MAX) {
+  if (aId <= INT32_MAX) {
     return new FileInfo32(aFileManager, aId);
   }
 
   return new FileInfo64(aFileManager, aId);
 }
 
 void
 FileInfo::GetReferences(int32_t* aRefCnt, int32_t* aDBRefCnt,
--- a/dom/indexedDB/FileStream.cpp
+++ b/dom/indexedDB/FileStream.cpp
@@ -24,17 +24,17 @@ NS_INTERFACE_MAP_BEGIN(FileStream)
   NS_INTERFACE_MAP_ENTRY(nsIStandardFileStream)
   NS_INTERFACE_MAP_ENTRY(nsIFileMetadata)
 NS_INTERFACE_MAP_END
 
 NS_IMETHODIMP
 FileStream::Seek(int32_t aWhence, int64_t aOffset)
 {
   // TODO: Add support for 64 bit file sizes, bug 752431
-  NS_ENSURE_TRUE(aOffset <= PR_INT32_MAX, NS_ERROR_INVALID_ARG);
+  NS_ENSURE_TRUE(aOffset <= INT32_MAX, NS_ERROR_INVALID_ARG);
 
   nsresult rv = DoPendingOpen();
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!mQuotaFile) {
     return NS_BASE_STREAM_CLOSED;
   }
 
--- a/dom/indexedDB/IDBCursor.cpp
+++ b/dom/indexedDB/IDBCursor.cpp
@@ -739,17 +739,17 @@ IDBCursor::Delete(JSContext* aCx,
   return mObjectStore->Delete(key, aCx, _retval);
 }
 
 NS_IMETHODIMP
 IDBCursor::Advance(int64_t aCount)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
-  if (aCount < 1 || aCount > PR_UINT32_MAX) {
+  if (aCount < 1 || aCount > UINT32_MAX) {
     return NS_ERROR_TYPE_ERR;
   }
 
   Key key;
   return ContinueInternal(key, int32_t(aCount));
 }
 
 void
--- a/dom/indexedDB/IDBIndex.cpp
+++ b/dom/indexedDB/IDBIndex.cpp
@@ -847,17 +847,17 @@ IDBIndex::GetAll(const jsval& aKey,
 
   nsRefPtr<IDBKeyRange> keyRange;
   if (aOptionalArgCount) {
     rv = IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   if (aOptionalArgCount < 2 || aLimit == 0) {
-    aLimit = PR_UINT32_MAX;
+    aLimit = UINT32_MAX;
   }
 
   nsRefPtr<IDBRequest> request;
   rv = GetAllInternal(keyRange, aLimit, aCx, getter_AddRefs(request));
   NS_ENSURE_SUCCESS(rv, rv);
 
   request.forget(_retval);
   return NS_OK;
@@ -881,17 +881,17 @@ IDBIndex::GetAllKeys(const jsval& aKey,
 
   nsRefPtr<IDBKeyRange> keyRange;
   if (aOptionalArgCount) {
     rv = IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   if (aOptionalArgCount < 2 || aLimit == 0) {
-    aLimit = PR_UINT32_MAX;
+    aLimit = UINT32_MAX;
   }
 
   nsRefPtr<IDBRequest> request;
   rv = GetAllKeysInternal(keyRange, aLimit, aCx, getter_AddRefs(request));
   NS_ENSURE_SUCCESS(rv, rv);
 
   request.forget(_retval);
   return NS_OK;
@@ -1318,17 +1318,17 @@ GetAllKeysHelper::DoDatabaseWork(mozISto
   }
 
   nsCString keyRangeClause;
   if (mKeyRange) {
     mKeyRange->GetBindingClause(NS_LITERAL_CSTRING("value"), keyRangeClause);
   }
 
   nsCString limitClause;
-  if (mLimit != PR_UINT32_MAX) {
+  if (mLimit != UINT32_MAX) {
     limitClause = NS_LITERAL_CSTRING(" LIMIT ");
     limitClause.AppendInt(mLimit);
   }
 
   nsCString query = NS_LITERAL_CSTRING("SELECT object_data_key FROM ") +
                     tableName +
                     NS_LITERAL_CSTRING(" WHERE index_id = :index_id") +
                     keyRangeClause + limitClause;
@@ -1485,17 +1485,17 @@ GetAllHelper::DoDatabaseWork(mozIStorage
   }
 
   nsCString keyRangeClause;
   if (mKeyRange) {
     mKeyRange->GetBindingClause(NS_LITERAL_CSTRING("value"), keyRangeClause);
   }
 
   nsCString limitClause;
-  if (mLimit != PR_UINT32_MAX) {
+  if (mLimit != UINT32_MAX) {
     limitClause = NS_LITERAL_CSTRING(" LIMIT ");
     limitClause.AppendInt(mLimit);
   }
 
   nsCString query = NS_LITERAL_CSTRING("SELECT data, file_ids FROM object_data "
                                        "INNER JOIN ") + indexTable +
                     NS_LITERAL_CSTRING(" AS index_table ON object_data.id = "
                                        "index_table.object_data_id "
--- a/dom/indexedDB/IDBObjectStore.cpp
+++ b/dom/indexedDB/IDBObjectStore.cpp
@@ -2122,17 +2122,17 @@ IDBObjectStore::GetAll(const jsval& aKey
 
   nsRefPtr<IDBKeyRange> keyRange;
   if (aOptionalArgCount) {
     rv = IDBKeyRange::FromJSVal(aCx, aKey, getter_AddRefs(keyRange));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   if (aOptionalArgCount < 2 || aLimit == 0) {
-    aLimit = PR_UINT32_MAX;
+    aLimit = UINT32_MAX;
   }
 
   nsRefPtr<IDBRequest> request;
   rv = GetAllInternal(keyRange, aLimit, aCx, getter_AddRefs(request));
   if (NS_FAILED(rv)) {
     return rv;
   }
 
@@ -3674,17 +3674,17 @@ GetAllHelper::DoDatabaseWork(mozIStorage
       else {
         keyRangeClause.AppendLiteral(" <= :");
       }
       keyRangeClause.Append(upperKeyName);
     }
   }
 
   nsAutoCString limitClause;
-  if (mLimit != PR_UINT32_MAX) {
+  if (mLimit != UINT32_MAX) {
     limitClause.AssignLiteral(" LIMIT ");
     limitClause.AppendInt(mLimit);
   }
 
   nsCString query = NS_LITERAL_CSTRING("SELECT data, file_ids FROM object_data "
                                        "WHERE object_store_id = :osid") +
                     keyRangeClause +
                     NS_LITERAL_CSTRING(" ORDER BY key_value ASC") +
--- a/dom/plugins/base/nsNPAPIPlugin.cpp
+++ b/dom/plugins/base/nsNPAPIPlugin.cpp
@@ -1290,17 +1290,17 @@ NPUTF8* NP_CALLBACK
 int32_t NP_CALLBACK
 _intfromidentifier(NPIdentifier id)
 {
   if (!NS_IsMainThread()) {
     NPN_PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("NPN_intfromidentifier called from the wrong thread\n"));
   }
 
   if (!NPIdentifierIsInt(id)) {
-    return PR_INT32_MIN;
+    return INT32_MIN;
   }
 
   return NPIdentifierToInt(id);
 }
 
 bool NP_CALLBACK
 _identifierisstring(NPIdentifier id)
 {
--- a/dom/plugins/ipc/BrowserStreamParent.cpp
+++ b/dom/plugins/ipc/BrowserStreamParent.cpp
@@ -47,17 +47,17 @@ BrowserStreamParent::AnswerNPN_RequestRe
   default:
     NS_ERROR("Unexpected state");
     return false;
   }
 
   if (!mStream)
     return false;
 
-  if (ranges.size() > PR_INT32_MAX)
+  if (ranges.size() > INT32_MAX)
     return false;
 
   nsAutoArrayPtr<NPByteRange> rp(new NPByteRange[ranges.size()]);
   for (uint32_t i = 0; i < ranges.size(); ++i) {
     rp[i].offset = ranges[i].offset;
     rp[i].length = ranges[i].length;
     rp[i].next = &rp[i + 1];
   }
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -2291,17 +2291,17 @@ PluginModuleChild::NPN_UTF8FromIdentifie
 int32_t NP_CALLBACK
 PluginModuleChild::NPN_IntFromIdentifier(NPIdentifier aIdentifier)
 {
     PLUGIN_LOG_DEBUG_FUNCTION;
 
     if (!static_cast<PluginIdentifierChild*>(aIdentifier)->IsString()) {
       return static_cast<PluginIdentifierChildInt*>(aIdentifier)->ToInt();
     }
-    return PR_INT32_MIN;
+    return INT32_MIN;
 }
 
 #ifdef OS_WIN
 void
 PluginModuleChild::EnteredCall()
 {
     mIncallPumpingStack.AppendElement();
 }
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -403,17 +403,17 @@ PluginModuleParent::ProcessFirstMinidump
     notes.Init(4);
     WriteExtraDataForMinidump(notes);
 
     if (!mPluginDumpID.IsEmpty()) {
         crashReporter->GenerateChildData(&notes);
         return;
     }
 
-    uint32_t sequence = PR_UINT32_MAX;
+    uint32_t sequence = UINT32_MAX;
     nsCOMPtr<nsIFile> dumpFile;
     nsAutoCString flashProcessType;
     TakeMinidump(getter_AddRefs(dumpFile), &sequence);
 
 #ifdef MOZ_CRASHREPORTER_INJECTOR
     nsCOMPtr<nsIFile> childDumpFile;
     uint32_t childSequence;
 
--- a/dom/src/json/nsJSON.cpp
+++ b/dom/src/json/nsJSON.cpp
@@ -445,18 +445,18 @@ nsJSON::DecodeInternal(JSContext* cx,
     }
     if (NS_FAILED(rv)) {
       jsonChannel->Cancel(rv);
       break;
     }
     if (!available)
       break; // blocking input stream has none available when done
 
-    if (available > PR_UINT32_MAX)
-      available = PR_UINT32_MAX;
+    if (available > UINT32_MAX)
+      available = UINT32_MAX;
 
     rv = jsonListener->OnDataAvailable(jsonChannel, nullptr,
                                        aStream,
                                        offset,
                                        (uint32_t)available);
     if (NS_FAILED(rv)) {
       jsonChannel->Cancel(rv);
       break;
--- a/dom/telephony/TelephonyCommon.h
+++ b/dom/telephony/TelephonyCommon.h
@@ -23,17 +23,17 @@
   using namespace mozilla::dom::telephony;
 
 class nsIDOMTelephony;
 class nsIDOMTelephonyCall;
 
 BEGIN_TELEPHONY_NAMESPACE
 
 enum {
-  kOutgoingPlaceholderCallIndex = PR_UINT32_MAX
+  kOutgoingPlaceholderCallIndex = UINT32_MAX
 };
 
 class Telephony;
 class TelephonyCall;
 
 END_TELEPHONY_NAMESPACE
 
 #endif // mozilla_dom_telephony_telephonycommon_h__
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -145,17 +145,17 @@ public:
                    nsresult aStatus, uint32_t aStringLen,
                    const uint8_t* aString)
   {
     AssertIsOnMainThread();
 
     nsCOMPtr<nsISupportsPRUint32> indexSupports(do_QueryInterface(aContext));
     NS_ASSERTION(indexSupports, "This should never fail!");
 
-    uint32_t index = PR_UINT32_MAX;
+    uint32_t index = UINT32_MAX;
     if (NS_FAILED(indexSupports->GetData(&index)) ||
         index >= mLoadInfos.Length()) {
       NS_ERROR("Bad index!");
     }
 
     ScriptLoadInfo& loadInfo = mLoadInfos[index];
 
     loadInfo.mLoadResult = OnStreamCompleteInternal(aLoader, aContext, aStatus,
@@ -508,46 +508,46 @@ public:
     }
 
     return NS_OK;
   }
 
   void
   ExecuteFinishedScripts()
   {
-    uint32_t firstIndex = PR_UINT32_MAX;
-    uint32_t lastIndex = PR_UINT32_MAX;
+    uint32_t firstIndex = UINT32_MAX;
+    uint32_t lastIndex = UINT32_MAX;
 
     // Find firstIndex based on whether mExecutionScheduled is unset.
     for (uint32_t index = 0; index < mLoadInfos.Length(); index++) {
       if (!mLoadInfos[index].mExecutionScheduled) {
         firstIndex = index;
         break;
       }
     }
 
     // Find lastIndex based on whether mChannel is set, and update
     // mExecutionScheduled on the ones we're about to schedule.
-    if (firstIndex != PR_UINT32_MAX) {
+    if (firstIndex != UINT32_MAX) {
       for (uint32_t index = firstIndex; index < mLoadInfos.Length(); index++) {
         ScriptLoadInfo& loadInfo = mLoadInfos[index];
 
         // If we still have a channel then the load is not complete.
         if (loadInfo.mChannel) {
           break;
         }
 
         // We can execute this one.
         loadInfo.mExecutionScheduled = true;
 
         lastIndex = index;
       }
     }
 
-    if (firstIndex != PR_UINT32_MAX && lastIndex != PR_UINT32_MAX) {
+    if (firstIndex != UINT32_MAX && lastIndex != UINT32_MAX) {
       nsRefPtr<ScriptExecutorRunnable> runnable =
         new ScriptExecutorRunnable(*this, mSyncQueueKey, firstIndex, lastIndex);
       if (!runnable->Dispatch(nullptr)) {
         NS_ERROR("This should never fail!");
       }
     }
   }
 };
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -3127,21 +3127,21 @@ WorkerPrivate::ClearQueue(EventQueue* aQ
     event->Release();
   }
 }
 
 uint32_t
 WorkerPrivate::RemainingRunTimeMS() const
 {
   if (mKillTime.IsNull()) {
-    return PR_UINT32_MAX;
+    return UINT32_MAX;
   }
   TimeDuration runtime = mKillTime - TimeStamp::Now();
   double ms = runtime > TimeDuration(0) ? runtime.ToMilliseconds() : 0;
-  return ms > double(PR_UINT32_MAX) ? PR_UINT32_MAX : uint32_t(ms);
+  return ms > double(UINT32_MAX) ? UINT32_MAX : uint32_t(ms);
 }
 
 bool
 WorkerPrivate::SuspendInternal(JSContext* aCx)
 {
   AssertIsOnWorkerThread();
 
   NS_ASSERTION(!mSuspended, "Already suspended!");
@@ -3332,17 +3332,17 @@ WorkerPrivate::CancelAllTimeouts(JSConte
   mTimer = nullptr;
 }
 
 uint32_t
 WorkerPrivate::CreateNewSyncLoop()
 {
   AssertIsOnWorkerThread();
 
-  NS_ASSERTION(mSyncQueues.Length() < PR_UINT32_MAX,
+  NS_ASSERTION(mSyncQueues.Length() < UINT32_MAX,
                "Should have bailed by now!");
 
   mSyncQueues.AppendElement(new SyncQueue());
   return mSyncQueues.Length() - 1;
 }
 
 bool
 WorkerPrivate::RunSyncLoop(JSContext* aCx, uint32_t aSyncLoopKey)
@@ -3669,17 +3669,17 @@ WorkerPrivate::SetTimeout(JSContext* aCx
   if (currentStatus >= Closing) {
     return false;
   }
 
   nsAutoPtr<TimeoutInfo> newInfo(new TimeoutInfo());
   newInfo->mIsInterval = aIsInterval;
   newInfo->mId = timerId;
 
-  if (NS_UNLIKELY(timerId == PR_UINT32_MAX)) {
+  if (NS_UNLIKELY(timerId == UINT32_MAX)) {
     NS_WARNING("Timeout ids overflowed!");
     mNextTimeoutId = 1;
   }
 
   JS::Value* argv = JS_ARGV(aCx, aVp);
 
   // Take care of the main argument.
   if (argv[0].isObject()) {
@@ -3933,17 +3933,17 @@ bool
 WorkerPrivate::RescheduleTimeoutTimer(JSContext* aCx)
 {
   AssertIsOnWorkerThread();
   NS_ASSERTION(!mTimeouts.IsEmpty(), "Should have some timeouts!");
   NS_ASSERTION(mTimer, "Should have a timer!");
 
   double delta =
     (mTimeouts[0]->mTargetTime - TimeStamp::Now()).ToMilliseconds();
-  uint32_t delay = delta > 0 ? NS_MIN(delta, double(PR_UINT32_MAX)) : 0;
+  uint32_t delay = delta > 0 ? NS_MIN(delta, double(UINT32_MAX)) : 0;
 
   nsresult rv = mTimer->InitWithFuncCallback(DummyCallback, nullptr, delay,
                                              nsITimer::TYPE_ONE_SHOT);
   if (NS_FAILED(rv)) {
     JS_ReportError(aCx, "Failed to start timer!");
     return false;
   }
 
--- a/dom/workers/XMLHttpRequest.cpp
+++ b/dom/workers/XMLHttpRequest.cpp
@@ -129,18 +129,18 @@ public:
   Proxy(XMLHttpRequest* aXHRPrivate, bool aMozAnon, bool aMozSystem)
   : mWorkerPrivate(nullptr), mXMLHttpRequestPrivate(aXHRPrivate),
     mMozAnon(aMozAnon), mMozSystem(aMozSystem),
     mInnerEventStreamId(0), mInnerChannelId(0), mOutstandingSendCount(0),
     mOuterEventStreamId(0), mOuterChannelId(0), mLastLoaded(0), mLastTotal(0),
     mLastUploadLoaded(0), mLastUploadTotal(0), mIsSyncXHR(false),
     mLastLengthComputable(false), mLastUploadLengthComputable(false),
     mSeenLoadStart(false), mSeenUploadLoadStart(false),
-    mSyncQueueKey(PR_UINT32_MAX),
-    mSyncEventResponseSyncQueueKey(PR_UINT32_MAX),
+    mSyncQueueKey(UINT32_MAX),
+    mSyncEventResponseSyncQueueKey(UINT32_MAX),
     mUploadEventListenersAttached(false), mMainThreadSeenLoadStart(false),
     mInOpen(false)
   { }
 
   ~Proxy()
   {
     NS_ASSERTION(!mXHR, "Still have an XHR object attached!");
     NS_ASSERTION(!mXHRUpload, "Still have an XHR upload object attached!");
@@ -196,28 +196,28 @@ public:
       AddRemoveEventListeners(true, false);
     }
   }
 
   uint32_t
   GetSyncQueueKey()
   {
     AssertIsOnMainThread();
-    return mSyncEventResponseSyncQueueKey == PR_UINT32_MAX ?
+    return mSyncEventResponseSyncQueueKey == UINT32_MAX ?
            mSyncQueueKey :
            mSyncEventResponseSyncQueueKey;
   }
 
   bool
   EventsBypassSyncQueue()
   {
     AssertIsOnMainThread();
 
-    return mSyncQueueKey == PR_UINT32_MAX &&
-           mSyncEventResponseSyncQueueKey == PR_UINT32_MAX;
+    return mSyncQueueKey == UINT32_MAX &&
+           mSyncEventResponseSyncQueueKey == UINT32_MAX;
   }
 };
 
 END_WORKERS_NAMESPACE
 
 
 namespace {
 
@@ -425,17 +425,17 @@ class LoadStartDetectionRunnable MOZ_FIN
     bool
     WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
     {
       if (mChannelId != mProxy->mOuterChannelId) {
         // Threads raced, this event is now obsolete.
         return true;
       }
 
-      if (mSyncQueueKey != PR_UINT32_MAX) {
+      if (mSyncQueueKey != UINT32_MAX) {
         aWorkerPrivate->StopSyncLoop(mSyncQueueKey, true);
       }
 
       mXMLHttpRequestPrivate->Unpin();
 
       return true;
     }
   };
@@ -1194,17 +1194,17 @@ public:
       }
 
       variant = wvariant;
     }
 
     NS_ASSERTION(!mProxy->mWorkerPrivate, "Should be null!");
     mProxy->mWorkerPrivate = mWorkerPrivate;
 
-    NS_ASSERTION(mProxy->mSyncQueueKey == PR_UINT32_MAX, "Should be unset!");
+    NS_ASSERTION(mProxy->mSyncQueueKey == UINT32_MAX, "Should be unset!");
     mProxy->mSyncQueueKey = mSyncQueueKey;
 
     if (mHasUploadListeners) {
       NS_ASSERTION(!mProxy->mUploadEventListenersAttached, "Huh?!");
       if (!mProxy->AddRemoveEventListeners(true, true)) {
         NS_ERROR("This should never fail!");
       }
     }
@@ -1688,17 +1688,17 @@ XMLHttpRequest::SendInternal(const nsASt
 
   MaybePin(aRv);
   if (aRv.Failed()) {
     return;
   }
 
   AutoUnpinXHR autoUnpin(this);
 
-  uint32_t syncQueueKey = PR_UINT32_MAX;
+  uint32_t syncQueueKey = UINT32_MAX;
   if (mProxy->mIsSyncXHR) {
     syncQueueKey = mWorkerPrivate->CreateNewSyncLoop();
   }
 
   mProxy->mOuterChannelId++;
 
   JSContext* cx = GetJSContext();
 
--- a/editor/libeditor/html/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp
@@ -1217,17 +1217,17 @@ nsresult nsHTMLEditor::InsertObject(cons
       rv = NS_OpenURI(getter_AddRefs(imageStream), fileURI);
       NS_ENSURE_SUCCESS(rv, rv);
     } else {
       imageStream = do_QueryInterface(aObject);
       NS_ENSURE_TRUE(imageStream, NS_ERROR_FAILURE);
     }
 
     nsCString imageData;
-    rv = NS_ConsumeStream(imageStream, PR_UINT32_MAX, imageData);
+    rv = NS_ConsumeStream(imageStream, UINT32_MAX, imageData);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = imageStream->Close();
     NS_ENSURE_SUCCESS(rv, rv);
 
     char * base64 = PL_Base64Encode(imageData.get(), imageData.Length(), nullptr);
     NS_ENSURE_TRUE(base64, NS_ERROR_OUT_OF_MEMORY);
 
--- a/embedding/browser/webBrowser/nsEmbedStream.cpp
+++ b/embedding/browser/webBrowser/nsEmbedStream.cpp
@@ -45,17 +45,17 @@ nsEmbedStream::OpenStream(nsIURI *aBaseU
   // if we're already doing a stream, return an error
   if (mOutputStream)
     return NS_ERROR_IN_PROGRESS;
 
   nsCOMPtr<nsIAsyncInputStream> inputStream;
   nsCOMPtr<nsIAsyncOutputStream> outputStream;
   rv = NS_NewPipe2(getter_AddRefs(inputStream),
                    getter_AddRefs(outputStream),
-                   true, false, 0, PR_UINT32_MAX);
+                   true, false, 0, UINT32_MAX);
   if (NS_FAILED(rv))
     return rv;
 
   nsCOMPtr<nsIDocShell> docShell = do_GetInterface(mOwner);
   rv = docShell->LoadStream(inputStream, aBaseURI, aContentType,
                             EmptyCString(), nullptr);
   if (NS_FAILED(rv))
     return rv;
--- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
+++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
@@ -1856,48 +1856,48 @@ nsWindowWatcher::CalcSizeSpec(const char
   present = false;
   if ((temp = WinHasOption(aFeatures, "top", 0, &present)) || present)
     aResult.mTop = temp;
   else if ((temp = WinHasOption(aFeatures, "screenY", 0, &present)) || present)
     aResult.mTop = temp;
   aResult.mTopSpecified = present;
 
   // Parse size spec, if any. Chrome size overrides content size.
-  if ((temp = WinHasOption(aFeatures, "outerWidth", PR_INT32_MIN, nullptr))) {
-    if (temp == PR_INT32_MIN) {
+  if ((temp = WinHasOption(aFeatures, "outerWidth", INT32_MIN, nullptr))) {
+    if (temp == INT32_MIN) {
       aResult.mUseDefaultWidth = true;
     }
     else {
       aResult.mOuterWidth = temp;
     }
     aResult.mOuterWidthSpecified = true;
-  } else if ((temp = WinHasOption(aFeatures, "width", PR_INT32_MIN, nullptr)) ||
-             (temp = WinHasOption(aFeatures, "innerWidth", PR_INT32_MIN,
+  } else if ((temp = WinHasOption(aFeatures, "width", INT32_MIN, nullptr)) ||
+             (temp = WinHasOption(aFeatures, "innerWidth", INT32_MIN,
                                   nullptr))) {
-    if (temp == PR_INT32_MIN) {
+    if (temp == INT32_MIN) {
       aResult.mUseDefaultWidth = true;
     } else {
       aResult.mInnerWidth = temp;
     }
     aResult.mInnerWidthSpecified = true;
   }
 
-  if ((temp = WinHasOption(aFeatures, "outerHeight", PR_INT32_MIN, nullptr))) {
-    if (temp == PR_INT32_MIN) {
+  if ((temp = WinHasOption(aFeatures, "outerHeight", INT32_MIN, nullptr))) {
+    if (temp == INT32_MIN) {
       aResult.mUseDefaultHeight = true;
     }
     else {
       aResult.mOuterHeight = temp;
     }
     aResult.mOuterHeightSpecified = true;
-  } else if ((temp = WinHasOption(aFeatures, "height", PR_INT32_MIN,
+  } else if ((temp = WinHasOption(aFeatures, "height", INT32_MIN,
                                   nullptr)) ||
-             (temp = WinHasOption(aFeatures, "innerHeight", PR_INT32_MIN,
+             (temp = WinHasOption(aFeatures, "innerHeight", INT32_MIN,
                                   nullptr))) {
-    if (temp == PR_INT32_MIN) {
+    if (temp == INT32_MIN) {
       aResult.mUseDefaultHeight = true;
     } else {
       aResult.mInnerHeight = temp;
     }
     aResult.mInnerHeightSpecified = true;
   }
 }
 
--- a/extensions/gio/nsGIOProtocolHandler.cpp
+++ b/extensions/gio/nsGIOProtocolHandler.cpp
@@ -140,17 +140,17 @@ class nsGIOInputStream : public nsIInput
     NS_DECL_ISUPPORTS
     NS_DECL_NSIINPUTSTREAM
 
     nsGIOInputStream(const nsCString &uriSpec)
       : mSpec(uriSpec)
       , mChannel(nullptr)
       , mHandle(nullptr)
       , mStream(nullptr)
-      , mBytesRemaining(PR_UINT64_MAX)
+      , mBytesRemaining(UINT64_MAX)
       , mStatus(NS_OK)
       , mDirList(nullptr)
       , mDirListPtr(nullptr)
       , mDirBufCursor(0)
       , mDirOpen(false)
       , mMonitorMountInProgress("GIOInputStream::MountFinished") { }
 
    ~nsGIOInputStream() { Close(); }
--- a/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
+++ b/extensions/gnomevfs/nsGnomeVFSProtocolHandler.cpp
@@ -314,17 +314,17 @@ class nsGnomeVFSInputStream MOZ_FINAL : 
   public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIINPUTSTREAM
 
     nsGnomeVFSInputStream(const nsCString &uriSpec)
       : mSpec(uriSpec)
       , mChannel(nullptr)
       , mHandle(nullptr)
-      , mBytesRemaining(PR_UINT64_MAX)
+      , mBytesRemaining(UINT64_MAX)
       , mStatus(NS_OK)
       , mDirList(nullptr)
       , mDirListPtr(nullptr)
       , mDirBufCursor(0)
       , mDirOpen(false) {}
 
    ~nsGnomeVFSInputStream() { Close(); }
 
@@ -428,19 +428,19 @@ nsGnomeVFSInputStream::DoOpen()
 
       if (info.mime_type && (strcmp(info.mime_type, APPLICATION_OCTET_STREAM) != 0))
         SetContentTypeOfChannel(info.mime_type);
 
       mBytesRemaining = info.size;
 
       // Update the content length attribute on the channel.  We do this
       // synchronously without proxying.  This hack is not as bad as it looks!
-      if (mBytesRemaining != PR_UINT64_MAX) {
+      if (mBytesRemaining != UINT64_MAX) {
         // XXX 64-bit
-        mChannel->SetContentLength(NS_MAX((int32_t)mBytesRemaining, PR_INT32_MAX));
+        mChannel->SetContentLength(NS_MAX((int32_t)mBytesRemaining, INT32_MAX));
       }
     }
     else
     {
       mDirOpen = true;
 
       // Sort mDirList
       mDirList = g_list_sort(mDirList, FileInfoComparator);
--- a/extensions/pref/autoconfig/src/nsReadConfig.cpp
+++ b/extensions/pref/autoconfig/src/nsReadConfig.cpp
@@ -279,17 +279,17 @@ nsresult nsReadConfig::openAndEvaluateJS
     }
 
     uint64_t fs64;
     uint32_t amt = 0;
     rv = inStr->Available(&fs64);
     if (NS_FAILED(rv))
         return rv;
     // PR_Malloc dones't support over 4GB
-    if (fs64 > PR_UINT32_MAX)
+    if (fs64 > UINT32_MAX)
       return NS_ERROR_FILE_TOO_BIG;
     uint32_t fs = (uint32_t)fs64;
 
     char *buf = (char *)PR_Malloc(fs * sizeof(char));
     if (!buf) 
         return NS_ERROR_OUT_OF_MEMORY;
 
     rv = inStr->Read(buf, (uint32_t)fs, &amt);
--- a/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
+++ b/extensions/spellcheck/src/mozInlineSpellWordUtil.cpp
@@ -477,17 +477,17 @@ mozInlineSpellWordUtil::BuildSoftText()
           // boundary so that we can avoid looking at too many words.
           ContainsDOMWordSeparator(node, firstOffsetInNode - 1, &newOffset);
         }
         firstOffsetInNode = newOffset;
         mSoftBegin.mOffset = newOffset;
       }
       break;
     }
-    checkBeforeOffset = PR_INT32_MAX;
+    checkBeforeOffset = INT32_MAX;
     if (IsBreakElement(node)) {
       // Since GetPreviousContent follows tree *preorder*, we're about to traverse
       // up out of 'node'. Since node induces breaks (e.g., it's a block),
       // don't bother trying to look outside it, just stop now.
       break;
     }
     // GetPreviousContent below expects mRootNode to be an ancestor of node.
     if (!nsContentUtils::ContentIsDescendantOf(node, mRootNode)) {
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -341,17 +341,17 @@ public:
             return false;
         }
 
         SetupLookupFunction();
 
         bool ok = InitWithPrefix("gl", true);
 
         PR_STATIC_ASSERT(sizeof(GLint) >= sizeof(int32_t));
-        mMaxTextureImageSize = PR_INT32_MAX;
+        mMaxTextureImageSize = INT32_MAX;
 
         mShareWithEGLImage = sEGLLibrary.HasKHRImageBase() &&
                              sEGLLibrary.HasKHRImageTexture2D() &&
                              IsExtensionSupported(OES_EGL_image);
 
         if (ok)
             InitFramebuffers();
 
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -383,17 +383,17 @@ public:
    */
   virtual TemporaryRef<mozilla::gfx::DrawTarget>
     CreateDrawTarget(const mozilla::gfx::IntSize &aSize,
                      mozilla::gfx::SurfaceFormat aFormat);
 
   virtual bool CanUseCanvasLayerForSize(const gfxIntSize &aSize) { return true; }
 
   /**
-   * returns the maximum texture size on this layer backend, or PR_INT32_MAX
+   * returns the maximum texture size on this layer backend, or INT32_MAX
    * if there is no maximum
    */
   virtual int32_t GetMaxTextureSize() const = 0;
 
   /**
    * Return the name of the layer manager's backend.
    */
   virtual void GetBackendName(nsAString& aName) = 0;
--- a/gfx/layers/basic/BasicLayerManager.cpp
+++ b/gfx/layers/basic/BasicLayerManager.cpp
@@ -1034,17 +1034,17 @@ BasicShadowLayerManager::~BasicShadowLay
 
 int32_t
 BasicShadowLayerManager::GetMaxTextureSize() const
 {
   if (HasShadowManager()) {
     return ShadowLayerForwarder::GetMaxTextureSize();
   }
 
-  return PR_INT32_MAX;
+  return INT32_MAX;
 }
 
 void
 BasicShadowLayerManager::SetDefaultTargetConfiguration(BufferMode aDoubleBuffering, ScreenRotation aRotation)
 {
   BasicLayerManager::SetDefaultTargetConfiguration(aDoubleBuffering, aRotation);
   mTargetRotation = aRotation;
   if (mWidget) {
--- a/gfx/layers/basic/BasicLayers.h
+++ b/gfx/layers/basic/BasicLayers.h
@@ -147,17 +147,17 @@ public:
   already_AddRefed<gfxContext> PushGroupForLayer(gfxContext* aContext, Layer* aLayer,
                                                  const nsIntRegion& aRegion,
                                                  bool* aNeedsClipToVisibleRegion);
   already_AddRefed<gfxContext> PushGroupWithCachedSurface(gfxContext *aTarget,
                                                           gfxASurface::gfxContentType aContent);
   void PopGroupToSourceWithCachedSurface(gfxContext *aTarget, gfxContext *aPushed);
 
   virtual bool IsCompositingCheap() { return false; }
-  virtual int32_t GetMaxTextureSize() const { return PR_INT32_MAX; }
+  virtual int32_t GetMaxTextureSize() const { return INT32_MAX; }
   bool CompositorMightResample() { return mCompositorMightResample; }
 
 protected:
   enum TransactionPhase {
     PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
   };
   TransactionPhase mPhase;
 
--- a/gfx/layers/opengl/LayerManagerOGL.cpp
+++ b/gfx/layers/opengl/LayerManagerOGL.cpp
@@ -1180,17 +1180,17 @@ LayerManagerOGL::CopyToTarget(gfxContext
   if (mIsRenderingToEGLSurface) {
     rect = nsIntRect(0, 0, mSurfaceSize.width, mSurfaceSize.height);
   } else {
     mWidget->GetBounds(rect);
   }
   GLint width = rect.width;
   GLint height = rect.height;
 
-  if ((int64_t(width) * int64_t(height) * int64_t(4)) > PR_INT32_MAX) {
+  if ((int64_t(width) * int64_t(height) * int64_t(4)) > INT32_MAX) {
     NS_ERROR("Widget size too big - integer overflow!");
     return;
   }
 
   nsRefPtr<gfxImageSurface> imageSurface =
     new gfxImageSurface(gfxIntSize(width, height),
                         gfxASurface::ImageFormatARGB32);
 
--- a/gfx/src/nsCoord.h
+++ b/gfx/src/nsCoord.h
@@ -287,30 +287,30 @@ NSCoordGreaterThan(nscoord a,nscoord b)
   NS_ASSERTION(a != nscoord_MAX, 
                "This coordinate should be constrained");
   return ((a > b) && (b != nscoord_MAX));
 }
 
 /**
  * Convert an nscoord to a int32_t. This *does not* do rounding because
  * coords are never fractional. They can be out of range, so this does
- * clamp out of bounds coord values to PR_INT32_MIN and PR_INT32_MAX.
+ * clamp out of bounds coord values to INT32_MIN and INT32_MAX.
  */
 inline int32_t NSCoordToInt(nscoord aCoord) {
   VERIFY_COORD(aCoord);
 #ifdef NS_COORD_IS_FLOAT
   NS_ASSERTION(!NS_IEEEIsNan(aCoord), "NaN encountered in int conversion");
   if (aCoord < -2147483648.0f) {
     // -2147483648 is the smallest 32-bit signed integer that can be
     // exactly represented as a float
-    return PR_INT32_MIN;
+    return INT32_MIN;
   } else if (aCoord > 2147483520.0f) {
     // 2147483520 is the largest 32-bit signed integer that can be
     // exactly represented as an IEEE float
-    return PR_INT32_MAX;
+    return INT32_MAX;
   } else {
     return (int32_t)aCoord;
   }
 #else
   return aCoord;
 #endif
 }
 
--- a/gfx/src/nsRegion.cpp
+++ b/gfx/src/nsRegion.cpp
@@ -15,18 +15,18 @@
  *   aCoord > NS_COORD_GREATER_SENTINEL
  * Setting the mRectListHead dummy rectangle to these values
  * allows us to loop without checking for the list end.
  */
 #ifdef NS_COORD_IS_FLOAT
 #define NS_COORD_LESS_SENTINEL nscoord_MIN
 #define NS_COORD_GREATER_SENTINEL nscoord_MAX
 #else
-#define NS_COORD_LESS_SENTINEL PR_INT32_MIN
-#define NS_COORD_GREATER_SENTINEL PR_INT32_MAX
+#define NS_COORD_LESS_SENTINEL INT32_MIN
+#define NS_COORD_GREATER_SENTINEL INT32_MAX
 #endif
 
 // Fast inline analogues of nsRect methods for nsRegion::nsRectFast.
 // Check for emptiness is not required - it is guaranteed by caller.
 
 inline bool nsRegion::nsRectFast::Contains (const nsRect& aRect) const
 {
   return (bool) ((aRect.x >= x) && (aRect.y >= y) &&
--- a/gfx/tests/TestColorNames.cpp
+++ b/gfx/tests/TestColorNames.cpp
@@ -74,17 +74,17 @@ int main(int argc, char** argv)
       rv = 1;
     }
 
     // Check that parsing an RGB value in hex gets the right values
     uint8_t r = NS_GET_R(rgb);
     uint8_t g = NS_GET_G(rgb);
     uint8_t b = NS_GET_B(rgb);
     uint8_t a = NS_GET_A(rgb);
-    if (a != PR_UINT8_MAX) {
+    if (a != UINT8_MAX) {
       // NS_HexToRGB() can not handle a color with alpha channel
       rgb = NS_RGB(r, g, b);
     }
     char cbuf[50];
     PR_snprintf(cbuf, sizeof(cbuf), "%02x%02x%02x", r, g, b);
     nscolor hexrgb;
     if (!NS_HexToRGB(NS_ConvertASCIItoUTF16(cbuf), &hexrgb)) {
       fail("hex conversion to color of '%s'", cbuf);
--- a/gfx/thebes/gfxASurface.cpp
+++ b/gfx/thebes/gfxASurface.cpp
@@ -749,17 +749,17 @@ gfxASurface::WriteAsPNG_internal(FILE* a
   if (!imgStream)
     return;
 
   uint64_t bufSize64;
   rv = imgStream->Available(&bufSize64);
   if (NS_FAILED(rv))
     return;
 
-  if (bufSize64 > PR_UINT32_MAX - 16)
+  if (bufSize64 > UINT32_MAX - 16)
     return;
 
   uint32_t bufSize = (uint32_t)bufSize64;
 
   // ...leave a little extra room so we can call read again and make sure we
   // got everything. 16 bytes for better padding (maybe)
   bufSize += 16;
   uint32_t imgSize = 0;
--- a/gfx/thebes/gfxDWriteShaper.cpp
+++ b/gfx/thebes/gfxDWriteShaper.cpp
@@ -50,17 +50,17 @@ gfxDWriteShaper::ShapeWord(gfxContext *a
         NS_WARNING("Analyzer failed to generate results.");
         return false;
     }
 
     uint32_t appUnitsPerDevPixel = aShapedWord->AppUnitsPerDevUnit();
 
     UINT32 maxGlyphs = 0;
 trymoreglyphs:
-    if ((PR_UINT32_MAX - 3 * length / 2 + 16) < maxGlyphs) {
+    if ((UINT32_MAX - 3 * length / 2 + 16) < maxGlyphs) {
         // This isn't going to work, we're going to cross the UINT32 upper
         // limit. Give up.
         NS_WARNING("Shaper needs to generate more than 2^32 glyphs?!");
         return false;
     }
     maxGlyphs += 3 * length / 2 + 16;
 
     nsAutoTArray<UINT16, 400> clusters;
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -5209,17 +5209,17 @@ gfxTextRun::BreakAndMeasureText(uint32_t
     if (aTrimWhitespace) {
         *aTrimWhitespace = trimmableAdvance;
     }
     if (aUsedHyphenation) {
         *aUsedHyphenation = usedHyphenation;
     }
     if (aLastBreak && charsFit == aMaxLength) {
         if (lastBreak < 0) {
-            *aLastBreak = PR_UINT32_MAX;
+            *aLastBreak = UINT32_MAX;
         } else {
             *aLastBreak = lastBreak - aStart;
         }
     }
 
     return charsFit;
 }
 
--- a/gfx/thebes/gfxFont.h
+++ b/gfx/thebes/gfxFont.h
@@ -2604,17 +2604,17 @@ public:
      *       N < aMaxLength && line break at N
      *   OR  N < aMaxLength && hyphen break at N
      *   OR  N == aMaxLength
      *
      * The call has the effect of
      * SetLineBreaks(aStart, result, aLineBreakBefore, result < aMaxLength, aProvider)
      * and the returned metrics and the invariants above reflect this.
      *
-     * @param aMaxLength this can be PR_UINT32_MAX, in which case the length used
+     * @param aMaxLength this can be UINT32_MAX, in which case the length used
      * is up to the end of the string
      * @param aLineBreakBefore set to true if and only if there is an actual
      * line break at the start of this string.
      * @param aSuppressInitialBreak if true, then we assume there is no possible
      * linebreak before aStart. If false, then we will check the internal
      * line break opportunity state before deciding whether to return 0 as the
      * character to break before.
      * @param aTrimWhitespace if non-null, then we allow a trailing run of
@@ -2628,17 +2628,17 @@ public:
      * @param aBoundingBoxType whether to make the bounding box in aMetrics tight
      * @param aRefContextForTightBoundingBox a reference context to get the
      * tight bounding box, if requested
      * @param aUsedHyphenation if non-null, records if we selected a hyphenation break
      * @param aLastBreak if non-null and result is aMaxLength, we set this to
      * the maximal N such that
      *       N < aMaxLength && line break at N && GetAdvanceWidth(aStart, N) <= aWidth
      *   OR  N < aMaxLength && hyphen break at N && GetAdvanceWidth(aStart, N) + GetHyphenWidth() <= aWidth
-     * or PR_UINT32_MAX if no such N exists, where GetAdvanceWidth assumes
+     * or UINT32_MAX if no such N exists, where GetAdvanceWidth assumes
      * the effect of
      * SetLineBreaks(aStart, N, aLineBreakBefore, N < aMaxLength, aProvider)
      *
      * @param aCanWordWrap true if we can break between any two grapheme
      * clusters. This is set by word-wrap: break-word
      *
      * @param aBreakPriority in/out the priority of the break opportunity
      * saved in the line. If we are prioritizing break opportunities, we will
@@ -3104,17 +3104,17 @@ public:
 
     const nsString& GetFamilies() { return mFamilies; }
 
     // This returns the preferred underline for this font group.
     // Some CJK fonts have wrong underline offset in its metrics.
     // If this group has such "bad" font, each platform's gfxFontGroup initialized mUnderlineOffset.
     // The value should be lower value of first font's metrics and the bad font's metrics.
     // Otherwise, this returns from first font's metrics.
-    enum { UNDERLINE_OFFSET_NOT_SET = PR_INT16_MAX };
+    enum { UNDERLINE_OFFSET_NOT_SET = INT16_MAX };
     virtual gfxFloat GetUnderlineOffset() {
         if (mUnderlineOffset == UNDERLINE_OFFSET_NOT_SET)
             mUnderlineOffset = GetFontAt(0)->GetMetrics().underlineOffset;
         return mUnderlineOffset;
     }
 
     virtual already_AddRefed<gfxFont>
         FindFontForChar(uint32_t ch, uint32_t prevCh, int32_t aRunScript,
--- a/gfx/thebes/gfxFontUtils.cpp
+++ b/gfx/thebes/gfxFontUtils.cpp
@@ -1342,17 +1342,17 @@ gfxFontUtils::RenameFont(const nsAString
     uint16_t nameStrLength = (aName.Length() + 1) * sizeof(PRUnichar); 
 
     // round name table size up to 4-byte multiple
     uint32_t nameTableSize = (sizeof(NameHeader) +
                               sizeof(NameRecord) * nameCount +
                               nameStrLength +
                               3) & ~3;
                               
-    if (dataLength + nameTableSize > PR_UINT32_MAX)
+    if (dataLength + nameTableSize > UINT32_MAX)
         return NS_ERROR_FAILURE;
         
     // bug 505386 - need to handle unpadded font length
     uint32_t paddedFontDataSize = (aFontDataLength + 3) & ~3;
     uint32_t adjFontDataSize = paddedFontDataSize + nameTableSize;
 
     // create new buffer: old font data plus new name table
     if (!aNewFont->AppendElements(adjFontDataSize))
--- a/image/decoders/nsPNGDecoder.cpp
+++ b/image/decoders/nsPNGDecoder.cpp
@@ -626,17 +626,17 @@ nsPNGDecoder::info_callback(png_structp 
     decoder->mCMSLine =
       (uint8_t *)moz_malloc(bpp[channels] * width);
     if (!decoder->mCMSLine) {
       longjmp(png_jmpbuf(decoder->mPNG), 5); // NS_ERROR_OUT_OF_MEMORY
     }
   }
 
   if (interlace_type == PNG_INTERLACE_ADAM7) {
-    if (height < PR_INT32_MAX / (width * channels))
+    if (height < INT32_MAX / (width * channels))
       decoder->interlacebuf = (uint8_t *)moz_malloc(channels * width * height);
     if (!decoder->interlacebuf) {
       longjmp(png_jmpbuf(decoder->mPNG), 5); // NS_ERROR_OUT_OF_MEMORY
     }
   }
 
   /* Reject any ancillary chunk after IDAT with a bad CRC (bug #397593).
    * It would be better to show the default frame (if one has already been
--- a/image/src/imgTools.cpp
+++ b/image/src/imgTools.cpp
@@ -78,17 +78,17 @@ NS_IMETHODIMP imgTools::DecodeImageData(
     if (NS_SUCCEEDED(rv))
       inStream = bufStream;
   }
 
   // Figure out how much data we've been passed
   uint64_t length;
   rv = inStream->Available(&length);
   NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_TRUE(length <= PR_UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
+  NS_ENSURE_TRUE(length <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
 
   // Send the source data to the Image. WriteToRasterImage always
   // consumes everything it gets if it doesn't run out of memory.
   uint32_t bytesRead;
   rv = inStream->ReadSegments(RasterImage::WriteToRasterImage,
                               static_cast<void*>(image),
                               (uint32_t)length, &bytesRead);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/intl/lwbrk/src/nsJISx4501LineBreaker.cpp
+++ b/intl/lwbrk/src/nsJISx4501LineBreaker.cpp
@@ -323,17 +323,17 @@ static const uint16_t gPairConservative[
       7: Characters
       8: Need special handling characters (E.g., Thai)
       9: Open parentheses like Character (See bug 389056)
       A: Close parenthese (or punctuations) like Character (See bug 389056)
       B: Non breakable (See bug 390920)
 
 */
 
-#define CLASS_NONE                             PR_INT8_MAX
+#define CLASS_NONE                             INT8_MAX
 
 #define CLASS_OPEN                             0x00
 #define CLASS_CLOSE                            0x01
 #define CLASS_NON_BREAKABLE_BETWEEN_SAME_CLASS 0x02
 #define CLASS_PREFIX                           0x03
 #define CLASS_POSTFFIX                         0x04
 #define CLASS_BREAKABLE                        0x05
 #define CLASS_NUMERIC                          0x06
--- a/ipc/glue/Shmem.cpp
+++ b/ipc/glue/Shmem.cpp
@@ -351,17 +351,17 @@ Shmem::RevokeRights(IHadBetterBeIPDLCode
 // static
 Shmem::SharedMemory*
 Shmem::Alloc(IHadBetterBeIPDLCodeCallingThis_OtherwiseIAmADoodyhead,
              size_t aNBytes,
              SharedMemoryType aType,
              bool aUnsafe,
              bool aProtect)
 {
-  NS_ASSERTION(aNBytes <= PR_UINT32_MAX, "Will truncate shmem segment size!");
+  NS_ASSERTION(aNBytes <= UINT32_MAX, "Will truncate shmem segment size!");
   NS_ABORT_IF_FALSE(!aProtect || !aUnsafe, "protect => !unsafe");
 
   size_t pageSize = SharedMemory::SystemPageSize();
   SharedMemory* segment = nullptr;
   // |2*pageSize| is for the front and back sentinel
   size_t segmentSize = SharedMemory::PageAlignedSize(aNBytes + 2*pageSize);
 
   if (aType == SharedMemory::TYPE_BASIC)
--- a/ipc/glue/SyncChannel.cpp
+++ b/ipc/glue/SyncChannel.cpp
@@ -17,17 +17,17 @@ struct RunnableMethodTraits<mozilla::ipc
 {
     static void RetainCallee(mozilla::ipc::SyncChannel* obj) { }
     static void ReleaseCallee(mozilla::ipc::SyncChannel* obj) { }
 };
 
 namespace mozilla {
 namespace ipc {
 
-const int32_t SyncChannel::kNoTimeout = PR_INT32_MIN;
+const int32_t SyncChannel::kNoTimeout = INT32_MIN;
 
 SyncChannel::SyncChannel(SyncListener* aListener)
   : AsyncChannel(aListener)
   , mPendingReply(0)
   , mProcessingSyncMessage(false)
   , mNextSeqno(0)
   , mInTimeoutSecondHalf(false)
   , mTimeoutMs(kNoTimeout)
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -738,17 +738,17 @@ mozJSComponentLoader::GlobalForLocation(
             int64_t fileSize;
             rv = aComponentFile->GetFileSize(&fileSize);
             if (NS_FAILED(rv)) {
                 JS_SetOptions(cx, oldopts);
                 return rv;
             }
 
             int64_t maxSize;
-            LL_UI2L(maxSize, PR_UINT32_MAX);
+            LL_UI2L(maxSize, UINT32_MAX);
             if (LL_CMP(fileSize, >, maxSize)) {
                 NS_ERROR("file too large");
                 JS_SetOptions(cx, oldopts);
                 return NS_ERROR_FAILURE;
             }
 
             PRFileDesc *fileHandle;
             rv = aComponentFile->OpenNSPRFileDesc(PR_RDONLY, 0, &fileHandle);
@@ -840,17 +840,17 @@ mozJSComponentLoader::GlobalForLocation(
             rv = scriptChannel->Open(getter_AddRefs(scriptStream));
             NS_ENSURE_SUCCESS(rv, rv);
 
             uint64_t len64;
             uint32_t bytesRead;
 
             rv = scriptStream->Available(&len64);
             NS_ENSURE_SUCCESS(rv, rv);
-            NS_ENSURE_TRUE(len64 < PR_UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
+            NS_ENSURE_TRUE(len64 < UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
             if (!len64)
                 return NS_ERROR_FAILURE;
             uint32_t len = (uint32_t)len64;
 
             /* malloc an internal buf the size of the file */
             nsAutoArrayPtr<char> buf(new char[len + 1]);
             if (!buf)
                 return NS_ERROR_OUT_OF_MEMORY;
--- a/js/xpconnect/src/XPCConvert.cpp
+++ b/js/xpconnect/src/XPCConvert.cpp
@@ -1477,17 +1477,17 @@ failure:
 
 #undef POPULATE
 }
 
 
 
 // Check that the tag part of the type matches the type
 // of the array. If the check succeeds, check that the size
-// of the output does not exceed PR_UINT32_MAX bytes. Allocate
+// of the output does not exceed UINT32_MAX bytes. Allocate
 // the memory and copy the elements by memcpy.
 static JSBool
 CheckTargetAndPopulate(JSContext *cx,
                        const nsXPTType& type,
                        uint8_t requiredType,
                        size_t typeSize,
                        uint32_t count,
                        JSObject* tArr,
@@ -1500,18 +1500,18 @@ CheckTargetAndPopulate(JSContext *cx,
     if (type.TagPart() != requiredType) {
         if (pErr)
             *pErr = NS_ERROR_XPC_BAD_CONVERT_JS;
 
         return false;
     }
 
     // Calulate the maximum number of elements that can fit in
-    // PR_UINT32_MAX bytes.
-    size_t max = PR_UINT32_MAX / typeSize;
+    // UINT32_MAX bytes.
+    size_t max = UINT32_MAX / typeSize;
 
     // This could overflow on 32-bit systems so check max first.
     size_t byteSize = count * typeSize;
     if (count > max || !(*output = nsMemory::Alloc(byteSize))) {
         if (pErr)
             *pErr = NS_ERROR_OUT_OF_MEMORY;
 
         return false;
@@ -1685,17 +1685,17 @@ XPCConvert::JSArray2Native(JSContext* cx
     }
 
     if (pErr)
         *pErr = NS_ERROR_XPC_BAD_CONVERT_JS;
 
 #define POPULATE(_mode, _t)                                                   \
     PR_BEGIN_MACRO                                                            \
         cleanupMode = _mode;                                                  \
-        size_t max = PR_UINT32_MAX / sizeof(_t);                              \
+        size_t max = UINT32_MAX / sizeof(_t);                              \
         if (count > max ||                                                    \
             nullptr == (array = nsMemory::Alloc(count * sizeof(_t)))) {        \
             if (pErr)                                                         \
                 *pErr = NS_ERROR_OUT_OF_MEMORY;                               \
             goto failure;                                                     \
         }                                                                     \
         for (initedCount = 0; initedCount < count; initedCount++) {           \
             if (!JS_GetElement(cx, jsarray, initedCount, &current) ||         \
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -2330,18 +2330,18 @@ public:
 
     CallMethodHelper(XPCCallContext& ccx)
         : mCallContext(ccx)
         , mIFaceInfo(ccx.GetInterface()->GetInterfaceInfo())
         , mMethodInfo(nullptr)
         , mCallee(ccx.GetTearOff()->GetNative())
         , mVTableIndex(ccx.GetMethodIndex())
         , mIdxValueId(ccx.GetRuntime()->GetStringID(XPCJSRuntime::IDX_VALUE))
-        , mJSContextIndex(PR_UINT8_MAX)
-        , mOptArgcIndex(PR_UINT8_MAX)
+        , mJSContextIndex(UINT8_MAX)
+        , mOptArgcIndex(UINT8_MAX)
         , mArgv(ccx.GetArgv())
         , mArgc(ccx.GetArgc())
 
     {
         // Success checked later.
         mIFaceInfo->GetMethodInfo(mVTableIndex, &mMethodInfo);
     }
 
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -451,17 +451,17 @@ protected:
    * Builds an ImageLayer for the appropriate backend; the mask is relative to
    * aLayer's visible region.
    * aLayer is the layer to be clipped.
    * aRoundedRectClipCount is used when building mask layers for ThebesLayers,
    * SetupMaskLayer will build a mask layer for only the first
    * aRoundedRectClipCount rounded rects in aClip
    */
   void SetupMaskLayer(Layer *aLayer, const FrameLayerBuilder::Clip& aClip,
-                      uint32_t aRoundedRectClipCount = PR_UINT32_MAX);
+                      uint32_t aRoundedRectClipCount = UINT32_MAX);
 
   nsDisplayListBuilder*            mBuilder;
   LayerManager*                    mManager;
   FrameLayerBuilder*               mLayerBuilder;
   nsIFrame*                        mContainerFrame;
   const nsIFrame*                  mContainerReferenceFrame;
   ContainerLayer*                  mContainerLayer;
   FrameLayerBuilder::ContainerParameters mParameters;
--- a/layout/base/FrameLayerBuilder.h
+++ b/layout/base/FrameLayerBuilder.h
@@ -459,17 +459,17 @@ public:
 
     // Construct as the intersection of aOther and aClipItem.
     Clip(const Clip& aOther, nsDisplayItem* aClipItem);
 
     // Apply this |Clip| to the given gfxContext.  Any saving of state
     // or clearing of other clips must be done by the caller.
     // See aBegin/aEnd note on ApplyRoundedRectsTo.
     void ApplyTo(gfxContext* aContext, nsPresContext* aPresContext,
-                 uint32_t aBegin = 0, uint32_t aEnd = PR_UINT32_MAX);
+                 uint32_t aBegin = 0, uint32_t aEnd = UINT32_MAX);
 
     void ApplyRectTo(gfxContext* aContext, int32_t A2D) const;
     // Applies the rounded rects in this Clip to aContext
     // Will only apply rounded rects from aBegin (inclusive) to aEnd
     // (exclusive) or the number of rounded rects, whichever is smaller.
     void ApplyRoundedRectsTo(gfxContext* aContext, int32_t A2DPRInt32,
                              uint32_t aBegin, uint32_t aEnd) const;
 
--- a/layout/base/nsCounterManager.h
+++ b/layout/base/nsCounterManager.h
@@ -84,17 +84,17 @@ struct nsCounterUseNode : public nsCount
 
     // args go directly to member variables here and of nsGenConNode
     nsCounterUseNode(nsCSSValue::Array* aCounterStyle,
                      uint32_t aContentIndex, bool aAllCounters)
         : nsCounterNode(aContentIndex, USE)
         , mCounterStyle(aCounterStyle)
         , mAllCounters(aAllCounters)
     {
-        NS_ASSERTION(aContentIndex <= PR_INT32_MAX, "out of range");
+        NS_ASSERTION(aContentIndex <= INT32_MAX, "out of range");
     }
     
     virtual bool InitTextFrame(nsGenConList* aList,
             nsIFrame* aPseudoFrame, nsIFrame* aTextFrame);
 
     // assign the correct |mValueAfter| value to a node that has been inserted
     // Should be called immediately after calling |Insert|.
     void Calc(nsCounterList* aList);
@@ -114,18 +114,18 @@ struct nsCounterChangeNode : public nsCo
     nsCounterChangeNode(nsIFrame* aPseudoFrame,
                         nsCounterNode::Type aChangeType,
                         int32_t aChangeValue,
                         int32_t aPropIndex)
         : nsCounterNode(// Fake a content index for resets and increments
                         // that comes before all the real content, with
                         // the resets first, in order, and then the increments.
                         aPropIndex + (aChangeType == RESET
-                                        ? (PR_INT32_MIN) 
-                                        : (PR_INT32_MIN / 2)),
+                                        ? (INT32_MIN) 
+                                        : (INT32_MIN / 2)),
                         aChangeType)
         , mChangeValue(aChangeValue)
     {
         NS_ASSERTION(aPropIndex >= 0, "out of range");
         NS_ASSERTION(aChangeType == INCREMENT || aChangeType == RESET,
                      "bad type");
         mPseudoFrame = aPseudoFrame;
         CheckFrameAssertions();
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -2558,17 +2558,17 @@ public:
   virtual bool ComputeVisibility(nsDisplayListBuilder *aBuilder,
                                    nsRegion *aVisibleRegion,
                                    const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
   virtual bool TryMerge(nsDisplayListBuilder *aBuilder, nsDisplayItem *aItem) MOZ_OVERRIDE;
   
   virtual uint32_t GetPerFrameKey() MOZ_OVERRIDE { return (mIndex << nsDisplayItem::TYPE_BITS) | nsDisplayItem::GetPerFrameKey(); }
 
   enum {
-    INDEX_MAX = PR_UINT32_MAX >> nsDisplayItem::TYPE_BITS
+    INDEX_MAX = UINT32_MAX >> nsDisplayItem::TYPE_BITS
   };
 
   const gfx3DMatrix& GetTransform(float aAppUnitsPerPixel);
 
   float GetHitDepthAtPoint(const nsPoint& aPoint);
 
   /**
    * TransformRect takes in as parameters a rectangle (in aFrame's coordinate
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -4459,17 +4459,17 @@ nsLayoutUtils::AssertTreeOnlyEmptyNextIn
 /* static */
 nsresult
 nsLayoutUtils::GetFontFacesForFrames(nsIFrame* aFrame,
                                      nsFontFaceList* aFontFaceList)
 {
   NS_PRECONDITION(aFrame, "NULL frame pointer");
 
   if (aFrame->GetType() == nsGkAtoms::textFrame) {
-    return GetFontFacesForText(aFrame, 0, PR_INT32_MAX, false,
+    return GetFontFacesForText(aFrame, 0, INT32_MAX, false,
                                aFontFaceList);
   }
 
   while (aFrame) {
     nsIFrame::ChildListID childLists[] = { nsIFrame::kPrincipalList,
                                            nsIFrame::kPopupList };
     for (size_t i = 0; i < ArrayLength(childLists); ++i) {
       nsFrameList children(aFrame->GetChildList(childLists[i]));
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -1489,17 +1489,17 @@ public:
    * to the list aFontFaceList.
    */
   static nsresult GetFontFacesForFrames(nsIFrame* aFrame,
                                         nsFontFaceList* aFontFaceList);
 
   /**
    * Adds all font faces used within the specified range of text in aFrame,
    * and optionally its continuations, to the list in aFontFaceList.
-   * Pass 0 and PR_INT32_MAX for aStartOffset and aEndOffset to specify the
+   * Pass 0 and INT32_MAX for aStartOffset and aEndOffset to specify the
    * entire text is to be considered.
    */
   static nsresult GetFontFacesForText(nsIFrame* aFrame,
                                       int32_t aStartOffset,
                                       int32_t aEndOffset,
                                       bool aFollowContinuations,
                                       nsFontFaceList* aFontFaceList);
 
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -8105,17 +8105,17 @@ DumpToPNG(nsIPresShell* shell, nsAString
   nsCOMPtr<nsIFile> file = do_CreateInstance("@mozilla.org/file/local;1");
   NS_ENSURE_TRUE(file, NS_ERROR_FAILURE);
   rv = file->InitWithPath(name);
   NS_ENSURE_SUCCESS(rv, rv);
 
   uint64_t length64;
   rv = encoder->Available(&length64);
   NS_ENSURE_SUCCESS(rv, rv);
-  if (length64 > PR_UINT32_MAX)
+  if (length64 > UINT32_MAX)
     return NS_ERROR_FILE_TOO_BIG;
 
   uint32_t length = (uint32_t)length64;
 
   nsCOMPtr<nsIOutputStream> outputStream;
   rv = NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), file);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/layout/base/nsQuoteList.h
+++ b/layout/base/nsQuoteList.h
@@ -23,17 +23,17 @@ struct nsQuoteNode : public nsGenConNode
     , mType(aType)
     , mDepthBefore(0)
   {
     NS_ASSERTION(aType == eStyleContentType_OpenQuote ||
                  aType == eStyleContentType_CloseQuote ||
                  aType == eStyleContentType_NoOpenQuote ||
                  aType == eStyleContentType_NoCloseQuote,
                  "incorrect type");
-    NS_ASSERTION(aContentIndex <= PR_INT32_MAX, "out of range");
+    NS_ASSERTION(aContentIndex <= INT32_MAX, "out of range");
   }
 
   virtual bool InitTextFrame(nsGenConList* aList, 
           nsIFrame* aPseudoFrame, nsIFrame* aTextFrame) MOZ_OVERRIDE;
 
   // is this 'open-quote' or 'no-open-quote'?
   bool IsOpenQuote() {
     return mType == eStyleContentType_OpenQuote ||
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -6153,18 +6153,18 @@ nsBlockFrame::BuildDisplayList(nsDisplay
                          linesDisplayListCollection, this, textOverflow);
         if (NS_FAILED(rv))
           break;
       }
     }
   } else {
     bool nonDecreasingYs = true;
     int32_t lineCount = 0;
-    nscoord lastY = PR_INT32_MIN;
-    nscoord lastYMost = PR_INT32_MIN;
+    nscoord lastY = INT32_MIN;
+    nscoord lastYMost = INT32_MIN;
     for (line_iterator line = begin_lines();
          line != line_end;
          ++line) {
       nsRect lineArea = line->GetVisualOverflowArea();
       rv = DisplayLine(aBuilder, lineArea, aDirtyRect, line, depth, drawnLines,
                        linesDisplayListCollection, this, textOverflow);
       if (NS_FAILED(rv))
         break;
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -410,17 +410,17 @@ nsColumnSetFrame::ChooseColumnStrategy(c
       numColumns = 1;
     }
 
     colHeight = NS_MIN(mLastBalanceHeight,
                        colHeight);
   } else {
     // This is the case when the column-fill property is set to 'auto'.
     // No balancing, so don't limit the column count
-    numColumns = PR_INT32_MAX;
+    numColumns = INT32_MAX;
   }
 
 #ifdef DEBUG_roc
   printf("*** nsColumnSetFrame::ChooseColumnStrategy: numColumns=%d, colWidth=%d, expectedWidthLeftOver=%d, colHeight=%d, colGap=%d\n",
          numColumns, colWidth, expectedWidthLeftOver, colHeight, colGap);
 #endif
   ReflowConfig config = { numColumns, colWidth, expectedWidthLeftOver, colGap, colHeight };
   return config;
@@ -627,17 +627,17 @@ nsColumnSetFrame::ReflowChildren(nsHTMLR
       if (reflowNext)
         child->AddStateBits(NS_FRAME_IS_DIRTY);
 
       nsHTMLReflowState kidReflowState(PresContext(), aReflowState, child,
                                        availSize, availSize.width,
                                        aReflowState.ComputedHeight());
       kidReflowState.mFlags.mIsTopOfPage = true;
       kidReflowState.mFlags.mTableIsSplittable = false;
-      kidReflowState.mFlags.mIsColumnBalancing = aConfig.mBalanceColCount < PR_INT32_MAX;
+      kidReflowState.mFlags.mIsColumnBalancing = aConfig.mBalanceColCount < INT32_MAX;
 
 #ifdef DEBUG_roc
       printf("*** Reflowing child #%d %p: availHeight=%d\n",
              columnCount, (void*)child,availSize.height);
 #endif
 
       // Note if the column's next in flow is not being changed by this incremental reflow.
       // This may allow the current column to avoid trying to pull lines from the next column.
@@ -734,17 +734,17 @@ nsColumnSetFrame::ReflowChildren(nsHTMLR
         aStatus |= NS_FRAME_REFLOW_NEXTINFLOW;
         reflowNext = true;
         kidNextInFlow->RemoveStateBits(NS_FRAME_IS_OVERFLOW_CONTAINER);
       }
 
 
       if ((contentBottom > aReflowState.mComputedMaxHeight ||
           contentBottom > aReflowState.ComputedHeight()) &&
-          aConfig.mBalanceColCount < PR_INT32_MAX) {
+          aConfig.mBalanceColCount < INT32_MAX) {
         // We overflowed vertically, but have not exceeded the number
         // of columns. If we're balancing, then we should try reverting
         // to auto instead.
         aColData.mShouldRevertToAuto = true;
       }
 
       if (columnCount >= aConfig.mBalanceColCount) {
         if (contentBottom >= aReflowState.availableHeight) {
@@ -904,17 +904,17 @@ nsColumnSetFrame::Reflow(nsPresContext* 
   }
   else {
     RemoveStateBits(NS_FRAME_CONTAINS_RELATIVE_HEIGHT);
   }
 
   //------------ Handle Incremental Reflow -----------------
 
   ReflowConfig config = ChooseColumnStrategy(aReflowState);
-  bool isBalancing = config.mBalanceColCount < PR_INT32_MAX;
+  bool isBalancing = config.mBalanceColCount < INT32_MAX;
   
   // If balancing, then we allow the last column to grow to unbounded
   // height during the first reflow. This gives us a way to estimate
   // what the average column height should be, because we can measure
   // the heights of all the columns and sum them up. But don't do this
   // if we have a next in flow because we don't want to suck all its
   // content back here and then have to push it out again!
   nsIFrame* nextInFlow = GetNextInFlow();
@@ -928,17 +928,17 @@ nsColumnSetFrame::Reflow(nsPresContext* 
 
   // Our loop invariant is: colData.mShouldRevertToAuto is true if and only
   // if we've reflowed our children, and during the most recent reflow of
   // children, we were balancing and we overflowed in the block direction.
   do {
     if (colData.mShouldRevertToAuto) {
       config = ChooseColumnStrategy(aReflowState);
       isBalancing = false;
-      config.mBalanceColCount = PR_INT32_MAX;
+      config.mBalanceColCount = INT32_MAX;
     }
 
     bool feasible = ReflowChildren(aDesiredSize, aReflowState,
       aStatus, config, unboundedLastColumn, &carriedOutBottomMargin, colData);
 
     if (isBalancing && !aPresContext->HasPendingInterrupt()) {
       nscoord availableContentHeight = GetAvailableContentHeight(aReflowState);
 
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -287,17 +287,17 @@ nsHTMLFramesetFrame::Init(nsIContent*   
   // Maximum value of mNumRows and mNumCols is NS_MAX_FRAMESET_SPEC_COUNT
   PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < UINT_MAX / sizeof(nscoord));
   mRowSizes  = new nscoord[mNumRows];
   mColSizes  = new nscoord[mNumCols];
   if (!mRowSizes || !mColSizes)
     return NS_ERROR_OUT_OF_MEMORY; 
 
   // Ensure we can't overflow numCells
-  PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < PR_INT32_MAX / NS_MAX_FRAMESET_SPEC_COUNT);
+  PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < INT32_MAX / NS_MAX_FRAMESET_SPEC_COUNT);
   int32_t numCells = mNumRows*mNumCols;
 
   PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < UINT_MAX / sizeof(nsHTMLFramesetBorderFrame*));
   mVerBorders    = new nsHTMLFramesetBorderFrame*[mNumCols];  // 1 more than number of ver borders
   if (!mVerBorders)
     return NS_ERROR_OUT_OF_MEMORY;
 
   for (int verX  = 0; verX < mNumCols; verX++)
@@ -1315,17 +1315,17 @@ nsHTMLFramesetFrame::CanChildResize(bool
 
 void
 nsHTMLFramesetFrame::RecalculateBorderResize()
 {
   if (!mContent) {
     return;
   }
 
-  PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < PR_INT32_MAX / NS_MAX_FRAMESET_SPEC_COUNT);
+  PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < INT32_MAX / NS_MAX_FRAMESET_SPEC_COUNT);
   int32_t numCells = mNumRows * mNumCols; // max number of cells
   PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT
                    < UINT_MAX / sizeof(int32_t) / NS_MAX_FRAMESET_SPEC_COUNT); 
   nsAutoArrayPtr<int32_t> childTypes(new int32_t[numCells]);
   if (NS_UNLIKELY(!childTypes)) {
     return;
   }
   int32_t childTypeIndex = 0;
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -1909,17 +1909,17 @@ public:
    * @param aStartOffset       Skipped (rendered text) start offset
    * @param aSkippedMaxLength  Maximum number of characters to return
    * The iterator can be used to map content offsets to offsets in the returned string, or vice versa.
    */
   virtual nsresult GetRenderedText(nsAString* aAppendToString = nullptr,
                                    gfxSkipChars* aSkipChars = nullptr,
                                    gfxSkipCharsIterator* aSkipIter = nullptr,
                                    uint32_t aSkippedStartOffset = 0,
-                                   uint32_t aSkippedMaxLength = PR_UINT32_MAX)
+                                   uint32_t aSkippedMaxLength = UINT32_MAX)
   { return NS_ERROR_NOT_IMPLEMENTED; }
 
   /**
    * Returns true if the frame contains any non-collapsed characters.
    * This method is only available for text frames, and it will return false
    * for all other frame types.
    */
   virtual bool HasAnyNoncollapsedCharacters()
--- a/layout/generic/nsLineBox.h
+++ b/layout/generic/nsLineBox.h
@@ -137,17 +137,17 @@ protected:
   nsFloatCache* mTail;
 
   friend class nsFloatCacheList;
 };
 
 //----------------------------------------------------------------------
 
 #define LINE_MAX_BREAK_TYPE  ((1 << 4) - 1)
-#define LINE_MAX_CHILD_COUNT PR_INT32_MAX
+#define LINE_MAX_CHILD_COUNT INT32_MAX
 
 #if NS_STYLE_CLEAR_LAST_VALUE > 15
 need to rearrange the mBits bitfield;
 #endif
 
 /**
  * Function to create a line box and initialize it with a single frame.
  * If the frame was moved from another line then you're responsible
--- a/layout/generic/nsLineLayout.cpp
+++ b/layout/generic/nsLineLayout.cpp
@@ -1029,18 +1029,18 @@ nsLineLayout::ReflowFrame(nsIFrame* aFra
         // so do most of it now.
         VerticalAlignFrames(span);
       }
       
       if (!continuingTextRun) {
         if (!psd->mNoWrap && (!LineIsEmpty() || placedFloat)) {
           // record soft break opportunity after this content that can't be
           // part of a text run. This is not a text frame so we know
-          // that offset PR_INT32_MAX means "after the content".
-          if (NotifyOptionalBreakPosition(aFrame->GetContent(), PR_INT32_MAX, optionalBreakAfterFits, eNormalBreak)) {
+          // that offset INT32_MAX means "after the content".
+          if (NotifyOptionalBreakPosition(aFrame->GetContent(), INT32_MAX, optionalBreakAfterFits, eNormalBreak)) {
             // If this returns true then we are being told to actually break here.
             aReflowStatus = NS_INLINE_LINE_BREAK_AFTER(aReflowStatus);
           }
         }
       }
     }
     else {
       PushFrame(aFrame);
--- a/layout/generic/nsLineLayout.h
+++ b/layout/generic/nsLineLayout.h
@@ -200,17 +200,17 @@ public:
   nsPresContext* mPresContext;
 
   /**
    * Record where an optional break could have been placed. During line reflow,
    * frames containing optional break points (e.g., whitespace in text frames)
    * can call SetLastOptionalBreakPosition to record where a break could
    * have been made, but wasn't because we decided to place more content on
    * the line. For non-text frames, offset 0 means
-   * before the content, offset PR_INT32_MAX means after the content.
+   * before the content, offset INT32_MAX means after the content.
    * 
    * Currently this is used to handle cases where a single word comprises
    * multiple frames, and the first frame fits on the line but the whole word
    * doesn't. We look back to the last optional break position and
    * reflow the whole line again, forcing a break at that position. The last
    * optional break position could be in a text frame or else after a frame
    * that cannot be part of a text run, so those are the positions we record.
    * 
@@ -383,17 +383,17 @@ protected:
 #define PFD_SKIPWHENTRIMMINGWHITESPACE  0x00000080
 #define PFD_LASTFLAG                    PFD_SKIPWHENTRIMMINGWHITESPACE
 
     uint8_t mFlags;
 
     void SetFlag(uint32_t aFlag, bool aValue)
     {
       NS_ASSERTION(aFlag<=PFD_LASTFLAG, "bad flag");
-      NS_ASSERTION(aFlag<=PR_UINT8_MAX, "bad flag");
+      NS_ASSERTION(aFlag<=UINT8_MAX, "bad flag");
       NS_ASSERTION(aValue==false || aValue==true, "bad value");
       if (aValue) { // set flag
         mFlags |= aFlag;
       }
       else {        // unset flag
         mFlags &= ~aFlag;
       }
     }
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -523,18 +523,18 @@ nsObjectFrame::GetDesiredSize(nsPresCont
                                 aReflowState.mComputedMaxHeight);
     }
 
 #if defined (MOZ_WIDGET_GTK2)
     // We need to make sure that the size of the object frame does not
     // exceed the maximum size of X coordinates.  See bug #225357 for
     // more information.  In theory Gtk2 can handle large coordinates,
     // but underlying plugins can't.
-    aMetrics.height = NS_MIN(aPresContext->DevPixelsToAppUnits(PR_INT16_MAX), aMetrics.height);
-    aMetrics.width = NS_MIN(aPresContext->DevPixelsToAppUnits(PR_INT16_MAX), aMetrics.width);
+    aMetrics.height = NS_MIN(aPresContext->DevPixelsToAppUnits(INT16_MAX), aMetrics.height);
+    aMetrics.width = NS_MIN(aPresContext->DevPixelsToAppUnits(INT16_MAX), aMetrics.width);
 #endif
   }
 
   // At this point, the width has an unconstrained value only if we have
   // nothing to go on (no width set, no information from the plugin, nothing).
   // Make up a number.
   if (aMetrics.width == NS_UNCONSTRAINEDSIZE) {
     aMetrics.width =
--- a/layout/generic/nsTextFrame.h
+++ b/layout/generic/nsTextFrame.h
@@ -234,17 +234,17 @@ public:
     // an amount to *subtract* from the frame's width (zero if !mChanged)
     nscoord      mDeltaWidth;
   };
   TrimOutput TrimTrailingWhiteSpace(nsRenderingContext* aRC);
   virtual nsresult GetRenderedText(nsAString* aString = nullptr,
                                    gfxSkipChars* aSkipChars = nullptr,
                                    gfxSkipCharsIterator* aSkipIter = nullptr,
                                    uint32_t aSkippedStartOffset = 0,
-                                   uint32_t aSkippedMaxLength = PR_UINT32_MAX);
+                                   uint32_t aSkippedMaxLength = UINT32_MAX);
 
   nsOverflowAreas
     RecomputeOverflow(const nsHTMLReflowState& aBlockReflowState);
 
   enum TextRunType {
     // Anything in reflow (but not intrinsic width calculation) or
     // painting should use the inflated text run (i.e., with font size
     // inflation applied).
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -950,17 +950,17 @@ private:
   gfxTextRun*                   mCurrentFramesAllSameTextRun;
   gfxContext*                   mContext;
   nsIFrame*                     mLineContainer;
   nsTextFrame*                  mLastFrame;
   // The common ancestor of the current frame and the previous leaf frame
   // on the line, or null if there was no previous leaf frame.
   nsIFrame*                     mCommonAncestorWithLastFrame;
   // mMaxTextLength is an upper bound on the size of the text in all mapped frames
-  // The value PR_UINT32_MAX represents overflow; text will be discarded
+  // The value UINT32_MAX represents overflow; text will be discarded
   uint32_t                      mMaxTextLength;
   bool                          mDoubleByteText;
   bool                          mBidiEnabled;
   bool                          mStartOfLine;
   bool                          mSkipIncompleteTextRuns;
   bool                          mCanStopOnThisLine;
   nsTextFrame::TextRunType      mWhichTextRun;
   uint8_t                       mNextRunContextInfo;
@@ -1396,17 +1396,17 @@ void BuildTextRunsScanner::FlushFrames(b
         mNextRunContextInfo |= nsTextFrameUtils::INCOMING_WHITESPACE;
       }
       if (textRun->GetFlags() & gfxTextRunFactory::TEXT_TRAILING_ARABICCHAR) {
         mNextRunContextInfo |= nsTextFrameUtils::INCOMING_ARABICCHAR;
       }
     } else {
       AutoFallibleTArray<uint8_t,BIG_TEXT_NODE_SIZE> buffer;
       uint32_t bufferSize = mMaxTextLength*(mDoubleByteText ? 2 : 1);
-      if (bufferSize < mMaxTextLength || bufferSize == PR_UINT32_MAX ||
+      if (bufferSize < mMaxTextLength || bufferSize == UINT32_MAX ||
           !buffer.AppendElements(bufferSize)) {
         return;
       }
       textRun = BuildTextRunForFrames(buffer.Elements());
     }
   }
 
   if (aFlushLineBreaks) {
@@ -1443,20 +1443,20 @@ void BuildTextRunsScanner::FlushLineBrea
     gTextRuns->RemoveFromCache(deleteTextRun);
     delete deleteTextRun;
   }
   mTextRunsToDelete.Clear();
 }
 
 void BuildTextRunsScanner::AccumulateRunInfo(nsTextFrame* aFrame)
 {
-  if (mMaxTextLength != PR_UINT32_MAX) {
-    NS_ASSERTION(mMaxTextLength < PR_UINT32_MAX - aFrame->GetContentLength(), "integer overflow");
-    if (mMaxTextLength >= PR_UINT32_MAX - aFrame->GetContentLength()) {
-      mMaxTextLength = PR_UINT32_MAX;
+  if (mMaxTextLength != UINT32_MAX) {
+    NS_ASSERTION(mMaxTextLength < UINT32_MAX - aFrame->GetContentLength(), "integer overflow");
+    if (mMaxTextLength >= UINT32_MAX - aFrame->GetContentLength()) {
+      mMaxTextLength = UINT32_MAX;
     } else {
       mMaxTextLength += aFrame->GetContentLength();
     }
   }
   mDoubleByteText |= aFrame->GetContent()->GetText()->Is2b();
   mLastFrame = aFrame;
   mCommonAncestorWithLastFrame = aFrame->GetParent();
 
@@ -2093,17 +2093,17 @@ BuildTextRunsScanner::BuildTextRunForFra
 // context for the line-breaker, when the textrun has already been created.
 // So it does the same walk over the mMappedFlows, but doesn't actually
 // build a new textrun.
 bool
 BuildTextRunsScanner::SetupLineBreakerContext(gfxTextRun *aTextRun)
 {
   AutoFallibleTArray<uint8_t,BIG_TEXT_NODE_SIZE> buffer;
   uint32_t bufferSize = mMaxTextLength*(mDoubleByteText ? 2 : 1);
-  if (bufferSize < mMaxTextLength || bufferSize == PR_UINT32_MAX) {
+  if (bufferSize < mMaxTextLength || bufferSize == UINT32_MAX) {
     return false;
   }
   void *textPtr = buffer.AppendElements(bufferSize);
   if (!textPtr) {
     return false;
   }
 
   gfxSkipCharsBuilder builder;
@@ -2647,33 +2647,33 @@ static bool IsChineseOrJapanese(nsIFrame
          (language->GetLength() == 2 || lang[2] == '-');
 }
 
 #ifdef DEBUG
 static bool IsInBounds(const gfxSkipCharsIterator& aStart, int32_t aContentLength,
                          uint32_t aOffset, uint32_t aLength) {
   if (aStart.GetSkippedOffset() > aOffset)
     return false;
-  if (aContentLength == PR_INT32_MAX)
+  if (aContentLength == INT32_MAX)
     return true;
   gfxSkipCharsIterator iter(aStart);
   iter.AdvanceOriginal(aContentLength);
   return iter.GetSkippedOffset() >= aOffset + aLength;
 }
 #endif
 
 class NS_STACK_CLASS PropertyProvider : public gfxTextRun::PropertyProvider {
 public:
   /**
    * Use this constructor for reflow, when we don't know what text is
    * really mapped by the frame and we have a lot of other data around.
    * 
-   * @param aLength can be PR_INT32_MAX to indicate we cover all the text
+   * @param aLength can be INT32_MAX to indicate we cover all the text
    * associated with aFrame up to where its flow chain ends in the given
-   * textrun. If PR_INT32_MAX is passed, justification and hyphen-related methods
+   * textrun. If INT32_MAX is passed, justification and hyphen-related methods
    * cannot be called, nor can GetOriginalLength().
    */
   PropertyProvider(gfxTextRun* aTextRun, const nsStyleText* aTextStyle,
                    const nsTextFragment* aFrag, nsTextFrame* aFrame,
                    const gfxSkipCharsIterator& aStart, int32_t aLength,
                    nsIFrame* aLineContainer,
                    nscoord aOffsetFromBlockOriginForTabs,
                    nsTextFrame::TextRunType aWhichTextRun)
@@ -2746,19 +2746,19 @@ public:
                               gfxSkipCharsIterator* aEnd);
 
   const nsStyleText* GetStyleText() { return mTextStyle; }
   nsTextFrame* GetFrame() { return mFrame; }
   // This may not be equal to the frame offset/length in because we may have
   // adjusted for whitespace trimming according to the state bits set in the frame
   // (for the static provider)
   const gfxSkipCharsIterator& GetStart() { return mStart; }
-  // May return PR_INT32_MAX if that was given to the constructor
+  // May return INT32_MAX if that was given to the constructor
   uint32_t GetOriginalLength() {
-    NS_ASSERTION(mLength != PR_INT32_MAX, "Length not known");
+    NS_ASSERTION(mLength != INT32_MAX, "Length not known");
     return mLength;
   }
   const nsTextFragment* GetFragment() { return mFrag; }
 
   gfxFontGroup* GetFontGroup() {
     if (!mFontGroup)
       InitFontGroupAndFontMetrics();
     return mFontGroup;
@@ -2795,17 +2795,17 @@ protected:
   gfxSkipCharsIterator  mTempIterator;
   
   // Either null, or pointing to the frame's tabWidthProperty.
   TabWidthStore*        mTabWidths;
   // how far we've done tab-width calculation; this is ONLY valid
   // when mTabWidths is NULL (otherwise rely on mTabWidths->mLimit instead)
   uint32_t              mTabWidthsAnalyzedLimit;
 
-  int32_t               mLength; // DOM string length, may be PR_INT32_MAX
+  int32_t               mLength; // DOM string length, may be INT32_MAX
   gfxFloat              mWordSpacing;     // space for each whitespace char
   gfxFloat              mLetterSpacing;   // space for each letter
   gfxFloat              mJustificationSpacing;
   gfxFloat              mHyphenWidth;
   gfxFloat              mOffsetFromBlockOriginForTabs;
   bool                  mReflowing;
   nsTextFrame::TextRunType mWhichTextRun;
 };
@@ -3094,17 +3094,17 @@ PropertyProvider::GetHyphenWidth()
   return mHyphenWidth;
 }
 
 void
 PropertyProvider::GetHyphenationBreaks(uint32_t aStart, uint32_t aLength,
                                        bool* aBreakBefore)
 {
   NS_PRECONDITION(IsInBounds(mStart, mLength, aStart, aLength), "Range out of bounds");
-  NS_PRECONDITION(mLength != PR_INT32_MAX, "Can't call this with undefined length");
+  NS_PRECONDITION(mLength != INT32_MAX, "Can't call this with undefined length");
 
   if (!mTextStyle->WhiteSpaceCanWrap() ||
       mTextStyle->mHyphens == NS_STYLE_HYPHENS_NONE)
   {
     memset(aBreakBefore, false, aLength*sizeof(bool));
     return;
   }
 
@@ -3164,17 +3164,17 @@ static uint32_t GetSkippedDistance(const
 {
   return aEnd.GetSkippedOffset() - aStart.GetSkippedOffset();
 }
 
 void
 PropertyProvider::FindJustificationRange(gfxSkipCharsIterator* aStart,
                                          gfxSkipCharsIterator* aEnd)
 {
-  NS_PRECONDITION(mLength != PR_INT32_MAX, "Can't call this with undefined length");
+  NS_PRECONDITION(mLength != INT32_MAX, "Can't call this with undefined length");
   NS_ASSERTION(aStart && aEnd, "aStart or/and aEnd is null");
 
   aStart->SetOriginalOffset(mStart.GetOriginalOffset());
   aEnd->SetOriginalOffset(mStart.GetOriginalOffset() + mLength);
 
   // Ignore first cluster at start of line for justification purposes
   if (mFrame->GetStateBits() & TEXT_START_OF_LINE) {
     while (aStart->GetOriginalOffset() < aEnd->GetOriginalOffset()) {
@@ -3194,17 +3194,17 @@ PropertyProvider::FindJustificationRange
         break;
     }
   }
 }
 
 void
 PropertyProvider::SetupJustificationSpacing()
 {
-  NS_PRECONDITION(mLength != PR_INT32_MAX, "Can't call this with undefined length");
+  NS_PRECONDITION(mLength != INT32_MAX, "Can't call this with undefined length");
 
   if (!(mFrame->GetStateBits() & TEXT_JUSTIFICATION_ENABLED))
     return;
 
   gfxSkipCharsIterator start(mStart), end(mStart);
   // We can't just use our mLength here; when InitializeForDisplay is
   // called with false for aTrimAfter, we still shouldn't be assigning
   // justification space to any trailing whitespace.
@@ -4011,17 +4011,17 @@ public:
                                  InlineMinWidthData *aData);
   virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                                   InlinePrefWidthData *aData);
   
   virtual nsresult GetRenderedText(nsAString* aString = nullptr,
                                    gfxSkipChars* aSkipChars = nullptr,
                                    gfxSkipCharsIterator* aSkipIter = nullptr,
                                    uint32_t aSkippedStartOffset = 0,
-                                   uint32_t aSkippedMaxLength = PR_UINT32_MAX)
+                                   uint32_t aSkippedMaxLength = UINT32_MAX)
   { return NS_ERROR_NOT_IMPLEMENTED; } // Call on a primary text frame only
 
 protected:
   nsContinuingTextFrame(nsStyleContext* aContext) : nsTextFrame(aContext) {}
   nsIFrame* mPrevContinuation;
 };
 
 NS_IMETHODIMP
@@ -6953,18 +6953,18 @@ nsTextFrame::AddInlineMinWidthForFlow(ns
     return;
 
   // Pass null for the line container. This will disable tab spacing, but that's
   // OK since we can't really handle tabs for intrinsic sizing anyway.
   const nsStyleText* textStyle = GetStyleText();
   const nsTextFragment* frag = mContent->GetText();
 
   // If we're hyphenating, the PropertyProvider needs the actual length;
-  // otherwise we can just pass PR_INT32_MAX to mean "all the text"
-  int32_t len = PR_INT32_MAX;
+  // otherwise we can just pass INT32_MAX to mean "all the text"
+  int32_t len = INT32_MAX;
   bool hyphenating = frag->GetLength() > 0 &&
     (textStyle->mHyphens == NS_STYLE_HYPHENS_AUTO ||
      (textStyle->mHyphens == NS_STYLE_HYPHENS_MANUAL &&
       (textRun->GetFlags() & gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS) != 0));
   if (hyphenating) {
     gfxSkipCharsIterator tmp(iter);
     len = NS_MIN<int32_t>(GetContentOffset() + GetInFlowContentLength(),
                  tmp.ConvertSkippedToOriginal(flowEndInTextRun)) - iter.GetOriginalOffset();
@@ -7126,17 +7126,17 @@ nsTextFrame::AddInlinePrefWidthForFlow(n
     return;
 
   // Pass null for the line container. This will disable tab spacing, but that's
   // OK since we can't really handle tabs for intrinsic sizing anyway.
   
   const nsStyleText* textStyle = GetStyleText();
   const nsTextFragment* frag = mContent->GetText();
   PropertyProvider provider(textRun, textStyle, frag, this,
-                            iter, PR_INT32_MAX, nullptr, 0, aTextRunType);
+                            iter, INT32_MAX, nullptr, 0, aTextRunType);
 
   bool collapseWhitespace = !textStyle->WhiteSpaceIsSignificant();
   bool preformatNewlines = textStyle->NewlineIsSignificant();
   bool preformatTabs = textStyle->WhiteSpaceIsSignificant();
   gfxFloat tabWidth = -1;
   uint32_t start =
     FindStartAfterSkippingWhitespace(&provider, aData, textStyle, &iter, flowEndInTextRun);
 
@@ -7887,17 +7887,17 @@ nsTextFrame::ReflowText(nsLineLayout& aL
     ++charsFit;
   }
   // That might have taken us beyond our assigned content range (because
   // we might have advanced over some skipped chars that extend outside
   // this frame), so get back in.
   int32_t lastBreak = -1;
   if (charsFit >= limitLength) {
     charsFit = limitLength;
-    if (transformedLastBreak != PR_UINT32_MAX) {
+    if (transformedLastBreak != UINT32_MAX) {
       // lastBreak is needed.
       // This may set lastBreak greater than 'length', but that's OK
       lastBreak = end.ConvertSkippedToOriginal(transformedOffset + transformedLastBreak);
     }
     end.SetOriginalOffset(offset + charsFit);
     // If we were forced to fit, and the break position is after a soft hyphen,
     // note that this is a hyphenation break.
     if ((forceBreak >= 0 || forceBreakAfter) &&
--- a/layout/style/Declaration.cpp
+++ b/layout/style/Declaration.cpp
@@ -13,17 +13,17 @@
 #include "mozilla/css/Declaration.h"
 #include "nsPrintfCString.h"
 
 namespace mozilla {
 namespace css {
 
 // check that we can fit all the CSS properties into a uint8_t
 // for the mOrder array - if not, might need to use uint16_t!
-MOZ_STATIC_ASSERT(eCSSProperty_COUNT_no_shorthands - 1 <= PR_UINT8_MAX,
+MOZ_STATIC_ASSERT(eCSSProperty_COUNT_no_shorthands - 1 <= UINT8_MAX,
                   "CSS longhand property numbers no longer fit in a uint8_t");
 
 Declaration::Declaration()
   : mImmutable(false)
 {
   MOZ_COUNT_CTOR(mozilla::css::Declaration);
 }
 
--- a/layout/style/StyleRule.cpp
+++ b/layout/style/StyleRule.cpp
@@ -304,17 +304,17 @@ nsCSSSelector::nsCSSSelector(void)
     mAttrList(nullptr),
     mNegations(nullptr),
     mNext(nullptr),
     mNameSpace(kNameSpaceID_Unknown),
     mOperator(0),
     mPseudoType(nsCSSPseudoElements::ePseudo_NotPseudoElement)
 {
   MOZ_COUNT_CTOR(nsCSSSelector);
-  MOZ_STATIC_ASSERT(nsCSSPseudoElements::ePseudo_MAX < PR_INT16_MAX,
+  MOZ_STATIC_ASSERT(nsCSSPseudoElements::ePseudo_MAX < INT16_MAX,
                     "nsCSSPseudoElements::Type values overflow mPseudoType");
 }
 
 nsCSSSelector*
 nsCSSSelector::Clone(bool aDeepNext, bool aDeepNegations) const
 {
   nsCSSSelector *result = new nsCSSSelector();
   if (!result)
--- a/layout/style/StyleRule.h
+++ b/layout/style/StyleRule.h
@@ -178,17 +178,17 @@ private:
   int32_t CalcWeightWithoutNegations() const;
 
 public:
   // Get and set the selector's pseudo type
   nsCSSPseudoElements::Type PseudoType() const {
     return static_cast<nsCSSPseudoElements::Type>(mPseudoType);
   }
   void SetPseudoType(nsCSSPseudoElements::Type aType) {
-    NS_ASSERTION(aType > PR_INT16_MIN && aType < PR_INT16_MAX, "Out of bounds");
+    NS_ASSERTION(aType > INT16_MIN && aType < INT16_MAX, "Out of bounds");
     mPseudoType = static_cast<int16_t>(aType);
   }
 
   size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const;
 
   // For case-sensitive documents, mLowercaseTag is the same as mCasedTag,
   // but in case-insensitive documents (HTML) mLowercaseTag is lowercase.
   // Also, for pseudo-elements mCasedTag will be null but mLowercaseTag
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -593,17 +593,17 @@ public:
   static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; }
   static PLDHashNumber HashKey(KeyTypePointer aKey) {
     MOZ_STATIC_ASSERT(sizeof(PLDHashNumber) == sizeof(uint32_t),
                       "this hash function assumes PLDHashNumber is uint32_t");
     MOZ_STATIC_ASSERT(PLDHashNumber(-1) > PLDHashNumber(0),
                       "this hash function assumes PLDHashNumber is uint32_t");
     float key = *aKey;
     NS_ABORT_IF_FALSE(0.0f <= key && key <= 1.0f, "out of range");
-    return PLDHashNumber(key * PR_UINT32_MAX);
+    return PLDHashNumber(key * UINT32_MAX);
   }
   enum { ALLOW_MEMMOVE = true };
 
 private:
   const float mValue;
 };
 
 struct KeyframeData {
--- a/layout/style/nsCSSDataBlock.h
+++ b/layout/style/nsCSSDataBlock.h
@@ -96,17 +96,17 @@ private:
     }
 
 public:
     // Ideally, |nsCSSProperty| would be |enum nsCSSProperty : int16_t|.  But
     // not all of the compilers we use are modern enough to support small
     // enums.  So we manually squeeze nsCSSProperty into 16 bits ourselves.
     // The static assertion below ensures it fits.
     typedef int16_t CompressedCSSProperty;
-    static const size_t MaxCompressedCSSProperty = PR_INT16_MAX;
+    static const size_t MaxCompressedCSSProperty = INT16_MAX;
 
 private:
     static size_t DataSize(uint32_t aNumProps) {
         return size_t(aNumProps) *
                (sizeof(nsCSSValue) + sizeof(CompressedCSSProperty));
     }
 
     int32_t mStyleBits; // the structs for which we have data, according to
--- a/layout/style/nsCSSRules.cpp
+++ b/layout/style/nsCSSRules.cpp
@@ -671,31 +671,31 @@ GroupRule::GetCssRules(nsIDOMCSSRuleList
 nsresult
 GroupRule::InsertRule(const nsAString & aRule, uint32_t aIndex, uint32_t* _retval)
 {
   NS_ENSURE_TRUE(mSheet, NS_ERROR_FAILURE);
   
   if (aIndex > uint32_t(mRules.Count()))
     return NS_ERROR_DOM_INDEX_SIZE_ERR;
 
-  NS_ASSERTION(uint32_t(mRules.Count()) <= PR_INT32_MAX,
+  NS_ASSERTION(uint32_t(mRules.Count()) <= INT32_MAX,
                "Too many style rules!");
 
   return mSheet->InsertRuleIntoGroup(aRule, this, aIndex, _retval);
 }
 
 nsresult
 GroupRule::DeleteRule(uint32_t aIndex)
 {
   NS_ENSURE_TRUE(mSheet, NS_ERROR_FAILURE);
 
   if (aIndex >= uint32_t(mRules.Count()))
     return NS_ERROR_DOM_INDEX_SIZE_ERR;
 
-  NS_ASSERTION(uint32_t(mRules.Count()) <= PR_INT32_MAX,
+  NS_ASSERTION(uint32_t(mRules.Count()) <= INT32_MAX,
                "Too many style rules!");
 
   return mSheet->DeleteRuleFromGroup(this, aIndex);
 }
 
 /* virtual */ size_t
 GroupRule::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
--- a/layout/style/nsCSSScanner.cpp
+++ b/layout/style/nsCSSScanner.cpp
@@ -1236,19 +1236,19 @@ nsCSSScanner::ParseNumber(int32_t c, nsC
   if (gotE) {
     // pow(), not powf(), because at least wince doesn't have the latter.
     // And explicitly cast everything to doubles to avoid issues with
     // overloaded pow() on Windows.
     value *= pow(10.0, double(expSign * exponent));
   } else if (!gotDot) {
     // Clamp values outside of integer range.
     if (sign > 0) {
-      aToken.mInteger = int32_t(NS_MIN(intPart, double(PR_INT32_MAX)));
+      aToken.mInteger = int32_t(NS_MIN(intPart, double(INT32_MAX)));
     } else {
-      aToken.mInteger = int32_t(NS_MAX(-intPart, double(PR_INT32_MIN)));
+      aToken.mInteger = int32_t(NS_MAX(-intPart, double(INT32_MIN)));
     }
     aToken.mIntegerValid = true;
   }
 
   nsString& ident = aToken.mIdent;
   ident.Truncate();
 
   // Look at character that terminated the number
--- a/layout/style/nsCSSStyleSheet.cpp
+++ b/layout/style/nsCSSStyleSheet.cpp
@@ -1817,17 +1817,17 @@ nsCSSStyleSheet::InsertRuleInternal(cons
   nsresult result;
   result = WillDirty();
   if (NS_FAILED(result))
     return result;
   
   if (aIndex > uint32_t(mInner->mOrderedRules.Count()))
     return NS_ERROR_DOM_INDEX_SIZE_ERR;
   
-  NS_ASSERTION(uint32_t(mInner->mOrderedRules.Count()) <= PR_INT32_MAX,
+  NS_ASSERTION(uint32_t(mInner->mOrderedRules.Count()) <= INT32_MAX,
                "Too many style rules!");
 
   // Hold strong ref to the CSSLoader in case the document update
   // kills the document
   nsRefPtr<css::Loader> loader;
   if (mDocument) {
     loader = mDocument->CSSLoader();
     NS_ASSERTION(loader, "Document with no CSS loader!");
@@ -1951,17 +1951,17 @@ nsCSSStyleSheet::DeleteRule(uint32_t aIn
   mozAutoDocUpdate updateBatch(mDocument, UPDATE_STYLE, true);
     
   result = WillDirty();
 
   if (NS_SUCCEEDED(result)) {
     if (aIndex >= uint32_t(mInner->mOrderedRules.Count()))
       return NS_ERROR_DOM_INDEX_SIZE_ERR;
 
-    NS_ASSERTION(uint32_t(mInner->mOrderedRules.Count()) <= PR_INT32_MAX,
+    NS_ASSERTION(uint32_t(mInner->mOrderedRules.Count()) <= INT32_MAX,
                  "Too many style rules!");
 
     // Hold a strong ref to the rule so it doesn't die when we RemoveObjectAt
     nsRefPtr<css::Rule> rule = mInner->mOrderedRules.ObjectAt(aIndex);
     if (rule) {
       mInner->mOrderedRules.RemoveObjectAt(aIndex);
       rule->SetStyleSheet(nullptr);
       DidDirty();
--- a/layout/style/nsFontFaceLoader.cpp
+++ b/layout/style/nsFontFaceLoader.cpp
@@ -872,17 +872,17 @@ nsUserFontSet::SyncLoadFontData(gfxProxy
   NS_ENSURE_SUCCESS(rv, rv);
 
   uint64_t bufferLength64;
   rv = stream->Available(&bufferLength64);
   NS_ENSURE_SUCCESS(rv, rv);
   if (bufferLength64 == 0) {
     return NS_ERROR_FAILURE;
   }
-  if (bufferLength64 > PR_UINT32_MAX) {
+  if (bufferLength64 > UINT32_MAX) {
     return NS_ERROR_FILE_TOO_BIG;
   }
   aBufferLength = static_cast<uint32_t>(bufferLength64);
 
   // read all the decoded data
   aBuffer = static_cast<uint8_t*> (NS_Alloc(sizeof(uint8_t) * aBufferLength));
   if (!aBuffer) {
     aBufferLength = 0;
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -41,17 +41,17 @@ nsStyleContext::nsStyleContext(nsStyleCo
     mRuleNode(aRuleNode),
     mAllocations(nullptr),
     mCachedResetData(nullptr),
     mBits(((uint32_t)aPseudoType) << NS_STYLE_CONTEXT_TYPE_SHIFT),
     mRefCnt(0)
 {
   // This check has to be done "backward", because if it were written the
   // more natural way it wouldn't fail even when it needed to.
-  MOZ_STATIC_ASSERT((PR_UINT32_MAX >> NS_STYLE_CONTEXT_TYPE_SHIFT) >=
+  MOZ_STATIC_ASSERT((UINT32_MAX >> NS_STYLE_CONTEXT_TYPE_SHIFT) >=
                     nsCSSPseudoElements::ePseudo_MAX,
                     "pseudo element bits no longer fit in a uint32_t");
 
   mNextSibling = this;
   mPrevSibling = this;
   if (mParent) {
     mParent->AddRef();
     mParent->AddChild(this);
--- a/layout/style/nsStyleContext.h
+++ b/layout/style/nsStyleContext.h
@@ -61,27 +61,27 @@ public:
                  nsCSSPseudoElements::Type aPseudoType,
                  nsRuleNode* aRuleNode);
   ~nsStyleContext();
 
   void* operator new(size_t sz, nsPresContext* aPresContext) CPP_THROW_NEW;
   void Destroy();
 
   nsrefcnt AddRef() {
-    if (mRefCnt == PR_UINT32_MAX) {
+    if (mRefCnt == UINT32_MAX) {
       NS_WARNING("refcount overflow, leaking object");
       return mRefCnt;
     }
     ++mRefCnt;
     NS_LOG_ADDREF(this, mRefCnt, "nsStyleContext", sizeof(nsStyleContext));
     return mRefCnt;
   }
 
   nsrefcnt Release() {
-    if (mRefCnt == PR_UINT32_MAX) {
+    if (mRefCnt == UINT32_MAX) {
       NS_WARNING("refcount overflow, leaking object");
       return mRefCnt;
     }
     --mRefCnt;
     NS_LOG_RELEASE(this, mRefCnt, "nsStyleContext");
     if (mRefCnt == 0) {
       Destroy();
       return 0;
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -1564,17 +1564,17 @@ ConvertToPixelCoord(const nsStyleCoord& 
     case eStyleUnit_Factor:
       pixelValue = aCoord.GetFactorValue();
       break;
     default:
       NS_NOTREACHED("unexpected unit for image crop rect");
       return 0;
   }
   NS_ABORT_IF_FALSE(pixelValue >= 0, "we ensured non-negative while parsing");
-  pixelValue = NS_MIN(pixelValue, double(PR_INT32_MAX)); // avoid overflow
+  pixelValue = NS_MIN(pixelValue, double(INT32_MAX)); // avoid overflow
   return NS_lround(pixelValue);
 }
 
 bool
 nsStyleImage::ComputeActualCropRect(nsIntRect& aActualCropRect,
                                     bool* aIsEntireImage) const
 {
   if (mType != eStyleImageType_Image)
--- a/layout/svg/nsSVGUtils.h
+++ b/layout/svg/nsSVGUtils.h
@@ -557,18 +557,18 @@ public:
                                                const gfxMatrix& aMatrix);
 
   /**
    * Convert a floating-point value to a 32-bit integer value, clamping to
    * the range of valid integers.
    */
   static int32_t ClampToInt(double aVal)
   {
-    return NS_lround(NS_MAX(double(PR_INT32_MIN),
-                            NS_MIN(double(PR_INT32_MAX), aVal)));
+    return NS_lround(NS_MAX(double(INT32_MIN),
+                            NS_MIN(double(INT32_MAX), aVal)));
   }
 
   static nscolor GetFallbackOrPaintColor(gfxContext *aContext,
                                          nsStyleContext *aStyleContext,
                                          nsStyleSVGPaint nsStyleSVG::*aFillOrStroke);
 
   /**
    * Set up cairo context with an object pattern
--- a/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -1897,17 +1897,17 @@ nsMenuPopupFrame::CreatePopupView()
   }
 
   nsIViewManager* viewManager = PresContext()->GetPresShell()->GetViewManager();
   NS_ASSERTION(nullptr != viewManager, "null view manager");
 
   // Create a view
   nsIView* parentView = viewManager->GetRootView();
   nsViewVisibility visibility = nsViewVisibility_kHide;
-  int32_t zIndex = PR_INT32_MAX;
+  int32_t zIndex = INT32_MAX;
   bool    autoZIndex = false;
 
   NS_ASSERTION(parentView, "no parent view");
 
   // Create a view
   nsIView *view = viewManager->CreateView(GetRect(), parentView, visibility);
   if (view) {
     viewManager->SetViewZIndex(view, autoZIndex, zIndex);
--- a/layout/xul/base/src/nsXULPopupManager.cpp
+++ b/layout/xul/base/src/nsXULPopupManager.cpp
@@ -187,17 +187,17 @@ nsXULPopupManager::Rollup(uint32_t aCoun
       while (first->GetParent())
         first = first->GetParent();
       lastRolledUpPopup = first->Content();
     }
 
     // if a number of popups to close has been specified, determine the last
     // popup to close
     nsIContent* lastPopup = nullptr;
-    if (aCount != PR_UINT32_MAX) {
+    if (aCount != UINT32_MAX) {
       nsMenuChainItem* last = item;
       while (--aCount && last->GetParent()) {
         last = last->GetParent();
       }
       if (last) {
         lastPopup = last->Content();
       }
     }
--- a/modules/libjar/nsJAR.cpp
+++ b/modules/libjar/nsJAR.cpp
@@ -420,17 +420,17 @@ nsJAR::LoadEntry(const nsACString &aFile
   rv = GetInputStream(aFilename, getter_AddRefs(manifestStream));
   if (NS_FAILED(rv)) return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST;
   
   //-- Read the manifest file into memory
   char* buf;
   uint64_t len64;
   rv = manifestStream->Available(&len64);
   if (NS_FAILED(rv)) return rv;
-  NS_ENSURE_TRUE(len64 < PR_UINT32_MAX, NS_ERROR_FILE_CORRUPTED); // bug 164695
+  NS_ENSURE_TRUE(len64 < UINT32_MAX, NS_ERROR_FILE_CORRUPTED); // bug 164695
   uint32_t len = (uint32_t)len64;
   buf = (char*)malloc(len+1);
   if (!buf) return NS_ERROR_OUT_OF_MEMORY;
   uint32_t bytesRead;
   rv = manifestStream->Read(buf, len, &bytesRead);
   if (bytesRead != len) 
     rv = NS_ERROR_FILE_CORRUPTED;
   if (NS_FAILED(rv)) {
--- a/modules/libjar/nsJARChannel.cpp
+++ b/modules/libjar/nsJARChannel.cpp
@@ -131,17 +131,17 @@ nsJARInputThunk::EnsureJarStream()
         return rv;
     }
 
     // ask the JarStream for the content length
     uint64_t avail;
     rv = mJarStream->Available((uint64_t *) &avail);
     if (NS_FAILED(rv)) return rv;
 
-    mContentLength = avail < PR_INT32_MAX ? (int32_t) avail : -1;
+    mContentLength = avail < INT32_MAX ? (int32_t) avail : -1;
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsJARInputThunk::Close()
 {
     if (mJarStream)
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -100,17 +100,17 @@ NS_IMPL_THREADSAFE_RELEASE(nsZipHandle)
 nsresult nsZipHandle::Init(nsIFile *file, nsZipHandle **ret)
 {
   mozilla::AutoFDClose fd;
   nsresult rv = file->OpenNSPRFileDesc(PR_RDONLY, 0000, &fd.rwget());
   if (NS_FAILED(rv))
     return rv;
 
   int64_t size = PR_Available64(fd);
-  if (size >= PR_INT32_MAX)
+  if (size >= INT32_MAX)
     return NS_ERROR_FILE_TOO_BIG;
 
   PRFileMap *map = PR_CreateFileMap(fd, size, PR_PROT_READONLY);
   if (!map)
     return NS_ERROR_FAILURE;
   
   uint8_t *buf = (uint8_t*) PR_MemMap(map, 0, (uint32_t) size);
   // Bug 525755: PR_MemMap fails when fd points at something other than a normal file.
--- a/modules/libpref/src/Preferences.cpp
+++ b/modules/libpref/src/Preferences.cpp
@@ -749,17 +749,17 @@ static nsresult openPrefFile(nsIFile* aF
   nsresult rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), aFile);
   if (NS_FAILED(rv)) 
     return rv;        
 
   uint64_t fileSize64;
   rv = inStr->Available(&fileSize64);
   if (NS_FAILED(rv))
     return rv;
-  NS_ENSURE_TRUE(fileSize64 <= PR_UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
+  NS_ENSURE_TRUE(fileSize64 <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
 
   uint32_t fileSize = (uint32_t)fileSize64;
   nsAutoArrayPtr<char> fileBuffer(new char[fileSize]);
   if (fileBuffer == nullptr)
     return NS_ERROR_OUT_OF_MEMORY;
 
   PrefParseState ps;
   PREF_InitParseState(&ps, PREF_ReaderCallback, NULL);
--- a/netwerk/base/public/nsASocketHandler.h
+++ b/netwerk/base/public/nsASocketHandler.h
@@ -9,17 +9,17 @@
 // methods are only called on the socket thread.
 
 class nsASocketHandler : public nsISupports
 {
 public:
     nsASocketHandler()
         : mCondition(NS_OK)
         , mPollFlags(0)
-        , mPollTimeout(PR_UINT16_MAX)
+        , mPollTimeout(UINT16_MAX)
         {}
 
     //
     // this condition variable will be checked to determine if the socket
     // handler should be detached.  it must only be accessed on the socket
     // thread.
     //
     nsresult mCondition;
@@ -31,18 +31,18 @@ public:
     //
     uint16_t mPollFlags;
 
     //
     // this value specifies the maximum amount of time in seconds that may be
     // spent waiting for activity on this socket.  if this timeout is reached,
     // then OnSocketReady will be called with outFlags = -1.
     //
-    // the default value for this member is PR_UINT16_MAX, which disables the
-    // timeout error checking.  (i.e., a timeout value of PR_UINT16_MAX is
+    // the default value for this member is UINT16_MAX, which disables the
+    // timeout error checking.  (i.e., a timeout value of UINT16_MAX is
     // never reached.)
     //
     uint16_t mPollTimeout;
 
     //
     // called to service a socket
     // 
     // params:
--- a/netwerk/base/public/nsICryptoHMAC.idl
+++ b/netwerk/base/public/nsICryptoHMAC.idl
@@ -63,17 +63,17 @@ interface nsICryptoHMAC : nsISupports
     void update([const, array, size_is(aLen)] in octet aData, in unsigned long aLen);
 
     /**
      * Calculates and updates a new hash based on a given data stream.
      *
      * @param aStream an input stream to read from.
      *
      * @param aLen how much to read from the given |aStream|.  Passing
-     *        PR_UINT32_MAX indicates that all data available will be used 
+     *        UINT32_MAX indicates that all data available will be used 
      *        to update the hash. 
      *
      * @throws NS_ERROR_NOT_INITIALIZED if |init| has not been 
      *         called.
      *
      * @throws NS_ERROR_NOT_AVAILABLE if the requested amount of 
      *         data to be calculated into the hash is not available.
      *
--- a/netwerk/base/public/nsICryptoHash.idl
+++ b/netwerk/base/public/nsICryptoHash.idl
@@ -67,17 +67,17 @@ interface nsICryptoHash : nsISupports
     void update([const, array, size_is(aLen)] in octet aData, in unsigned long aLen);
 
     /**
      * Calculates and updates a new hash based on a given data stream.
      *
      * @param aStream an input stream to read from.
      *
      * @param aLen how much to read from the given |aStream|.  Passing
-     *        PR_UINT32_MAX indicates that all data available will be used 
+     *        UINT32_MAX indicates that all data available will be used 
      *        to update the hash. 
      *
      * @throws NS_ERROR_NOT_INITIALIZED if |init| has not been 
      *         called.
      *
      * @throws NS_ERROR_NOT_AVAILABLE if the requested amount of 
      *         data to be calculated into the hash is not available.
      *
--- a/netwerk/base/public/nsIProtocolProxyService.idl
+++ b/netwerk/base/public/nsIProtocolProxyService.idl
@@ -117,17 +117,17 @@ interface nsIProtocolProxyService : nsIS
      *        The proxy hostname or IP address.
      * @param aPort
      *        The proxy port.
      * @param aFlags
      *        Flags associated with this connection.  See nsIProxyInfo.idl
      *        for currently defined flags.
      * @param aFailoverTimeout
      *        Specifies the length of time (in seconds) to ignore this proxy if
-     *        this proxy fails.  Pass PR_UINT32_MAX to specify the default
+     *        this proxy fails.  Pass UINT32_MAX to specify the default
      *        timeout value, causing nsIProxyInfo::failoverTimeout to be
      *        assigned the default value.
      * @param aFailoverProxy
      *        Specifies the next proxy to try if this proxy fails.  This
      *        parameter may be null.
      */
     nsIProxyInfo newProxyInfo(in ACString aType, in AUTF8String aHost,
                               in long aPort, in unsigned long aFlags,
--- a/netwerk/base/public/nsISocketTransport.idl
+++ b/netwerk/base/public/nsISocketTransport.idl
@@ -75,17 +75,17 @@ interface nsISocketTransport : nsITransp
     attribute nsIInterfaceRequestor securityCallbacks;
    
     /**
      * Test if this socket transport is (still) connected.
      */
     boolean isAlive();
 
     /**
-     * Socket timeouts in seconds.  To specify no timeout, pass PR_UINT32_MAX
+     * Socket timeouts in seconds.  To specify no timeout, pass UINT32_MAX
      * as aValue to setTimeout.  The implementation may truncate timeout values
      * to a smaller range of values (e.g., 0 to 0xFFFF).
      */
     unsigned long getTimeout(in unsigned long aType);
     void          setTimeout(in unsigned long aType, in unsigned long aValue);
 
     /**
      * Values for the aType parameter passed to get/setTimeout.
--- a/netwerk/base/public/nsNetUtil.h
+++ b/netwerk/base/public/nsNetUtil.h
@@ -723,17 +723,17 @@ NS_NewProxyInfo(const nsACString &type,
                 int32_t           port,
                 uint32_t          flags,
                 nsIProxyInfo    **result)
 {
     nsresult rv;
     nsCOMPtr<nsIProtocolProxyService> pps =
             do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID, &rv);
     if (NS_SUCCEEDED(rv))
-        rv = pps->NewProxyInfo(type, host, port, flags, PR_UINT32_MAX, nullptr,
+        rv = pps->NewProxyInfo(type, host, port, flags, UINT32_MAX, nullptr,
                                result);
     return rv; 
 }
 
 inline nsresult
 NS_GetFileProtocolHandler(nsIFileProtocolHandler **result,
                           nsIIOService            *ioService = nullptr)
 {
--- a/netwerk/base/src/nsBaseChannel.cpp
+++ b/netwerk/base/src/nsBaseChannel.cpp
@@ -504,17 +504,17 @@ nsBaseChannel::GetContentDispositionHead
 {
   return NS_ERROR_NOT_AVAILABLE;
 }
 
 NS_IMETHODIMP
 nsBaseChannel::GetContentLength(int32_t *aContentLength)
 {
   int64_t len = ContentLength64();
-  if (len > PR_INT32_MAX || len < 0)
+  if (len > INT32_MAX || len < 0)
     *aContentLength = -1;
   else
     *aContentLength = (int32_t) len;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsBaseChannel::SetContentLength(int32_t aContentLength)
--- a/netwerk/base/src/nsInputStreamPump.cpp
+++ b/netwerk/base/src/nsInputStreamPump.cpp
@@ -100,17 +100,17 @@ nsInputStreamPump::PeekStream(PeekSegmen
 {
   NS_ASSERTION(mAsyncStream, "PeekStream called without stream");
 
   // See if the pipe is closed by checking the return of Available.
   uint64_t dummy64;
   nsresult rv = mAsyncStream->Available(&dummy64);
   if (NS_FAILED(rv))
     return rv;
-  uint32_t dummy = (uint32_t)NS_MIN(dummy64, (uint64_t)PR_UINT32_MAX);
+  uint32_t dummy = (uint32_t)NS_MIN(dummy64, (uint64_t)UINT32_MAX);
 
   PeekData data(callback, closure);
   return mAsyncStream->ReadSegments(CallPeekFunc,
                                     &data,
                                     nsIOService::gDefaultSegmentSize,
                                     &dummy);
 }
 
@@ -468,18 +468,18 @@ nsInputStreamPump::OnStateTransfer()
             int64_t offsetBefore;
             nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mAsyncStream);
             if (seekable && NS_FAILED(seekable->Tell(&offsetBefore))) {
                 NS_NOTREACHED("Tell failed on readable stream");
                 offsetBefore = 0;
             }
 
             uint32_t odaAvail =
-                avail > PR_UINT32_MAX ?
-                PR_UINT32_MAX : uint32_t(avail);
+                avail > UINT32_MAX ?
+                UINT32_MAX : uint32_t(avail);
 
             LOG(("  calling OnDataAvailable [offset=%llu count=%llu(%u)]\n",
                 mStreamOffset, avail, odaAvail));
 
             rv = mListener->OnDataAvailable(this, mListenerContext, mAsyncStream,
                                             mStreamOffset, odaAvail);
 
             // don't enter this code if ODA failed or called Cancel
--- a/netwerk/base/src/nsProtocolProxyService.cpp
+++ b/netwerk/base/src/nsProtocolProxyService.cpp
@@ -1447,17 +1447,17 @@ nsProtocolProxyService::NewProxyInfo_Int
     if (!proxyInfo)
         return NS_ERROR_OUT_OF_MEMORY;
 
     proxyInfo->mType = aType;
     proxyInfo->mHost = aHost;
     proxyInfo->mPort = aPort;
     proxyInfo->mFlags = aFlags;
     proxyInfo->mResolveFlags = aResolveFlags;
-    proxyInfo->mTimeout = aFailoverTimeout == PR_UINT32_MAX
+    proxyInfo->mTimeout = aFailoverTimeout == UINT32_MAX
         ? mFailedProxyTimeout : aFailoverTimeout;
     failover.swap(proxyInfo->mNext);
 
     NS_ADDREF(*aResult = proxyInfo);
     return NS_OK;
 }
 
 nsresult
@@ -1603,17 +1603,17 @@ nsProtocolProxyService::Resolve_Internal
             type = kProxyType_SOCKS;
         port = mSOCKSProxyPort;
         if (mSOCKSProxyRemoteDNS)
             proxyFlags |= nsIProxyInfo::TRANSPARENT_PROXY_RESOLVES_HOST;
     }
 
     if (type) {
         rv = NewProxyInfo_Internal(type, *host, port, proxyFlags,
-                                   PR_UINT32_MAX, nullptr, flags,
+                                   UINT32_MAX, nullptr, flags,
                                    result);
         if (NS_FAILED(rv))
             return rv;
     }
 
     return NS_OK;
 }
 
--- a/netwerk/base/src/nsProxyInfo.h
+++ b/netwerk/base/src/nsProxyInfo.h
@@ -39,17 +39,17 @@ public:
 private:
   friend class nsProtocolProxyService;
 
   nsProxyInfo(const char *type = nullptr)
     : mType(type)
     , mPort(-1)
     , mFlags(0)
     , mResolveFlags(0)
-    , mTimeout(PR_UINT32_MAX)
+    , mTimeout(UINT32_MAX)
     , mNext(nullptr)
   {}
 
   ~nsProxyInfo()
   {
     NS_IF_RELEASE(mNext);
   }
 
--- a/netwerk/base/src/nsSocketTransport2.cpp
+++ b/netwerk/base/src/nsSocketTransport2.cpp
@@ -697,18 +697,18 @@ nsSocketTransport::nsSocketTransport()
     , mInput(this)
     , mOutput(this)
     , mQoSBits(0x00)
 {
     SOCKET_LOG(("creating nsSocketTransport @%x\n", this));
 
     NS_ADDREF(gSocketTransportService);
 
-    mTimeouts[TIMEOUT_CONNECT]    = PR_UINT16_MAX; // no timeout
-    mTimeouts[TIMEOUT_READ_WRITE] = PR_UINT16_MAX; // no timeout
+    mTimeouts[TIMEOUT_CONNECT]    = UINT16_MAX; // no timeout
+    mTimeouts[TIMEOUT_READ_WRITE] = UINT16_MAX; // no timeout
 }
 
 nsSocketTransport::~nsSocketTransport()
 {
     SOCKET_LOG(("destroying nsSocketTransport @%x\n", this));
 
     // cleanup socket type info
     if (mTypes) {
@@ -1978,17 +1978,17 @@ nsSocketTransport::GetTimeout(uint32_t t
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSocketTransport::SetTimeout(uint32_t type, uint32_t value)
 {
     NS_ENSURE_ARG_MAX(type, nsISocketTransport::TIMEOUT_READ_WRITE);
     // truncate overly large timeout values.
-    mTimeouts[type] = (uint16_t) NS_MIN(value, PR_UINT16_MAX);
+    mTimeouts[type] = (uint16_t) NS_MIN<uint32_t>(value, UINT16_MAX);
     PostEvent(MSG_TIMEOUT_CHANGED);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSocketTransport::SetQoSBits(uint8_t aQoSBits)
 {
     // Don't do any checking here of bits.  Why?  Because as of RFC-4594
--- a/netwerk/base/src/nsSocketTransportService2.cpp
+++ b/netwerk/base/src/nsSocketTransportService2.cpp
@@ -339,17 +339,17 @@ nsSocketTransportService::GrowIdleList()
 
 PRIntervalTime
 nsSocketTransportService::PollTimeout()
 {
     if (mActiveCount == 0)
         return NS_SOCKET_POLL_TIMEOUT;
 
     // compute minimum time before any socket timeout expires.
-    uint32_t minR = PR_UINT16_MAX;
+    uint32_t minR = UINT16_MAX;
     for (uint32_t i=0; i<mActiveCount; ++i) {
         const SocketContext &s = mActiveList[i];
         // mPollTimeout could be less than mElapsedTime if setTimeout
         // was called with a value smaller than mElapsedTime.
         uint32_t r = (s.mElapsedTime < s.mHandler->mPollTimeout)
           ? s.mHandler->mPollTimeout - s.mElapsedTime
           : 0;
         if (r < minR)
@@ -765,20 +765,20 @@ nsSocketTransportService::DoPollIteratio
         for (i=0; i<int32_t(mActiveCount); ++i) {
             PRPollDesc &desc = mPollList[i+1];
             SocketContext &s = mActiveList[i];
             if (n > 0 && desc.out_flags != 0) {
                 s.mElapsedTime = 0;
                 s.mHandler->OnSocketReady(desc.fd, desc.out_flags);
             }
             // check for timeout errors unless disabled...
-            else if (s.mHandler->mPollTimeout != PR_UINT16_MAX) {
+            else if (s.mHandler->mPollTimeout != UINT16_MAX) {
                 // update elapsed time counter
-                if (NS_UNLIKELY(pollInterval > (PR_UINT16_MAX - s.mElapsedTime)))
-                    s.mElapsedTime = PR_UINT16_MAX;
+                if (NS_UNLIKELY(pollInterval > (UINT16_MAX - s.mElapsedTime)))
+                    s.mElapsedTime = UINT16_MAX;
                 else
                     s.mElapsedTime += uint16_t(pollInterval);
                 // check for timeout expiration 
                 if (s.mElapsedTime >= s.mHandler->mPollTimeout) {
                     s.mElapsedTime = 0;
                     s.mHandler->OnSocketReady(desc.fd, -1);
                 }
             }
--- a/netwerk/base/src/nsStandardURL.cpp
+++ b/netwerk/base/src/nsStandardURL.cpp
@@ -831,17 +831,17 @@ nsStandardURL::AppendToSubstring(uint32_
     if ((uint32_t)len > (mSpec.Length() - pos))
         return NULL;
     if (!tail)
         return NULL;
 
     uint32_t tailLen = strlen(tail);
 
     // Check for int overflow for proposed length of combined string
-    if (PR_UINT32_MAX - ((uint32_t)len + 1) < tailLen)
+    if (UINT32_MAX - ((uint32_t)len + 1) < tailLen)
         return NULL;
 
     char *result = (char *) NS_Alloc(len + tailLen + 1);
     if (result) {
         memcpy(result, mSpec.get() + pos, len);
         memcpy(result + len, tail, tailLen);
         result[len + tailLen] = '\0';
     }
--- a/netwerk/base/src/nsStreamLoader.cpp
+++ b/netwerk/base/src/nsStreamLoader.cpp
@@ -113,17 +113,17 @@ nsStreamLoader::WriteSegmentFun(nsIInput
                                 void *closure,
                                 const char *fromSegment,
                                 uint32_t toOffset,
                                 uint32_t count,
                                 uint32_t *writeCount)
 {
   nsStreamLoader *self = (nsStreamLoader *) closure;
 
-  if (count > PR_UINT32_MAX - self->mLength) {
+  if (count > UINT32_MAX - self->mLength) {
     return NS_ERROR_ILLEGAL_VALUE; // is there a better error to use here?
   }
 
   if (self->mLength + count > self->mAllocated) {
     self->mData = static_cast<uint8_t*>(NS_Realloc(self->mData,
                                                    self->mLength + count));
     if (!self->mData) {
       self->mLength = 0;
--- a/netwerk/base/src/nsSyncStreamListener.cpp
+++ b/netwerk/base/src/nsSyncStreamListener.cpp
@@ -7,17 +7,17 @@
 #include "nsIPipe.h"
 
 nsresult
 nsSyncStreamListener::Init()
 {
     return NS_NewPipe(getter_AddRefs(mPipeIn),
                       getter_AddRefs(mPipeOut),
                       nsIOService::gDefaultSegmentSize,
-                      PR_UINT32_MAX, // no size limit
+                      UINT32_MAX, // no size limit
                       false,
                       false);
 }
 
 nsresult
 nsSyncStreamListener::WaitForData()
 {
     mKeepWaiting = true;
--- a/netwerk/cache/nsCacheEntryDescriptor.cpp
+++ b/netwerk/cache/nsCacheEntryDescriptor.cpp
@@ -865,17 +865,17 @@ nsOutputStreamWrapper::LazyInit()
     mDescriptor->mOutput = mOutput = stream;
     mInitialized = true;
     return NS_OK;
 }
 
 nsresult nsCacheEntryDescriptor::
 nsOutputStreamWrapper::OnWrite(uint32_t count)
 {
-    if (count > PR_INT32_MAX)  return NS_ERROR_UNEXPECTED;
+    if (count > INT32_MAX)  return NS_ERROR_UNEXPECTED;
     return mDescriptor->RequestDataSizeChange((int32_t)count);
 }
 
 NS_IMETHODIMP nsCacheEntryDescriptor::
 nsOutputStreamWrapper::Close()
 {
     nsresult rv = EnsureInit();
     if (NS_FAILED(rv)) return rv;
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -1708,17 +1708,17 @@ nsCookieService::PrefChanged(nsIPrefBran
   if (NS_SUCCEEDED(aPrefBranch->GetIntPref(kPrefMaxNumberOfCookies, &val)))
     mMaxNumberOfCookies = (uint16_t) LIMIT(val, 1, 0xFFFF, kMaxNumberOfCookies);
 
   if (NS_SUCCEEDED(aPrefBranch->GetIntPref(kPrefMaxCookiesPerHost, &val)))
     mMaxCookiesPerHost = (uint16_t) LIMIT(val, 1, 0xFFFF, kMaxCookiesPerHost);
 
   if (NS_SUCCEEDED(aPrefBranch->GetIntPref(kPrefCookiePurgeAge, &val))) {
     mCookiePurgeAge =
-      int64_t(LIMIT(val, 0, PR_INT32_MAX, PR_INT32_MAX)) * PR_USEC_PER_SEC;
+      int64_t(LIMIT(val, 0, INT32_MAX, INT32_MAX)) * PR_USEC_PER_SEC;
   }
 
   bool boolval;
   if (NS_SUCCEEDED(aPrefBranch->GetBoolPref(kPrefThirdPartySession, &boolval)))
     mThirdPartySession = boolval;
 }
 
 /******************************************************************************
--- a/netwerk/protocol/about/nsAboutCacheEntry.cpp
+++ b/netwerk/protocol/about/nsAboutCacheEntry.cpp
@@ -110,17 +110,17 @@ nsAboutCacheEntry::GetContentStream(nsIU
 {
     nsresult rv;
 
     // Init: (block size, maximum length)
     nsCOMPtr<nsIAsyncInputStream> inputStream;
     rv = NS_NewPipe2(getter_AddRefs(inputStream),
                      getter_AddRefs(mOutputStream),
                      true, false,
-                     256, PR_UINT32_MAX);
+                     256, UINT32_MAX);
     if (NS_FAILED(rv)) return rv;
 
     NS_NAMED_LITERAL_CSTRING(
       buffer,
       "<!DOCTYPE html>\n"
       "<html>\n"
       "<head>\n"
       "  <title>Cache entry information</title>\n"
--- a/netwerk/protocol/data/nsDataChannel.cpp
+++ b/netwerk/protocol/data/nsDataChannel.cpp
@@ -46,17 +46,17 @@ nsDataChannel::OpenContentStream(bool as
     
     nsCOMPtr<nsIInputStream> bufInStream;
     nsCOMPtr<nsIOutputStream> bufOutStream;
     
     // create an unbounded pipe.
     rv = NS_NewPipe(getter_AddRefs(bufInStream),
                     getter_AddRefs(bufOutStream),
                     nsIOService::gDefaultSegmentSize,
-                    PR_UINT32_MAX,
+                    UINT32_MAX,
                     async, true);
     if (NS_FAILED(rv))
         return rv;
 
     uint32_t contentLen;
     if (lBase64) {
         const uint32_t dataLen = dataBuffer.Length();
         int32_t resultLen = 0;
--- a/netwerk/protocol/device/GonkCaptureProvider.cpp
+++ b/netwerk/protocol/device/GonkCaptureProvider.cpp
@@ -306,17 +306,17 @@ GonkCameraInputStream::Init(nsACString& 
   CameraParameters params = mHardware->getParameters();
 
   printf_stderr("Preview format : %s\n", params.get(params.KEY_SUPPORTED_PREVIEW_FORMATS));
 
   Vector<Size> previewSizes;
   params.getSupportedPreviewSizes(previewSizes);
 
   // find the available preview size closest to the requested size.
-  uint32_t minSizeDelta = PR_UINT32_MAX;
+  uint32_t minSizeDelta = UINT32_MAX;
   uint32_t bestWidth = mWidth;
   uint32_t bestHeight = mHeight;
   for (uint32_t i = 0; i < previewSizes.size(); i++) {
     Size size = previewSizes[i];
     uint32_t delta = abs(size.width * size.height - mWidth * mHeight); 
     if (delta < minSizeDelta) {
       minSizeDelta = delta;
       bestWidth = size.width;
--- a/netwerk/protocol/file/nsFileChannel.cpp
+++ b/netwerk/protocol/file/nsFileChannel.cpp
@@ -421,17 +421,17 @@ nsFileChannel::SetUploadStream(nsIInputS
   if ((mUploadStream = stream)) {
     mUploadLength = contentLength;
     if (mUploadLength < 0) {
       // Make sure we know how much data we are uploading.
       uint64_t avail;
       nsresult rv = mUploadStream->Available(&avail);
       if (NS_FAILED(rv))
         return rv;
-      if (avail < PR_INT64_MAX)
+      if (avail < INT64_MAX)
         mUploadLength = avail;
     }
   } else {
     mUploadLength = -1;
   }
   return NS_OK;
 }
 
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -1188,17 +1188,17 @@ HttpChannelChild::ResumeAt(uint64_t star
 
 //-----------------------------------------------------------------------------
 // HttpChannelChild::nsISupportsPriority
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 HttpChannelChild::SetPriority(int32_t aPriority)
 {
-  int16_t newValue = clamped(aPriority, PR_INT16_MIN, PR_INT16_MAX);
+  int16_t newValue = clamped(aPriority, INT16_MIN, INT16_MAX);
   if (mPriority == newValue)
     return NS_OK;
   mPriority = newValue;
   if (RemoteChannelExists())
     SendSetPriority(mPriority);
   return NS_OK;
 }
 
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -4484,17 +4484,17 @@ nsHttpChannel::SetupFallbackChannel(cons
 
 //-----------------------------------------------------------------------------
 // nsHttpChannel::nsISupportsPriority
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsHttpChannel::SetPriority(int32_t value)
 {
-    int16_t newValue = clamped(value, PR_INT16_MIN, PR_INT16_MAX);
+    int16_t newValue = clamped(value, INT16_MIN, INT16_MAX);
     if (mPriority == newValue)
         return NS_OK;
     mPriority = newValue;
     if (mTransaction)
         gHttpHandler->RescheduleTransaction(mTransaction, mPriority);
     return NS_OK;
 }
 
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -753,17 +753,17 @@ nsHttpConnectionMgr::PruneDeadConnection
                                             void *closure)
 {
     nsHttpConnectionMgr *self = (nsHttpConnectionMgr *) closure;
 
     LOG(("  pruning [ci=%s]\n", ent->mConnInfo->HashKey().get()));
 
     // Find out how long it will take for next idle connection to not be reusable
     // anymore.
-    uint32_t timeToNextExpire = PR_UINT32_MAX;
+    uint32_t timeToNextExpire = UINT32_MAX;
     int32_t count = ent->mIdleConns.Length();
     if (count > 0) {
         for (int32_t i=count-1; i>=0; --i) {
             nsHttpConnection *conn = ent->mIdleConns[i];
             if (!conn->CanReuse()) {
                 ent->mIdleConns.RemoveElementAt(i);
                 conn->Close(NS_ERROR_ABORT);
                 NS_RELEASE(conn);
@@ -788,17 +788,17 @@ nsHttpConnectionMgr::PruneDeadConnection
                                               conn->TimeToLive());
                 }
             }
         }
     }
     
     // If time to next expire found is shorter than time to next wake-up, we need to
     // change the time for next wake-up.
-    if (timeToNextExpire != PR_UINT32_MAX) {
+    if (timeToNextExpire != UINT32_MAX) {
         uint32_t now = NowInSeconds();
         uint64_t timeOfNextExpire = now + timeToNextExpire;
         // If pruning of dead connections is not already scheduled to happen
         // or time found for next connection to expire is is before
         // mTimeOfNextWakeUp, we need to schedule the pruning to happen
         // after timeToNextExpire.
         if (!self->mTimer || timeOfNextExpire < self->mTimeOfNextWakeUp) {
             self->PruneDeadConnectionsAfter(timeToNextExpire);
--- a/netwerk/protocol/http/nsHttpHeaderArray.h
+++ b/netwerk/protocol/http/nsHttpHeaderArray.h
@@ -128,26 +128,26 @@ private:
 //-----------------------------------------------------------------------------
 // nsHttpHeaderArray <private>: inline functions
 //-----------------------------------------------------------------------------
 
 inline int32_t
 nsHttpHeaderArray::LookupEntry(nsHttpAtom header, const nsEntry **entry) const
 {
     uint32_t index = mHeaders.IndexOf(header, 0, nsEntry::MatchHeader());
-    if (index != PR_UINT32_MAX)
+    if (index != UINT32_MAX)
         *entry = &mHeaders[index];
     return index;
 }
 
 inline int32_t
 nsHttpHeaderArray::LookupEntry(nsHttpAtom header, nsEntry **entry)
 {
     uint32_t index = mHeaders.IndexOf(header, 0, nsEntry::MatchHeader());
-    if (index != PR_UINT32_MAX)
+    if (index != UINT32_MAX)
         *entry = &mHeaders[index];
     return index;
 }
 
 inline bool
 nsHttpHeaderArray::IsSingletonHeader(nsHttpAtom header)
 {
     return header == nsHttp::Content_Type        ||
--- a/netwerk/protocol/http/nsHttpPipeline.cpp
+++ b/netwerk/protocol/http/nsHttpPipeline.cpp
@@ -850,17 +850,17 @@ nsHttpPipeline::FillSendBuf()
         if (avail) {
             // if there is already a response in the responseq then this
             // new data comprises a pipeline. Update the transaction in the
             // response queue to reflect that if necessary. We are now sending
             // out a request while we haven't received all responses.
             nsAHttpTransaction *response = Response(0);
             if (response && !response->PipelinePosition())
                 response->SetPipelinePosition(1);
-            rv = trans->ReadSegments(this, (uint32_t)NS_MIN(avail, (uint64_t)PR_UINT32_MAX), &n);
+            rv = trans->ReadSegments(this, (uint32_t)NS_MIN(avail, (uint64_t)UINT32_MAX), &n);
             if (NS_FAILED(rv)) return rv;
             
             if (n == 0) {
                 LOG(("send pipe is full"));
                 break;
             }
 
             mSendingToProgress += n;
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -1327,17 +1327,17 @@ nsHttpTransaction::HandleContent(char *b
         *contentRead = count;
     }
     
     int64_t toReadBeforeRestart =
         mRestartInProgressVerifier.ToReadBeforeRestart();
 
     if (toReadBeforeRestart && *contentRead) {
         uint32_t ignore =
-            static_cast<uint32_t>(NS_MIN<int64_t>(toReadBeforeRestart, PR_UINT32_MAX));
+            static_cast<uint32_t>(NS_MIN<int64_t>(toReadBeforeRestart, UINT32_MAX));
         ignore = NS_MIN(*contentRead, ignore);
         LOG(("Due To Restart ignoring %d of remaining %ld",
              ignore, toReadBeforeRestart));
         *contentRead -= ignore;
         mContentRead += ignore;
         mRestartInProgressVerifier.HaveReadBeforeRestart(ignore);
         memmove(buf, buf + ignore, *contentRead + *contentRemaining);
     }
--- a/netwerk/protocol/websocket/WebSocketChannel.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannel.cpp
@@ -925,17 +925,17 @@ WebSocketChannel::WebSocketChannel() :
   mAutoFollowRedirects(0),
   mReleaseOnTransmit(0),
   mTCPClosed(0),
   mWasOpened(0),
   mOpenedHttpChannel(0),
   mDataStarted(0),
   mIncrementedSessionCount(0),
   mDecrementedSessionCount(0),
-  mMaxMessageSize(PR_INT32_MAX),
+  mMaxMessageSize(INT32_MAX),
   mStopOnClose(NS_OK),
   mServerCloseCode(CLOSE_ABNORMAL),
   mScriptCloseCode(0),
   mFragmentOpcode(kContinuation),
   mFragmentAccumulator(0),
   mBuffered(0),
   mBufferSize(kIncomingBufferInitialSize),
   mCurrentOut(nullptr),
@@ -2476,17 +2476,17 @@ WebSocketChannel::AsyncOpen(nsIURI *aURI
   prefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
 
   if (prefService) {
     int32_t intpref;
     bool boolpref;
     rv = prefService->GetIntPref("network.websocket.max-message-size", 
                                  &intpref);
     if (NS_SUCCEEDED(rv)) {
-      mMaxMessageSize = clamped(intpref, 1024, PR_INT32_MAX);
+      mMaxMessageSize = clamped(intpref, 1024, INT32_MAX);
     }
     rv = prefService->GetIntPref("network.websocket.timeout.close", &intpref);
     if (NS_SUCCEEDED(rv)) {
       mCloseTimeout = clamped(intpref, 1, 1800) * 1000;
     }
     rv = prefService->GetIntPref("network.websocket.timeout.open", &intpref);
     if (NS_SUCCEEDED(rv)) {
       mOpenTimeout = clamped(intpref, 1, 1800) * 1000;
--- a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp
+++ b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp
@@ -85,17 +85,17 @@ nsFTPDirListingConv::OnDataAvailable(nsI
     nsCOMPtr<nsIChannel> channel = do_QueryInterface(request, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
     
     uint32_t read, streamLen;
 
     uint64_t streamLen64;
     rv = inStr->Available(&streamLen64);
     NS_ENSURE_SUCCESS(rv, rv);
-    streamLen = (uint32_t)NS_MIN(streamLen64, uint64_t(PR_UINT32_MAX - 1));
+    streamLen = (uint32_t)NS_MIN(streamLen64, uint64_t(UINT32_MAX - 1));
 
     nsAutoArrayPtr<char> buffer(new char[streamLen + 1]);
     NS_ENSURE_TRUE(buffer, NS_ERROR_OUT_OF_MEMORY);
 
     rv = inStr->Read(buffer, streamLen, &read);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // the dir listings are ascii text, null terminate this sucker.
--- a/netwerk/streamconv/test/Converters.cpp
+++ b/netwerk/streamconv/test/Converters.cpp
@@ -76,17 +76,17 @@ TestConverter::AsyncConvertData(const ch
     toType = aToType;
 
     return NS_OK; 
 }
 
 static inline uint32_t
 saturated(uint64_t aValue)
 {
-    return (uint32_t) NS_MIN(aValue, (uint64_t) PR_UINT32_MAX);
+    return (uint32_t) NS_MIN(aValue, (uint64_t) UINT32_MAX);
 }
 
 // nsIStreamListener method
 /* This method handles asyncronous conversion of data. */
 NS_IMETHODIMP
 TestConverter::OnDataAvailable(nsIRequest* request,
                                nsISupports *ctxt, 
                                nsIInputStream *inStr, 
--- a/netwerk/streamconv/test/TestStreamConv.cpp
+++ b/netwerk/streamconv/test/TestStreamConv.cpp
@@ -61,17 +61,17 @@ public:
     NS_IMETHOD OnDataAvailable(nsIRequest* request, nsISupports *ctxt, nsIInputStream *inStr, 
                                uint64_t sourceOffset, uint32_t count)
     {
         nsresult rv;
         uint32_t read;
         uint64_t len64;
         rv = inStr->Available(&len64);
         if (NS_FAILED(rv)) return rv;
-        uint32_t len = (uint32_t)NS_MIN(len64, (uint64_t)(PR_UINT32_MAX - 1));
+        uint32_t len = (uint32_t)NS_MIN(len64, (uint64_t)(UINT32_MAX - 1));
 
         char *buffer = (char*)nsMemory::Alloc(len + 1);
         if (!buffer) return NS_ERROR_OUT_OF_MEMORY;
 
         rv = inStr->Read(buffer, len, &read);
         buffer[len] = '\0';
         if (NS_SUCCEEDED(rv)) {
             printf("CONTEXT %p: Received %u bytes and the following data: \n %s\n\n",
@@ -95,17 +95,17 @@ NS_IMPL_ISUPPORTS2(EndListener,
 
 ////////////////////////////////////////////////////////////////////////
 // EndListener END
 ////////////////////////////////////////////////////////////////////////
 
 static uint32_t 
 saturated(uint64_t aValue)
 {
-    return (uint32_t)NS_MIN(aValue, (uint64_t)PR_UINT32_MAX);
+    return (uint32_t)NS_MIN(aValue, (uint64_t)UINT32_MAX);
 }
  
 nsresult SendData(const char * aData, nsIStreamListener* aListener, nsIRequest* request) {
     nsresult rv;
 
     nsCOMPtr<nsIStringInputStream> dataStream
       (do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv));
     NS_ENSURE_SUCCESS(rv, rv);
--- a/parser/html/nsHtml5Highlighter.cpp
+++ b/parser/html/nsHtml5Highlighter.cpp
@@ -42,17 +42,17 @@ PRUnichar nsHtml5Highlighter::sAttribute
 PRUnichar nsHtml5Highlighter::sDoctype[] =
   { 'd', 'o', 'c', 't', 'y', 'p', 'e', 0 };
 
 PRUnichar nsHtml5Highlighter::sPi[] =
   { 'p', 'i', 0 };
 
 nsHtml5Highlighter::nsHtml5Highlighter(nsAHtml5TreeOpSink* aOpSink)
  : mState(NS_HTML5TOKENIZER_DATA)
- , mCStart(PR_INT32_MAX)
+ , mCStart(INT32_MAX)
  , mPos(0)
  , mLineNumber(1)
  , mInlinesOpen(0)
  , mInCharacters(false)
  , mBuffer(nullptr)
  , mSyntaxHighlight(Preferences::GetBool("view_source.syntax_highlight",
                                          true))
  , mOpSink(aOpSink)
@@ -82,18 +82,18 @@ nsHtml5Highlighter::Start(const nsAutoSt
   mOpQueue.AppendElement()->Init(eTreeOpAppendToDocument, root);
   mStack.AppendElement(root);
 
   Push(nsGkAtoms::head, nullptr);
 
   Push(nsGkAtoms::title, nullptr);
   // XUL will add the "Source of: " prefix.
   uint32_t length = aTitle.Length();
-  if (length > PR_INT32_MAX) {
-    length = PR_INT32_MAX;
+  if (length > INT32_MAX) {
+    length = INT32_MAX;
   }
   AppendCharacters(aTitle.get(), 0, (int32_t)length);
   Pop(); // title
 
   Push(nsGkAtoms::link, nsHtml5ViewSourceUtils::NewLinkAttributes());
 
   mOpQueue.AppendElement()->Init(eTreeOpUpdateStyleSheet, CurrentNode());
 
--- a/parser/html/nsHtml5MetaScanner.cpp
+++ b/parser/html/nsHtml5MetaScanner.cpp
@@ -62,20 +62,20 @@ staticJArray<PRUnichar,int32_t> nsHtml5M
 static PRUnichar const HTTP_EQUIV_DATA[] = { 't', 't', 'p', '-', 'e', 'q', 'u', 'i', 'v' };
 staticJArray<PRUnichar,int32_t> nsHtml5MetaScanner::HTTP_EQUIV = { HTTP_EQUIV_DATA, NS_ARRAY_LENGTH(HTTP_EQUIV_DATA) };
 static PRUnichar const CONTENT_TYPE_DATA[] = { 'c', 'o', 'n', 't', 'e', 'n', 't', '-', 't', 'y', 'p', 'e' };
 staticJArray<PRUnichar,int32_t> nsHtml5MetaScanner::CONTENT_TYPE = { CONTENT_TYPE_DATA, NS_ARRAY_LENGTH(CONTENT_TYPE_DATA) };
 
 nsHtml5MetaScanner::nsHtml5MetaScanner()
   : readable(nullptr),
     metaState(NS_HTML5META_SCANNER_NO),
-    contentIndex(PR_INT32_MAX),
-    charsetIndex(PR_INT32_MAX),
-    httpEquivIndex(PR_INT32_MAX),
-    contentTypeIndex(PR_INT32_MAX),
+    contentIndex(INT32_MAX),
+    charsetIndex(INT32_MAX),
+    httpEquivIndex(INT32_MAX),
+    contentTypeIndex(INT32_MAX),
     stateSave(NS_HTML5META_SCANNER_DATA),
     strBufLen(0),
     strBuf(jArray<PRUnichar,int32_t>::newJArray(36)),
     content(nullptr),
     charset(nullptr),
     httpEquivState(NS_HTML5META_SCANNER_HTTP_EQUIV_NOT_SEEN)
 {
   MOZ_COUNT_CTOR(nsHtml5MetaScanner);
@@ -242,35 +242,35 @@ nsHtml5MetaScanner::stateLoop(int32_t st
               }
               state = NS_HTML5META_SCANNER_DATA;
               NS_HTML5_CONTINUE(stateloop);
             }
             case 'c':
             case 'C': {
               contentIndex = 0;
               charsetIndex = 0;
-              httpEquivIndex = PR_INT32_MAX;
-              contentTypeIndex = PR_INT32_MAX;
+              httpEquivIndex = INT32_MAX;
+              contentTypeIndex = INT32_MAX;
               state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
               NS_HTML5_BREAK(beforeattributenameloop);
             }
             case 'h':
             case 'H': {
-              contentIndex = PR_INT32_MAX;
-              charsetIndex = PR_INT32_MAX;
+              contentIndex = INT32_MAX;
+              charsetIndex = INT32_MAX;
               httpEquivIndex = 0;
-              contentTypeIndex = PR_INT32_MAX;
+              contentTypeIndex = INT32_MAX;
               state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
               NS_HTML5_BREAK(beforeattributenameloop);
             }
             default: {
-              contentIndex = PR_INT32_MAX;
-              charsetIndex = PR_INT32_MAX;
-              httpEquivIndex = PR_INT32_MAX;
-              contentTypeIndex = PR_INT32_MAX;
+              contentIndex = INT32_MAX;
+              charsetIndex = INT32_MAX;
+              httpEquivIndex = INT32_MAX;
+              contentTypeIndex = INT32_MAX;
               state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
               NS_HTML5_BREAK(beforeattributenameloop);
             }
           }
         }
         beforeattributenameloop_end: ;
       }
       case NS_HTML5META_SCANNER_ATTRIBUTE_NAME: {
@@ -307,27 +307,27 @@ nsHtml5MetaScanner::stateLoop(int32_t st
             default: {
               if (metaState == NS_HTML5META_SCANNER_A) {
                 if (c >= 'A' && c <= 'Z') {
                   c += 0x20;
                 }
                 if (contentIndex < CONTENT.length && c == CONTENT[contentIndex]) {
                   ++contentIndex;
                 } else {
-                  contentIndex = PR_INT32_MAX;
+                  contentIndex = INT32_MAX;
                 }
                 if (charsetIndex < CHARSET.length && c == CHARSET[charsetIndex]) {
                   ++charsetIndex;
                 } else {
-                  charsetIndex = PR_INT32_MAX;
+                  charsetIndex = INT32_MAX;
                 }
                 if (httpEquivIndex < HTTP_EQUIV.length && c == HTTP_EQUIV[httpEquivIndex]) {
                   ++httpEquivIndex;
                 } else {
-                  httpEquivIndex = PR_INT32_MAX;
+                  httpEquivIndex = INT32_MAX;
                 }
               }
               continue;
             }
           }
         }
         attributenameloop_end: ;
       }
@@ -515,18 +515,18 @@ nsHtml5MetaScanner::stateLoop(int32_t st
             case 'c':
             case 'C': {
               contentIndex = 0;
               charsetIndex = 0;
               state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
               NS_HTML5_CONTINUE(stateloop);
             }
             default: {
-              contentIndex = PR_INT32_MAX;
-              charsetIndex = PR_INT32_MAX;
+              contentIndex = INT32_MAX;
+              charsetIndex = INT32_MAX;
               state = NS_HTML5META_SCANNER_ATTRIBUTE_NAME;
               NS_HTML5_CONTINUE(stateloop);
             }
           }
         }
       }
       case NS_HTML5META_SCANNER_MARKUP_DECLARATION_OPEN: {
         for (; ; ) {
@@ -724,17 +724,17 @@ nsHtml5MetaScanner::handleCharInAttribut
 {
   if (metaState == NS_HTML5META_SCANNER_A) {
     if (contentIndex == CONTENT.length || charsetIndex == CHARSET.length) {
       addToBuffer(c);
     } else if (httpEquivIndex == HTTP_EQUIV.length) {
       if (contentTypeIndex < CONTENT_TYPE.length && toAsciiLowerCase(c) == CONTENT_TYPE[contentTypeIndex]) {
         ++contentTypeIndex;
       } else {
-        contentTypeIndex = PR_INT32_MAX;
+        contentTypeIndex = INT32_MAX;
       }
     }
   }
 }
 
 void 
 nsHtml5MetaScanner::addToBuffer(int32_t c)
 {
--- a/parser/html/nsHtml5Parser.cpp
+++ b/parser/html/nsHtml5Parser.cpp
@@ -193,17 +193,17 @@ nsHtml5Parser::Parse(const nsAString& aS
                      const nsACString& aContentType,
                      bool aLastCall,
                      nsDTDMode aMode) // ignored
 {
   nsresult rv;
   if (NS_FAILED(rv = mExecutor->IsBroken())) {
     return rv;
   }
-  if (aSourceBuffer.Length() > PR_INT32_MAX) {
+  if (aSourceBuffer.Length() > INT32_MAX) {
     return mExecutor->MarkAsBroken(NS_ERROR_OUT_OF_MEMORY);
   }
 
   // Maintain a reference to ourselves so we don't go away
   // till we're completely done. The old parser grips itself in this method.
   nsCOMPtr<nsIParser> kungFuDeathGrip(this);
   
   // Gripping the other objects just in case, since the other old grip
--- a/parser/html/nsHtml5StringParser.cpp
+++ b/parser/html/nsHtml5StringParser.cpp
@@ -31,17 +31,17 @@ nsHtml5StringParser::~nsHtml5StringParse
 nsresult
 nsHtml5StringParser::ParseFragment(const nsAString& aSourceBuffer,
                                    nsIContent* aTargetNode,
                                    nsIAtom* aContextLocalName,
                                    int32_t aContextNamespace,
                                    bool aQuirks,
                                    bool aPreventScriptExecution)
 {
-  NS_ENSURE_TRUE(aSourceBuffer.Length() <= PR_INT32_MAX,
+  NS_ENSURE_TRUE(aSourceBuffer.Length() <= INT32_MAX,
                  NS_ERROR_OUT_OF_MEMORY);
 
   nsIDocument* doc = aTargetNode->OwnerDoc();
   nsIURI* uri = doc->GetDocumentURI();
   NS_ENSURE_TRUE(uri, NS_ERROR_NOT_AVAILABLE);
 
   nsIContent* target = aTargetNode;
   mTreeBuilder->setFragmentContext(aContextLocalName,
@@ -68,17 +68,17 @@ nsHtml5StringParser::ParseFragment(const
 
 nsresult
 nsHtml5StringParser::ParseDocument(const nsAString& aSourceBuffer,
                                    nsIDocument* aTargetDoc,
                                    bool aScriptingEnabledForNoscriptParsing)
 {
   MOZ_ASSERT(!aTargetDoc->GetFirstChild());
 
-  NS_ENSURE_TRUE(aSourceBuffer.Length() <= PR_INT32_MAX,
+  NS_ENSURE_TRUE(aSourceBuffer.Length() <= INT32_MAX,
                  NS_ERROR_OUT_OF_MEMORY);
 
   mTreeBuilder->setFragmentContext(nullptr,
                                    kNameSpaceID_None,
                                    nullptr,
                                    false);
 
   mTreeBuilder->SetPreventScriptExecution(true);
--- a/parser/html/nsHtml5Tokenizer.cpp
+++ b/parser/html/nsHtml5Tokenizer.cpp
@@ -276,17 +276,17 @@ nsHtml5Tokenizer::emitComment(int32_t pr
 }
 
 void 
 nsHtml5Tokenizer::flushChars(PRUnichar* buf, int32_t pos)
 {
   if (pos > cstart) {
     tokenHandler->characters(buf, cstart, pos - cstart);
   }
-  cstart = PR_INT32_MAX;
+  cstart = INT32_MAX;
 }
 
 void 
 nsHtml5Tokenizer::resetAttributes()
 {
   attributes = nullptr;
 }
 
@@ -393,17 +393,17 @@ nsHtml5Tokenizer::tokenizeBuffer(nsHtml5
     case NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:
     case NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_DASH:
     case NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:
     case NS_HTML5TOKENIZER_SCRIPT_DATA_DOUBLE_ESCAPE_END: {
       cstart = start;
       break;
     }
     default: {
-      cstart = PR_INT32_MAX;
+      cstart = INT32_MAX;
       break;
     }
   }
   if (mViewSource) {
     mViewSource->SetBuffer(buffer);
     pos = stateLoop<nsHtml5ViewSourcePolicy>(state, c, pos, buffer->getBuffer(), false, returnState, buffer->getEnd());
     mViewSource->DropBuffer((pos == buffer->getEnd()) ? pos : pos + 1);
   } else {
@@ -3466,17 +3466,17 @@ nsHtml5Tokenizer::initDoctypeFields()
 }
 
 void 
 nsHtml5Tokenizer::emitCarriageReturn(PRUnichar* buf, int32_t pos)
 {
   silentCarriageReturn();
   flushChars(buf, pos);
   tokenHandler->characters(nsHtml5Tokenizer::LF, 0, 1);
-  cstart = PR_INT32_MAX;
+  cstart = INT32_MAX;
 }
 
 void 
 nsHtml5Tokenizer::emitReplacementCharacter(PRUnichar* buf, int32_t pos)
 {
   flushChars(buf, pos);
   tokenHandler->zeroOriginatingReplacementCharacter();
   cstart = pos + 1;
--- a/parser/html/nsHtml5TreeBuilder.h
+++ b/parser/html/nsHtml5TreeBuilder.h
@@ -348,13 +348,13 @@ class nsHtml5TreeBuilder : public nsAHtm
 #define NS_HTML5TREE_BUILDER_CHARSET_R 4
 #define NS_HTML5TREE_BUILDER_CHARSET_S 5
 #define NS_HTML5TREE_BUILDER_CHARSET_E 6
 #define NS_HTML5TREE_BUILDER_CHARSET_T 7
 #define NS_HTML5TREE_BUILDER_CHARSET_EQUALS 8
 #define NS_HTML5TREE_BUILDER_CHARSET_SINGLE_QUOTED 9
 #define NS_HTML5TREE_BUILDER_CHARSET_DOUBLE_QUOTED 10
 #define NS_HTML5TREE_BUILDER_CHARSET_UNQUOTED 11
-#define NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK PR_INT32_MAX
+#define NS_HTML5TREE_BUILDER_NOT_FOUND_ON_STACK INT32_MAX
 
 
 #endif
 
--- a/parser/html/nsHtml5TreeBuilderCppSupplement.h
+++ b/parser/html/nsHtml5TreeBuilderCppSupplement.h
@@ -700,18 +700,18 @@ void
 nsHtml5TreeBuilder::StartPlainTextViewSource(const nsAutoString& aTitle)
 {
   startTag(nsHtml5ElementName::ELT_TITLE,
            nsHtml5HtmlAttributes::EMPTY_ATTRIBUTES,
            false);
 
   // XUL will add the "Source of: " prefix.
   uint32_t length = aTitle.Length();
-  if (length > PR_INT32_MAX) {
-    length = PR_INT32_MAX;
+  if (length > INT32_MAX) {
+    length = INT32_MAX;
   }
   characters(aTitle.get(), 0, (int32_t)length);
   endTag(nsHtml5ElementName::ELT_TITLE);
 
   startTag(nsHtml5ElementName::ELT_LINK,
            nsHtml5ViewSourceUtils::NewLinkAttributes(),
            false);
 
--- a/parser/htmlparser/src/nsScannerString.cpp
+++ b/parser/htmlparser/src/nsScannerString.cpp
@@ -7,17 +7,17 @@
 #include <stdlib.h>
 #include "nsScannerString.h"
 
 
   /**
    * nsScannerBufferList
    */
 
-#define MAX_CAPACITY ((PR_UINT32_MAX / sizeof(PRUnichar)) - \
+#define MAX_CAPACITY ((UINT32_MAX / sizeof(PRUnichar)) - \
                       (sizeof(Buffer) + sizeof(PRUnichar)))
 
 nsScannerBufferList::Buffer*
 nsScannerBufferList::AllocBufferFromString( const nsAString& aString )
   {
     uint32_t len = aString.Length();
 
     if (len > MAX_CAPACITY)
--- a/parser/xml/src/nsSAXXMLReader.cpp
+++ b/parser/xml/src/nsSAXXMLReader.cpp
@@ -511,18 +511,18 @@ nsSAXXMLReader::ParseFromStream(nsIInput
     }
     if (NS_FAILED(rv)) {
       parserChannel->Cancel(rv);
       break;
     }
     if (! available)
       break; // blocking input stream has none available when done
 
-    if (available > PR_UINT32_MAX)
-      available = PR_UINT32_MAX;
+    if (available > UINT32_MAX)
+      available = UINT32_MAX;
 
     rv = mListener->OnDataAvailable(parserChannel, nullptr,
                                     aStream,
                                     offset,
                                     (uint32_t)available);
     if (NS_SUCCEEDED(rv))
       offset += available;
     else
--- a/rdf/base/src/nsInMemoryDataSource.cpp
+++ b/rdf/base/src/nsInMemoryDataSource.cpp
@@ -120,25 +120,25 @@ public:
               nsIRDFResource* aProperty,
               nsIRDFNode* aTarget,
               bool aTruthValue);
     Assertion(nsIRDFResource* aSource);     // PLDHashTable assertion variant
 
     ~Assertion();
 
     void AddRef() {
-        if (mRefCnt == PR_UINT16_MAX) {
+        if (mRefCnt == UINT16_MAX) {
             NS_WARNING("refcount overflow, leaking Assertion");
             return;
         }
         ++mRefCnt;
     }
 
     void Release(nsFixedSizeAllocator& aAllocator) {
-        if (mRefCnt == PR_UINT16_MAX) {
+        if (mRefCnt == UINT16_MAX) {
             NS_WARNING("refcount overflow, leaking Assertion");
             return;
         }
         if (--mRefCnt == 0)
             Destroy(aAllocator, this);
     }
 
     // For nsIRDFPurgeableDataSource
--- a/rdf/base/src/nsRDFXMLDataSource.cpp
+++ b/rdf/base/src/nsRDFXMLDataSource.cpp
@@ -528,18 +528,18 @@ RDFXMLDataSourceImpl::BlockingParse(nsIU
 
         uint64_t avail;
         if (NS_FAILED(rv = bufStream->Available(&avail)))
             break; // error
 
         if (avail == 0)
             break; // eof
 
-        if (avail > PR_UINT32_MAX)
-            avail = PR_UINT32_MAX;
+        if (avail > UINT32_MAX)
+            avail = UINT32_MAX;
 
         rv = aConsumer->OnDataAvailable(channel, nullptr, bufStream, offset, (uint32_t)avail);
         if (NS_SUCCEEDED(rv))
             offset += avail;
     }
 
     if (NS_FAILED(rv))
         channel->Cancel(rv);
--- a/security/manager/ssl/src/nsNSSComponent.cpp
+++ b/security/manager/ssl/src/nsNSSComponent.cpp
@@ -2773,21 +2773,21 @@ nsCryptoHash::UpdateFromStream(nsIInputS
   if (!data)
     return NS_ERROR_INVALID_ARG;
 
   uint64_t n;
   nsresult rv = data->Available(&n);
   if (NS_FAILED(rv))
     return rv;
 
-  // if the user has passed PR_UINT32_MAX, then read
+  // if the user has passed UINT32_MAX, then read
   // everything in the stream
 
   uint64_t len = aLen;
-  if (aLen == PR_UINT32_MAX)
+  if (aLen == UINT32_MAX)
     len = n;
 
   // So, if the stream has NO data available for the hash,
   // or if the data available is less then what the caller
   // requested, we can not fulfill the hash update.  In this
   // case, just return NS_ERROR_NOT_AVAILABLE indicating
   // that there is not enough data in the stream to satisify
   // the request.
@@ -2966,21 +2966,21 @@ NS_IMETHODIMP nsCryptoHMAC::UpdateFromSt
   if (!aStream)
     return NS_ERROR_INVALID_ARG;
 
   uint64_t n;
   nsresult rv = aStream->Available(&n);
   if (NS_FAILED(rv))
     return rv;
 
-  // if the user has passed PR_UINT32_MAX, then read
+  // if the user has passed UINT32_MAX, then read
   // everything in the stream
 
   uint64_t len = aLen;
-  if (aLen == PR_UINT32_MAX)
+  if (aLen == UINT32_MAX)
     len = n;
 
   // So, if the stream has NO data available for the hash,
   // or if the data available is less then what the caller
   // requested, we can not fulfill the HMAC update.  In this
   // case, just return NS_ERROR_NOT_AVAILABLE indicating
   // that there is not enough data in the stream to satisify
   // the request.
--- a/startupcache/StartupCacheUtils.cpp
+++ b/startupcache/StartupCacheUtils.cpp
@@ -35,17 +35,17 @@ NewObjectInputStreamFromBuffer(char* buf
 
 NS_EXPORT nsresult
 NewObjectOutputWrappedStorageStream(nsIObjectOutputStream **wrapperStream,
                                     nsIStorageStream** stream,
                                     bool wantDebugStream)
 {
   nsCOMPtr<nsIStorageStream> storageStream;
 
-  nsresult rv = NS_NewStorageStream(256, PR_UINT32_MAX, getter_AddRefs(storageStream));
+  nsresult rv = NS_NewStorageStream(256, UINT32_MAX, getter_AddRefs(storageStream));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIObjectOutputStream> objectOutput
     = do_CreateInstance("@mozilla.org/binaryoutputstream;1");
   nsCOMPtr<nsIOutputStream> outputStream
     = do_QueryInterface(storageStream);
   
   objectOutput->SetOutputStream(outputStream);
@@ -77,17 +77,17 @@ NewBufferFromStorageStream(nsIStorageStr
   nsresult rv;
   nsCOMPtr<nsIInputStream> inputStream;
   rv = storageStream->NewInputStream(0, getter_AddRefs(inputStream));
   NS_ENSURE_SUCCESS(rv, rv);
   
   uint64_t avail64;
   rv = inputStream->Available(&avail64);
   NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_TRUE(avail64 <= PR_UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
+  NS_ENSURE_TRUE(avail64 <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
 
   uint32_t avail = (uint32_t)avail64;
   nsAutoArrayPtr<char> temp (new char[avail]);
   uint32_t read;
   rv = inputStream->Read(temp, avail, &read);
   if (NS_SUCCEEDED(rv) && avail != read)
     rv = NS_ERROR_UNEXPECTED;
   
--- a/storage/src/Variant.h
+++ b/storage/src/Variant.h
@@ -107,17 +107,17 @@ struct variant_traits<int64_t>
   static inline uint16_t type() { return nsIDataType::VTYPE_INT64; }
 };
 template < >
 struct variant_integer_traits<int64_t>
 {
   static inline nsresult asInt32(int64_t aValue,
                                  int32_t *_result)
   {
-    if (aValue > PR_INT32_MAX || aValue < PR_INT32_MIN)
+    if (aValue > INT32_MAX || aValue < INT32_MIN)
       return NS_ERROR_CANNOT_CONVERT_DATA;
 
     *_result = static_cast<int32_t>(aValue);
     return NS_OK;
   }
   static inline nsresult asInt64(int64_t aValue,
                                  int64_t *_result)
   {
--- a/toolkit/components/places/Helpers.cpp
+++ b/toolkit/components/places/Helpers.cpp
@@ -248,17 +248,17 @@ GenerateRandomBytes(uint32_t aSize,
   if (rc) {
     rc = CryptGenRandom(cryptoProvider, aSize, _buffer);
     (void)CryptReleaseContext(cryptoProvider, 0);
   }
   return rc ? NS_OK : NS_ERROR_FAILURE;
 
   // On Unix, we'll just read in from /dev/urandom.
 #elif defined(XP_UNIX)
-  NS_ENSURE_ARG_MAX(aSize, PR_INT32_MAX);
+  NS_ENSURE_ARG_MAX(aSize, INT32_MAX);
   PRFileDesc* urandom = PR_Open("/dev/urandom", PR_RDONLY, 0);
   nsresult rv = NS_ERROR_FAILURE;
   if (urandom) {
     int32_t bytesRead = PR_Read(urandom, _buffer, aSize);
     if (bytesRead == static_cast<int32_t>(aSize)) {
       rv = NS_OK;
     }
     (void)PR_Close(urandom);
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -59,33 +59,33 @@ namespace places {
 
 struct VisitData {
   VisitData()
   : placeId(0)
   , visitId(0)
   , sessionId(0)
   , hidden(true)
   , typed(false)
-  , transitionType(PR_UINT32_MAX)
+  , transitionType(UINT32_MAX)
   , visitTime(0)
   , frecency(-1)
   , titleChanged(false)
   {
     guid.SetIsVoid(true);
     title.SetIsVoid(true);
   }
 
   VisitData(nsIURI* aURI,
             nsIURI* aReferrer = NULL)
   : placeId(0)
   , visitId(0)
   , sessionId(0)
   , hidden(true)
   , typed(false)
-  , transitionType(PR_UINT32_MAX)
+  , transitionType(UINT32_MAX)
   , visitTime(0)
   , frecency(-1)
   , titleChanged(false)
   {
     (void)aURI->GetSpec(spec);
     (void)GetReversedHostname(aURI, revHost);
     if (aReferrer) {
       (void)aReferrer->GetSpec(referrerSpec);
--- a/toolkit/components/places/nsFaviconService.cpp
+++ b/toolkit/components/places/nsFaviconService.cpp
@@ -600,17 +600,17 @@ nsFaviconService::ReplaceFaviconDataFrom
   // Blocking stream is OK for data URIs.
   nsCOMPtr<nsIInputStream> stream;
   rv = channel->Open(getter_AddRefs(stream));
   NS_ENSURE_SUCCESS(rv, rv);
 
   uint64_t available64;
   rv = stream->Available(&available64);
   NS_ENSURE_SUCCESS(rv, rv);
-  if (available64 == 0 || available64 > PR_UINT32_MAX / sizeof(uint8_t))
+  if (available64 == 0 || available64 > UINT32_MAX / sizeof(uint8_t))
     return NS_ERROR_FILE_TOO_BIG;
   uint32_t available = (uint32_t)available64;
 
   // Read all the decoded data.
   uint8_t* buffer = static_cast<uint8_t*>
                                (nsMemory::Alloc(sizeof(uint8_t) * available));
   if (!buffer)
     return NS_ERROR_OUT_OF_MEMORY;
@@ -663,17 +663,17 @@ nsFaviconService::SetFaviconDataFromData
   // blocking stream is OK for data URIs
   nsCOMPtr<nsIInputStream> stream;
   rv = channel->Open(getter_AddRefs(stream));
   NS_ENSURE_SUCCESS(rv, rv);
 
   uint64_t available64;
   rv = stream->Available(&available64);
   NS_ENSURE_SUCCESS(rv, rv);
-  if (available64 == 0 || available64 > PR_UINT32_MAX / sizeof(uint8_t))
+  if (available64 == 0 || available64 > UINT32_MAX / sizeof(uint8_t))
     return NS_ERROR_FAILURE;
   uint32_t available = (uint32_t)available64;
 
   // read all the decoded data
   uint8_t* buffer = static_cast<uint8_t*>
                                (nsMemory::Alloc(sizeof(uint8_t) * available));
   if (!buffer)
     return NS_ERROR_OUT_OF_MEMORY;
@@ -757,17 +757,17 @@ nsFaviconService::GetDefaultFaviconData(
     nsCOMPtr<nsIURI> defaultFaviconURI;
     nsresult rv = GetDefaultFavicon(getter_AddRefs(defaultFaviconURI));
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIInputStream> istream;
     rv = NS_OpenURI(getter_AddRefs(istream), defaultFaviconURI);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    rv = NS_ConsumeStream(istream, PR_UINT32_MAX, mDefaultFaviconData);
+    rv = NS_ConsumeStream(istream, UINT32_MAX, mDefaultFaviconData);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = istream->Close();
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (mDefaultFaviconData.IsEmpty())
       return NS_ERROR_UNEXPECTED;
   }
@@ -1070,17 +1070,17 @@ nsFaviconService::OptimizeFaviconImage(c
   rv = imgtool->EncodeScaledImage(container, aNewMimeType,
                                   mOptimizedIconDimension,
                                   mOptimizedIconDimension,
                                   EmptyString(),
                                   getter_AddRefs(iconStream));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Read the stream into a new buffer.
-  rv = NS_ConsumeStream(iconStream, PR_UINT32_MAX, aNewData);
+  rv = NS_ConsumeStream(iconStream, UINT32_MAX, aNewData);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 nsresult
 nsFaviconService::GetFaviconDataAsync(nsIURI* aFaviconURI,
                                       mozIStorageStatementCallback *aCallback)
--- a/toolkit/components/places/nsNavBookmarks.cpp
+++ b/toolkit/components/places/nsNavBookmarks.cpp
@@ -336,17 +336,17 @@ nsNavBookmarks::IsBookmarkedInDatabase(i
 
 
 nsresult
 nsNavBookmarks::AdjustIndices(int64_t aFolderId,
                               int32_t aStartIndex,
                               int32_t aEndIndex,
                               int32_t aDelta)
 {
-  NS_ASSERTION(aStartIndex >= 0 && aEndIndex <= PR_INT32_MAX &&
+  NS_ASSERTION(aStartIndex >= 0 && aEndIndex <= INT32_MAX &&
                aStartIndex <= aEndIndex, "Bad indices");
 
   // Expire all cached items for this parent, since all positions are going to
   // change.
   ExpireRecentBookmarksByParent(&mRecentBookmarksCache, aFolderId);
 
   nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
     "UPDATE moz_bookmarks SET position = position + :delta "
@@ -573,17 +573,17 @@ nsNavBookmarks::InsertBookmark(int64_t a
   NS_ENSURE_SUCCESS(rv, rv);
   if (aIndex == nsINavBookmarksService::DEFAULT_INDEX ||
       aIndex >= folderCount) {
     index = folderCount;
   }
   else {
     index = aIndex;
     // Create space for the insertion.
-    rv = AdjustIndices(aFolder, index, PR_INT32_MAX, 1);
+    rv = AdjustIndices(aFolder, index, INT32_MAX, 1);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   *aNewBookmarkId = -1;
   PRTime dateAdded = PR_Now();
   nsAutoCString guid;
   nsCString title;
   TruncateTitle(aTitle, title);
@@ -684,17 +684,17 @@ nsNavBookmarks::RemoveItem(int64_t aItem
   rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("item_id"), bookmark.id);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = stmt->Execute();
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Fix indices in the parent.
   if (bookmark.position != DEFAULT_INDEX) {
     rv = AdjustIndices(bookmark.parentId,
-                       bookmark.position + 1, PR_INT32_MAX, -1);
+                       bookmark.position + 1, INT32_MAX, -1);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   bookmark.lastModified = PR_Now();
   rv = SetItemDateInternal(LAST_MODIFIED, bookmark.parentId,
                            bookmark.lastModified);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -836,17 +836,17 @@ nsNavBookmarks::CreateContainerWithID(in
   mozStorageTransaction transaction(mDB->MainConn(), false);
 
   if (*aIndex == nsINavBookmarksService::DEFAULT_INDEX ||
       *aIndex >= folderCount) {
     index = folderCount;
   } else {
     index = *aIndex;
     // Create space for the insertion.
-    rv = AdjustIndices(aParent, index, PR_INT32_MAX, 1);
+    rv = AdjustIndices(aParent, index, INT32_MAX, 1);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   *aNewFolder = aItemId;
   PRTime dateAdded = PR_Now();
   nsAutoCString guid;
   nsCString title;
   TruncateTitle(aTitle, title);
@@ -889,17 +889,17 @@ nsNavBookmarks::InsertSeparator(int64_t 
 
   if (aIndex == nsINavBookmarksService::DEFAULT_INDEX ||
       aIndex >= folderCount) {
     index = folderCount;
   }
   else {
     index = aIndex;
     // Create space for the insertion.
-    rv = AdjustIndices(aParent, index, PR_INT32_MAX, 1);
+    rv = AdjustIndices(aParent, index, INT32_MAX, 1);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   *aNewItemId = -1;
   // Set a NULL title rather than an empty string.
   nsCString voidString;
   voidString.SetIsVoid(true);
   nsAutoCString guid;
@@ -1352,20 +1352,20 @@ nsNavBookmarks::MoveItem(int64_t aItemId
     else {
       rv = AdjustIndices(bookmark.parentId, bookmark.position + 1, newIndex, -1);
     }
     NS_ENSURE_SUCCESS(rv, rv);
   }
   else {
     // We're moving between containers, so this happens in two steps.
     // First, fill the hole from the removal from the old parent.
-    rv = AdjustIndices(bookmark.parentId, bookmark.position + 1, PR_INT32_MAX, -1);
+    rv = AdjustIndices(bookmark.parentId, bookmark.position + 1, INT32_MAX, -1);
     NS_ENSURE_SUCCESS(rv, rv);
     // Now, make room in the new parent for the insertion.
-    rv = AdjustIndices(aNewParent, newIndex, PR_INT32_MAX, 1);
+    rv = AdjustIndices(aNewParent, newIndex, INT32_MAX, 1);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   BEGIN_CRITICAL_BOOKMARK_CACHE_SECTION(bookmark.id);
 
   {
     // Update parent and position.
     nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
--- a/toolkit/components/places/nsNavHistoryResult.cpp
+++ b/toolkit/components/places/nsNavHistoryResult.cpp
@@ -3696,25 +3696,25 @@ nsNavHistoryFolderResultNode::OnItemAdde
     NS_ENSURE_SUCCESS(rv, rv);
     isQuery = IsQueryURI(itemURISpec);
   }
 
   if (aItemType != nsINavBookmarksService::TYPE_FOLDER &&
       !isQuery && excludeItems) {
     // don't update items when we aren't displaying them, but we still need
     // to adjust bookmark indices to account for the insertion
-    ReindexRange(aIndex, PR_INT32_MAX, 1);
+    ReindexRange(aIndex, INT32_MAX, 1);
     return NS_OK;
   }
 
   if (!StartIncrementalUpdate())
     return NS_OK; // folder was completely refreshed for us
 
   // adjust indices to account for insertion
-  ReindexRange(aIndex, PR_INT32_MAX, 1);
+  ReindexRange(aIndex, INT32_MAX, 1);
 
   nsRefPtr<nsNavHistoryResultNode> node;
   if (aItemType == nsINavBookmarksService::TYPE_BOOKMARK) {
     nsNavHistory* history = nsNavHistory::GetHistoryService();
     NS_ENSURE_TRUE(history, NS_ERROR_OUT_OF_MEMORY);
     rv = history->BookmarkIdToResultNode(aItemId, mOptions, getter_AddRefs(node));
     NS_ENSURE_SUCCESS(rv, rv);
   }
@@ -3788,25 +3788,25 @@ nsNavHistoryFolderResultNode::OnItemRemo
 
     NS_NOTREACHED("Removing item we don't have");
     return NS_ERROR_FAILURE;
   }
 
   if ((node->IsURI() || node->IsSeparator()) && excludeItems) {
     // don't update items when we aren't displaying them, but we do need to
     // adjust everybody's bookmark indices to account for the removal
-    ReindexRange(aIndex, PR_INT32_MAX, -1);
+    ReindexRange(aIndex, INT32_MAX, -1);
     return NS_OK;
   }
 
   if (!StartIncrementalUpdate())
     return NS_OK; // we are completely refreshed
 
   // shift all following indices down
-  ReindexRange(aIndex + 1, PR_INT32_MAX, -1);
+  ReindexRange(aIndex + 1, INT32_MAX, -1);
 
   return RemoveChildAt(index);
 }
 
 
 NS_IMETHODIMP
 nsNavHistoryResultNode::OnItemChanged(int64_t aItemId,
                                       const nsACString& aProperty,
@@ -4010,18 +4010,18 @@ nsNavHistoryFolderResultNode::OnItemMove
   if (!StartIncrementalUpdate())
     return NS_OK; // entire container was refreshed for us
 
   if (aOldParent == aNewParent) {
     // getting moved within the same folder, we don't want to do a remove and
     // an add because that will lose your tree state.
 
     // adjust bookmark indices
-    ReindexRange(aOldIndex + 1, PR_INT32_MAX, -1);
-    ReindexRange(aNewIndex, PR_INT32_MAX, 1);
+    ReindexRange(aOldIndex + 1, INT32_MAX, -1);
+    ReindexRange(aNewIndex, INT32_MAX, 1);
 
     uint32_t index;
     nsNavHistoryResultNode* node = FindChildById(aItemId, &index);
     if (!node) {
       NS_NOTREACHED("Can't find folder that is moving!");
       return NS_ERROR_FAILURE;
     }
     NS_ASSERTION(index >= 0 && index < uint32_t(mChildren.Count()),
--- a/toolkit/components/places/nsNavHistoryResult.h
+++ b/toolkit/components/places/nsNavHistoryResult.h
@@ -46,17 +46,17 @@ public:
   nsTrimInt64HashKey(const nsTrimInt64HashKey& toCopy) : mValue(toCopy.mValue) { }
   ~nsTrimInt64HashKey() { }
 
   KeyType GetKey() const { return mValue; }
   bool KeyEquals(KeyTypePointer aKey) const { return *aKey == mValue; }
 
   static KeyTypePointer KeyToPointer(KeyType aKey) { return &aKey; }
   static PLDHashNumber HashKey(KeyTypePointer aKey)
-    { return static_cast<uint32_t>((*aKey) & PR_UINT32_MAX); }
+    { return static_cast<uint32_t>((*aKey) & UINT32_MAX); }
   enum { ALLOW_MEMMOVE = true };
 
 private:
   const int64_t mValue;
 };
 
 
 // Declare methods for implementing nsINavBookmarkObserver
--- a/toolkit/components/places/nsPlacesExportService.cpp
+++ b/toolkit/components/places/nsPlacesExportService.cpp
@@ -96,17 +96,17 @@ static nsresult WriteEscapedUrl(const ns
  * Copied from nsEscape.cpp, which requires internal string API.
  */
 char*
 nsEscapeHTML(const char* string)
 {
   /* XXX Hardcoded max entity len. The +1 is for the trailing null. */
   char* escaped = nullptr;
   uint32_t len = strlen(string);
-  if (len >= (PR_UINT32_MAX / 6))
+  if (len >= (UINT32_MAX / 6))
     return nullptr;
 
   escaped = (char*)NS_Alloc((len * 6) + 1);
   if (escaped) {
     char* ptr = escaped;
     for (; *string != '\0'; string++) {
       switch(*string) {
         case '<':
--- a/toolkit/components/url-classifier/HashStore.cpp
+++ b/toolkit/components/url-classifier/HashStore.cpp
@@ -373,17 +373,17 @@ HashStore::CalculateChecksum(nsAutoCStri
   // Size of MD5 hash in bytes
   const uint32 CHECKSUM_SIZE = 16;
 
   rv = hash->Init(nsICryptoHash::MD5);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!aChecksumPresent) {
     // Hash entire file
-    rv = hash->UpdateFromStream(hashStream, PR_UINT32_MAX);
+    rv = hash->UpdateFromStream(hashStream, UINT32_MAX);
   } else {
     // Hash everything but last checksum bytes
     rv = hash->UpdateFromStream(hashStream, fileSize-CHECKSUM_SIZE);
   }
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = hash->Finish(false, aChecksum);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/uriloader/exthandler/ExternalHelperAppParent.cpp
+++ b/uriloader/exthandler/ExternalHelperAppParent.cpp
@@ -302,17 +302,17 @@ ExternalHelperAppParent::GetContentDispo
 
   aContentDispositionHeader = mContentDispositionHeader;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ExternalHelperAppParent::GetContentLength(int32_t *aContentLength)
 {
-  if (mContentLength > PR_INT32_MAX || mContentLength < 0)
+  if (mContentLength > INT32_MAX || mContentLength < 0)
     *aContentLength = -1;
   else
     *aContentLength = (int32_t)mContentLength;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 ExternalHelperAppParent::SetContentLength(int32_t aContentLength)
--- a/view/src/nsViewManager.cpp
+++ b/view/src/nsViewManager.cpp
@@ -37,17 +37,17 @@
    A note about platform assumptions:
 
    We assume that a widget is z-ordered on top of its parent.
    
    We do NOT assume anything about the relative z-ordering of sibling widgets. Even though
    we ask for a specific z-order, we don't assume that widget z-ordering actually works.
 */
 
-#define NSCOORD_NONE      PR_INT32_MIN
+#define NSCOORD_NONE      INT32_MIN
 
 #undef DEBUG_MOUSE_LOCATION
 
 static bool
 IsRefreshDriverPaintingEnabled()
 {
   static bool sRefreshDriverPaintingEnabled;
   static bool sRefreshDriverPaintingPrefCached = false;
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -2182,17 +2182,17 @@ nsWindow::OnIMETextChange(uint32_t aStar
 
     // A quirk in Android makes it necessary to pass the whole text.
     // The more efficient way would have been passing the substring from index
     // aStart to index aNewEnd
 
     nsRefPtr<nsWindow> kungFuDeathGrip(this);
     nsQueryContentEvent event(true, NS_QUERY_TEXT_CONTENT, this);
     InitEvent(event, nullptr);
-    event.InitForQueryTextContent(0, PR_UINT32_MAX);
+    event.InitForQueryTextContent(0, UINT32_MAX);
 
     DispatchEvent(&event);
     if (!event.mSucceeded)
         return NS_OK;
 
     AndroidBridge::NotifyIMEChange(event.mReply.mString.get(),
                                    event.mReply.mString.Length(),
                                    aStart, aOldEnd, aNewEnd);
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -2649,17 +2649,17 @@ NSEvent* gLastDragMouseDownEvent = nil;
         shouldRollup = gRollupListener->ShouldRollupOnMouseWheelEvent();
         // always consume scroll events that aren't over the popup
         consumeEvent = YES;
       }
 
       // if we're dealing with menus, we probably have submenus and
       // we don't want to rollup if the click is in a parent menu of
       // the current submenu
-      uint32_t popupsToRollup = PR_UINT32_MAX;
+      uint32_t popupsToRollup = UINT32_MAX;
       if (gRollupListener) {
         nsAutoTArray<nsIWidget*, 5> widgetChain;
         uint32_t sameTypeCount = gRollupListener->GetSubmenuWidgetChain(&widgetChain);
         for (uint32_t i = 0; i < widgetChain.Length(); i++) {
           nsIWidget* widget = widgetChain[i];
           NSWindow* currWindow = (NSWindow*)widget->GetNativeData(NS_NATIVE_WINDOW);
           if (nsCocoaUtils::IsEventOverWindow(theEvent, currWindow)) {
             // don't roll up if the mouse event occurred within a menu of the
--- a/widget/cocoa/nsIdleServiceX.mm
+++ b/widget/cocoa/nsIdleServiceX.mm
@@ -54,17 +54,17 @@ nsIdleServiceX::PollIdleTime(uint32_t *a
     [idleObj getBytes: &time];
   else
     time = [idleObj unsignedLongLongValue];
 
   IOObjectRelease(entry);
 
   // convert to ms from ns
   time /= 1000000;
-  if (time > PR_UINT32_MAX) // Overflow will occur
+  if (time > UINT32_MAX) // Overflow will occur
     return false;
 
   *aIdleTime = static_cast<uint32_t>(time);
 
   return true;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(false);
 }
--- a/widget/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/cocoa/nsNativeThemeCocoa.mm
@@ -144,18 +144,18 @@ extern "C" {
 {
   CGContext* cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
 
   HIThemeTrackDrawInfo tdi;
 
   tdi.version = 0;
   tdi.min = 0;
 
-  tdi.value = PR_INT32_MAX * (mValue / mMax);
-  tdi.max = PR_INT32_MAX;
+  tdi.value = INT32_MAX * (mValue / mMax);
+  tdi.max = INT32_MAX;
   tdi.bounds = NSRectToCGRect(cellFrame);
   tdi.attributes = mIsHorizontal ? kThemeTrackHorizontal : 0;
   tdi.enableState = [self controlTint] == NSClearControlTint ? kThemeTrackInactive
                                                              : kThemeTrackActive;
 
   NSControlSize size = [self controlSize];
   if (size == NSRegularControlSize) {
     tdi.kind = mIsIndeterminate ? kThemeLargeIndeterminateBar
--- a/widget/cocoa/nsPrintDialogX.mm
+++ b/widget/cocoa/nsPrintDialogX.mm
@@ -100,17 +100,17 @@ nsPrintDialogServiceX::Show(nsIDOMWindow
   int16_t pageRange;
   aSettings->GetPrintRange(&pageRange);
   if (pageRange != nsIPrintSettings::kRangeSelection) {
     PMPrintSettings nativePrintSettings = settingsX->GetPMPrintSettings();
     UInt32 firstPage, lastPage;
     OSStatus status = ::PMGetFirstPage(nativePrintSettings, &firstPage);
     if (status == noErr) {
       status = ::PMGetLastPage(nativePrintSettings, &lastPage);
-      if (status == noErr && lastPage != PR_UINT32_MAX) {
+      if (status == noErr && lastPage != UINT32_MAX) {
         aSettings->SetPrintRange(nsIPrintSettings::kRangeSpecifiedPageRange);
         aSettings->SetStartPageRange(firstPage);
         aSettings->SetEndPageRange(lastPage);
       }
     }
   }
 
   return NS_OK;
--- a/widget/gtk2/nsGtkIMModule.cpp
+++ b/widget/gtk2/nsGtkIMModule.cpp
@@ -75,17 +75,17 @@ static bool gIsVirtualKeyboardOpened = f
 
 nsGtkIMModule::nsGtkIMModule(nsWindow* aOwnerWindow) :
     mOwnerWindow(aOwnerWindow), mLastFocusedWindow(nullptr),
     mContext(nullptr),
 #ifndef NS_IME_ENABLED_ON_PASSWORD_FIELD
     mSimpleContext(nullptr),
 #endif
     mDummyContext(nullptr),
-    mCompositionStart(PR_UINT32_MAX), mProcessingKeyEvent(nullptr),
+    mCompositionStart(UINT32_MAX), mProcessingKeyEvent(nullptr),
     mCompositionState(eCompositionState_NotComposing),
     mIsIMFocused(false), mIgnoreNativeCompositionEvent(false)
 {
 #ifdef PR_LOGGING
     if (!gGtkIMLog) {
         gGtkIMLog = PR_NewLogModule("nsGtkIMModuleWidgets");
     }
 #endif
@@ -1050,17 +1050,17 @@ nsGtkIMModule::DispatchCompositionStart(
     }
 
     nsEventStatus status;
     nsQueryContentEvent selection(true, NS_QUERY_SELECTED_TEXT,
                                   mLastFocusedWindow);
     InitEvent(selection);
     mLastFocusedWindow->DispatchEvent(&selection, status);
 
-    if (!selection.mSucceeded || selection.mReply.mOffset == PR_UINT32_MAX) {
+    if (!selection.mSucceeded || selection.mReply.mOffset == UINT32_MAX) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, cannot query the selection offset"));
         return false;
     }
 
     // XXX The composition start point might be changed by composition events
     //     even though we strongly hope it doesn't happen.
     //     Every composition event should have the start offset for the result
@@ -1134,17 +1134,17 @@ nsGtkIMModule::DispatchCompositionEnd()
     nsCompositionEvent compEvent(true, NS_COMPOSITION_END,
                                  mLastFocusedWindow);
     InitEvent(compEvent);
     compEvent.data = mDispatchedCompositionString;
     nsEventStatus status;
     nsCOMPtr<nsIWidget> kungFuDeathGrip = mLastFocusedWindow;
     mLastFocusedWindow->DispatchEvent(&compEvent, status);
     mCompositionState = eCompositionState_NotComposing;
-    mCompositionStart = PR_UINT32_MAX;
+    mCompositionStart = UINT32_MAX;
     mDispatchedCompositionString.Truncate();
     if (static_cast<nsWindow*>(kungFuDeathGrip.get())->IsDestroyed() ||
         kungFuDeathGrip != mLastFocusedWindow) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    NOTE, the focused widget was destroyed/changed by compositionend event"));
         return false;
     }
 
@@ -1373,17 +1373,17 @@ nsGtkIMModule::SetTextRangeList(nsTArray
 
 void
 nsGtkIMModule::SetCursorPosition(uint32_t aTargetOffset)
 {
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("GtkIMModule(%p): SetCursorPosition, aTargetOffset=%u",
          this, aTargetOffset));
 
-    if (aTargetOffset == PR_UINT32_MAX) {
+    if (aTargetOffset == UINT32_MAX) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, aTargetOffset is wrong offset"));
         return;
     }
 
     if (!mLastFocusedWindow) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, there are no focused window"));
@@ -1462,29 +1462,29 @@ nsGtkIMModule::GetCurrentParagraph(nsASt
     }
 
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("        selOffset=%u, selLength=%u",
          selOffset, selLength));
 
     // XXX nsString::Find and nsString::RFind take int32_t for offset, so,
     //     we cannot support this request when the current offset is larger
-    //     than PR_INT32_MAX.
-    if (selOffset > PR_INT32_MAX || selLength > PR_INT32_MAX ||
-        selOffset + selLength > PR_INT32_MAX) {
+    //     than INT32_MAX.
+    if (selOffset > INT32_MAX || selLength > INT32_MAX ||
+        selOffset + selLength > INT32_MAX) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, The selection is out of range"));
         return NS_ERROR_FAILURE;
     }
 
     // Get all text contents of the focused editor
     nsQueryContentEvent queryTextContentEvent(true,
                                               NS_QUERY_TEXT_CONTENT,
                                               mLastFocusedWindow);
-    queryTextContentEvent.InitForQueryTextContent(0, PR_UINT32_MAX);
+    queryTextContentEvent.InitForQueryTextContent(0, UINT32_MAX);
     mLastFocusedWindow->DispatchEvent(&queryTextContentEvent, status);
     NS_ENSURE_TRUE(queryTextContentEvent.mSucceeded, NS_ERROR_FAILURE);
 
     nsAutoString textContent(queryTextContentEvent.mReply.mString);
     if (selOffset + selLength > textContent.Length()) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, The selection is invalid, textContent.Length()=%u",
              textContent.Length()));
@@ -1569,17 +1569,17 @@ nsGtkIMModule::DeleteText(const int32_t 
 
         selOffset = querySelectedTextEvent.mReply.mOffset;
     }
 
     // Get all text contents of the focused editor
     nsQueryContentEvent queryTextContentEvent(true,
                                               NS_QUERY_TEXT_CONTENT,
                                               mLastFocusedWindow);
-    queryTextContentEvent.InitForQueryTextContent(0, PR_UINT32_MAX);
+    queryTextContentEvent.InitForQueryTextContent(0, UINT32_MAX);
     mLastFocusedWindow->DispatchEvent(&queryTextContentEvent, status);
     NS_ENSURE_TRUE(queryTextContentEvent.mSucceeded, NS_ERROR_FAILURE);
     if (queryTextContentEvent.mReply.mString.IsEmpty()) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, there is no contents"));
         return NS_ERROR_FAILURE;
     }
 
--- a/widget/gtk2/nsGtkKeyUtils.cpp
+++ b/widget/gtk2/nsGtkKeyUtils.cpp
@@ -380,17 +380,17 @@ KeymapWrapper::InitBySystemSettings()
     // And also Super and Hyper share the Mod4. In such cases, we need to
     // decide which modifier flag means one of DOM modifiers.
 
     // mod[0] is Modifier introduced by Mod1.
     Modifier mod[5];
     int32_t foundLevel[5];
     for (uint32_t i = 0; i < ArrayLength(mod); i++) {
         mod[i] = NOT_MODIFIER;
-        foundLevel[i] = PR_INT32_MAX;
+        foundLevel[i] = INT32_MAX;
     }
     const uint32_t map_size = 8 * xmodmap->max_keypermod;
     for (uint32_t i = 0; i < map_size; i++) {
         KeyCode keycode = xmodmap->modifiermap[i];
         PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS,
             ("KeymapWrapper(%p): InitBySystemSettings, "
              "  i=%d, keycode=0x%08X",
              this, i, keycode));
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -4726,17 +4726,17 @@ check_for_rollup(gdouble aMouseX, gdoubl
             bool rollup = true;
             if (aIsWheel) {
                 rollup = gRollupListener->ShouldRollupOnMouseWheelEvent();
                 retVal = true;
             }
             // if we're dealing with menus, we probably have submenus and
             // we don't want to rollup if the click is in a parent menu of
             // the current submenu
-            uint32_t popupsToRollup = PR_UINT32_MAX;
+            uint32_t popupsToRollup = UINT32_MAX;
             if (!aAlwaysRollup) {
                 nsAutoTArray<nsIWidget*, 5> widgetChain;
                 uint32_t sameTypeCount = gRollupListener->GetSubmenuWidgetChain(&widgetChain);
                 for (uint32_t i=0; i<widgetChain.Length(); ++i) {
                     nsIWidget* widget = widgetChain[i];
                     GdkWindow* currWindow =
                         (GdkWindow*) widget->GetNativeData(NS_NATIVE_WINDOW);
                     if (is_mouse_in_window(currWindow, aMouseX, aMouseY)) {
@@ -4754,17 +4754,17 @@ check_for_rollup(gdouble aMouseX, gdoubl
                       break;
                     }
                 } // foreach parent menu widget
             } // if rollup listener knows about menus
 
             // if we've determined that we should still rollup, do it.
             if (rollup) {
                 gRollupListener->Rollup(popupsToRollup);
-                if (popupsToRollup == PR_UINT32_MAX) {
+                if (popupsToRollup == UINT32_MAX) {
                     retVal = true;
                 }
             }
         }
     } else {
         gRollupWindow = nullptr;
         gRollupListener = nullptr;
     }
--- a/widget/nsGUIEvent.h
+++ b/widget/nsGUIEvent.h
@@ -1369,17 +1369,17 @@ public:
     bool mReversed; // true if selection is reversed (end < start)
     bool mHasSelection; // true if the selection exists
     bool mWidgetIsHit; // true if DOM element under mouse belongs to widget
     // used by NS_QUERY_SELECTION_AS_TRANSFERABLE
     nsCOMPtr<nsITransferable> mTransferable;
   } mReply;
 
   enum {
-    NOT_FOUND = PR_UINT32_MAX
+    NOT_FOUND = UINT32_MAX
   };
 
   // values of mComputedScrollAction
   enum {
     SCROLL_ACTION_NONE,
     SCROLL_ACTION_LINE,
     SCROLL_ACTION_PAGE
   };
--- a/widget/nsIRollupListener.h
+++ b/widget/nsIRollupListener.h
@@ -15,17 +15,17 @@ class nsIWidget;
 class nsIRollupListener {
  public: 
 
   /**
    * Notifies the object to rollup, optionally returning the node that
    * was just rolled up.
    *
    * aCount is the number of popups in a chain to close. If this is
-   * PR_UINT32_MAX, then all popups are closed.
+   * UINT32_MAX, then all popups are closed.
    * If aGetLastRolledUp is true, then return the last rolled up popup,
    * if this is supported.
    */
   virtual nsIContent* Rollup(uint32_t aCount, bool aGetLastRolledUp = false) = 0;
 
   /**
    * Asks the RollupListener if it should rollup on mousevents
    */
--- a/widget/os2/nsWindow.cpp
+++ b/widget/os2/nsWindow.cpp
@@ -491,17 +491,17 @@ NS_METHOD nsWindow::Destroy()
   if ((mWindowState & nsWindowState_eLive) && mParent) {
     nsBaseWidget::Destroy();
   }
 
   // just to be safe. If we're going away and for some reason we're still
   // the rollup widget, rollup and turn off capture.
   if (this == gRollupWidget) {
     if (gRollupListener) {
-      gRollupListener->Rollup(PR_UINT32_MAX);
+      gRollupListener->Rollup(UINT32_MAX);
     }
     CaptureRollupEvents(nullptr, false, true);
   }
 
   HWND hMain = GetMainWindow();
   if (hMain) {
     DEBUGFOCUS(Destroy);
     if (hMain == WinQueryFocus(HWND_DESKTOP)) {
@@ -1580,17 +1580,17 @@ bool nsWindow::RollupOnButtonDown(ULONG 
 {
   // Exit if the event is inside the most recent popup.
   if (EventIsInsideWindow((nsWindow*)gRollupWidget)) {
     return false;
   }
 
   // See if we're dealing with a menu.  If so, exit if the
   // event was inside a parent of the current submenu.
-  uint32_t popupsToRollup = PR_UINT32_MAX;
+  uint32_t popupsToRollup = UINT32_MAX;
 
   if (gRollupListener) {
     nsAutoTArray<nsIWidget*, 5> widgetChain;
     uint32_t sameTypeCount = gRollupListener->GetSubmenuWidgetChain(&widgetChain);
     for (uint32_t i = 0; i < widgetChain.Length(); ++i) {
       nsIWidget* widget = widgetChain[i];
       if (EventIsInsideWindow((nsWindow*)widget)) {
         if (i < sameTypeCount) {
@@ -1630,17 +1630,17 @@ void nsWindow::RollupOnFocusLost(HWND aF
     for (uint32_t i = 0; i < widgetChain.Length(); ++i) {
       if (((nsWindow*)widgetChain[i])->mWnd == aFocus) {
         return;
       }
     }
   }
 
   // Rollup all popups.
-  gRollupListener->Rollup(PR_UINT32_MAX);
+  gRollupListener->Rollup(UINT32_MAX);
   return;
 }
 
 //=============================================================================
 //  nsWindow's Window Procedure
 //=============================================================================
 
 // This is the actual wndproc;  it does some preprocessing then passes
--- a/widget/os2/os2FrameWindow.cpp
+++ b/widget/os2/os2FrameWindow.cpp
@@ -592,17 +592,17 @@ MRESULT EXPENTRY fnwpFrame(HWND hwnd, UL
 {
   // check to see if we have a rollup listener registered
   if (gRollupListener && gRollupWidget) {
     if (msg == WM_TRACKFRAME || msg == WM_MINMAXFRAME ||
         msg == WM_BUTTON1DOWN || msg == WM_BUTTON2DOWN ||
         msg == WM_BUTTON3DOWN) {
       // Rollup if the event is outside the popup
       if (!nsWindow::EventIsInsideWindow((nsWindow*)gRollupWidget)) {
-        gRollupListener->Rollup(PR_UINT32_MAX);
+        gRollupListener->Rollup(UINT32_MAX);
       }
     }
   }
 
   os2FrameWindow* pFrame = (os2FrameWindow*)WinQueryWindowPtr(hwnd, QWL_USER);
   return pFrame->ProcessFrameMessage(msg, mp1, mp2);
 }
 
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -924,17 +924,17 @@ check_for_rollup(double aMouseX, double 
             bool rollup = true;
             if (aIsWheel) {
                 rollup = gRollupListener->ShouldRollupOnMouseWheelEvent();
                 retVal = true;
             }
             // if we're dealing with menus, we probably have submenus and
             // we don't want to rollup if the clickis in a parent menu of
             // the current submenu
-            uint32_t popupsToRollup = PR_UINT32_MAX;
+            uint32_t popupsToRollup = UINT32_MAX;
             if (gRollupListener) {
                 nsAutoTArray<nsIWidget*, 5> widgetChain;
                 uint32_t sameTypeCount = gRollupListener->GetSubmenuWidgetChain(&widgetChain);
                 for (uint32_t i=0; i<widgetChain.Length(); ++i) {
                     nsIWidget* widget =  widgetChain[i];
                     MozQWidget* currWindow =
                         (MozQWidget*) widget->GetNativeData(NS_NATIVE_WINDOW);
                     if (is_mouse_in_window(currWindow, aMouseX, aMouseY)) {
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -588,17 +588,17 @@ NS_IMETHODIMP AsyncWriteIconToDisk::Run(
   nsCOMPtr<nsIOutputStream> outputStream;
   rv = NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), icoFile);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Obtain the ICO buffer size from the re-encoded ICO stream
   uint64_t bufSize64;
   rv = iconStream->Available(&bufSize64);
   NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_TRUE(bufSize64 <= PR_UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
+  NS_ENSURE_TRUE(bufSize64 <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
 
   uint32_t bufSize = (uint32_t)bufSize64;
 
   // Setup a buffered output stream from the stream object
   // so that we can simply use WriteFrom with the stream object
   nsCOMPtr<nsIOutputStream> bufferedOutputStream;
   rv = NS_NewBufferedOutputStream(getter_AddRefs(bufferedOutputStream),
                                   outputStream, bufSize);
--- a/widget/windows/nsIMM32Handler.cpp
+++ b/widget/windows/nsIMM32Handler.cpp
@@ -1477,27 +1477,27 @@ nsIMM32Handler::HandleDocumentFeed(nsWin
     targetLength = int32_t(selection.mReply.mString.Length());
   } else {
     targetOffset = int32_t(mCompositionStart);
     targetLength = int32_t(mCompositionString.Length());
   }
 
   // XXX nsString::Find and nsString::RFind take int32_t for offset, so,
   //     we cannot support this message when the current offset is larger than
-  //     PR_INT32_MAX.
+  //     INT32_MAX.
   if (targetOffset < 0 || targetLength < 0 ||
       targetOffset + targetLength < 0) {
     PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
       ("IMM32: HandleDocumentFeed, FAILED (The selection is out of range)\n"));
     return false;
   }
 
   // Get all contents of the focused editor.
   nsQueryContentEvent textContent(true, NS_QUERY_TEXT_CONTENT, aWindow);
-  textContent.InitForQueryTextContent(0, PR_UINT32_MAX);
+  textContent.InitForQueryTextContent(0, UINT32_MAX);
   aWindow->InitEvent(textContent, &point);
   aWindow->DispatchWindowEvent(&textContent);
   if (!textContent.mSucceeded) {
     PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
       ("IMM32: HandleDocumentFeed, FAILED (NS_QUERY_TEXT_CONTENT)\n"));
     return false;
   }
 
--- a/widget/windows/nsTextStore.cpp
+++ b/widget/windows/nsTextStore.cpp
@@ -337,17 +337,17 @@ nsTextStore::nsTextStore()
     ("TSF: 0x%p nsTextStore::nsTestStore(): instance is created", this));
 
   mRefCnt = 1;
   mEditCookie = 0;
   mSinkMask = 0;
   mWindow = nullptr;
   mLock = 0;
   mLockQueued = 0;
-  mTextChange.acpStart = PR_INT32_MAX;
+  mTextChange.acpStart = INT32_MAX;
   mTextChange.acpOldEnd = mTextChange.acpNewEnd = 0;
   mLastDispatchedTextEvent = nullptr;
 }
 
 nsTextStore::~nsTextStore()
 {
   PR_LOG(sTextStoreLog, PR_LOG_ALWAYS,
     ("TSF: 0x%p nsTextStore instance is destroyed, "
@@ -1386,17 +1386,17 @@ nsTextStore::GetText(LONG acpStart,
   *pcchPlainOut = 0;
   if (pchPlain && cchPlainReq) *pchPlain = 0;
   if (pulRunInfoOut) *pulRunInfoOut = 0;
   if (pacpNext) *pacpNext = acpStart;
   if (prgRunInfo && ulRunInfoReq) {
     prgRunInfo->uCount = 0;
     prgRunInfo->type = TS_RT_PLAIN;
   }
-  uint32_t length = -1 == acpEnd ? PR_UINT32_MAX : uint32_t(acpEnd - acpStart);
+  uint32_t length = -1 == acpEnd ? UINT32_MAX : uint32_t(acpEnd - acpStart);
   if (cchPlainReq && cchPlainReq - 1 < length) {
     length = cchPlainReq - 1;
   }
   if (length) {
     LONG compNewStart = 0, compOldEnd = 0, compNewEnd = 0;
     if (mCompositionView) {
       // Sometimes GetText gets called between InsertTextAtSelection and
       // OnUpdateComposition. In this case the returned text would
@@ -1691,17 +1691,17 @@ nsTextStore::GetEndACP(LONG *pacp)
             "null argument", this));
     return E_INVALIDARG;
   }
 
   // Flattened text is retrieved and its length returned
   nsQueryContentEvent event(true, NS_QUERY_TEXT_CONTENT, mWindow);
   mWindow->InitEvent(event);
   // Return entire text
-  event.InitForQueryTextContent(0, PR_INT32_MAX);
+  event.InitForQueryTextContent(0, INT32_MAX);
   mWindow->DispatchWindowEvent(&event);
   if (!event.mSucceeded) {
     PR_LOG(sTextStoreLog, PR_LOG_ERROR,
            ("TSF: 0x%p   nsTextStore::GetEndACP() FAILED due to "
             "NS_QUERY_TEXT_CONTENT failure", this));
     return E_FAIL;
   }
   *pacp = LONG(event.mReply.mString.Length());
@@ -2594,24 +2594,24 @@ nsTextStore::OnTextChangeMsgInternal(voi
          ("TSF: 0x%p nsTextStore::OnTextChangeMsgInternal(), mLock=%s, "
           "mSink=0x%p, mSinkMask=%s, mTextChange={ acpStart=%ld, "
           "acpOldEnd=%ld, acpNewEnd=%ld }",
           this, GetLockFlagNameStr(mLock).get(), mSink.get(),
           GetSinkMaskNameStr(mSinkMask).get(), mTextChange.acpStart,
           mTextChange.acpOldEnd, mTextChange.acpNewEnd));
 
   if (!mLock && mSink && 0 != (mSinkMask & TS_AS_TEXT_CHANGE) &&
-      PR_INT32_MAX > mTextChange.acpStart) {
+      INT32_MAX > mTextChange.acpStart) {
     PR_LOG(sTextStoreLog, PR_LOG_ALWAYS,
            ("TSF: 0x%p   nsTextStore::OnTextChangeMsgInternal(), calling"
             "mSink->OnTextChange(0, { acpStart=%ld, acpOldEnd=%ld, "
             "acpNewEnd=%ld })...", this, mTextChange.acpStart,
             mTextChange.acpOldEnd, mTextChange.acpNewEnd));
     mSink->OnTextChange(0, &mTextChange);
-    mTextChange.acpStart = PR_INT32_MAX;
+    mTextChange.acpStart = INT32_MAX;
     mTextChange.acpOldEnd = mTextChange.acpNewEnd = 0;
   }
 }
 
 nsresult
 nsTextStore::OnSelectionChangeInternal(void)
 {
   PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -7912,17 +7912,17 @@ nsWindow::DealWithPopups(HWND inWnd, UIN
       if (rollup && (inMsg == WM_MOUSEWHEEL || inMsg == WM_MOUSEHWHEEL))
       {
         rollup = sRollupListener->ShouldRollupOnMouseWheelEvent();
         *outResult = true;
       }
 
       // If we're dealing with menus, we probably have submenus and we don't
       // want to rollup if the click is in a parent menu of the current submenu.
-      uint32_t popupsToRollup = PR_UINT32_MAX;
+      uint32_t popupsToRollup = UINT32_MAX;
       if (rollup) {
         if ( sRollupListener ) {
           nsAutoTArray<nsIWidget*, 5> widgetChain;
           uint32_t sameTypeCount = sRollupListener->GetSubmenuWidgetChain(&widgetChain);
           for ( uint32_t i = 0; i < widgetChain.Length(); ++i ) {
             nsIWidget* widget = widgetChain[i];
             if ( nsWindow::EventIsInsideWindow(inMsg, (nsWindow*)widget) ) {
               // don't roll up if the mouse event occurred within a menu of the
@@ -7936,17 +7936,17 @@ nsWindow::DealWithPopups(HWND inWnd, UIN
                 popupsToRollup = sameTypeCount;
               }
               break;
             }
           } // foreach parent menu widget
         } // if rollup listener knows about menus
       }
 
-      if (inMsg == WM_MOUSEACTIVATE && popupsToRollup == PR_UINT32_MAX) {
+      if (inMsg == WM_MOUSEACTIVATE && popupsToRollup == UINT32_MAX) {
         // Prevent the click inside the popup from causing a change in window
         // activation. Since the popup is shown non-activated, we need to eat
         // any requests to activate the window while it is displayed. Windows
         // will automatically activate the popup on the mousedown otherwise.
         if (!rollup) {
           *outResult = MA_NOACTIVATE;
           return TRUE;
         }
@@ -7999,17 +7999,17 @@ nsWindow::DealWithPopups(HWND inWnd, UIN
               }
             }
           }
           return TRUE;
         }
         // if we are only rolling up some popups, don't activate and don't let
         // the event go through. This prevents clicks menus higher in the
         // chain from opening when a context menu is open
-        if (popupsToRollup != PR_UINT32_MAX && inMsg == WM_MOUSEACTIVATE) {
+        if (popupsToRollup != UINT32_MAX && inMsg == WM_MOUSEACTIVATE) {
           *outResult = MA_NOACTIVATEANDEAT;
           return TRUE;
         }
       }
     } // if event that might trigger a popup to rollup
   } // if rollup listeners registered
 
   return FALSE;
--- a/widget/xpwidgets/PuppetWidget.cpp
+++ b/widget/xpwidgets/PuppetWidget.cpp
@@ -395,17 +395,17 @@ PuppetWidget::OnIMEFocusChange(bool aFoc
   if (!mTabChild)
     return NS_ERROR_FAILURE;
 
   if (aFocus) {
     nsEventStatus status;
     nsQueryContentEvent queryEvent(true, NS_QUERY_TEXT_CONTENT, this);
     InitEvent(queryEvent, nullptr);
     // Query entire content
-    queryEvent.InitForQueryTextContent(0, PR_UINT32_MAX);
+    queryEvent.InitForQueryTextContent(0, UINT32_MAX);
     DispatchEvent(&queryEvent, status);
 
     if (queryEvent.mSucceeded) {
       mTabChild->SendNotifyIMETextHint(queryEvent.mReply.mString);
     }
   } else {
     // ResetInputState might not have been called yet
     ResetInputState();
@@ -433,17 +433,17 @@ PuppetWidget::OnIMETextChange(uint32_t a
 {
   if (!mTabChild)
     return NS_ERROR_FAILURE;
 
   if (mIMEPreference.mWantHints) {
     nsEventStatus status;
     nsQueryContentEvent queryEvent(true, NS_QUERY_TEXT_CONTENT, this);
     InitEvent(queryEvent, nullptr);
-    queryEvent.InitForQueryTextContent(0, PR_UINT32_MAX);
+    queryEvent.InitForQueryTextContent(0, UINT32_MAX);
     DispatchEvent(&queryEvent, status);
 
     if (queryEvent.mSucceeded) {
       mTabChild->SendNotifyIMETextHint(queryEvent.mReply.mString);
     }
   }
   if (mIMEPreference.mWantUpdates) {
     mTabChild->SendNotifyIMETextChange(aStart, aEnd, aNewEnd);
--- a/widget/xpwidgets/nsIdleService.cpp
+++ b/widget/xpwidgets/nsIdleService.cpp
@@ -315,17 +315,17 @@ already_AddRefed<nsIdleService>
 nsIdleService::GetInstance()
 {
   nsRefPtr<nsIdleService> instance(gIdleService);
   return instance.forget();
 }
 
 nsIdleService::nsIdleService() : mCurrentlySetToTimeoutAtInPR(0),
                                  mAnyObserverIdle(false),
-                                 mDeltaToNextIdleSwitchInS(PR_UINT32_MAX),
+                                 mDeltaToNextIdleSwitchInS(UINT32_MAX),
                                  mLastUserInteractionInPR(PR_Now())
 {
 #ifdef PR_LOGGING
   if (sLog == NULL)
     sLog = PR_NewLogModule("idleService");
 #endif
   MOZ_ASSERT(!gIdleService);
   gIdleService = this;
@@ -355,17 +355,17 @@ nsIdleService::AddIdleObserver(nsIObserv
 #ifdef ANDROID
   __android_log_print(ANDROID_LOG_INFO, "IdleService", "Register idle observer %x for %d seconds",
                       aObserver, aIdleTimeInS);
 #endif
 
   NS_ENSURE_ARG_POINTER(aObserver);
   // We don't accept idle time at 0, and we can't handle idle time that are too
   // high either - no more than ~136 years.
-  NS_ENSURE_ARG_RANGE(aIdleTimeInS, 1, (PR_UINT32_MAX / 10) - 1);
+  NS_ENSURE_ARG_RANGE(aIdleTimeInS, 1, (UINT32_MAX / 10) - 1);
 
   // Put the time + observer in a struct we can keep:
   IdleListener listener(aObserver, aIdleTimeInS);
 
   if (!mArrayListeners.AppendElement(listener)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
@@ -450,17 +450,17 @@ nsIdleService::ResetIdleTimeOut(uint32_t
     PR_LOG(sLog, PR_LOG_DEBUG,
            ("idleService: Reset idle timeout: no idle observers"));
     return NS_OK;
   }
 
   // Mark all idle services as non-idle, and calculate the next idle timeout.
   Telemetry::AutoTimer<Telemetry::IDLE_NOTIFY_BACK_MS> timer;
   nsCOMArray<nsIObserver> notifyList;
-  mDeltaToNextIdleSwitchInS = PR_UINT32_MAX;
+  mDeltaToNextIdleSwitchInS = UINT32_MAX;
 
   // Loop through all listeners, and find any that have detected idle.
   for (uint32_t i = 0; i < mArrayListeners.Length(); i++) {
     IdleListener& curListener = mArrayListeners.ElementAt(i);
 
     // If the listener was idle, then he shouldn't be any longer.
     if (curListener.isIdle) {
       notifyList.AppendObject(curListener.observer);
@@ -627,17 +627,17 @@ nsIdleService::IdleTimerCallback(void)
     ReconfigureTimer();
     return;
   }
 
   // Tell expired listeners they are expired,and find the next timeout
   Telemetry::AutoTimer<Telemetry::IDLE_NOTIFY_IDLE_MS> timer;
 
   // We need to initialise the time to the next idle switch.
-  mDeltaToNextIdleSwitchInS = PR_UINT32_MAX;
+  mDeltaToNextIdleSwitchInS = UINT32_MAX;
 
   // Create list of observers that should be notified.
   nsCOMArray<nsIObserver> notifyList;
 
   for (uint32_t i = 0; i < mArrayListeners.Length(); i++) {
     IdleListener& curListener = mArrayListeners.ElementAt(i);
 
     // We are only interested in items, that are not in the idle state.
@@ -751,17 +751,17 @@ nsIdleService::SetTimerExpiryIfBefore(PR
   }
 }
 
 
 void
 nsIdleService::ReconfigureTimer(void)
 {
   // Check if either someone is idle, or someone will become idle.
-  if (!mAnyObserverIdle && PR_UINT32_MAX == mDeltaToNextIdleSwitchInS) {
+  if (!mAnyObserverIdle && UINT32_MAX == mDeltaToNextIdleSwitchInS) {
     // If not, just let any existing timers run to completion
     // And bail out.
     PR_LOG(sLog, PR_LOG_DEBUG,
            ("idleService: ReconfigureTimer: no idle or waiting observers"));
 #ifdef ANDROID
   __android_log_print(ANDROID_LOG_INFO, "IdleService",
                       "ReconfigureTimer: no idle or waiting observers");
 #endif
--- a/widget/xpwidgets/nsNativeTheme.cpp
+++ b/widget/xpwidgets/nsNativeTheme.cpp
@@ -19,17 +19,17 @@
 #include "nsIComponentManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsProgressFrame.h"
 #include "nsMeterFrame.h"
 #include "nsMenuFrame.h"
 #include "mozilla/dom/Element.h"
 
 nsNativeTheme::nsNativeTheme()
-: mAnimatedContentTimeout(PR_UINT32_MAX)
+: mAnimatedContentTimeout(UINT32_MAX)
 {
 }
 
 NS_IMPL_ISUPPORTS1(nsNativeTheme, nsITimerCallback)
 
 nsIPresShell *
 nsNativeTheme::GetPresShell(nsIFrame* aFrame)
 {
@@ -566,17 +566,17 @@ nsNativeTheme::Notify(nsITimer* aTimer)
   for (uint32_t index = 0; index < count; index++) {
     nsIFrame* frame = mAnimatedContentList[index]->GetPrimaryFrame();
     if (frame) {
       frame->InvalidateFrame();
     }
   }
 
   mAnimatedContentList.Clear();
-  mAnimatedContentTimeout = PR_UINT32_MAX;
+  mAnimatedContentTimeout = UINT32_MAX;
   return NS_OK;
 }
 
 nsIFrame*
 nsNativeTheme::GetAdjacentSiblingFrameWithSameAppearance(nsIFrame* aFrame,
                                                          bool aNextSibling)
 {
   if (!aFrame)
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -1781,32 +1781,32 @@ GCGraphBuilder::NoteNativeRoot(void *roo
     NoteRoot(root, participant);
 }
 
 NS_IMETHODIMP_(void)
 GCGraphBuilder::DescribeRefCountedNode(nsrefcnt refCount, const char *objName)
 {
     if (refCount == 0)
         Fault("zero refcount", mCurrPi);
-    if (refCount == PR_UINT32_MAX)
+    if (refCount == UINT32_MAX)
         Fault("overflowing refcount", mCurrPi);
     sCollector->mVisitedRefCounted++;
 
     if (mListener) {
         mListener->NoteRefCountedObject((uint64_t)mCurrPi->mPointer, refCount,
                                         objName);
     }
 
     DescribeNode(refCount, objName);
 }
 
 NS_IMETHODIMP_(void)
 GCGraphBuilder::DescribeGCedNode(bool isMarked, const char *objName)
 {
-    uint32_t refCount = isMarked ? PR_UINT32_MAX : 0;
+    uint32_t refCount = isMarked ? UINT32_MAX : 0;
     sCollector->mVisitedGCed++;
 
     if (mListener) {
         mListener->NoteGCedObject((uint64_t)mCurrPi->mPointer, isMarked,
                                   objName);
     }
 
     DescribeNode(refCount, objName);
@@ -2731,17 +2731,17 @@ nsCycleCollector::BeginCollection(bool a
 
         if (aListener) {
             aListener->BeginResults();
 
             NodePool::Enumerator etor(mGraph.mNodes);
             while (!etor.IsDone()) {
                 PtrInfo *pi = etor.GetNext();
                 if (pi->mColor == black &&
-                    pi->mRefCount > 0 && pi->mRefCount < PR_UINT32_MAX &&
+                    pi->mRefCount > 0 && pi->mRefCount < UINT32_MAX &&
                     pi->mInternalRefs != pi->mRefCount) {
                     aListener->DescribeRoot((uint64_t)pi->mPointer,
                                             pi->mInternalRefs);
                 }
             }
         }
 
 #ifdef DEBUG_CC
--- a/xpcom/build/FileLocation.cpp
+++ b/xpcom/build/FileLocation.cpp
@@ -123,34 +123,34 @@ FileLocation::GetData(Data &data)
 nsresult
 FileLocation::Data::GetSize(uint32_t *result)
 {
   if (mFd) {
     PRFileInfo64 fileInfo;
     if (PR_SUCCESS != PR_GetOpenFileInfo64(mFd, &fileInfo))
       return NS_ErrorAccordingToNSPR();
 
-    if (fileInfo.size > int64_t(PR_UINT32_MAX))
+    if (fileInfo.size > int64_t(UINT32_MAX))
       return NS_ERROR_FILE_TOO_BIG;
 
     *result = fileInfo.size;
     return NS_OK;
   } else if (mItem) {
     *result = mItem->RealSize();
     return NS_OK;
   }
   return NS_ERROR_NOT_INITIALIZED;
 }
 
 nsresult
 FileLocation::Data::Copy(char *buf, uint32_t len)
 {
   if (mFd) {
     for (uint32_t totalRead = 0; totalRead < len; ) {
-      int32_t read = PR_Read(mFd, buf + totalRead, NS_MIN(len - totalRead, uint32_t(PR_INT32_MAX)));
+      int32_t read = PR_Read(mFd, buf + totalRead, NS_MIN(len - totalRead, uint32_t(INT32_MAX)));
       if (read < 0)
         return NS_ErrorAccordingToNSPR();
       totalRead += read;
     }
     return NS_OK;
   } else if (mItem) {
     nsZipCursor cursor(mItem, mZip, reinterpret_cast<uint8_t *>(buf), len, true);
     uint32_t readLen;
--- a/xpcom/build/nsXPCOMStrings.cpp
+++ b/xpcom/build/nsXPCOMStrings.cpp
@@ -33,17 +33,17 @@ NS_StringContainerInit2(nsStringContaine
       "nsStringContainer is not large enough");
 
   if (!aData)
   {
     new (&aContainer) nsString();
   }
   else
   {
-    if (aDataLength == PR_UINT32_MAX)
+    if (aDataLength == UINT32_MAX)
     {
       NS_ENSURE_ARG(!(aFlags & NS_STRING_CONTAINER_INIT_SUBSTRING));
       aDataLength = nsCharTraits<PRUnichar>::length(aData);
     }
 
     if (aFlags & (NS_STRING_CONTAINER_INIT_DEPEND |
                   NS_STRING_CONTAINER_INIT_ADOPT))
     {
@@ -89,17 +89,17 @@ NS_StringGetData(const nsAString &aStr, 
   *aData = begin.get();
   return begin.size_forward();
 }
 
 XPCOM_API(uint32_t)
 NS_StringGetMutableData(nsAString &aStr, uint32_t aDataLength,
                         PRUnichar **aData)
 {
-  if (aDataLength != PR_UINT32_MAX) {
+  if (aDataLength != UINT32_MAX) {
     aStr.SetLength(aDataLength);
     if (aStr.Length() != aDataLength) {
       *aData = nullptr;
       return 0;
     }
   }
 
   nsAString::iterator begin;
@@ -121,30 +121,30 @@ NS_StringSetData(nsAString &aStr, const 
   return NS_OK; // XXX report errors
 }
 
 XPCOM_API(nsresult)
 NS_StringSetDataRange(nsAString &aStr,
                       uint32_t aCutOffset, uint32_t aCutLength,
                       const PRUnichar *aData, uint32_t aDataLength)
 {
-  if (aCutOffset == PR_UINT32_MAX)
+  if (aCutOffset == UINT32_MAX)
   {
     // append case
     if (aData)
       aStr.Append(aData, aDataLength);
     return NS_OK; // XXX report errors
   }
 
-  if (aCutLength == PR_UINT32_MAX)
+  if (aCutLength == UINT32_MAX)
     aCutLength = aStr.Length() - aCutOffset;
 
   if (aData)
   {
-    if (aDataLength == PR_UINT32_MAX)
+    if (aDataLength == UINT32_MAX)
       aStr.Replace(aCutOffset, aCutLength, nsDependentString(aData));
     else
       aStr.Replace(aCutOffset, aCutLength, Substring(aData, aDataLength));
   }
   else
     aStr.Cut(aCutOffset, aCutLength);
 
   return NS_OK; // XXX report errors
@@ -193,17 +193,17 @@ NS_CStringContainerInit2(nsCStringContai
       "nsStringContainer is not large enough");
 
   if (!aData)
   {
     new (&aContainer) nsCString();
   }
   else
   {
-    if (aDataLength == PR_UINT32_MAX)
+    if (aDataLength == UINT32_MAX)
     {
       NS_ENSURE_ARG(!(aFlags & NS_CSTRING_CONTAINER_INIT_SUBSTRING));
       aDataLength = nsCharTraits<char>::length(aData);
     }
 
     if (aFlags & (NS_CSTRING_CONTAINER_INIT_DEPEND |
                   NS_CSTRING_CONTAINER_INIT_ADOPT))
     {
@@ -248,17 +248,17 @@ NS_CStringGetData(const nsACString &aStr
   aStr.BeginReading(begin);
   *aData = begin.get();
   return begin.size_forward();
 }
 
 XPCOM_API(uint32_t)
 NS_CStringGetMutableData(nsACString &aStr, uint32_t aDataLength, char **aData)
 {
-  if (aDataLength != PR_UINT32_MAX) {
+  if (aDataLength != UINT32_MAX) {
     aStr.SetLength(aDataLength);
     if (aStr.Length() != aDataLength) {
       *aData = nullptr;
       return 0;
     }
   }
 
   nsACString::iterator begin;
@@ -280,30 +280,30 @@ NS_CStringSetData(nsACString &aStr, cons
   return NS_OK; // XXX report errors
 }
 
 XPCOM_API(nsresult)
 NS_CStringSetDataRange(nsACString &aStr,
                        uint32_t aCutOffset, uint32_t aCutLength,
                        const char *aData, uint32_t aDataLength)
 {
-  if (aCutOffset == PR_UINT32_MAX)
+  if (aCutOffset == UINT32_MAX)
   {
     // append case
     if (aData)
       aStr.Append(aData, aDataLength);
     return NS_OK; // XXX report errors
   }
 
-  if (aCutLength == PR_UINT32_MAX)
+  if (aCutLength == UINT32_MAX)
     aCutLength = aStr.Length() - aCutOffset;
 
   if (aData)
   {
-    if (aDataLength == PR_UINT32_MAX)
+    if (aDataLength == UINT32_MAX)
       aStr.Replace(aCutOffset, aCutLength, nsDependentCString(aData));
     else
       aStr.Replace(aCutOffset, aCutLength, Substring(aData, aDataLength));
   }
   else
     aStr.Cut(aCutOffset, aCutLength);
 
   return NS_OK; // XXX report errors
--- a/xpcom/ds/nsArray.cpp
+++ b/xpcom/ds/nsArray.cpp
@@ -72,17 +72,17 @@ nsArray::QueryElementAt(uint32_t aIndex,
 
 NS_IMETHODIMP
 nsArray::IndexOf(uint32_t aStartIndex, nsISupports* aElement,
                  uint32_t* aResult)
 {
     // optimize for the common case by forwarding to mArray
     if (aStartIndex == 0) {
         uint32_t idx = mArray.IndexOf(aElement);
-        if (idx == PR_UINT32_MAX)
+        if (idx == UINT32_MAX)
             return NS_ERROR_FAILURE;
 
         *aResult = idx;
         return NS_OK;
     }
 
     findIndexOfClosure closure = { aElement, aStartIndex, 0 };
     bool notFound = mArray.EnumerateForwards(FindElementCallback, &closure);
--- a/xpcom/ds/nsAtomTable.cpp
+++ b/xpcom/ds/nsAtomTable.cpp
@@ -79,17 +79,17 @@ protected:
   // We don't need a virtual destructor here because PermanentAtomImpl
   // deletions aren't handled through Release().
   ~AtomImpl();
 
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIATOM
 
-  enum { REFCNT_PERMANENT_SENTINEL = PR_UINT32_MAX };
+  enum { REFCNT_PERMANENT_SENTINEL = UINT32_MAX };
 
   virtual bool IsPermanent();
 
   // We can't use the virtual function in the base class destructor.
   bool IsPermanentInDestructor() {
     return mRefCnt == REFCNT_PERMANENT_SENTINEL;
   }
 
--- a/xpcom/glue/FileUtils.cpp
+++ b/xpcom/glue/FileUtils.cpp
@@ -31,17 +31,17 @@ mozilla::fallocate(PRFileDesc *aFD, int6
   if (PR_Seek64(aFD, aLength, PR_SEEK_SET) != aLength)
     return false;
 
   bool retval = (0 != SetEndOfFile((HANDLE)PR_FileDesc2NativeHandle(aFD)));
 
   PR_Seek64(aFD, oldpos, PR_SEEK_SET);
   return retval;
 #elif defined(XP_OS2)
-  return aLength <= PR_UINT32_MAX
+  return aLength <= UINT32_MAX
     && 0 == DosSetFileSize(PR_FileDesc2NativeHandle(aFD), (uint32_t)aLength);
 #elif defined(XP_MACOSX)
   int fd = PR_FileDesc2NativeHandle(aFD);
   fstore_t store = {F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, aLength};
   // Try to get a continous chunk of disk space
   int ret = fcntl(fd, F_PREALLOCATE, &store);
   if (-1 == ret) {
     // OK, perhaps we are too fragmented, allocate non-continuous
--- a/xpcom/glue/nsStringAPI.cpp
+++ b/xpcom/glue/nsStringAPI.cpp
@@ -61,17 +61,17 @@ nsAString::BeginWriting(uint32_t aLen)
   NS_StringGetMutableData(*this, aLen, &data);
   return data;
 }
 
 nsAString::char_type*
 nsAString::EndWriting()
 {
   char_type *data;
-  uint32_t len = NS_StringGetMutableData(*this, PR_UINT32_MAX, &data);
+  uint32_t len = NS_StringGetMutableData(*this, UINT32_MAX, &data);
   return data + len;
 }
 
 bool
 nsAString::SetLength(uint32_t aLen)
 {
   char_type *data;
   NS_StringGetMutableData(*this, aLen, &data);
@@ -592,17 +592,17 @@ nsACString::BeginWriting(uint32_t aLen)
   NS_CStringGetMutableData(*this, aLen, &data);
   return data;
 }
 
 nsACString::char_type*
 nsACString::EndWriting()
 {
   char_type *data;
-  uint32_t len = NS_CStringGetMutableData(*this, PR_UINT32_MAX, &data);
+  uint32_t len = NS_CStringGetMutableData(*this, UINT32_MAX, &data);
   return data + len;
 }
 
 bool
 nsACString::SetLength(uint32_t aLen)
 {
   char_type *data;
   NS_CStringGetMutableData(*this, aLen, &data);
@@ -1056,17 +1056,17 @@ ToNewUTF8String(const nsAString& aSource
   CopyUTF16toUTF8(aSource, temp);
   return NS_CStringCloneData(temp);
 }
 
 void
 CompressWhitespace(nsAString& aString)
 {
   PRUnichar *start;
-  uint32_t len = NS_StringGetMutableData(aString, PR_UINT32_MAX, &start);
+  uint32_t len = NS_StringGetMutableData(aString, UINT32_MAX, &start);
   PRUnichar *end = start + len;
   PRUnichar *from = start, *to = start;
 
   // Skip any leading whitespace
   while (from < end && NS_IsAsciiWhitespace(*from))
     from++;
 
   while (from < end) {
--- a/xpcom/glue/nsStringAPI.h
+++ b/xpcom/glue/nsStringAPI.h
@@ -65,25 +65,25 @@ public:
     uint32_t dataLen = NS_StringGetData(*this, &data);
     return data[dataLen - 1];
   }
 
   /**
    * Get the length, begin writing, and optionally set the length of a
    * string all in one operation.
    *
-   * @param   newSize Size the string to this length. Pass PR_UINT32_MAX
+   * @param   newSize Size the string to this length. Pass UINT32_MAX
    *                  to leave the length unchanged.
    * @return  The new length of the string, or 0 if resizing failed.
    */
   NS_HIDDEN_(uint32_t) BeginWriting(char_type **begin,
                                     char_type **end = nullptr,
-                                    uint32_t newSize = PR_UINT32_MAX);
+                                    uint32_t newSize = UINT32_MAX);
 
-  NS_HIDDEN_(char_type*) BeginWriting(uint32_t = PR_UINT32_MAX);
+  NS_HIDDEN_(char_type*) BeginWriting(uint32_t = UINT32_MAX);
   NS_HIDDEN_(char_type*) EndWriting();
 
   NS_HIDDEN_(bool) SetLength(uint32_t aLen);
 
   NS_HIDDEN_(size_type) Length() const
   {
     const char_type* data;
     return NS_StringGetData(*this, &data);
@@ -102,17 +102,17 @@ public:
   {
     return NS_StringGetIsVoid(*this);
   }
 
   NS_HIDDEN_(void) Assign(const self_type& aString)
   {
     NS_StringCopy(*this, aString);
   }
-  NS_HIDDEN_(void) Assign(const char_type* aData, size_type aLength = PR_UINT32_MAX)
+  NS_HIDDEN_(void) Assign(const char_type* aData, size_type aLength = UINT32_MAX)
   {
     NS_StringSetData(*this, aData, aLength);
   }
   NS_HIDDEN_(void) Assign(char_type aChar)
   {
     NS_StringSetData(*this, &aChar, 1);
   }
 
@@ -411,25 +411,25 @@ public:
     uint32_t dataLen = NS_CStringGetData(*this, &data);
     return data[dataLen - 1];
   }
 
   /**
    * Get the length, begin writing, and optionally set the length of a
    * string all in one operation.
    *
-   * @param   newSize Size the string to this length. Pass PR_UINT32_MAX
+   * @param   newSize Size the string to this length. Pass UINT32_MAX
    *                  to leave the length unchanged.
    * @return  The new length of the string, or 0 if resizing failed.
    */
   NS_HIDDEN_(uint32_t) BeginWriting(char_type **begin,
                                     char_type **end = nullptr,
-                                    uint32_t newSize = PR_UINT32_MAX);
+                                    uint32_t newSize = UINT32_MAX);
 
-  NS_HIDDEN_(char_type*) BeginWriting(uint32_t aLen = PR_UINT32_MAX);
+  NS_HIDDEN_(char_type*) BeginWriting(uint32_t aLen = UINT32_MAX);
   NS_HIDDEN_(char_type*) EndWriting();
 
   NS_HIDDEN_(bool) SetLength(uint32_t aLen);
 
   NS_HIDDEN_(size_type) Length() const
   {
     const char_type* data;
     return NS_CStringGetData(*this, &data);
@@ -448,17 +448,17 @@ public:
   {
     return NS_CStringGetIsVoid(*this);
   }
 
   NS_HIDDEN_(void) Assign(const self_type& aString)
   {
     NS_CStringCopy(*this, aString);
   }
-  NS_HIDDEN_(void) Assign(const char_type* aData, size_type aLength = PR_UINT32_MAX)
+  NS_HIDDEN_(void) Assign(const char_type* aData, size_type aLength = UINT32_MAX)
   {
     NS_CStringSetData(*this, aData, aLength);
   }
   NS_HIDDEN_(void) Assign(char_type aChar)
   {
     NS_CStringSetData(*this, &aChar, 1);
   }
   NS_HIDDEN_(void) AssignLiteral(const char_type *aData)
@@ -798,17 +798,17 @@ public:
   explicit
   nsString(const abstract_string_type& aReadable)
   {
     NS_StringContainerInit(*this);
     NS_StringCopy(*this, aReadable);
   }
 
   explicit
-  nsString(const char_type* aData, size_type aLength = PR_UINT32_MAX)
+  nsString(const char_type* aData, size_type aLength = UINT32_MAX)
   {
     NS_StringContainerInit2(*this, aData, aLength, 0);
   }
   
   ~nsString()
   {
     NS_StringContainerFinish(*this);
   }
@@ -818,17 +818,17 @@ public:
     return BeginReading();
   }
 
   self_type& operator=(const self_type& aString)              { Assign(aString);   return *this; }
   self_type& operator=(const abstract_string_type& aReadable) { Assign(aReadable); return *this; }
   self_type& operator=(const char_type* aPtr)                 { Assign(aPtr);      return *this; }
   self_type& operator=(char_type aChar)                       { Assign(aChar);     return *this; }
 
-  void Adopt(const char_type *aData, size_type aLength = PR_UINT32_MAX)
+  void Adopt(const char_type *aData, size_type aLength = UINT32_MAX)
   {
     NS_StringContainerFinish(*this);
     NS_StringContainerInit2(*this, aData, aLength,
                             NS_STRING_CONTAINER_INIT_ADOPT);
   }
 
 protected:
   
@@ -858,17 +858,17 @@ public:
   explicit
   nsCString(const abstract_string_type& aReadable)
   {
     NS_CStringContainerInit(*this);
     NS_CStringCopy(*this, aReadable);
   }
 
   explicit
-  nsCString(const char_type* aData, size_type aLength = PR_UINT32_MAX)
+  nsCString(const char_type* aData, size_type aLength = UINT32_MAX)
   {
     NS_CStringContainerInit(*this);
     NS_CStringSetData(*this, aData, aLength);
   }
   
   ~nsCString()
   {
     NS_CStringContainerFinish(*this);
@@ -879,17 +879,17 @@ public:
     return BeginReading();
   }
   
   self_type& operator=(const self_type& aString)              { Assign(aString);   return *this; }
   self_type& operator=(const abstract_string_type& aReadable) { Assign(aReadable); return *this; }
   self_type& operator=(const char_type* aPtr)                 { Assign(aPtr);      return *this; }
   self_type& operator=(char_type aChar)                       { Assign(aChar);     return *this; }
 
-  void Adopt(const char_type *aData, size_type aLength = PR_UINT32_MAX)
+  void Adopt(const char_type *aData, size_type aLength = UINT32_MAX)
   {
     NS_CStringContainerFinish(*this);
     NS_CStringContainerInit2(*this, aData, aLength,
                              NS_CSTRING_CONTAINER_INIT_ADOPT);
   }
 
 protected:
   
@@ -907,21 +907,21 @@ protected:
 class nsDependentString : public nsString
 {
 public:
   typedef nsDependentString         self_type;
 
   nsDependentString() {}
 
   explicit
-  nsDependentString(const char_type* aData, size_type aLength = PR_UINT32_MAX)
+  nsDependentString(const char_type* aData, size_type aLength = UINT32_MAX)
     : nsString(aData, aLength, NS_CSTRING_CONTAINER_INIT_DEPEND)
   {}
 
-  void Rebind(const char_type* aData, size_type aLength = PR_UINT32_MAX)
+  void Rebind(const char_type* aData, size_type aLength = UINT32_MAX)
   {
     NS_StringContainerFinish(*this);
     NS_StringContainerInit2(*this, aData, aLength,
                             NS_STRING_CONTAINER_INIT_DEPEND);
   }
   
 private:
   self_type& operator=(const self_type& aString) MOZ_DELETE;
@@ -930,21 +930,21 @@ private:
 class nsDependentCString : public nsCString
 {
 public:
   typedef nsDependentCString        self_type;
 
   nsDependentCString() {}
 
   explicit
-  nsDependentCString(const char_type* aData, size_type aLength = PR_UINT32_MAX)
+  nsDependentCString(const char_type* aData, size_type aLength = UINT32_MAX)
     : nsCString(aData, aLength, NS_CSTRING_CONTAINER_INIT_DEPEND)
   {}
 
-  void Rebind(const char_type* aData, size_type aLength = PR_UINT32_MAX)
+  void Rebind(const char_type* aData, size_type aLength = UINT32_MAX)
   {
     NS_CStringContainerFinish(*this);
     NS_CStringContainerInit2(*this, aData, aLength,
                              NS_CSTRING_CONTAINER_INIT_DEPEND);
   }
   
 private:
   self_type& operator=(const self_type& aString) MOZ_DELETE;
@@ -989,17 +989,17 @@ public:
 
   explicit
   NS_ConvertASCIItoUTF16(const nsACString& aStr)
   {
     NS_CStringToUTF16(aStr, NS_CSTRING_ENCODING_ASCII, *this);
   }
 
   explicit
-  NS_ConvertASCIItoUTF16(const char* aData, uint32_t aLength = PR_UINT32_MAX)
+  NS_ConvertASCIItoUTF16(const char* aData, uint32_t aLength = UINT32_MAX)
   {
     NS_CStringToUTF16(nsDependentCString(aData, aLength),
                       NS_CSTRING_ENCODING_ASCII, *this);
   }
 
 private:
   self_type& operator=(const self_type& aString) MOZ_DELETE;
 };
@@ -1011,17 +1011,17 @@ public:
 
   explicit
   NS_ConvertUTF8toUTF16(const nsACString& aStr)
   {
     NS_CStringToUTF16(aStr, NS_CSTRING_ENCODING_UTF8, *this);
   }
 
   explicit
-  NS_ConvertUTF8toUTF16(const char* aData, uint32_t aLength = PR_UINT32_MAX)
+  NS_ConvertUTF8toUTF16(const char* aData, uint32_t aLength = UINT32_MAX)
   {
     NS_CStringToUTF16(nsDependentCString(aData, aLength),
                       NS_CSTRING_ENCODING_UTF8, *this);
   }
 
 private:
   self_type& operator=(const self_type& aString) MOZ_DELETE;
 };
@@ -1033,17 +1033,17 @@ public:
 
   explicit
   NS_ConvertUTF16toUTF8(const nsAString& aStr)
   {
     NS_UTF16ToCString(aStr, NS_CSTRING_ENCODING_UTF8, *this);
   }
 
   explicit
-  NS_ConvertUTF16toUTF8(const PRUnichar* aData, uint32_t aLength = PR_UINT32_MAX)
+  NS_ConvertUTF16toUTF8(const PRUnichar* aData, uint32_t aLength = UINT32_MAX)
   {
     NS_UTF16ToCString(nsDependentString(aData, aLength),
                       NS_CSTRING_ENCODING_UTF8, *this);
   }
 
 private:
   self_type& operator=(const self_type& aString) MOZ_DELETE;
 };
@@ -1055,17 +1055,17 @@ public:
 
   explicit
   NS_LossyConvertUTF16toASCII(const nsAString& aStr)
   {
     NS_UTF16ToCString(aStr, NS_CSTRING_ENCODING_ASCII, *this);
   }
 
   explicit
-  NS_LossyConvertUTF16toASCII(const PRUnichar* aData, uint32_t aLength = PR_UINT32_MAX)
+  NS_LossyConvertUTF16toASCII(const PRUnichar* aData, uint32_t aLength = UINT32_MAX)
   {
     NS_UTF16ToCString(nsDependentString(aData, aLength),
                       NS_CSTRING_ENCODING_ASCII, *this);
   }
 
 private:
   self_type& operator=(const self_type& aString) MOZ_DELETE;
 };
--- a/xpcom/glue/nsVersionComparator.cpp
+++ b/xpcom/glue/nsVersionComparator.cpp
@@ -127,17 +127,17 @@ ParseVP(PRUnichar *part, VersionPartW &r
   if (!part)
     return part;
 
   dot = wcschr(part, '.');
   if (dot)
     *dot = '\0';
 
   if (part[0] == '*' && part[1] == '\0') {
-    result.numA = PR_INT32_MAX;
+    result.numA = INT32_MAX;
     result.strB = L"";
   }
   else {
     result.numA = wcstol(part, const_cast<PRUnichar**>(&result.strB), 10);
   }
 
   if (!*result.strB) {
     result.strB = nullptr;
--- a/xpcom/io/Base64.cpp
+++ b/xpcom/io/Base64.cpp
@@ -166,17 +166,17 @@ EncodeInputStream(nsIInputStream *aInput
     NS_ENSURE_SUCCESS(rv, rv);
     // if count64 is over 4GB, it will be failed at the below condition,
     // then will return NS_ERROR_OUT_OF_MEMORY
     aCount = (uint32_t)count64;
   }
 
   uint64_t countlong =
     (count64 + 2) / 3 * 4; // +2 due to integer math.
-  if (countlong + aOffset > PR_UINT32_MAX)
+  if (countlong + aOffset > UINT32_MAX)
     return NS_ERROR_OUT_OF_MEMORY;
 
   uint32_t count = uint32_t(countlong);
 
   aDest.SetLength(count + aOffset);
   if (aDest.Length() != count + aOffset)
     return NS_ERROR_OUT_OF_MEMORY;
 
@@ -234,17 +234,17 @@ Base64EncodeInputStream(nsIInputStream *
 {
   return EncodeInputStream<nsAString>(aInputStream, aDest, aCount, aOffset);
 }
 
 nsresult
 Base64Encode(const nsACString &aBinaryData, nsACString &aString)
 {
   // Check for overflow.
-  if (aBinaryData.Length() > (PR_UINT32_MAX / 4) * 3) {
+  if (aBinaryData.Length() > (UINT32_MAX / 4) * 3) {
     return NS_ERROR_FAILURE;
   }
 
   uint32_t stringLen = ((aBinaryData.Length() + 2) / 3) * 4;
 
   char *buffer;
 
   // Add one byte for null termination.
@@ -278,17 +278,17 @@ Base64Encode(const nsAString &aString, n
 
   return rv;
 }
 
 nsresult
 Base64Decode(const nsACString &aString, nsACString &aBinaryData)
 {
   // Check for overflow.
-  if (aString.Length() > PR_UINT32_MAX / 3) {
+  if (aString.Length() > UINT32_MAX / 3) {
     return NS_ERROR_FAILURE;
   }
 
   uint32_t binaryDataLen = ((aString.Length() * 3) / 4);
 
   char *buffer;
 
   // Add one byte for null termination.
--- a/xpcom/io/nsEscape.cpp
+++ b/xpcom/io/nsEscape.cpp
@@ -70,17 +70,17 @@ static char* nsEscapeCount(
     dstSize += charsToEscape;
     if (dstSize < len)
 	return 0;
 
     // fail if we need more than 4GB
     // size_t is likely to be long unsigned int but nsMemory::Alloc(size_t)
     // calls NS_Alloc_P(size_t) which calls PR_Malloc(uint32_t), so there is
     // no chance to allocate more than 4GB using nsMemory::Alloc()
-    if (dstSize > PR_UINT32_MAX)
+    if (dstSize > UINT32_MAX)
         return 0;
 
 	char* result = (char *)nsMemory::Alloc(dstSize);
     if (!result)
         return 0;
 
     register unsigned char* dst = (unsigned char *) result;
 	src = (const unsigned char *) str;
@@ -188,17 +188,17 @@ int32_t nsUnescapeCount(char * str)
 
 
 char *
 nsEscapeHTML(const char * string)
 {
     char *rv = nullptr;
     /* XXX Hardcoded max entity len. The +1 is for the trailing null. */
     uint32_t len = PL_strlen(string);
-    if (len >= (PR_UINT32_MAX / 6))
+    if (len >= (UINT32_MAX / 6))
       return nullptr;
 
     rv = (char *)NS_Alloc( (6 * len) + 1 );
     char *ptr = rv;
 
     if(rv)
       {
         for(; *string != '\0'; string++)
@@ -258,17 +258,17 @@ nsEscapeHTML2(const PRUnichar *aSourceBu
 {
   // Calculate the length, if the caller didn't.
   if (aSourceBufferLen < 0) {
     aSourceBufferLen = NS_strlen(aSourceBuffer);
   }
 
   /* XXX Hardcoded max entity len. */
   if (uint32_t(aSourceBufferLen) >=
-      ((PR_UINT32_MAX - sizeof(PRUnichar)) / (6 * sizeof(PRUnichar))) )
+      ((UINT32_MAX - sizeof(PRUnichar)) / (6 * sizeof(PRUnichar))) )
     return nullptr;
 
   PRUnichar *resultBuffer = (PRUnichar *)nsMemory::Alloc(aSourceBufferLen *
                             6 * sizeof(PRUnichar) + sizeof(PRUnichar('\0')));
   PRUnichar *ptr = resultBuffer;
 
   if (resultBuffer) {
     int32_t i;
--- a/xpcom/io/nsIPipe.idl
+++ b/xpcom/io/nsIPipe.idl
@@ -45,17 +45,17 @@ interface nsIPipe : nsISupports
      * @param nonBlockingInput
      *        true specifies non-blocking input stream behavior
      * @param nonBlockingOutput
      *        true specifies non-blocking output stream behavior
      * @param segmentSize
      *        specifies the segment size in bytes (pass 0 to use default value)
      * @param segmentCount
      *        specifies the max number of segments (pass 0 to use default
-     *        value).   Passing PR_UINT32_MAX here causes the pipe to have
+     *        value).   Passing UINT32_MAX here causes the pipe to have
      *        "infinite" space.  This mode can be useful in some cases, but
      *        should always be used with caution.  The default value for this
      *        parameter is a finite value.
      * @param segmentAllocator
      *        pass reference to nsIMemory to have all pipe allocations use this
      *        allocator (pass null to use the default allocator)
      */
     void init(in boolean nonBlockingInput,
@@ -117,17 +117,17 @@ interface nsISearchableInputStream : nsI
  * @param nonBlockingInput
  *        true specifies non-blocking input stream behavior
  * @param nonBlockingOutput
  *        true specifies non-blocking output stream behavior
  * @param segmentSize
  *        specifies the segment size in bytes (pass 0 to use default value)
  * @param segmentCount
  *        specifies the max number of segments (pass 0 to use default value)
- *        passing PR_UINT32_MAX here causes the pipe to have "infinite" space.
+ *        passing UINT32_MAX here causes the pipe to have "infinite" space.
  *        this mode can be useful in some cases, but should always be used with
  *        caution.  the default value for this parameter is a finite value.
  * @param segmentAlloc
  *        pass reference to nsIMemory to have all pipe allocations use this
  *        allocator (pass null to use the default allocator)
  */
 extern nsresult
 NS_NewPipe2(nsIAsyncInputStream **pipeIn,
@@ -149,17 +149,17 @@ NS_NewPipe2(nsIAsyncInputStream **pipeIn
  *        resulting input end of the pipe
  * @param pipeOut
  *        resulting output end of the pipe
  * @param segmentSize
  *        specifies the segment size in bytes (pass 0 to use default value)
  * @param maxSize
  *        specifies the max size of the pipe (pass 0 to use default value)
  *        number of segments is maxSize / segmentSize, and maxSize must be a
- *        multiple of segmentSize.  passing PR_UINT32_MAX here causes the
+ *        multiple of segmentSize.  passing UINT32_MAX here causes the
  *        pipe to have "infinite" space.  this mode can be useful in some
  *        cases, but should always be used with caution.  the default value
  *        for this parameter is a finite value.
  * @param nonBlockingInput
  *        true specifies non-blocking input stream behavior
  * @param nonBlockingOutput
  *        true specifies non-blocking output stream behavior
  * @param segmentAlloc
--- a/xpcom/io/nsIStorageStream.idl
+++ b/xpcom/io/nsIStorageStream.idl
@@ -23,17 +23,17 @@ interface nsIStorageStream : nsISupports
      *
      * Initialize the stream, setting up the amount of space that will be
      * allocated for the stream's backing-store.
      *
      * @param segmentSize
      *        Size of each segment. Must be a power of two.
      * @param maxSize
      *        Maximum total size of this stream. length will always be less
-     *        than or equal to this value. Passing PR_UINT32_MAX is safe.
+     *        than or equal to this value. Passing UINT32_MAX is safe.
      * @param segmentAllocator
      *        Which allocator to use for the segments. May be null, in which
      *        case a default allocator will be used.
      */
     void init(in uint32_t segmentSize, in uint32_t maxSize, in nsIMemory segmentAllocator);
 
     /**
      * Get a reference to the one and only output stream for this instance.
--- a/xpcom/io/nsPipe3.cpp
+++ b/xpcom/io/nsPipe3.cpp
@@ -1234,20 +1234,20 @@ NS_NewPipe(nsIInputStream **pipeIn,
            uint32_t maxSize,
            bool nonBlockingInput,
            bool nonBlockingOutput,
            nsIMemory *segmentAlloc)
 {
     if (segmentSize == 0)
         segmentSize = DEFAULT_SEGMENT_SIZE;
 
-    // Handle maxSize of PR_UINT32_MAX as a special case
+    // Handle maxSize of UINT32_MAX as a special case
     uint32_t segmentCount;
-    if (maxSize == PR_UINT32_MAX)
-        segmentCount = PR_UINT32_MAX;
+    if (maxSize == UINT32_MAX)
+        segmentCount = UINT32_MAX;
     else
         segmentCount = maxSize / segmentSize;
 
     nsIAsyncInputStream *in;
     nsIAsyncOutputStream *out;
     nsresult rv = NS_NewPipe2(&in, &out, nonBlockingInput, nonBlockingOutput,
                               segmentSize, segmentCount, segmentAlloc);
     if (NS_FAILED(rv)) return rv;
--- a/xpcom/io/nsScriptableInputStream.cpp
+++ b/xpcom/io/nsScriptableInputStream.cpp
@@ -36,17 +36,17 @@ nsScriptableInputStream::Read(uint32_t a
     char *buffer = nullptr;
 
     if (!mInputStream) return NS_ERROR_NOT_INITIALIZED;
 
     rv = mInputStream->Available(&count64);
     if (NS_FAILED(rv)) return rv;
 
     // bug716556 - Ensure count+1 doesn't overflow
-    uint32_t count = NS_MIN((uint32_t)NS_MIN<uint64_t>(count64, aCount), PR_UINT32_MAX - 1);
+    uint32_t count = NS_MIN((uint32_t)NS_MIN<uint64_t>(count64, aCount), UINT32_MAX - 1);
     buffer = (char*)nsMemory::Alloc(count+1); // make room for '\0'
     if (!buffer) return NS_ERROR_OUT_OF_MEMORY;
 
     uint32_t amtRead = 0;
     rv = mInputStream->Read(buffer, count, &amtRead);
     if (NS_FAILED(rv)) {
         nsMemory::Free(buffer);
         return rv;
--- a/xpcom/io/nsStreamUtils.cpp
+++ b/xpcom/io/nsStreamUtils.cpp
@@ -620,17 +620,17 @@ NS_ConsumeStream(nsIInputStream *stream,
         }
         if (avail64 == 0)
             break;
 
         uint32_t avail = (uint32_t)NS_MIN<uint64_t>(avail64, maxCount);
 
         // resize result buffer
         uint32_t length = result.Length();
-        if (avail > PR_UINT32_MAX - length)
+        if (avail > UINT32_MAX - length)
             return NS_ERROR_FILE_TOO_BIG;
         
         result.SetLength(length + avail);
         if (result.Length() != (length + avail))
             return NS_ERROR_OUT_OF_MEMORY;
         char *buf = result.BeginWriting() + length;
         
         uint32_t n;
--- a/xpcom/io/nsStreamUtils.h
+++ b/xpcom/io/nsStreamUtils.h
@@ -107,17 +107,17 @@ NS_CancelAsyncCopy(nsISupports *aCopierC
  * output buffer.  This allows one to use this function with a non-blocking
  * input stream that may return NS_BASE_STREAM_WOULD_BLOCK if it only has
  * partial data available.
  *
  * @param aSource
  *        The input stream to read.
  * @param aMaxCount
  *        The maximum number of bytes to consume from the stream.  Pass the
- *        value PR_UINT32_MAX to consume the entire stream.  The number of
+ *        value UINT32_MAX to consume the entire stream.  The number of
  *        bytes actually read is given by the length of aBuffer upon return.
  * @param aBuffer
  *        The string object that will contain the stream data upon return.
  *        Note: The data copied to the string may contain null bytes and may
  *        contain non-ASCII values.
  */
 extern nsresult
 NS_ConsumeStream(nsIInputStream *aSource, uint32_t aMaxCount,
--- a/xpcom/string/public/nsReadableUtils.h
+++ b/xpcom/string/public/nsReadableUtils.h
@@ -338,17 +338,17 @@ const nsAFlatString& NullString();
 const nsAFlatCString& NullCString();
 
    /**
    * Compare a UTF-8 string to an UTF-16 string.
    *
    * Returns 0 if the strings are equal, -1 if aUTF8String is less
    * than aUTF16Count, and 1 in the reverse case.  In case of fatal
    * error (eg the strings are not valid UTF8 and UTF16 respectively),
-   * this method will return PR_INT32_MIN.
+   * this method will return INT32_MIN.
    */
 int32_t
 CompareUTF8toUTF16(const nsASingleFragmentCString& aUTF8String,
                    const nsASingleFragmentString& aUTF16String);
 
 void
 AppendUCS4ToUTF16(const uint32_t aSource, nsAString& aDest);
 
--- a/xpcom/string/src/nsReadableUtils.cpp
+++ b/xpcom/string/src/nsReadableUtils.cpp
@@ -1049,17 +1049,17 @@ CompareUTF8toUTF16(const nsASingleFragme
         // converting to uint32_t
         uint32_t c8_32 = (uint8_t)*u8;
 
         if (c8_32 & NOT_ASCII)
           {
             bool err;
             c8_32 = UTF8CharEnumerator::NextChar(&u8, u8end, &err);
             if (err)
-              return PR_INT32_MIN;
+              return INT32_MIN;
 
             uint32_t c16_32 = UTF16CharEnumerator::NextChar(&u16, u16end);
             // The above UTF16CharEnumerator::NextChar() calls can
             // fail, but if it does for anything other than no data to
             // look at (which can't happen here), it returns the
             // Unicode replacement character 0xFFFD for the invalid
             // data they were fed. Ignore that error and treat invalid
             // UTF16 as 0xFFFD.
--- a/xpcom/tests/TestPipes.cpp
+++ b/xpcom/tests/TestPipes.cpp
@@ -58,20 +58,20 @@ nsresult TP_NewPipe(nsIInputStream **pip
                     uint32_t maxSize,
                     bool nonBlockingInput,
                     bool nonBlockingOutput,
                     nsIMemory *segmentAlloc)
 {
     if (segmentSize == 0)
         segmentSize = TP_DEFAULT_SEGMENT_SIZE;
 
-    // Handle maxSize of PR_UINT32_MAX as a special case
+    // Handle maxSize of UINT32_MAX as a special case
     uint32_t segmentCount;
-    if (maxSize == PR_UINT32_MAX)
-        segmentCount = PR_UINT32_MAX;
+    if (maxSize == UINT32_MAX)
+        segmentCount = UINT32_MAX;
     else
         segmentCount = maxSize / segmentSize;
 
     nsIAsyncInputStream *in;
     nsIAsyncOutputStream *out;
     nsresult rv = TP_NewPipe2(&in, &out, nonBlockingInput, nonBlockingOutput,
                               segmentSize, segmentCount, segmentAlloc);
     if (NS_FAILED(rv)) return rv;
--- a/xpcom/tests/TestStorageStream.cpp
+++ b/xpcom/tests/TestStorageStream.cpp
@@ -11,17 +11,17 @@
 int main()
 {
   char kData[4096];
   memset(kData, 0, sizeof(kData));
 
   nsresult rv;
   nsCOMPtr<nsIStorageStream> stor;
 
-  rv = NS_NewStorageStream(4096, PR_UINT32_MAX, getter_AddRefs(stor));
+  rv = NS_NewStorageStream(4096, UINT32_MAX, getter_AddRefs(stor));
   if (NS_FAILED(rv))
     return -1;
 
   nsCOMPtr<nsIOutputStream> out;
   rv = stor->GetOutputStream(0, getter_AddRefs(out));
   if (NS_FAILED(rv))
     return -1;
 
--- a/xpcom/tests/TestStreamUtils.cpp
+++ b/xpcom/tests/TestStreamUtils.cpp
@@ -17,28 +17,28 @@ static bool test_consume_stream() {
   const char kData[] =
       "Get your facts first, and then you can distort them as much as you "
       "please.";
 
   nsCOMPtr<nsIInputStream> input;
   nsCOMPtr<nsIOutputStream> output;
   NS_NewPipe(getter_AddRefs(input),
              getter_AddRefs(output),
-             10, PR_UINT32_MAX);
+             10, UINT32_MAX);
   if (!input || !output)
     return false;
 
   uint32_t n = 0;
   output->Write(kData, sizeof(kData) - 1, &n);
   if (n != (sizeof(kData) - 1))
     return false;
   output = nullptr;  // close output
 
   nsCString buf;
-  if (NS_FAILED(NS_ConsumeStream(input, PR_UINT32_MAX, buf)))
+  if (NS_FAILED(NS_ConsumeStream(input, UINT32_MAX, buf)))
     return false;
 
   if (!buf.Equals(kData))
     return false;
 
   return true; 
 }
 
--- a/xpcom/tests/TestStrings.cpp
+++ b/xpcom/tests/TestStrings.cpp
@@ -714,23 +714,23 @@ bool test_appendint64()
       fprintf(stderr, "Error appending LL_MinInt() (oct): Got %s\n", str.get());
       return false;
     }
 
 
     str.Truncate();
     str.AppendInt(maxint_plus1);
     if (!str.Equals(maxint_plus1_expected)) {
-      fprintf(stderr, "Error appending PR_UINT32_MAX + 1: Got %s\n", str.get());
+      fprintf(stderr, "Error appending UINT32_MAX + 1: Got %s\n", str.get());
       return false;
     }
     str.Truncate();
     str.AppendInt(maxint_plus1, 16);
     if (!str.Equals(maxint_plus1_expected_x)) {
-      fprintf(stderr, "Error appending PR_UINT32_MAX + 1 (hex): Got %s\n", str.get());
+      fprintf(stderr, "Error appending UINT32_MAX + 1 (hex): Got %s\n", str.get());
       return false;
     }
 
 
     return true;
   }
 
 bool test_appendfloat()
--- a/xpcom/tests/TestTArray.cpp
+++ b/xpcom/tests/TestTArray.cpp
@@ -90,19 +90,19 @@ static bool test_basic_array(ElementType
 
   uint32_t index = ary.Length() / 2;
   if (!ary.InsertElementAt(index, extra))
     return false;
   if (!(ary == ary))
     return false;
   if (ary[index] != extra)
     return false;
-  if (ary.IndexOf(extra) == PR_UINT32_MAX)
+  if (ary.IndexOf(extra) == UINT32_MAX)
     return false;
-  if (ary.LastIndexOf(extra) == PR_UINT32_MAX)
+  if (ary.LastIndexOf(extra) == UINT32_MAX)
     return false;
   // ensure proper searching
   if (ary.IndexOf(extra) > ary.LastIndexOf(extra))
     return false;
   if (ary.IndexOf(extra, index) != ary.LastIndexOf(extra, index))
     return false;
 
   nsTArray<ElementType> copy(ary);
--- a/xpcom/tests/external/TestMinStringAPI.cpp
+++ b/xpcom/tests/external/TestMinStringAPI.cpp
@@ -25,17 +25,17 @@ static bool test_basic_1()
 
     NS_CStringGetData(s, &ptr);
     if (ptr == nullptr || *ptr != '\0')
       {
         NS_ERROR("unexpected result");
         return false;
       }
 
-    NS_CStringSetData(s, kAsciiData, PR_UINT32_MAX);
+    NS_CStringSetData(s, kAsciiData, UINT32_MAX);
     len = NS_CStringGetData(s, &ptr);
     if (ptr == nullptr || strcmp(ptr, kAsciiData) != 0)
       {
         NS_ERROR("unexpected result");
         return false;
       }
     if (len != sizeof(kAsciiData)-1)
       {
@@ -84,17 +84,17 @@ static bool test_basic_2()
 
     NS_StringGetData(s, &ptr);
     if (ptr == nullptr || *ptr != '\0')
       {
         NS_ERROR("unexpected result");
         return false;
       }
 
-    NS_StringSetData(s, kUnicodeData, PR_UINT32_MAX);
+    NS_StringSetData(s, kUnicodeData, UINT32_MAX);
     len = NS_StringGetData(s, &ptr);
     if (len != sizeof(kUnicodeData)/2 - 1)
       {
         NS_ERROR("unexpected result");
         return false;
       }
     if (ptr == nullptr || memcmp(ptr, kUnicodeData, sizeof(kUnicodeData)) != 0)
       {
@@ -356,17 +356,17 @@ static bool test_adopt()
     static const char kData[] = "hello world";
 
     char *data = (char *) nsMemory::Clone(kData, sizeof(kData));
     if (!data)
       return false;
 
     nsCStringContainer s;
     NS_ENSURE_SUCCESS(
-        NS_CStringContainerInit2(s, data, PR_UINT32_MAX,
+        NS_CStringContainerInit2(s, data, UINT32_MAX,
                                  NS_CSTRING_CONTAINER_INIT_ADOPT),
         false); // leaks data on failure *shrug*
 
     const char *sd;
     NS_CStringGetData(s, &sd);
 
     bool rv = (sd == data);
     NS_CStringContainerFinish(s);
--- a/xpcom/threads/LazyIdleThread.cpp
+++ b/xpcom/threads/LazyIdleThread.cpp
@@ -81,17 +81,17 @@ LazyIdleThread::DisableIdleTimeout()
 
   if (mIdleTimer && NS_FAILED(mIdleTimer->Cancel())) {
     NS_WARNING("Failed to cancel timer!");
   }
 
   MutexAutoLock lock(mMutex);
 
   // Pretend we have a pending event to keep the idle timer from firing.
-  NS_ASSERTION(mPendingEventCount < PR_UINT32_MAX, "Way too many!");
+  NS_ASSERTION(mPendingEventCount < UINT32_MAX, "Way too many!");
   mPendingEventCount++;
 }
 
 void
 LazyIdleThread::EnableIdleTimeout()
 {
   ASSERT_OWNING_THREAD();
   if (mIdleTimeoutEnabled) {
@@ -114,17 +114,17 @@ LazyIdleThread::EnableIdleTimeout()
   }
 }
 
 void
 LazyIdleThread::PreDispatch()
 {
   MutexAutoLock lock(mMutex);
 
-  NS_ASSERTION(mPendingEventCount < PR_UINT32_MAX, "Way too many!");
+  NS_ASSERTION(mPendingEventCount < UINT32_MAX, "Way too many!");
   mPendingEventCount++;
 }
 
 nsresult
 LazyIdleThread::EnsureThread()
 {
   ASSERT_OWNING_THREAD();
 
@@ -492,17 +492,17 @@ LazyIdleThread::AfterProcessNextEvent(ns
 
     if (mThreadIsShuttingDown) {
       // We're shutting down, no need to fire any timer.
       return NS_OK;
     }
 
     shouldNotifyIdle = !mPendingEventCount;
     if (shouldNotifyIdle) {
-      NS_ASSERTION(mIdleNotificationCount < PR_UINT32_MAX, "Way too many!");
+      NS_ASSERTION(mIdleNotificationCount < UINT32_MAX, "Way too many!");
       mIdleNotificationCount++;
     }
   }
 
   if (shouldNotifyIdle) {
     nsCOMPtr<nsIRunnable> runnable =
       NS_NewRunnableMethod(this, &LazyIdleThread::ScheduleTimer);
     NS_ENSURE_TRUE(runnable, NS_ERROR_FAILURE);