Bug 777292 - Convert incorrect conversions to nsresult and fix named constants; r=ehsan
authorAryeh Gregor <ayg@aryeh.name>
Fri, 27 Jul 2012 16:59:29 +0300
changeset 100884 6e30103582c44ea1ee8c25747bd3bed6671c0011
parent 100883 20b67f48676c6afd5353b5ca621e2980e43a1abe
child 100885 d64f195e9c43f2b0de92b2b0d1daa04f4e6077aa
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersehsan
bugs777292
milestone17.0a1
Bug 777292 - Convert incorrect conversions to nsresult and fix named constants; r=ehsan
accessible/src/base/nsCoreUtils.cpp
accessible/src/generic/Accessible.cpp
accessible/src/generic/FormControlAccessible.cpp
accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
accessible/src/xul/XULMenuAccessible.cpp
accessible/src/xul/XULSliderAccessible.cpp
content/base/src/Link.cpp
content/base/src/nsAttrValue.cpp
content/base/src/nsContentUtils.cpp
content/base/src/nsHTMLContentSerializer.cpp
content/base/src/nsPlainTextSerializer.cpp
content/base/src/nsXHTMLContentSerializer.cpp
content/html/content/src/nsHTMLFormElement.cpp
content/html/content/src/nsHTMLFrameSetElement.cpp
content/html/content/src/nsHTMLInputElement.cpp
content/html/content/src/nsMediaFragmentURIParser.cpp
content/mathml/content/src/nsMathMLElement.cpp
content/media/MediaResource.cpp
content/xul/content/src/nsXULContextMenuBuilder.cpp
content/xul/document/src/nsXULDocument.cpp
content/xul/templates/src/nsTemplateRule.cpp
content/xul/templates/src/nsXULContentBuilder.cpp
content/xul/templates/src/nsXULSortService.cpp
content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp
docshell/base/nsIContentViewer.idl
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMException.cpp
dom/base/nsFocusManager.cpp
dom/devicestorage/nsDeviceStorage.cpp
dom/indexedDB/IDBTransaction.cpp
dom/system/gonk/Volume.cpp
dom/workers/WorkerPrivate.cpp
editor/libeditor/base/nsEditor.cpp
editor/libeditor/html/nsHTMLAbsPosition.cpp
editor/libeditor/html/nsHTMLCSSUtils.cpp
editor/libeditor/html/nsHTMLDataTransfer.cpp
editor/txtsvc/src/nsTextServicesDocument.cpp
embedding/components/printingui/src/unixshared/nsPrintProgress.cpp
embedding/components/printingui/src/unixshared/nsPrintProgress.h
extensions/cookie/nsPermissionManager.cpp
gfx/thebes/gfxUserFontSet.h
intl/unicharutil/src/nsEntityConverter.cpp
js/xpconnect/src/XPCComponents.cpp
js/xpconnect/src/XPCException.cpp
js/xpconnect/src/XPCWrappedNative.cpp
js/xpconnect/src/XPCWrappedNativeJSOps.cpp
js/xpconnect/src/xpcprivate.h
layout/base/nsCSSFrameConstructor.cpp
layout/forms/nsListControlFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsTextFrameThebes.cpp
layout/mathml/nsMathMLOperators.cpp
layout/mathml/nsMathMLmactionFrame.cpp
layout/mathml/nsMathMLmpaddedFrame.cpp
layout/mathml/nsMathMLmtableFrame.cpp
layout/printing/nsPrintData.cpp
layout/style/nsFontFaceLoader.h
layout/svg/base/src/nsSVGImageFrame.cpp
layout/xul/base/src/nsBox.cpp
layout/xul/base/src/nsDeckFrame.cpp
layout/xul/base/src/nsListBoxBodyFrame.cpp
layout/xul/base/src/nsMenuPopupFrame.cpp
layout/xul/base/src/nsSliderFrame.cpp
layout/xul/base/src/nsStackLayout.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
modules/libjar/nsZipArchive.cpp
modules/libjar/nsZipArchive.h
netwerk/base/src/nsChannelClassifier.cpp
netwerk/base/src/nsIOService.cpp
netwerk/base/src/nsURLParsers.cpp
netwerk/protocol/ftp/nsFtpConnectionThread.cpp
netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
netwerk/test/urltest.cpp
parser/htmlparser/src/nsHTMLTokens.cpp
parser/htmlparser/src/nsParser.cpp
parser/htmlparser/src/nsParser.h
rdf/base/src/nsContainerEnumerator.cpp
rdf/base/src/nsRDFContainer.cpp
rdf/base/src/nsRDFContentSink.cpp
rdf/datasource/src/nsFileSystemDataSource.cpp
security/manager/ssl/src/nsCertOverrideService.cpp
security/manager/ssl/src/nsCertVerificationThread.cpp
storage/test/test_deadlock_detector.cpp
toolkit/components/downloads/nsDownloadProxy.h
toolkit/components/places/nsNavHistoryQuery.cpp
toolkit/components/places/nsNavHistoryResult.cpp
toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
widget/gtk2/nsDragService.cpp
widget/xpwidgets/nsNativeTheme.cpp
widget/xpwidgets/nsPrintOptionsImpl.cpp
xpcom/string/public/nsTString.h
xpcom/string/src/nsStringObsolete.cpp
xpcom/string/src/nsTStringObsolete.cpp
xpcom/tests/TestCOMPtr.cpp
xpcom/tests/TestDeadlockDetector.cpp
xpcom/tests/TestHashtables.cpp
xpcom/tests/TestRefPtr.cpp
xpfe/appshell/src/nsXULWindow.cpp
--- a/accessible/src/base/nsCoreUtils.cpp
+++ b/accessible/src/base/nsCoreUtils.cpp
@@ -508,17 +508,17 @@ nsCoreUtils::GetID(nsIContent *aContent,
 }
 
 bool
 nsCoreUtils::GetUIntAttr(nsIContent *aContent, nsIAtom *aAttr, PRInt32 *aUInt)
 {
   nsAutoString value;
   aContent->GetAttr(kNameSpaceID_None, aAttr, value);
   if (!value.IsEmpty()) {
-    PRInt32 error = NS_OK;
+    nsresult error = NS_OK;
     PRInt32 integer = value.ToInteger(&error);
     if (NS_SUCCEEDED(error) && integer > 0) {
       *aUInt = integer;
       return true;
     }
   }
 
   return false;
--- a/accessible/src/generic/Accessible.cpp
+++ b/accessible/src/generic/Accessible.cpp
@@ -3051,17 +3051,17 @@ Accessible::GetAttrValue(nsIAtom *aPrope
 
   nsAutoString attrValue;
   mContent->GetAttr(kNameSpaceID_None, aProperty, attrValue);
 
   // Return zero value if there is no attribute or its value is empty.
   if (attrValue.IsEmpty())
     return NS_OK;
 
-  PRInt32 error = NS_OK;
+  nsresult error = NS_OK;
   double value = attrValue.ToDouble(&error);
   if (NS_SUCCEEDED(error))
     *aValue = value;
 
   return NS_OK;
 }
 
 PRUint32
--- a/accessible/src/generic/FormControlAccessible.cpp
+++ b/accessible/src/generic/FormControlAccessible.cpp
@@ -106,17 +106,17 @@ NS_IMETHODIMP
 ProgressMeterAccessible<Max>::GetMaximumValue(double* aMaximumValue)
 {
   nsresult rv = LeafAccessible::GetMaximumValue(aMaximumValue);
   if (rv != NS_OK_NO_ARIA_VALUE)
     return rv;
 
   nsAutoString value;
   if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::max, value)) {
-    PRInt32 result = NS_OK;
+    nsresult result = NS_OK;
     *aMaximumValue = value.ToDouble(&result);
     return result;
   }
 
   *aMaximumValue = Max;
   return NS_OK;
 }
 
@@ -154,17 +154,17 @@ ProgressMeterAccessible<Max>::GetCurrent
 
   nsAutoString attrValue;
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue);
 
   // Return zero value if there is no attribute or its value is empty.
   if (attrValue.IsEmpty())
     return NS_OK;
 
-  PRInt32 error = NS_OK;
+  nsresult error = NS_OK;
   double value = attrValue.ToDouble(&error);
   if (NS_FAILED(error))
     return NS_OK; // Zero value because of wrong markup.
 
   *aCurrentValue = value;
   return NS_OK;
 }
 
--- a/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
@@ -308,62 +308,62 @@ nsXFormsRangeAccessible::GetMaximumValue
 {
   NS_ENSURE_ARG_POINTER(aMaximumValue);
 
   nsAutoString value;
   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
   nsresult rv = sXFormsService->GetRangeEnd(DOMNode, value);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  PRInt32 error = NS_OK;
+  nsresult error = NS_OK;
   *aMaximumValue = value.ToDouble(&error);
   return error;
 }
 
 NS_IMETHODIMP
 nsXFormsRangeAccessible::GetMinimumValue(double *aMinimumValue)
 {
   NS_ENSURE_ARG_POINTER(aMinimumValue);
 
   nsAutoString value;
   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
   nsresult rv = sXFormsService->GetRangeStart(DOMNode, value);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  PRInt32 error = NS_OK;
+  nsresult error = NS_OK;
   *aMinimumValue = value.ToDouble(&error);
   return error;
 }
 
 NS_IMETHODIMP
 nsXFormsRangeAccessible::GetMinimumIncrement(double *aMinimumIncrement)
 {
   NS_ENSURE_ARG_POINTER(aMinimumIncrement);
 
   nsAutoString value;
   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
   nsresult rv = sXFormsService->GetRangeStep(DOMNode, value);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  PRInt32 error = NS_OK;
+  nsresult error = NS_OK;
   *aMinimumIncrement = value.ToDouble(&error);
   return error;
 }
 
 NS_IMETHODIMP
 nsXFormsRangeAccessible::GetCurrentValue(double *aCurrentValue)
 {
   NS_ENSURE_ARG_POINTER(aCurrentValue);
 
   nsAutoString value;
   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
   nsresult rv = sXFormsService->GetValue(DOMNode, value);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  PRInt32 error = NS_OK;
+  nsresult error = NS_OK;
   *aCurrentValue = value.ToDouble(&error);
   return error;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXFormsSelectAccessible
 ////////////////////////////////////////////////////////////////////////////////
--- a/accessible/src/xul/XULMenuAccessible.cpp
+++ b/accessible/src/xul/XULMenuAccessible.cpp
@@ -208,17 +208,17 @@ XULMenuitemAccessible::KeyboardShortcut(
 
   PRUint32 key = 0;
 
   nsAutoString keyStr;
   keyElm->GetAttr(kNameSpaceID_None, nsGkAtoms::key, keyStr);
   if (keyStr.IsEmpty()) {
     nsAutoString keyCodeStr;
     keyElm->GetAttr(kNameSpaceID_None, nsGkAtoms::keycode, keyCodeStr);
-    PRUint32 errorCode;
+    nsresult errorCode;
     key = keyStr.ToInteger(&errorCode, kAutoDetect);
   } else {
     key = keyStr[0];
   }
 
   nsAutoString modifiersStr;
   keyElm->GetAttr(kNameSpaceID_None, nsGkAtoms::modifiers, modifiersStr);
 
--- a/accessible/src/xul/XULSliderAccessible.cpp
+++ b/accessible/src/xul/XULSliderAccessible.cpp
@@ -218,17 +218,17 @@ XULSliderAccessible::GetSliderAttr(nsIAt
   nsAutoString attrValue;
   nsresult rv = GetSliderAttr(aName, attrValue);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Return zero value if there is no attribute or its value is empty.
   if (attrValue.IsEmpty())
     return NS_OK;
 
-  PRInt32 error = NS_OK;
+  nsresult error = NS_OK;
   double value = attrValue.ToDouble(&error);
   if (NS_SUCCEEDED(error))
     *aValue = value;
 
   return NS_OK;
 }
 
 nsresult
--- a/content/base/src/Link.cpp
+++ b/content/base/src/Link.cpp
@@ -183,17 +183,17 @@ Link::SetHost(const nsAString &aHost)
   (void)uri->SetHost(host);
 
   // Also set the port if needed.
   if (iter != end) {
     iter++;
     if (iter != end) {
       nsAutoString portStr(Substring(iter, end));
       nsresult rv;
-      PRInt32 port = portStr.ToInteger((PRInt32 *)&rv);
+      PRInt32 port = portStr.ToInteger(&rv);
       if (NS_SUCCEEDED(rv)) {
         (void)uri->SetPort(port);
       }
     }
   };
 
   SetHrefAttribute(uri);
   return NS_OK;
@@ -249,17 +249,17 @@ Link::SetPort(const nsAString &aPort)
   nsCOMPtr<nsIURI> uri(GetURIToMutate());
   if (!uri) {
     // Ignore failures to be compatible with NS4.
     return NS_OK;
   }
 
   nsresult rv;
   nsAutoString portStr(aPort);
-  PRInt32 port = portStr.ToInteger((PRInt32 *)&rv);
+  PRInt32 port = portStr.ToInteger(&rv);
   if (NS_FAILED(rv)) {
     return NS_OK;
   }
 
   (void)uri->SetPort(port);
   SetHrefAttribute(uri);
   return NS_OK;
 }
--- a/content/base/src/nsAttrValue.cpp
+++ b/content/base/src/nsAttrValue.cpp
@@ -1457,17 +1457,17 @@ nsAttrValue::ParseColor(const nsAString&
 
   return false;
 }
 
 bool nsAttrValue::ParseDoubleValue(const nsAString& aString)
 {
   ResetIfSet();
 
-  PRInt32 ec;
+  nsresult ec;
   double val = PromiseFlatString(aString).ToDouble(&ec);
   if (NS_FAILED(ec)) {
     return false;
   }
   if (EnsureEmptyMiscContainer()) {
     MiscContainer* cont = GetMiscContainer();
     cont->mDoubleValue = val;
     cont->mType = eDoubleValue;
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -1256,18 +1256,18 @@ nsContentUtils::ParseIntMarginValue(cons
     if (count < 3)
       end = Substring(marginStr, start).FindChar(',');
     else
       end = Substring(marginStr, start).Length();
 
     if (end <= 0)
       return false;
 
-    PRInt32 ec, val = 
-      nsString(Substring(marginStr, start, end)).ToInteger(&ec);
+    nsresult ec;
+    PRInt32 val = nsString(Substring(marginStr, start, end)).ToInteger(&ec);
     if (NS_FAILED(ec))
       return false;
 
     switch(count) {
       case 0:
         result.top = val;
       break;
       case 1:
@@ -5015,49 +5015,48 @@ nsContentUtils::GetViewportInfo(nsIDocum
 
   nsAutoString handheldFriendly;
   aDocument->GetHeaderData(nsGkAtoms::handheldFriendly, handheldFriendly);
 
   if (handheldFriendly.EqualsLiteral("true")) {
     return ret;
   }
 
-  PRInt32 errorCode;
-
   nsAutoString minScaleStr;
   aDocument->GetHeaderData(nsGkAtoms::minimum_scale, minScaleStr);
 
+  nsresult errorCode;
   float scaleMinFloat = minScaleStr.ToFloat(&errorCode);
 
   if (errorCode) {
     scaleMinFloat = kViewportMinScale;
   }
 
   scaleMinFloat = NS_MIN(scaleMinFloat, kViewportMaxScale);
   scaleMinFloat = NS_MAX(scaleMinFloat, kViewportMinScale);
 
   nsAutoString maxScaleStr;
   aDocument->GetHeaderData(nsGkAtoms::maximum_scale, maxScaleStr);
 
   // We define a special error code variable for the scale and max scale,
   // because they are used later (see the width calculations).
-  PRInt32 scaleMaxErrorCode;
+  nsresult scaleMaxErrorCode;
   float scaleMaxFloat = maxScaleStr.ToFloat(&scaleMaxErrorCode);
 
   if (scaleMaxErrorCode) {
     scaleMaxFloat = kViewportMaxScale;
   }
 
   scaleMaxFloat = NS_MIN(scaleMaxFloat, kViewportMaxScale);
   scaleMaxFloat = NS_MAX(scaleMaxFloat, kViewportMinScale);
 
   nsAutoString scaleStr;
   aDocument->GetHeaderData(nsGkAtoms::viewport_initial_scale, scaleStr);
 
-  PRInt32 scaleErrorCode;
+  nsresult scaleErrorCode;
   float scaleFloat = scaleStr.ToFloat(&scaleErrorCode);
   scaleFloat = NS_MIN(scaleFloat, scaleMaxFloat);
   scaleFloat = NS_MAX(scaleFloat, scaleMinFloat);
 
   nsAutoString widthStr, heightStr;
 
   aDocument->GetHeaderData(nsGkAtoms::viewport_height, heightStr);
   aDocument->GetHeaderData(nsGkAtoms::viewport_width, widthStr);
--- a/content/base/src/nsHTMLContentSerializer.cpp
+++ b/content/base/src/nsHTMLContentSerializer.cpp
@@ -236,17 +236,17 @@ nsHTMLContentSerializer::AppendElementSt
   if (mIsCopying && name == nsGkAtoms::ol && ns == kNameSpaceID_XHTML){
     // We are copying and current node is an OL;
     // Store its start attribute value in olState->startVal.
     nsAutoString start;
     PRInt32 startAttrVal = 0;
 
     aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::start, start);
     if (!start.IsEmpty()){
-      PRInt32 rv = 0;
+      nsresult rv = NS_OK;
       startAttrVal = start.ToInteger(&rv);
       //If OL has "start" attribute, first LI element has to start with that value
       //Therefore subtracting 1 as all the LI elements are incrementing it before using it;
       //In failure of ToInteger(), default StartAttrValue to 0.
       if (NS_SUCCEEDED(rv))
         startAttrVal--; 
       else
         startAttrVal = 0;
--- a/content/base/src/nsPlainTextSerializer.cpp
+++ b/content/base/src/nsPlainTextSerializer.cpp
@@ -475,17 +475,17 @@ nsPlainTextSerializer::DoOpenContainer(n
           // considers 'c' to be a valid numeric char (even if radix=10)
           // but then gets confused if it sees it next to the number
           // when the radix specified was 10, and returns an error code.
           PRInt32 semiOffset = style.Find("ch", false, widthOffset+6);
           PRInt32 length = (semiOffset > 0 ? semiOffset - widthOffset - 6
                             : style.Length() - widthOffset);
           nsAutoString widthstr;
           style.Mid(widthstr, widthOffset+6, length);
-          PRInt32 err;
+          nsresult err;
           PRInt32 col = widthstr.ToInteger(&err);
 
           if (NS_SUCCEEDED(err)) {
             mWrapColumn = (PRUint32)col;
 #ifdef DEBUG_preformatted
             printf("Set wrap column to %d based on style\n", mWrapColumn);
 #endif
           }
@@ -558,17 +558,17 @@ nsPlainTextSerializer::DoOpenContainer(n
   else if (aTag == nsGkAtoms::ol) {
     EnsureVerticalSpace(mULCount + mOLStackIndex == 0 ? 1 : 0);
     if (mFlags & nsIDocumentEncoder::OutputFormatted) {
       // Must end the current line before we change indention
       if (mOLStackIndex < OLStackSize) {
         nsAutoString startAttr;
         PRInt32 startVal = 1;
         if (NS_SUCCEEDED(GetAttributeValue(nsGkAtoms::start, startAttr))) {
-          PRInt32 rv = 0;
+          nsresult rv = NS_OK;
           startVal = startAttr.ToInteger(&rv);
           if (NS_FAILED(rv))
             startVal = 1;
         }
         mOLStack[mOLStackIndex++] = startVal;
       }
     } else {
       mOLStackIndex++;
@@ -576,17 +576,17 @@ nsPlainTextSerializer::DoOpenContainer(n
     mIndent += kIndentSizeList;  // see ul
   }
   else if (aTag == nsGkAtoms::li &&
            (mFlags & nsIDocumentEncoder::OutputFormatted)) {
     if (mTagStackIndex > 1 && IsInOL()) {
       if (mOLStackIndex > 0) {
         nsAutoString valueAttr;
         if (NS_SUCCEEDED(GetAttributeValue(nsGkAtoms::value, valueAttr))) {
-          PRInt32 rv = 0;
+          nsresult rv = NS_OK;
           PRInt32 valueAttrVal = valueAttr.ToInteger(&rv);
           if (NS_SUCCEEDED(rv))
             mOLStack[mOLStackIndex-1] = valueAttrVal;
         }
         // This is what nsBulletFrame does for OLs:
         mInIndentString.AppendInt(mOLStack[mOLStackIndex-1]++, 10);
       }
       else {
--- a/content/base/src/nsXHTMLContentSerializer.cpp
+++ b/content/base/src/nsXHTMLContentSerializer.cpp
@@ -249,17 +249,17 @@ nsXHTMLContentSerializer::SerializeAttri
     // for the LI.
     if (aTagName == nsGkAtoms::ol) {
       // We are copying and current node is an OL;
       // Store its start attribute value in olState->startVal.
       nsAutoString start;
       PRInt32 startAttrVal = 0;
       aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::start, start);
       if (!start.IsEmpty()) {
-        PRInt32 rv = 0;
+        nsresult rv = NS_OK;
         startAttrVal = start.ToInteger(&rv);
         //If OL has "start" attribute, first LI element has to start with that value
         //Therefore subtracting 1 as all the LI elements are incrementing it before using it;
         //In failure of ToInteger(), default StartAttrValue to 0.
         if (NS_SUCCEEDED(rv))
           --startAttrVal;
         else
           startAttrVal = 0;
@@ -915,17 +915,17 @@ nsXHTMLContentSerializer::SerializeLIVal
       nsAutoString tagName;
       currElement->GetTagName(tagName);
       if (tagName.LowerCaseEqualsLiteral("li")) {
         currElement->GetAttribute(NS_LITERAL_STRING("value"), valueStr);
         if (valueStr.IsEmpty())
           offset++;
         else {
           found = true;
-          PRInt32 rv = 0;
+          nsresult rv = NS_OK;
           startVal = valueStr.ToInteger(&rv);
         }
       }
     }
     nsCOMPtr<nsIDOMNode> tmp;
     currNode->GetPreviousSibling(getter_AddRefs(tmp));
     currNode.swap(tmp);
   }
--- a/content/html/content/src/nsHTMLFormElement.cpp
+++ b/content/html/content/src/nsHTMLFormElement.cpp
@@ -1789,17 +1789,17 @@ nsHTMLFormElement::UpdateValidity(bool a
   UpdateState(true);
 }
 
 // nsIWebProgressListener
 NS_IMETHODIMP
 nsHTMLFormElement::OnStateChange(nsIWebProgress* aWebProgress,
                                  nsIRequest* aRequest,
                                  PRUint32 aStateFlags,
-                                 PRUint32 aStatus)
+                                 nsresult aStatus)
 {
   // If STATE_STOP is never fired for any reason (redirect?  Failed state
   // change?) the form element will leak.  It will be kept around by the
   // nsIWebProgressListener (assuming it keeps a strong pointer).  We will
   // consequently leak the request.
   if (aRequest == mSubmittingRequest &&
       aStateFlags & nsIWebProgressListener::STATE_STOP) {
     ForgetCurrentSubmission();
--- a/content/html/content/src/nsHTMLFrameSetElement.cpp
+++ b/content/html/content/src/nsHTMLFrameSetElement.cpp
@@ -270,17 +270,17 @@ nsHTMLFrameSetElement::ParseRowCol(const
 
       // Treat * as 1*
       if ((eFramesetUnit_Relative == specs[i].mUnit) &&
         (0 == token.Length())) {
         specs[i].mValue = 1;
       }
       else {
         // Otherwise just convert to integer.
-        PRInt32 err;
+        nsresult err;
         specs[i].mValue = token.ToInteger(&err);
         if (err) {
           specs[i].mValue = 0;
         }
       }
 
       // Treat 0* as 1* in quirks mode (bug 40383)
       if (isInQuirks) {
--- a/content/html/content/src/nsHTMLInputElement.cpp
+++ b/content/html/content/src/nsHTMLInputElement.cpp
@@ -1000,17 +1000,17 @@ nsHTMLInputElement::IsValueEmpty() const
   return value.IsEmpty();
 }
 
 double
 nsHTMLInputElement::GetValueAsDouble() const
 {
   double doubleValue;
   nsAutoString stringValue;
-  PRInt32 ec;
+  nsresult ec;
 
   GetValueInternal(stringValue);
   doubleValue = stringValue.ToDouble(&ec);
 
   return NS_SUCCEEDED(ec) ? doubleValue : MOZ_DOUBLE_NaN();
 }
 
 NS_IMETHODIMP 
@@ -1102,17 +1102,17 @@ nsHTMLInputElement::GetMinAsDouble() con
 
   if (!HasAttr(kNameSpaceID_None, nsGkAtoms::min)) {
     return MOZ_DOUBLE_NaN();
   }
 
   nsAutoString minStr;
   GetAttr(kNameSpaceID_None, nsGkAtoms::min, minStr);
 
-  PRInt32 ec;
+  nsresult ec;
   double min = minStr.ToDouble(&ec);
   return NS_SUCCEEDED(ec) ? min : MOZ_DOUBLE_NaN();
 }
 
 double
 nsHTMLInputElement::GetMaxAsDouble() const
 {
   // Should only be used for <input type='number'> for the moment.
@@ -1120,17 +1120,17 @@ nsHTMLInputElement::GetMaxAsDouble() con
 
   if (!HasAttr(kNameSpaceID_None, nsGkAtoms::max)) {
     return MOZ_DOUBLE_NaN();
   }
 
   nsAutoString maxStr;
   GetAttr(kNameSpaceID_None, nsGkAtoms::max, maxStr);
 
-  PRInt32 ec;
+  nsresult ec;
   double max = maxStr.ToDouble(&ec);
   return NS_SUCCEEDED(ec) ? max : MOZ_DOUBLE_NaN();
 }
 
 double
 nsHTMLInputElement::GetStepBase() const
 {
   double stepBase = GetMinAsDouble();
@@ -2656,17 +2656,17 @@ nsHTMLInputElement::SanitizeValue(nsAStr
         PRUnichar crlf[] = { PRUnichar('\r'), PRUnichar('\n'), 0 };
         aValue.StripChars(crlf);
 
         aValue = nsContentUtils::TrimWhitespace<nsContentUtils::IsHTMLWhitespace>(aValue);
       }
       break;
     case NS_FORM_INPUT_NUMBER:
       {
-        PRInt32 ec;
+        nsresult ec;
         PromiseFlatString(aValue).ToDouble(&ec);
         if (NS_FAILED(ec)) {
           aValue.Truncate();
         }
       }
       break;
   }
 }
@@ -3858,17 +3858,17 @@ nsHTMLInputElement::GetStep() const
     nsAutoString stepStr;
     GetAttr(kNameSpaceID_None, nsGkAtoms::step, stepStr);
 
     if (stepStr.LowerCaseEqualsLiteral("any")) {
       // The element can't suffer from step mismatch if there is no step.
       return kStepAny;
     }
 
-    PRInt32 ec;
+    nsresult ec;
     // NOTE: should be multiplied by defaultStepScaleFactor,
     // which is 1 for type=number.
     step = stepStr.ToDouble(&ec);
     if (NS_FAILED(ec) || step <= 0) {
       // NOTE: we should use defaultStep * defaultStepScaleFactor,
       // which is 1 for type=number.
       step = 1;
     }
--- a/content/html/content/src/nsMediaFragmentURIParser.cpp
+++ b/content/html/content/src/nsMediaFragmentURIParser.cpp
@@ -101,17 +101,17 @@ bool nsMediaFragmentURIParser::ParseNPTS
   }
 
   PRUint32 index = FirstNonDigit(aString, 0);
   if (index == 0) {
     return false;
   }
 
   nsDependentSubstring n(aString, 0, index);
-  PRInt32 ec;
+  nsresult ec;
   PRInt32 s = PromiseFlatString(n).ToInteger(&ec);
   if (NS_FAILED(ec)) {
     return false;
   }
 
   aString.Rebind(aString, index);
   double fraction = 0.0;
   if (!ParseNPTFraction(aString, fraction)) {
@@ -157,17 +157,17 @@ bool nsMediaFragmentURIParser::ParseNPTF
 {
   double fraction = 0.0;
 
   if (aString.Length() > 0 && aString[0] == '.') {
     PRUint32 index = FirstNonDigit(aString, 1);
 
     if (index > 1) {
       nsDependentSubstring number(aString, 0, index);
-      PRInt32 ec;
+      nsresult ec;
       fraction = PromiseFlatString(number).ToDouble(&ec);
       if (NS_FAILED(ec)) {
         return false;
       }
     }
     aString.Rebind(aString, index);
   }
 
@@ -206,17 +206,17 @@ bool nsMediaFragmentURIParser::ParseNPTH
   }
 
   PRUint32 index = FirstNonDigit(aString, 0);
   if (index == 0) {
     return false;
   }
 
   nsDependentSubstring n(aString, 0, index);
-  PRInt32 ec;
+  nsresult ec;
   PRInt32 u = PromiseFlatString(n).ToInteger(&ec);
   if (NS_FAILED(ec)) {
     return false;
   }
 
   aString.Rebind(aString, index);
   aHour = u;
   return true;
@@ -230,18 +230,17 @@ bool nsMediaFragmentURIParser::ParseNPTM
 bool nsMediaFragmentURIParser::ParseNPTSS(nsDependentSubstring& aString, PRUint32& aSecond)
 {
   if (aString.Length() < 2) {
     return false;
   }
 
   if (IsDigit(aString[0]) && IsDigit(aString[1])) {
     nsDependentSubstring n(aString, 0, 2);
-    PRInt32 ec;
-
+    nsresult ec;
     PRInt32 u = PromiseFlatString(n).ToInteger(&ec);
     if (NS_FAILED(ec)) {
       return false;
     }
 
     aString.Rebind(aString, 2);
     if (u >= 60)
       return false;
--- a/content/mathml/content/src/nsMathMLElement.cpp
+++ b/content/mathml/content/src/nsMathMLElement.cpp
@@ -329,17 +329,17 @@ nsMathMLElement::ParseNumericValue(const
       // some authors leave blanks before the unit, but that shouldn't
       // be allowed, so don't CompressWhitespace on 'unit'.
       break;
     }
     number.Append(c);
   }
 
   // Convert number to floating point
-  PRInt32 errorCode;
+  nsresult errorCode;
   float floatValue = number.ToFloat(&errorCode);
   if (NS_FAILED(errorCode))
     return false;
   if (floatValue < 0 && !(aFlags & PARSE_ALLOW_NEGATIVE))
     return false;
 
   nsCSSUnit cssUnit;
   if (unit.IsEmpty()) {
@@ -392,17 +392,17 @@ nsMathMLElement::MapMathMLAttributesInto
     nsCSSValue* scriptSizeMultiplier =
       aData->ValueForScriptSizeMultiplier();
     if (value && value->Type() == nsAttrValue::eString &&
         scriptSizeMultiplier->GetUnit() == eCSSUnit_Null) {
       nsAutoString str(value->GetStringValue());
       str.CompressWhitespace();
       // MathML numbers can't have leading '+'
       if (str.Length() > 0 && str.CharAt(0) != '+') {
-        PRInt32 errorCode;
+        nsresult errorCode;
         float floatValue = str.ToFloat(&errorCode);
         // Negative scriptsizemultipliers are not parsed
         if (NS_SUCCEEDED(errorCode) && floatValue >= 0.0f) {
           scriptSizeMultiplier->SetFloatValue(floatValue, eCSSUnit_Number);
         }
       }
     }
 
@@ -438,17 +438,17 @@ nsMathMLElement::MapMathMLAttributesInto
     //
     value = aAttributes->GetAttr(nsGkAtoms::scriptlevel_);
     nsCSSValue* scriptLevel = aData->ValueForScriptLevel();
     if (value && value->Type() == nsAttrValue::eString &&
         scriptLevel->GetUnit() == eCSSUnit_Null) {
       nsAutoString str(value->GetStringValue());
       str.CompressWhitespace();
       if (str.Length() > 0) {
-        PRInt32 errorCode;
+        nsresult errorCode;
         PRInt32 intValue = str.ToInteger(&errorCode);
         if (NS_SUCCEEDED(errorCode)) {
           // This is kind of cheesy ... if the scriptlevel has a sign,
           // then it's a relative value and we store the nsCSSValue as an
           // Integer to indicate that. Otherwise we store it as a Number
           // to indicate that the scriptlevel is absolute.
           PRUnichar ch = str.CharAt(0);
           if (ch == '+' || ch == '-') {
--- a/content/media/MediaResource.cpp
+++ b/content/media/MediaResource.cpp
@@ -175,17 +175,17 @@ ChannelMediaResource::OnStartRequest(nsI
       // In the case of multiple options for obtaining the duration
       // the order of precedence is:
       // 1) The Media resource metadata if possible (done by the decoder itself).
       // 2) Content-Duration message header.
       // 3) X-AMZ-Meta-Content-Duration.
       // 4) X-Content-Duration.
       // 5) Perform a seek in the decoder to find the value.
       nsCAutoString durationText;
-      PRInt32 ec = 0;
+      nsresult ec = NS_OK;
       rv = hc->GetResponseHeader(NS_LITERAL_CSTRING("Content-Duration"), durationText);
       if (NS_FAILED(rv)) {
         rv = hc->GetResponseHeader(NS_LITERAL_CSTRING("X-AMZ-Meta-Content-Duration"), durationText);
       }
       if (NS_FAILED(rv)) {
         rv = hc->GetResponseHeader(NS_LITERAL_CSTRING("X-Content-Duration"), durationText);
       }
 
--- a/content/xul/content/src/nsXULContextMenuBuilder.cpp
+++ b/content/xul/content/src/nsXULContextMenuBuilder.cpp
@@ -191,17 +191,17 @@ nsXULContextMenuBuilder::Init(nsIDOMDocu
   mGeneratedItemIdAttr = do_GetAtom(aGeneratedItemIdAttrName);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULContextMenuBuilder::Click(const nsAString& aGeneratedItemId)
 {
-  PRInt32 rv;
+  nsresult rv;
   PRInt32 idx = nsString(aGeneratedItemId).ToInteger(&rv);
   if (NS_SUCCEEDED(rv)) {
     nsCOMPtr<nsIDOMHTMLElement> element = mElements.SafeObjectAt(idx);
     if (element) {
       element->Click();
     }
   }
 
--- a/content/xul/document/src/nsXULDocument.cpp
+++ b/content/xul/document/src/nsXULDocument.cpp
@@ -4417,17 +4417,17 @@ nsXULDocument::InsertElement(nsIContent*
     }
 
     if (!wasInserted) {
 
         aChild->GetAttr(kNameSpaceID_None, nsGkAtoms::position, posStr);
         if (!posStr.IsEmpty()) {
             nsresult rv;
             // Positions are one-indexed.
-            PRInt32 pos = posStr.ToInteger(reinterpret_cast<PRInt32*>(&rv));
+            PRInt32 pos = posStr.ToInteger(&rv);
             // Note: if the insertion index (which is |pos - 1|) would be less
             // than 0 or greater than the number of children aParent has, then
             // don't insert, since the position is bogus.  Just skip on to
             // appending.
             if (NS_SUCCEEDED(rv) && pos > 0 &&
                 PRUint32(pos - 1) <= aParent->GetChildCount()) {
                 rv = aParent->InsertChildAt(aChild, pos - 1, aNotify);
                 if (NS_SUCCEEDED(rv))
--- a/content/xul/templates/src/nsTemplateRule.cpp
+++ b/content/xul/templates/src/nsTemplateRule.cpp
@@ -150,17 +150,17 @@ nsTemplateCondition::CheckMatchStrings(c
                 else
                     match = aLeftString.Equals(aRightString);
                 break;
 
             case eLess:
             case eGreater:
             {
                 // non-numbers always compare false
-                PRInt32 err;
+                nsresult err;
                 PRInt32 leftint = PromiseFlatString(aLeftString).ToInteger(&err);
                 if (NS_SUCCEEDED(err)) {
                     PRInt32 rightint = PromiseFlatString(aRightString).ToInteger(&err);
                     if (NS_SUCCEEDED(err)) {
                         match = (mRelation == eLess) ? (leftint < rightint) :
                                                        (leftint > rightint);
                     }
                 }
--- a/content/xul/templates/src/nsXULContentBuilder.cpp
+++ b/content/xul/templates/src/nsXULContentBuilder.cpp
@@ -1884,17 +1884,17 @@ nsXULContentBuilder::InsertSortedNode(ns
         // rjc says: determine where static XUL ends and generated XUL/RDF begins
         PRInt32 staticCount = 0;
 
         nsAutoString staticValue;
         aContainer->GetAttr(kNameSpaceID_None, nsGkAtoms::staticHint, staticValue);
         if (!staticValue.IsEmpty())
         {
             // found "static" XUL element count hint
-            PRInt32 strErr = 0;
+            nsresult strErr = NS_OK;
             staticCount = staticValue.ToInteger(&strErr);
             if (strErr)
                 staticCount = 0;
         } else {
             // compute the "static" XUL element count
             for (nsIContent* child = aContainer->GetFirstChild();
                  child;
                  child = child->GetNextSibling()) {
--- a/content/xul/templates/src/nsXULSortService.cpp
+++ b/content/xul/templates/src/nsXULSortService.cpp
@@ -448,17 +448,17 @@ XULSortServiceImpl::InitializeSortState(
 }
 
 PRInt32
 XULSortServiceImpl::CompareValues(const nsAString& aLeft,
                                   const nsAString& aRight,
                                   PRUint32 aSortHints)
 {
   if (aSortHints & SORT_INTEGER) {
-    PRInt32 err;
+    nsresult err;
     PRInt32 leftint = PromiseFlatString(aLeft).ToInteger(&err);
     if (NS_SUCCEEDED(err)) {
       PRInt32 rightint = PromiseFlatString(aRight).ToInteger(&err);
       if (NS_SUCCEEDED(err)) {
         return leftint - rightint;
       }
     }
     // if they aren't integers, just fall through and compare strings
--- a/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp
+++ b/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp
@@ -1316,17 +1316,17 @@ nsXULTemplateQueryProcessorRDF::ParseLit
                                              const nsString& aValue,
                                              nsIRDFNode** aResult)
 {
     nsresult rv = NS_OK;
     *aResult = nullptr;
 
     if (aParseType.EqualsLiteral(PARSE_TYPE_INTEGER)) {
         nsCOMPtr<nsIRDFInt> intLiteral;
-        PRInt32 errorCode;
+        nsresult errorCode;
         PRInt32 intValue = aValue.ToInteger(&errorCode);
         if (NS_FAILED(errorCode))
             return NS_ERROR_FAILURE;
         rv = gRDFService->GetIntLiteral(intValue, getter_AddRefs(intLiteral));
         if (NS_FAILED(rv)) 
             return rv;
         rv = CallQueryInterface(intLiteral, aResult);
     }
--- a/docshell/base/nsIContentViewer.idl
+++ b/docshell/base/nsIContentViewer.idl
@@ -32,17 +32,17 @@ interface nsIContentViewer : nsISupports
 {
 
   [noscript] void init(in nsIWidgetPtr aParentWidget,
                        [const] in nsIntRectRef aBounds);
 
   attribute nsISupports container;
 
   void loadStart(in nsISupports aDoc);
-  void loadComplete(in unsigned long aStatus);
+  void loadComplete(in nsresult aStatus);
 
   /**
    * Checks if the document wants to prevent unloading by firing beforeunload on
    * the document, and if it does, prompts the user. The result is returned.
    *
    * @param aCallerClosesWindow indicates that the current caller will close the
    *        window. If the method returns true, all subsequent calls will be
    *        ignored.
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -10287,17 +10287,17 @@ nsStorage2SH::NewResolve(nsIXPConnectWra
     return NS_ERROR_FAILURE;
   }
 
   // First check to see if the property is defined on our prototype,
   // after converting id to a string if it's an integer.
 
   JSString *jsstr = IdToString(cx, id);
   if (!jsstr) {
-    return JS_FALSE;
+    return NS_OK;
   }
 
   JSObject *proto = ::JS_GetPrototype(realObj);
   JSBool hasProp;
 
   if (proto &&
       (::JS_HasPropertyById(cx, proto, id, &hasProp) &&
        hasProp)) {
--- a/dom/base/nsDOMException.cpp
+++ b/dom/base/nsDOMException.cpp
@@ -65,17 +65,17 @@ enum DOM4ErrorTypeCodeMap {
 static struct ResultStruct
 {
   nsresult mNSResult;
   PRUint16 mCode;
   const char* mName;
   const char* mMessage;
 } gDOMErrorMsgMap[] = {
 #include "domerr.msg"
-  {0, 0, nullptr, nullptr}   // sentinel to mark end of array
+  {NS_OK, 0, nullptr, nullptr}   // sentinel to mark end of array
 };
 
 #undef DOM4_MSG_DEF
 #undef DOM_MSG_DEF
 
 static void
 NSResultToNameAndMessage(nsresult aNSResult,
                          const char** aName,
@@ -200,17 +200,17 @@ nsDOMException::GetMessageMoz(char **aMe
   } else {
     *aMessage = nullptr;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMException::GetResult(PRUint32* aResult)
+nsDOMException::GetResult(nsresult* aResult)
 {
   NS_ENSURE_ARG_POINTER(aResult);
 
   *aResult = mResult;
 
   return NS_OK;
 }
 
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -2921,17 +2921,18 @@ nsFocusManager::GetNextTabIndex(nsIConte
          child = child->GetNextSibling()) {
       childTabIndex = GetNextTabIndex(child, aCurrentTabIndex, aForward);
       if (childTabIndex > aCurrentTabIndex && childTabIndex != tabIndex) {
         tabIndex = (tabIndex == 0 || childTabIndex < tabIndex) ? childTabIndex : tabIndex;
       }
 
       nsAutoString tabIndexStr;
       child->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex, tabIndexStr);
-      PRInt32 ec, val = tabIndexStr.ToInteger(&ec);
+      nsresult ec;
+      PRInt32 val = tabIndexStr.ToInteger(&ec);
       if (NS_SUCCEEDED (ec) && val > aCurrentTabIndex && val != tabIndex) {
         tabIndex = (tabIndex == 0 || val < tabIndex) ? val : tabIndex;
       }
     }
   }
   else { /* !aForward */
     tabIndex = 1;
     for (nsIContent* child = aParent->GetFirstChild();
@@ -2940,17 +2941,18 @@ nsFocusManager::GetNextTabIndex(nsIConte
       childTabIndex = GetNextTabIndex(child, aCurrentTabIndex, aForward);
       if ((aCurrentTabIndex == 0 && childTabIndex > tabIndex) ||
           (childTabIndex < aCurrentTabIndex && childTabIndex > tabIndex)) {
         tabIndex = childTabIndex;
       }
 
       nsAutoString tabIndexStr;
       child->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex, tabIndexStr);
-      PRInt32 ec, val = tabIndexStr.ToInteger(&ec);
+      nsresult ec;
+      PRInt32 val = tabIndexStr.ToInteger(&ec);
       if (NS_SUCCEEDED (ec)) {
         if ((aCurrentTabIndex == 0 && val > tabIndex) ||
             (val < aCurrentTabIndex && val > tabIndex) ) {
           tabIndex = val;
         }
       }
     }
   }
--- a/dom/devicestorage/nsDeviceStorage.cpp
+++ b/dom/devicestorage/nsDeviceStorage.cpp
@@ -956,17 +956,17 @@ public:
     }
 
     if (XRE_GetProcessType() == GeckoProcessType_Content) {
 
       // because owner implements nsITabChild, we can assume that it is
       // the one and only TabChild.
       TabChild* child = GetTabChildFrom(mWindow->GetDocShell());
       if (!child)
-	return false;
+        return NS_OK;
 
       // Retain a reference so the object isn't deleted without IPDL's knowledge.
       // Corresponding release occurs in DeallocPContentPermissionRequest.
       AddRef();
 
       nsCString type = NS_LITERAL_CSTRING("device-storage");
       child->SendPContentPermissionRequestConstructor(this, type, IPC::URI(mURI));
 
@@ -1452,17 +1452,17 @@ nsDOMDeviceStorage::EnumerateInternal(co
     return NS_OK;
   }
 
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
     // because owner implements nsITabChild, we can assume that it is
     // the one and only TabChild.
     TabChild* child = GetTabChildFrom(win->GetDocShell());
     if (!child)
-      return false;
+      return NS_OK;
 
     // Retain a reference so the object isn't deleted without IPDL's knowledge.
     // Corresponding release occurs in DeallocPContentPermissionRequest.
     r->AddRef();
 
     nsCString type = NS_LITERAL_CSTRING("device-storage");
     child->SendPContentPermissionRequestConstructor(r, type, IPC::URI(mURI));
 
--- a/dom/indexedDB/IDBTransaction.cpp
+++ b/dom/indexedDB/IDBTransaction.cpp
@@ -300,22 +300,22 @@ IDBTransaction::ReleaseSavepoint()
   NS_PRECONDITION(!NS_IsMainThread(), "Wrong thread!");
   NS_PRECONDITION(mConnection, "No connection!");
 
   NS_ASSERTION(mSavepointCount, "Mismatch!");
 
   nsCOMPtr<mozIStorageStatement> stmt = GetCachedStatement(NS_LITERAL_CSTRING(
     "RELEASE SAVEPOINT " SAVEPOINT_NAME
   ));
-  NS_ENSURE_TRUE(stmt, false);
+  NS_ENSURE_TRUE(stmt, NS_OK);
 
   mozStorageStatementScoper scoper(stmt);
 
   nsresult rv = stmt->Execute();
-  NS_ENSURE_SUCCESS(rv, false);
+  NS_ENSURE_SUCCESS(rv, NS_OK);
 
   --mSavepointCount;
 
   return NS_OK;
 }
 
 void
 IDBTransaction::RollbackSavepoint()
--- a/dom/system/gonk/Volume.cpp
+++ b/dom/system/gonk/Volume.cpp
@@ -150,32 +150,32 @@ Volume::HandleVoldResponse(int aResponse
   switch (aResponseCode) {
     case ResponseCode::VolumeListResult: {
       // Each line will look something like:
       //
       //  sdcard /mnt/sdcard 1
       //
       nsDependentCSubstring mntPoint(aTokenizer.nextToken());
       SetMountPoint(mntPoint);
-      PRInt32 errCode;
+      nsresult errCode;
       nsCString state(aTokenizer.nextToken());
       SetState((STATE)state.ToInteger(&errCode));
       break;
     }
 
     case ResponseCode::VolumeStateChange: {
       // Format of the line looks something like:
       //
       //  Volume sdcard /mnt/sdcard state changed from 7 (Shared-Unmounted) to 1 (Idle-Unmounted)
       //
       // So we parse out the state after the string " to "
       while (aTokenizer.hasMoreTokens()) {
         nsCAutoString token(aTokenizer.nextToken());
         if (token.Equals("to")) {
-          PRInt32 errCode;
+          nsresult errCode;
           token = aTokenizer.nextToken();
           SetState((STATE)token.ToInteger(&errCode));
           break;
         }
       }
       break;
     }
 
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -1789,17 +1789,17 @@ WorkerRunnable::Run()
   }
 
   NS_ASSERTION(cx, "Must have a context!");
 
   JSAutoRequest ar(cx);
 
   JSAutoEnterCompartment ac;
   if (targetCompartmentObject && !ac.enter(cx, targetCompartmentObject)) {
-    return false;
+    return NS_OK;
   }
 
   bool result = WorkerRun(cx, mWorkerPrivate);
 
   PostRun(cx, mWorkerPrivate, result);
 
   if (contextStack) {
     JSContext* otherCx;
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -3280,17 +3280,17 @@ nsEditor::GetNextNode(nsINode* aParentNo
     // restart the search from the non-editable node we just found
     return GetNextNode(resultNode, aEditableNode, aNoBlockCrossing);
   }
     
   // unless there isn't one, in which case we are at the end of the node
   // and want the next one.
   if (aNoBlockCrossing && IsBlockNode(aParentNode)) {
     // don't cross out of parent block
-    return NS_OK;
+    return nullptr;
   }
 
   return GetNextNode(aParentNode, aEditableNode, aNoBlockCrossing);
 }
 
 
 nsresult 
 nsEditor::GetPriorNode(nsIDOMNode  *aCurrentNode, 
--- a/editor/libeditor/html/nsHTMLAbsPosition.cpp
+++ b/editor/libeditor/html/nsHTMLAbsPosition.cpp
@@ -228,17 +228,17 @@ nsHTMLEditor::GetElementZIndex(nsIDOMEle
       }
       res = node->GetParentNode(getter_AddRefs(parentNode));
       NS_ENSURE_SUCCESS(res, res);
       node = parentNode;
     }
   }
 
   if (!zIndexStr.EqualsLiteral("auto")) {
-    PRInt32 errorCode;
+    nsresult errorCode;
     *aZindex = zIndexStr.ToInteger(&errorCode);
   }
 
   return NS_OK;
 }
 
 nsresult
 nsHTMLEditor::CreateGrabber(nsIDOMNode * aParentNode, nsIDOMElement ** aReturn)
--- a/editor/libeditor/html/nsHTMLCSSUtils.cpp
+++ b/editor/libeditor/html/nsHTMLCSSUtils.cpp
@@ -1150,17 +1150,17 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInl
         aIsSet = true;
       } else if (valueString.EqualsLiteral("normal")) {
         aIsSet = false;
       } else if (valueString.EqualsLiteral("bolder")) {
         aIsSet = true;
         valueString.AssignLiteral("bold");
       } else {
         PRInt32 weight = 0;
-        PRInt32 errorCode;
+        nsresult errorCode;
         nsAutoString value(valueString);
         weight = value.ToInteger(&errorCode, 10);
         if (400 < weight) {
           aIsSet = true;
           valueString.AssignLiteral("bold");
         } else {
           aIsSet = false;
           valueString.AssignLiteral("normal");
--- a/editor/libeditor/html/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/html/nsHTMLDataTransfer.cpp
@@ -1038,17 +1038,17 @@ FindIntegerAfterString(const char *aLead
     return false;
   numFront += strlen(aLeadingString);
 
   PRInt32 numBack = aCStr.FindCharInSet(CRLF, numFront);
   if (numBack == -1)
     return false;
 
   nsCAutoString numStr(Substring(aCStr, numFront, numBack-numFront));
-  PRInt32 errorCode;
+  nsresult errorCode;
   foundNumber = numStr.ToInteger(&errorCode);
   return true;
 }
 
 nsresult
 RemoveFragComments(nsCString & aStr)
 {
   // remove the StartFragment/EndFragment comments from the str, if present
@@ -2284,22 +2284,23 @@ nsresult nsHTMLEditor::CreateDOMFragment
     *outEndNode = *outStartNode = *outFragNode;
 
   *outStartOffset = 0;
 
   // get the infoString contents
   nsAutoString numstr1, numstr2;
   if (!aInfoStr.IsEmpty())
   {
-    PRInt32 err, sep, num;
+    PRInt32 sep, num;
     sep = aInfoStr.FindChar((PRUnichar)',');
     numstr1 = Substring(aInfoStr, 0, sep);
     numstr2 = Substring(aInfoStr, sep+1, aInfoStr.Length() - (sep+1));
 
     // Move the start and end children.
+    nsresult err;
     num = numstr1.ToInteger(&err);
     while (num--)
     {
       (*outStartNode)->GetFirstChild(getter_AddRefs(tmp));
       NS_ENSURE_TRUE(tmp, NS_ERROR_FAILURE);
       tmp.swap(*outStartNode);
     }
 
--- a/editor/txtsvc/src/nsTextServicesDocument.cpp
+++ b/editor/txtsvc/src/nsTextServicesDocument.cpp
@@ -1862,23 +1862,23 @@ nsTextServicesDocument::DidJoinNodes(nsI
   //**** KDEBUG ****
   // printf("** JoinNodes: 0x%.8x  0x%.8x  0x%.8x\n", aLeftNode, aRightNode, aParent);
   // fflush(stdout);
   //**** KDEBUG ****
 
   // Make sure that both nodes are text nodes -- otherwise we don't care.
 
   result = aLeftNode->GetNodeType(&type);
-  NS_ENSURE_SUCCESS(result, false);
+  NS_ENSURE_SUCCESS(result, NS_OK);
   if (nsIDOMNode::TEXT_NODE != type) {
     return NS_OK;
   }
 
   result = aRightNode->GetNodeType(&type);
-  NS_ENSURE_SUCCESS(result, false);
+  NS_ENSURE_SUCCESS(result, NS_OK);
   if (nsIDOMNode::TEXT_NODE != type) {
     return NS_OK;
   }
 
   // Note: The editor merges the contents of the left node into the
   //       contents of the right.
 
   PRInt32 leftIndex = 0;
--- a/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp
+++ b/embedding/components/printingui/src/unixshared/nsPrintProgress.cpp
@@ -22,17 +22,17 @@ NS_INTERFACE_MAP_BEGIN(nsPrintProgress)
 NS_INTERFACE_MAP_END_THREADSAFE
 
 
 nsPrintProgress::nsPrintProgress(nsIPrintSettings* aPrintSettings)
 {
   m_closeProgress = false;
   m_processCanceled = false;
   m_pendingStateFlags = -1;
-  m_pendingStateValue = 0;
+  m_pendingStateValue = NS_OK;
   m_PrintSetting = aPrintSettings;
 }
 
 nsPrintProgress::~nsPrintProgress()
 {
   (void)ReleaseListeners();
 }
 
@@ -110,17 +110,17 @@ NS_IMETHODIMP nsPrintProgress::GetProces
   *aProcessCanceledByUser = m_processCanceled;
   return NS_OK;
 }
 NS_IMETHODIMP nsPrintProgress::SetProcessCanceledByUser(bool aProcessCanceledByUser)
 {
   if(m_PrintSetting)
     m_PrintSetting->SetIsCancelled(true);
   m_processCanceled = aProcessCanceledByUser;
-  OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, false);
+  OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, NS_OK);
   return NS_OK;
 }
 
 /* void RegisterListener (in nsIWebProgressListener listener); */
 NS_IMETHODIMP nsPrintProgress::RegisterListener(nsIWebProgressListener * listener)
 {
   nsresult rv = NS_OK;
   
@@ -129,17 +129,17 @@ NS_IMETHODIMP nsPrintProgress::RegisterL
   
   if (!m_listenerList)
     rv = NS_NewISupportsArray(getter_AddRefs(m_listenerList));
   
   if (NS_SUCCEEDED(rv) && m_listenerList)
   {
     m_listenerList->AppendElement(listener);
     if (m_closeProgress || m_processCanceled)
-      listener->OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, 0);
+      listener->OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, NS_OK);
     else
     {
       listener->OnStatusChange(nullptr, nullptr, 0, m_pendingStatus.get());
       if (m_pendingStateFlags != -1)
         listener->OnStateChange(nullptr, nullptr, m_pendingStateFlags, m_pendingStateValue);
     }
   }
     
--- a/embedding/components/printingui/src/unixshared/nsPrintProgress.h
+++ b/embedding/components/printingui/src/unixshared/nsPrintProgress.h
@@ -29,16 +29,16 @@ public:
 
 private:
   nsresult ReleaseListeners();
 
   bool                              m_closeProgress;
   bool                              m_processCanceled;
   nsString                          m_pendingStatus;
   PRInt32                           m_pendingStateFlags;
-  PRInt32                           m_pendingStateValue;
+  nsresult                          m_pendingStateValue;
   nsCOMPtr<nsIDOMWindow>            m_dialog;
   nsCOMPtr<nsISupportsArray>        m_listenerList;
   nsCOMPtr<nsIObserver>             m_observer;
   nsCOMPtr<nsIPrintSettings>        m_PrintSetting;
 };
 
 #endif
--- a/extensions/cookie/nsPermissionManager.cpp
+++ b/extensions/cookie/nsPermissionManager.cpp
@@ -1168,17 +1168,17 @@ nsPermissionManager::Import()
     nsTArray<nsCString> lineArray;
 
     // Split the line at tabs
     ParseString(buffer, '\t', lineArray);
     
     if (lineArray[0].EqualsLiteral(kMatchTypeHost) &&
         lineArray.Length() == 4) {
       
-      PRInt32 error;
+      nsresult error;
       PRUint32 permission = lineArray[2].ToInteger(&error);
       if (error)
         continue;
 
       // hosts might be encoded in UTF8; switch them to ACE to be consistent
       if (!IsASCII(lineArray[3])) {
         rv = NormalizeToACE(lineArray[3]);
         if (NS_FAILED(rv))
--- a/gfx/thebes/gfxUserFontSet.h
+++ b/gfx/thebes/gfxUserFontSet.h
@@ -254,17 +254,17 @@ protected:
     }
 
     gfxMixedFontFamily *GetFamily(const nsAString& aName) const;
 
     // report a problem of some kind (implemented in nsUserFontSet)
     virtual nsresult LogMessage(gfxProxyFontEntry *aProxy,
                                 const char *aMessage,
                                 PRUint32 aFlags = nsIScriptError::errorFlag,
-                                nsresult aStatus = 0) = 0;
+                                nsresult aStatus = NS_OK) = 0;
 
     const PRUint8* SanitizeOpenTypeData(gfxProxyFontEntry *aProxy,
                                         const PRUint8* aData,
                                         PRUint32 aLength,
                                         PRUint32& aSaneLength,
                                         bool aIsCompressed);
 
 #ifdef MOZ_OTS_REPORT_ERRORS
--- a/intl/unicharutil/src/nsEntityConverter.cpp
+++ b/intl/unicharutil/src/nsEntityConverter.cpp
@@ -38,17 +38,17 @@ nsEntityConverter::LoadVersionPropertyFi
         mozilla::services::GetStringBundleService();
     if (!bundleService)
         return NS_ERROR_FAILURE;
     
     nsCOMPtr<nsIStringBundle> entities;
     nsresult rv = bundleService->CreateBundle(url.get(), getter_AddRefs(entities));
     if (NS_FAILED(rv)) return rv;
     
-    PRInt32	result;
+    nsresult result;
 
     nsAutoString key;
     nsXPIDLString value;
     rv = entities->GetStringFromName(NS_LITERAL_STRING("length").get(),
                                      getter_Copies(value));
     NS_ASSERTION(NS_SUCCEEDED(rv),"nsEntityConverter: malformed entity table\n");
     if (NS_FAILED(rv)) return rv;
       
--- a/js/xpconnect/src/XPCComponents.cpp
+++ b/js/xpconnect/src/XPCComponents.cpp
@@ -37,17 +37,17 @@ using namespace mozilla;
 using namespace js;
 using namespace xpc;
 
 using mozilla::dom::DestroyProtoOrIfaceCache;
 
 /***************************************************************************/
 // stuff used by all
 
-static nsresult ThrowAndFail(unsigned errNum, JSContext* cx, bool* retval)
+static nsresult ThrowAndFail(nsresult errNum, JSContext* cx, bool* retval)
 {
     XPCThrower::Throw(errNum, cx);
     *retval = false;
     return NS_OK;
 }
 
 static JSBool
 JSValIsInterfaceOfType(JSContext *cx, jsval v, REFNSIID iid)
--- a/js/xpconnect/src/XPCException.cpp
+++ b/js/xpconnect/src/XPCException.cpp
@@ -22,17 +22,17 @@
 */
 
 static struct ResultMap
 {nsresult rv; const char* name; const char* format;} map[] = {
 #define XPC_MSG_DEF(val, format) \
     {(val), #val, format},
 #include "xpc.msg"
 #undef XPC_MSG_DEF
-    {0,0,0}   // sentinel to mark end of array
+    {NS_OK,0,0}   // sentinel to mark end of array
 };
 
 #define RESULT_COUNT ((sizeof(map) / sizeof(map[0]))-1)
 
 // static
 JSBool
 nsXPCException::NameAndFormatForNSResult(nsresult rv,
                                          const char** name,
@@ -95,17 +95,17 @@ NS_INTERFACE_MAP_END_THREADSAFE
 
 NS_IMPL_THREADSAFE_ADDREF(nsXPCException)
 NS_IMPL_THREADSAFE_RELEASE(nsXPCException)
 
 NS_IMPL_CI_INTERFACE_GETTER1(nsXPCException, nsIXPCException)
 
 nsXPCException::nsXPCException()
     : mMessage(nullptr),
-      mResult(0),
+      mResult(NS_OK),
       mName(nullptr),
       mLocation(nullptr),
       mData(nullptr),
       mFilename(nullptr),
       mLineNumber(0),
       mInner(nullptr),
       mInitialized(false)
 {
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -2223,17 +2223,17 @@ XPCWrappedNative::GetSameCompartmentSecu
     }
 
     // Otherwise, just return the bare JS reflection.
     return flat;
 }
 
 /***************************************************************************/
 
-static JSBool Throw(unsigned errNum, XPCCallContext& ccx)
+static JSBool Throw(nsresult errNum, XPCCallContext& ccx)
 {
     XPCThrower::Throw(errNum, ccx);
     return false;
 }
 
 /***************************************************************************/
 
 class CallMethodHelper
@@ -2671,17 +2671,17 @@ CallMethodHelper::QueryInterfaceFastPath
     mCallContext.GetXPCContext()->SetLastResult(invokeResult);
 
     if (NS_FAILED(invokeResult)) {
         ThrowBadResult(invokeResult, mCallContext);
         return false;
     }
 
     jsval v = JSVAL_NULL;
-    unsigned err;
+    nsresult err;
     JSBool success =
         XPCConvert::NativeData2JS(mCallContext, &v, &qiresult,
                                   nsXPTType::T_INTERFACE_IS,
                                   iid, &err);
     NS_IF_RELEASE(qiresult);
 
     if (!success) {
         ThrowBadParam(err, 0, mCallContext);
@@ -2837,17 +2837,17 @@ CallMethodHelper::ConvertIndependentPara
     nsID param_iid;
     if (type_tag == nsXPTType::T_INTERFACE &&
         NS_FAILED(mIFaceInfo->GetIIDForParamNoAlloc(mVTableIndex, &paramInfo,
                                                     &param_iid))) {
         ThrowBadParam(NS_ERROR_XPC_CANT_GET_PARAM_IFACE_INFO, i, mCallContext);
         return false;
     }
 
-    unsigned err;
+    nsresult err;
     if (!XPCConvert::JSData2Native(mCallContext, &dp->val, src, type,
                                    true, &param_iid, &err)) {
         ThrowBadParam(err, i, mCallContext);
         return false;
     }
 
     return true;
 }
@@ -2935,17 +2935,17 @@ CallMethodHelper::ConvertDependentParam(
         src = i < mArgc ? mArgv[i] : JSVAL_NULL;
     }
 
     nsID param_iid;
     if (datum_type.IsInterfacePointer() &&
         !GetInterfaceTypeFromParam(i, datum_type, &param_iid))
         return false;
 
-    unsigned err;
+    nsresult err;
 
     if (isArray || isSizedString) {
         if (!GetArraySizeFromParam(i, &array_count))
             return false;
 
         if (isArray) {
             if (array_count &&
                 !XPCConvert::JSArray2Native(mCallContext, (void**)&dp->val, src,
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp
@@ -12,17 +12,17 @@
 #include "nsWrapperCacheInlines.h"
 #include "mozilla/dom/BindingUtils.h"
 
 /***************************************************************************/
 
 // All of the exceptions thrown into JS from this file go through here.
 // That makes this a nice place to set a breakpoint.
 
-static JSBool Throw(unsigned errNum, JSContext* cx)
+static JSBool Throw(nsresult errNum, JSContext* cx)
 {
     XPCThrower::Throw(errNum, cx);
     return false;
 }
 
 // Handy macro used in many callback stub below.
 
 #define MORPH_SLIM_WRAPPER(cx, obj)                                           \
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -3389,17 +3389,17 @@ public:
     static JSBool NativeStringWithSize2JS(JSContext* cx,
                                           jsval* d, const void* s,
                                           const nsXPTType& type,
                                           uint32_t count,
                                           nsresult* pErr);
 
     static JSBool JSStringWithSize2Native(XPCCallContext& ccx, void* d, jsval s,
                                           uint32_t count, const nsXPTType& type,
-                                          unsigned* pErr);
+                                          nsresult* pErr);
 
     static nsresult JSValToXPCException(XPCCallContext& ccx,
                                         jsval s,
                                         const char* ifaceName,
                                         const char* methodName,
                                         nsIException** exception);
 
     static nsresult JSErrorToXPCException(XPCCallContext& ccx,
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -1552,17 +1552,17 @@ nsCSSFrameConstructor::CreateGeneratedCo
       nsCOMPtr<nsIAtom> attrName;
       PRInt32 attrNameSpace = kNameSpaceID_None;
       nsAutoString contentString(data.mContent.mString);
       
       PRInt32 barIndex = contentString.FindChar('|'); // CSS namespace delimiter
       if (-1 != barIndex) {
         nsAutoString  nameSpaceVal;
         contentString.Left(nameSpaceVal, barIndex);
-        PRInt32 error;
+        nsresult error;
         attrNameSpace = nameSpaceVal.ToInteger(&error, 10);
         contentString.Cut(0, barIndex + 1);
         if (contentString.Length()) {
           if (mDocument->IsHTML() && aParentContent->IsHTML()) {
             ToLowerCase(contentString);
           }
           attrName = do_GetAtom(contentString);
         }
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -1567,17 +1567,17 @@ nsListControlFrame::SetFormProperty(nsIA
 }
 
 nsresult 
 nsListControlFrame::GetFormProperty(nsIAtom* aName, nsAString& aValue) const
 {
   // Get the selected value of option from local cache (optimization vs. widget)
   if (nsGkAtoms::selected == aName) {
     nsAutoString val(aValue);
-    PRInt32 error = 0;
+    nsresult error = NS_OK;
     bool selected = false;
     PRInt32 indx = val.ToInteger(&error, 10); // Get index from aValue
     if (error == 0)
        selected = IsContentSelectedByIndex(indx); 
   
     aValue.Assign(selected ? NS_LITERAL_STRING("1") : NS_LITERAL_STRING("0"));
     
   // For selectedIndex, get the value from the widget
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -3950,17 +3950,17 @@ nsGfxScrollFrameInner::GetCoordAttribute
 {
   if (aBox) {
     nsIContent* content = aBox->GetContent();
 
     nsAutoString value;
     content->GetAttr(kNameSpaceID_None, aAtom, value);
     if (!value.IsEmpty())
     {
-      PRInt32 error;
+      nsresult error;
       // convert it to appunits
       nscoord result = nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
       nscoord halfPixel = nsPresContext::CSSPixelsToAppUnits(0.5f);
       // Any nscoord value that would round to the attribute value when converted
       // to CSS pixels is allowed.
       *aRangeStart = result - halfPixel;
       *aRangeLength = halfPixel*2 - 1;
       return result;
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -4135,17 +4135,18 @@ nsTextFrame::GetCursor(const nsPoint& aP
     // If tabindex >= 0, use default cursor to indicate it's not selectable
     nsIFrame *ancestorFrame = this;
     while ((ancestorFrame = ancestorFrame->GetParent()) != nullptr) {
       nsIContent *ancestorContent = ancestorFrame->GetContent();
       if (ancestorContent && ancestorContent->HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex)) {
         nsAutoString tabIndexStr;
         ancestorContent->GetAttr(kNameSpaceID_None, nsGkAtoms::tabindex, tabIndexStr);
         if (!tabIndexStr.IsEmpty()) {
-          PRInt32 rv, tabIndexVal = tabIndexStr.ToInteger(&rv);
+          nsresult rv;
+          PRInt32 tabIndexVal = tabIndexStr.ToInteger(&rv);
           if (NS_SUCCEEDED(rv) && tabIndexVal >= 0) {
             aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;
             break;
           }
         }
       }
     }
   }
--- a/layout/mathml/nsMathMLOperators.cpp
+++ b/layout/mathml/nsMathMLOperators.cpp
@@ -109,17 +109,17 @@ SetProperty(OperatorData* aOperatorData,
     bool isLeadingSpace;
     if (aName.EqualsLiteral("lspace"))
       isLeadingSpace = true;
     else if (aName.EqualsLiteral("rspace"))
       isLeadingSpace = false;
     else return;  // input is not applicable
 
     // aValue is assumed to be a digit from 0 to 7
-    PRInt32 error = 0;
+    nsresult error = NS_OK;
     float space = aValue.ToFloat(&error) / 18.0;
     if (error) return;
 
     if (isLeadingSpace)
       aOperatorData->mLeadingSpace = space;
     else
       aOperatorData->mTrailingSpace = space;
   }
--- a/layout/mathml/nsMathMLmactionFrame.cpp
+++ b/layout/mathml/nsMathMLmactionFrame.cpp
@@ -165,17 +165,17 @@ nsMathMLmactionFrame::GetSelectedFrame()
     mSelection = 1;
     mSelectedFrame = mFrames.FirstChild();
     return mSelectedFrame;
   }
 
   GetAttribute(mContent, mPresentationData.mstyle, nsGkAtoms::selection_,
                value);
   if (!value.IsEmpty()) {
-    PRInt32 errorCode;
+    nsresult errorCode;
     selection = value.ToInteger(&errorCode);
     if (NS_FAILED(errorCode)) 
       selection = 1;
   }
   else selection = 1; // default is first frame
 
   if (-1 != mChildCount) { // we have been in this function before...
     // cater for invalid user-supplied selection
--- a/layout/mathml/nsMathMLmpaddedFrame.cpp
+++ b/layout/mathml/nsMathMLmpaddedFrame.cpp
@@ -177,17 +177,17 @@ nsMathMLmpaddedFrame::ParseAttribute(nsS
 #ifdef DEBUG
     printf("mpadded: attribute with bad numeric value: %s\n",
             NS_LossyConvertUTF16toASCII(aString).get());
 #endif
     aSign = NS_MATHML_SIGN_INVALID;
     return false;
   }
 
-  PRInt32 errorCode;
+  nsresult errorCode;
   float floatValue = number.ToFloat(&errorCode);
   if (errorCode) {
     aSign = NS_MATHML_SIGN_INVALID;
     return false;
   }
 
   // see if this is a percentage-based value
   if (i < stringLength && aString[i] == '%') {
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -315,17 +315,17 @@ ParseAlignAttribute(nsString& aValue, eA
     len = 8; // 8 is the length of 'baseline'
     aAlign = eAlign_baseline;
   }
   else if (0 == aValue.Find("axis")) {
     len = 4; // 4 is the length of 'axis'
     aAlign = eAlign_axis;
   }
   if (len) {
-    PRInt32 error;
+    nsresult error;
     aValue.Cut(0, len); // aValue is not a const here
     aRowIndex = aValue.ToInteger(&error);
     if (error)
       aRowIndex = 0;
   }
 }
 
 #ifdef DEBUG_rbs_off
@@ -770,17 +770,17 @@ nsMathMLmtdFrame::GetRowSpan()
 {
   PRInt32 rowspan = 1;
 
   // Don't look at the content's rowspan if we're not an mtd or a pseudo cell.
   if ((mContent->Tag() == nsGkAtoms::mtd_) && !GetStyleContext()->GetPseudo()) {
     nsAutoString value;
     mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rowspan, value);
     if (!value.IsEmpty()) {
-      PRInt32 error;
+      nsresult error;
       rowspan = value.ToInteger(&error);
       if (error || rowspan < 0)
         rowspan = 1;
       rowspan = NS_MIN(rowspan, MAX_ROWSPAN);
     }
   }
   return rowspan;
 }
@@ -790,17 +790,17 @@ nsMathMLmtdFrame::GetColSpan()
 {
   PRInt32 colspan = 1;
 
   // Don't look at the content's colspan if we're not an mtd or a pseudo cell.
   if ((mContent->Tag() == nsGkAtoms::mtd_) && !GetStyleContext()->GetPseudo()) {
     nsAutoString value;
     mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::columnspan_, value);
     if (!value.IsEmpty()) {
-      PRInt32 error;
+      nsresult error;
       colspan = value.ToInteger(&error);
       if (error || colspan < 0 || colspan > MAX_COLSPAN)
         colspan = 1;
     }
   }
   return colspan;
 }
 
--- a/layout/printing/nsPrintData.cpp
+++ b/layout/printing/nsPrintData.cpp
@@ -118,13 +118,13 @@ nsPrintData::DoOnProgressChange(PRInt32 
                                 PRInt32      aMaxProgress,
                                 bool         aDoStartStop,
                                 PRInt32      aFlag)
 {
   for (PRInt32 i=0;i<mPrintProgressListeners.Count();i++) {
     nsIWebProgressListener* wpl = mPrintProgressListeners.ObjectAt(i);
     wpl->OnProgressChange(nullptr, nullptr, aProgress, aMaxProgress, aProgress, aMaxProgress);
     if (aDoStartStop) {
-      wpl->OnStateChange(nullptr, nullptr, aFlag, 0);
+      wpl->OnStateChange(nullptr, nullptr, aFlag, NS_OK);
     }
   }
 }
 
--- a/layout/style/nsFontFaceLoader.h
+++ b/layout/style/nsFontFaceLoader.h
@@ -67,17 +67,17 @@ protected:
 
   void InsertRule(nsCSSFontFaceRule *aRule, PRUint8 aSheetType,
                   nsTArray<FontFaceRuleRecord>& oldRules,
                   bool& aFontSetModified);
 
   virtual nsresult LogMessage(gfxProxyFontEntry *aProxy,
                               const char *aMessage,
                               PRUint32 aFlags = nsIScriptError::errorFlag,
-                              nsresult aStatus = 0);
+                              nsresult aStatus = NS_OK);
 
   nsresult CheckFontLoad(gfxProxyFontEntry *aFontToLoad,
                          const gfxFontFaceSrc *aFontFaceSrc,
                          nsIPrincipal **aPrincipal);
 
   virtual nsresult SyncLoadFontData(gfxProxyFontEntry *aFontToLoad,
                                     const gfxFontFaceSrc *aFontFaceSrc,
                                     PRUint8* &aBuffer,
--- a/layout/svg/base/src/nsSVGImageFrame.cpp
+++ b/layout/svg/base/src/nsSVGImageFrame.cpp
@@ -365,17 +365,17 @@ nsSVGImageFrame::PaintSVG(nsRenderingCon
         return NS_OK;
       }
 
       // Grab root node (w/ sanity-check to make sure it exists & is <svg>)
       nsSVGSVGElement* rootSVGElem =
         static_cast<nsSVGSVGElement*>(imgRootFrame->GetContent());
       if (!rootSVGElem || !rootSVGElem->IsSVG(nsGkAtoms::svg)) {
         NS_ABORT_IF_FALSE(false, "missing or non-<svg> root node!!");
-        return false;
+        return NS_OK;
       }
 
       // Override preserveAspectRatio in our helper document
       // XXXdholbert We should technically be overriding the helper doc's clip
       // and overflow properties here, too. See bug 272288 comment 36.
       rootSVGElem->SetImageOverridePreserveAspectRatio(
         imgElem->mPreserveAspectRatio.GetAnimValue());
       nsRect destRect(0, 0,
--- a/layout/xul/base/src/nsBox.cpp
+++ b/layout/xul/base/src/nsBox.cpp
@@ -465,17 +465,17 @@ nsBox::GetFlex(nsBoxLayoutState& aState)
 PRUint32
 nsIFrame::GetOrdinal(nsBoxLayoutState& aState)
 {
   PRUint32 ordinal = GetStyleXUL()->mBoxOrdinal;
 
   // When present, attribute value overrides CSS.
   nsIContent* content = GetContent();
   if (content && content->IsXUL()) {
-    PRInt32 error;
+    nsresult error;
     nsAutoString value;
 
     content->GetAttr(kNameSpaceID_None, nsGkAtoms::ordinal, value);
     if (!value.IsEmpty()) {
       ordinal = value.ToInteger(&error);
     }
   }
 
@@ -646,17 +646,17 @@ nsIBox::AddCSSPrefSize(nsIBox* aBox, nsS
     }
 
     nsIContent* content = aBox->GetContent();
     // ignore 'height' and 'width' attributes if the actual element is not XUL
     // For example, we might be magic XUL frames whose primary content is an HTML
     // <select>
     if (content && content->IsXUL()) {
         nsAutoString value;
-        PRInt32 error;
+        nsresult error;
 
         content->GetAttr(kNameSpaceID_None, nsGkAtoms::width, value);
         if (!value.IsEmpty()) {
             value.Trim("%");
 
             aSize.width =
               nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
             aWidthSet = true;
@@ -750,17 +750,17 @@ nsIBox::AddCSSMinSize(nsBoxLayoutState& 
         aHeightSet = true; // FIXME: should we really do this for
                               // nonzero values?
     }
     // calc() with percentage is treated like '0' (unset)
 
     nsIContent* content = aBox->GetContent();
     if (content && content->IsXUL()) {
         nsAutoString value;
-        PRInt32 error;
+        nsresult error;
 
         content->GetAttr(kNameSpaceID_None, nsGkAtoms::minwidth, value);
         if (!value.IsEmpty())
         {
             value.Trim("%");
 
             nscoord val =
               nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
@@ -813,17 +813,17 @@ nsIBox::AddCSSMaxSize(nsIBox* aBox, nsSi
         aSize.height = nsRuleNode::ComputeCoordPercentCalc(maxHeight, 0);
         aHeightSet = true;
     }
     // percentages and calc() with percentages are treated like 'none'
 
     nsIContent* content = aBox->GetContent();
     if (content && content->IsXUL()) {
         nsAutoString value;
-        PRInt32 error;
+        nsresult error;
 
         content->GetAttr(kNameSpaceID_None, nsGkAtoms::maxwidth, value);
         if (!value.IsEmpty()) {
             value.Trim("%");
 
             nscoord val =
               nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
             aSize.width = val;
@@ -851,17 +851,17 @@ nsIBox::AddCSSFlex(nsBoxLayoutState& aSt
     bool flexSet = false;
 
     // get the flexibility
     aFlex = aBox->GetStyleXUL()->mBoxFlex;
 
     // attribute value overrides CSS
     nsIContent* content = aBox->GetContent();
     if (content && content->IsXUL()) {
-        PRInt32 error;
+        nsresult error;
         nsAutoString value;
 
         content->GetAttr(kNameSpaceID_None, nsGkAtoms::flex, value);
         if (!value.IsEmpty()) {
             value.Trim("%");
             aFlex = value.ToInteger(&error);
             flexSet = true;
         }
--- a/layout/xul/base/src/nsDeckFrame.cpp
+++ b/layout/xul/base/src/nsDeckFrame.cpp
@@ -112,17 +112,17 @@ nsDeckFrame::GetSelectedIndex()
 {
   // default index is 0
   PRInt32 index = 0;
 
   // get the index attribute
   nsAutoString value;
   if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::selectedIndex, value))
   {
-    PRInt32 error;
+    nsresult error;
 
     // convert it to an integer
     index = value.ToInteger(&error);
   }
 
   return index;
 }
 
--- a/layout/xul/base/src/nsListBoxBodyFrame.cpp
+++ b/layout/xul/base/src/nsListBoxBodyFrame.cpp
@@ -596,17 +596,17 @@ nsListBoxBodyFrame::GetRowCount()
   if (mRowCount < 0)
     ComputeTotalRowCount();
   return mRowCount;
 }
 
 PRInt32
 nsListBoxBodyFrame::GetFixedRowSize()
 {
-  PRInt32 dummy;
+  nsresult dummy;
 
   nsAutoString rows;
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rows, rows);
   if (!rows.IsEmpty())
     return rows.ToInteger(&dummy);
  
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::size, rows);
 
--- a/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -624,17 +624,17 @@ nsMenuPopupFrame::InitializePopup(nsICon
 
   if (aAttributesOverride) {
     // Use |left| and |top| dimension attributes to position the popup if
     // present, as they may have been persisted. 
     nsAutoString left, top;
     mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::left, left);
     mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::top, top);
 
-    PRInt32 err;
+    nsresult err;
     if (!left.IsEmpty()) {
       PRInt32 x = left.ToInteger(&err);
       if (NS_SUCCEEDED(err))
         mScreenXPos = x;
     }
     if (!top.IsEmpty()) {
       PRInt32 y = top.ToInteger(&err);
       if (NS_SUCCEEDED(err))
@@ -1786,17 +1786,17 @@ nsMenuPopupFrame::MoveToAttributePositio
 {
   // Move the widget around when the user sets the |left| and |top| attributes. 
   // Note that this is not the best way to move the widget, as it results in lots
   // of FE notifications and is likely to be slow as molasses. Use |moveTo| on
   // nsIPopupBoxObject if possible. 
   nsAutoString left, top;
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::left, left);
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::top, top);
-  PRInt32 err1, err2;
+  nsresult err1, err2;
   PRInt32 xpos = left.ToInteger(&err1);
   PRInt32 ypos = top.ToInteger(&err2);
 
   if (NS_SUCCEEDED(err1) && NS_SUCCEEDED(err2))
     MoveTo(xpos, ypos, false);
 }
 
 void
--- a/layout/xul/base/src/nsSliderFrame.cpp
+++ b/layout/xul/base/src/nsSliderFrame.cpp
@@ -166,17 +166,17 @@ nsSliderFrame::GetPageIncrement(nsIConte
 }
 
 PRInt32
 nsSliderFrame::GetIntegerAttribute(nsIContent* content, nsIAtom* atom, PRInt32 defaultValue)
 {
     nsAutoString value;
     content->GetAttr(kNameSpaceID_None, atom, value);
     if (!value.IsEmpty()) {
-      PRInt32 error;
+      nsresult error;
 
       // convert it to an integer
       defaultValue = value.ToInteger(&error);
     }
 
     return defaultValue;
 }
 
--- a/layout/xul/base/src/nsStackLayout.cpp
+++ b/layout/xul/base/src/nsStackLayout.cpp
@@ -173,17 +173,17 @@ nsStackLayout::GetOffset(nsBoxLayoutStat
       (aChild->GetStateBits() & NS_STATE_STACK_NOT_POSITIONED))
     return 0;
 
   PRUint8 offsetSpecified = 0;
   nsIContent* content = aChild->GetContent();
   if (content) {
     bool ltr = aChild->GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR;
     nsAutoString value;
-    PRInt32 error;
+    nsresult error;
 
     content->GetAttr(kNameSpaceID_None, nsGkAtoms::start, value);
     if (!value.IsEmpty()) {
       value.Trim("%");
       if (ltr) {
         aOffset.left =
           nsPresContext::CSSPixelsToAppUnits(value.ToInteger(&error));
         offsetSpecified |= SPECIFIED_LEFT;
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -185,31 +185,31 @@ nsTreeBodyFrame::GetMinSize(nsBoxLayoutS
     desiredRows = 0;
   }
   else if (baseElement->Tag() == nsGkAtoms::select &&
            baseElement->IsHTML()) {
     min.width = CalcMaxRowWidth();
     nsAutoString size;
     baseElement->GetAttr(kNameSpaceID_None, nsGkAtoms::size, size);
     if (!size.IsEmpty()) {
-      PRInt32 err;
+      nsresult err;
       desiredRows = size.ToInteger(&err);
       mHasFixedRowCount = true;
       mPageLength = desiredRows;
     }
     else {
       desiredRows = 1;
     }
   }
   else {
     // tree
     nsAutoString rows;
     baseElement->GetAttr(kNameSpaceID_None, nsGkAtoms::rows, rows);
     if (!rows.IsEmpty()) {
-      PRInt32 err;
+      nsresult err;
       desiredRows = rows.ToInteger(&err);
       mPageLength = desiredRows;
     }
     else {
       desiredRows = 0;
     }
   }
 
@@ -350,17 +350,17 @@ nsTreeBodyFrame::EnsureView()
       nsWeakFrame weakFrame(this);
       nsCOMPtr<nsITreeView> treeView;
       mTreeBoxObject->GetView(getter_AddRefs(treeView));
       if (treeView && weakFrame.IsAlive()) {
         nsXPIDLString rowStr;
         box->GetProperty(NS_LITERAL_STRING("topRow").get(),
                          getter_Copies(rowStr));
         nsAutoString rowStr2(rowStr);
-        PRInt32 error;
+        nsresult error;
         PRInt32 rowIndex = rowStr2.ToInteger(&error);
 
         // Set our view.
         SetView(treeView);
         ENSURE_TRUE(weakFrame.IsAlive());
 
         // Scroll to the given row.
         // XXX is this optimal if we haven't laid out yet?
@@ -3714,17 +3714,17 @@ nsTreeBodyFrame::PaintProgressMeter(PRIn
 
     // Set our color.
     aRenderingContext.SetColor(meterContext->GetStyleColor()->mColor);
 
     // Now obtain the value for our cell.
     nsAutoString value;
     mView->GetCellValue(aRowIndex, aColumn, value);
 
-    PRInt32 rv;
+    nsresult rv;
     PRInt32 intValue = value.ToInteger(&rv);
     if (intValue < 0)
       intValue = 0;
     else if (intValue > 100)
       intValue = 100;
 
     nscoord meterWidth = NSToCoordRound((float)intValue / 100 * meterRect.width);
     if (GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL)
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -370,17 +370,17 @@ nsresult nsZipArchive::ExtractFile(nsZip
   }
 
   return rv;
 }
 
 //---------------------------------------------
 // nsZipArchive::FindInit
 //---------------------------------------------
-PRInt32
+nsresult
 nsZipArchive::FindInit(const char * aPattern, nsZipFind **aFind)
 {
   if (!aFind)
     return NS_ERROR_ILLEGAL_VALUE;
 
   // null out param in case an error happens
   *aFind = NULL;
 
--- a/modules/libjar/nsZipArchive.h
+++ b/modules/libjar/nsZipArchive.h
@@ -168,17 +168,17 @@ public:
    *
    * @param   aPattern    a string or RegExp pattern to search for
    *                      (may be NULL to find all files in archive)
    * @param   aFind       a pointer to a pointer to a structure used
    *                      in FindNext.  In the case of an error this
    *                      will be set to NULL.
    * @return  status code
    */
-  PRInt32 FindInit(const char * aPattern, nsZipFind** aFind);
+  nsresult FindInit(const char * aPattern, nsZipFind** aFind);
 
   /*
    * Gets an undependent handle to the mapped file.
    */
   nsZipHandle* GetFD();
 
   /**
    * Get pointer to the data of the item.
--- a/netwerk/base/src/nsChannelClassifier.cpp
+++ b/netwerk/base/src/nsChannelClassifier.cpp
@@ -31,17 +31,17 @@ nsChannelClassifier::nsChannelClassifier
 #endif
 }
 
 nsresult
 nsChannelClassifier::Start(nsIChannel *aChannel)
 {
     // Don't bother to run the classifier on a load that has already failed.
     // (this might happen after a redirect)
-    PRUint32 status;
+    nsresult status;
     aChannel->GetStatus(&status);
     if (NS_FAILED(status))
         return NS_OK;
 
     // Don't bother to run the classifier on a cached load that was
     // previously classified.
     if (HasBeenClassified(aChannel)) {
         return NS_OK;
--- a/netwerk/base/src/nsIOService.cpp
+++ b/netwerk/base/src/nsIOService.cpp
@@ -901,30 +901,31 @@ nsIOService::ParsePortList(nsIPrefBranch
     // Get a pref string and chop it up into a list of ports.
     prefBranch->GetCharPref(pref, getter_Copies(portList));
     if (portList) {
         nsTArray<nsCString> portListArray;
         ParseString(portList, ',', portListArray);
         PRUint32 index;
         for (index=0; index < portListArray.Length(); index++) {
             portListArray[index].StripWhitespace();
-            PRInt32 aErrorCode, portBegin, portEnd;
+            PRInt32 portBegin, portEnd;
 
             if (PR_sscanf(portListArray[index].get(), "%d-%d", &portBegin, &portEnd) == 2) {
                if ((portBegin < 65536) && (portEnd < 65536)) {
                    PRInt32 curPort;
                    if (remove) {
                         for (curPort=portBegin; curPort <= portEnd; curPort++)
                             mRestrictedPortList.RemoveElement(curPort);
                    } else {
                         for (curPort=portBegin; curPort <= portEnd; curPort++)
                             mRestrictedPortList.AppendElement(curPort);
                    }
                }
             } else {
+               nsresult aErrorCode;
                PRInt32 port = portListArray[index].ToInteger(&aErrorCode);
                if (NS_SUCCEEDED(aErrorCode) && port < 65536) {
                    if (remove)
                        mRestrictedPortList.RemoveElement(port);
                    else
                        mRestrictedPortList.AppendElement(port);
                }
             }
--- a/netwerk/base/src/nsURLParsers.cpp
+++ b/netwerk/base/src/nsURLParsers.cpp
@@ -576,17 +576,17 @@ nsAuthURLParser::ParseServerInfo(const c
             if (buf.Length() == 0) {
                 *port = -1;
             }
             else {
                 const char* nondigit = NS_strspnp("0123456789", buf.get());
                 if (nondigit && *nondigit)
                     return NS_ERROR_MALFORMED_URI;
 
-                PRInt32 err;
+                nsresult err;
                 *port = buf.ToInteger(&err);
                 if (NS_FAILED(err) || *port <= 0)
                     return NS_ERROR_MALFORMED_URI;
             }
         }
     }
     else {
         // serverinfo = <hostname>
--- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
+++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp
@@ -1019,17 +1019,17 @@ nsFtpState::R_mdtm() {
         // yyyymmddhhmmss
         if (mResponseMsg.Length() != 14) {
             NS_ASSERTION(mResponseMsg.Length() == 14, "Unknown MDTM response");
         } else {
             mModTime = mResponseMsg;
 
             // Save lastModified time for downloaded files.
             nsCAutoString timeString;
-            PRInt32 error;
+            nsresult error;
             PRExplodedTime exTime;
 
             mResponseMsg.Mid(timeString, 0, 4);
             exTime.tm_year  = timeString.ToInteger(&error, 10);
             mResponseMsg.Mid(timeString, 4, 2);
             exTime.tm_month = timeString.ToInteger(&error, 10) - 1; //january = 0
             mResponseMsg.Mid(timeString, 6, 2);
             exTime.tm_mday  = timeString.ToInteger(&error, 10);
@@ -2183,17 +2183,17 @@ nsFtpState::ReadCacheEntry()
     NS_ASSERTION(mCacheEntry, "should have a cache entry");
 
     // make sure the channel knows wassup
     SetContentType();
 
     nsXPIDLCString serverType;
     mCacheEntry->GetMetaDataElement("servertype", getter_Copies(serverType));
     nsCAutoString serverNum(serverType.get());
-    PRInt32 err;
+    nsresult err;
     mServerType = serverNum.ToInteger(&err);
     
     mChannel->PushStreamConverter("text/ftp-dir",
                                   APPLICATION_HTTP_INDEX_FORMAT);
     
     mChannel->SetEntityID(EmptyCString());
 
     if (NS_FAILED(OpenCacheDataStream()))
--- a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
+++ b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
@@ -525,18 +525,17 @@ nsWyciwygChannel::GetCharsetAndSource(PR
   if (data.IsEmpty()) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   nsXPIDLCString sourceStr;
   mCacheEntry->GetMetaDataElement("charset-source", getter_Copies(sourceStr));
 
   PRInt32 source;
-  // XXXbz ToInteger takes an PRInt32* but outputs an nsresult in it... :(
-  PRInt32 err;
+  nsresult err;
   source = sourceStr.ToInteger(&err);
   if (NS_FAILED(err) || source == 0) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   *aSource = source;
   aCharset = data;
   return NS_OK;
--- a/netwerk/test/urltest.cpp
+++ b/netwerk/test/urltest.cpp
@@ -123,17 +123,17 @@ nsresult writeoutto(const char* i_pURL, 
     }
     return NS_OK;
 }
 
 nsresult writeout(const char* i_pURL, PRInt32 urlFactory = URL_FACTORY_DEFAULT)
 {
     if (!i_pURL) return NS_ERROR_FAILURE;
     nsCString temp;
-    int rv = writeoutto(i_pURL, getter_Copies(temp), urlFactory);
+    nsresult rv = writeoutto(i_pURL, getter_Copies(temp), urlFactory);
     printf("%s\n%s\n", i_pURL, temp.get());
     return rv;
 }
 
 /* construct a url and print out its elements separated by commas and
    the whole spec */
 nsresult testURL(const char* i_pURL, PRInt32 urlFactory = URL_FACTORY_DEFAULT)
 {
@@ -243,17 +243,17 @@ nsresult makeAbsTest(const char* i_BaseU
         } else {
             printf("\tFAILED\n\n");
             return NS_ERROR_FAILURE;
         }
     }
     return NS_OK;
 }
 
-int doMakeAbsTest(const char* i_URL = 0, const char* i_relativePortion=0)
+nsresult doMakeAbsTest(const char* i_URL = 0, const char* i_relativePortion=0)
 {
     if (i_URL && i_relativePortion)
     {
         return makeAbsTest(i_URL, i_relativePortion, nullptr);
     }
 
     // Run standard tests. These tests are based on the ones described in 
     // rfc2396 with the exception of the handling of ?y which is wrong as
--- a/parser/htmlparser/src/nsHTMLTokens.cpp
+++ b/parser/htmlparser/src/nsHTMLTokens.cpp
@@ -82,17 +82,17 @@ ConsumeEntity(nsScannerSharedSubstring& 
       if (NS_SUCCEEDED(result)) {
         nsSubstring &writable = aString.writable();
         if (result == NS_HTMLTOKENS_NOT_AN_ENTITY) {
           // Looked like an entity but it's not
           aScanner.GetChar(amp);
           writable.Append(amp);
           result = NS_OK;
         } else {
-          PRInt32 err;
+          nsresult err;
           theNCRValue = entity.ToInteger(&err, kAutoDetect);
           AppendNCR(writable, theNCRValue);
         }
       }
     } else {
       // What we thought as entity is not really an entity...
       aScanner.GetChar(amp);
       aString.writable().Append(amp);
@@ -1448,17 +1448,17 @@ CCommentToken::ConsumeQuirksComment(nsSc
  *
  *  @param   aChar -- last char consumed from stream
  *  @param   aScanner -- controller of underlying input source
  *  @return  error result
  */
 nsresult
 CCommentToken::Consume(PRUnichar aChar, nsScanner& aScanner, PRInt32 aFlag)
 {
-  nsresult result = true;
+  nsresult result = NS_OK;
 
   if (aFlag & NS_IPARSER_FLAG_STRICT_MODE) {
     // Enabling strict comment parsing for Bug 53011 and 2749 contradicts!
     result = ConsumeStrictComment(aScanner);
   } else {
     result = ConsumeQuirksComment(aScanner);
   }
 
@@ -2160,17 +2160,17 @@ PRInt32
 CEntityToken::TranslateToUnicodeStr(nsString& aString)
 {
   PRInt32 value = 0;
 
   if (mTextValue.Length() > 1) {
     PRUnichar theChar0 = mTextValue.CharAt(0);
 
     if (kHashsign == theChar0) {
-      PRInt32 err = 0;
+      nsresult err = NS_OK;
 
       value = mTextValue.ToInteger(&err, kAutoDetect);
 
       if (0 == err) {
         AppendNCR(aString, value);
       }
     } else {
       value = nsHTMLEntities::EntityToUnicode(mTextValue);
--- a/parser/htmlparser/src/nsParser.cpp
+++ b/parser/htmlparser/src/nsParser.cpp
@@ -193,17 +193,17 @@ nsParser::Initialize(bool aConstructor)
     mObserver = nullptr;
     mUnusedInput.Truncate();
   }
 
   mContinueEvent = nullptr;
   mCharsetSource = kCharsetUninitialized;
   mCharset.AssignLiteral("ISO-8859-1");
   mInternalState = NS_OK;
-  mStreamStatus = 0;
+  mStreamStatus = NS_OK;
   mCommand = eViewNormal;
   mFlags = NS_PARSER_FLAG_OBSERVERS_ENABLED |
            NS_PARSER_FLAG_PARSER_ENABLED |
            NS_PARSER_FLAG_CAN_TOKENIZE;
 
   mProcessingNetworkData = false;
   mIsAboutBlank = false;
 }
--- a/parser/htmlparser/src/nsParser.h
+++ b/parser/htmlparser/src/nsParser.h
@@ -407,17 +407,17 @@ protected:
     nsCOMPtr<nsIRequestObserver> mObserver;
     nsCOMPtr<nsIContentSink>     mSink;
     nsIRunnable*                 mContinueEvent;  // weak ref
    
     nsTokenAllocator          mTokenAllocator;
     
     eParserCommands     mCommand;
     nsresult            mInternalState;
-    PRInt32             mStreamStatus;
+    nsresult            mStreamStatus;
     PRInt32             mCharsetSource;
     
     PRUint16            mFlags;
 
     nsString            mUnusedInput;
     nsCString           mCharset;
     nsCString           mCommandStr;
 
--- a/rdf/base/src/nsContainerEnumerator.cpp
+++ b/rdf/base/src/nsContainerEnumerator.cpp
@@ -154,17 +154,17 @@ ContainerEnumeratorImpl::HasMoreElements
 
         nsCOMPtr<nsIRDFLiteral> nextValLiteral = do_QueryInterface(isupports);
         if (! nextValLiteral)
              continue;
 
          const PRUnichar *nextValStr;
          nextValLiteral->GetValueConst(&nextValStr);
 		 
-         PRInt32 err;
+         nsresult err;
          PRInt32 nextVal = nsAutoString(nextValStr).ToInteger(&err);
 
          if (nextVal > max)
              max = nextVal;
     }
 
     // Now pre-fetch our next value into mResult.
     while (mCurrent || mNextIndex < max) {
--- a/rdf/base/src/nsRDFContainer.cpp
+++ b/rdf/base/src/nsRDFContainer.cpp
@@ -179,17 +179,17 @@ RDFContainerImpl::GetCount(PRInt32 *aCou
 
     const PRUnichar *s;
     rv = nextValLiteral->GetValueConst( &s );
     if (NS_FAILED(rv)) return rv;
 
     nsAutoString nextValStr(s);
 
     PRInt32 nextVal;
-    PRInt32 err;
+    nsresult err;
     nextVal = nextValStr.ToInteger(&err);
     if (NS_FAILED(err))
         return NS_ERROR_UNEXPECTED;
 
     *aCount = nextVal - 1;
     return NS_OK;
 }
 
--- a/rdf/base/src/nsRDFContentSink.cpp
+++ b/rdf/base/src/nsRDFContentSink.cpp
@@ -691,18 +691,18 @@ RDFContentSinkImpl::ParseText(nsIRDFNode
             nsIRDFResource *result;
             gRDFService->GetUnicodeResource(value, &result);
             *aResult = result;
         }
         break;
 
     case eRDFContentSinkParseMode_Int:
         {
-            PRInt32 i, err;
-            i = value.ToInteger(&err);
+            nsresult err;
+            PRInt32 i = value.ToInteger(&err);
             nsIRDFInt *result;
             gRDFService->GetIntLiteral(i, &result);
             *aResult = result;
         }
         break;
 
     case eRDFContentSinkParseMode_Date:
         {
--- a/rdf/datasource/src/nsFileSystemDataSource.cpp
+++ b/rdf/datasource/src/nsFileSystemDataSource.cpp
@@ -1009,17 +1009,17 @@ FileSystemDataSource::GetFolderList(nsIR
         return(NS_ERROR_UNEXPECTED);
 
     nsCOMPtr<nsIURI>    aIURI;
     if (NS_FAILED(rv = NS_NewURI(getter_AddRefs(aIURI), nsDependentCString(parentURI))))
         return(rv);
 
     nsCOMPtr<nsIFileURL>    fileURL = do_QueryInterface(aIURI);
     if (!fileURL)
-        return(false);
+        return NS_OK;
 
     nsCOMPtr<nsIFile>   aDir;
     if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aDir))))
         return(rv);
 
     // ensure that we DO NOT resolve aliases
     aDir->SetFollowLinks(false);
 
@@ -1117,17 +1117,17 @@ FileSystemDataSource::GetLastMod(nsIRDFR
         return(NS_ERROR_UNEXPECTED);
 
     nsCOMPtr<nsIURI>    aIURI;
     if (NS_FAILED(rv = NS_NewURI(getter_AddRefs(aIURI), nsDependentCString(uri))))
         return(rv);
 
     nsCOMPtr<nsIFileURL>    fileURL = do_QueryInterface(aIURI);
     if (!fileURL)
-        return(false);
+        return NS_OK;
 
     nsCOMPtr<nsIFile>   aFile;
     if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile))))
         return(rv);
     if (!aFile)
         return(NS_ERROR_UNEXPECTED);
 
     // ensure that we DO NOT resolve aliases
@@ -1164,17 +1164,17 @@ FileSystemDataSource::GetFileSize(nsIRDF
         return(NS_ERROR_UNEXPECTED);
 
     nsCOMPtr<nsIURI>    aIURI;
     if (NS_FAILED(rv = NS_NewURI(getter_AddRefs(aIURI), nsDependentCString(uri))))
         return(rv);
 
     nsCOMPtr<nsIFileURL>    fileURL = do_QueryInterface(aIURI);
     if (!fileURL)
-        return(false);
+        return NS_OK;
 
     nsCOMPtr<nsIFile>   aFile;
     if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile))))
         return(rv);
     if (!aFile)
         return(NS_ERROR_UNEXPECTED);
 
     // ensure that we DO NOT resolve aliases
@@ -1215,17 +1215,17 @@ FileSystemDataSource::GetName(nsIRDFReso
         return(NS_ERROR_UNEXPECTED);
 
     nsCOMPtr<nsIURI>    aIURI;
     if (NS_FAILED(rv = NS_NewURI(getter_AddRefs(aIURI), nsDependentCString(uri))))
         return(rv);
 
     nsCOMPtr<nsIFileURL>    fileURL = do_QueryInterface(aIURI);
     if (!fileURL)
-        return(false);
+        return NS_OK;
 
     nsCOMPtr<nsIFile>   aFile;
     if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile))))
         return(rv);
     if (!aFile)
         return(NS_ERROR_UNEXPECTED);
 
     // ensure that we DO NOT resolve aliases
--- a/security/manager/ssl/src/nsCertOverrideService.cpp
+++ b/security/manager/ssl/src/nsCertOverrideService.cpp
@@ -267,17 +267,17 @@ nsCertOverrideService::Read()
     nsCertOverride::OverrideBits bits;
     nsCertOverride::convertStringToBits(bits_string, bits);
 
     PRInt32 port;
     PRInt32 portIndex = host.RFindChar(':');
     if (portIndex == kNotFound)
       continue; // Ignore broken entries
 
-    PRInt32 portParseError;
+    nsresult portParseError;
     nsCAutoString portString(Substring(host, portIndex+1));
     port = portString.ToInteger(&portParseError);
     if (portParseError)
       continue; // Ignore broken entries
 
     host.Truncate(portIndex);
     
     AddEntryToList(host, port, 
--- a/security/manager/ssl/src/nsCertVerificationThread.cpp
+++ b/security/manager/ssl/src/nsCertVerificationThread.cpp
@@ -154,17 +154,17 @@ void nsCertVerificationThread::Run(void)
         static_cast<nsCertVerificationJob*>(mJobQ.PopFront());
       delete job;
     }
     postStoppedEventToMainThread(threadLock);
   }
 }
 
 nsCertVerificationResult::nsCertVerificationResult()
-: mRV(0),
+: mRV(NS_OK),
   mVerified(0),
   mCount(0),
   mUsages(0)
 {
 }
 
 nsCertVerificationResult::~nsCertVerificationResult()
 {
--- a/storage/test/test_deadlock_detector.cpp
+++ b/storage/test/test_deadlock_detector.cpp
@@ -294,17 +294,17 @@ CheckForDeadlock(const char* test, const
 
 // Stupidest possible deadlock.
 nsresult
 Sanity_Child()
 {
     TestMutex m1("dd.sanity.m1");
     m1.Lock();
     m1.Lock();
-    return 0;                  // not reached
+    return NS_OK;                  // not reached
 }
 
 nsresult
 Sanity()
 {
     const char* const tokens[] = {
         "###!!! ERROR: Potential deadlock detected",
         "=== Cyclical dependency starts at\n--- Mutex : dd.sanity.m1",
@@ -324,17 +324,17 @@ Sanity()
 nsresult
 Sanity2_Child()
 {
     TestMutex m1("dd.sanity2.m1");
     TestMutex m2("dd.sanity2.m2");
     m1.Lock();
     m2.Lock();
     m1.Lock();
-    return 0;                  // not reached
+    return NS_OK;                  // not reached
 }
 
 nsresult
 Sanity2()
 {
     const char* const tokens[] = {
         "###!!! ERROR: Potential deadlock detected",
         "=== Cyclical dependency starts at\n--- Mutex : dd.sanity2.m1",
@@ -366,17 +366,17 @@ Sanity3_Child()
     m4.Lock();
     m4.Unlock();
     m3.Unlock();
     m2.Unlock();
     m1.Unlock();
 
     m4.Lock();
     m1.Lock();
-    return 0;
+    return NS_OK;
 }
 
 nsresult
 Sanity3()
 {
     const char* const tokens[] = {
         "###!!! ERROR: Potential deadlock detected",
         "=== Cyclical dependency starts at\n--- Mutex : dd.sanity3.m1",
@@ -398,17 +398,17 @@ Sanity3()
 nsresult
 Sanity4_Child()
 {
     mozilla::ReentrantMonitor m1("dd.sanity4.m1");
     TestMutex m2("dd.sanity4.m2");
     m1.Enter();
     m2.Lock();
     m1.Enter();
-    return 0;
+    return NS_OK;
 }
 
 nsresult
 Sanity4()
 {
     const char* const tokens[] = {
         "Re-entering ReentrantMonitor after acquiring other resources",
         "###!!! ERROR: Potential deadlock detected",
@@ -458,17 +458,17 @@ TwoThreads_Child()
         NS_RUNTIMEABORT("couldn't allocate mutexes");
 
     PRThread* t1 = spawn(TwoThreads_thread, (void*) 0);
     PR_JoinThread(t1);
 
     PRThread* t2 = spawn(TwoThreads_thread, (void*) 1);
     PR_JoinThread(t2);
 
-    return 0;
+    return NS_OK;
 }
 
 nsresult
 TwoThreads()
 {
     const char* const tokens[] = {
         "###!!! ERROR: Potential deadlock detected",
         "=== Cyclical dependency starts at\n--- Mutex : dd.twothreads.m2",
@@ -517,17 +517,17 @@ ContentionNoDeadlock_Child()
         threads[i] = spawn(ContentionNoDeadlock_thread, NS_INT32_TO_PTR(i));
 
     for (PRUint32 i = 0; i < ArrayLength(threads); ++i)
         PR_JoinThread(threads[i]);
 
     for (PRUint32 i = 0; i < ArrayLength(cndMs); ++i)
         delete cndMs[i];
 
-    return 0;
+    return NS_OK;
 }
 
 nsresult
 ContentionNoDeadlock()
 {
     const char * func = __func__;
     Subprocess proc(func);
     proc.RunToCompletion(60000);
--- a/toolkit/components/downloads/nsDownloadProxy.h
+++ b/toolkit/components/downloads/nsDownloadProxy.h
@@ -70,17 +70,17 @@ public:
 
       return dmui->Show(nullptr, id, nsIDownloadManagerUI::REASON_NEW_DOWNLOAD);
     }
     return rv;
   }
 
   NS_IMETHODIMP OnStateChange(nsIWebProgress* aWebProgress,
                               nsIRequest* aRequest, PRUint32 aStateFlags,
-                              PRUint32 aStatus)
+                              nsresult aStatus)
   {
     NS_ENSURE_TRUE(mInner, NS_ERROR_NOT_INITIALIZED);
     return mInner->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
   }
   
   NS_IMETHODIMP OnStatusChange(nsIWebProgress *aWebProgress,
                                nsIRequest *aRequest, nsresult aStatus,
                                const PRUnichar *aMessage)
--- a/toolkit/components/places/nsNavHistoryQuery.cpp
+++ b/toolkit/components/places/nsNavHistoryQuery.cpp
@@ -1653,49 +1653,48 @@ SetOptionsKeyBool(const nsCString& aValu
 
 // SetQuery/OptionsKeyUint32
 
 void // static
 SetQueryKeyUint32(const nsCString& aValue, nsINavHistoryQuery* aQuery,
                   Uint32QuerySetter setter)
 {
   nsresult rv;
-  PRUint32 value = aValue.ToInteger(reinterpret_cast<PRInt32*>(&rv));
+  PRUint32 value = aValue.ToInteger(&rv);
   if (NS_SUCCEEDED(rv)) {
     rv = (aQuery->*setter)(value);
     if (NS_FAILED(rv)) {
       NS_WARNING("Error setting Int32 key value");
     }
   } else {
     NS_WARNING("Invalid Int32 key value in query string.");
   }
 }
 void // static
 SetOptionsKeyUint32(const nsCString& aValue, nsINavHistoryQueryOptions* aOptions,
                   Uint32OptionsSetter setter)
 {
   nsresult rv;
-  PRUint32 value = aValue.ToInteger(reinterpret_cast<PRInt32*>(&rv));
+  PRUint32 value = aValue.ToInteger(&rv);
   if (NS_SUCCEEDED(rv)) {
     rv = (aOptions->*setter)(value);
     if (NS_FAILED(rv)) {
       NS_WARNING("Error setting Int32 key value");
     }
   } else {
     NS_WARNING("Invalid Int32 key value in query string.");
   }
 }
 
 void // static
 SetOptionsKeyUint16(const nsCString& aValue, nsINavHistoryQueryOptions* aOptions,
                     Uint16OptionsSetter setter)
 {
   nsresult rv;
-  PRUint16 value = static_cast<PRUint16>
-                              (aValue.ToInteger(reinterpret_cast<PRInt32*>(&rv)));
+  PRUint16 value = static_cast<PRUint16>(aValue.ToInteger(&rv));
   if (NS_SUCCEEDED(rv)) {
     rv = (aOptions->*setter)(value);
     if (NS_FAILED(rv)) {
       NS_WARNING("Error setting Int16 key value");
     }
   } else {
     NS_WARNING("Invalid Int16 key value in query string.");
   }
--- a/toolkit/components/places/nsNavHistoryResult.cpp
+++ b/toolkit/components/places/nsNavHistoryResult.cpp
@@ -4745,17 +4745,17 @@ nsNavHistoryResult::OnVisit(nsIURI* aURI
     if (childCount) {
       nsCOMPtr<nsINavHistoryResultNode> firstChild;
       rv = mRootNode->GetChild(0, getter_AddRefs(firstChild));
       NS_ENSURE_SUCCESS(rv, rv);
       nsCAutoString title;
       rv = firstChild->GetTitle(title);
       NS_ENSURE_SUCCESS(rv, rv);
       nsNavHistory* history = nsNavHistory::GetHistoryService();
-      NS_ENSURE_TRUE(history, 0);
+      NS_ENSURE_TRUE(history, NS_OK);
       nsCAutoString todayLabel;
       history->GetStringFromName(
         NS_LITERAL_STRING("finduri-AgeInDays-is-0").get(), todayLabel);
       todayIsMissing = !todayLabel.Equals(title);
     }
   }
 
   if (!added || todayIsMissing) {
--- a/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierStreamUpdater.cpp
@@ -322,17 +322,17 @@ nsUrlClassifierStreamUpdater::UpdateSucc
   if (successCallback) {
     successCallback->HandleEvent(strTimeout);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsUrlClassifierStreamUpdater::UpdateError(PRUint32 result)
+nsUrlClassifierStreamUpdater::UpdateError(nsresult result)
 {
   LOG(("nsUrlClassifierStreamUpdater::UpdateError [this=%p]", this));
 
   // DownloadDone() clears mUpdateErrorCallback, so we save it off here.
   nsCOMPtr<nsIUrlClassifierCallback> errorCallback = mDownloadError ? nullptr : mUpdateErrorCallback.get();
 
   DownloadDone();
 
@@ -403,20 +403,21 @@ nsUrlClassifierStreamUpdater::OnStartReq
       bool succeeded = false;
       rv = httpChannel->GetRequestSucceeded(&succeeded);
       NS_ENSURE_SUCCESS(rv, rv);
 
       if (!succeeded) {
         // 404 or other error, pass error status back
         LOG(("HTTP request returned failure code."));
 
-        rv = httpChannel->GetResponseStatus(&status);
+        PRUint32 requestStatus;
+        rv = httpChannel->GetResponseStatus(&requestStatus);
         NS_ENSURE_SUCCESS(rv, rv);
 
-        strStatus.AppendInt(status);
+        strStatus.AppendInt(requestStatus);
         downloadError = true;
       }
     }
   }
 
   if (downloadError) {
     mDownloadErrorCallback->HandleEvent(strStatus);
     mDownloadError = true;
--- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
+++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
@@ -117,17 +117,17 @@ IsInNoProxyList(const nsACString& aHost,
     }
     
     nsReadingIterator<char> colon = pos;
     PRInt32 port = -1;
     if (FindCharInReadable(':', colon, last)) {
       ++colon;
       nsDependentCSubstring portStr(colon, last);
       nsCAutoString portStr2(portStr); // We need this for ToInteger. String API's suck.
-      PRInt32 err;
+      nsresult err;
       port = portStr2.ToInteger(&err);
       if (NS_FAILED(err)) {
         port = -2; // don't match any port, so we ignore this pattern
       }
       --colon;
     } else {
       colon = last;
     }
@@ -336,17 +336,17 @@ static bool HostIgnoredByProxy(const nsA
   nsReadingIterator<char> end;
   aIgnore.BeginReading(start);
   aIgnore.BeginReading(slash);
   aIgnore.EndReading(end);
   if (FindCharInReadable('/', slash, end)) {
     ++slash;
     nsDependentCSubstring maskStr(slash, end);
     nsCAutoString maskStr2(maskStr);
-    PRInt32 err;
+    nsresult err;
     mask = maskStr2.ToInteger(&err);
     if (err != 0) {
       mask = 128;
     }
     --slash;
   } else {
     slash = end;
   }
--- a/widget/gtk2/nsDragService.cpp
+++ b/widget/gtk2/nsDragService.cpp
@@ -1407,17 +1407,17 @@ CreateUriList(nsISupportsArray *items, g
         nsCOMPtr<nsISupports> genericItem;
         items->GetElementAt(i, getter_AddRefs(genericItem));
         nsCOMPtr<nsITransferable> item;
         item = do_QueryInterface(genericItem);
 
         if (item) {
             PRUint32 tmpDataLen = 0;
             void    *tmpData = NULL;
-            nsresult rv = 0;
+            nsresult rv = NS_OK;
             nsCOMPtr<nsISupports> data;
             rv = item->GetTransferData(kURLMime,
                                        getter_AddRefs(data),
                                        &tmpDataLen);
 
             if (NS_SUCCEEDED(rv)) {
                 nsPrimitiveHelpers::CreateDataFromPrimitive(kURLMime,
                                                             data,
--- a/widget/xpwidgets/nsNativeTheme.cpp
+++ b/widget/xpwidgets/nsNativeTheme.cpp
@@ -123,17 +123,18 @@ nsNativeTheme::CheckBooleanAttr(nsIFrame
 PRInt32
 nsNativeTheme::CheckIntAttr(nsIFrame* aFrame, nsIAtom* aAtom, PRInt32 defaultValue)
 {
   if (!aFrame)
     return defaultValue;
 
   nsAutoString attr;
   aFrame->GetContent()->GetAttr(kNameSpaceID_None, aAtom, attr);
-  PRInt32 err, value = attr.ToInteger(&err);
+  nsresult err;
+  PRInt32 value = attr.ToInteger(&err);
   if (attr.IsEmpty() || NS_FAILED(err))
     return defaultValue;
 
   return value;
 }
 
 bool
 nsNativeTheme::GetCheckedOrSelected(nsIFrame* aFrame, bool aCheckSelected)
--- a/widget/xpwidgets/nsPrintOptionsImpl.cpp
+++ b/widget/xpwidgets/nsPrintOptionsImpl.cpp
@@ -1083,17 +1083,17 @@ nsPrintOptions::ReadInchesToTwipsPref(co
                                       const char * aMarginPref)
 {
   nsAutoString str;
   nsresult rv = Preferences::GetString(aPrefId, &str);
   if (NS_FAILED(rv) || str.IsEmpty()) {
     rv = Preferences::GetString(aMarginPref, &str);
   }
   if (NS_SUCCEEDED(rv) && !str.IsEmpty()) {
-    PRInt32 errCode;
+    nsresult errCode;
     float inches = str.ToFloat(&errCode);
     if (NS_SUCCEEDED(errCode)) {
       aTwips = NS_INCHES_TO_INT_TWIPS(inches);
     } else {
       aTwips = 0;
     }
   }
 }
--- a/xpcom/string/public/nsTString.h
+++ b/xpcom/string/public/nsTString.h
@@ -225,39 +225,36 @@ class nsTString_CharT : public nsTSubstr
 #endif // !CharT_is_PRUnichar
 
         /**
          * Perform string to double-precision float conversion.
          *
          * @param   aErrorCode will contain error if one occurs
          * @return  double-precision float rep of string value
          */
-      double ToDouble( PRInt32* aErrorCode ) const;
+      double ToDouble( nsresult* aErrorCode ) const;
 
         /**
          * Perform string to single-precision float conversion.
          *
          * @param   aErrorCode will contain error if one occurs
          * @return  single-precision float rep of string value
          */
-      float ToFloat( PRInt32* aErrorCode ) const {
+      float ToFloat( nsresult* aErrorCode ) const {
         return (float)ToDouble(aErrorCode);
       }
 
 
         /**
          * Perform string to int conversion.
          * @param   aErrorCode will contain error if one occurs
          * @param   aRadix tells us which radix to assume; kAutoDetect tells us to determine the radix for you.
          * @return  int rep of string value, and possible (out) error code
          */
-      PRInt32 ToInteger( PRInt32* aErrorCode, PRUint32 aRadix=kRadix10 ) const;
-      PRInt32 ToInteger( nsresult* aErrorCode, PRUint32 aRadix=kRadix10 ) const {
-        return ToInteger(reinterpret_cast<PRInt32*>(aErrorCode), aRadix);
-      }
+      PRInt32 ToInteger( nsresult* aErrorCode, PRUint32 aRadix=kRadix10 ) const;
 
         /**
          * |Left|, |Mid|, and |Right| are annoying signatures that seem better almost
          * any _other_ way than they are now.  Consider these alternatives
          * 
          * aWritable = aReadable.Left(17);   // ...a member function that returns a |Substring|
          * aWritable = Left(aReadable, 17);  // ...a global function that returns a |Substring|
          * Left(aReadable, 17, aWritable);   // ...a global function that does the assignment
--- a/xpcom/string/src/nsStringObsolete.cpp
+++ b/xpcom/string/src/nsStringObsolete.cpp
@@ -979,40 +979,40 @@ nsString::EqualsIgnoreCase( const char* 
   }
 
 
   /**
    * nsTString::ToDouble
    */
 
 double
-nsCString::ToDouble(PRInt32* aErrorCode) const
+nsCString::ToDouble(nsresult* aErrorCode) const
   {
     double res = 0.0;
     if (mLength > 0)
       {
         char *conv_stopped;
         const char *str = mData;
         // Use PR_strtod, not strtod, since we don't want locale involved.
         res = PR_strtod(str, &conv_stopped);
         if (conv_stopped == str+mLength)
-          *aErrorCode = (PRInt32) NS_OK;
+          *aErrorCode = NS_OK;
         else // Not all the string was scanned
-          *aErrorCode = (PRInt32) NS_ERROR_ILLEGAL_VALUE;
+          *aErrorCode = NS_ERROR_ILLEGAL_VALUE;
       }
     else
       {
         // The string was too short (0 characters)
-        *aErrorCode = (PRInt32) NS_ERROR_ILLEGAL_VALUE;
+        *aErrorCode = NS_ERROR_ILLEGAL_VALUE;
       }
     return res;
   }
 
 double
-nsString::ToDouble(PRInt32* aErrorCode) const
+nsString::ToDouble(nsresult* aErrorCode) const
   {
     return NS_LossyConvertUTF16toASCII(*this).ToDouble(aErrorCode);
   }
 
 
   /**
    * nsTString::AssignWithConversion
    */
--- a/xpcom/string/src/nsTStringObsolete.cpp
+++ b/xpcom/string/src/nsTStringObsolete.cpp
@@ -104,17 +104,17 @@ nsTString_CharT::RFindCharInSet( const C
     return ::RFindCharInSet(mData, aOffset, aSet);
   }
 
 
   // it's a shame to replicate this code.  it was done this way in the past
   // to help performance.  this function also gets to keep the rickg style
   // indentation :-/
 PRInt32
-nsTString_CharT::ToInteger( PRInt32* aErrorCode, PRUint32 aRadix ) const
+nsTString_CharT::ToInteger( nsresult* aErrorCode, PRUint32 aRadix ) const
 {
   CharT*  cp=mData;
   PRInt32 theRadix=10; // base 10 unless base 16 detected, or overriden (aRadix != kAutoDetect)
   PRInt32 result=0;
   bool    negate=false;
   CharT   theChar=0;
 
     //initial value, override if we find an integer
--- a/xpcom/tests/TestCOMPtr.cpp
+++ b/xpcom/tests/TestCOMPtr.cpp
@@ -161,17 +161,17 @@ CreateIFoo( void** result )
     printf(">>CreateIFoo() --> ");
     IFoo* foop = new IFoo;
     printf("IFoo@%p\n", static_cast<void*>(foop));
 
     foop->AddRef();
     *result = foop;
 
     printf("<<CreateIFoo()\n");
-    return 0;
+    return NS_OK;
   }
 
 void
 set_a_IFoo( nsCOMPtr<IFoo>* result )
   {
     printf(">>set_a_IFoo()\n");
     assert(result);
 
@@ -255,17 +255,17 @@ CreateIBar( void** result )
     printf(">>CreateIBar() --> ");
     IBar* barp = new IBar;
     printf("IBar@%p\n", static_cast<void*>(barp));
 
     barp->AddRef();
     *result = barp;
 
     printf("<<CreateIBar()\n");
-    return 0;
+    return NS_OK;
   }
 
 void
 AnIFooPtrPtrContext( IFoo** )
   {
   }
 
 void
--- a/xpcom/tests/TestDeadlockDetector.cpp
+++ b/xpcom/tests/TestDeadlockDetector.cpp
@@ -258,17 +258,17 @@ CheckForDeadlock(const char* test, const
 
 // Stupidest possible deadlock.
 nsresult
 Sanity_Child()
 {
     mozilla::Mutex m1("dd.sanity.m1");
     m1.Lock();
     m1.Lock();
-    return 0;                  // not reached
+    return NS_OK;                  // not reached
 }
 
 nsresult
 Sanity()
 {
     const char* const tokens[] = {
         "###!!! ERROR: Potential deadlock detected",
         "=== Cyclical dependency starts at\n--- Mutex : dd.sanity.m1",
@@ -288,17 +288,17 @@ Sanity()
 nsresult
 Sanity2_Child()
 {
     mozilla::Mutex m1("dd.sanity2.m1");
     mozilla::Mutex m2("dd.sanity2.m2");
     m1.Lock();
     m2.Lock();
     m1.Lock();
-    return 0;                  // not reached
+    return NS_OK;                  // not reached
 }
 
 nsresult
 Sanity2()
 {
     const char* const tokens[] = {
         "###!!! ERROR: Potential deadlock detected",
         "=== Cyclical dependency starts at\n--- Mutex : dd.sanity2.m1",
@@ -330,17 +330,17 @@ Sanity3_Child()
     m4.Lock();
     m4.Unlock();
     m3.Unlock();
     m2.Unlock();
     m1.Unlock();
 
     m4.Lock();
     m1.Lock();
-    return 0;
+    return NS_OK;
 }
 
 nsresult
 Sanity3()
 {
     const char* const tokens[] = {
         "###!!! ERROR: Potential deadlock detected",
         "=== Cyclical dependency starts at\n--- Mutex : dd.sanity3.m1",
@@ -362,17 +362,17 @@ Sanity3()
 nsresult
 Sanity4_Child()
 {
     mozilla::ReentrantMonitor m1("dd.sanity4.m1");
     mozilla::Mutex m2("dd.sanity4.m2");
     m1.Enter();
     m2.Lock();
     m1.Enter();
-    return 0;
+    return NS_OK;
 }
 
 nsresult
 Sanity4()
 {
     const char* const tokens[] = {
         "Re-entering ReentrantMonitor after acquiring other resources",
         "###!!! ERROR: Potential deadlock detected",
@@ -422,17 +422,17 @@ TwoThreads_Child()
         NS_RUNTIMEABORT("couldn't allocate mutexes");
 
     PRThread* t1 = spawn(TwoThreads_thread, (void*) 0);
     PR_JoinThread(t1);
 
     PRThread* t2 = spawn(TwoThreads_thread, (void*) 1);
     PR_JoinThread(t2);
 
-    return 0;
+    return NS_OK;
 }
 
 nsresult
 TwoThreads()
 {
     const char* const tokens[] = {
         "###!!! ERROR: Potential deadlock detected",
         "=== Cyclical dependency starts at\n--- Mutex : dd.twothreads.m2",
@@ -481,17 +481,17 @@ ContentionNoDeadlock_Child()
         threads[i] = spawn(ContentionNoDeadlock_thread, NS_INT32_TO_PTR(i));
 
     for (PRUint32 i = 0; i < ArrayLength(threads); ++i)
         PR_JoinThread(threads[i]);
 
     for (PRUint32 i = 0; i < ArrayLength(cndMs); ++i)
         delete cndMs[i];
 
-    return 0;
+    return NS_OK;
 }
 
 nsresult
 ContentionNoDeadlock()
 {
     const char * func = __func__;
     Subprocess proc(func);
     proc.RunToCompletion(60000);
--- a/xpcom/tests/TestHashtables.cpp
+++ b/xpcom/tests/TestHashtables.cpp
@@ -319,17 +319,17 @@ CreateIFoo( IFoo** result )
     printf("    >>CreateIFoo() --> ");
     IFoo* foop = new IFoo();
     printf("IFoo@%p\n", static_cast<void*>(foop));
 
     foop->AddRef();
     *result = foop;
 
     printf("<<CreateIFoo()\n");
-    return 0;
+    return NS_OK;
   }
 
 PLDHashOperator
 nsIEnumRead(const PRUint32& aKey, IFoo* aFoo, void* userArg) {
   nsCAutoString str;
   aFoo->GetString(str);
 
   printf("  enumerated %u = \"%s\"\n", aKey, str.get());
--- a/xpcom/tests/TestRefPtr.cpp
+++ b/xpcom/tests/TestRefPtr.cpp
@@ -162,17 +162,17 @@ CreateFoo( void** result )
     printf(">>CreateFoo() --> ");
     Foo* foop = new Foo;
     printf("Foo@%p\n", static_cast<void*>(foop));
 
     foop->AddRef();
     *result = foop;
 
     printf("<<CreateFoo()\n");
-    return 0;
+    return NS_OK;
   }
 
 void
 set_a_Foo( nsRefPtr<Foo>* result )
   {
     printf(">>set_a_Foo()\n");
     assert(result);
 
@@ -256,17 +256,17 @@ CreateBar( void** result )
     printf(">>CreateBar() --> ");
     Bar* barp = new Bar;
     printf("Bar@%p\n", static_cast<void*>(barp));
 
     barp->AddRef();
     *result = barp;
 
     printf("<<CreateBar()\n");
-    return 0;
+    return NS_OK;
   }
 
 void
 AnFooPtrPtrContext( Foo** )
   {
   }
 
 void
--- a/xpfe/appshell/src/nsXULWindow.cpp
+++ b/xpfe/appshell/src/nsXULWindow.cpp
@@ -1008,17 +1008,17 @@ bool nsXULWindow::LoadPositionFromXUL()
   NS_ASSERTION(windowElement, "no xul:window");
   if (!windowElement)
     return false;
 
   PRInt32 currX = 0;
   PRInt32 currY = 0;
   PRInt32 currWidth = 0;
   PRInt32 currHeight = 0;
-  PRInt32 errorCode;
+  nsresult errorCode;
   PRInt32 temp;
 
   GetPositionAndSize(&currX, &currY, &currWidth, &currHeight);
 
   // Obtain the position information from the <xul:window> element.
   PRInt32 specX = currX;
   PRInt32 specY = currY;
   nsAutoString posString;
@@ -1075,17 +1075,17 @@ bool nsXULWindow::LoadSizeFromXUL()
   nsCOMPtr<nsIDOMElement> windowElement;
   GetWindowDOMElement(getter_AddRefs(windowElement));
   NS_ASSERTION(windowElement, "no xul:window");
   if (!windowElement)
     return false;
 
   PRInt32 currWidth = 0;
   PRInt32 currHeight = 0;
-  PRInt32 errorCode;
+  nsresult errorCode;
   PRInt32 temp;
 
   GetSize(&currWidth, &currHeight);
 
   // Obtain the position and sizing information from the <xul:window> element.
   PRInt32 specWidth = currWidth;
   PRInt32 specHeight = currHeight;
   nsAutoString sizeString;
@@ -1207,17 +1207,17 @@ bool nsXULWindow::LoadMiscPersistentAttr
       mWindow->SetSizeMode(sizeMode);
     }
     gotState = true;
   }
 
   // zlevel
   rv = windowElement->GetAttribute(NS_LITERAL_STRING("zlevel"), stateString);
   if (NS_SUCCEEDED(rv) && stateString.Length() > 0) {
-    PRInt32  errorCode;
+    nsresult errorCode;
     PRUint32 zLevel = stateString.ToInteger(&errorCode);
     if (NS_SUCCEEDED(errorCode) && zLevel >= lowestZ && zLevel <= highestZ)
       SetZLevel(zLevel);
   }
 
   return gotState;
 }