Bug 784739 - Switch from NULL to nullptr in xpcom/ (1/3); r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Thu, 10 Oct 2013 16:41:00 -0400
changeset 164212 ec55161f805947fe5c0d2d29fa02fe427eac89c4
parent 164211 fc9733225130f30dde5e197bc4885722c9401ad1
child 164213 20f2a3e61f370b7374d78c7c03f4420f92f12756
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs784739
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 784739 - Switch from NULL to nullptr in xpcom/ (1/3); r=ehsan
xpcom/base/ClearOnShutdown.h
xpcom/base/CycleCollectedJSRuntime.cpp
xpcom/base/nsAutoRef.h
xpcom/base/nsConsoleService.cpp
xpcom/base/nsCycleCollector.cpp
xpcom/base/nsDebugImpl.cpp
xpcom/base/nsDebugImpl.h
xpcom/base/nsGZFileWriter.cpp
xpcom/base/nsISupportsObsolete.h
xpcom/base/nsMacUtilsImpl.cpp
xpcom/base/nsMemoryInfoDumper.cpp
xpcom/base/nsMemoryReporterManager.cpp
xpcom/base/nsObjCExceptions.h
xpcom/base/nsSetDllDirectory.h
xpcom/base/nsStackWalk.cpp
xpcom/base/nsStackWalk.h
xpcom/base/nsTraceRefcntImpl.cpp
xpcom/base/nsWindowsHelpers.h
xpcom/build/BinaryPath.h
xpcom/build/FileLocation.cpp
xpcom/build/FileLocation.h
xpcom/build/FrozenFunctions.cpp
xpcom/build/mach_override.h
xpcom/build/mozPoisonWriteBase.cpp
xpcom/build/mozPoisonWriteMac.cpp
xpcom/build/nsXPComInit.cpp
xpcom/build/perfprobe.cpp
xpcom/components/ManifestParser.cpp
xpcom/components/Module.h
xpcom/components/ModuleUtils.h
xpcom/components/nsCategoryManager.cpp
xpcom/components/nsCategoryManager.h
xpcom/components/nsComponentManager.h
xpcom/components/nsNativeComponentLoader.cpp
xpcom/components/nsNativeComponentLoader.h
xpcom/ds/TimeStamp_darwin.cpp
xpcom/ds/TimeStamp_posix.cpp
xpcom/ds/nsCRT.cpp
xpcom/ds/nsCRT.h
xpcom/ds/nsHashtable.cpp
xpcom/ds/nsHashtable.h
xpcom/ds/nsSupportsArray.cpp
xpcom/ds/nsWindowsRegKey.cpp
--- a/xpcom/base/ClearOnShutdown.h
+++ b/xpcom/base/ClearOnShutdown.h
@@ -51,17 +51,17 @@ class PointerClearer : public ShutdownOb
 public:
   PointerClearer(SmartPtr *aPtr)
     : mPtr(aPtr)
   {}
 
   virtual void Shutdown()
   {
     if (mPtr) {
-      *mPtr = NULL;
+      *mPtr = nullptr;
     }
   }
 
 private:
   SmartPtr *mPtr;
 };
 
 extern bool sHasShutDown;
--- a/xpcom/base/CycleCollectedJSRuntime.cpp
+++ b/xpcom/base/CycleCollectedJSRuntime.cpp
@@ -483,17 +483,17 @@ CycleCollectedJSRuntime::~CycleCollected
   DestroyRuntime();
 }
 
 size_t
 CycleCollectedJSRuntime::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
 {
   size_t n = 0;
 
-  // NULL for the second arg;  we're not measuring anything hanging off the
+  // nullptr for the second arg;  we're not measuring anything hanging off the
   // entries in mJSHolders.
   n += mJSHolders.SizeOfExcludingThis(nullptr, aMallocSizeOf);
 
   return n;
 }
 
 static PLDHashOperator
 UnmarkJSHolder(void* holder, nsScriptObjectTracer*& tracer, void* arg)
--- a/xpcom/base/nsAutoRef.h
+++ b/xpcom/base/nsAutoRef.h
@@ -461,17 +461,17 @@ template <class T> class nsAutoRefTraits
  */
 
 template <class T>
 class nsPointerRefTraits
 {
 public:
     // The handle is a pointer to T.
     typedef T* RawRef;
-    // A NULL pointer does not have a resource.
+    // A nullptr does not have a resource.
     static RawRef Void() { return nullptr; }
 };
 
 /**
  * template <class T> class nsSimpleRef
  *
  * Constructs a non-smart reference, and provides methods to test whether
  * there is an associated resource and (if so) get its raw handle.
--- a/xpcom/base/nsConsoleService.cpp
+++ b/xpcom/base/nsConsoleService.cpp
@@ -28,17 +28,17 @@
 #ifdef XP_WIN
 #include <windows.h>
 #endif
 
 using namespace mozilla;
 
 NS_IMPL_ADDREF(nsConsoleService)
 NS_IMPL_RELEASE(nsConsoleService)
-NS_IMPL_CLASSINFO(nsConsoleService, NULL, nsIClassInfo::THREADSAFE | nsIClassInfo::SINGLETON, NS_CONSOLESERVICE_CID)
+NS_IMPL_CLASSINFO(nsConsoleService, nullptr, nsIClassInfo::THREADSAFE | nsIClassInfo::SINGLETON, NS_CONSOLESERVICE_CID)
 NS_IMPL_QUERY_INTERFACE1_CI(nsConsoleService, nsIConsoleService)
 NS_IMPL_CI_INTERFACE_GETTER1(nsConsoleService, nsIConsoleService)
 
 static bool sLoggingEnabled = true;
 static bool sLoggingBuffered = true;
 
 nsConsoleService::nsConsoleService()
     : mMessages(nullptr)
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -169,19 +169,19 @@ CC_AbortIfNull(void *ptr)
 
 struct nsCycleCollectorParams
 {
     bool mLogAll;
     bool mLogShutdown;
     bool mAllTracesAtShutdown;
 
     nsCycleCollectorParams() :
-        mLogAll      (PR_GetEnv("XPCOM_CC_LOG_ALL") != NULL),
-        mLogShutdown (PR_GetEnv("XPCOM_CC_LOG_SHUTDOWN") != NULL),
-        mAllTracesAtShutdown (PR_GetEnv("XPCOM_CC_ALL_TRACES_AT_SHUTDOWN") != NULL)
+        mLogAll      (PR_GetEnv("XPCOM_CC_LOG_ALL") != nullptr),
+        mLogShutdown (PR_GetEnv("XPCOM_CC_LOG_SHUTDOWN") != nullptr),
+        mAllTracesAtShutdown (PR_GetEnv("XPCOM_CC_ALL_TRACES_AT_SHUTDOWN") != nullptr)
     {
     }
 };
 
 #ifdef COLLECT_TIME_DEBUG
 class TimeLog
 {
 public:
--- a/xpcom/base/nsDebugImpl.cpp
+++ b/xpcom/base/nsDebugImpl.cpp
@@ -73,17 +73,17 @@ Break(const char *aMsg);
 #include <malloc.h> // for _alloca
 #elif defined(XP_UNIX)
 #include <stdlib.h>
 #endif
 
 using namespace mozilla;
 
 static bool sIsMultiprocess = false;
-static const char *sMultiprocessDescription = NULL;
+static const char *sMultiprocessDescription = nullptr;
 
 static Atomic<int32_t> gAssertionCount;
 
 NS_IMPL_QUERY_INTERFACE2(nsDebugImpl, nsIDebug, nsIDebug2)
 
 NS_IMETHODIMP_(nsrefcnt)
 nsDebugImpl::AddRef()
 {
@@ -158,17 +158,17 @@ nsDebugImpl::GetIsDebuggerAttached(bool*
   mib[2] = KERN_PROC_PID;
   mib[3] = getpid();
   size_t mibSize = sizeof(mib) / sizeof(int);
 
   struct kinfo_proc info;
   size_t infoSize = sizeof(info);
   memset(&info, 0, infoSize);
 
-  if (sysctl(mib, mibSize, &info, &infoSize, NULL, 0)) {
+  if (sysctl(mib, mibSize, &info, &infoSize, nullptr, 0)) {
     // if the call fails, default to false
     *aResult = false;
     return NS_OK;
   }
 
   if (info.kp_proc.p_flag & P_TRACED) {
     *aResult = true;
   }
@@ -492,23 +492,21 @@ Break(const char *aMsg)
     si.cb          = sizeof(si);
     si.wShowWindow = SW_SHOW;
 
     // 2nd arg of CreateProcess is in/out
     PRUnichar *msgCopy = (PRUnichar*) _alloca((strlen(aMsg) + 1)*sizeof(PRUnichar));
     wcscpy(msgCopy  , (PRUnichar*)NS_ConvertUTF8toUTF16(aMsg).get());
 
     if(GetModuleFileNameW(GetModuleHandleW(L"xpcom.dll"), (LPWCH)executable, MAX_PATH) &&
-       NULL != (pName = wcsrchr(executable, '\\')) &&
-       NULL != 
-       wcscpy((WCHAR*)
-       pName+1, L"windbgdlg.exe") &&
-       CreateProcessW((LPCWSTR)executable, (LPWSTR)msgCopy, NULL, NULL, false,
-                     DETACHED_PROCESS | NORMAL_PRIORITY_CLASS,
-                     NULL, NULL, &si, &pi)) {
+       nullptr != (pName = wcsrchr(executable, '\\')) &&
+       nullptr != wcscpy((WCHAR*)pName + 1, L"windbgdlg.exe") &&
+       CreateProcessW((LPCWSTR)executable, (LPWSTR)msgCopy, nullptr, nullptr,
+                      false, DETACHED_PROCESS | NORMAL_PRIORITY_CLASS,
+                      nullptr, nullptr, &si, &pi)) {
       WaitForSingleObject(pi.hProcess, INFINITE);
       GetExitCodeProcess(pi.hProcess, &code);
       CloseHandle(pi.hProcess);
       CloseHandle(pi.hThread);
     }
 
     switch(code) {
     case IDABORT:
--- a/xpcom/base/nsDebugImpl.h
+++ b/xpcom/base/nsDebugImpl.h
@@ -13,17 +13,17 @@ public:
     NS_DECL_NSIDEBUG
     NS_DECL_NSIDEBUG2
     
     static nsresult Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
 
     /*
      * Inform nsDebugImpl that we're in multiprocess mode.
      *
-     * If aDesc is not NULL, the string it points to must be
+     * If aDesc is not nullptr, the string it points to must be
      * statically-allocated (i.e., it must be a string literal).
      */
     static void SetMultiprocessMode(const char *aDesc);
 };
 
 
 #define NS_DEBUG_CONTRACTID "@mozilla.org/xpcom/debug;1"
 #define NS_DEBUG_CID                                 \
--- a/xpcom/base/nsGZFileWriter.cpp
+++ b/xpcom/base/nsGZFileWriter.cpp
@@ -41,17 +41,17 @@ nsGZFileWriter::Init(nsIFile* aFile)
 
   FILE* file;
   nsresult rv = aFile->OpenANSIFileDesc("wb", &file);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mGZFile = gzdopen(dup(fileno(file)), "wb");
   fclose(file);
 
-  // gzdopen returns NULL on error.
+  // gzdopen returns nullptr on error.
   NS_ENSURE_TRUE(mGZFile, NS_ERROR_FAILURE);
   mInitialized = true;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGZFileWriter::Write(const nsACString& aStr)
--- a/xpcom/base/nsISupportsObsolete.h
+++ b/xpcom/base/nsISupportsObsolete.h
@@ -189,17 +189,17 @@ NS_IMPL_SETTER_STR(_class::Set##_postfix
  * inheritance chain leads to its own interface.
  *
  * @param _class The name of the class implementing the method
  * @param _classiiddef The name of the #define symbol that defines the IID
  * for the class (e.g. NS_ISUPPORTS_IID)
  */
 #if defined(DEBUG)
 #define NS_VERIFY_THREADSAFE_INTERFACE(_iface)                                \
- if (NULL != (_iface)) {                                                      \
+ if (nullptr != (_iface)) {                                                   \
    nsISupports* tmp;                                                          \
    static NS_DEFINE_IID(kIsThreadsafeIID, NS_ISTHREADSAFE_IID);               \
    NS_PRECONDITION((NS_OK == _iface->QueryInterface(kIsThreadsafeIID,         \
                                                     (void**)&tmp)),           \
                    "Interface is not threadsafe");                            \
  }
 #else
 #define NS_VERIFY_THREADSAFE_INTERFACE(_iface)
--- a/xpcom/base/nsMacUtilsImpl.cpp
+++ b/xpcom/base/nsMacUtilsImpl.cpp
@@ -118,17 +118,17 @@ NS_IMETHODIMP nsMacUtilsImpl::GetIsTrans
 
   // Initialize sIsNative to 1.  If the sysctl fails because it doesn't
   // exist, then translation is not possible, so the process must not be
   // running translated.
   static int32_t sIsNative = 1;
 
   if (!sInitialized) {
     size_t sz = sizeof(sIsNative);
-    sysctlbyname("sysctl.proc_native", &sIsNative, &sz, NULL, 0);
+    sysctlbyname("sysctl.proc_native", &sIsNative, &sz, nullptr, 0);
     sInitialized = true;
   }
 
   *aIsTranslated = !sIsNative;
 #else
   // Translation only exists for ppc code.  Other architectures aren't
   // translated.
   *aIsTranslated = false;
--- a/xpcom/base/nsMemoryInfoDumper.cpp
+++ b/xpcom/base/nsMemoryInfoDumper.cpp
@@ -612,17 +612,17 @@ namespace mozilla {
 static nsresult
 DumpReport(nsIGZFileWriter *aWriter, bool aIsFirst,
   const nsACString &aProcess, const nsACString &aPath, int32_t aKind,
   int32_t aUnits, int64_t aAmount, const nsACString &aDescription)
 {
   DUMP(aWriter, aIsFirst ? "[" : ",");
 
   // We only want to dump reports for this process.  If |aProcess| is
-  // non-NULL that means we've received it from another process in response
+  // non-nullptr that means we've received it from another process in response
   // to a "child-memory-reporter-request" event;  ignore such reports.
   if (!aProcess.IsEmpty()) {
     return NS_OK;
   }
 
   // Generate the process identifier, which is of the form "$PROCESS_NAME
   // (pid $PID)", or just "(pid $PID)" if we don't have a process name.  If
   // we're the main process, we let $PROCESS_NAME be "Main Process".
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -155,17 +155,17 @@ static nsresult GetKinfoProcSelf(KINFO_P
         getpid(),
 #if defined(__NetBSD__) || defined(__OpenBSD__)
         sizeof(KINFO_PROC),
         1,
 #endif
     };
     u_int miblen = sizeof(mib) / sizeof(mib[0]);
     size_t size = sizeof(KINFO_PROC);
-    if (sysctl(mib, miblen, aProc, &size, NULL, 0))
+    if (sysctl(mib, miblen, aProc, &size, nullptr, 0))
         return NS_ERROR_FAILURE;
 
     return NS_OK;
 }
 
 #define HAVE_VSIZE_AND_RESIDENT_REPORTERS 1
 static nsresult GetVsize(int64_t* aN)
 {
@@ -199,17 +199,17 @@ static nsresult GetResidentFast(int64_t*
 #include <unistd.h>
 
 static void XMappingIter(int64_t& vsize, int64_t& resident)
 {
     vsize = -1;
     resident = -1;
     int mapfd = open("/proc/self/xmap", O_RDONLY);
     struct stat st;
-    prxmap_t* prmapp = NULL;
+    prxmap_t* prmapp = nullptr;
     if (mapfd >= 0) {
         if (!fstat(mapfd, &st)) {
             int nmap = st.st_size / sizeof(prxmap_t);
             while (1) {
                 // stat(2) on /proc/<pid>/xmap returns an incorrect value,
                 // prior to the release of Solaris 11.
                 // Here is a workaround for it.
                 nmap *= 2;
--- a/xpcom/base/nsObjCExceptions.h
+++ b/xpcom/base/nsObjCExceptions.h
@@ -128,17 +128,17 @@ static void nsObjCExceptionLog(NSExcepti
 }
 
 __attribute__((unused))
 static void nsObjCExceptionAbort()
 {
   // We need to raise a mach-o signal here, the Mozilla crash reporter on
   // Mac OS X does not respond to POSIX signals. Raising mach-o signals directly
   // is tricky so we do it by just derefing a null pointer.
-  int* foo = NULL;
+  int* foo = nullptr;
   *foo = 1;
 }
 
 __attribute__((unused))
 static void nsObjCExceptionLogAbort(NSException *e)
 {
   nsObjCExceptionLog(e);
   nsObjCExceptionAbort();
--- a/xpcom/base/nsSetDllDirectory.h
+++ b/xpcom/base/nsSetDllDirectory.h
@@ -13,21 +13,21 @@
 #include <windows.h>
 #include <nscore.h>
 #include <stdlib.h>
 
 namespace mozilla {
 
 static void SanitizeEnvironmentVariables()
 {
-  DWORD bufferSize = GetEnvironmentVariableW(L"PATH", NULL, 0);
+  DWORD bufferSize = GetEnvironmentVariableW(L"PATH", nullptr, 0);
   if (bufferSize) {
     wchar_t* originalPath = new wchar_t[bufferSize];
     if (bufferSize - 1 == GetEnvironmentVariableW(L"PATH", originalPath, bufferSize)) {
-      bufferSize = ExpandEnvironmentStringsW(originalPath, NULL, 0);
+      bufferSize = ExpandEnvironmentStringsW(originalPath, nullptr, 0);
       if (bufferSize) {
         wchar_t* newPath = new wchar_t[bufferSize];
         if (ExpandEnvironmentStringsW(originalPath,
                                       newPath,
                                       bufferSize)) {
           SetEnvironmentVariableW(L"PATH", newPath);
         }
         delete[] newPath;
--- a/xpcom/base/nsStackWalk.cpp
+++ b/xpcom/base/nsStackWalk.cpp
@@ -11,17 +11,17 @@
 #include "mozilla/StackWalk.h"
 #include "nsStackWalkPrivate.h"
 
 #include "nsStackWalk.h"
 
 using namespace mozilla;
 
 // The presence of this address is the stack must stop the stack walk. If
-// there is no such address, the structure will be {NULL, true}.
+// there is no such address, the structure will be {nullptr, true}.
 struct CriticalAddress {
   void* mAddr;
   bool mInit;
 };
 static CriticalAddress gCriticalAddress;
 
 #if defined(HAVE_DLOPEN) || defined(XP_MACOSX)
 #include <dlfcn.h>
@@ -55,17 +55,17 @@ stack_callback(void *pc, void *sp, void 
   const char *name = reinterpret_cast<char *>(closure);
   Dl_info info;
 
   // On Leopard dladdr returns the wrong value for "new_sem_from_pool". The
   // stack shows up as having two pthread_cond_wait$UNIX2003 frames. The
   // correct one is the first that we find on our way up, so the
   // following check for gCriticalAddress.mAddr is critical.
   if (gCriticalAddress.mAddr || dladdr(pc, &info) == 0  ||
-      info.dli_sname == NULL || strcmp(info.dli_sname, name) != 0)
+      info.dli_sname == nullptr || strcmp(info.dli_sname, name) != 0)
     return;
   gCriticalAddress.mAddr = pc;
 }
 
 #ifdef DEBUG
 #define MAC_OS_X_VERSION_10_7_HEX 0x00001070
 
 static int32_t OSXVersion()
@@ -135,17 +135,17 @@ StackWalkInitCriticalAddress()
   r = pthread_cond_timedwait_relative_np(&cond, &mutex, &abstime);
 
   // restore the previous malloc logger
   malloc_logger = old_malloc_logger;
 
   // On Lion, malloc is no longer called from pthread_cond_*wait*. This prevents
   // us from finding the address, but that is fine, since with no call to malloc
   // there is no critical address.
-  MOZ_ASSERT(OnLionOrLater() || gCriticalAddress.mAddr != NULL);
+  MOZ_ASSERT(OnLionOrLater() || gCriticalAddress.mAddr != nullptr);
   MOZ_ASSERT(r == ETIMEDOUT);
   r = pthread_mutex_unlock(&mutex);
   MOZ_ASSERT(r == 0);
   r = pthread_mutex_destroy(&mutex);
   MOZ_ASSERT(r == 0);
   r = pthread_cond_destroy(&cond);
   MOZ_ASSERT(r == 0);
 }
@@ -232,22 +232,22 @@ CRITICAL_SECTION gDbgHelpCS;
 // Routine to print an error message to standard error.
 // Will also call callback with error, if data supplied.
 void PrintError(const char *prefix)
 {
     LPVOID lpMsgBuf;
     DWORD lastErr = GetLastError();
     FormatMessageA(
       FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
-      NULL,
+      nullptr,
       lastErr,
       MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
       (LPSTR) &lpMsgBuf,
       0,
-      NULL
+      nullptr
     );
     fprintf(stderr, "### ERROR: %s: %s",
                     prefix, lpMsgBuf ? lpMsgBuf : "(null)\n");
     fflush(stderr);
     LocalFree(lpMsgBuf);
 }
 
 bool
@@ -258,24 +258,24 @@ EnsureImageHlpInitialized()
     if (gInitialized)
         return gInitialized;
 
     // Hope that our first call doesn't happen during static
     // initialization.  If it does, this CreateThread call won't
     // actually start the thread until after the static initialization
     // is done, which means we'll deadlock while waiting for it to
     // process a stack.
-    HANDLE readyEvent = ::CreateEvent(NULL, FALSE /* auto-reset*/,
-                            FALSE /* initially non-signaled */, NULL);
+    HANDLE readyEvent = ::CreateEvent(nullptr, FALSE /* auto-reset*/,
+                            FALSE /* initially non-signaled */, nullptr);
     unsigned int threadID;
     HANDLE hStackWalkThread = (HANDLE)
-      _beginthreadex(NULL, 0, WalkStackThread, (void*)readyEvent,
+      _beginthreadex(nullptr, 0, WalkStackThread, (void*)readyEvent,
                      0, &threadID);
     gStackWalkThread = threadID;
-    if (hStackWalkThread == NULL) {
+    if (hStackWalkThread == nullptr) {
         PrintError("CreateThread");
         return false;
     }
     ::CloseHandle(hStackWalkThread);
 
     // Wait for the thread's event loop to start before posting events to it.
     ::WaitForSingleObject(readyEvent, INFINITE);
     ::CloseHandle(readyEvent);
@@ -351,17 +351,17 @@ WalkStackMain64(struct WalkStackData* da
           IMAGE_FILE_MACHINE_I386,
 #else
 #error "Should not have compiled this code"
 #endif
           myProcess,
           myThread,
           &frame64,
           &context,
-          NULL,
+          nullptr,
           SymFunctionTableAccess64, // function table access routine
           SymGetModuleBase64,       // module base routine
           0
         );
         LeaveCriticalSection(&gDbgHelpCS);
 
         if (ok) {
             addr = frame64.AddrPC.Offset;
@@ -403,17 +403,17 @@ WalkStackMain64(struct WalkStackData* da
 unsigned int WINAPI
 WalkStackThread(void* aData)
 {
     BOOL msgRet;
     MSG msg;
 
     // Call PeekMessage to force creation of a message queue so that
     // other threads can safely post events to us.
-    ::PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE);
+    ::PeekMessage(&msg, nullptr, WM_USER, WM_USER, PM_NOREMOVE);
 
     // and tell the thread that created us that we're ready.
     HANDLE readyEvent = (HANDLE)aData;
     ::SetEvent(readyEvent);
 
     while ((msgRet = ::GetMessage(&msg, (HWND)-1, 0, 0)) != 0) {
         if (msgRet == -1) {
             PrintError("GetMessage");
@@ -461,17 +461,17 @@ WalkStackThread(void* aData)
  */
 
 EXPORT_XPCOM_API(nsresult)
 NS_StackWalk(NS_WalkStackCallback aCallback, uint32_t aSkipFrames,
              uint32_t aMaxFrames, void *aClosure, uintptr_t aThread,
              void *aPlatformData)
 {
     StackWalkInitCriticalAddress();
-    static HANDLE myProcess = NULL;
+    static HANDLE myProcess = nullptr;
     HANDLE myThread;
     DWORD walkerReturn;
     struct WalkStackData data;
 
     if (!EnsureImageHlpInitialized())
         return NS_ERROR_FAILURE;
 
     HANDLE targetThread = ::GetCurrentThread();
@@ -535,20 +535,20 @@ NS_StackWalk(NS_WalkStackCallback aCallb
             data.pc_size = data.pc_count;
             data.pc_count = 0;
             data.sps = (void**) _alloca(data.sp_count * sizeof(void*));
             data.sp_size = data.sp_count;
             data.sp_count = 0;
             WalkStackMain64(&data);
         }
     } else {
-        data.eventStart = ::CreateEvent(NULL, FALSE /* auto-reset*/,
-                              FALSE /* initially non-signaled */, NULL);
-        data.eventEnd = ::CreateEvent(NULL, FALSE /* auto-reset*/,
-                            FALSE /* initially non-signaled */, NULL);
+        data.eventStart = ::CreateEvent(nullptr, FALSE /* auto-reset*/,
+                              FALSE /* initially non-signaled */, nullptr);
+        data.eventEnd = ::CreateEvent(nullptr, FALSE /* auto-reset*/,
+                            FALSE /* initially non-signaled */, nullptr);
 
         ::PostThreadMessage(gStackWalkThread, WM_USER, 0, (LPARAM)&data);
 
         walkerReturn = ::SignalObjectAndWait(data.eventStart,
                            data.eventEnd, INFINITE, FALSE);
         if (walkerReturn != WAIT_OBJECT_0 && !shouldBeThreadSafe)
             PrintError("SignalObjectAndWait (1)");
         if (data.pc_count > data.pc_size) {
@@ -596,17 +596,19 @@ static BOOL CALLBACK callbackEspecial64(
 
     /*
      * If it falls in side the known range, load the symbols.
      */
     if (addressIncreases
        ? (addr >= aModuleBase && addr <= (aModuleBase + aModuleSize))
        : (addr <= aModuleBase && addr >= (aModuleBase - aModuleSize))
         ) {
-        retval = !!SymLoadModule64(GetCurrentProcess(), NULL, (PSTR)aModuleName, NULL, aModuleBase, aModuleSize);
+        retval = !!SymLoadModule64(GetCurrentProcess(), nullptr,
+                                   (PSTR)aModuleName, nullptr,
+                                   aModuleBase, aModuleSize);
         if (!retval)
             PrintError("SymLoadModule64");
     }
 
     return retval;
 }
 
 /*
@@ -700,17 +702,17 @@ EnsureSymInitialized()
 
     if (gInitialized)
         return gInitialized;
 
     if (!EnsureImageHlpInitialized())
         return false;
 
     SymSetOptions(SYMOPT_LOAD_LINES | SYMOPT_UNDNAME);
-    retStat = SymInitialize(GetCurrentProcess(), NULL, TRUE);
+    retStat = SymInitialize(GetCurrentProcess(), nullptr, TRUE);
     if (!retStat)
         PrintError("SymInitialize");
 
     gInitialized = retStat;
     /* XXX At some point we need to arrange to call SymCleanup */
 
     return retStat;
 }
@@ -918,17 +920,17 @@ myinit()
 {
 
     if (! initialized) {
 #ifndef __GNUC__
         void *handle;
         const char *libdem = "libdemangle.so.1";
 
         /* load libdemangle if we can and need to (only try this once) */
-        if ((handle = dlopen(libdem, RTLD_LAZY)) != NULL) {
+        if ((handle = dlopen(libdem, RTLD_LAZY)) != nullptr) {
             demf = (demf_t *)dlsym(handle,
                            "cplus_demangle"); /*lint !e611 */
                 /*
                  * lint override above is to prevent lint from
                  * complaining about "suspicious cast".
                  */
         }
 #endif /*__GNUC__*/
@@ -974,17 +976,17 @@ load_address(void * pc, void * arg)
 
 static struct bucket *
 newbucket(void * pc)
 {
     struct bucket * ptr = (struct bucket *) malloc(sizeof (*ptr));
     static int index; /* protected by lock in caller */
                      
     ptr->index = index++;
-    ptr->next = NULL;
+    ptr->next = nullptr;
     ptr->pc = pc;    
     return (ptr);    
 }
 
 
 static struct frame *
 csgetframeptr()
 {
@@ -1005,17 +1007,17 @@ csgetframeptr()
 
 static void
 cswalkstack(struct frame *fp, int (*operate_func)(void *, void *, void *),
     void *usrarg)
 {
 
     while (fp != 0 && fp->fr_savpc != 0) {
 
-        if (operate_func((void *)fp->fr_savpc, NULL, usrarg) != 0)
+        if (operate_func((void *)fp->fr_savpc, nullptr, usrarg) != 0)
             break;
         /*
          * watch out - libthread stacks look funny at the top
          * so they may not have their STACK_BIAS set
          */
 
         fp = (struct frame *)((ulong_t)fp->fr_savfp +
             (fp->fr_savfp?(ulong_t)STACK_BIAS:0));
@@ -1224,17 +1226,17 @@ unwind_callback (struct _Unwind_Context 
         printf("Aborting stack trace, PC is critical\n");
         info->isCriticalAbort = true;
         // We just want to stop the walk, so any error code will do.  Using
         // _URC_NORMAL_STOP would probably be the most accurate, but it is not
         // defined on Android for ARM.
         return _URC_FOREIGN_EXCEPTION_CAUGHT;
     }
     if (--info->skip < 0) {
-        (*info->callback)(pc, NULL, info->closure);
+        (*info->callback)(pc, nullptr, info->closure);
         info->numFrames++;
         if (info->maxFrames != 0 && info->numFrames == info->maxFrames) {
             // Again, any error code that stops the walk will do.
             return _URC_FOREIGN_EXCEPTION_CAUGHT;
         }
     }
     return _URC_NO_REASON;
 }
--- a/xpcom/base/nsStackWalk.h
+++ b/xpcom/base/nsStackWalk.h
@@ -14,17 +14,17 @@
 #include <stdint.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 // aSP will be the best approximation possible of what the stack pointer will be
 // pointing to when the execution returns to executing that at that PC.
-// If no approximation can be made it will be NULL.
+// If no approximation can be made it will be nullptr.
 typedef void
 (* NS_WalkStackCallback)(void *aPC, void *aSP, void *aClosure);
 
 /**
  * Call aCallback for the C/C++ stack frames on the current thread, from
  * the caller of NS_StackWalk to main (or above).
  *
  * @param aCallback    Callback function, called once per frame.
@@ -33,17 +33,17 @@ typedef void
  *                     NS_StackWalk.
  * @param aMaxFrames   Maximum number of frames to trace.  0 means no limit.
  * @param aClosure     Caller-supplied data passed through to aCallback.
  * @param aThread      The thread for which the stack is to be retrieved.
  *                     Passing null causes us to walk the stack of the
  *                     current thread. On Windows, this is a thread HANDLE.
  *                     It is currently not supported on any other platform.
  * @param aPlatformData Platform specific data that can help in walking the
- *                      stack, this should be NULL unless you really know
+ *                      stack, this should be nullptr unless you really know
  *                      what you're doing! This needs to be a pointer to a
  *                      CONTEXT on Windows and should not be passed on other
  *                      platforms.
  *
  * Return values:
  * - NS_ERROR_NOT_IMPLEMENTED.  Occurs on platforms where it is unimplemented.
  *
  * - NS_ERROR_UNEXPECTED.  Occurs when the stack indicates that the thread
--- a/xpcom/base/nsTraceRefcntImpl.cpp
+++ b/xpcom/base/nsTraceRefcntImpl.cpp
@@ -406,35 +406,35 @@ const static PLHashAllocOps bloatViewHas
 
 static void
 RecreateBloatView()
 {
   gBloatView = PL_NewHashTable(256,
                                PL_HashString,
                                PL_CompareStrings,
                                PL_CompareValues,
-                               &bloatViewHashAllocOps, NULL);
+                               &bloatViewHashAllocOps, nullptr);
 }
 
 static BloatEntry*
 GetBloatEntry(const char* aTypeName, uint32_t aInstanceSize)
 {
   if (!gBloatView) {
     RecreateBloatView();
   }
-  BloatEntry* entry = NULL;
+  BloatEntry* entry = nullptr;
   if (gBloatView) {
     entry = (BloatEntry*)PL_HashTableLookup(gBloatView, aTypeName);
-    if (entry == NULL && aInstanceSize > 0) {
+    if (entry == nullptr && aInstanceSize > 0) {
 
       entry = new BloatEntry(aTypeName, aInstanceSize);
       PLHashEntry* e = PL_HashTableAdd(gBloatView, aTypeName, entry);
-      if (e == NULL) {
+      if (e == nullptr) {
         delete entry;
-        entry = NULL;
+        entry = nullptr;
       }
     } else {
       NS_ASSERTION(aInstanceSize == 0 ||
                    entry->GetClassSize() == aInstanceSize,
                    "bad size recorded");
     }
   }
   return entry;
@@ -641,27 +641,27 @@ static bool InitLog(const char* envVar, 
         fname.AppendLiteral("_");
         fname.Append((char*)XRE_ChildProcessTypeToString(XRE_GetProcessType()));
         fname.AppendLiteral("_pid");
         fname.AppendInt((uint32_t)getpid());
         if (hasLogExtension)
           fname.AppendLiteral(".log");
       }
       stream = ::fopen(fname.get(), "w" FOPEN_NO_INHERIT);
-      if (stream != NULL) {
+      if (stream != nullptr) {
         MozillaRegisterDebugFD(fileno(stream));
         *result = stream;
         fprintf(stdout, "### %s defined -- logging %s to %s\n",
                 envVar, msg, fname.get());
       }
       else {
         fprintf(stdout, "### %s defined -- unable to log %s to %s\n",
                 envVar, msg, fname.get());
       }
-      return stream != NULL;
+      return stream != nullptr;
     }
   }
   return false;
 }
 
 
 static PLHashNumber HashNumber(const void* aKey)
 {
@@ -738,17 +738,17 @@ static void InitTraceLog(void)
 
   if (classes) {
     // if XPCOM_MEM_LOG_CLASSES was set to some value, the value is interpreted
     // as a list of class names to track
     gTypesToLog = PL_NewHashTable(256,
                                   PL_HashString,
                                   PL_CompareStrings,
                                   PL_CompareValues,
-                                  &typesToLogHashAllocOps, NULL);
+                                  &typesToLogHashAllocOps, nullptr);
     if (!gTypesToLog) {
       NS_WARNING("out of memory");
       fprintf(stdout, "### XPCOM_MEM_LOG_CLASSES defined -- unable to log specific classes\n");
     }
     else {
       fprintf(stdout, "### XPCOM_MEM_LOG_CLASSES defined -- only logging these classes: ");
       const char* cp = classes;
       for (;;) {
@@ -764,28 +764,28 @@ static void InitTraceLog(void)
       }
       fprintf(stdout, "\n");
     }
 
     gSerialNumbers = PL_NewHashTable(256,
                                      HashNumber,
                                      PL_CompareValues,
                                      PL_CompareValues,
-                                     &serialNumberHashAllocOps, NULL);
+                                     &serialNumberHashAllocOps, nullptr);
 
 
   }
 
   const char* objects = getenv("XPCOM_MEM_LOG_OBJECTS");
   if (objects) {
     gObjectsToLog = PL_NewHashTable(256,
                                     HashNumber,
                                     PL_CompareValues,
                                     PL_CompareValues,
-                                    NULL, NULL);
+                                    nullptr, nullptr);
 
     if (!gObjectsToLog) {
       NS_WARNING("out of memory");
       fprintf(stdout, "### XPCOM_MEM_LOG_OBJECTS defined -- unable to log specific objects\n");
     }
     else if (! (gRefcntsLog || gAllocLog || gCOMPtrLog)) {
       fprintf(stdout, "### XPCOM_MEM_LOG_OBJECTS defined -- but none of XPCOM_MEM_(REFCNT|ALLOC|COMPTR)_LOG is defined\n");
     }
--- a/xpcom/base/nsWindowsHelpers.h
+++ b/xpcom/base/nsWindowsHelpers.h
@@ -11,17 +11,17 @@
 
 template<>
 class nsAutoRefTraits<HKEY>
 {
 public:
   typedef HKEY RawRef;
   static HKEY Void()
   {
-    return NULL;
+    return nullptr;
   }
 
   static void Release(RawRef aFD)
   {
     if (aFD != Void()) {
       RegCloseKey(aFD);
     }
   }
@@ -29,70 +29,70 @@ public:
 
 template<>
 class nsAutoRefTraits<SC_HANDLE>
 {
 public:
   typedef SC_HANDLE RawRef;
   static SC_HANDLE Void()
   {
-    return NULL;
+    return nullptr;
   }
 
   static void Release(RawRef aFD)
   {
     if (aFD != Void()) {
       CloseServiceHandle(aFD);
     }
   }
 };
 
 template<>
 class nsSimpleRef<HANDLE>
 {
 protected:
   typedef HANDLE RawRef;
 
-  nsSimpleRef() : mRawRef(NULL)
+  nsSimpleRef() : mRawRef(nullptr)
   {
   }
 
   nsSimpleRef(RawRef aRawRef) : mRawRef(aRawRef)
   {
   }
 
   bool HaveResource() const
   {
-    return mRawRef != NULL && mRawRef != INVALID_HANDLE_VALUE;
+    return mRawRef != nullptr && mRawRef != INVALID_HANDLE_VALUE;
   }
 
 public:
   RawRef get() const
   {
     return mRawRef;
   }
 
   static void Release(RawRef aRawRef)
   {
-    if (aRawRef != NULL && aRawRef != INVALID_HANDLE_VALUE) {
+    if (aRawRef != nullptr && aRawRef != INVALID_HANDLE_VALUE) {
       CloseHandle(aRawRef);
     }
   }
   RawRef mRawRef;
 };
 
 
 template<>
 class nsAutoRefTraits<HMODULE>
 {
 public:
   typedef HMODULE RawRef;
   static RawRef Void()
   {
-    return NULL;
+    return nullptr;
   }
 
   static void Release(RawRef aFD)
   {
     if (aFD != Void()) {
       FreeLibrary(aFD);
     }
   }
@@ -154,17 +154,17 @@ namespace
     // normal search path.
     GetSystemDirectoryW(systemPath, MAX_PATH + 1);
     size_t systemDirLen = wcslen(systemPath);
 
     // Make the system directory path terminate with a slash
     if (systemDirLen && systemPath[systemDirLen - 1] != L'\\') {
       systemPath[systemDirLen] = L'\\';
       ++systemDirLen;
-      // No need to re-NULL terminate
+      // No need to re-nullptr terminate
     }
 
     size_t fileLen = wcslen(module);
     wcsncpy(systemPath + systemDirLen, module,
             MAX_PATH - systemDirLen);
     if (systemDirLen + fileLen <= MAX_PATH) {
       systemPath[systemDirLen + fileLen] = L'\0';
     } else {
--- a/xpcom/build/BinaryPath.h
+++ b/xpcom/build/BinaryPath.h
@@ -22,17 +22,17 @@ public:
 #ifdef XP_WIN
   static nsresult Get(const char *argv0, char aResult[MAXPATHLEN])
   {
     PRUnichar wide_path[MAXPATHLEN];
     nsresult rv = GetW(argv0, wide_path);
     if (NS_FAILED(rv))
       return rv;
     WideCharToMultiByte(CP_UTF8, 0, wide_path, -1,
-                        aResult, MAXPATHLEN, NULL, NULL);
+                        aResult, MAXPATHLEN, nullptr, nullptr);
     return NS_OK;
   }
 
 private:
   static nsresult GetW(const char *argv0, PRUnichar aResult[MAXPATHLEN])
   {
     if (::GetModuleFileNameW(0, aResult, MAXPATHLEN))
       return NS_OK;
@@ -107,17 +107,17 @@ private:
     char *token = strtok(pathdup, ":");
     while (token) {
       char tmpPath[MAXPATHLEN];
       sprintf(tmpPath, "%s/%s", token, argv0);
       if (realpath(tmpPath, aResult) && stat(aResult, &fileStat) == 0) {
         found = true;
         break;
       }
-      token = strtok(NULL, ":");
+      token = strtok(nullptr, ":");
     }
     free(pathdup);
     if (found)
       return NS_OK;
     return NS_ERROR_FAILURE;
   }
 
 #elif defined(XP_OS2)
--- a/xpcom/build/FileLocation.cpp
+++ b/xpcom/build/FileLocation.cpp
@@ -66,34 +66,34 @@ FileLocation::FileLocation(const FileLoc
       Init(file.mBaseFile);
     }
   }
 }
 
 void
 FileLocation::Init(nsIFile* file)
 {
-  mBaseZip = NULL;
+  mBaseZip = nullptr;
   mBaseFile = file;
   mPath.Truncate();
 }
 
 void
 FileLocation::Init(nsIFile* file, const char* path)
 {
-  mBaseZip = NULL;
+  mBaseZip = nullptr;
   mBaseFile = file;
   mPath = path;
 }
 
 void
 FileLocation::Init(nsZipArchive* zip, const char* path)
 {
   mBaseZip = zip;
-  mBaseFile = NULL;
+  mBaseFile = nullptr;
   mPath = path;
 }
 
 void
 FileLocation::GetURIString(nsACString &result) const
 {
   if (mBaseFile) {
     net_GetURLSpecFromActualFile(mBaseFile, result);
--- a/xpcom/build/FileLocation.h
+++ b/xpcom/build/FileLocation.h
@@ -45,17 +45,17 @@ public:
    */
   FileLocation(nsIFile *zip, const char *path);
 
   FileLocation(nsZipArchive *zip, const char *path);
 
   /**
    * Creates a new file location relative to another one.
    */
-  FileLocation(const FileLocation &file, const char *path = NULL);
+  FileLocation(const FileLocation &file, const char *path = nullptr);
 
   /**
    * Initialization functions corresponding to constructors
    */
   void Init(nsIFile *file);
 
   void Init(nsIFile *zip, const char *path);
 
--- a/xpcom/build/FrozenFunctions.cpp
+++ b/xpcom/build/FrozenFunctions.cpp
@@ -62,17 +62,17 @@ static const XPCOMFunctions kFrozenFunct
     // these functions were added post 1.7 (post Firefox 1.0)
     &NS_Alloc,
     &NS_Realloc,
     &NS_Free,
     &NS_StringContainerInit2,
     &NS_CStringContainerInit2,
     &NS_StringGetMutableData,
     &NS_CStringGetMutableData,
-    NULL,
+    nullptr,
 
     // these functions were added post 1.8
     &NS_DebugBreak,
     &NS_LogInit,
     &NS_LogTerm,
     &NS_LogAddRef,
     &NS_LogRelease,
     &NS_LogCtor,
--- a/xpcom/build/mach_override.h
+++ b/xpcom/build/mach_override.h
@@ -63,17 +63,17 @@
 	Optionally returns a pointer to a "reentry island" which, if jumped to, will resume
 	the original implementation.
 	
 	@param	originalFunctionAddress			->	Required address of the function to
 												override (with overrideFunctionAddress).
 	@param	overrideFunctionAddress			->	Required address to the overriding
 												function.
 	@param	originalFunctionReentryIsland	<-	Optional pointer to pointer to the
-												reentry island. Can be NULL.
+												reentry island. Can be nullptr.
 	@result									<-	err_cannot_override if the original
 												function's implementation begins with
 												the 'mfctr' instruction.
 
 	************************************************************************************/
 
     mach_error_t
 mach_override_ptr(
--- a/xpcom/build/mozPoisonWriteBase.cpp
+++ b/xpcom/build/mozPoisonWriteBase.cpp
@@ -70,17 +70,17 @@ public:
 };
 
 PRLock *DebugFilesAutoLock::Lock;
 void DebugFilesAutoLock::Clear() {
   MOZ_ASSERT(Lock != nullptr);
   Lock = nullptr;
 }
 
-static char *sProfileDirectory = NULL;
+static char *sProfileDirectory = nullptr;
 
 // Return a vector used to hold the IDs of the current debug files. On unix
 // an ID is a file descriptor. On Windows it is a file HANDLE.
 std::vector<intptr_t>* getDebugFileIDs() {
   PRLock *lock = DebugFilesAutoLock::getDebugFileIDsLock();
   PR_ASSERT_CURRENT_THREAD_OWNS_LOCK(lock);
   // We have to use new as some write happen during static destructors
   // so an static std::vector might be destroyed while we still need it.
@@ -112,17 +112,17 @@ public:
     }
     void Finish(SHA1Sum::Hash &aHash)
     {
         int fd = fileno(mFile);
         fflush(mFile);
         MozillaUnRegisterDebugFD(fd);
         fclose(mFile);
         mSHA1.finish(aHash);
-        mFile = NULL;
+        mFile = nullptr;
     }
 private:
     FILE *mFile;
     SHA1Sum mSHA1;
 };
 
 static void RecordStackWalker(void *aPC, void *aSP, void *aClosure)
 {
@@ -196,17 +196,18 @@ bool ValidWriteAssert(bool ok)
     // We want the sha1 of the entire file, so please don't write to fd
     // directly; use sha1Stream.
     FILE *stream;
 #ifdef XP_WIN
     HANDLE hFile;
     do {
       // mkstemp isn't supported so keep trying until we get a file
       int result = _mktemp_s(name, strlen(name) + 1);
-      hFile = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
+      hFile = CreateFileA(name, GENERIC_WRITE, 0, nullptr,
+                          CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr);
     } while (GetLastError() == ERROR_FILE_EXISTS);
 
     if (hFile == INVALID_HANDLE_VALUE) {
       NS_RUNTIMEABORT("Um, how did we get here?");
     }
 
     // http://support.microsoft.com/kb/139640
     int fd = _open_osfhandle((intptr_t)hFile, _O_APPEND);
--- a/xpcom/build/mozPoisonWriteMac.cpp
+++ b/xpcom/build/mozPoisonWriteMac.cpp
@@ -171,17 +171,17 @@ void AbortOnBadWrite(int fd, const void 
 
     if (IsIPCWrite(fd, buf))
         return;
 
     // Debugging FDs are OK
     if (IsDebugFile(fd))
         return;
 
-    // For writev we pass NULL in wbuf. We should only get here from
+    // For writev we pass nullptr in wbuf. We should only get here from
     // dbm, and it uses write, so assert that we have wbuf.
     if (!ValidWriteAssert(wbuf))
         return;
 
     // As a really bad hack, accept writes that don't change the on disk
     // content. This is needed because dbm doesn't keep track of dirty bits
     // and can end up writing the same data to disk twice. Once when the
     // user (nss) asks it to sync and once when closing the database.
--- a/xpcom/build/nsXPComInit.cpp
+++ b/xpcom/build/nsXPComInit.cpp
@@ -235,17 +235,17 @@ nsXPTIInterfaceInfoManagerGetSingleton(n
     nsCOMPtr<nsIInterfaceInfoManager> iim
         (XPTInterfaceInfoManager::GetSingleton());
     if (!iim)
         return NS_ERROR_FAILURE;
 
     return iim->QueryInterface(aIID, aInstancePtr);
 }
 
-nsComponentManagerImpl* nsComponentManagerImpl::gComponentManager = NULL;
+nsComponentManagerImpl* nsComponentManagerImpl::gComponentManager = nullptr;
 bool gXPCOMShuttingDown = false;
 bool gXPCOMThreadsShutDown = false;
 
 static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
 static NS_DEFINE_CID(kINIParserFactoryCID, NS_INIPARSERFACTORY_CID);
 static NS_DEFINE_CID(kSimpleUnicharStreamFactoryCID, NS_SIMPLE_UNICHAR_STREAM_FACTORY_CID);
 
 NS_DEFINE_NAMED_CID(NS_CHROMEREGISTRY_CID);
@@ -274,37 +274,37 @@ CreateUnicharStreamFactory(const mozilla
     return already_AddRefed<nsIFactory>(
             nsSimpleUnicharStreamFactory::GetInstance());
 }
 
 #define COMPONENT(NAME, Ctor) static NS_DEFINE_CID(kNS_##NAME##_CID, NS_##NAME##_CID);
 #include "XPCOMModule.inc"
 #undef COMPONENT
 
-#define COMPONENT(NAME, Ctor) { &kNS_##NAME##_CID, false, NULL, Ctor },
+#define COMPONENT(NAME, Ctor) { &kNS_##NAME##_CID, false, nullptr, Ctor },
 const mozilla::Module::CIDEntry kXPCOMCIDEntries[] = {
-    { &kComponentManagerCID, true, NULL, nsComponentManagerImpl::Create },
+    { &kComponentManagerCID, true, nullptr, nsComponentManagerImpl::Create },
     { &kINIParserFactoryCID, false, CreateINIParserFactory },
     { &kSimpleUnicharStreamFactoryCID, false, CreateUnicharStreamFactory },
 #include "XPCOMModule.inc"
-    { &kNS_CHROMEREGISTRY_CID, false, NULL, nsChromeRegistryConstructor },
-    { &kNS_CHROMEPROTOCOLHANDLER_CID, false, NULL, nsChromeProtocolHandlerConstructor },
-    { &kNS_SECURITY_CONSOLE_MESSAGE_CID, false, NULL, nsSecurityConsoleMessageConstructor },
-    { NULL }
+    { &kNS_CHROMEREGISTRY_CID, false, nullptr, nsChromeRegistryConstructor },
+    { &kNS_CHROMEPROTOCOLHANDLER_CID, false, nullptr, nsChromeProtocolHandlerConstructor },
+    { &kNS_SECURITY_CONSOLE_MESSAGE_CID, false, nullptr, nsSecurityConsoleMessageConstructor },
+    { nullptr }
 };
 #undef COMPONENT
 
 #define COMPONENT(NAME, Ctor) { NS_##NAME##_CONTRACTID, &kNS_##NAME##_CID },
 const mozilla::Module::ContractIDEntry kXPCOMContracts[] = {
 #include "XPCOMModule.inc"
     { NS_CHROMEREGISTRY_CONTRACTID, &kNS_CHROMEREGISTRY_CID },
     { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "chrome", &kNS_CHROMEPROTOCOLHANDLER_CID },
     { NS_INIPARSERFACTORY_CONTRACTID, &kINIParserFactoryCID },
     { NS_SECURITY_CONSOLE_MESSAGE_CONTRACTID, &kNS_SECURITY_CONSOLE_MESSAGE_CID },
-    { NULL }
+    { nullptr }
 };
 #undef COMPONENT
 
 const mozilla::Module kXPCOMModule = { mozilla::Module::kVersion, kXPCOMCIDEntries, kXPCOMContracts };
 
 // gDebug will be freed during shutdown.
 static nsIDebug* gDebug = nullptr;
 
@@ -436,17 +436,17 @@ NS_InitXPCOM2(nsIServiceManager* *result
 
     // Set up the timer globals/timer thread
     rv = nsTimerImpl::Startup();
     NS_ENSURE_SUCCESS(rv, rv);
 
 #ifndef ANDROID
     // If the locale hasn't already been setup by our embedder,
     // get us out of the "C" locale and into the system 
-    if (strcmp(setlocale(LC_ALL, NULL), "C") == 0)
+    if (strcmp(setlocale(LC_ALL, nullptr), "C") == 0)
         setlocale(LC_ALL, "");
 #endif
 
 #if defined(XP_UNIX) || defined(XP_OS2)
     NS_StartupNativeCharsetUtils();
 #endif
 
     NS_StartupLocalFile();
@@ -503,17 +503,17 @@ NS_InitXPCOM2(nsIServiceManager* *result
         rv = binaryFile->GetNativePath(binaryPath);
         NS_ENSURE_SUCCESS(rv, rv);
         
         static char const *const argv = { strdup(binaryPath.get()) };
         CommandLine::Init(1, &argv);
 #endif
     }
 
-    NS_ASSERTION(nsComponentManagerImpl::gComponentManager == NULL, "CompMgr not null at init");
+    NS_ASSERTION(nsComponentManagerImpl::gComponentManager == nullptr, "CompMgr not null at init");
 
     // Create the Component/Service Manager
     nsComponentManagerImpl::gComponentManager = new nsComponentManagerImpl();
     NS_ADDREF(nsComponentManagerImpl::gComponentManager);
 
     // Global cycle collector initialization.
     if (!nsCycleCollector_init()) {
         return NS_ERROR_UNEXPECTED;
--- a/xpcom/build/perfprobe.cpp
+++ b/xpcom/build/perfprobe.cpp
@@ -199,20 +199,20 @@ nsresult ProbeManager::StartSession(nsTA
                      /*RequestContext: Passed to ControlCallback*/,
                      (LPGUID)&mApplicationUID
                      /*ControlGuid:    Tracing GUID
                       the cast comes from MSDN examples*/,
                      probesCount
                      /*GuidCount:      Number of probes*/,
                      probes
                      /*TraceGuidReg:   Probes registration*/,
-                     NULL
-                     /*MofImagePath:   Must be NULL, says MSDN*/,
-                     NULL
-                     /*MofResourceName:Must be NULL, says MSDN*/,
+                     nullptr
+                     /*MofImagePath:   Must be nullptr, says MSDN*/,
+                     nullptr
+                     /*MofResourceName:Must be nullptr, says MSDN*/,
                      &mRegistrationHandle
                      /*RegistrationHandle: Handler.
                       used only for unregistration*/
                      );
   delete[] probes;
   NS_ENSURE_TRUE(result == ERROR_SUCCESS, NS_ERROR_UNEXPECTED);
   return NS_OK;
 }
--- a/xpcom/components/ManifestParser.cpp
+++ b/xpcom/components/ManifestParser.cpp
@@ -63,41 +63,41 @@ struct ManifestDirective
     (nsChromeRegistry::ManifestProcessingContext& cx,
      int lineno, char *const *argv,
      bool platform, bool contentaccessible);
 
   bool isContract;
 };
 static const ManifestDirective kParsingTable[] = {
   { "manifest",         1, false, true, true, false,
-    &nsComponentManagerImpl::ManifestManifest, NULL },
+    &nsComponentManagerImpl::ManifestManifest, nullptr },
   { "binary-component", 1, true, false, false, false,
-    &nsComponentManagerImpl::ManifestBinaryComponent, NULL },
+    &nsComponentManagerImpl::ManifestBinaryComponent, nullptr },
   { "interfaces",       1, true, false, false, false,
-    &nsComponentManagerImpl::ManifestXPT, NULL },
+    &nsComponentManagerImpl::ManifestXPT, nullptr },
   { "component",        2, true, false, false, false,
-    &nsComponentManagerImpl::ManifestComponent, NULL },
+    &nsComponentManagerImpl::ManifestComponent, nullptr },
   { "contract",         2, true, false, false, false,
-    &nsComponentManagerImpl::ManifestContract, NULL, true},
+    &nsComponentManagerImpl::ManifestContract, nullptr, true},
   { "category",         3, true, false, false, false,
-    &nsComponentManagerImpl::ManifestCategory, NULL },
+    &nsComponentManagerImpl::ManifestCategory, nullptr },
   { "content",          2, true, true, true,  true,
-    NULL, &nsChromeRegistry::ManifestContent },
+    nullptr, &nsChromeRegistry::ManifestContent },
   { "locale",           3, true, true, true,  false,
-    NULL, &nsChromeRegistry::ManifestLocale },
+    nullptr, &nsChromeRegistry::ManifestLocale },
   { "skin",             3, false, true, true,  false,
-    NULL, &nsChromeRegistry::ManifestSkin },
+    nullptr, &nsChromeRegistry::ManifestSkin },
   { "overlay",          2, true, true, false,  false,
-    NULL, &nsChromeRegistry::ManifestOverlay },
+    nullptr, &nsChromeRegistry::ManifestOverlay },
   { "style",            2, false, true, false,  false,
-    NULL, &nsChromeRegistry::ManifestStyle },
+    nullptr, &nsChromeRegistry::ManifestStyle },
   { "override",         2, true, true, true,  false,
-    NULL, &nsChromeRegistry::ManifestOverride },
+    nullptr, &nsChromeRegistry::ManifestOverride },
   { "resource",         2, true, true, false,  false,
-    NULL, &nsChromeRegistry::ManifestResource }
+    nullptr, &nsChromeRegistry::ManifestResource }
 };
 
 static const char kWhitespace[] = "\t ";
 
 static bool IsNewline(char c)
 {
   return c == '\n' || c == '\r';
 }
@@ -505,17 +505,17 @@ ParseManifest(NSLocationType type, FileL
 
     if (*token == '#') // ignore lines that begin with # as comments
       continue;
 
     char *whitespace = token;
     token = nsCRT::strtok(whitespace, kWhitespace, &whitespace);
     if (!token) continue;
 
-    const ManifestDirective* directive = NULL;
+    const ManifestDirective* directive = nullptr;
     for (const ManifestDirective* d = kParsingTable;
 	 d < ArrayEnd(kParsingTable);
 	 ++d) {
       if (!strcmp(d->directive, token)) {
 	directive = d;
 	break;
       }
     }
@@ -561,17 +561,17 @@ ParseManifest(NSLocationType type, FileL
     TriState stOs = eUnspecified;
     TriState stABI = eUnspecified;
 #if defined(MOZ_WIDGET_ANDROID)
     TriState stTablet = eUnspecified;
 #endif
     bool platform = false;
     bool contentAccessible = false;
 
-    while (NULL != (token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) && ok) {
+    while (nullptr != (token = nsCRT::strtok(whitespace, kWhitespace, &whitespace)) && ok) {
       ToLowerCase(token);
       NS_ConvertASCIItoUTF16 wtoken(token);
 
       if (CheckStringFlag(kApplication, wtoken, appID, stApp) ||
           CheckStringFlag(kOs, wtoken, osTarget, stOs) ||
           CheckStringFlag(kABI, wtoken, abi, stABI) ||
           CheckVersionFlag(kOsVersion, wtoken, osVersion, stOsVersion) ||
           CheckVersionFlag(kAppVersion, wtoken, appVersion, stAppVersion) ||
--- a/xpcom/components/Module.h
+++ b/xpcom/components/Module.h
@@ -62,38 +62,38 @@ struct Module
 
   /**
    * Binary compatibility check, should be kModuleVersion.
    */
   unsigned int mVersion;
 
   /**
    * An array of CIDs (class IDs) implemented by this module. The final entry
-   * should be { NULL }.
+   * should be { nullptr }.
    */
   const CIDEntry* mCIDs;
 
   /**
    * An array of mappings from contractid to CID. The final entry should
-   * be { NULL }.
+   * be { nullptr }.
    */
   const ContractIDEntry* mContractIDs;
 
   /**
    * An array of category manager entries. The final entry should be
-   * { NULL }.
+   * { nullptr }.
    */
   const CategoryEntry* mCategoryEntries;
 
   /**
    * When the component manager tries to get the factory for a CID, it first
    * checks for this module-level getfactory callback. If this function is
    * not implemented, it checks the CIDEntry getfactory callback. If that is
-   * also NULL, a generic factory is generated using the CIDEntry constructor
-   * callback which must be non-NULL.
+   * also nullptr, a generic factory is generated using the CIDEntry
+   * constructor callback which must be non-nullptr.
    */
   GetFactoryProcPtr getFactoryProc;
 
   /**
    * Optional Function which are called when this module is loaded and
    * at shutdown. These are not C++ constructor/destructors to avoid
    * calling them too early in startup or too late in shutdown.
    */
--- a/xpcom/components/ModuleUtils.h
+++ b/xpcom/components/ModuleUtils.h
@@ -13,24 +13,24 @@
 static nsresult                                                               \
 _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID,               \
                             void **aResult)                                   \
 {                                                                             \
     nsresult rv;                                                              \
                                                                               \
     _InstanceClass * inst;                                                    \
                                                                               \
-    *aResult = NULL;                                                          \
-    if (NULL != aOuter) {                                                     \
+    *aResult = nullptr;                                                       \
+    if (nullptr != aOuter) {                                                  \
         rv = NS_ERROR_NO_AGGREGATION;                                         \
         return rv;                                                            \
     }                                                                         \
                                                                               \
     inst = new _InstanceClass();                                              \
-    if (NULL == inst) {                                                       \
+    if (nullptr == inst) {                                                    \
         rv = NS_ERROR_OUT_OF_MEMORY;                                          \
         return rv;                                                            \
     }                                                                         \
     NS_ADDREF(inst);                                                          \
     rv = inst->QueryInterface(aIID, aResult);                                 \
     NS_RELEASE(inst);                                                         \
                                                                               \
     return rv;                                                                \
@@ -40,24 +40,24 @@ static nsresult                         
 static nsresult                                                               \
 _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID,               \
                             void **aResult)                                   \
 {                                                                             \
     nsresult rv;                                                              \
                                                                               \
     _InstanceClass * inst;                                                    \
                                                                               \
-    *aResult = NULL;                                                          \
-    if (NULL != aOuter) {                                                     \
+    *aResult = nullptr;                                                       \
+    if (nullptr != aOuter) {                                                  \
         rv = NS_ERROR_NO_AGGREGATION;                                         \
         return rv;                                                            \
     }                                                                         \
                                                                               \
     inst = new _InstanceClass();                                              \
-    if (NULL == inst) {                                                       \
+    if (nullptr == inst) {                                                    \
         rv = NS_ERROR_OUT_OF_MEMORY;                                          \
         return rv;                                                            \
     }                                                                         \
     NS_ADDREF(inst);                                                          \
     rv = inst->_InitMethod();                                                 \
     if(NS_SUCCEEDED(rv)) {                                                    \
         rv = inst->QueryInterface(aIID, aResult);                             \
     }                                                                         \
@@ -72,24 +72,24 @@ static nsresult                         
 static nsresult                                                               \
 _InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID,               \
                             void **aResult)                                   \
 {                                                                             \
     nsresult rv;                                                              \
                                                                               \
     _InstanceClass * inst;                                                    \
                                                                               \
-    *aResult = NULL;                                                          \
-    if (NULL != aOuter) {                                                     \
+    *aResult = nullptr;                                                       \
+    if (nullptr != aOuter) {                                                  \
         rv = NS_ERROR_NO_AGGREGATION;                                         \
         return rv;                                                            \
     }                                                                         \
                                                                               \
     inst = already_AddRefed<_InstanceClass>(_GetterProc()).get();             \
-    if (NULL == inst) {                                                       \
+    if (nullptr == inst) {                                                    \
         rv = NS_ERROR_OUT_OF_MEMORY;                                          \
         return rv;                                                            \
     }                                                                         \
     /* NS_ADDREF(inst); */                                                    \
     rv = inst->QueryInterface(aIID, aResult);                                 \
     NS_RELEASE(inst);                                                         \
                                                                               \
     return rv;                                                                \
--- a/xpcom/components/nsCategoryManager.cpp
+++ b/xpcom/components/nsCategoryManager.cpp
@@ -247,17 +247,17 @@ CategoryNode::GetLeaf(const char* aEntry
 NS_METHOD
 CategoryNode::AddLeaf(const char* aEntryName,
                       const char* aValue,
                       bool aReplace,
                       char** _retval,
                       PLArenaPool* aArena)
 {
   if (_retval)
-    *_retval = NULL;
+    *_retval = nullptr;
 
   MutexAutoLock lock(mLock);
   CategoryLeaf* leaf = 
     mTable.GetEntry(aEntryName);
 
   if (!leaf) {
     const char* arenaEntryName = ArenaStrdup(aEntryName, aArena);
     if (!arenaEntryName)
@@ -632,17 +632,17 @@ nsCategoryManager::AddCategoryEntry( con
 void
 nsCategoryManager::AddCategoryEntry(const char *aCategoryName,
                                     const char *aEntryName,
                                     const char *aValue,
                                     bool aReplace,
                                     char** aOldValue)
 {
   if (aOldValue)
-    *aOldValue = NULL;
+    *aOldValue = nullptr;
 
   // Before we can insert a new entry, we'll need to
   //  find the |CategoryNode| to put it in...
   CategoryNode* category;
   {
     MutexAutoLock lock(mLock);
     category = get_category(aCategoryName);
 
--- a/xpcom/components/nsCategoryManager.h
+++ b/xpcom/components/nsCategoryManager.h
@@ -30,17 +30,17 @@ class nsIMemoryReporter;
  * the same, except when aPersist==false. The strings are permanently arena-
  * allocated, and will never go away.
  */
 class CategoryLeaf : public nsDepCharHashKey
 {
 public:
   CategoryLeaf(const char* aKey)
     : nsDepCharHashKey(aKey),
-      value(NULL) { }
+      value(nullptr) { }
   const char* value;
 };
 
 
 /**
  * CategoryNode keeps a hashtable of its entries.
  * the CategoryNode itself is permanently allocated in
  * the arena.
@@ -109,17 +109,17 @@ public:
    * on startup while reading the stored category list.
    */
   NS_METHOD SuppressNotifications(bool aSuppress);
 
   void AddCategoryEntry(const char* aCategory,
                         const char* aKey,
                         const char* aValue,
                         bool aReplace = true,
-                        char** aOldValue = NULL);
+                        char** aOldValue = nullptr);
 
   static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
   void InitMemoryReporter();
 
   static nsCategoryManager* GetSingleton();
   static void Destroy();
 
   static int64_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
--- a/xpcom/components/nsComponentManager.h
+++ b/xpcom/components/nsComponentManager.h
@@ -206,19 +206,19 @@ public:
 
         KnownModule(const mozilla::Module* aModule)
             : mModule(aModule)
             , mLoaded(false)
             , mFailed(false)
         { }
 
         KnownModule(mozilla::FileLocation &aFile)
-            : mModule(NULL)
+            : mModule(nullptr)
             , mFile(aFile)
-            , mLoader(NULL)
+            , mLoader(nullptr)
             , mLoaded(false)
             , mFailed(false)
         { }
 
         ~KnownModule()
         {
             if (mLoaded && mModule->unloadProc)
                 mModule->unloadProc();
--- a/xpcom/components/nsNativeComponentLoader.cpp
+++ b/xpcom/components/nsNativeComponentLoader.cpp
@@ -83,17 +83,17 @@ nsNativeModuleLoader::Init()
 
 class LoadModuleMainThreadRunnable : public nsRunnable
 {
 public:
     LoadModuleMainThreadRunnable(nsNativeModuleLoader* loader,
                                  FileLocation &file)
         : mLoader(loader)
         , mFile(file)
-        , mResult(NULL)
+        , mResult(nullptr)
     { }
 
     NS_IMETHOD Run()
     {
         mResult = mLoader->LoadModule(mFile);
         return NS_OK;
     }
 
@@ -102,33 +102,33 @@ public:
     const mozilla::Module* mResult;
 };
 
 const mozilla::Module*
 nsNativeModuleLoader::LoadModule(FileLocation &aFile)
 {
     if (aFile.IsZip()) {
         NS_ERROR("Binary components cannot be loaded from JARs");
-        return NULL;
+        return nullptr;
     }
     nsCOMPtr<nsIFile> file = aFile.GetBaseFile();
     nsresult rv;
 
     if (!NS_IsMainThread()) {
         // If this call is off the main thread, synchronously proxy it
         // to the main thread.
         nsRefPtr<LoadModuleMainThreadRunnable> r = new LoadModuleMainThreadRunnable(this, aFile);
         NS_DispatchToMainThread(r, NS_DISPATCH_SYNC);
         return r->mResult;
     }
 
     nsCOMPtr<nsIHashable> hashedFile(do_QueryInterface(file));
     if (!hashedFile) {
         NS_ERROR("nsIFile is not nsIHashable");
-        return NULL;
+        return nullptr;
     }
 
     nsAutoCString filePath;
     file->GetNativePath(filePath);
 
     NativeLoadData data;
 
     if (mLibraries.Get(hashedFile, &data)) {
@@ -149,17 +149,17 @@ nsNativeModuleLoader::LoadModule(FileLoc
         char errorMsg[1024] = "<unknown; can't get error from NSPR>";
 
         if (PR_GetErrorTextLength() < (int) sizeof(errorMsg))
             PR_GetErrorText(errorMsg);
 
         LogMessage("Failed to load native module at path '%s': (%lx) %s",
                    filePath.get(), rv, errorMsg);
 
-        return NULL;
+        return nullptr;
     }
 
 #ifdef IMPLEMENT_BREAK_AFTER_LOAD
     nsAutoCString leafName;
     file->GetNativeLeafName(leafName);
 
     char *env = getenv("XPCOM_BREAK_ON_LOAD");
     char *blist;
@@ -175,26 +175,26 @@ nsNativeModuleLoader::LoadModule(FileLoc
     }
 #endif
 
     void *module = PR_FindSymbol(data.library, "NSModule");
     if (!module) {
         LogMessage("Native module at path '%s' doesn't export symbol `NSModule`.",
                    filePath.get());
         PR_UnloadLibrary(data.library);
-        return NULL;
+        return nullptr;
     }
 
     data.module = *(mozilla::Module const *const *) module;
     if (mozilla::Module::kVersion != data.module->mVersion) {
         LogMessage("Native module at path '%s' is incompatible with this version of Firefox, has version %i, expected %i.",
                    filePath.get(), data.module->mVersion,
                    mozilla::Module::kVersion);
         PR_UnloadLibrary(data.library);
-        return NULL;
+        return nullptr;
     }
         
     mLibraries.Put(hashedFile, data); // infallible
     return data.module;
 }
 
 PLDHashOperator
 nsNativeModuleLoader::ReleaserFunc(nsIHashable* aHashedFile,
--- a/xpcom/components/nsNativeComponentLoader.h
+++ b/xpcom/components/nsNativeComponentLoader.h
@@ -26,18 +26,18 @@ class nsNativeModuleLoader : public mozi
     nsresult Init();
 
     void UnloadLibraries();
 
  private:
     struct NativeLoadData
     {
         NativeLoadData()
-            : module(NULL)
-            , library(NULL)
+            : module(nullptr)
+            , library(nullptr)
         { }
 
         const mozilla::Module* module;
         PRLibrary* library;
     };
 
     static PLDHashOperator
     ReleaserFunc(nsIHashable* aHashedFile, NativeLoadData &aLoadData, void*);
--- a/xpcom/ds/TimeStamp_darwin.cpp
+++ b/xpcom/ds/TimeStamp_darwin.cpp
@@ -169,33 +169,33 @@ TimeStamp::Now(bool aHighResolution)
 
 // Computes and returns the process uptime in microseconds.
 // Returns 0 if an error was encountered.
 
 uint64_t
 TimeStamp::ComputeProcessUptime()
 {
   struct timeval tv;
-  int rv = gettimeofday(&tv, NULL);
+  int rv = gettimeofday(&tv, nullptr);
 
   if (rv == -1) {
     return 0;
   }
 
   int mib[] = {
     CTL_KERN,
     KERN_PROC,
     KERN_PROC_PID,
     getpid(),
   };
   u_int mibLen = sizeof(mib) / sizeof(mib[0]);
 
   struct kinfo_proc proc;
   size_t bufferSize = sizeof(proc);
-  rv = sysctl(mib, mibLen, &proc, &bufferSize, NULL, 0);
+  rv = sysctl(mib, mibLen, &proc, &bufferSize, nullptr, 0);
 
   if (rv == -1)
     return 0;
 
   uint64_t startTime =
     ((uint64_t)proc.kp_proc.p_un.__p_starttime.tv_sec * kUsPerSec) +
     proc.kp_proc.p_un.__p_starttime.tv_usec;
   uint64_t now = (tv.tv_sec * kUsPerSec) + tv.tv_usec;
--- a/xpcom/ds/TimeStamp_posix.cpp
+++ b/xpcom/ds/TimeStamp_posix.cpp
@@ -325,17 +325,17 @@ TimeStamp::ComputeProcessUptime()
     sizeof(KINFO_PROC),
     1,
 #endif
   };
   u_int mibLen = sizeof(mib) / sizeof(mib[0]);
 
   KINFO_PROC proc;
   size_t bufferSize = sizeof(proc);
-  rv = sysctl(mib, mibLen, &proc, &bufferSize, NULL, 0);
+  rv = sysctl(mib, mibLen, &proc, &bufferSize, nullptr, 0);
 
   if (rv == -1)
     return 0;
 
   uint64_t startTime = ((uint64_t)proc.KP_START_SEC * kNsPerSec)
     + (proc.KP_START_USEC * kNsPerUs);
   uint64_t now = ((uint64_t)ts.tv_sec * kNsPerSec) + ts.tv_nsec;
 
--- a/xpcom/ds/nsCRT.cpp
+++ b/xpcom/ds/nsCRT.cpp
@@ -60,25 +60,25 @@ char* nsCRT::strtok(char* string, const 
     if (IS_DELIM(delimTable, static_cast<uint8_t>(*str))) {
       *str++ = '\0';
       break;
     }
     str++;
   }
   *newStr = str;
 
-  return str == result ? NULL : result;
+  return str == result ? nullptr : result;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 
 /**
  * Compare unichar string ptrs, stopping at the 1st null 
  * NOTE: If both are null, we return 0.
- * NOTE: We terminate the search upon encountering a NULL
+ * NOTE: We terminate the search upon encountering a nullptr
  *
  * @update  gess 11/10/99
  * @param   s1 and s2 both point to unichar strings
  * @return  0 if they match, -1 if s1<s2; 1 if s1>s2
  */
 int32_t nsCRT::strcmp(const PRUnichar* s1, const PRUnichar* s2) {
   if(s1 && s2) {
     for (;;) {
@@ -98,17 +98,17 @@ int32_t nsCRT::strcmp(const PRUnichar* s
       return 1;
   }
   return 0;
 }
 
 /**
  * Compare unichar string ptrs, stopping at the 1st null or nth char.
  * NOTE: If either is null, we return 0.
- * NOTE: We DO NOT terminate the search upon encountering NULL's before N
+ * NOTE: We DO NOT terminate the search upon encountering nullptr's before N
  *
  * @update  gess 11/10/99
  * @param   s1 and s2 both point to unichar strings
  * @return  0 if they match, -1 if s1<s2; 1 if s1>s2
  */
 int32_t nsCRT::strncmp(const PRUnichar* s1, const PRUnichar* s2, uint32_t n) {
   if(s1 && s2) { 
     if(n != 0) {
@@ -126,30 +126,30 @@ int32_t nsCRT::strncmp(const PRUnichar* 
 }
 
 const char* nsCRT::memmem(const char* haystack, uint32_t haystackLen,
                           const char* needle, uint32_t needleLen)
 {
   // Sanity checking
   if (!(haystack && needle && haystackLen && needleLen &&
         needleLen <= haystackLen))
-    return NULL;
+    return nullptr;
 
 #ifdef HAVE_MEMMEM
   return (const char*)::memmem(haystack, haystackLen, needle, needleLen);
 #else
   // No memmem means we need to roll our own.  This isn't really optimized
   // for performance ... if that becomes an issue we can take some inspiration
   // from the js string compare code in jsstr.cpp
   for (uint32_t i = 0; i < haystackLen - needleLen; i++) {
     if (!memcmp(haystack + i, needle, needleLen))
       return haystack + i;
   }
 #endif
-  return NULL;
+  return nullptr;
 }
 
 // This should use NSPR but NSPR isn't exporting its PR_strtoll function
 // Until then...
 int64_t nsCRT::atoll(const char *str)
 {
     if (!str)
         return 0;
--- a/xpcom/ds/nsCRT.h
+++ b/xpcom/ds/nsCRT.h
@@ -104,17 +104,17 @@ public:
 
     How to use this fancy (thread-safe) version of strtok: 
 
     void main(void) {
       printf("%s\n\nTokens:\n", string);
       // Establish string and get the first token:
       char* newStr;
       token = nsCRT::strtok(string, seps, &newStr);   
-      while (token != NULL) {
+      while (token != nullptr) {
         // While there are tokens in "string"
         printf(" %s\n", token);
         // Get next token:
         token = nsCRT::strtok(newStr, seps, &newStr);
       }
     }
     * WARNING - STRTOK WHACKS str THE FIRST TIME IT IS CALLED *
     * MAKE A COPY OF str IF YOU NEED TO USE IT AFTER strtok() *
--- a/xpcom/ds/nsHashtable.cpp
+++ b/xpcom/ds/nsHashtable.cpp
@@ -114,35 +114,35 @@ nsHashKey::~nsHashKey(void)
 nsresult
 nsHashKey::Write(nsIObjectOutputStream* aStream) const
 {
     NS_NOTREACHED("oops");
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 nsHashtable::nsHashtable(uint32_t aInitSize, bool threadSafe)
-  : mLock(NULL), mEnumerating(false)
+  : mLock(nullptr), mEnumerating(false)
 {
     MOZ_COUNT_CTOR(nsHashtable);
 
     bool result = PL_DHashTableInit(&mHashtable, &hashtableOps, nullptr,
                                       sizeof(HTEntry), aInitSize);
     
     NS_ASSERTION(result, "Hashtable failed to initialize");
 
     // make sure we detect this later
     if (!result)
         mHashtable.ops = nullptr;
     
     if (threadSafe) {
         mLock = PR_NewLock();
-        if (mLock == NULL) {
+        if (mLock == nullptr) {
             // Cannot create a lock. If running on a multiprocessing system
             // we are sure to die.
-            PR_ASSERT(mLock != NULL);
+            PR_ASSERT(mLock != nullptr);
         }
     }
 }
 
 
 nsHashtable::~nsHashtable() {
     MOZ_COUNT_DTOR(nsHashtable);
     if (mHashtable.ops)
@@ -166,17 +166,17 @@ bool nsHashtable::Exists(nsHashKey *aKey
     
     if (mLock) PR_Unlock(mLock);
 
     return exists;
 }
 
 void *nsHashtable::Put(nsHashKey *aKey, void *aData)
 {
-    void *res =  NULL;
+    void *res =  nullptr;
 
     if (!mHashtable.ops) return nullptr;
     
     if (mLock) PR_Lock(mLock);
 
     // shouldn't be adding an item during enumeration
     PR_ASSERT(!mEnumerating);
     
@@ -294,17 +294,17 @@ hashEnumerateRemove(PLDHashTable*, PLDHa
         return thunk->fn(entry->key, entry->value, thunk->arg)
             ? PL_DHASH_REMOVE
             : PL_DHASH_STOP;
     }
     return PL_DHASH_REMOVE;
 }
 
 void nsHashtable::Reset() {
-    Reset(NULL);
+    Reset(nullptr);
 }
 
 void nsHashtable::Reset(nsHashtableEnumFunc destroyFunc, void* aClosure)
 {
     if (!mHashtable.ops) return;
     
     _HashEnumerateArgs thunk, *thunkp;
     if (!destroyFunc) {
@@ -526,18 +526,18 @@ nsCStringKey::Clone() const
         return new nsCStringKey(mStr, mStrLen, NEVER_OWN);
 
     // Since this might hold binary data OR a string, we ensure that the
     // clone string is zero terminated, but don't assume that the source
     // string was so terminated.
 
     uint32_t len = mStrLen * sizeof(char);
     char* str = (char*)nsMemory::Alloc(len + sizeof(char));
-    if (str == NULL)
-        return NULL;
+    if (str == nullptr)
+        return nullptr;
     memcpy(str, mStr, len);
     str[len] = 0;
     return new nsCStringKey(str, mStrLen, OWN);
 }
 
 nsCStringKey::nsCStringKey(nsIObjectInputStream* aStream, nsresult *aResult)
     : mStr(nullptr), mStrLen(0), mOwnership(OWN)
 {
@@ -649,18 +649,18 @@ nsStringKey::Equals(const nsHashKey* aKe
 nsHashKey*
 nsStringKey::Clone() const
 {
     if (mOwnership == NEVER_OWN)
         return new nsStringKey(mStr, mStrLen, NEVER_OWN);
 
     uint32_t len = (mStrLen+1) * sizeof(PRUnichar);
     PRUnichar* str = (PRUnichar*)nsMemory::Alloc(len);
-    if (str == NULL)
-        return NULL;
+    if (str == nullptr)
+        return nullptr;
     memcpy(str, mStr, len);
     return new nsStringKey(str, mStrLen, OWN);
 }
 
 nsStringKey::nsStringKey(nsIObjectInputStream* aStream, nsresult *aResult)
     : mStr(nullptr), mStrLen(0), mOwnership(OWN)
 {
     nsAutoString str;
--- a/xpcom/ds/nsHashtable.h
+++ b/xpcom/ds/nsHashtable.h
@@ -105,19 +105,19 @@ class nsHashtable {
     virtual ~nsHashtable();
 
     int32_t Count(void) { return mHashtable.entryCount; }
     bool Exists(nsHashKey *aKey);
     void *Put(nsHashKey *aKey, void *aData);
     void *Get(nsHashKey *aKey);
     void *Remove(nsHashKey *aKey);
     nsHashtable *Clone();
-    void Enumerate(nsHashtableEnumFunc aEnumFunc, void* aClosure = NULL);
+    void Enumerate(nsHashtableEnumFunc aEnumFunc, void* aClosure = nullptr);
     void Reset();
-    void Reset(nsHashtableEnumFunc destroyFunc, void* aClosure = NULL);
+    void Reset(nsHashtableEnumFunc destroyFunc, void* aClosure = nullptr);
 
     nsHashtable(nsIObjectInputStream* aStream,
                 nsHashtableReadEntryFunc aReadEntryFunc,
                 nsHashtableFreeEntryFunc aFreeEntryFunc,
                 nsresult *aRetVal);
     nsresult Write(nsIObjectOutputStream* aStream,
                    nsHashtableWriteDataFunc aWriteDataFunc) const;
 };
@@ -170,17 +170,17 @@ class nsSupportsHashtable
         return nsHashtable::Exists (aKey);
     }
     bool Put(nsHashKey *aKey,
                nsISupports *aData,
                nsISupports **value = nullptr);
     nsISupports* Get(nsHashKey *aKey);
     bool Remove(nsHashKey *aKey, nsISupports **value = nullptr);
     nsHashtable *Clone();
-    void Enumerate(nsHashtableEnumFunc aEnumFunc, void* aClosure = NULL) {
+    void Enumerate(nsHashtableEnumFunc aEnumFunc, void* aClosure = nullptr) {
         nsHashtable::Enumerate(aEnumFunc, aClosure);
     }
     void Reset();
 
   private:
     static bool ReleaseElement(nsHashKey *, void *, void *);
     static PLDHashOperator EnumerateCopy(PLDHashTable*,
                                          PLDHashEntryHdr* hdr,
--- a/xpcom/ds/nsSupportsArray.cpp
+++ b/xpcom/ds/nsSupportsArray.cpp
@@ -598,12 +598,12 @@ nsSupportsArray::Clone(nsISupportsArray*
   newArray.forget(aResult);
   return NS_OK;
 }
 
 nsresult
 NS_NewISupportsArray(nsISupportsArray** aInstancePtrResult)
 {
   nsresult rv;
-  rv = nsSupportsArray::Create(NULL, NS_GET_IID(nsISupportsArray),
+  rv = nsSupportsArray::Create(nullptr, NS_GET_IID(nsISupportsArray),
                                (void**)aInstancePtrResult);
   return rv;
 }
--- a/xpcom/ds/nsWindowsRegKey.cpp
+++ b/xpcom/ds/nsWindowsRegKey.cpp
@@ -22,18 +22,18 @@
 
 class nsWindowsRegKey MOZ_FINAL : public nsIWindowsRegKey
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIWINDOWSREGKEY
 
   nsWindowsRegKey()
-    : mKey(NULL)
-    , mWatchEvent(NULL)
+    : mKey(nullptr)
+    , mWatchEvent(nullptr)
     , mWatchRecursive(FALSE)
   {
   }
 
 private:
   ~nsWindowsRegKey()
   {
     Close();
@@ -65,17 +65,17 @@ nsWindowsRegKey::SetKey(HKEY key)
 
 NS_IMETHODIMP
 nsWindowsRegKey::Close()
 {
   StopWatching();
 
   if (mKey) {
     RegCloseKey(mKey);
-    mKey = NULL;
+    mKey = nullptr;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::Open(uint32_t rootKey, const nsAString &path, uint32_t mode)
 {
   Close();
@@ -88,17 +88,17 @@ nsWindowsRegKey::Open(uint32_t rootKey, 
 
 NS_IMETHODIMP
 nsWindowsRegKey::Create(uint32_t rootKey, const nsAString &path, uint32_t mode)
 {
   Close();
 
   DWORD disposition;
   LONG rv = RegCreateKeyExW((HKEY) rootKey, PromiseFlatString(path).get(), 0,
-                            NULL, REG_OPTION_NON_VOLATILE, (REGSAM) mode, NULL,
+                            nullptr, REG_OPTION_NON_VOLATILE, (REGSAM) mode, nullptr,
                             &mKey, &disposition);
 
   return (rv == ERROR_SUCCESS) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::OpenChild(const nsAString &path, uint32_t mode,
                            nsIWindowsRegKey **result)
@@ -132,36 +132,37 @@ nsWindowsRegKey::CreateChild(const nsASt
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::GetChildCount(uint32_t *result)
 {
   NS_ENSURE_TRUE(mKey, NS_ERROR_NOT_INITIALIZED);
 
   DWORD numSubKeys;
-  LONG rv = RegQueryInfoKeyW(mKey, NULL, NULL, NULL, &numSubKeys, NULL, NULL,
-                             NULL, NULL, NULL, NULL, NULL);
+  LONG rv = RegQueryInfoKeyW(mKey, nullptr, nullptr, nullptr, &numSubKeys,
+                             nullptr, nullptr, nullptr, nullptr, nullptr,
+                             nullptr, nullptr);
   NS_ENSURE_STATE(rv == ERROR_SUCCESS);
 
   *result = numSubKeys;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::GetChildName(uint32_t index, nsAString &result)
 {
   NS_ENSURE_TRUE(mKey, NS_ERROR_NOT_INITIALIZED);
 
   FILETIME lastWritten;
 
   PRUnichar nameBuf[MAX_KEY_NAME_LEN + 1];
   DWORD nameLen = sizeof(nameBuf) / sizeof(nameBuf[0]);
 
-  LONG rv = RegEnumKeyExW(mKey, index, nameBuf, &nameLen, NULL, NULL, NULL,
-                          &lastWritten);
+  LONG rv = RegEnumKeyExW(mKey, index, nameBuf, &nameLen, nullptr, nullptr,
+                          nullptr, &lastWritten);
   if (rv != ERROR_SUCCESS)
     return NS_ERROR_NOT_AVAILABLE;  // XXX what's the best error code here?
 
   result.Assign(nameBuf, nameLen);
  
   return NS_OK;
 }
 
@@ -184,49 +185,50 @@ nsWindowsRegKey::HasChild(const nsAStrin
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::GetValueCount(uint32_t *result)
 {
   NS_ENSURE_TRUE(mKey, NS_ERROR_NOT_INITIALIZED);
 
   DWORD numValues;
-  LONG rv = RegQueryInfoKeyW(mKey, NULL, NULL, NULL, NULL, NULL, NULL,
-                             &numValues, NULL, NULL, NULL, NULL);
+  LONG rv = RegQueryInfoKeyW(mKey, nullptr, nullptr, nullptr, nullptr,
+                             nullptr, nullptr, &numValues, nullptr, nullptr,
+                             nullptr, nullptr);
   NS_ENSURE_STATE(rv == ERROR_SUCCESS);
 
   *result = numValues;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::GetValueName(uint32_t index, nsAString &result)
 {
   NS_ENSURE_TRUE(mKey, NS_ERROR_NOT_INITIALIZED);
 
   PRUnichar nameBuf[MAX_VALUE_NAME_LEN];
   DWORD nameLen = sizeof(nameBuf) / sizeof(nameBuf[0]);
 
-  LONG rv = RegEnumValueW(mKey, index, nameBuf, &nameLen, NULL, NULL, NULL,
-                          NULL);
+  LONG rv = RegEnumValueW(mKey, index, nameBuf, &nameLen, nullptr, nullptr,
+                          nullptr, nullptr);
   if (rv != ERROR_SUCCESS)
     return NS_ERROR_NOT_AVAILABLE;  // XXX what's the best error code here?
 
   result.Assign(nameBuf, nameLen);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::HasValue(const nsAString &name, bool *result)
 {
   NS_ENSURE_TRUE(mKey, NS_ERROR_NOT_INITIALIZED);
 
-  LONG rv = RegQueryValueExW(mKey, PromiseFlatString(name).get(), 0, NULL, NULL,
-                             NULL);
+  LONG rv = RegQueryValueExW(mKey, PromiseFlatString(name).get(), 0, nullptr,
+                             nullptr, nullptr);
 
   *result = (rv == ERROR_SUCCESS);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::RemoveChild(const nsAString &name)
 {
@@ -248,31 +250,31 @@ nsWindowsRegKey::RemoveValue(const nsASt
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::GetValueType(const nsAString &name, uint32_t *result)
 {
   NS_ENSURE_TRUE(mKey, NS_ERROR_NOT_INITIALIZED);
 
   LONG rv = RegQueryValueExW(mKey, PromiseFlatString(name).get(), 0,
-                             (LPDWORD) result, NULL, NULL);
+                             (LPDWORD) result, nullptr, nullptr);
 
   return (rv == ERROR_SUCCESS) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::ReadStringValue(const nsAString &name, nsAString &result)
 {
   NS_ENSURE_TRUE(mKey, NS_ERROR_NOT_INITIALIZED);
 
   DWORD type, size;
 
   const nsString &flatName = PromiseFlatString(name);
 
-  LONG rv = RegQueryValueExW(mKey, flatName.get(), 0, &type, NULL, &size);
+  LONG rv = RegQueryValueExW(mKey, flatName.get(), 0, &type, nullptr, &size);
   if (rv != ERROR_SUCCESS)
     return NS_ERROR_FAILURE;
 
   // This must be a string type in order to fetch the value as a string.
   // We're being a bit forgiving here by allowing types other than REG_SZ.
   NS_ENSURE_STATE(type == REG_SZ ||
                   type == REG_EXPAND_SZ ||
                   type == REG_MULTI_SZ);
@@ -295,17 +297,17 @@ nsWindowsRegKey::ReadStringValue(const n
     return NS_ERROR_OUT_OF_MEMORY;
 
   rv = RegQueryValueExW(mKey, flatName.get(), 0, &type, (LPBYTE) begin.get(),
                         &size);
 
   // Expand the environment variables if needed
   if (type == REG_EXPAND_SZ) {
     const nsString &flatSource = PromiseFlatString(result);
-    resultLen = ExpandEnvironmentStringsW(flatSource.get(), NULL, 0);
+    resultLen = ExpandEnvironmentStringsW(flatSource.get(), nullptr, 0);
     if (resultLen > 0) {
       nsAutoString expandedResult;
       // |resultLen| includes the terminating null character
       --resultLen;
       expandedResult.SetLength(resultLen);
       nsAString::iterator begin;
       expandedResult.BeginWriting(begin);
       if (begin.size_forward() != resultLen)
@@ -328,53 +330,53 @@ nsWindowsRegKey::ReadStringValue(const n
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::ReadIntValue(const nsAString &name, uint32_t *result)
 {
   NS_ENSURE_TRUE(mKey, NS_ERROR_NOT_INITIALIZED);
 
   DWORD size = sizeof(*result);
-  LONG rv = RegQueryValueExW(mKey, PromiseFlatString(name).get(), 0, NULL,
+  LONG rv = RegQueryValueExW(mKey, PromiseFlatString(name).get(), 0, nullptr,
                              (LPBYTE) result, &size);
 
   return (rv == ERROR_SUCCESS) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::ReadInt64Value(const nsAString &name, uint64_t *result)
 {
   NS_ENSURE_TRUE(mKey, NS_ERROR_NOT_INITIALIZED);
 
   DWORD size = sizeof(*result);
-  LONG rv = RegQueryValueExW(mKey, PromiseFlatString(name).get(), 0, NULL,
+  LONG rv = RegQueryValueExW(mKey, PromiseFlatString(name).get(), 0, nullptr,
                              (LPBYTE) result, &size);
 
   return (rv == ERROR_SUCCESS) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::ReadBinaryValue(const nsAString &name, nsACString &result)
 {
   NS_ENSURE_TRUE(mKey, NS_ERROR_NOT_INITIALIZED);
 
   DWORD size;
   LONG rv = RegQueryValueExW(mKey, PromiseFlatString(name).get(), 0,
-                             NULL, NULL, &size);
+                             nullptr, nullptr, &size);
 
   if (rv != ERROR_SUCCESS)
     return NS_ERROR_FAILURE;
 
   result.SetLength(size);
   nsACString::iterator begin;
   result.BeginWriting(begin);
   if (begin.size_forward() != size)
     return NS_ERROR_OUT_OF_MEMORY;
 
-  rv = RegQueryValueExW(mKey, PromiseFlatString(name).get(), 0, NULL,
+  rv = RegQueryValueExW(mKey, PromiseFlatString(name).get(), 0, nullptr,
                         (LPBYTE) begin.get(), &size);
 
   return (rv == ERROR_SUCCESS) ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::WriteStringValue(const nsAString &name, const nsAString &value)
 {
@@ -427,17 +429,17 @@ nsWindowsRegKey::WriteBinaryValue(const 
 NS_IMETHODIMP
 nsWindowsRegKey::StartWatching(bool recurse)
 {
   NS_ENSURE_TRUE(mKey, NS_ERROR_NOT_INITIALIZED);
 
   if (mWatchEvent)
     return NS_OK;
   
-  mWatchEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
+  mWatchEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
   if (!mWatchEvent)
     return NS_ERROR_OUT_OF_MEMORY;
   
   DWORD filter = REG_NOTIFY_CHANGE_NAME |
                  REG_NOTIFY_CHANGE_ATTRIBUTES |
                  REG_NOTIFY_CHANGE_LAST_SET |
                  REG_NOTIFY_CHANGE_SECURITY;
 
@@ -453,17 +455,17 @@ nsWindowsRegKey::StartWatching(bool recu
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::StopWatching()
 {
   if (mWatchEvent) {
     CloseHandle(mWatchEvent);
-    mWatchEvent = NULL;
+    mWatchEvent = nullptr;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::HasChanged(bool *result)
 {
   if (mWatchEvent && WaitForSingleObject(mWatchEvent, 0) == WAIT_OBJECT_0) {
@@ -476,17 +478,17 @@ nsWindowsRegKey::HasChanged(bool *result
     *result = false;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindowsRegKey::IsWatching(bool *result)
 {
-  *result = (mWatchEvent != NULL);
+  *result = (mWatchEvent != nullptr);
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 
 nsresult
 NS_NewWindowsRegKey(nsIWindowsRegKey **result)
 {