Bug 626472 part 3 - Remove nsnull for good; r=ehsan
authorAryeh Gregor <ayg@aryeh.name>
Sun, 12 Aug 2012 13:43:47 +0300
changeset 102293 fb2d41f41c15acda67d298774c9e315d9aeb1f16
parent 102292 d9183f015df867977de7d9eef4d23ec51d4a875b
child 102294 16932b47500242c040db2e65fdef1c82aa38def6
child 102323 14afa26b8ac77f45d7ea5d9bf52e52f09d8a13f9
child 102339 d1b05e332e4e8ea05d990ca44054c2cc5246b0e2
child 106693 62cc14fe2c5fd0eaaff6a10772e6b1956a71cc7c
push id1007
push userttaubert@mozilla.com
push dateThu, 16 Aug 2012 18:11:38 +0000
treeherderfx-team@88ba578cbaab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs626472
milestone17.0a1
Bug 626472 part 3 - Remove nsnull for good; r=ehsan
content/canvas/src/WebGLContext.cpp
content/events/src/nsDOMTouchEvent.cpp
content/events/src/nsDOMTouchEvent.h
content/events/src/nsEventDispatcher.cpp
content/media/webrtc/MediaEngineDefault.cpp
docshell/base/SerializedLoadContext.h
dom/base/nsGlobalWindow.cpp
dom/bluetooth/linux/BluetoothDBusService.cpp
dom/devicestorage/nsDeviceStorage.cpp
dom/indexedDB/IndexedDatabaseManager.cpp
dom/ipc/PermissionMessageUtils.h
dom/src/storage/nsDOMStorage.cpp
gfx/2d/QuartzSupport.h
gfx/2d/QuartzSupport.mm
gfx/layers/opengl/TiledThebesLayerOGL.cpp
layout/base/FrameLayerBuilder.cpp
layout/base/nsDisplayList.h
layout/generic/ScrollbarActivity.cpp
layout/generic/nsColumnSetFrame.cpp
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsTextFrameThebes.cpp
toolkit/components/osfile/osfileutils.cpp
uriloader/prefetch/nsPrefetchService.cpp
xpcom/base/nscore.h
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -663,18 +663,18 @@ void WebGLContext::LoseOldestWebGLContex
     }
 
     // note that here by "context" we mean "non-lost context". See the check for
     // IsContextLost() below. Indeed, the point of this function is to maybe lose
     // some currently non-lost context.
 
     uint64_t oldestIndex = UINT64_MAX;
     uint64_t oldestIndexThisPrincipal = UINT64_MAX;
-    const WebGLContext *oldestContext = nsnull;
-    const WebGLContext *oldestContextThisPrincipal = nsnull;
+    const WebGLContext *oldestContext = nullptr;
+    const WebGLContext *oldestContextThisPrincipal = nullptr;
     size_t numContexts = 0;
     size_t numContextsThisPrincipal = 0;
 
     for(size_t i = 0; i < contexts.Length(); ++i) {
 
         // don't want to lose ourselves.
         if (contexts[i] == this)
             continue;
--- a/content/events/src/nsDOMTouchEvent.cpp
+++ b/content/events/src/nsDOMTouchEvent.cpp
@@ -158,17 +158,17 @@ nsDOMTouchList::GetLength(PRUint32* aLen
 {
   *aLength = mPoints.Length();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMTouchList::Item(PRUint32 aIndex, nsIDOMTouch** aRetVal)
 {
-  NS_IF_ADDREF(*aRetVal = mPoints.SafeElementAt(aIndex, nsnull));
+  NS_IF_ADDREF(*aRetVal = mPoints.SafeElementAt(aIndex, nullptr));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMTouchList::IdentifiedTouch(PRInt32 aIdentifier, nsIDOMTouch** aRetVal)
 {
   *aRetVal = nullptr;
   for (PRUint32 i = 0; i < mPoints.Length(); ++i) {
--- a/content/events/src/nsDOMTouchEvent.h
+++ b/content/events/src/nsDOMTouchEvent.h
@@ -109,17 +109,17 @@ public:
 
   void Append(nsIDOMTouch* aPoint)
   {
     mPoints.AppendElement(aPoint);
   }
 
   nsIDOMTouch* GetItemAt(PRUint32 aIndex)
   {
-    return mPoints.SafeElementAt(aIndex, nsnull);
+    return mPoints.SafeElementAt(aIndex, nullptr);
   }
 
 protected:
   nsTArray<nsCOMPtr<nsIDOMTouch> > mPoints;
 };
 
 class nsDOMTouchEvent : public nsDOMUIEvent,
                         public nsIDOMTouchEvent
--- a/content/events/src/nsEventDispatcher.cpp
+++ b/content/events/src/nsEventDispatcher.cpp
@@ -864,14 +864,14 @@ nsEventDispatcher::CreateEvent(nsPresCon
     return NS_NewDOMTouchEvent(aDOMEvent, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("hashchangeevent"))
     return NS_NewDOMHashChangeEvent(aDOMEvent, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("customevent"))
     return NS_NewDOMCustomEvent(aDOMEvent, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("mozsmsevent"))
     return NS_NewDOMSmsEvent(aDOMEvent, aPresContext, nullptr);
   if (aEventType.LowerCaseEqualsLiteral("storageevent")) {
-    return NS_NewDOMStorageEvent(aDOMEvent, aPresContext, nsnull);
+    return NS_NewDOMStorageEvent(aDOMEvent, aPresContext, nullptr);
   }
     
 
   return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
 }
--- a/content/media/webrtc/MediaEngineDefault.cpp
+++ b/content/media/webrtc/MediaEngineDefault.cpp
@@ -22,17 +22,17 @@
 namespace mozilla {
 
 NS_IMPL_THREADSAFE_ISUPPORTS1(MediaEngineDefaultVideoSource, nsITimerCallback)
 /**
  * Default video source.
  */
 
 MediaEngineDefaultVideoSource::MediaEngineDefaultVideoSource()
-  : mTimer(nsnull), mState(kReleased)
+  : mTimer(nullptr), mState(kReleased)
 {}
 
 MediaEngineDefaultVideoSource::~MediaEngineDefaultVideoSource()
 {}
 
 void
 MediaEngineDefaultVideoSource::GetName(nsAString& aName)
 {
--- a/docshell/base/SerializedLoadContext.h
+++ b/docshell/base/SerializedLoadContext.h
@@ -23,17 +23,17 @@ class nsIWebSocketChannel;
 
 namespace IPC {
 
 class SerializedLoadContext
 {
 public:
   SerializedLoadContext()
   {
-    Init(nsnull);
+    Init(nullptr);
   }
 
   SerializedLoadContext(nsILoadContext* aLoadContext);
   SerializedLoadContext(nsIChannel* aChannel);
   SerializedLoadContext(nsIWebSocketChannel* aChannel);
 
   void Init(nsILoadContext* aLoadContext);
 
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -9054,17 +9054,17 @@ nsGlobalWindow::CloneStorageEvent(const 
   domEvent->GetCancelable(&cancelable);
 
   aEvent->GetKey(key);
   aEvent->GetOldValue(oldValue);
   aEvent->GetNewValue(newValue);
   aEvent->GetUrl(url);
   aEvent->GetStorageArea(getter_AddRefs(storageArea));
 
-  NS_NewDOMStorageEvent(getter_AddRefs(domEvent), nsnull, nsnull);
+  NS_NewDOMStorageEvent(getter_AddRefs(domEvent), nullptr, nullptr);
   aEvent = do_QueryInterface(domEvent);
   return aEvent->InitStorageEvent(aType, canBubble, cancelable,
                                   key, oldValue, newValue,
                                   url, storageArea);
 }
 
 nsresult
 nsGlobalWindow::FireDelayedDOMEvents()
--- a/dom/bluetooth/linux/BluetoothDBusService.cpp
+++ b/dom/bluetooth/linux/BluetoothDBusService.cpp
@@ -238,17 +238,17 @@ RunDBusCallback(DBusMessage* aMsg, void*
   MOZ_ASSERT(!NS_IsMainThread());
   nsRefPtr<BluetoothReplyRunnable> replyRunnable =
     dont_AddRef(static_cast< BluetoothReplyRunnable* >(aBluetoothReplyRunnable));
 
   NS_ASSERTION(replyRunnable, "Callback reply runnable is null!");
 
   nsString replyError;
   BluetoothValue v;
-  aFunc(aMsg, nsnull, v, replyError);
+  aFunc(aMsg, nullptr, v, replyError);
   DispatchBluetoothReply(replyRunnable, v, replyError);  
 }
 
 void
 GetObjectPathCallback(DBusMessage* aMsg, void* aBluetoothReplyRunnable)
 {
   RunDBusCallback(aMsg, aBluetoothReplyRunnable,
                   UnpackObjectPathMessage);
--- a/dom/devicestorage/nsDeviceStorage.cpp
+++ b/dom/devicestorage/nsDeviceStorage.cpp
@@ -842,17 +842,17 @@ public:
 
     nsRefPtr<nsIDOMDeviceStorageStat> domstat = new nsDOMDeviceStorageStat(mFreeBytes, mTotalBytes);
 
     jsval result = InterfaceToJsval(mRequest->GetOwner(),
 				    domstat,
 				    &NS_GET_IID(nsIDOMDeviceStorageStat));
 
     mRequest->FireSuccess(result);
-    mRequest = nsnull;
+    mRequest = nullptr;
     return NS_OK;
   }
 
 private:
   PRInt64 mFreeBytes, mTotalBytes;
   nsRefPtr<DOMRequest> mRequest;
 };
 
--- a/dom/indexedDB/IndexedDatabaseManager.cpp
+++ b/dom/indexedDB/IndexedDatabaseManager.cpp
@@ -784,17 +784,17 @@ IndexedDatabaseManager::EnsureOriginIsIn
   // Now tell SQLite to start tracking this pattern for content.
   nsCOMPtr<mozIStorageServiceQuotaManagement> ss =
     do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID);
   NS_ENSURE_TRUE(ss, NS_ERROR_FAILURE);
 
   if (aPrivilege != Chrome) {
     rv = ss->SetQuotaForFilenamePattern(pattern,
                                         GetIndexedDBQuotaMB() * 1024 * 1024,
-                                        mQuotaCallbackSingleton, nsnull);
+                                        mQuotaCallbackSingleton, nullptr);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   // We need to see if there are any files in the directory already. If they
   // are database files then we need to create file managers for them and also
   // tell SQLite about all of them.
 
   nsAutoTArray<nsString, 20> subdirsToProcess;
--- a/dom/ipc/PermissionMessageUtils.h
+++ b/dom/ipc/PermissionMessageUtils.h
@@ -11,17 +11,17 @@
 #include "nsIPrincipal.h"
 
 namespace IPC {
 
 class Principal {
   friend struct ParamTraits<Principal>;
 
 public:
-  Principal() : mPrincipal(nsnull) {}
+  Principal() : mPrincipal(nullptr) {}
   Principal(nsIPrincipal* aPrincipal) : mPrincipal(aPrincipal) {}
   operator nsIPrincipal*() const { return mPrincipal.get(); }
 
 private:
   // Unimplemented
   Principal& operator=(Principal&);
   nsCOMPtr<nsIPrincipal> mPrincipal;
 };
--- a/dom/src/storage/nsDOMStorage.cpp
+++ b/dom/src/storage/nsDOMStorage.cpp
@@ -1890,17 +1890,17 @@ StorageNotifierRunnable::Run()
 
 void
 nsDOMStorage2::BroadcastChangeNotification(const nsSubstring &aKey,
                                            const nsSubstring &aOldValue,
                                            const nsSubstring &aNewValue)
 {
   nsresult rv;
   nsCOMPtr<nsIDOMEvent> domEvent;
-  NS_NewDOMStorageEvent(getter_AddRefs(domEvent), nsnull, nsnull);
+  NS_NewDOMStorageEvent(getter_AddRefs(domEvent), nullptr, nullptr);
   nsCOMPtr<nsIDOMStorageEvent> event = do_QueryInterface(domEvent);
   rv = event->InitStorageEvent(NS_LITERAL_STRING("storage"),
                                false,
                                false,
                                aKey,
                                aOldValue,
                                aNewValue,
                                mDocumentURI,
--- a/gfx/2d/QuartzSupport.h
+++ b/gfx/2d/QuartzSupport.h
@@ -20,26 +20,26 @@ CGColorSpaceRef THEBES_API CreateSystemC
 // Manages a CARenderer
 struct _CGLPBufferObject;
 struct _CGLContextObject;
 
 enum AllowOfflineRendererEnum { ALLOW_OFFLINE_RENDERER, DISALLOW_OFFLINE_RENDERER };
 
 class nsCARenderer : public mozilla::RefCounted<nsCARenderer> {
 public:
-  nsCARenderer() : mCARenderer(nsnull), mFBOTexture(0), mOpenGLContext(nsnull),
-                   mCGImage(nsnull), mCGData(nsnull), mIOSurface(nsnull), mFBO(0),
+  nsCARenderer() : mCARenderer(nullptr), mFBOTexture(0), mOpenGLContext(nullptr),
+                   mCGImage(nullptr), mCGData(nullptr), mIOSurface(nullptr), mFBO(0),
                    mIOTexture(0),
                    mUnsupportedWidth(UINT32_MAX), mUnsupportedHeight(UINT32_MAX),
                    mAllowOfflineRenderer(DISALLOW_OFFLINE_RENDERER) {}
   ~nsCARenderer();
   nsresult SetupRenderer(void* aCALayer, int aWidth, int aHeight,
                          AllowOfflineRendererEnum aAllowOfflineRenderer);
   nsresult Render(int aWidth, int aHeight, CGImageRef *aOutCAImage);
-  bool isInit() { return mCARenderer != nsnull; }
+  bool isInit() { return mCARenderer != nullptr; }
   /*
    * Render the CALayer to an IOSurface. If no IOSurface
    * is attached then an internal pixel buffer will be
    * used.
    */
   void AttachIOSurface(mozilla::RefPtr<MacIOSurface> aSurface);
   IOSurfaceID GetIOSurfaceID();
   static nsresult DrawSurfaceToCGContext(CGContextRef aContext,
--- a/gfx/2d/QuartzSupport.mm
+++ b/gfx/2d/QuartzSupport.mm
@@ -246,19 +246,19 @@ void MacIOSurfaceLib::LoadLibrary() {
                             RTLD_LAZY | RTLD_LOCAL);
   if (!sIOSurfaceFramework || !sOpenGLFramework || !sCoreGraphicsFramework) {
     if (sIOSurfaceFramework)
       dlclose(sIOSurfaceFramework);
     if (sOpenGLFramework)
       dlclose(sOpenGLFramework);
     if (sCoreGraphicsFramework)
       dlclose(sCoreGraphicsFramework);
-    sIOSurfaceFramework = nsnull;
-    sOpenGLFramework = nsnull;
-    sCoreGraphicsFramework = nsnull;
+    sIOSurfaceFramework = nullptr;
+    sOpenGLFramework = nullptr;
+    sCoreGraphicsFramework = nullptr;
     return;
   }
 
   kPropWidth = GetIOConst("kIOSurfaceWidth");
   kPropHeight = GetIOConst("kIOSurfaceHeight");
   kPropBytesPerElem = GetIOConst("kIOSurfaceBytesPerElement");
   kPropBytesPerRow = GetIOConst("kIOSurfaceBytesPerRow");
   kPropIsGlobal = GetIOConst("kIOSurfaceIsGlobal");
@@ -969,36 +969,36 @@ void nsCARenderer::SaveToDisk(MacIOSurfa
   return;
 
 }
 
 #endif
 
 CGImageRef MacIOSurface::CreateImageFromIOSurfaceContext(CGContextRef aContext) {
   if (!MacIOSurfaceLib::isInit())
-    return nsnull;
+    return nullptr;
 
   return MacIOSurfaceLib::IOSurfaceContextCreateImage(aContext);
 }
 
 TemporaryRef<MacIOSurface> MacIOSurface::IOSurfaceContextGetSurface(CGContextRef aContext) {
   if (!MacIOSurfaceLib::isInit())
-    return nsnull;
+    return nullptr;
 
   IOSurfacePtr surfaceRef = MacIOSurfaceLib::IOSurfaceContextGetSurface(aContext);
   if (!surfaceRef)
-    return nsnull;
+    return nullptr;
 
   // Retain the IOSurface because MacIOSurface will release it
   CFRetain(surfaceRef);
 
   RefPtr<MacIOSurface> ioSurface = new MacIOSurface(surfaceRef);
   if (!ioSurface) {
     ::CFRelease(surfaceRef);
-    return nsnull;
+    return nullptr;
   }
   return ioSurface.forget();
 }
 
 
 CGContextType GetContextType(CGContextRef ref)
 {
   if (!MacIOSurfaceLib::isInit() || !MacIOSurfaceLib::sCGContextGetTypePtr)
--- a/gfx/layers/opengl/TiledThebesLayerOGL.cpp
+++ b/gfx/layers/opengl/TiledThebesLayerOGL.cpp
@@ -110,17 +110,17 @@ TiledLayerBufferOGL::ValidateTile(TiledT
 #endif
   return aTile;
 }
 
 TiledThebesLayerOGL::TiledThebesLayerOGL(LayerManagerOGL *aManager)
   : ShadowThebesLayer(aManager, nullptr)
   , LayerOGL(aManager)
   , mVideoMemoryTiledBuffer(aManager->gl())
-  , mReusableTileStore(nsnull)
+  , mReusableTileStore(nullptr)
 {
   mImplData = static_cast<LayerOGL*>(this);
 }
 
 TiledThebesLayerOGL::~TiledThebesLayerOGL()
 {
   mMainMemoryTiledBuffer.ReadUnlock();
   if (mReusableTileStore)
@@ -144,17 +144,17 @@ TiledThebesLayerOGL::ProcessUploadQueue(
   if (mRegionToUpload.IsEmpty())
     return;
 
   // We should only be retaining old tiles if we're not fixed position.
   // Fixed position layers don't/shouldn't move on the screen, so retaining
   // tiles is not useful and often results in rendering artifacts.
   if (mReusableTileStore && mIsFixedPosition) {
     delete mReusableTileStore;
-    mReusableTileStore = nsnull;
+    mReusableTileStore = nullptr;
   } else if (!mReusableTileStore && !mIsFixedPosition) {
     // XXX Add a pref for reusable tile store size
     mReusableTileStore = new ReusableTileStoreOGL(gl(), 1);
   }
 
   gfxSize resolution(1, 1);
   if (mReusableTileStore) {
     // Work out render resolution by multiplying the resolution of our ancestors.
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -2220,17 +2220,17 @@ FrameLayerBuilder::RestoreThebesLayerIte
   return PL_DHASH_NEXT;
 }
 
 static nsDisplayTransform* FindTransformForContainerFrame(nsIFrame* aContainerFrame,
                                                           nsDisplayItem* aContainerItem)
 {
   if (!aContainerFrame->IsTransformed() ||
       aContainerItem->GetType() == nsDisplayItem::TYPE_TRANSFORM)
-    return nsnull;
+    return nullptr;
 
   nsTArray<nsDisplayItem*> queue;
   queue.AppendElement(aContainerItem);
   while (queue.Length()) {
     nsDisplayItem* item = queue[queue.Length() - 1];
     queue.RemoveElementAt(queue.Length() - 1);
 
     if (item->GetType() == nsDisplayItem::TYPE_TRANSFORM) {
@@ -2242,17 +2242,17 @@ static nsDisplayTransform* FindTransform
            child = child->GetAbove()) {
         if (child->GetUnderlyingFrame() == aContainerFrame) {
           queue.AppendElement(child);
         }
       }
     }
   }
 
-  return nsnull;
+  return nullptr;
 }
 
 already_AddRefed<ContainerLayer>
 FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder,
                                           LayerManager* aManager,
                                           nsIFrame* aContainerFrame,
                                           nsDisplayItem* aContainerItem,
                                           const nsDisplayList& aChildren,
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -2428,17 +2428,17 @@ private:
  * The default value for both edges is zero, which means everything is painted.
  */
 class nsCharClipDisplayItem : public nsDisplayItem {
 public:
   nsCharClipDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
     : nsDisplayItem(aBuilder, aFrame), mLeftEdge(0), mRightEdge(0) {}
 
   nsCharClipDisplayItem(nsIFrame* aFrame)
-    : nsDisplayItem(nsnull, aFrame, nsPoint()) {}
+    : nsDisplayItem(nullptr, aFrame, nsPoint()) {}
 
   struct ClipEdges {
     ClipEdges(const nsDisplayItem& aItem,
               nscoord aLeftEdge, nscoord aRightEdge) {
       nsRect r = aItem.GetUnderlyingFrame()->GetScrollableOverflowRect() +
                  aItem.ToReferenceFrame();
       mX = aLeftEdge > 0 ? r.x + aLeftEdge : nscoord_MIN;
       mXMost = aRightEdge > 0 ? NS_MAX(r.XMost() - aRightEdge, mX) : nscoord_MAX;
--- a/layout/generic/ScrollbarActivity.cpp
+++ b/layout/generic/ScrollbarActivity.cpp
@@ -67,22 +67,22 @@ ScrollbarActivity::StartActivityFinished
                                             nsITimer::TYPE_ONE_SHOT);
 }
 
 void
 ScrollbarActivity::CancelActivityFinishedTimer()
 {
   if (mActivityFinishedTimer) {
     mActivityFinishedTimer->Cancel();
-    mActivityFinishedTimer = nsnull;
+    mActivityFinishedTimer = nullptr;
   }
 }
 
 nsIContent*
 ScrollbarActivity::GetScrollbarContent(bool aVertical)
 {
   nsIFrame* box = mScrollableFrame->GetScrollbarBox(aVertical);
-  return box ? box->GetContent() : nsnull;
+  return box ? box->GetContent() : nullptr;
 
-  return nsnull;
+  return nullptr;
 }
 
 } // namespace mozilla
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -758,17 +758,17 @@ nsColumnSetFrame::ReflowChildren(nsHTMLR
           aStatus |= NS_FRAME_REFLOW_NEXTINFLOW;
           kidNextInFlow->AddStateBits(NS_FRAME_IS_DIRTY);
           // Move any of our leftover columns to our overflow list. Our
           // next-in-flow will eventually pick them up.
           const nsFrameList& continuationColumns = mFrames.RemoveFramesAfter(child);
           if (continuationColumns.NotEmpty()) {
             SetOverflowFrames(PresContext(), continuationColumns);
           }
-          child = nsnull;
+          child = nullptr;
           break;
         } else if (contentBottom > aReflowState.mComputedMaxHeight ||
                    contentBottom > aReflowState.ComputedHeight()) {
           aColData.mShouldRevertToAuto = true;
         } else {
           // The number of columns required is too high.
           allFit = false;
         }
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -477,28 +477,28 @@ nsHTMLScrollFrame::ReflowScrolledFrame(S
   if (!ShouldPropagateComputedHeightToScrolledContent()) {
     computedHeight = NS_UNCONSTRAINEDSIZE;
     computedMinHeight = 0;
     computedMaxHeight = NS_UNCONSTRAINEDSIZE;
   }
   if (aAssumeHScroll) {
     nsSize hScrollbarPrefSize;
     GetScrollbarMetrics(aState->mBoxState, mInner.mHScrollbarBox,
-                        nsnull, &hScrollbarPrefSize, false);
+                        nullptr, &hScrollbarPrefSize, false);
     if (computedHeight != NS_UNCONSTRAINEDSIZE)
       computedHeight = NS_MAX(0, computedHeight - hScrollbarPrefSize.height);
     computedMinHeight = NS_MAX(0, computedMinHeight - hScrollbarPrefSize.height);
     if (computedMaxHeight != NS_UNCONSTRAINEDSIZE)
       computedMaxHeight = NS_MAX(0, computedMaxHeight - hScrollbarPrefSize.height);
   }
 
   if (aAssumeVScroll) {
     nsSize vScrollbarPrefSize;
     GetScrollbarMetrics(aState->mBoxState, mInner.mVScrollbarBox,
-                        nsnull, &vScrollbarPrefSize, true);
+                        nullptr, &vScrollbarPrefSize, true);
     availWidth = NS_MAX(0, availWidth - vScrollbarPrefSize.width);
   }
 
   nsPresContext* presContext = PresContext();
 
   // Pass false for aInit so we can pass in the correct padding.
   nsHTMLReflowState kidReflowState(presContext, aState->mReflowState,
                                    mInner.mScrolledFrame,
@@ -2912,17 +2912,17 @@ nsGfxScrollFrameInner::AppendAnonymousCo
   aElements.MaybeAppendElement(mScrollCornerContent);
   aElements.MaybeAppendElement(mResizerContent);
 }
 
 void
 nsGfxScrollFrameInner::Destroy()
 {
   if (mScrollbarActivity) {
-    mScrollbarActivity = nsnull;
+    mScrollbarActivity = nullptr;
   }
 
   // Unbind any content created in CreateAnonymousContent from the tree
   nsContentUtils::DestroyAnonymousContent(&mHScrollbarContent);
   nsContentUtils::DestroyAnonymousContent(&mVScrollbarContent);
   nsContentUtils::DestroyAnonymousContent(&mScrollCornerContent);
   nsContentUtils::DestroyAnonymousContent(&mResizerContent);
 
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -1469,29 +1469,29 @@ HasTerminalNewline(const nsTextFrame* aF
 {
   if (aFrame->GetContentLength() == 0)
     return false;
   const nsTextFragment* frag = aFrame->GetContent()->GetText();
   return frag->CharAt(aFrame->GetContentEnd() - 1) == '\n';
 }
 
 static nscoord
-LetterSpacing(nsIFrame* aFrame, const nsStyleText* aStyleText = nsnull)
+LetterSpacing(nsIFrame* aFrame, const nsStyleText* aStyleText = nullptr)
 {
   if (aFrame->IsSVGText()) {
     return 0;
   }
   if (!aStyleText) {
     aStyleText = aFrame->GetStyleText();
   }
   return StyleToCoord(aStyleText->mLetterSpacing);
 }
 
 static nscoord
-WordSpacing(nsIFrame* aFrame, const nsStyleText* aStyleText = nsnull)
+WordSpacing(nsIFrame* aFrame, const nsStyleText* aStyleText = nullptr)
 {
   if (aFrame->IsSVGText()) {
     return 0;
   }
   if (!aStyleText) {
     aStyleText = aFrame->GetStyleText();
   }
   return aStyleText->mWordSpacing;
--- a/toolkit/components/osfile/osfileutils.cpp
+++ b/toolkit/components/osfile/osfileutils.cpp
@@ -90,105 +90,105 @@ MOZ_EXPORT_API(PRUnichar*) osfile_wstrdu
 
 MOZ_EXPORT_API(PRUnichar*) osfile_DecodeAll(
    const char* aEncoding,
    const char* aSource,
    const int32_t aBytesToDecode)
 {
   if (!aEncoding || !aSource) {
     error_invalid_argument();
-    return nsnull;
+    return nullptr;
   }
 
   nsresult rv;
   nsCOMPtr<nsICharsetConverterManager> manager =
     do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
   if (NS_FAILED(rv)) {
     error_not_supported();
-    return nsnull;
+    return nullptr;
   }
 
   nsCOMPtr<nsIUnicodeDecoder> decoder;
   rv = manager->GetUnicodeDecoder(aEncoding, getter_AddRefs(decoder));
   if (NS_FAILED(rv)) {
     error_invalid_argument();
-    return nsnull;
+    return nullptr;
   }
 
   // Compute an upper bound to the number of chars, allocate buffer
 
   int32_t srcBytes = aBytesToDecode;
   int32_t upperBoundChars = 0;
   rv = decoder->GetMaxLength(aSource, srcBytes, &upperBoundChars);
   MOZ_ASSERT(NS_SUCCEEDED(rv));
 
   int32_t bufSize = (upperBoundChars + 1) * sizeof (PRUnichar);
 
   mozilla::ScopedFreePtr<PRUnichar> dest((PRUnichar*)NS_Alloc(bufSize));
-  if (dest.get() == nsnull) {
+  if (dest.get() == nullptr) {
     error_no_memory();
-    return nsnull;
+    return nullptr;
   }
 
   // Convert, add trailing \0
 
   rv = decoder->Convert(aSource, &srcBytes, dest.rwget(), &upperBoundChars);
   if (NS_FAILED(rv)) {
     error_invalid_argument();
-    return nsnull;
+    return nullptr;
   }
 
   dest.rwget()[upperBoundChars] = '\0';
 
   return dest.forget();
 }
 
 MOZ_EXPORT_API(char*) osfile_EncodeAll(
    const char* aEncoding,
    const PRUnichar* aSource,
    int32_t* aBytesProduced)
 {
   if (!aEncoding || !aSource || !aBytesProduced) {
     error_invalid_argument();
-    return nsnull;
+    return nullptr;
   }
 
   nsresult rv;
   nsCOMPtr<nsICharsetConverterManager> manager =
     do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
   if (NS_FAILED(rv)) {
     error_not_supported();
-    return nsnull;
+    return nullptr;
   }
 
   nsCOMPtr<nsIUnicodeEncoder> encoder;
   rv = manager->GetUnicodeEncoder(aEncoding, getter_AddRefs(encoder));
   if (NS_FAILED(rv)) {
     error_invalid_argument();
-    return nsnull;
+    return nullptr;
   }
 
   int32_t srcChars = NS_strlen(aSource);
 
   int32_t upperBoundBytes = 0;
   rv = encoder->GetMaxLength(aSource, srcChars, &upperBoundBytes);
   MOZ_ASSERT(NS_SUCCEEDED(rv));
 
   printf_stderr("Encoding %d chars into at up to %d bytes\n", srcChars, upperBoundBytes);
   int32_t bufSize = upperBoundBytes;
   mozilla::ScopedFreePtr<char> dest((char*)NS_Alloc(bufSize));
 
-  if (dest.get() == nsnull) {
+  if (dest.get() == nullptr) {
     error_no_memory();
-    return nsnull;
+    return nullptr;
   }
 
   rv = encoder->Convert(aSource, &srcChars, dest.rwget(), &upperBoundBytes);
   if (NS_FAILED(rv)) {
     error_invalid_argument();
-    return nsnull;
+    return nullptr;
   }
 
   *aBytesProduced = upperBoundBytes;
   return dest.forget();
 }
 
 } // extern "C"
--- a/uriloader/prefetch/nsPrefetchService.cpp
+++ b/uriloader/prefetch/nsPrefetchService.cpp
@@ -381,17 +381,17 @@ nsPrefetchNode::AsyncOnChannelRedirect(n
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsPrefetchNode::OnRedirectResult(bool proceeding)
 {
     if (proceeding && mRedirectChannel)
         mChannel = mRedirectChannel;
 
-    mRedirectChannel = nsnull;
+    mRedirectChannel = nullptr;
 
     return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 // nsPrefetchService <public>
 //-----------------------------------------------------------------------------
 
--- a/xpcom/base/nscore.h
+++ b/xpcom/base/nscore.h
@@ -335,18 +335,16 @@ typedef PRUint32 nsrefcnt;
 # define nullptr __null
 #elif defined(_WIN64)
 # define nullptr 0LL
 #else
 # define nullptr 0L
 #endif
 #endif /* defined(HAVE_NULLPTR) */
 
-#define nsnull nullptr
-
 #include "nsError.h"
 
 /* ------------------------------------------------------------------------ */
 /* Casting macros for hiding C++ features from older compilers */
 
   /* under VC++ (Windows), we don't have autoconf yet */
 #if defined(_MSC_VER)
   #define HAVE_CPP_2BYTE_WCHAR_T