Bug 1316432 - Fix nsCOMPtr constructions&assignments from 0 - r=froydnj
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 10 Nov 2016 14:11:27 +1100
changeset 322029 8d3dcf1db881af59d7cff15d3964d14f9c075812
parent 322028 376b38e78518ba0774db44085ec9586bd5ddbdbf
child 322030 0d8346f8bbcbf47bcae441656caaf13f17d4a83a
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersfroydnj
bugs1316432
milestone52.0a1
Bug 1316432 - Fix nsCOMPtr constructions&assignments from 0 - r=froydnj Giving '0' (literal zero) to nsCOMPtr is now ambiguous, as both nsCOMPtr(decltype(nullptr)) and nsCOMPtr(T*) could be used. In any case, our coding standards mandate the use of 'nullptr' for pointers. So I'm changing all zeroes into nullptr's where necessary. MozReview-Commit-ID: LXiZTu87Ck6
dom/base/nsContentSink.cpp
dom/plugins/base/nsPluginStreamListenerPeer.cpp
dom/xslt/xpath/txNameTest.cpp
dom/xslt/xpath/txVariableRefExpr.cpp
dom/xul/templates/nsRDFPropertyTestNode.cpp
editor/composer/nsEditorSpellCheck.cpp
editor/libeditor/HTMLEditRules.cpp
editor/libeditor/HTMLURIRefObject.cpp
embedding/browser/nsEmbedStream.cpp
embedding/components/find/nsFind.cpp
embedding/components/windowwatcher/nsWindowWatcher.cpp
layout/generic/nsSelection.cpp
modules/libjar/nsJARChannel.cpp
netwerk/base/nsIncrementalStreamLoader.cpp
netwerk/base/nsInputStreamPump.cpp
netwerk/base/nsLoadGroup.cpp
netwerk/base/nsSocketTransport2.cpp
netwerk/base/nsStandardURL.cpp
netwerk/base/nsStreamListenerTee.cpp
netwerk/base/nsStreamLoader.cpp
netwerk/protocol/about/nsAboutCacheEntry.cpp
netwerk/protocol/ftp/nsFtpControlConnection.cpp
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/nsHttpConnectionMgr.cpp
netwerk/protocol/http/nsHttpTransaction.cpp
netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
netwerk/streamconv/converters/nsBinHexDecoder.cpp
netwerk/streamconv/converters/nsIndexedToHTML.cpp
netwerk/streamconv/converters/nsUnknownDecoder.cpp
parser/htmlparser/nsParser.cpp
parser/htmlparser/nsScanner.cpp
security/manager/ssl/nsNSSCertHelper.cpp
security/manager/ssl/nsPKCS12Blob.cpp
toolkit/components/places/nsNavHistory.cpp
uriloader/base/nsDocLoader.cpp
uriloader/base/nsURILoader.cpp
uriloader/exthandler/nsExternalProtocolHandler.cpp
xpcom/io/nsInputStreamTee.cpp
xpcom/io/nsPipe3.cpp
--- a/dom/base/nsContentSink.cpp
+++ b/dom/base/nsContentSink.cpp
@@ -1501,17 +1501,17 @@ nsContentSink::DidBuildModelImpl(bool aT
 
   // Cancel a timer if we had one out there
   if (mNotificationTimer) {
     SINK_TRACE(static_cast<LogModule*>(gContentSinkLogModuleInfo),
                SINK_TRACE_REFLOW,
                ("nsContentSink::DidBuildModel: canceling notification "
                 "timeout"));
     mNotificationTimer->Cancel();
-    mNotificationTimer = 0;
+    mNotificationTimer = nullptr;
   }	
 }
 
 void
 nsContentSink::DropParserAndPerfHint(void)
 {
   if (!mParser) {
     // Make sure we don't unblock unload too many times
--- a/dom/plugins/base/nsPluginStreamListenerPeer.cpp
+++ b/dom/plugins/base/nsPluginStreamListenerPeer.cpp
@@ -67,18 +67,18 @@ NS_IMPL_ISUPPORTS(nsPluginByteRangeStrea
 nsPluginByteRangeStreamListener::nsPluginByteRangeStreamListener(nsIWeakReference* aWeakPtr)
 {
   mWeakPtrPluginStreamListenerPeer = aWeakPtr;
   mRemoveByteRangeRequest = false;
 }
 
 nsPluginByteRangeStreamListener::~nsPluginByteRangeStreamListener()
 {
-  mStreamConverter = 0;
-  mWeakPtrPluginStreamListenerPeer = 0;
+  mStreamConverter = nullptr;
+  mWeakPtrPluginStreamListenerPeer = nullptr;
 }
 
 /**
  * Unwrap any byte-range requests so that we can check whether the base channel
  * is being tracked properly.
  */
 static nsCOMPtr<nsIRequest>
 GetBaseRequest(nsIRequest* r)
@@ -118,17 +118,17 @@ nsPluginByteRangeStreamListener::OnStart
                                 nullptr,
                                 getter_AddRefs(mStreamConverter));
     if (NS_SUCCEEDED(rv)) {
       rv = mStreamConverter->OnStartRequest(request, ctxt);
       if (NS_SUCCEEDED(rv))
         return rv;
     }
   }
-  mStreamConverter = 0;
+  mStreamConverter = nullptr;
 
   nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(request));
   if (!httpChannel) {
     return NS_ERROR_FAILURE;
   }
 
   uint32_t responseCode = 0;
   rv = httpChannel->GetResponseStatus(&responseCode);
--- a/dom/xslt/xpath/txNameTest.cpp
+++ b/dom/xslt/xpath/txNameTest.cpp
@@ -10,17 +10,17 @@
 #include "txIXPathContext.h"
 
 txNameTest::txNameTest(nsIAtom* aPrefix, nsIAtom* aLocalName, int32_t aNSID,
                        uint16_t aNodeType)
     :mPrefix(aPrefix), mLocalName(aLocalName), mNamespace(aNSID),
      mNodeType(aNodeType)
 {
     if (aPrefix == nsGkAtoms::_empty)
-        mPrefix = 0;
+        mPrefix = nullptr;
     NS_ASSERTION(aLocalName, "txNameTest without a local name?");
     NS_ASSERTION(aNodeType == txXPathNodeType::DOCUMENT_NODE ||
                  aNodeType == txXPathNodeType::ELEMENT_NODE ||
                  aNodeType == txXPathNodeType::ATTRIBUTE_NODE,
                  "Go fix txNameTest::matches");
 }
 
 bool txNameTest::matches(const txXPathNode& aNode, txIMatchContext* aContext)
--- a/dom/xslt/xpath/txVariableRefExpr.cpp
+++ b/dom/xslt/xpath/txVariableRefExpr.cpp
@@ -17,17 +17,17 @@
  * Creates a VariableRefExpr with the given variable name
 **/
 VariableRefExpr::VariableRefExpr(nsIAtom* aPrefix, nsIAtom* aLocalName,
                                  int32_t aNSID)
     : mPrefix(aPrefix), mLocalName(aLocalName), mNamespace(aNSID)
 {
     NS_ASSERTION(mLocalName, "VariableRefExpr without local name?");
     if (mPrefix == nsGkAtoms::_empty)
-        mPrefix = 0;
+        mPrefix = nullptr;
 }
 
 /**
  * Evaluates this Expr based on the given context node and processor state
  * @param context the context node for evaluation of this Expr
  * @param ps the ContextState containing the stack information needed
  * for evaluation
  * @return the result of the evaluation
--- a/dom/xul/templates/nsRDFPropertyTestNode.cpp
+++ b/dom/xul/templates/nsRDFPropertyTestNode.cpp
@@ -49,17 +49,17 @@ nsRDFPropertyTestNode::nsRDFPropertyTest
 
 nsRDFPropertyTestNode::nsRDFPropertyTestNode(TestNode* aParent,
                                              nsXULTemplateQueryProcessorRDF* aProcessor,
                                              nsIRDFResource* aSource,
                                              nsIRDFResource* aProperty,
                                              nsIAtom* aTargetVariable)
     : nsRDFTestNode(aParent),
       mProcessor(aProcessor),
-      mSourceVariable(0),
+      mSourceVariable(nullptr),
       mSource(aSource),
       mProperty(aProperty),
       mTargetVariable(aTargetVariable),
       mTarget(nullptr)
 {
     if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) {
         const char* source = "(null)";
         if (aSource)
@@ -85,17 +85,17 @@ nsRDFPropertyTestNode::nsRDFPropertyTest
                                              nsIAtom* aSourceVariable,
                                              nsIRDFResource* aProperty,
                                              nsIRDFNode* aTarget)
     : nsRDFTestNode(aParent),
       mProcessor(aProcessor),
       mSourceVariable(aSourceVariable),
       mSource(nullptr),
       mProperty(aProperty),
-      mTargetVariable(0),
+      mTargetVariable(nullptr),
       mTarget(aTarget)
 {
     if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) {
         nsAutoString svar(NS_LITERAL_STRING("(none)"));
         if (mSourceVariable)
             mSourceVariable->ToString(svar);
 
         const char* prop = "(null)";
--- a/editor/composer/nsEditorSpellCheck.cpp
+++ b/editor/composer/nsEditorSpellCheck.cpp
@@ -637,17 +637,17 @@ NS_IMETHODIMP
 nsEditorSpellCheck::UninitSpellChecker()
 {
   NS_ENSURE_TRUE(mSpellChecker, NS_ERROR_NOT_INITIALIZED);
 
   // Cleanup - kill the spell checker
   DeleteSuggestedWordList();
   mDictionaryList.Clear();
   mDictionaryIndex = 0;
-  mSpellChecker = 0;
+  mSpellChecker = nullptr;
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsEditorSpellCheck::SetFilter(nsITextServicesFilter *filter)
 {
   mTxtSrvFilter = filter;
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -495,17 +495,17 @@ HTMLEditRules::AfterEditInner(EditAction
         WSRunObject(mHTMLEditor, mRangeItem->endNode,
                     mRangeItem->endOffset).AdjustWhitespace();
       }
     }
 
     // if we created a new block, make sure selection lands in it
     if (mNewBlock) {
       rv = PinSelectionToNewBlock(selection);
-      mNewBlock = 0;
+      mNewBlock = nullptr;
     }
 
     // adjust selection for insert text, html paste, and delete actions
     if (action == EditAction::insertText ||
         action == EditAction::insertIMEText ||
         action == EditAction::deleteSelection ||
         action == EditAction::insertBreak ||
         action == EditAction::htmlPaste ||
@@ -3074,17 +3074,17 @@ HTMLEditRules::WillMakeList(Selection* a
       curList = nullptr;
     }
 
     // if curNode is a Break, delete it, and quit remembering prev list item
     if (TextEditUtils::IsBreak(curNode)) {
       NS_ENSURE_STATE(mHTMLEditor);
       rv = mHTMLEditor->DeleteNode(curNode);
       NS_ENSURE_SUCCESS(rv, rv);
-      prevListItem = 0;
+      prevListItem = nullptr;
       continue;
     } else if (IsEmptyInline(curNode)) {
       // if curNode is an empty inline container, delete it
       NS_ENSURE_STATE(mHTMLEditor);
       rv = mHTMLEditor->DeleteNode(curNode);
       NS_ENSURE_SUCCESS(rv, rv);
       continue;
     }
@@ -3107,17 +3107,17 @@ HTMLEditRules::WillMakeList(Selection* a
         NS_ENSURE_SUCCESS(rv, rv);
       } else {
         // replace list with new list type
         rv = ConvertListType(curNode->AsElement(), getter_AddRefs(newBlock),
                              listType, itemType);
         NS_ENSURE_SUCCESS(rv, rv);
         curList = newBlock;
       }
-      prevListItem = 0;
+      prevListItem = nullptr;
       continue;
     }
 
     if (HTMLEditUtils::IsListItem(curNode)) {
       NS_ENSURE_STATE(mHTMLEditor);
       if (!curParent->IsHTMLElement(listType)) {
         // list item is in wrong type of list. if we don't have a curList,
         // split the old list and make a new list of correct type.
@@ -3201,17 +3201,17 @@ HTMLEditRules::WillMakeList(Selection* a
     if (!curList) {
       rv = SplitAsNeeded(listType, curParent, offset);
       NS_ENSURE_SUCCESS(rv, rv);
       NS_ENSURE_STATE(mHTMLEditor);
       curList = mHTMLEditor->CreateNode(listType, curParent, offset);
       // remember our new block for postprocessing
       mNewBlock = curList;
       // curList is now the correct thing to put curNode in
-      prevListItem = 0;
+      prevListItem = nullptr;
     }
 
     // if curNode isn't a list item, we must wrap it in one
     nsCOMPtr<Element> listItem;
     if (!HTMLEditUtils::IsListItem(curNode)) {
       if (IsInlineNode(curNode) && prevListItem) {
         // this is a continuation of some inline nodes that belong together in
         // the same list item.  use prevListItem
--- a/editor/libeditor/HTMLURIRefObject.cpp
+++ b/editor/libeditor/HTMLURIRefObject.cpp
@@ -238,17 +238,17 @@ HTMLURIRefObject::SetNode(nsIDOMNode* aN
   nsAutoString dummyURI;
   if (NS_SUCCEEDED(GetNextURI(dummyURI))) {
     mCurAttrIndex = 0;    // Reset so we'll get the first node next time
     return NS_OK;
   }
 
   // If there weren't any URIs in the attributes,
   // then don't accept this node.
-  mNode = 0;
+  mNode = nullptr;
   return NS_ERROR_INVALID_ARG;
 }
 
 } // namespace mozilla
 
 nsresult NS_NewHTMLURIRefObject(nsIURIRefObject** aResult, nsIDOMNode* aNode)
 {
   RefPtr<mozilla::HTMLURIRefObject> refObject = new mozilla::HTMLURIRefObject();
--- a/embedding/browser/nsEmbedStream.cpp
+++ b/embedding/browser/nsEmbedStream.cpp
@@ -90,12 +90,12 @@ nsresult
 nsEmbedStream::CloseStream(void)
 {
   nsresult rv = NS_OK;
 
   // NS_ENSURE_STATE returns NS_ERROR_UNEXPECTED if the condition isn't
   // satisfied; this is exactly what we want to return.
   NS_ENSURE_STATE(mOutputStream);
   mOutputStream->Close();
-  mOutputStream = 0;
+  mOutputStream = nullptr;
 
   return rv;
 }
--- a/embedding/components/find/nsFind.cpp
+++ b/embedding/components/find/nsFind.cpp
@@ -1039,17 +1039,17 @@ nsFind::Find(const char16_t* aPatText, n
         pindex = (mFindBackward ? patLen : 0);
         inWhitespace = false;
       }
 
       // Get the text content:
       tc = do_QueryInterface(mIterNode);
       if (!tc || !(frag = tc->GetText())) { // Out of nodes
         mIterator = nullptr;
-        mLastBlockParent = 0;
+        mLastBlockParent = nullptr;
         ResetAll();
         return NS_OK;
       }
 
       fragLen = frag->GetLength();
 
       // Set our starting point in this node. If we're going back to the anchor
       // node, which means that we just ended a partial match, use the saved
--- a/embedding/components/windowwatcher/nsWindowWatcher.cpp
+++ b/embedding/components/windowwatcher/nsWindowWatcher.cpp
@@ -95,17 +95,17 @@ struct nsWatcherWindowEntry
 #else
     mWindow = aWindow;
 #endif
     nsCOMPtr<nsISupportsWeakReference> supportsweak(do_QueryInterface(aChrome));
     if (supportsweak) {
       supportsweak->GetWeakReference(getter_AddRefs(mChromeWeak));
     } else {
       mChrome = aChrome;
-      mChromeWeak = 0;
+      mChromeWeak = nullptr;
     }
     ReferenceSelf();
   }
   ~nsWatcherWindowEntry() {}
 
   void InsertAfter(nsWatcherWindowEntry* aOlder);
   void Unlink();
   void ReferenceSelf();
@@ -1486,17 +1486,17 @@ nsWindowWatcher::AddWindow(mozIDOMWindow
     info = FindWindowEntry(aWindow);
     if (info) {
       nsCOMPtr<nsISupportsWeakReference> supportsweak(
         do_QueryInterface(aChrome));
       if (supportsweak) {
         supportsweak->GetWeakReference(getter_AddRefs(info->mChromeWeak));
       } else {
         info->mChrome = aChrome;
-        info->mChromeWeak = 0;
+        info->mChromeWeak = nullptr;
       }
       return NS_OK;
     }
 
     // create a window info struct and add it to the list of windows
     info = new nsWatcherWindowEntry(aWindow, aChrome);
     if (!info) {
       return NS_ERROR_OUT_OF_MEMORY;
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -275,17 +275,17 @@ public:
     return mTimer->InitWithCallback(this, mDelay, nsITimer::TYPE_ONE_SHOT);
   }
 
   nsresult Stop()
   {
     if (mTimer)
     {
       mTimer->Cancel();
-      mTimer = 0;
+      mTimer = nullptr;
     }
 
     mContent = nullptr;
     return NS_OK;
   }
 
   nsresult Init(nsFrameSelection* aFrameSelection, Selection* aSelection)
   {
--- a/modules/libjar/nsJARChannel.cpp
+++ b/modules/libjar/nsJARChannel.cpp
@@ -1012,29 +1012,29 @@ nsJARChannel::OnStopRequest(nsIRequest *
     LOG(("nsJARChannel::OnStopRequest [this=%x %s status=%x]\n",
         this, mSpec.get(), status));
 
     if (NS_SUCCEEDED(mStatus))
         mStatus = status;
 
     if (mListener) {
         mListener->OnStopRequest(this, mListenerContext, status);
-        mListener = 0;
-        mListenerContext = 0;
+        mListener = nullptr;
+        mListenerContext = nullptr;
     }
 
     if (mLoadGroup)
         mLoadGroup->RemoveRequest(this, nullptr, status);
 
-    mPump = 0;
+    mPump = nullptr;
     mIsPending = false;
 
     // Drop notification callbacks to prevent cycles.
-    mCallbacks = 0;
-    mProgressSink = 0;
+    mCallbacks = nullptr;
+    mProgressSink = nullptr;
 
     #if defined(XP_WIN) || defined(MOZ_WIDGET_COCOA)
     #else
     // To deallocate file descriptor by RemoteOpenFileChild destructor.
     mJarFile = nullptr;
     #endif
 
     return NS_OK;
--- a/netwerk/base/nsIncrementalStreamLoader.cpp
+++ b/netwerk/base/nsIncrementalStreamLoader.cpp
@@ -99,19 +99,19 @@ nsIncrementalStreamLoader::OnStopRequest
                                               length, elems);
     if (rv != NS_SUCCESS_ADOPTED_DATA) {
       // The observer didn't take ownership of the extracted data buffer, so
       // put it back into mData.
       mData.replaceRawBuffer(elems, length);
     }
     // done.. cleanup
     ReleaseData();
-    mRequest = 0;
-    mObserver = 0;
-    mContext = 0;
+    mRequest = nullptr;
+    mObserver = nullptr;
+    mContext = nullptr;
   }
   return NS_OK;
 }
 
 nsresult
 nsIncrementalStreamLoader::WriteSegmentFun(nsIInputStream *inStr,
                                            void *closure,
                                            const char *fromSegment,
@@ -192,17 +192,17 @@ nsIncrementalStreamLoader::OnDataAvailab
                                 uint64_t sourceOffset, uint32_t count)
 {
   if (mObserver) {
     // provide nsIIncrementalStreamLoader::request during call to OnStreamComplete
     mRequest = request;
   }
   uint32_t countRead;
   nsresult rv = inStr->ReadSegments(WriteSegmentFun, this, count, &countRead);
-  mRequest = 0;
+  mRequest = nullptr;
   return rv;
 }
 
 void
 nsIncrementalStreamLoader::ReleaseData()
 {
   mData.clearAndFree();
 }
--- a/netwerk/base/nsInputStreamPump.cpp
+++ b/netwerk/base/nsInputStreamPump.cpp
@@ -356,17 +356,17 @@ nsInputStreamPump::AsyncRead(nsIStreamLi
         if (NS_FAILED(rv)) return rv;
 
         mAsyncStream = do_QueryInterface(wrapper, &rv);
         if (NS_FAILED(rv)) return rv;
     }
 
     // release our reference to the original stream.  from this point forward,
     // we only reference the "stream" via mAsyncStream.
-    mStream = 0;
+    mStream = nullptr;
 
     // mStreamOffset now holds the number of bytes currently read.  we use this
     // to enforce the mStreamLength restriction.
     mStreamOffset = 0;
 
     // grab event queue (we must do this here by contract, since all notifications
     // must go to the thread which called AsyncRead)
     mTargetThread = do_GetCurrentThread();
@@ -698,29 +698,29 @@ nsInputStreamPump::OnStateStop()
         return STATE_IDLE;
     }
 
     if (NS_FAILED(mStatus))
         mAsyncStream->CloseWithStatus(mStatus);
     else if (mCloseWhenDone)
         mAsyncStream->Close();
 
-    mAsyncStream = 0;
-    mTargetThread = 0;
+    mAsyncStream = nullptr;
+    mTargetThread = nullptr;
     mIsPending = false;
     {
         // Note: Must exit monitor for call to OnStartRequest to avoid
         // deadlocks when calls to RetargetDeliveryTo for multiple
         // nsInputStreamPumps are needed (e.g. nsHttpChannel).
         mMonitor.Exit();
         mListener->OnStopRequest(this, mListenerContext, mStatus);
         mMonitor.Enter();
     }
-    mListener = 0;
-    mListenerContext = 0;
+    mListener = nullptr;
+    mListenerContext = nullptr;
 
     if (mLoadGroup)
         mLoadGroup->RemoveRequest(this, nullptr, mStatus);
 
     return STATE_IDLE;
 }
 
 //-----------------------------------------------------------------------------
--- a/netwerk/base/nsLoadGroup.cpp
+++ b/netwerk/base/nsLoadGroup.cpp
@@ -118,17 +118,17 @@ nsLoadGroup::nsLoadGroup(nsISupports* ou
     LOG(("LOADGROUP [%x]: Created.\n", this));
 }
 
 nsLoadGroup::~nsLoadGroup()
 {
     DebugOnly<nsresult> rv = Cancel(NS_BINDING_ABORTED);
     NS_ASSERTION(NS_SUCCEEDED(rv), "Cancel failed");
 
-    mDefaultLoadRequest = 0;
+    mDefaultLoadRequest = nullptr;
 
     if (mRequestContext) {
         nsID rcid;
         mRequestContext->GetID(&rcid);
 
         if (IsNeckoChild() && gNeckoChild) {
             char rcid_str[NSID_LENGTH];
             rcid.ToProvidedString(rcid_str);
--- a/netwerk/base/nsSocketTransport2.cpp
+++ b/netwerk/base/nsSocketTransport2.cpp
@@ -1869,17 +1869,17 @@ nsSocketTransport::OnSocketEvent(uint32_
         }
         break;
 
     case MSG_DNS_LOOKUP_COMPLETE:
         if (mDNSRequest)  // only send this if we actually resolved anything
             SendStatus(NS_NET_STATUS_RESOLVED_HOST);
 
         SOCKET_LOG(("  MSG_DNS_LOOKUP_COMPLETE\n"));
-        mDNSRequest = 0;
+        mDNSRequest = nullptr;
         if (param) {
             mDNSRecord = static_cast<nsIDNSRecord *>(param);
             mDNSRecord->GetNextAddr(SocketPort(), &mNetAddr);
         }
         // status contains DNS lookup status
         if (NS_FAILED(status)) {
             // When using a HTTP proxy, NS_ERROR_UNKNOWN_HOST means the HTTP 
             // proxy host is not found, so we fixup the error code.
@@ -2087,17 +2087,17 @@ nsSocketTransport::OnSocketDetached(PRFi
     if (!gIOService->IsNetTearingDown() && RecoverFromError())
         mCondition = NS_OK;
     else {
         mState = STATE_CLOSED;
 
         // make sure there isn't any pending DNS request
         if (mDNSRequest) {
             mDNSRequest->Cancel(NS_ERROR_ABORT);
-            mDNSRequest = 0;
+            mDNSRequest = nullptr;
         }
 
         //
         // notify input/output streams
         //
         mInput.OnSocketReady(mCondition);
         mOutput.OnSocketReady(mCondition);
     }
--- a/netwerk/base/nsStandardURL.cpp
+++ b/netwerk/base/nsStandardURL.cpp
@@ -388,17 +388,17 @@ nsStandardURL::Clear()
 
     InvalidateCache();
 }
 
 void
 nsStandardURL::InvalidateCache(bool invalidateCachedFile)
 {
     if (invalidateCachedFile)
-        mFile = 0;
+        mFile = nullptr;
     if (mHostA) {
         free(mHostA);
         mHostA = nullptr;
     }
     mSpecEncoding = eEncoding_Unknown;
 }
 
 // |base| should be 8, 10 or 16. Not check the precondition for performance.
@@ -3102,17 +3102,17 @@ nsStandardURL::SetFile(nsIFile *file)
     rv = Init(mURLType, mDefaultPort, url, nullptr, nullptr);
 
     // must clone |file| since its value is not guaranteed to remain constant
     if (NS_SUCCEEDED(rv)) {
         InvalidateCache();
         if (NS_FAILED(file->Clone(getter_AddRefs(mFile)))) {
             NS_WARNING("nsIFile::Clone failed");
             // failure to clone is not fatal (GetFile will generate mFile)
-            mFile = 0;
+            mFile = nullptr;
         }
     }
     return rv;
 }
 
 //----------------------------------------------------------------------------
 // nsStandardURL::nsIStandardURL
 //----------------------------------------------------------------------------
--- a/netwerk/base/nsStreamListenerTee.cpp
+++ b/netwerk/base/nsStreamListenerTee.cpp
@@ -32,31 +32,31 @@ NS_IMETHODIMP
 nsStreamListenerTee::OnStopRequest(nsIRequest *request,
                                    nsISupports *context,
                                    nsresult status)
 {
     NS_ENSURE_TRUE(mListener, NS_ERROR_NOT_INITIALIZED);
     // it is critical that we close out the input stream tee
     if (mInputTee) {
         mInputTee->SetSink(nullptr);
-        mInputTee = 0;
+        mInputTee = nullptr;
     }
 
     // release sink on the same thread where the data was written (bug 716293)
     if (mEventTarget) {
       NS_ProxyRelease(mEventTarget, mSink.forget());
     }
     else {
-        mSink = 0;
+        mSink = nullptr;
     }
 
     nsresult rv = mListener->OnStopRequest(request, context, status);
     if (mObserver)
         mObserver->OnStopRequest(request, context, status);
-    mObserver = 0;
+    mObserver = nullptr;
     return rv;
 }
 
 NS_IMETHODIMP
 nsStreamListenerTee::OnDataAvailable(nsIRequest *request,
                                      nsISupports *context,
                                      nsIInputStream *input,
                                      uint64_t offset,
--- a/netwerk/base/nsStreamLoader.cpp
+++ b/netwerk/base/nsStreamLoader.cpp
@@ -106,19 +106,19 @@ nsStreamLoader::OnStopRequest(nsIRequest
                                               length, elems);
     if (rv != NS_SUCCESS_ADOPTED_DATA) {
       // The observer didn't take ownership of the extracted data buffer, so
       // put it back into mData.
       mData.replaceRawBuffer(elems, length);
     }
     // done.. cleanup
     ReleaseData();
-    mRequest = 0;
-    mObserver = 0;
-    mContext = 0;
+    mRequest = nullptr;
+    mObserver = nullptr;
+    mContext = nullptr;
   }
 
   if (mRequestObserver) {
     mRequestObserver->OnStopRequest(request, ctxt, aStatus);
     mRequestObserver = nullptr;
   }
 
   return NS_OK;
--- a/netwerk/protocol/about/nsAboutCacheEntry.cpp
+++ b/netwerk/protocol/about/nsAboutCacheEntry.cpp
@@ -381,17 +381,17 @@ nsAboutCacheEntry::Channel::WriteCacheEn
     }
     char* escapedStr = nsEscapeHTML(str.get());
     if (NS_SUCCEEDED(rv) && !(isJS || isData)) {
         buffer.AppendLiteral("<a href=\"");
         buffer.Append(escapedStr);
         buffer.AppendLiteral("\">");
         buffer.Append(escapedStr);
         buffer.AppendLiteral("</a>");
-        uri = 0;
+        uri = nullptr;
     } else {
         buffer.Append(escapedStr);
     }
     free(escapedStr);
     buffer.AppendLiteral("</td>\n"
                          "  </tr>\n");
 
     // temp vars for reporting
--- a/netwerk/protocol/ftp/nsFtpControlConnection.cpp
+++ b/netwerk/protocol/ftp/nsFtpControlConnection.cpp
@@ -156,17 +156,17 @@ nsFtpControlConnection::Disconnect(nsres
     if (!mSocket)
         return NS_OK;  // already disconnected
     
     LOG_INFO(("FTP:(%p) CC disconnecting (%x)", this, status));
 
     if (NS_FAILED(status)) {
         // break cyclic reference!
         mSocket->Close(status);
-        mSocket = 0;
+        mSocket = nullptr;
         mSocketInput->AsyncWait(nullptr, 0, 0, nullptr);  // clear any observer
         mSocketInput = nullptr;
         mSocketOutput = nullptr;
     }
 
     return NS_OK;
 }
 
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -972,18 +972,18 @@ HttpChannelChild::DoOnStopRequest(nsIReq
 
   // In theory mListener should not be null, but in practice sometimes it is.
   MOZ_ASSERT(mListener);
   if (mListener) {
     mListener->OnStopRequest(aRequest, aContext, mStatus);
   }
   mOnStopRequestCalled = true;
 
-  mListener = 0;
-  mListenerContext = 0;
+  mListener = nullptr;
+  mListenerContext = nullptr;
   mCacheEntryAvailable = false;
   if (mLoadGroup)
     mLoadGroup->RemoveRequest(this, nullptr, mStatus);
 }
 
 class ProgressEvent : public ChannelEvent
 {
  public:
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -783,17 +783,17 @@ HttpChannelParent::RecvRedirect2Verify(c
   return true;
 }
 
 bool
 HttpChannelParent::RecvDocumentChannelCleanup()
 {
   // From now on only using mAssociatedContentSecurity.  Free everything else.
   mChannel = nullptr;          // Reclaim some memory sooner.
-  mCacheEntry = 0;  // Else we'll block other channels reading same URI
+  mCacheEntry = nullptr;  // Else we'll block other channels reading same URI
   return true;
 }
 
 bool
 HttpChannelParent::RecvMarkOfflineCacheEntryAsForeign()
 {
   if (mOfflineForeignMarker) {
     mOfflineForeignMarker->MarkAsForeign();
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -173,17 +173,17 @@ nsHttpConnectionMgr::Shutdown()
 
         nsresult rv = PostEvent(&nsHttpConnectionMgr::OnMsgShutdown,
                                 0, shutdownWrapper);
 
         // release our reference to the STS to prevent further events
         // from being posted.  this is how we indicate that we are
         // shutting down.
         mIsShuttingDown = true;
-        mSocketThreadTarget = 0;
+        mSocketThreadTarget = nullptr;
 
         if (NS_FAILED(rv)) {
             NS_WARNING("unable to post SHUTDOWN message");
             return rv;
         }
     }
 
     // wait for shutdown event to complete
--- a/netwerk/protocol/http/nsHttpTransaction.cpp
+++ b/netwerk/protocol/http/nsHttpTransaction.cpp
@@ -1293,17 +1293,17 @@ nsHttpTransaction::Restart()
     mTunnelProvider = nullptr;
 
     // rewind streams in case we already wrote out the request
     nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(mRequestStream);
     if (seekable)
         seekable->Seek(nsISeekableStream::NS_SEEK_SET, 0);
 
     // clear old connection state...
-    mSecurityInfo = 0;
+    mSecurityInfo = nullptr;
     if (mConnection) {
         if (!mReuseOnRestart) {
             mConnection->DontReuse();
         }
         MutexAutoLock lock(mLock);
         mConnection = nullptr;
     }
 
--- a/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
+++ b/netwerk/protocol/wyciwyg/WyciwygChannelChild.cpp
@@ -286,24 +286,24 @@ WyciwygChannelChild::OnStopRequest(const
 
     mIsPending = false;
 
     if (!mCanceled)
       mStatus = statusCode;
 
     mListener->OnStopRequest(this, mListenerContext, statusCode);
 
-    mListener = 0;
-    mListenerContext = 0;
+    mListener = nullptr;
+    mListenerContext = nullptr;
 
     if (mLoadGroup)
       mLoadGroup->RemoveRequest(this, nullptr, mStatus);
 
-    mCallbacks = 0;
-    mProgressSink = 0;
+    mCallbacks = nullptr;
+    mProgressSink = nullptr;
   }
 
   if (mIPCOpen)
     PWyciwygChannelChild::Send__delete__(this);
 }
 
 class WyciwygCancelEvent : public ChannelEvent
 {
--- a/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
+++ b/netwerk/protocol/wyciwyg/nsWyciwygChannel.cpp
@@ -567,23 +567,23 @@ nsWyciwygChannel::CloseCacheEntry(nsresu
 
 nsresult
 nsWyciwygChannel::CloseCacheEntryInternal(nsresult reason)
 {
   NS_ASSERTION(IsOnCacheIOThread(), "wrong thread");
 
   if (mCacheEntry) {
     LOG(("nsWyciwygChannel::CloseCacheEntryInternal [this=%p ]", this));
-    mCacheOutputStream = 0;
-    mCacheInputStream = 0;
+    mCacheOutputStream = nullptr;
+    mCacheInputStream = nullptr;
 
     if (NS_FAILED(reason))
       mCacheEntry->AsyncDoom(nullptr); // here we were calling Doom() ...
 
-    mCacheEntry = 0;
+    mCacheEntry = nullptr;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWyciwygChannel::SetSecurityInfo(nsISupports *aSecurityInfo)
 {
   mSecurityInfo = aSecurityInfo;
@@ -751,29 +751,29 @@ nsWyciwygChannel::OnStopRequest(nsIReque
 {
   LOG(("nsWyciwygChannel::OnStopRequest [this=%p request=%x status=%d\n",
       this, request, status));
 
   if (NS_SUCCEEDED(mStatus))
     mStatus = status;
 
   mListener->OnStopRequest(this, mListenerContext, mStatus);
-  mListener = 0;
-  mListenerContext = 0;
+  mListener = nullptr;
+  mListenerContext = nullptr;
 
   if (mLoadGroup)
     mLoadGroup->RemoveRequest(this, nullptr, mStatus);
 
   CloseCacheEntry(mStatus);
-  mPump = 0;
+  mPump = nullptr;
   mIsPending = false;
 
   // Drop notification callbacks to prevent cycles.
-  mCallbacks = 0;
-  mProgressSink = 0;
+  mCallbacks = nullptr;
+  mProgressSink = nullptr;
 
   return NS_OK;
 }
 
 //////////////////////////////////////////////////////////////////////////////
 // Helper functions
 //////////////////////////////////////////////////////////////////////////////
 
@@ -849,18 +849,18 @@ nsWyciwygChannel::WriteCharsetAndSourceT
 }
 
 void
 nsWyciwygChannel::NotifyListener()
 {    
   if (mListener) {
     mListener->OnStartRequest(this, mListenerContext);
     mListener->OnStopRequest(this, mListenerContext, mStatus);
-    mListener = 0;
-    mListenerContext = 0;
+    mListener = nullptr;
+    mListenerContext = nullptr;
   }
 
   mIsPending = false;
 
   // Remove ourselves from the load group.
   if (mLoadGroup) {
     mLoadGroup->RemoveRequest(this, nullptr, mStatus);
   }
--- a/netwerk/streamconv/converters/nsBinHexDecoder.cpp
+++ b/netwerk/streamconv/converters/nsBinHexDecoder.cpp
@@ -269,17 +269,17 @@ nsresult nsBinHexDecoder::ProcessNextSta
         }
 
         /* passed the CRC check!!!*/
         mCRC = 0;
         if (++mState == BINHEX_STATE_FINISH)
         {
           // when we reach the finished state...fire an on stop request on the event listener...
           mNextListener->OnStopRequest(aRequest, aContext, NS_OK);
-          mNextListener = 0;
+          mNextListener = nullptr;
 
           /*   now We are done with everything.  */
           ++mState;
           break;
         }
 
         if (mState == BINHEX_STATE_DFORK)
           mCount = PR_ntohl(mHeader.dlen);
--- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp
+++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
@@ -660,17 +660,17 @@ nsIndexedToHTML::OnStopRequest(nsIReques
     if (NS_SUCCEEDED(aStatus)) {
         nsCString buffer;
         buffer.AssignLiteral("</tbody></table></body></html>\n");
 
         aStatus = SendToListener(request, aContext, buffer);
     }
 
     mParser->OnStopRequest(request, aContext, aStatus);
-    mParser = 0;
+    mParser = nullptr;
     
     return mListener->OnStopRequest(request, aContext, aStatus);
 }
 
 nsresult
 nsIndexedToHTML::SendToListener(nsIRequest* aRequest, nsISupports *aContext, const nsACString &aBuffer)
 {
     nsCOMPtr<nsIInputStream> inputData;
--- a/netwerk/streamconv/converters/nsUnknownDecoder.cpp
+++ b/netwerk/streamconv/converters/nsUnknownDecoder.cpp
@@ -294,17 +294,17 @@ nsUnknownDecoder::OnStopRequest(nsIReque
 
     // now we need to set pending state to false before calling OnStopRequest
     if (forcePendingChannel) {
       forcePendingChannel->ForcePending(false);
     }
   }
 
   rv = mNextListener->OnStopRequest(request, aCtxt, aStatus);
-  mNextListener = 0;
+  mNextListener = nullptr;
 
   return rv;
 }
 
 // ----
 //
 // nsIContentSniffer methods...
 //
--- a/parser/htmlparser/nsParser.cpp
+++ b/parser/htmlparser/nsParser.cpp
@@ -905,17 +905,17 @@ nsParser::DidBuildModel(nsresult anError
         // that responsibility back to the parser. The former behavior of the
         // DTD was to NS_ENSURE_SUCCESS the sink DidBuildModel call, so if the
         // sink returns failure we should use sinkResult instead of dtdResult,
         // to preserve the old error handling behavior of the DTD:
         result = NS_FAILED(sinkResult) ? sinkResult : dtdResult;
       }
 
       //Ref. to bug 61462.
-      mParserContext->mRequest = 0;
+      mParserContext->mRequest = nullptr;
     }
   }
 
   return result;
 }
 
 /**
  * This method adds a new parser context to the list,
--- a/parser/htmlparser/nsScanner.cpp
+++ b/parser/htmlparser/nsScanner.cpp
@@ -62,17 +62,17 @@ nsScanner::nsScanner(const nsAString& an
     mSlidingBuffer->BeginReading(mCurrentPosition);
   } else {
     /* XXX see hack below, re: bug 182067 */
     memset(&mCurrentPosition, 0, sizeof(mCurrentPosition));
     mEndPosition = mCurrentPosition;
   }
   mMarkPosition = mCurrentPosition;
   mIncremental = false;
-  mUnicodeDecoder = 0;
+  mUnicodeDecoder = nullptr;
   mCharsetSource = kCharsetUninitialized;
   mHasInvalidCharacter = false;
   mReplacementCharacter = char16_t(0x0);
 }
 
 /**
  *  Use this constructor if you want i/o to be based on strings 
  *  the scanner receives. If you pass a null filename, you
@@ -94,17 +94,17 @@ nsScanner::nsScanner(nsString& aFilename
   memset(&mCurrentPosition, 0, sizeof(mCurrentPosition));
   mMarkPosition = mCurrentPosition;
   mEndPosition = mCurrentPosition;
 
   mIncremental = true;
   mFirstNonWhitespacePosition = -1;
   mCountRemaining = 0;
 
-  mUnicodeDecoder = 0;
+  mUnicodeDecoder = nullptr;
   mCharsetSource = kCharsetUninitialized;
   mHasInvalidCharacter = false;
   mReplacementCharacter = char16_t(0x0);
   // XML defaults to UTF-8 and about:blank is UTF-8, too.
   SetDocumentCharset(NS_LITERAL_CSTRING("UTF-8"), kCharsetFromDocTypeDefault);
 }
 
 nsresult nsScanner::SetDocumentCharset(const nsACString& aCharset , int32_t aSource)
--- a/security/manager/ssl/nsNSSCertHelper.cpp
+++ b/security/manager/ssl/nsNSSCertHelper.cpp
@@ -1879,17 +1879,17 @@ nsNSSCertificate::CreateTBSCertificateAS
   asn1Objects->AppendElement(validitySequence, false);
   nssComponent->GetPIPNSSBundleString("CertDumpNotBefore", text);
   nsCOMPtr<nsIX509CertValidity> validityData;
   GetValidity(getter_AddRefs(validityData));
   PRTime notBefore, notAfter;
 
   validityData->GetNotBefore(&notBefore);
   validityData->GetNotAfter(&notAfter);
-  validityData = 0;
+  validityData = nullptr;
   rv = ProcessTime(notBefore, text.get(), validitySequence);
   if (NS_FAILED(rv))
     return rv;
 
   nssComponent->GetPIPNSSBundleString("CertDumpNotAfter", text);
   rv = ProcessTime(notAfter, text.get(), validitySequence);
   if (NS_FAILED(rv))
     return rv;
--- a/security/manager/ssl/nsPKCS12Blob.cpp
+++ b/security/manager/ssl/nsPKCS12Blob.cpp
@@ -37,17 +37,17 @@ extern LazyLogModule gPIPNSSLog;
 #define PIP_PKCS12_BACKUP_OK           2
 #define PIP_PKCS12_USER_CANCELED       3
 #define PIP_PKCS12_NOSMARTCARD_EXPORT  4
 #define PIP_PKCS12_RESTORE_FAILED      5
 #define PIP_PKCS12_BACKUP_FAILED       6
 #define PIP_PKCS12_NSS_ERROR           7
 
 // constructor
-nsPKCS12Blob::nsPKCS12Blob():mCertArray(0),
+nsPKCS12Blob::nsPKCS12Blob():mCertArray(nullptr),
                              mTmpFile(nullptr),
                              mTokenSet(false)
 {
   mUIContext = new PipUIContext();
 }
 
 // destructor
 nsPKCS12Blob::~nsPKCS12Blob()
@@ -72,17 +72,17 @@ nsPKCS12Blob::SetToken(nsIPK11Token *tok
  }
  nsresult rv = NS_OK;
  if (token) {
    mToken = token;
  } else {
    PK11SlotInfo *slot;
    rv = GetSlotWithMechanism(CKM_RSA_PKCS, mUIContext, &slot, locker);
    if (NS_FAILED(rv)) {
-      mToken = 0;  
+      mToken = nullptr;
    } else {
      mToken = new nsPK11Token(slot);
      PK11_FreeSlot(slot);
    }
  }
  mTokenSet = true;
  return rv;
 }
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -672,17 +672,17 @@ nsNavHistory::GetNow()
 }
 
 
 void nsNavHistory::expireNowTimerCallback(nsITimer* aTimer, void* aClosure)
 {
   nsNavHistory *history = static_cast<nsNavHistory *>(aClosure);
   if (history) {
     history->mCachedNow = 0;
-    history->mExpireNowTimer = 0;
+    history->mExpireNowTimer = nullptr;
   }
 }
 
 
 /**
  * Code borrowed from mozilla/xpfe/components/history/src/nsGlobalHistory.cpp
  * Pass in a pre-normalized now and a date, and we'll find the difference since
  * midnight on each of the days.
--- a/uriloader/base/nsDocLoader.cpp
+++ b/uriloader/base/nsDocLoader.cpp
@@ -351,17 +351,17 @@ nsDocLoader::Destroy()
   }
 
   // Release all the information about network requests...
   ClearRequestInfoHash();
 
   mListenerInfoList.Clear();
   mListenerInfoList.Compact();
 
-  mDocumentRequest = 0;
+  mDocumentRequest = nullptr;
 
   if (mLoadGroup)
     mLoadGroup->SetGroupObserver(nullptr);
 
   DestroyChildren();
 }
 
 void
@@ -694,17 +694,17 @@ void nsDocLoader::DocLoaderIsEmpty(bool 
       // we don't need it anymore to CalculateMaxProgress().
       ClearInternalProgress();
 
       MOZ_LOG(gDocLoaderLog, LogLevel::Debug,
              ("DocLoader:%p: Is now idle...\n", this));
 
       nsCOMPtr<nsIRequest> docRequest = mDocumentRequest;
 
-      mDocumentRequest = 0;
+      mDocumentRequest = nullptr;
       mIsLoadingDocument = false;
 
       // Update the progress status state - the document is done
       mProgressStateFlags = nsIWebProgressListener::STATE_STOP;
 
 
       nsresult loadGroupStatus = NS_OK;
       mLoadGroup->GetStatus(&loadGroupStatus);
--- a/uriloader/base/nsURILoader.cpp
+++ b/uriloader/base/nsURILoader.cpp
@@ -328,17 +328,17 @@ NS_IMETHODIMP nsDocumentOpenInfo::OnStop
   LOG(("[0x%p] nsDocumentOpenInfo::OnStopRequest", this));
   
   if ( m_targetStreamListener)
   {
     nsCOMPtr<nsIStreamListener> listener(m_targetStreamListener);
 
     // If this is a multipart stream, we could get another
     // OnStartRequest after this... reset state.
-    m_targetStreamListener = 0;
+    m_targetStreamListener = nullptr;
     mContentType.Truncate();
     listener->OnStopRequest(request, aCtxt, aStatus);
   }
 
   // Remember...
   // In the case of multiplexed streams (such as multipart/x-mixed-replace)
   // these stream listener methods could be called again :-)
   //
--- a/uriloader/exthandler/nsExternalProtocolHandler.cpp
+++ b/uriloader/exthandler/nsExternalProtocolHandler.cpp
@@ -178,17 +178,17 @@ nsresult nsExtProtocolChannel::OpenURL()
         // despite success, we need to abort this channel, at the very least 
         // to make it clear to the caller that no on{Start,Stop}Request
         // should be expected.
         rv = NS_ERROR_NO_CONTENT;
     }
   }
 
 finish:
-  mCallbacks = 0;
+  mCallbacks = nullptr;
   return rv;
 }
 
 NS_IMETHODIMP nsExtProtocolChannel::Open(nsIInputStream **_retval)
 {
   return OpenURL();
 }
 
--- a/xpcom/io/nsInputStreamTee.cpp
+++ b/xpcom/io/nsInputStreamTee.cpp
@@ -174,17 +174,17 @@ nsInputStreamTee::TeeSegment(const char*
       uint32_t bytesWritten = 0;
       rv = mSink->Write(aBuf + totalBytesWritten, aCount, &bytesWritten);
       if (NS_FAILED(rv)) {
         // ok, this is not a fatal error... just drop our reference to mSink
         // and continue on as if nothing happened.
         NS_WARNING("Write failed (non-fatal)");
         // catch possible misuse of the input stream tee
         NS_ASSERTION(rv != NS_BASE_STREAM_WOULD_BLOCK, "sink must be a blocking stream");
-        mSink = 0;
+        mSink = nullptr;
         break;
       }
       totalBytesWritten += bytesWritten;
       NS_ASSERTION(bytesWritten <= aCount, "wrote too much");
       aCount -= bytesWritten;
     }
     return NS_OK;
   }
@@ -212,18 +212,18 @@ NS_IMPL_ISUPPORTS(nsInputStreamTee,
                   nsIInputStream)
 NS_IMETHODIMP
 nsInputStreamTee::Close()
 {
   if (NS_WARN_IF(!mSource)) {
     return NS_ERROR_NOT_INITIALIZED;
   }
   nsresult rv = mSource->Close();
-  mSource = 0;
-  mSink = 0;
+  mSource = nullptr;
+  mSink = nullptr;
   return rv;
 }
 
 NS_IMETHODIMP
 nsInputStreamTee::Available(uint64_t* aAvail)
 {
   if (NS_WARN_IF(!mSource)) {
     return NS_ERROR_NOT_INITIALIZED;
--- a/xpcom/io/nsPipe3.cpp
+++ b/xpcom/io/nsPipe3.cpp
@@ -1195,17 +1195,17 @@ nsPipeInputStream::OnInputReadable(uint3
 {
   MonitorAction result = DoNotNotifyMonitor;
 
   mPipe->mReentrantMonitor.AssertCurrentThreadIn();
   mReadState.mAvailable += aBytesWritten;
 
   if (mCallback && !(mCallbackFlags & WAIT_CLOSURE_ONLY)) {
     aEvents.NotifyInputReady(this, mCallback);
-    mCallback = 0;
+    mCallback = nullptr;
     mCallbackFlags = 0;
   } else if (mBlocked) {
     result = NotifyMonitor;
   }
 
   return result;
 }
 
@@ -1224,17 +1224,17 @@ nsPipeInputStream::OnInputException(nsre
     mInputStatus = aReason;
   }
 
   // force count of available bytes to zero.
   mPipe->DrainInputStream(mReadState, aEvents);
 
   if (mCallback) {
     aEvents.NotifyInputReady(this, mCallback);
-    mCallback = 0;
+    mCallback = nullptr;
     mCallbackFlags = 0;
   } else if (mBlocked) {
     result = NotifyMonitor;
   }
 
   return result;
 }
 
@@ -1365,17 +1365,17 @@ nsPipeInputStream::AsyncWait(nsIInputStr
 {
   LOG(("III AsyncWait [this=%x]\n", this));
 
   nsPipeEvents pipeEvents;
   {
     ReentrantMonitorAutoEnter mon(mPipe->mReentrantMonitor);
 
     // replace a pending callback
-    mCallback = 0;
+    mCallback = nullptr;
     mCallbackFlags = 0;
 
     if (!aCallback) {
       return NS_OK;
     }
 
     nsCOMPtr<nsIInputStreamCallback> proxy;
     if (aTarget) {
@@ -1589,17 +1589,17 @@ MonitorAction
 nsPipeOutputStream::OnOutputWritable(nsPipeEvents& aEvents)
 {
   MonitorAction result = DoNotNotifyMonitor;
 
   mWritable = true;
 
   if (mCallback && !(mCallbackFlags & WAIT_CLOSURE_ONLY)) {
     aEvents.NotifyOutputReady(this, mCallback);
-    mCallback = 0;
+    mCallback = nullptr;
     mCallbackFlags = 0;
   } else if (mBlocked) {
     result = NotifyMonitor;
   }
 
   return result;
 }
 
@@ -1611,17 +1611,17 @@ nsPipeOutputStream::OnOutputException(ns
 
   MonitorAction result = DoNotNotifyMonitor;
 
   NS_ASSERTION(NS_FAILED(aReason), "huh? successful exception");
   mWritable = false;
 
   if (mCallback) {
     aEvents.NotifyOutputReady(this, mCallback);
-    mCallback = 0;
+    mCallback = nullptr;
     mCallbackFlags = 0;
   } else if (mBlocked) {
     result = NotifyMonitor;
   }
 
   return result;
 }
 
@@ -1797,17 +1797,17 @@ nsPipeOutputStream::AsyncWait(nsIOutputS
 {
   LOG(("OOO AsyncWait [this=%x]\n", this));
 
   nsPipeEvents pipeEvents;
   {
     ReentrantMonitorAutoEnter mon(mPipe->mReentrantMonitor);
 
     // replace a pending callback
-    mCallback = 0;
+    mCallback = nullptr;
     mCallbackFlags = 0;
 
     if (!aCallback) {
       return NS_OK;
     }
 
     nsCOMPtr<nsIOutputStreamCallback> proxy;
     if (aTarget) {