Bug 784739 - Switch from NULL to nullptr in toolkit/components/ (1/2); r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Thu, 10 Oct 2013 16:38:05 -0400
changeset 150397 8b9687f6c60276ac3a92b21682ad932aca504877
parent 150396 01fa498691752a5998bb0a848f47a299648dc21c
child 150398 62c48f8645456e6d7eb5988b7a7d96916c91234e
push id2991
push userkwierso@gmail.com
push dateFri, 11 Oct 2013 02:10:33 +0000
treeherderfx-team@98b44fcfebb2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs784739
milestone27.0a1
Bug 784739 - Switch from NULL to nullptr in toolkit/components/ (1/2); r=ehsan
toolkit/components/maintenanceservice/workmonitor.cpp
toolkit/components/mediasniffer/nsMediaSnifferModule.cpp
toolkit/components/parentalcontrols/nsParentalControlsServiceWin.cpp
toolkit/components/perf/PerfMeasurement.cpp
toolkit/components/places/AsyncFaviconHelpers.cpp
toolkit/components/places/Helpers.cpp
toolkit/components/places/History.cpp
toolkit/components/places/PlaceInfo.cpp
toolkit/components/places/nsFaviconService.cpp
toolkit/components/places/nsNavHistory.cpp
toolkit/components/places/nsNavHistory.h
toolkit/components/places/nsNavHistoryQuery.cpp
toolkit/components/places/nsNavHistoryResult.cpp
toolkit/components/places/nsPlacesModule.cpp
toolkit/components/places/tests/cpp/test_IHistory.cpp
toolkit/components/reflect/reflect.cpp
toolkit/components/remote/nsGTKRemoteService.cpp
toolkit/components/remote/nsGTKRemoteService.h
toolkit/components/remote/nsQtRemoteService.cpp
toolkit/components/remote/nsXRemoteService.cpp
toolkit/components/satchel/nsFormFillController.cpp
toolkit/components/startup/nsAppStartup.cpp
toolkit/components/startup/nsUserInfoWin.cpp
toolkit/components/telemetry/Telemetry.cpp
--- a/toolkit/components/maintenanceservice/workmonitor.cpp
+++ b/toolkit/components/maintenanceservice/workmonitor.cpp
@@ -52,26 +52,26 @@ IsStatusApplying(LPCWSTR updateDirPath, 
     LOG_WARN(("Could not append path for update.status file"));
     return FALSE;
   }
 
   nsAutoHandle statusFile(CreateFileW(updateStatusFilePath, GENERIC_READ,
                                       FILE_SHARE_READ | 
                                       FILE_SHARE_WRITE | 
                                       FILE_SHARE_DELETE,
-                                      NULL, OPEN_EXISTING, 0, NULL));
+                                      nullptr, OPEN_EXISTING, 0, nullptr));
 
   if (INVALID_HANDLE_VALUE == statusFile) {
     LOG_WARN(("Could not open update.status file"));
     return FALSE;
   }
 
   char buf[32] = { 0 };
   DWORD read;
-  if (!ReadFile(statusFile, buf, sizeof(buf), &read, NULL)) {
+  if (!ReadFile(statusFile, buf, sizeof(buf), &read, nullptr)) {
     LOG_WARN(("Could not read from update.status file"));
     return FALSE;
   }
 
   LOG(("updater.exe returned status: %s", buf));
 
   const char kApplying[] = "applying";
   isApplying = strncmp(buf, kApplying, 
@@ -174,20 +174,20 @@ StartUpdateProcess(int argc,
   }
 
   // Add an env var for MOZ_USING_SERVICE so the updater.exe can
   // do anything special that it needs to do for service updates.
   // Search in updater.cpp for more info on MOZ_USING_SERVICE.
   putenv(const_cast<char*>("MOZ_USING_SERVICE=1"));
   LOG(("Starting service with cmdline: %ls", cmdLine));
   processStarted = CreateProcessW(argv[0], cmdLine, 
-                                  NULL, NULL, FALSE, 
+                                  nullptr, nullptr, FALSE, 
                                   CREATE_DEFAULT_ERROR_MODE, 
-                                  NULL, 
-                                  NULL, &si, &pi);
+                                  nullptr, 
+                                  nullptr, &si, &pi);
   // Empty value on putenv is how you remove an env variable in Windows
   putenv(const_cast<char*>("MOZ_USING_SERVICE="));
   
   BOOL updateWasSuccessful = FALSE;
   if (processStarted) {
     // Wait for the updater process to finish
     LOG(("Process was started... waiting on result."));
     DWORD waitRes = WaitForSingleObject(pi.hProcess, TIME_TO_WAIT_ON_UPDATER);
@@ -258,17 +258,17 @@ StartUpdateProcess(int argc,
       // the unelevated updater.exe after the update process is complete
       // from the service.  We don't know here which session to start
       // the user PostUpdate process from.
       // Note that we don't need to do this if we're just staging the
       // update in the background, as the PostUpdate step runs when
       // performing the replacing in that case.
       if (!backgroundUpdate) {
         LOG(("Launching post update process as the service in session 0."));
-        if (!LaunchWinPostProcess(installDir, updateInfoDir, true, NULL)) {
+        if (!LaunchWinPostProcess(installDir, updateInfoDir, true, nullptr)) {
           LOG_WARN(("The post update process could not be launched."
                     " installDir: %ls, updateInfoDir: %ls",
                     installDir, updateInfoDir));
         }
       }
     }
   }
 
@@ -324,17 +324,17 @@ ProcessSoftwareUpdateCommand(DWORD argc,
                             SERVICE_UPDATER_NOT_FIXED_DRIVE)) {
       LOG_WARN(("Could not write update.status service update failure.  (%d)",
                 GetLastError()));
     }
     return FALSE;
   }
 
   nsAutoHandle noWriteLock(CreateFileW(argv[0], GENERIC_READ, FILE_SHARE_READ, 
-                                       NULL, OPEN_EXISTING, 0, NULL));
+                                       nullptr, OPEN_EXISTING, 0, nullptr));
   if (INVALID_HANDLE_VALUE == noWriteLock) {
       LOG_WARN(("Could not set no write sharing access on file.  (%d)",
                 GetLastError()));
     if (!WriteStatusFailure(argv[1], 
                             SERVICE_COULD_NOT_LOCK_UPDATER)) {
       LOG_WARN(("Could not write update.status service update failure.  (%d)",
                 GetLastError()));
     }
@@ -373,17 +373,17 @@ ProcessSoftwareUpdateCommand(DWORD argc,
       LOG_WARN(("Could not write update.status updater compare failure."));
     }
     return FALSE;
   }
 
   // Check to make sure the updater.exe module has the unique updater identity.
   // This is a security measure to make sure that the signed executable that
   // we will run is actually an updater.
-  HMODULE updaterModule = LoadLibraryEx(argv[0], NULL, 
+  HMODULE updaterModule = LoadLibraryEx(argv[0], nullptr, 
                                         LOAD_LIBRARY_AS_DATAFILE);
   if (!updaterModule) {
     LOG_WARN(("updater.exe module could not be loaded. (%d)", GetLastError()));
     result = FALSE;
   } else {
     char updaterIdentity[64];
     if (!LoadStringA(updaterModule, IDS_UPDATER_IDENTITY, 
                      updaterIdentity, sizeof(updaterIdentity))) {
@@ -474,17 +474,17 @@ ProcessSoftwareUpdateCommand(DWORD argc,
  *
  * @param serviceUpdaterPath Out parameter for the path where the updater
  *                           should be copied to.
  * @return TRUE if a file path was obtained.
  */
 BOOL
 GetSecureUpdaterPath(WCHAR serviceUpdaterPath[MAX_PATH + 1])
 {
-  if (!GetModuleFileNameW(NULL, serviceUpdaterPath, MAX_PATH)) {
+  if (!GetModuleFileNameW(nullptr, serviceUpdaterPath, MAX_PATH)) {
     LOG_WARN(("Could not obtain module filename when attempting to "
               "use a secure updater path.  (%d)", GetLastError()));
     return FALSE;
   }
 
   if (!PathRemoveFileSpecW(serviceUpdaterPath)) {
     LOG_WARN(("Couldn't remove file spec when attempting to use a secure "
               "updater path.  (%d)", GetLastError()));
@@ -492,17 +492,17 @@ GetSecureUpdaterPath(WCHAR serviceUpdate
   }
 
   if (!PathAppendSafe(serviceUpdaterPath, L"update")) {
     LOG_WARN(("Couldn't append file spec when attempting to use a secure "
               "updater path.  (%d)", GetLastError()));
     return FALSE;
   }
 
-  CreateDirectoryW(serviceUpdaterPath, NULL);
+  CreateDirectoryW(serviceUpdaterPath, nullptr);
 
   if (!PathAppendSafe(serviceUpdaterPath, L"updater.exe")) {
     LOG_WARN(("Couldn't append file spec when attempting to use a secure "
               "updater path.  (%d)", GetLastError()));
     return FALSE;
   }
 
   return TRUE;
--- a/toolkit/components/mediasniffer/nsMediaSnifferModule.cpp
+++ b/toolkit/components/mediasniffer/nsMediaSnifferModule.cpp
@@ -7,29 +7,29 @@
 
 #include "nsMediaSniffer.h"
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsMediaSniffer)
 
 NS_DEFINE_NAMED_CID(NS_MEDIA_SNIFFER_CID);
 
 static const mozilla::Module::CIDEntry kMediaSnifferCIDs[] = {
-    { &kNS_MEDIA_SNIFFER_CID, false, NULL, nsMediaSnifferConstructor },
-    { NULL }
+    { &kNS_MEDIA_SNIFFER_CID, false, nullptr, nsMediaSnifferConstructor },
+    { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kMediaSnifferContracts[] = {
     { NS_MEDIA_SNIFFER_CONTRACTID, &kNS_MEDIA_SNIFFER_CID },
-    { NULL }
+    { nullptr }
 };
 
 static const mozilla::Module::CategoryEntry kMediaSnifferCategories[] = {
     { "content-sniffing-services", NS_MEDIA_SNIFFER_CONTRACTID, NS_MEDIA_SNIFFER_CONTRACTID},
     { "net-content-sniffers", NS_MEDIA_SNIFFER_CONTRACTID, NS_MEDIA_SNIFFER_CONTRACTID},
-    { NULL }
+    { nullptr }
 };
 
 static const mozilla::Module kMediaSnifferModule = {
     mozilla::Module::kVersion,
     kMediaSnifferCIDs,
     kMediaSnifferContracts,
     kMediaSnifferCategories
 };
--- a/toolkit/components/parentalcontrols/nsParentalControlsServiceWin.cpp
+++ b/toolkit/components/parentalcontrols/nsParentalControlsServiceWin.cpp
@@ -14,51 +14,51 @@
 #include "nsArrayUtils.h"
 #include "nsIXULAppInfo.h"
 
 static const CLSID CLSID_WinParentalControls = {0xE77CC89B,0x7401,0x4C04,{0x8C,0xED,0x14,0x9D,0xB3,0x5A,0xDD,0x04}};
 static const IID IID_IWinParentalControls  = {0x28B4D88B,0xE072,0x49E6,{0x80,0x4D,0x26,0xED,0xBE,0x21,0xA7,0xB9}};
 
 NS_IMPL_ISUPPORTS1(nsParentalControlsServiceWin, nsIParentalControlsService)
 
-static HINSTANCE gAdvAPIDLLInst = NULL;
+static HINSTANCE gAdvAPIDLLInst = nullptr;
 
 typedef ULONG (STDMETHODCALLTYPE *MyEventWrite)(
   REGHANDLE RegHandle,
   PCEVENT_DESCRIPTOR EventDescriptor,
   ULONG UserDataCount,
   PEVENT_DATA_DESCRIPTOR UserData);
 
 typedef ULONG (STDMETHODCALLTYPE *MyEventRegister)(
   LPCGUID ProviderId,
   PENABLECALLBACK EnableCallback,
   PVOID CallbackContext,
   PREGHANDLE RegHandle);
 
 typedef ULONG (STDMETHODCALLTYPE *MyEventUnregister)(
   REGHANDLE RegHandle);
 
-MyEventWrite gEventWrite = NULL;
-MyEventRegister gEventRegister = NULL;
-MyEventUnregister gEventUnregister = NULL;
+MyEventWrite gEventWrite = nullptr;
+MyEventRegister gEventRegister = nullptr;
+MyEventUnregister gEventUnregister = nullptr;
 
 nsParentalControlsServiceWin::nsParentalControlsServiceWin() :
   mEnabled(false)
 , mProvider(0)
 , mPC(nullptr)
 {
   HRESULT hr;
-  CoInitialize(NULL);
-  hr = CoCreateInstance(CLSID_WinParentalControls, NULL, CLSCTX_INPROC,
+  CoInitialize(nullptr);
+  hr = CoCreateInstance(CLSID_WinParentalControls, nullptr, CLSCTX_INPROC,
                         IID_IWinParentalControls, (void**)&mPC);
   if (FAILED(hr))
     return;
 
   nsRefPtr<IWPCSettings> wpcs;
-  if (FAILED(mPC->GetUserSettings(NULL, getter_AddRefs(wpcs)))) {
+  if (FAILED(mPC->GetUserSettings(nullptr, getter_AddRefs(wpcs)))) {
     // Not available on this os or not enabled for this user account or we're running as admin
     mPC->Release();
     mPC = nullptr;
     return;
   }
 
   DWORD settings = 0;
   wpcs->GetRestrictions(&settings);
@@ -104,17 +104,17 @@ NS_IMETHODIMP
 nsParentalControlsServiceWin::GetBlockFileDownloadsEnabled(bool *aResult)
 {
   *aResult = false;
 
   if (!mEnabled)
     return NS_ERROR_NOT_AVAILABLE;
 
   nsRefPtr<IWPCWebSettings> wpcws;
-  if (SUCCEEDED(mPC->GetWebSettings(NULL, getter_AddRefs(wpcws)))) {
+  if (SUCCEEDED(mPC->GetWebSettings(nullptr, getter_AddRefs(wpcws)))) {
     DWORD settings = 0;
     wpcws->GetSettings(&settings);
     if (settings == WPCFLAG_WEB_SETTING_DOWNLOADSBLOCKED)
       *aResult = true;
   }
 
   return NS_OK;
 }
@@ -124,17 +124,17 @@ nsParentalControlsServiceWin::GetLogging
 {
   *aResult = false;
 
   if (!mEnabled)
     return NS_ERROR_NOT_AVAILABLE;
 
   // Check the general purpose logging flag
   nsRefPtr<IWPCSettings> wpcs;
-  if (SUCCEEDED(mPC->GetUserSettings(NULL, getter_AddRefs(wpcs)))) {
+  if (SUCCEEDED(mPC->GetUserSettings(nullptr, getter_AddRefs(wpcs)))) {
     BOOL enabled = FALSE;
     wpcs->IsLoggingRequired(&enabled);
     if (enabled)
       *aResult = true;
   }
 
   return NS_OK;
 }
@@ -153,17 +153,17 @@ nsParentalControlsServiceWin::Log(int16_
   GetLoggingEnabled(&enabled);
   if (!enabled)
     return NS_ERROR_NOT_AVAILABLE;
 
   // Register a Vista log event provider associated with the parental controls channel.
   if (!mProvider) {
     if (!gEventRegister)
       return NS_ERROR_NOT_AVAILABLE;
-    if (gEventRegister(&WPCPROV, NULL, NULL, &mProvider) != ERROR_SUCCESS)
+    if (gEventRegister(&WPCPROV, nullptr, nullptr, &mProvider) != ERROR_SUCCESS)
       return NS_ERROR_OUT_OF_MEMORY;
   }
 
   switch(aEntryType) {
     case ePCLog_URIVisit:
       // Not needed, Vista's web content filter handles this for us
       break;
     case ePCLog_FileDownload:
@@ -197,19 +197,19 @@ nsParentalControlsServiceWin::RequestURI
   nsCOMPtr<nsIWidget> widget(do_GetInterface(aWindowContext));
   if (widget)
     hWnd = (HWND)widget->GetNativeData(NS_NATIVE_WINDOW);
   if (hWnd == nullptr)
     hWnd = GetDesktopWindow();
 
   BOOL ret;
   nsRefPtr<IWPCWebSettings> wpcws;
-  if (SUCCEEDED(mPC->GetWebSettings(NULL, getter_AddRefs(wpcws)))) {
+  if (SUCCEEDED(mPC->GetWebSettings(nullptr, getter_AddRefs(wpcws)))) {
     wpcws->RequestURLOverride(hWnd, NS_ConvertUTF8toUTF16(spec).get(),
-                              0, NULL, &ret);
+                              0, nullptr, &ret);
     *_retval = ret;
   }
 
 
   return NS_OK;
 }
 
 // Override a web page
@@ -277,17 +277,17 @@ nsParentalControlsServiceWin::RequestURI
     uriIdx++;
   }
 
   if (!uriIdx)
     return NS_ERROR_INVALID_ARG;
 
   BOOL ret; 
   nsRefPtr<IWPCWebSettings> wpcws;
-  if (SUCCEEDED(mPC->GetWebSettings(NULL, getter_AddRefs(wpcws)))) {
+  if (SUCCEEDED(mPC->GetWebSettings(nullptr, getter_AddRefs(wpcws)))) {
     wpcws->RequestURLOverride(hWnd, NS_ConvertUTF8toUTF16(rootSpec).get(),
                              uriIdx, (LPCWSTR*)arrUrls.get(), &ret);
    *_retval = ret;
   }
 
   // Free up the allocated strings in our array
   for (idx = 0; idx < uriIdx; idx++)
     NS_Free((void*)arrUrls[idx]);
--- a/toolkit/components/perf/PerfMeasurement.cpp
+++ b/toolkit/components/perf/PerfMeasurement.cpp
@@ -96,23 +96,23 @@ Module::Call(nsIXPConnectWrappedNative* 
 }
 
 }
 }
 
 NS_DEFINE_NAMED_CID(JSPERF_CID);
 
 static const mozilla::Module::CIDEntry kPerfCIDs[] = {
-  { &kJSPERF_CID, false, NULL, mozilla::jsperf::ModuleConstructor },
-  { NULL }
+  { &kJSPERF_CID, false, nullptr, mozilla::jsperf::ModuleConstructor },
+  { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kPerfContracts[] = {
   { JSPERF_CONTRACTID, &kJSPERF_CID },
-  { NULL }
+  { nullptr }
 };
 
 static const mozilla::Module kPerfModule = {
   mozilla::Module::kVersion,
   kPerfCIDs,
   kPerfContracts
 };
 
--- a/toolkit/components/places/AsyncFaviconHelpers.cpp
+++ b/toolkit/components/places/AsyncFaviconHelpers.cpp
@@ -84,17 +84,17 @@ FetchPageInfo(nsRefPtr<Database>& aDB,
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   rv = stmt->GetInt64(0, &_page.id);
   NS_ENSURE_SUCCESS(rv, rv);
   bool isNull;
   rv = stmt->GetIsNull(1, &isNull);
   NS_ENSURE_SUCCESS(rv, rv);
-  // favicon_id can be NULL.
+  // favicon_id can be nullptr.
   if (!isNull) {
     rv = stmt->GetInt64(1, &_page.iconId);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   rv = stmt->GetUTF8String(2, _page.guid);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = stmt->GetIsNull(3, &isNull);
   NS_ENSURE_SUCCESS(rv, rv);
@@ -219,26 +219,26 @@ FetchIconInfo(nsRefPtr<Database>& aDB,
   if (!hasResult) {
     // The icon does not exist yet, bail out.
     return NS_OK;
   }
 
   rv = stmt->GetInt64(0, &_icon.id);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  // Expiration can be NULL.
+  // Expiration can be nullptr.
   bool isNull;
   rv = stmt->GetIsNull(1, &isNull);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!isNull) {
     rv = stmt->GetInt64(1, reinterpret_cast<int64_t*>(&_icon.expiration));
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  // Data can be NULL.
+  // Data can be nullptr.
   rv = stmt->GetIsNull(2, &isNull);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!isNull) {
     uint8_t* data;
     uint32_t dataLen = 0;
     rv = stmt->GetBlob(2, &dataLen, &data);
     NS_ENSURE_SUCCESS(rv, rv);
     _icon.data.Adopt(TO_CHARBUFFER(data), dataLen);
--- a/toolkit/components/places/Helpers.cpp
+++ b/toolkit/components/places/Helpers.cpp
@@ -205,18 +205,18 @@ ReverseString(const nsString& aInput, ns
 }
 
 static
 nsresult
 Base64urlEncode(const uint8_t* aBytes,
                 uint32_t aNumBytes,
                 nsCString& _result)
 {
-  // SetLength does not set aside space for NULL termination.  PL_Base64Encode
-  // will not NULL terminate, however, nsCStrings must be NULL terminated.  As a
+  // SetLength does not set aside space for null termination.  PL_Base64Encode
+  // will not null terminate, however, nsCStrings must be null terminated.  As a
   // result, we set the capacity to be one greater than what we need, and the
   // length to our desired length.
   uint32_t length = (aNumBytes + 2) / 3 * 4; // +2 due to integer math.
   NS_ENSURE_TRUE(_result.SetCapacity(length + 1, fallible_t()),
                  NS_ERROR_OUT_OF_MEMORY);
   _result.SetLength(length);
   (void)PL_Base64Encode(reinterpret_cast<const char*>(aBytes), aNumBytes,
                         _result.BeginWriting());
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -79,17 +79,17 @@ struct VisitData {
   , titleChanged(false)
   , shouldUpdateFrecency(true)
   {
     guid.SetIsVoid(true);
     title.SetIsVoid(true);
   }
 
   VisitData(nsIURI* aURI,
-            nsIURI* aReferrer = NULL)
+            nsIURI* aReferrer = nullptr)
   : placeId(0)
   , visitId(0)
   , hidden(true)
   , typed(false)
   , transitionType(UINT32_MAX)
   , visitTime(0)
   , frecency(-1)
   , titleChanged(false)
@@ -782,17 +782,17 @@ private:
  *        The guid of the URI to check.  This is passed back to the callback.
  * @param [optional] aCallback
  *        The callback to notify if the URI cannot be added to history.
  * @return true if the URI can be added to history, false otherwise.
  */
 bool
 CanAddURI(nsIURI* aURI,
           const nsCString& aGUID = EmptyCString(),
-          mozIVisitInfoCallback* aCallback = NULL)
+          mozIVisitInfoCallback* aCallback = nullptr)
 {
   nsNavHistory* navHistory = nsNavHistory::GetHistoryService();
   NS_ENSURE_TRUE(navHistory, false);
 
   bool canAdd;
   nsresult rv = navHistory->CanAddURI(aURI, &canAdd);
   if (NS_SUCCEEDED(rv) && canAdd) {
     return true;
@@ -833,17 +833,17 @@ public:
    *        The database connection to use for these operations.
    * @param aPlaces
    *        The locations to record visits.
    * @param [optional] aCallback
    *        The callback to notify about the visit.
    */
   static nsresult Start(mozIStorageConnection* aConnection,
                         nsTArray<VisitData>& aPlaces,
-                        mozIVisitInfoCallback* aCallback = NULL)
+                        mozIVisitInfoCallback* aCallback = nullptr)
   {
     MOZ_ASSERT(NS_IsMainThread(), "This should be called on the main thread");
     MOZ_ASSERT(aPlaces.Length() > 0, "Must pass a non-empty array!");
 
     nsRefPtr<InsertVisitedURIs> event =
       new InsertVisitedURIs(aConnection, aPlaces, aCallback);
 
     // Get the target thread, and then start the work!
@@ -864,17 +864,17 @@ public:
     if (mHistory->IsShuttingDown()) {
       // If we were already shutting down, we cannot insert the URIs.
       return NS_OK;
     }
 
     mozStorageTransaction transaction(mDBConn, false,
                                       mozIStorageConnection::TRANSACTION_IMMEDIATE);
 
-    VisitData* lastPlace = NULL;
+    VisitData* lastPlace = nullptr;
     for (nsTArray<VisitData>::size_type i = 0; i < mPlaces.Length(); i++) {
       VisitData& place = mPlaces.ElementAt(i);
       VisitData& referrer = mReferrers.ElementAt(i);
 
       // We can avoid a database lookup if it's the same place as the last
       // visit we added.
       bool known = lastPlace && lastPlace->IsSamePlaceAs(place);
       if (!known) {
@@ -1867,17 +1867,17 @@ private:
  *
  * @param aPlace
  *        The VisitData of the visit to store as an embed visit.
  * @param [optional] aCallback
  *        The mozIVisitInfoCallback to notify, if provided.
  */
 void
 StoreAndNotifyEmbedVisit(VisitData& aPlace,
-                         mozIVisitInfoCallback* aCallback = NULL)
+                         mozIVisitInfoCallback* aCallback = nullptr)
 {
   MOZ_ASSERT(aPlace.transitionType == nsINavHistoryService::TRANSITION_EMBED,
              "Must only pass TRANSITION_EMBED visits to this!");
   MOZ_ASSERT(NS_IsMainThread(), "Must be called on the main thread!");
 
   nsCOMPtr<nsIURI> uri;
   (void)NS_NewURI(getter_AddRefs(uri), aPlace.spec);
 
@@ -1925,17 +1925,17 @@ private:
   }
 };
 
 } // anonymous namespace
 
 ////////////////////////////////////////////////////////////////////////////////
 //// History
 
-History* History::gService = NULL;
+History* History::gService = nullptr;
 
 History::History()
   : mShuttingDown(false)
   , mShutdownMutex("History::mShutdownMutex")
   , mObservers(VISIT_OBSERVERS_INITIAL_CACHE_SIZE)
   , mRecentlyVisitedURIsNextIndex(0)
 {
   NS_ASSERTION(!gService, "Ruh-roh!  This service has already been created!");
@@ -2466,29 +2466,29 @@ History::RegisterVisitedCallback(nsIURI*
     NS_ASSERTION(!keyAlreadyExists,
                  "An empty key was kept around in our hashtable!");
 
     // We are the first Link node to ask about this URI, or there are no pending
     // Links wanting to know about this URI.  Therefore, we should query the
     // database now.
     nsresult rv = VisitedQuery::Start(aURI);
 
-    // In IPC builds, we are passed a NULL Link from
-    // ContentParent::RecvStartVisitedQuery.  Since we won't be adding a NULL
-    // entry to our list of observers, and the code after this point assumes
-    // that aLink is non-NULL, we will need to return now.
+    // In IPC builds, we are passed a nullptr Link from
+    // ContentParent::RecvStartVisitedQuery.  Since we won't be adding a
+    // nullptr entry to our list of observers, and the code after this point
+    // assumes that aLink is non-nullptr, we will need to return now.
     if (NS_FAILED(rv) || !aLink) {
       // Remove our array from the hashtable so we don't keep it around.
       mObservers.RemoveEntry(aURI);
       return rv;
     }
   }
-  // In IPC builds, we are passed a NULL Link from
+  // In IPC builds, we are passed a nullptr Link from
   // ContentParent::RecvStartVisitedQuery.  All of our code after this point
-  // assumes aLink is non-NULL, so we have to return now.
+  // assumes aLink is non-nullptr, so we have to return now.
   else if (!aLink) {
     NS_ASSERTION(XRE_GetProcessType() == GeckoProcessType_Default,
                  "We should only ever get a null Link in the default process!");
     return NS_OK;
   }
 
   // Sanity check that Links are not registered more than once for a given URI.
   // This will not catch a case where it is registered for two different URIs.
--- a/toolkit/components/places/PlaceInfo.cpp
+++ b/toolkit/components/places/PlaceInfo.cpp
@@ -95,17 +95,18 @@ PlaceInfo::GetVisits(JSContext* aContext
   // of a place without any visit.
   if (!mVisitsAvailable) {
     *_visits = JSVAL_NULL;
     return NS_OK;
   }
 
   // TODO bug 625913 when we use this in situations that have more than one
   // visit here, we will likely want to make this cache the value.
-  JS::Rooted<JSObject*> visits(aContext, JS_NewArrayObject(aContext, 0, NULL));
+  JS::Rooted<JSObject*> visits(aContext,
+                               JS_NewArrayObject(aContext, 0, nullptr));
   NS_ENSURE_TRUE(visits, NS_ERROR_OUT_OF_MEMORY);
 
   JS::Rooted<JSObject*> global(aContext, JS::CurrentGlobalOrNull(aContext));
   NS_ENSURE_TRUE(global, NS_ERROR_UNEXPECTED);
 
   nsCOMPtr<nsIXPConnect> xpc = mozilla::services::GetXPConnect();
 
   for (VisitsArray::size_type idx = 0; idx < mVisits.Length(); idx++) {
--- a/toolkit/components/places/nsFaviconService.cpp
+++ b/toolkit/components/places/nsFaviconService.cpp
@@ -61,17 +61,17 @@ class ExpireFaviconsStatementCallbackNot
 public:
   ExpireFaviconsStatementCallbackNotifier();
   NS_IMETHOD HandleCompletion(uint16_t aReason);
 };
 
 
 PLACES_FACTORY_SINGLETON_IMPLEMENTATION(nsFaviconService, gFaviconService)
 
-NS_IMPL_CLASSINFO(nsFaviconService, NULL, 0, NS_FAVICONSERVICE_CID)
+NS_IMPL_CLASSINFO(nsFaviconService, nullptr, 0, NS_FAVICONSERVICE_CID)
 NS_IMPL_ISUPPORTS3_CI(
   nsFaviconService
 , nsIFaviconService
 , mozIAsyncFavicons
 , nsITimerCallback
 )
 
 nsFaviconService::nsFaviconService()
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -157,17 +157,17 @@ static const char* kObservedPrefs[] = {
 , PREF_FREC_UNVISITED_BOOKMARK_BONUS
 , PREF_FREC_UNVISITED_TYPED_BONUS
 , nullptr
 };
 
 NS_IMPL_ADDREF(nsNavHistory)
 NS_IMPL_RELEASE(nsNavHistory)
 
-NS_IMPL_CLASSINFO(nsNavHistory, NULL, nsIClassInfo::SINGLETON,
+NS_IMPL_CLASSINFO(nsNavHistory, nullptr, nsIClassInfo::SINGLETON,
                   NS_NAVHISTORYSERVICE_CID)
 NS_INTERFACE_MAP_BEGIN(nsNavHistory)
   NS_INTERFACE_MAP_ENTRY(nsINavHistoryService)
   NS_INTERFACE_MAP_ENTRY(nsIBrowserHistory)
   NS_INTERFACE_MAP_ENTRY(nsIObserver)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
   NS_INTERFACE_MAP_ENTRY(nsPIPlacesDatabase)
   NS_INTERFACE_MAP_ENTRY(nsPIPlacesHistoryListenersNotifier)
--- a/toolkit/components/places/nsNavHistory.h
+++ b/toolkit/components/places/nsNavHistory.h
@@ -91,17 +91,17 @@ public:
   /**
    * Initializes the nsNavHistory object.  This should only be called once.
    */
   nsresult Init();
 
   /**
    * Used by other components in the places directory such as the annotation
    * service to get a reference to this history object. Returns a pointer to
-   * the service if it exists. Otherwise creates one. Returns NULL on error.
+   * the service if it exists. Otherwise creates one. Returns nullptr on error.
    */
   static nsNavHistory* GetHistoryService()
   {
     if (!gHistoryService) {
       nsCOMPtr<nsINavHistoryService> serv =
         do_GetService(NS_NAVHISTORYSERVICE_CONTRACTID);
       NS_ENSURE_TRUE(serv, nullptr);
       NS_ASSERTION(gHistoryService, "Should have static instance pointer now");
@@ -109,17 +109,17 @@ public:
     return gHistoryService;
   }
 
   /**
    * Used by other components in the places directory to get a reference to a
    * const version of this history object.
    *
    * @return A pointer to a const version of the service if it exists,
-   *         NULL otherwise.
+   *         nullptr otherwise.
    */
   static const nsNavHistory* GetConstHistoryService()
   {
     const nsNavHistory* const history = gHistoryService;
     return history;
   }
 
   /**
@@ -442,17 +442,17 @@ protected:
   nsresult CalculateFrecencyInternal(int64_t aPageID, int32_t aTyped, int32_t aVisitCount, bool aIsBookmarked, int32_t *aFrecency);
 
   nsresult RemovePagesInternal(const nsCString& aPlaceIdsQueryString);
   nsresult CleanupPlacesOnVisitsDelete(const nsCString& aPlaceIdsQueryString);
 
   /**
    * Loads all of the preferences that we use into member variables.
    *
-   * @note If mPrefBranch is NULL, this does nothing.
+   * @note If mPrefBranch is nullptr, this does nothing.
    */
   void LoadPrefs();
 
   /**
    * Calculates and returns value for mCachedNow.
    * This is an hack to avoid calling PR_Now() too often, as is the case when
    * we're asked the ageindays of many history entries in a row.  A timer is
    * set which will clear our valid flag after a short timeout.
--- a/toolkit/components/places/nsNavHistoryQuery.cpp
+++ b/toolkit/components/places/nsNavHistoryQuery.cpp
@@ -25,17 +25,17 @@ class QueryKeyValuePair
 {
 public:
 
   // QueryKeyValuePair
   //
   //                  01234567890
   //    input : qwerty&key=value&qwerty
   //                  ^   ^     ^
-  //          aKeyBegin   |     aPastEnd (may point to NULL terminator)
+  //          aKeyBegin   |     aPastEnd (may point to null terminator)
   //                      aEquals
   //
   //    Special case: if aKeyBegin == aEquals, then there is only one string
   //    and no equal sign, so we treat the entire thing as a key with no value
 
   QueryKeyValuePair(const nsCSubstring& aSource, int32_t aKeyBegin,
                     int32_t aEquals, int32_t aPastEnd)
   {
--- a/toolkit/components/places/nsNavHistoryResult.cpp
+++ b/toolkit/components/places/nsNavHistoryResult.cpp
@@ -1628,18 +1628,18 @@ nsNavHistoryContainerResultNode::ChangeT
                                               bool aOnlyOne)
 {
   // uri string
   nsAutoCString uriString;
   nsresult rv = aURI->GetSpec(uriString);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // The recursive function will update the result's tree nodes, but only if we
-  // give it a non-null pointer.  So if there isn't a tree, just pass NULL so
-  // it doesn't bother trying to call the result.
+  // give it a non-null pointer.  So if there isn't a tree, just pass nullptr
+  // so it doesn't bother trying to call the result.
   nsNavHistoryResult* result = GetResult();
   NS_ENSURE_STATE(result);
 
   uint16_t sortType = GetSortType();
   bool updateSorting =
     (sortType == nsINavHistoryQueryOptions::SORT_BY_TITLE_ASCENDING ||
      sortType == nsINavHistoryQueryOptions::SORT_BY_TITLE_DESCENDING);
 
--- a/toolkit/components/places/nsPlacesModule.cpp
+++ b/toolkit/components/places/nsPlacesModule.cpp
@@ -29,40 +29,40 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsAnnoPro
 NS_DEFINE_NAMED_CID(NS_NAVHISTORYSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_ANNOTATIONSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_ANNOPROTOCOLHANDLER_CID);
 NS_DEFINE_NAMED_CID(NS_NAVBOOKMARKSSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_FAVICONSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_HISTORYSERVICE_CID);
 
 const mozilla::Module::CIDEntry kPlacesCIDs[] = {
-  { &kNS_NAVHISTORYSERVICE_CID, false, NULL, nsNavHistoryConstructor },
-  { &kNS_ANNOTATIONSERVICE_CID, false, NULL, nsAnnotationServiceConstructor },
-  { &kNS_ANNOPROTOCOLHANDLER_CID, false, NULL, nsAnnoProtocolHandlerConstructor },
-  { &kNS_NAVBOOKMARKSSERVICE_CID, false, NULL, nsNavBookmarksConstructor },
-  { &kNS_FAVICONSERVICE_CID, false, NULL, nsFaviconServiceConstructor },
-  { &kNS_HISTORYSERVICE_CID, false, NULL, HistoryConstructor },
-  { NULL }
+  { &kNS_NAVHISTORYSERVICE_CID, false, nullptr, nsNavHistoryConstructor },
+  { &kNS_ANNOTATIONSERVICE_CID, false, nullptr, nsAnnotationServiceConstructor },
+  { &kNS_ANNOPROTOCOLHANDLER_CID, false, nullptr, nsAnnoProtocolHandlerConstructor },
+  { &kNS_NAVBOOKMARKSSERVICE_CID, false, nullptr, nsNavBookmarksConstructor },
+  { &kNS_FAVICONSERVICE_CID, false, nullptr, nsFaviconServiceConstructor },
+  { &kNS_HISTORYSERVICE_CID, false, nullptr, HistoryConstructor },
+  { nullptr }
 };
 
 const mozilla::Module::ContractIDEntry kPlacesContracts[] = {
   { NS_NAVHISTORYSERVICE_CONTRACTID, &kNS_NAVHISTORYSERVICE_CID },
   { NS_ANNOTATIONSERVICE_CONTRACTID, &kNS_ANNOTATIONSERVICE_CID },
   { NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "moz-anno", &kNS_ANNOPROTOCOLHANDLER_CID },
   { NS_NAVBOOKMARKSSERVICE_CONTRACTID, &kNS_NAVBOOKMARKSSERVICE_CID },
   { NS_FAVICONSERVICE_CONTRACTID, &kNS_FAVICONSERVICE_CID },
   { "@mozilla.org/embeddor.implemented/bookmark-charset-resolver;1", &kNS_NAVHISTORYSERVICE_CID },
   { NS_IHISTORY_CONTRACTID, &kNS_HISTORYSERVICE_CID },
   { NS_DOWNLOADHISTORY_CONTRACTID, &kNS_HISTORYSERVICE_CID },
-  { NULL }
+  { nullptr }
 };
 
 const mozilla::Module::CategoryEntry kPlacesCategories[] = {
   { "vacuum-participant", "Places", NS_NAVHISTORYSERVICE_CONTRACTID },
-  { NULL }
+  { nullptr }
 };
 
 const mozilla::Module kPlacesModule = {
   mozilla::Module::kVersion,
   kPlacesCIDs,
   kPlacesContracts,
   kPlacesCategories
 };
--- a/toolkit/components/places/tests/cpp/test_IHistory.cpp
+++ b/toolkit/components/places/tests/cpp/test_IHistory.cpp
@@ -553,17 +553,17 @@ test_visituri_transition_embed()
 }
 
 void
 test_new_visit_adds_place_guid()
 {
   // First, add a visit and wait.  This will also add a place.
   nsCOMPtr<nsIURI> visitedURI = new_test_uri();
   nsCOMPtr<IHistory> history = do_get_IHistory();
-  nsresult rv = history->VisitURI(visitedURI, NULL,
+  nsresult rv = history->VisitURI(visitedURI, nullptr,
                                   mozilla::IHistory::TOP_LEVEL);
   do_check_success(rv);
   nsRefPtr<VisitURIObserver> finisher = new VisitURIObserver();
   finisher->WaitForNotification();
 
   // Check that we have a guid for our visit.
   PlaceRecord place;
   do_get_place(visitedURI, place);
@@ -574,28 +574,28 @@ test_new_visit_adds_place_guid()
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// IPC-only Tests
 
 void
 test_two_null_links_same_uri()
 {
-  // Tests that we do not crash when we have had two NULL Links passed to
+  // Tests that we do not crash when we have had two nullptr Links passed to
   // RegisterVisitedCallback and then the visit occurs (bug 607469).  This only
   // happens in IPC builds.
   nsCOMPtr<nsIURI> testURI = new_test_uri();
 
   nsCOMPtr<IHistory> history = do_get_IHistory();
-  nsresult rv = history->RegisterVisitedCallback(testURI, NULL);
+  nsresult rv = history->RegisterVisitedCallback(testURI, nullptr);
   do_check_success(rv);
-  rv = history->RegisterVisitedCallback(testURI, NULL);
+  rv = history->RegisterVisitedCallback(testURI, nullptr);
   do_check_success(rv);
 
-  rv = history->VisitURI(testURI, NULL, mozilla::IHistory::TOP_LEVEL);
+  rv = history->VisitURI(testURI, nullptr, mozilla::IHistory::TOP_LEVEL);
   do_check_success(rv);
 
   nsRefPtr<VisitURIObserver> finisher = new VisitURIObserver();
   finisher->WaitForNotification();
 
   run_next_test();
 }
 
--- a/toolkit/components/reflect/reflect.cpp
+++ b/toolkit/components/reflect/reflect.cpp
@@ -53,23 +53,23 @@ Module::Call(nsIXPConnectWrappedNative* 
 }
 
 }
 }
 
 NS_DEFINE_NAMED_CID(JSREFLECT_CID);
 
 static const mozilla::Module::CIDEntry kReflectCIDs[] = {
-  { &kJSREFLECT_CID, false, NULL, mozilla::reflect::ModuleConstructor },
-  { NULL }
+  { &kJSREFLECT_CID, false, nullptr, mozilla::reflect::ModuleConstructor },
+  { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kReflectContracts[] = {
   { JSREFLECT_CONTRACTID, &kJSREFLECT_CID },
-  { NULL }
+  { nullptr }
 };
 
 static const mozilla::Module kReflectModule = {
   mozilla::Module::kVersion,
   kReflectCIDs,
   kReflectContracts
 };
 
--- a/toolkit/components/remote/nsGTKRemoteService.cpp
+++ b/toolkit/components/remote/nsGTKRemoteService.cpp
@@ -171,23 +171,23 @@ nsGTKRemoteService::HandlePropertyChange
 // {C0773E90-5799-4eff-AD03-3EBCD85624AC}
 #define NS_REMOTESERVICE_CID \
   { 0xc0773e90, 0x5799, 0x4eff, { 0xad, 0x3, 0x3e, 0xbc, 0xd8, 0x56, 0x24, 0xac } }
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsGTKRemoteService)
 NS_DEFINE_NAMED_CID(NS_REMOTESERVICE_CID);
 
 static const mozilla::Module::CIDEntry kRemoteCIDs[] = {
-  { &kNS_REMOTESERVICE_CID, false, NULL, nsGTKRemoteServiceConstructor },
-  { NULL }
+  { &kNS_REMOTESERVICE_CID, false, nullptr, nsGTKRemoteServiceConstructor },
+  { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kRemoteContracts[] = {
   { "@mozilla.org/toolkit/remote-service;1", &kNS_REMOTESERVICE_CID },
-  { NULL }
+  { nullptr }
 };
 
 static const mozilla::Module kRemoteModule = {
   mozilla::Module::kVersion,
   kRemoteCIDs,
   kRemoteContracts
 };
 
--- a/toolkit/components/remote/nsGTKRemoteService.h
+++ b/toolkit/components/remote/nsGTKRemoteService.h
@@ -20,17 +20,17 @@ class nsGTKRemoteService MOZ_FINAL : pub
 {
 public:
   // We will be a static singleton, so don't use the ordinary methods.
   NS_DECL_ISUPPORTS
   NS_DECL_NSIREMOTESERVICE
 
 
   nsGTKRemoteService() :
-    mServerWindow(NULL) { }
+    mServerWindow(nullptr) { }
 
 private:
   ~nsGTKRemoteService() { }
 
   void HandleCommandsFor(GtkWidget* aWidget,
                          nsIWeakReference* aWindow);
 
 
--- a/toolkit/components/remote/nsQtRemoteService.cpp
+++ b/toolkit/components/remote/nsQtRemoteService.cpp
@@ -114,23 +114,23 @@ nsQtRemoteService::SetDesktopStartupIDOr
 // {C0773E90-5799-4eff-AD03-3EBCD85624AC}
 #define NS_REMOTESERVICE_CID \
   { 0xc0773e90, 0x5799, 0x4eff, { 0xad, 0x3, 0x3e, 0xbc, 0xd8, 0x56, 0x24, 0xac } }
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsQtRemoteService)
 NS_DEFINE_NAMED_CID(NS_REMOTESERVICE_CID);
 
 static const mozilla::Module::CIDEntry kRemoteCIDs[] = {
-  { &kNS_REMOTESERVICE_CID, false, NULL, nsQtRemoteServiceConstructor },
-  { NULL }
+  { &kNS_REMOTESERVICE_CID, false, nullptr, nsQtRemoteServiceConstructor },
+  { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kRemoteContracts[] = {
   { "@mozilla.org/toolkit/remote-service;1", &kNS_REMOTESERVICE_CID },
-  { NULL }
+  { nullptr }
 };
 
 static const mozilla::Module kRemoteModule = {
   mozilla::Module::kVersion,
   kRemoteCIDs,
   kRemoteContracts
 };
 
--- a/toolkit/components/remote/nsXRemoteService.cpp
+++ b/toolkit/components/remote/nsXRemoteService.cpp
@@ -209,17 +209,17 @@ nsXRemoteService::HandleNewProperty(XID 
     if (result != Success)
       return false;
 
     // Failed to get the data off the window or it was the wrong type?
     if (!data || !TO_LITTLE_ENDIAN32(*reinterpret_cast<int32_t*>(data)))
       return false;
 
     // cool, we got the property data.
-    const char *response = NULL;
+    const char *response = nullptr;
     if (aChangedAtom == sMozCommandAtom)
       response = HandleCommand(data, window, aEventTime);
     else if (aChangedAtom == sMozCommandLineAtom)
       response = HandleCommandLine(data, window, aEventTime);
 
     // put the property onto the window as the response
     XChangeProperty (aDisplay, aWindowId,
                      sMozResponseAtom, XA_STRING,
--- a/toolkit/components/satchel/nsFormFillController.cpp
+++ b/toolkit/components/satchel/nsFormFillController.cpp
@@ -1199,24 +1199,24 @@ nsFormFillController::GetIndexOfDocShell
   return -1;
 }
 
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsFormFillController)
 
 NS_DEFINE_NAMED_CID(NS_FORMFILLCONTROLLER_CID);
 
 static const mozilla::Module::CIDEntry kSatchelCIDs[] = {
-  { &kNS_FORMFILLCONTROLLER_CID, false, NULL, nsFormFillControllerConstructor },
-  { NULL }
+  { &kNS_FORMFILLCONTROLLER_CID, false, nullptr, nsFormFillControllerConstructor },
+  { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kSatchelContracts[] = {
   { "@mozilla.org/satchel/form-fill-controller;1", &kNS_FORMFILLCONTROLLER_CID },
   { NS_FORMHISTORYAUTOCOMPLETE_CONTRACTID, &kNS_FORMFILLCONTROLLER_CID },
-  { NULL }
+  { nullptr }
 };
 
 static const mozilla::Module kSatchelModule = {
   mozilla::Module::kVersion,
   kSatchelCIDs,
   kSatchelContracts
 };
 
--- a/toolkit/components/startup/nsAppStartup.cpp
+++ b/toolkit/components/startup/nsAppStartup.cpp
@@ -666,17 +666,17 @@ nsAppStartup::Observe(nsISupports *aSubj
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAppStartup::GetStartupInfo(JSContext* aCx, JS::Value* aRetval)
 {
-  JS::Rooted<JSObject*> obj(aCx, JS_NewObject(aCx, NULL, NULL, NULL));
+  JS::Rooted<JSObject*> obj(aCx, JS_NewObject(aCx, nullptr, nullptr, nullptr));
   *aRetval = OBJECT_TO_JSVAL(obj);
 
   TimeStamp procTime = StartupTimeline::Get(StartupTimeline::PROCESS_CREATION);
   TimeStamp now = TimeStamp::Now();
   PRTime absNow = PR_Now();
 
   if (procTime.IsNull()) {
     bool error = false;
@@ -707,17 +707,17 @@ nsAppStartup::GetStartupInfo(JSContext* 
     }
 
     if (!stamp.IsNull()) {
       if (stamp >= procTime) {
         PRTime prStamp = ComputeAbsoluteTimestamp(absNow, now, stamp)
           / PR_USEC_PER_MSEC;
         JS::Rooted<JSObject*> date(aCx, JS_NewDateObjectMsec(aCx, prStamp));
         JS_DefineProperty(aCx, obj, StartupTimeline::Describe(ev),
-          OBJECT_TO_JSVAL(date), NULL, NULL, JSPROP_ENUMERATE);
+          OBJECT_TO_JSVAL(date), nullptr, nullptr, JSPROP_ENUMERATE);
       } else {
         Telemetry::Accumulate(Telemetry::STARTUP_MEASUREMENT_ERRORS, ev);
       }
     }
   }
 
   return NS_OK;
 }
--- a/toolkit/components/startup/nsUserInfoWin.cpp
+++ b/toolkit/components/startup/nsUserInfoWin.cpp
@@ -96,17 +96,17 @@ nsUserInfo::GetFullname(PRUnichar **aFul
 NS_IMETHODIMP
 nsUserInfo::GetDomain(char **aDomain)
 {
   NS_ENSURE_ARG_POINTER(aDomain);
   *aDomain = nullptr;
 
   const DWORD level = 100;
   LPBYTE info;
-  NET_API_STATUS status = NetWkstaGetInfo(NULL, level, &info);
+  NET_API_STATUS status = NetWkstaGetInfo(nullptr, level, &info);
   if (status == NERR_Success) {
     *aDomain =
       ToNewUTF8String(nsDependentString(reinterpret_cast<WKSTA_INFO_100 *>(info)->
                                         wki100_langroup));
     NetApiBufferFree(info);
   }
 
   return (*aDomain) ? NS_OK : NS_ERROR_FAILURE;
--- a/toolkit/components/telemetry/Telemetry.cpp
+++ b/toolkit/components/telemetry/Telemetry.cpp
@@ -324,17 +324,17 @@ private:
   CombinedStacks mLateWritesStacks; // This is collected out of the main thread.
   bool mCachedTelemetryData;
   uint32_t mLastShutdownTime;
   uint32_t mFailedLockCount;
   nsCOMArray<nsIFetchTelemetryDataCallback> mCallbacks;
   friend class nsFetchTelemetryData;
 };
 
-TelemetryImpl*  TelemetryImpl::sTelemetry = NULL;
+TelemetryImpl*  TelemetryImpl::sTelemetry = nullptr;
 
 size_t
 TelemetryImpl::SizeOfIncludingThisHelper(mozilla::MallocSizeOf aMallocSizeOf)
 {
   size_t n = aMallocSizeOf(this);
   // Ignore the hashtables in mAddonMap; they are not significant.
   n += mAddonMap.SizeOfExcludingThis(nullptr, aMallocSizeOf);
   n += mHistogramMap.SizeOfExcludingThis(nullptr, aMallocSizeOf);
@@ -526,63 +526,63 @@ enum reflectStatus
 ReflectHistogramAndSamples(JSContext *cx, JS::Handle<JSObject*> obj, Histogram *h,
                            const Histogram::SampleSet &ss)
 {
   // We don't want to reflect corrupt histograms.
   if (h->FindCorruption(ss) != Histogram::NO_INCONSISTENCIES) {
     return REFLECT_CORRUPT;
   }
 
-  if (!(JS_DefineProperty(cx, obj, "min", INT_TO_JSVAL(h->declared_min()), NULL, NULL, JSPROP_ENUMERATE)
-        && JS_DefineProperty(cx, obj, "max", INT_TO_JSVAL(h->declared_max()), NULL, NULL, JSPROP_ENUMERATE)
-        && JS_DefineProperty(cx, obj, "histogram_type", INT_TO_JSVAL(h->histogram_type()), NULL, NULL, JSPROP_ENUMERATE)
-        && JS_DefineProperty(cx, obj, "sum", DOUBLE_TO_JSVAL(ss.sum()), NULL, NULL, JSPROP_ENUMERATE))) {
+  if (!(JS_DefineProperty(cx, obj, "min", INT_TO_JSVAL(h->declared_min()), nullptr, nullptr, JSPROP_ENUMERATE)
+        && JS_DefineProperty(cx, obj, "max", INT_TO_JSVAL(h->declared_max()), nullptr, nullptr, JSPROP_ENUMERATE)
+        && JS_DefineProperty(cx, obj, "histogram_type", INT_TO_JSVAL(h->histogram_type()), nullptr, nullptr, JSPROP_ENUMERATE)
+        && JS_DefineProperty(cx, obj, "sum", DOUBLE_TO_JSVAL(ss.sum()), nullptr, nullptr, JSPROP_ENUMERATE))) {
     return REFLECT_FAILURE;
   }
 
   if (h->histogram_type() == Histogram::HISTOGRAM) {
-    if (!(JS_DefineProperty(cx, obj, "log_sum", DOUBLE_TO_JSVAL(ss.log_sum()), NULL, NULL, JSPROP_ENUMERATE)
-          && JS_DefineProperty(cx, obj, "log_sum_squares", DOUBLE_TO_JSVAL(ss.log_sum_squares()), NULL, NULL, JSPROP_ENUMERATE))) {
+    if (!(JS_DefineProperty(cx, obj, "log_sum", DOUBLE_TO_JSVAL(ss.log_sum()), nullptr, nullptr, JSPROP_ENUMERATE)
+          && JS_DefineProperty(cx, obj, "log_sum_squares", DOUBLE_TO_JSVAL(ss.log_sum_squares()), nullptr, nullptr, JSPROP_ENUMERATE))) {
       return REFLECT_FAILURE;
     }
   } else {
     // Export |sum_squares| as two separate 32-bit properties so that we
     // can accurately reconstruct it on the analysis side.
     uint64_t sum_squares = ss.sum_squares();
     // Cast to avoid implicit truncation warnings.
     uint32_t lo = static_cast<uint32_t>(sum_squares);
     uint32_t hi = static_cast<uint32_t>(sum_squares >> 32);
-    if (!(JS_DefineProperty(cx, obj, "sum_squares_lo", INT_TO_JSVAL(lo), NULL, NULL, JSPROP_ENUMERATE)
-          && JS_DefineProperty(cx, obj, "sum_squares_hi", INT_TO_JSVAL(hi), NULL, NULL, JSPROP_ENUMERATE))) {
+    if (!(JS_DefineProperty(cx, obj, "sum_squares_lo", INT_TO_JSVAL(lo), nullptr, nullptr, JSPROP_ENUMERATE)
+          && JS_DefineProperty(cx, obj, "sum_squares_hi", INT_TO_JSVAL(hi), nullptr, nullptr, JSPROP_ENUMERATE))) {
       return REFLECT_FAILURE;
     }
   }
 
   const size_t count = h->bucket_count();
   JS::Rooted<JSObject*> rarray(cx, JS_NewArrayObject(cx, count, nullptr));
   if (!rarray) {
     return REFLECT_FAILURE;
   }
   if (!(FillRanges(cx, rarray, h)
         && JS_DefineProperty(cx, obj, "ranges", OBJECT_TO_JSVAL(rarray),
-                             NULL, NULL, JSPROP_ENUMERATE))) {
+                             nullptr, nullptr, JSPROP_ENUMERATE))) {
     return REFLECT_FAILURE;
   }
 
   JS::Rooted<JSObject*> counts_array(cx, JS_NewArrayObject(cx, count, nullptr));
   if (!counts_array) {
     return REFLECT_FAILURE;
   }
   if (!JS_DefineProperty(cx, obj, "counts", OBJECT_TO_JSVAL(counts_array),
-                         NULL, NULL, JSPROP_ENUMERATE)) {
+                         nullptr, nullptr, JSPROP_ENUMERATE)) {
     return REFLECT_FAILURE;
   }
   for (size_t i = 0; i < count; i++) {
     if (!JS_DefineElement(cx, counts_array, i, INT_TO_JSVAL(ss.counts(i)),
-                          NULL, NULL, JSPROP_ENUMERATE)) {
+                          nullptr, nullptr, JSPROP_ENUMERATE)) {
       return REFLECT_FAILURE;
     }
   }
 
   return REFLECT_OK;
 }
 
 enum reflectStatus
@@ -999,17 +999,17 @@ TelemetryImpl::ReflectSQL(const SlowSQLE
   if (!arrayObj) {
     return false;
   }
   return (JS_SetElement(cx, arrayObj, 0, &hitCount)
           && JS_SetElement(cx, arrayObj, 1, &totalTime)
           && JS_DefineProperty(cx, obj,
                                sql.BeginReading(),
                                OBJECT_TO_JSVAL(arrayObj),
-                               NULL, NULL, JSPROP_ENUMERATE));
+                               nullptr, nullptr, JSPROP_ENUMERATE));
 }
 
 bool
 TelemetryImpl::ReflectMainThreadSQL(SlowSQLEntryType *entry, JSContext *cx,
                                     JS::Handle<JSObject*> obj)
 {
   return ReflectSQL(entry, &entry->mData.mainThread, cx, obj);
 }
@@ -1035,17 +1035,17 @@ TelemetryImpl::AddSQLInfo(JSContext *cx,
     (mainThread ? ReflectMainThreadSQL : ReflectOtherThreadsSQL);
   if(!sqlMap.ReflectIntoJS(reflectFunction, cx, statsObj)) {
     return false;
   }
 
   return JS_DefineProperty(cx, rootObj,
                            mainThread ? "mainThread" : "otherThreads",
                            OBJECT_TO_JSVAL(statsObj),
-                           NULL, NULL, JSPROP_ENUMERATE);
+                           nullptr, nullptr, JSPROP_ENUMERATE);
 }
 
 nsresult
 TelemetryImpl::GetHistogramEnumId(const char *name, Telemetry::ID *id)
 {
   if (!sTelemetry) {
     return NS_ERROR_FAILURE;
   }
@@ -1318,17 +1318,17 @@ TelemetryImpl::GetHistogramSnapshots(JSC
       // We can still hit this case even if ShouldReflectHistograms
       // returns true.  The histogram lies outside of our control
       // somehow; just skip it.
       continue;
     case REFLECT_FAILURE:
       return NS_ERROR_FAILURE;
     case REFLECT_OK:
       if (!JS_DefineProperty(cx, root_obj, h->histogram_name().c_str(),
-                             OBJECT_TO_JSVAL(hobj), NULL, NULL, JSPROP_ENUMERATE)) {
+                             OBJECT_TO_JSVAL(hobj), nullptr, nullptr, JSPROP_ENUMERATE)) {
         return NS_ERROR_FAILURE;
       }
     }
   }
   return NS_OK;
 }
 
 bool
@@ -1379,17 +1379,17 @@ TelemetryImpl::AddonHistogramReflector(A
   switch (ReflectHistogramSnapshot(cx, snapshot, info.h)) {
   case REFLECT_FAILURE:
   case REFLECT_CORRUPT:
     return false;
   case REFLECT_OK:
     const nsACString &histogramName = entry->GetKey();
     if (!JS_DefineProperty(cx, obj,
                            PromiseFlatCString(histogramName).get(),
-                           OBJECT_TO_JSVAL(snapshot), NULL, NULL,
+                           OBJECT_TO_JSVAL(snapshot), nullptr, nullptr,
                            JSPROP_ENUMERATE)) {
       return false;
     }
     break;
   }
   return true;
 }
 
@@ -1402,17 +1402,17 @@ TelemetryImpl::AddonReflector(AddonEntry
   if (!subobj) {
     return false;
   }
 
   AddonHistogramMapType *map = entry->mData;
   if (!(map->ReflectIntoJS(AddonHistogramReflector, cx, subobj)
         && JS_DefineProperty(cx, obj,
                              PromiseFlatCString(addonId).get(),
-                             OBJECT_TO_JSVAL(subobj), NULL, NULL,
+                             OBJECT_TO_JSVAL(subobj), nullptr, nullptr,
                              JSPROP_ENUMERATE))) {
     return false;
   }
   return true;
 }
 
 NS_IMETHODIMP
 TelemetryImpl::GetAddonHistogramSnapshots(JSContext *cx, JS::Value *ret)
@@ -1488,17 +1488,17 @@ TelemetryImpl::GetChromeHangs(JSContext 
   *ret = OBJECT_TO_JSVAL(fullReportObj);
 
   JS::Rooted<JSObject*> durationArray(cx, JS_NewArrayObject(cx, 0, nullptr));
   if (!durationArray) {
     return NS_ERROR_FAILURE;
   }
   bool ok = JS_DefineProperty(cx, fullReportObj, "durations",
                               OBJECT_TO_JSVAL(durationArray),
-                              NULL, NULL, JSPROP_ENUMERATE);
+                              nullptr, nullptr, JSPROP_ENUMERATE);
   if (!ok) {
     return NS_ERROR_FAILURE;
   }
 
   const size_t length = stacks.GetStackCount();
   for (size_t i = 0; i < length; ++i) {
     JS::Rooted<JS::Value> duration(cx, INT_TO_JSVAL(mHangReports.GetDuration(i)));
     if (!JS_SetElement(cx, durationArray, i, &duration)) {
@@ -1517,17 +1517,17 @@ CreateJSStackObject(JSContext *cx, const
   }
 
   JS::Rooted<JSObject*> moduleArray(cx, JS_NewArrayObject(cx, 0, nullptr));
   if (!moduleArray) {
     return nullptr;
   }
   bool ok = JS_DefineProperty(cx, ret, "memoryMap",
                               OBJECT_TO_JSVAL(moduleArray),
-                              NULL, NULL, JSPROP_ENUMERATE);
+                              nullptr, nullptr, JSPROP_ENUMERATE);
   if (!ok) {
     return nullptr;
   }
 
   const size_t moduleCount = stacks.GetModuleCount();
   for (size_t moduleIndex = 0; moduleIndex < moduleCount; ++moduleIndex) {
     // Current module
     const Telemetry::ProcessedStack::Module& module =
@@ -1566,17 +1566,17 @@ CreateJSStackObject(JSContext *cx, const
   }
 
   JS::Rooted<JSObject*> reportArray(cx, JS_NewArrayObject(cx, 0, nullptr));
   if (!reportArray) {
     return nullptr;
   }
   ok = JS_DefineProperty(cx, ret, "stacks",
                          OBJECT_TO_JSVAL(reportArray),
-                         NULL, NULL, JSPROP_ENUMERATE);
+                         nullptr, nullptr, JSPROP_ENUMERATE);
   if (!ok) {
     return nullptr;
   }
 
   const size_t length = stacks.GetStackCount();
   for (size_t i = 0; i < length; ++i) {
     // Represent call stack PCs as (module index, offset) pairs.
     JS::Rooted<JSObject*> pcArray(cx, JS_NewArrayObject(cx, 0, nullptr));
@@ -1783,17 +1783,17 @@ TelemetryImpl::GetRegisteredHistograms(J
   if (!info)
     return NS_ERROR_FAILURE;
 
   for (size_t i = 0; i < count; ++i) {
     JSString *comment = JS_InternString(cx, gHistograms[i].comment());
 
     if (!(comment
           && JS_DefineProperty(cx, info, gHistograms[i].id(),
-                               STRING_TO_JSVAL(comment), NULL, NULL,
+                               STRING_TO_JSVAL(comment), nullptr, nullptr,
                                JSPROP_ENUMERATE))) {
       return NS_ERROR_FAILURE;
     }
   }
 
   *ret = OBJECT_TO_JSVAL(info);
   return NS_OK;
 }
@@ -1834,17 +1834,17 @@ TelemetryImpl::GetCanSend(bool *ret) {
   *ret = false;
 #endif
   return NS_OK;
 }
 
 already_AddRefed<nsITelemetry>
 TelemetryImpl::CreateTelemetryInstance()
 {
-  NS_ABORT_IF_FALSE(sTelemetry == NULL, "CreateTelemetryInstance may only be called once, via GetService()");
+  NS_ABORT_IF_FALSE(sTelemetry == nullptr, "CreateTelemetryInstance may only be called once, via GetService()");
   sTelemetry = new TelemetryImpl();
   // AddRef for the local reference
   NS_ADDREF(sTelemetry);
   // AddRef for the caller
   nsCOMPtr<nsITelemetry> ret = sTelemetry;
   return ret.forget();
 }
 
@@ -1853,17 +1853,17 @@ TelemetryImpl::ShutdownTelemetry()
 {
   NS_IF_RELEASE(sTelemetry);
 }
 
 void
 TelemetryImpl::StoreSlowSQL(const nsACString &sql, uint32_t delay,
                             SanitizedState state)
 {
-  AutoHashtable<SlowSQLEntryType> *slowSQLMap = NULL;
+  AutoHashtable<SlowSQLEntryType> *slowSQLMap = nullptr;
   if (state == Sanitized)
     slowSQLMap = &(sTelemetry->mSanitizedSQL);
   else
     slowSQLMap = &(sTelemetry->mPrivateSQL);
 
   MutexAutoLock hashMutex(sTelemetry->mHashMutex);
 
   SlowSQLEntryType *entry = slowSQLMap->GetEntry(sql);
@@ -2061,32 +2061,32 @@ TelemetryImpl::RecordChromeHang(uint32_t
 NS_IMPL_ISUPPORTS1(TelemetryImpl, nsITelemetry)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelemetry, TelemetryImpl::CreateTelemetryInstance)
 
 #define NS_TELEMETRY_CID \
   {0xaea477f2, 0xb3a2, 0x469c, {0xaa, 0x29, 0x0a, 0x82, 0xd1, 0x32, 0xb8, 0x29}}
 NS_DEFINE_NAMED_CID(NS_TELEMETRY_CID);
 
 const Module::CIDEntry kTelemetryCIDs[] = {
-  { &kNS_TELEMETRY_CID, false, NULL, nsITelemetryConstructor },
-  { NULL }
+  { &kNS_TELEMETRY_CID, false, nullptr, nsITelemetryConstructor },
+  { nullptr }
 };
 
 const Module::ContractIDEntry kTelemetryContracts[] = {
   { "@mozilla.org/base/telemetry;1", &kNS_TELEMETRY_CID },
-  { NULL }
+  { nullptr }
 };
 
 const Module kTelemetryModule = {
   Module::kVersion,
   kTelemetryCIDs,
   kTelemetryContracts,
-  NULL,
-  NULL,
-  NULL,
+  nullptr,
+  nullptr,
+  nullptr,
   TelemetryImpl::ShutdownTelemetry
 };
 
 } // anonymous namespace
 
 namespace mozilla {
 void
 RecordShutdownStartTimeStamp() {
@@ -2190,17 +2190,17 @@ bool
 CanRecord()
 {
   return TelemetryImpl::CanRecord();
 }
 
 base::Histogram*
 GetHistogramById(ID id)
 {
-  Histogram *h = NULL;
+  Histogram *h = nullptr;
   GetHistogramByEnumId(id, &h);
   return h;
 }
 
 void
 RecordSlowSQLStatement(const nsACString &statement,
                        const nsACString &dbName,
                        uint32_t delay)