Bug 784739 - Switch from NULL to nullptr in toolkit/; r=ehsan
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Thu, 10 Oct 2013 16:36:42 -0400
changeset 150392 01fa498691752a5998bb0a848f47a299648dc21c
parent 150391 9ee0459d73363b3eeabc9e8ab4e79bf13fd51be9
child 150393 8b9687f6c60276ac3a92b21682ad932aca504877
push id25437
push userkwierso@gmail.com
push dateFri, 11 Oct 2013 02:00:22 +0000
treeherdermozilla-central@672cd63528d3 [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 toolkit/; r=ehsan
toolkit/devtools/server/nsJSInspector.cpp
toolkit/identity/IdentityCryptoService.cpp
toolkit/library/nsDllMain.cpp
toolkit/library/nsStaticXULComponents.cpp
toolkit/system/androidproxy/nsAndroidSystemProxySettings.cpp
toolkit/system/dbus/nsDBusModule.cpp
toolkit/system/dbus/nsDBusService.cpp
toolkit/system/dbus/nsNetworkManagerListener.cpp
toolkit/system/gnome/nsAlertsIconListener.cpp
toolkit/system/gnome/nsGIOService.cpp
toolkit/system/gnome/nsGSettingsService.cpp
toolkit/system/gnome/nsGnomeModule.cpp
toolkit/system/gnome/nsGnomeVFSService.cpp
toolkit/system/unixproxy/nsLibProxySettings.cpp
toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
toolkit/system/windowsproxy/nsWindowsSystemProxySettings.cpp
toolkit/xre/EventTracer.cpp
toolkit/xre/MacQuirks.h
toolkit/xre/ProfileReset.cpp
toolkit/xre/glxtest.cpp
toolkit/xre/nsAndroidStartup.cpp
toolkit/xre/nsAppRunner.cpp
toolkit/xre/nsAppRunner.h
toolkit/xre/nsCommandLineServiceMac.cpp
toolkit/xre/nsEmbedFunctions.cpp
toolkit/xre/nsNativeAppSupportOS2.cpp
toolkit/xre/nsNativeAppSupportUnix.cpp
toolkit/xre/nsNativeAppSupportWin.cpp
toolkit/xre/nsQAppInstance.cpp
toolkit/xre/nsSigHandlers.cpp
toolkit/xre/nsUpdateDriver.cpp
toolkit/xre/nsWindowsDllBlocklist.cpp
toolkit/xre/nsWindowsDllInterceptor.h
toolkit/xre/nsWindowsRestart.cpp
toolkit/xre/nsWindowsWMain.cpp
toolkit/xre/nsX11ErrorHandler.cpp
toolkit/xre/nsXREDirProvider.cpp
--- a/toolkit/devtools/server/nsJSInspector.cpp
+++ b/toolkit/devtools/server/nsJSInspector.cpp
@@ -100,23 +100,23 @@ nsJSInspector::GetLastNestRequestor(JS::
 }
 
 }
 }
 
 NS_DEFINE_NAMED_CID(JSINSPECTOR_CID);
 
 static const mozilla::Module::CIDEntry kJSInspectorCIDs[] = {
-  { &kJSINSPECTOR_CID, false, NULL, mozilla::jsinspector::nsJSInspectorConstructor },
-  { NULL }
+  { &kJSINSPECTOR_CID, false, nullptr, mozilla::jsinspector::nsJSInspectorConstructor },
+  { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kJSInspectorContracts[] = {
   { JSINSPECTOR_CONTRACTID, &kJSINSPECTOR_CID },
-  { NULL }
+  { nullptr }
 };
 
 static const mozilla::Module kJSInspectorModule = {
   mozilla::Module::kVersion,
   kJSInspectorCIDs,
   kJSInspectorContracts
 };
 
--- a/toolkit/identity/IdentityCryptoService.cpp
+++ b/toolkit/identity/IdentityCryptoService.cpp
@@ -112,19 +112,19 @@ private:
 
   void destructorSafeDestroyNSSReference()
   {
     nsNSSShutDownPreventionLock locker;
     if (isAlreadyShutDown())
       return;
 
     SECKEY_DestroyPrivateKey(mPrivateKey);
-    mPrivateKey = NULL;
+    mPrivateKey = nullptr;
     SECKEY_DestroyPublicKey(mPublicKey);
-    mPublicKey = NULL;
+    mPublicKey = nullptr;
   }
 
   SECKEYPrivateKey * mPrivateKey;
   SECKEYPublicKey * mPublicKey;
 
   KeyPair(const KeyPair &) MOZ_DELETE;
   void operator=(const KeyPair &) MOZ_DELETE;
 };
@@ -151,17 +151,17 @@ private:
   }
 
   void destructorSafeDestroyNSSReference()
   {
     nsNSSShutDownPreventionLock locker;
     if (isAlreadyShutDown())
       return;
 
-     mKeyPair = NULL;
+     mKeyPair = nullptr;
   }
 
   const KeyType mKeyType; // in
   nsMainThreadPtrHandle<nsIIdentityKeyGenCallback> mCallback; // in
   nsresult mRv; // out
   nsCOMPtr<KeyPair> mKeyPair; // out
 
   KeyGenRunnable(const KeyGenRunnable &) MOZ_DELETE;
@@ -190,17 +190,17 @@ private:
 
   void destructorSafeDestroyNSSReference()
   {
     nsNSSShutDownPreventionLock locker;
     if (isAlreadyShutDown())
       return;
 
     SECKEY_DestroyPrivateKey(mPrivateKey);
-    mPrivateKey = NULL;
+    mPrivateKey = nullptr;
   }
 
   const nsCString mTextToSign; // in
   SECKEYPrivateKey* mPrivateKey; // in
   nsMainThreadPtrHandle<nsIIdentitySignCallback> mCallback; // in
   nsresult mRv; // out
   nsCString mSignature; // out
 
@@ -371,28 +371,28 @@ KeyGenRunnable::KeyGenRunnable(KeyType k
 
 MOZ_WARN_UNUSED_RESULT nsresult
 GenerateKeyPair(PK11SlotInfo * slot,
                 SECKEYPrivateKey ** privateKey,
                 SECKEYPublicKey ** publicKey,
                 CK_MECHANISM_TYPE mechanism,
                 void * params)
 {
-  *publicKey = NULL;
+  *publicKey = nullptr;
   *privateKey = PK11_GenerateKeyPair(slot, mechanism, params, publicKey,
                                      PR_FALSE /*isPerm*/,
                                      PR_TRUE /*isSensitive*/,
-                                     NULL /*&pwdata*/);
+                                     nullptr /*&pwdata*/);
   if (!*privateKey) {
     MOZ_ASSERT(!*publicKey);
     return PRErrorCode_to_nsresult(PR_GetError());
   }
   if (!*publicKey) {
 	  SECKEY_DestroyPrivateKey(*privateKey);
-	  *privateKey = NULL;
+	  *privateKey = nullptr;
     MOZ_CRASH("PK11_GnerateKeyPair returned private key without public key");
   }
 
   return NS_OK;
 }
 
 
 MOZ_WARN_UNUSED_RESULT nsresult
@@ -455,17 +455,17 @@ GenerateDSAKeyPair(PK11SlotInfo * slot,
     0x72,0xDF,0xFA,0x89,0x62,0x33,0x39,0x7A
   };
 
   static_assert(MOZ_ARRAY_LENGTH(P) == 1024 / CHAR_BIT, "bad DSA P");
   static_assert(MOZ_ARRAY_LENGTH(Q) ==  160 / CHAR_BIT, "bad DSA Q");
   static_assert(MOZ_ARRAY_LENGTH(G) == 1024 / CHAR_BIT, "bad DSA G");
 
   PQGParams pqgParams  = {
-    NULL /*arena*/,
+    nullptr /*arena*/,
     { siBuffer, P, static_cast<unsigned int>(mozilla::ArrayLength(P)) },
     { siBuffer, Q, static_cast<unsigned int>(mozilla::ArrayLength(Q)) },
     { siBuffer, G, static_cast<unsigned int>(mozilla::ArrayLength(G)) }
   };
 
   return GenerateKeyPair(slot, privateKey, publicKey, CKM_DSA_KEY_PAIR_GEN,
                          &pqgParams);
 }
@@ -479,18 +479,18 @@ KeyGenRunnable::Run()
       mRv = NS_ERROR_NOT_AVAILABLE;
     } else {
       // We always want to use the internal slot for BrowserID; in particular,
       // we want to avoid smartcard slots.
       PK11SlotInfo *slot = PK11_GetInternalSlot();
       if (!slot) {
         mRv = NS_ERROR_UNEXPECTED;
       } else {
-        SECKEYPrivateKey *privk = NULL;
-        SECKEYPublicKey *pubk = NULL;
+        SECKEYPrivateKey *privk = nullptr;
+        SECKEYPublicKey *pubk = nullptr;
 
         switch (mKeyType) {
         case rsaKey:
           mRv = GenerateRSAKeyPair(slot, &privk, &pubk);
           break;
         case dsaKey:
           mRv = GenerateDSAKeyPair(slot, &privk, &pubk);
           break;
@@ -533,21 +533,21 @@ SignRunnable::Run()
   if (!NS_IsMainThread()) {
     nsNSSShutDownPreventionLock locker;
     if (isAlreadyShutDown()) {
       mRv = NS_ERROR_NOT_AVAILABLE;
     } else {
       // We need the output in PKCS#11 format, not DER encoding, so we must use
       // PK11_HashBuf and PK11_Sign instead of SEC_SignData.
 
-      SECItem sig = { siBuffer, NULL, 0 };
+      SECItem sig = { siBuffer, nullptr, 0 };
       int sigLength = PK11_SignatureLen(mPrivateKey);
       if (sigLength <= 0) {
         mRv = PRErrorCode_to_nsresult(PR_GetError());
-      } else if (!SECITEM_AllocItem(NULL, &sig, sigLength)) {
+      } else if (!SECITEM_AllocItem(nullptr, &sig, sigLength)) {
         mRv = PRErrorCode_to_nsresult(PR_GetError());
       } else {
         uint8_t hash[32]; // big enough for SHA-1 or SHA-256
         SECOidTag hashAlg = mPrivateKey->keyType == dsaKey ? SEC_OID_SHA1
                                                            : SEC_OID_SHA256;
         SECItem hashItem = { siBuffer, hash,
                              hashAlg == SEC_OID_SHA1 ? 20u : 32u };
 
@@ -581,23 +581,23 @@ SignRunnable::Run()
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(IdentityCryptoService, Init)
 
 #define NS_IDENTITYCRYPTOSERVICE_CID \
   {0xbea13a3a, 0x44e8, 0x4d7f, {0xa0, 0xa2, 0x2c, 0x67, 0xf8, 0x4e, 0x3a, 0x97}}
 
 NS_DEFINE_NAMED_CID(NS_IDENTITYCRYPTOSERVICE_CID);
 
 const mozilla::Module::CIDEntry kCIDs[] = {
-  { &kNS_IDENTITYCRYPTOSERVICE_CID, false, NULL, IdentityCryptoServiceConstructor },
-  { NULL }
+  { &kNS_IDENTITYCRYPTOSERVICE_CID, false, nullptr, IdentityCryptoServiceConstructor },
+  { nullptr }
 };
 
 const mozilla::Module::ContractIDEntry kContracts[] = {
   { "@mozilla.org/identity/crypto-service;1", &kNS_IDENTITYCRYPTOSERVICE_CID },
-  { NULL }
+  { nullptr }
 };
 
 const mozilla::Module kModule = {
   mozilla::Module::kVersion,
   kCIDs,
   kContracts
 };
 
--- a/toolkit/library/nsDllMain.cpp
+++ b/toolkit/library/nsDllMain.cpp
@@ -118,17 +118,17 @@ FARPROC WINAPI DelayDllLoadHook(unsigned
     NS_ABORT();
   }
   if (dliNotify == dliNotePreGetProcAddress &&
       IsWinRTDLLPresent(pdli, kvccorlib) &&
       pdli->dlp.szProcName &&
       !strnicmp(pdli->dlp.szProcName, kfailfast, strlen(kfailfast))) {
     return (FARPROC)__abi_MozFailFast;
   }
-  return NULL;
+  return nullptr;
 }
 
 ExternC PfnDliHook __pfnDliNotifyHook2 = DelayDllLoadHook;
 ExternC PfnDliHook __pfnDliFailureHook2 = DelayDllLoadHook;
 
 #endif // MOZ_METRO
 
 #if defined(__GNUC__)
--- a/toolkit/library/nsStaticXULComponents.cpp
+++ b/toolkit/library/nsStaticXULComponents.cpp
@@ -256,12 +256,12 @@ MODULE(WifiProxyServiceModule)
 #define MODULE(_name) \
     &NSMODULE_NAME(_name),
 
 extern const mozilla::Module *const *const kPStaticModules[] = {
   XUL_MODULES
 #ifdef MOZ_WIDGET_GONK
 MODULE(WifiProxyServiceModule)
 #endif
-  NULL
+  nullptr
 };
 
 #undef MODULE
--- a/toolkit/system/androidproxy/nsAndroidSystemProxySettings.cpp
+++ b/toolkit/system/androidproxy/nsAndroidSystemProxySettings.cpp
@@ -68,23 +68,23 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsAn
     {0xf01f0060, 0x3708, 0x478e,                            \
     {0xb9, 0x35, 0x3e, 0xce, 0x8b, 0xe2, 0x94, 0xb8}}
 
 NS_DEFINE_NAMED_CID(NS_ANDROIDSYSTEMPROXYSERVICE_CID);
 
 void test() {};
 
 static const mozilla::Module::CIDEntry kSysProxyCIDs[] = {
-    { &kNS_ANDROIDSYSTEMPROXYSERVICE_CID, false, NULL, nsAndroidSystemProxySettingsConstructor },
-    { NULL }
+    { &kNS_ANDROIDSYSTEMPROXYSERVICE_CID, false, nullptr, nsAndroidSystemProxySettingsConstructor },
+    { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kSysProxyContracts[] = {
     { NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_ANDROIDSYSTEMPROXYSERVICE_CID },
-    { NULL }
+    { nullptr }
 };
 
 static const mozilla::Module kSysProxyModule = {
     mozilla::Module::kVersion,
     kSysProxyCIDs,
     kSysProxyContracts
 };
 
--- a/toolkit/system/dbus/nsDBusModule.cpp
+++ b/toolkit/system/dbus/nsDBusModule.cpp
@@ -20,23 +20,23 @@
   }
   
 /* ===== XPCOM registration stuff ======== */
 
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsNetworkManagerListener, Init)
 NS_DEFINE_NAMED_CID(NS_DBUS_NETWORK_LINK_SERVICE_CID);
 
 static const mozilla::Module::CIDEntry kDBUSCIDs[] = {
-    { &kNS_DBUS_NETWORK_LINK_SERVICE_CID, false, NULL, nsNetworkManagerListenerConstructor },
-    { NULL }
+    { &kNS_DBUS_NETWORK_LINK_SERVICE_CID, false, nullptr, nsNetworkManagerListenerConstructor },
+    { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kDBUSContracts[] = {
     { NS_NETWORK_LINK_SERVICE_CONTRACTID, &kNS_DBUS_NETWORK_LINK_SERVICE_CID },
-    { NULL }
+    { nullptr }
 };
 
 static const mozilla::Module kDBUSModule = {
     mozilla::Module::kVersion,
     kDBUSCIDs,
     kDBUSContracts
 };
 
--- a/toolkit/system/dbus/nsDBusService.cpp
+++ b/toolkit/system/dbus/nsDBusService.cpp
@@ -123,21 +123,21 @@ void nsDBusService::HandleDBusDisconnect
                                              5000, nsITimer::TYPE_REPEATING_SLACK);
   if (NS_FAILED(rv)) {
     mReconnectTimer = nullptr;
     return;
   }
 }
 
 nsresult nsDBusService::CreateConnection() {
-  mConnection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+  mConnection = dbus_bus_get(DBUS_BUS_SYSTEM, nullptr);
   if (!mConnection)
     return NS_ERROR_FAILURE;
 
   dbus_connection_set_exit_on_disconnect(mConnection, false);
-  dbus_connection_setup_with_g_main(mConnection, NULL);
+  dbus_connection_setup_with_g_main(mConnection, nullptr);
 
-  if (!dbus_connection_add_filter(mConnection, dbus_filter, this, NULL))
+  if (!dbus_connection_add_filter(mConnection, dbus_filter, this, nullptr))
     return NS_ERROR_FAILURE;
 
   mSingleClient->RegisterWithConnection(mConnection);
   return NS_OK;
 }
--- a/toolkit/system/dbus/nsNetworkManagerListener.cpp
+++ b/toolkit/system/dbus/nsNetworkManagerListener.cpp
@@ -120,17 +120,17 @@ nsNetworkManagerListener::RegisterWithCo
   }
 
   DBusPendingCall* reply = mDBUS->SendWithReply(this, msg);
   if (!reply) {
     mOK = false;
     return;
   }
 
-  dbus_pending_call_set_notify(reply, NetworkStatusNotify, this, NULL);
+  dbus_pending_call_set_notify(reply, NetworkStatusNotify, this, nullptr);
   dbus_pending_call_unref(reply);
 }
 
 void
 nsNetworkManagerListener::NotifyNetworkStatusObservers() {
   nsCOMPtr<nsIObserverService> observerService =
     do_GetService("@mozilla.org/observer-service;1");
   if (!observerService) {
@@ -167,17 +167,17 @@ nsNetworkManagerListener::HandleMessage(
   }
   return false;
 }
 
 void
 nsNetworkManagerListener::UpdateNetworkStatus(DBusMessage* msg)
 {
   int32_t result;
-  if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_UINT32, &result,
+  if (!dbus_message_get_args(msg, nullptr, DBUS_TYPE_UINT32, &result,
                              DBUS_TYPE_INVALID)) {
     return;
   }
 
   mNetworkManagerActive = true;
 
   bool wasUp = mLinkUp;
   mLinkUp = result == NM_STATE_CONNECTED_OLD ||
--- a/toolkit/system/gnome/nsAlertsIconListener.cpp
+++ b/toolkit/system/gnome/nsAlertsIconListener.cpp
@@ -51,17 +51,17 @@ static void notify_closed_marshal(GClosu
   NS_RELEASE(alert);
 }
 
 NS_IMPL_ISUPPORTS3(nsAlertsIconListener, imgINotificationObserver,
                    nsIObserver, nsISupportsWeakReference)
 
 nsAlertsIconListener::nsAlertsIconListener()
 : mLoadedFrame(false),
-  mNotification(NULL)
+  mNotification(nullptr)
 {
   if (!libNotifyHandle && !libNotifyNotAvail) {
     libNotifyHandle = dlopen("libnotify.so.4", RTLD_LAZY);
     if (!libNotifyHandle) {
       libNotifyHandle = dlopen("libnotify.so.1", RTLD_LAZY);
       if (!libNotifyHandle) {
         libNotifyNotAvail = true;
         return;
@@ -106,17 +106,17 @@ nsAlertsIconListener::Notify(imgIRequest
 nsresult
 nsAlertsIconListener::OnStopRequest(imgIRequest* aRequest)
 {
   uint32_t imgStatus = imgIRequest::STATUS_ERROR;
   nsresult rv = aRequest->GetImageStatus(&imgStatus);
   NS_ENSURE_SUCCESS(rv, rv);
   if (imgStatus == imgIRequest::STATUS_ERROR && !mLoadedFrame) {
     // We have an error getting the image. Display the notification with no icon.
-    ShowAlert(NULL);
+    ShowAlert(nullptr);
   }
 
   if (mIconRequest) {
     mIconRequest->Cancel(NS_BINDING_ABORTED);
     mIconRequest = nullptr;
   }
   return NS_OK;
 }
@@ -148,95 +148,96 @@ nsAlertsIconListener::OnStopFrame(imgIRe
 
   mLoadedFrame = true;
   return NS_OK;
 }
 
 nsresult
 nsAlertsIconListener::ShowAlert(GdkPixbuf* aPixbuf)
 {
-  mNotification = notify_notification_new(mAlertTitle.get(), mAlertText.get(), NULL, NULL);
+  mNotification = notify_notification_new(mAlertTitle.get(), mAlertText.get(),
+                                          nullptr, nullptr);
 
   if (!mNotification)
     return NS_ERROR_OUT_OF_MEMORY;
 
   if (aPixbuf)
     notify_notification_set_icon_from_pixbuf(mNotification, aPixbuf);
 
   NS_ADDREF(this);
   if (mAlertHasAction) {
     // What we put as the label doesn't matter here, if the action
     // string is "default" then that makes the entire bubble clickable
     // rather than creating a button.
     notify_notification_add_action(mNotification, "default", "Activate",
-                                   notify_action_cb, this, NULL);
+                                   notify_action_cb, this, nullptr);
   }
 
   // Fedora 10 calls NotifyNotification "closed" signal handlers with a
   // different signature, so a marshaller is used instead of a C callback to
   // get the user_data (this) in a parseable format.  |closure| is created
   // with a floating reference, which gets sunk by g_signal_connect_closure().
   GClosure* closure = g_closure_new_simple(sizeof(GClosure), this);
   g_closure_set_marshal(closure, notify_closed_marshal);
   mClosureHandler = g_signal_connect_closure(mNotification, "closed", closure, FALSE);
-  gboolean result = notify_notification_show(mNotification, NULL);
+  gboolean result = notify_notification_show(mNotification, nullptr);
 
   return result ? NS_OK : NS_ERROR_FAILURE;
 }
 
 nsresult
 nsAlertsIconListener::StartRequest(const nsAString & aImageUrl)
 {
   if (mIconRequest) {
     // Another icon request is already in flight.  Kill it.
     mIconRequest->Cancel(NS_BINDING_ABORTED);
     mIconRequest = nullptr;
   }
 
   nsCOMPtr<nsIURI> imageUri;
   NS_NewURI(getter_AddRefs(imageUri), aImageUrl);
   if (!imageUri)
-    return ShowAlert(NULL);
+    return ShowAlert(nullptr);
 
   nsCOMPtr<imgILoader> il(do_GetService("@mozilla.org/image/loader;1"));
   if (!il)
-    return ShowAlert(NULL);
+    return ShowAlert(nullptr);
 
-  return il->LoadImageXPCOM(imageUri, nullptr, nullptr, nullptr, nullptr, this,
-			    nullptr, nsIRequest::LOAD_NORMAL, nullptr, nullptr,
-			    getter_AddRefs(mIconRequest));
+  return il->LoadImageXPCOM(imageUri, nullptr, nullptr, nullptr, nullptr,
+                            this, nullptr, nsIRequest::LOAD_NORMAL, nullptr,
+                            nullptr, getter_AddRefs(mIconRequest));
 }
 
 void
 nsAlertsIconListener::SendCallback()
 {
   if (mAlertListener)
-    mAlertListener->Observe(NULL, "alertclickcallback", mAlertCookie.get());
+    mAlertListener->Observe(nullptr, "alertclickcallback", mAlertCookie.get());
 }
 
 void
 nsAlertsIconListener::SendClosed()
 {
   if (mNotification) {
     g_object_unref(mNotification);
-    mNotification = NULL;
+    mNotification = nullptr;
   }
   if (mAlertListener)
-    mAlertListener->Observe(NULL, "alertfinished", mAlertCookie.get());
+    mAlertListener->Observe(nullptr, "alertfinished", mAlertCookie.get());
 }
 
 NS_IMETHODIMP
 nsAlertsIconListener::Observe(nsISupports *aSubject, const char *aTopic,
                               const PRUnichar *aData) {
   // We need to close any open notifications upon application exit, otherwise
   // we will leak since libnotify holds a ref for us.
   if (!nsCRT::strcmp(aTopic, "quit-application") && mNotification) {
     g_signal_handler_disconnect(mNotification, mClosureHandler);
     g_object_unref(mNotification);
-    mNotification = NULL;
+    mNotification = nullptr;
     Release(); // equivalent to NS_RELEASE(this)
   }
   return NS_OK;
 }
 
 nsresult
 nsAlertsIconListener::InitAlertAsync(const nsAString & aImageUrl,
                                      const nsAString & aAlertTitle, 
@@ -273,23 +274,23 @@ nsAlertsIconListener::InitAlertAsync(con
     }
 
     if (!notify_init(appShortName.get()))
       return NS_ERROR_FAILURE;
 
     GList *server_caps = notify_get_server_caps();
     if (server_caps) {
       gHasCaps = true;
-      for (GList* cap = server_caps; cap != NULL; cap = cap->next) {
+      for (GList* cap = server_caps; cap != nullptr; cap = cap->next) {
         if (!strcmp((char*) cap->data, "actions")) {
           gHasActions = true;
           break;
         }
       }
-      g_list_foreach(server_caps, (GFunc)g_free, NULL);
+      g_list_foreach(server_caps, (GFunc)g_free, nullptr);
       g_list_free(server_caps);
     }
   }
 
   if (!gHasCaps) {
     // if notify_get_server_caps() failed above we need to assume
     // there is no notification-server to display anything
     return NS_ERROR_FAILURE;
--- a/toolkit/system/gnome/nsGIOService.cpp
+++ b/toolkit/system/gnome/nsGIOService.cpp
@@ -14,29 +14,29 @@
 #include <gtk/gtk.h>
 
 
 char *
 get_content_type_from_mime_type(const char *mimeType)
 {
   GList* contentTypes = g_content_types_get_registered();
   GList* ct_ptr = contentTypes;
-  char* foundContentType = NULL;
+  char* foundContentType = nullptr;
 
   while (ct_ptr) {
     char *mimeTypeFromContentType =  g_content_type_get_mime_type((char*)ct_ptr->data);
     if (strcmp(mimeTypeFromContentType, mimeType) == 0) {
       foundContentType = g_strdup((char*)ct_ptr->data);
       g_free(mimeTypeFromContentType);
       break;
     }
     g_free(mimeTypeFromContentType);
     ct_ptr = ct_ptr->next;
   }
-  g_list_foreach(contentTypes, (GFunc) g_free, NULL);
+  g_list_foreach(contentTypes, (GFunc) g_free, nullptr);
   g_list_free(contentTypes);
   return foundContentType;
 }
 
 class nsGIOMimeApp MOZ_FINAL : public nsIGIOMimeApp
 {
 public:
   NS_DECL_ISUPPORTS
@@ -84,18 +84,18 @@ nsGIOMimeApp::GetExpectsURIs(int32_t* aE
 
 NS_IMETHODIMP
 nsGIOMimeApp::Launch(const nsACString& aUri)
 {
   GList uris = { 0 };
   PromiseFlatCString flatUri(aUri);
   uris.data = const_cast<char*>(flatUri.get());
 
-  GError *error = NULL;
-  gboolean result = g_app_info_launch_uris(mApp, &uris, NULL, &error);
+  GError *error = nullptr;
+  gboolean result = g_app_info_launch_uris(mApp, &uris, nullptr, &error);
 
   if (!result) {
     g_warning("Cannot launch application: %s", error->message);
     g_error_free(error);
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
@@ -146,17 +146,17 @@ nsGIOMimeApp::GetSupportedURISchemes(nsI
 
   if (!gvfs) {
     g_warning("Cannot get GVfs object.");
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   const gchar* const * uri_schemes = g_vfs_get_supported_uri_schemes(gvfs);
 
-  while (*uri_schemes != NULL) {
+  while (*uri_schemes != nullptr) {
     if (!array->mStrings.AppendElement(*uri_schemes)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
     uri_schemes++;
   }
 
   NS_ADDREF(*aSchemes = array);
   return NS_OK;
@@ -164,17 +164,17 @@ nsGIOMimeApp::GetSupportedURISchemes(nsI
 
 NS_IMETHODIMP
 nsGIOMimeApp::SetAsDefaultForMimeType(nsACString const& aMimeType)
 {
   char *content_type =
     get_content_type_from_mime_type(PromiseFlatCString(aMimeType).get());
   if (!content_type)
     return NS_ERROR_FAILURE;
-  GError *error = NULL;
+  GError *error = nullptr;
   g_app_info_set_as_default_for_type(mApp,
                                      content_type,
                                      &error);
   if (error) {
     g_warning("Cannot set application as default for MIME type (%s): %s",
               PromiseFlatCString(aMimeType).get(),
               error->message);
     g_error_free(error);
@@ -189,17 +189,17 @@ nsGIOMimeApp::SetAsDefaultForMimeType(ns
  * Set default application for files with given extensions
  * @param fileExts string of space separated extensions
  * @return NS_OK when application was set as default for given extensions,
  * NS_ERROR_FAILURE otherwise
  */
 NS_IMETHODIMP
 nsGIOMimeApp::SetAsDefaultForFileExtensions(nsACString const& fileExts)
 {
-  GError *error = NULL;
+  GError *error = nullptr;
   char *extensions = g_strdup(PromiseFlatCString(fileExts).get());
   char *ext_pos = extensions;
   char *space_pos;
 
   while ( (space_pos = strchr(ext_pos, ' ')) || (*ext_pos != '\0') ) {
     if (space_pos) {
       *space_pos = '\0';
     }
@@ -226,17 +226,17 @@ nsGIOMimeApp::SetAsDefaultForFileExtensi
  * Set default application for URI's of a particular scheme
  * @param aURIScheme string containing the URI scheme
  * @return NS_OK when application was set as default for URI scheme,
  * NS_ERROR_FAILURE otherwise
  */
 NS_IMETHODIMP
 nsGIOMimeApp::SetAsDefaultForURIScheme(nsACString const& aURIScheme)
 {
-  GError *error = NULL;
+  GError *error = nullptr;
   nsAutoCString contentType("x-scheme-handler/");
   contentType.Append(aURIScheme);
 
   g_app_info_set_as_default_for_type(mApp,
                                      contentType.get(),
                                      &error);
   if (error) {
     g_warning("Cannot set application as default for URI scheme (%s): %s",
@@ -255,17 +255,17 @@ NS_IMETHODIMP
 nsGIOService::GetMimeTypeFromExtension(const nsACString& aExtension,
                                              nsACString& aMimeType)
 {
   nsAutoCString fileExtToUse("file.");
   fileExtToUse.Append(aExtension);
 
   gboolean result_uncertain;
   char *content_type = g_content_type_guess(fileExtToUse.get(),
-                                            NULL,
+                                            nullptr,
                                             0,
                                             &result_uncertain);
   if (!content_type)
     return NS_ERROR_FAILURE;
 
   char *mime_type = g_content_type_get_mime_type(content_type);
   if (!mime_type) {
     g_free(content_type);
@@ -342,34 +342,34 @@ nsGIOService::GetDescriptionForMimeType(
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGIOService::ShowURI(nsIURI* aURI)
 {
   nsAutoCString spec;
   aURI->GetSpec(spec);
-  GError *error = NULL;
-  if (!g_app_info_launch_default_for_uri(spec.get(), NULL, &error)) {
-    g_warning("Could not launch default application for URI: %s" ,error->message);
+  GError *error = nullptr;
+  if (!g_app_info_launch_default_for_uri(spec.get(), nullptr, &error)) {
+    g_warning("Could not launch default application for URI: %s", error->message);
     g_error_free(error);
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGIOService::ShowURIForInput(const nsACString& aUri)
 {
   GFile *file = g_file_new_for_commandline_arg(PromiseFlatCString(aUri).get());
   char* spec = g_file_get_uri(file);
   nsresult rv = NS_ERROR_FAILURE;
-  GError *error = NULL;
+  GError *error = nullptr;
 
-  g_app_info_launch_default_for_uri(spec, NULL, &error);
+  g_app_info_launch_default_for_uri(spec, nullptr, &error);
   if (error) {
     g_warning("Cannot launch default application: %s", error->message);
     g_error_free(error);
   } else {
     rv = NS_OK;
   }
   g_object_unref(file);
   g_free(spec);
@@ -385,20 +385,20 @@ nsGIOService::ShowURIForInput(const nsAC
  * @param appInfo location where created GAppInfo is stored
  * @return NS_OK when object is created, NS_ERROR_FAILURE otherwise.
  */
 NS_IMETHODIMP
 nsGIOService::CreateAppFromCommand(nsACString const& cmd,
                                    nsACString const& appName,
                                    nsIGIOMimeApp**   appInfo)
 {
-  GError *error = NULL;
+  GError *error = nullptr;
   *appInfo = nullptr;
 
-  GAppInfo *app_info = NULL, *app_info_from_list = NULL;
+  GAppInfo *app_info = nullptr, *app_info_from_list = nullptr;
   GList *apps = g_app_info_get_all();
   GList *apps_p = apps;
 
   // Try to find relevant and existing GAppInfo in all installed application
   // We do this by comparing each GAppInfo's executable with out own
   while (apps_p) {
     app_info_from_list = (GAppInfo*) apps_p->data;
     if (!app_info) {
--- a/toolkit/system/gnome/nsGSettingsService.cpp
+++ b/toolkit/system/gnome/nsGSettingsService.cpp
@@ -79,17 +79,17 @@ static PRLibrary *gioLib = nullptr;
 
 class nsGSettingsCollection MOZ_FINAL : public nsIGSettingsCollection
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIGSETTINGSCOLLECTION
 
   nsGSettingsCollection(GSettings* aSettings) : mSettings(aSettings),
-                                                mKeys(NULL) {}
+                                                mKeys(nullptr) {}
   ~nsGSettingsCollection();
 
 private:
   bool KeyExists(const nsACString& aKey);
   bool SetValue(const nsACString& aKey,
                   GVariant *aValue);
 
   GSettings *mSettings;
@@ -103,17 +103,17 @@ nsGSettingsCollection::~nsGSettingsColle
 }
 
 bool
 nsGSettingsCollection::KeyExists(const nsACString& aKey)
 {
   if (!mKeys)
     mKeys = g_settings_list_keys(mSettings);
 
-  for (uint32_t i = 0; mKeys[i] != NULL; i++) {
+  for (uint32_t i = 0; mKeys[i] != nullptr; i++) {
     if (aKey.Equals(mKeys[i]))
       return true;
   }
 
   return false;
 }
 
 bool
@@ -185,17 +185,17 @@ nsGSettingsCollection::GetString(const n
                                          PromiseFlatCString(aKey).get());
   if (!g_variant_is_of_type(value, G_VARIANT_TYPE_STRING) &&
       !g_variant_is_of_type(value, G_VARIANT_TYPE_OBJECT_PATH) &&
       !g_variant_is_of_type(value, G_VARIANT_TYPE_SIGNATURE)) {
     g_variant_unref(value);
     return NS_ERROR_FAILURE;
   }
 
-  aResult.Assign(g_variant_get_string(value, NULL));
+  aResult.Assign(g_variant_get_string(value, nullptr));
   g_variant_unref(value);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsGSettingsCollection::GetBoolean(const nsACString& aKey,
                                   bool* aResult)
@@ -264,26 +264,26 @@ nsGSettingsCollection::GetStringList(con
   GVariant *value = g_settings_get_value(mSettings,
                                          PromiseFlatCString(aKey).get());
 
   if (!g_variant_is_of_type(value, G_VARIANT_TYPE_STRING_ARRAY)) {
     g_variant_unref(value);
     return NS_ERROR_FAILURE;
   }
 
-  const gchar ** gs_strings = g_variant_get_strv(value, NULL);
+  const gchar ** gs_strings = g_variant_get_strv(value, nullptr);
   if (!gs_strings) {
     // empty array
     NS_ADDREF(*aResult = items);
     g_variant_unref(value);
     return NS_OK;
   }
 
   const gchar** p_gs_strings = gs_strings;
-  while (*p_gs_strings != NULL)
+  while (*p_gs_strings != nullptr)
   {
     nsCOMPtr<nsISupportsCString> obj(do_CreateInstance(NS_SUPPORTS_CSTRING_CONTRACTID));
     if (obj) {
       obj->SetData(nsDependentCString(*p_gs_strings));
       items->AppendElement(obj, false);
     }
     p_gs_strings++;
   }
@@ -332,17 +332,17 @@ nsGSettingsService::~nsGSettingsService(
 NS_IMETHODIMP
 nsGSettingsService::GetCollectionForSchema(const nsACString& schema,
                                            nsIGSettingsCollection** collection)
 {
   NS_ENSURE_ARG_POINTER(collection);
 
   const char * const *schemas = g_settings_list_schemas();
 
-  for (uint32_t i = 0; schemas[i] != NULL; i++) {
+  for (uint32_t i = 0; schemas[i] != nullptr; i++) {
     if (schema.Equals(schemas[i])) {
       GSettings *settings = g_settings_new(PromiseFlatCString(schema).get());
       nsGSettingsCollection *mozGSettings = new nsGSettingsCollection(settings);
       NS_ADDREF(*collection = mozGSettings);
       return NS_OK;
     }
   }
 
--- a/toolkit/system/gnome/nsGnomeModule.cpp
+++ b/toolkit/system/gnome/nsGnomeModule.cpp
@@ -31,51 +31,51 @@ NS_DEFINE_NAMED_CID(NS_GNOMEVFSSERVICE_C
 #endif
 #ifdef MOZ_ENABLE_GIO
 NS_DEFINE_NAMED_CID(NS_GIOSERVICE_CID);
 NS_DEFINE_NAMED_CID(NS_GSETTINGSSERVICE_CID);
 #endif
 
 static const mozilla::Module::CIDEntry kGnomeCIDs[] = {
 #ifdef MOZ_ENABLE_GCONF
-  { &kNS_GCONFSERVICE_CID, false, NULL, nsGConfServiceConstructor },
+  { &kNS_GCONFSERVICE_CID, false, nullptr, nsGConfServiceConstructor },
 #endif
 #ifdef MOZ_ENABLE_GNOMEVFS
-  { &kNS_GNOMEVFSSERVICE_CID, false, NULL, nsGnomeVFSServiceConstructor },
+  { &kNS_GNOMEVFSSERVICE_CID, false, nullptr, nsGnomeVFSServiceConstructor },
 #endif
 #ifdef MOZ_ENABLE_GIO
-  { &kNS_GIOSERVICE_CID, false, NULL, nsGIOServiceConstructor },
-  { &kNS_GSETTINGSSERVICE_CID, false, NULL, nsGSettingsServiceConstructor },
+  { &kNS_GIOSERVICE_CID, false, nullptr, nsGIOServiceConstructor },
+  { &kNS_GSETTINGSSERVICE_CID, false, nullptr, nsGSettingsServiceConstructor },
 #endif
-  { NULL }
+  { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kGnomeContracts[] = {
 #ifdef MOZ_ENABLE_GCONF
   { NS_GCONFSERVICE_CONTRACTID, &kNS_GCONFSERVICE_CID },
 #endif
 #ifdef MOZ_ENABLE_GNOMEVFS
   { NS_GNOMEVFSSERVICE_CONTRACTID, &kNS_GNOMEVFSSERVICE_CID },
 #endif
 #ifdef MOZ_ENABLE_GIO
   { NS_GIOSERVICE_CONTRACTID, &kNS_GIOSERVICE_CID },
   { NS_GSETTINGSSERVICE_CONTRACTID, &kNS_GSETTINGSSERVICE_CID },
 #endif
-  { NULL }
+  { nullptr }
 };
 
 static nsresult
 InitGType ()
 {
   g_type_init();
   return NS_OK;
 }
 
 static const mozilla::Module kGnomeModule = {
   mozilla::Module::kVersion,
   kGnomeCIDs,
   kGnomeContracts,
-  NULL,
-  NULL,
+  nullptr,
+  nullptr,
   InitGType
 };
 
 NSMODULE_DEFN(mozgnome) = &kGnomeModule;
--- a/toolkit/system/gnome/nsGnomeVFSService.cpp
+++ b/toolkit/system/gnome/nsGnomeVFSService.cpp
@@ -199,26 +199,26 @@ nsGnomeVFSService::GetDescriptionForMime
 }
 
 NS_IMETHODIMP
 nsGnomeVFSService::ShowURI(nsIURI *aURI)
 {
   nsAutoCString spec;
   aURI->GetSpec(spec);
 
-  if (gnome_vfs_url_show_with_env(spec.get(), NULL) == GNOME_VFS_OK)
+  if (gnome_vfs_url_show_with_env(spec.get(), nullptr) == GNOME_VFS_OK)
     return NS_OK;
 
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsGnomeVFSService::ShowURIForInput(const nsACString &aUri)
 {
   char* spec = gnome_vfs_make_uri_from_input(PromiseFlatCString(aUri).get());
   nsresult rv = NS_ERROR_FAILURE;
 
-  if (gnome_vfs_url_show_with_env(spec, NULL) == GNOME_VFS_OK)
+  if (gnome_vfs_url_show_with_env(spec, nullptr) == GNOME_VFS_OK)
     rv = NS_OK;
 
   g_free(spec);
   return rv;
 }
--- a/toolkit/system/unixproxy/nsLibProxySettings.cpp
+++ b/toolkit/system/unixproxy/nsLibProxySettings.cpp
@@ -80,17 +80,17 @@ nsUnixSystemProxySettings::GetProxyForUR
   // <procotol>://[username:password@]proxy:port
   // or
   // direct://
   //
   // PAC format: "PROXY proxy1.foo.com:8080; PROXY proxy2.foo.com:8080; DIRECT"
   // but nsISystemProxySettings allows "PROXY http://proxy.foo.com:8080" as well.
 
   int c = 0;
-  while (proxyArray[c] != NULL) {
+  while (proxyArray[c] != nullptr) {
     if (!aResult.IsEmpty()) {
       aResult.AppendLiteral("; ");
     }
 
     // figure out the scheme, and we can't use nsIIOService::NewURI because
     // this is not the main thread.
     char *colon = strchr (proxyArray[c], ':');
     uint32_t schemelen = colon ? colon - proxyArray[c] : 0;
@@ -117,23 +117,23 @@ nsUnixSystemProxySettings::GetProxyForUR
 #define NS_UNIXSYSTEMPROXYSERVICE_CID  /* 0fa3158c-d5a7-43de-9181-a285e74cf1d4 */\
      { 0x0fa3158c, 0xd5a7, 0x43de, \
        {0x91, 0x81, 0xa2, 0x85, 0xe7, 0x4c, 0xf1, 0xd4 } }
 
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUnixSystemProxySettings, Init)
 NS_DEFINE_NAMED_CID(NS_UNIXSYSTEMPROXYSERVICE_CID);
 
 static const mozilla::Module::CIDEntry kUnixProxyCIDs[] = {
-  { &kNS_UNIXSYSTEMPROXYSERVICE_CID, false, NULL, nsUnixSystemProxySettingsConstructor },
-  { NULL }
+  { &kNS_UNIXSYSTEMPROXYSERVICE_CID, false, nullptr, nsUnixSystemProxySettingsConstructor },
+  { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kUnixProxyContracts[] = {
   { NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_UNIXSYSTEMPROXYSERVICE_CID },
-  { NULL }
+  { nullptr }
 };
 
 static const mozilla::Module kUnixProxyModule = {
   mozilla::Module::kVersion,
   kUnixProxyCIDs,
   kUnixProxyContracts
 };
         
--- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
+++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp
@@ -513,23 +513,23 @@ nsUnixSystemProxySettings::GetProxyForUR
 #define NS_UNIXSYSTEMPROXYSERVICE_CID  /* 0fa3158c-d5a7-43de-9181-a285e74cf1d4 */\
      { 0x0fa3158c, 0xd5a7, 0x43de, \
        {0x91, 0x81, 0xa2, 0x85, 0xe7, 0x4c, 0xf1, 0xd4 } }
 
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUnixSystemProxySettings, Init)
 NS_DEFINE_NAMED_CID(NS_UNIXSYSTEMPROXYSERVICE_CID);
 
 static const mozilla::Module::CIDEntry kUnixProxyCIDs[] = {
-  { &kNS_UNIXSYSTEMPROXYSERVICE_CID, false, NULL, nsUnixSystemProxySettingsConstructor },
-  { NULL }
+  { &kNS_UNIXSYSTEMPROXYSERVICE_CID, false, nullptr, nsUnixSystemProxySettingsConstructor },
+  { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kUnixProxyContracts[] = {
   { NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_UNIXSYSTEMPROXYSERVICE_CID },
-  { NULL }
+  { nullptr }
 };
 
 static const mozilla::Module kUnixProxyModule = {
   mozilla::Module::kVersion,
   kUnixProxyCIDs,
   kUnixProxyContracts
 };
 
--- a/toolkit/system/windowsproxy/nsWindowsSystemProxySettings.cpp
+++ b/toolkit/system/windowsproxy/nsWindowsSystemProxySettings.cpp
@@ -77,31 +77,32 @@ static nsresult ReadInternetOption(uint3
 
     INTERNET_PER_CONN_OPTIONW options[2];
     options[0].dwOption = INTERNET_PER_CONN_FLAGS_UI;
     options[1].dwOption = aOption;
 
     INTERNET_PER_CONN_OPTION_LISTW list;
     list.dwSize = sizeof(INTERNET_PER_CONN_OPTION_LISTW);
     list.pszConnection = connFlags & INTERNET_CONNECTION_MODEM ?
-                         connName : NULL;
+                         connName : nullptr;
     list.dwOptionCount = mozilla::ArrayLength(options);
     list.dwOptionError = 0;
     list.pOptions = options;
 
     unsigned long size = sizeof(INTERNET_PER_CONN_OPTION_LISTW);
-    if (!InternetQueryOptionW(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
+    if (!InternetQueryOptionW(nullptr, INTERNET_OPTION_PER_CONNECTION_OPTION,
                               &list, &size)) {
         if (GetLastError() != ERROR_INVALID_PARAMETER) {
             return NS_ERROR_FAILURE;
         }
         options[0].dwOption = INTERNET_PER_CONN_FLAGS;
         size = sizeof(INTERNET_PER_CONN_OPTION_LISTW);
         MOZ_SEH_TRY {
-            if (!InternetQueryOptionW(NULL, INTERNET_OPTION_PER_CONNECTION_OPTION,
+            if (!InternetQueryOptionW(nullptr,
+                                      INTERNET_OPTION_PER_CONNECTION_OPTION,
                                       &list, &size)) {
                 return NS_ERROR_FAILURE;
             }
         } MOZ_SEH_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
             return NS_ERROR_FAILURE;
         }
     }
 
@@ -298,23 +299,23 @@ nsWindowsSystemProxySettings::GetProxyFo
 #define NS_WINDOWSSYSTEMPROXYSERVICE_CID  /* 4e22d3ea-aaa2-436e-ada4-9247de57d367 */\
     { 0x4e22d3ea, 0xaaa2, 0x436e, \
         {0xad, 0xa4, 0x92, 0x47, 0xde, 0x57, 0xd3, 0x67 } }
 
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowsSystemProxySettings, Init)
 NS_DEFINE_NAMED_CID(NS_WINDOWSSYSTEMPROXYSERVICE_CID);
 
 static const mozilla::Module::CIDEntry kSysProxyCIDs[] = {
-    { &kNS_WINDOWSSYSTEMPROXYSERVICE_CID, false, NULL, nsWindowsSystemProxySettingsConstructor },
-    { NULL }
+    { &kNS_WINDOWSSYSTEMPROXYSERVICE_CID, false, nullptr, nsWindowsSystemProxySettingsConstructor },
+    { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kSysProxyContracts[] = {
     { NS_SYSTEMPROXYSETTINGS_CONTRACTID, &kNS_WINDOWSSYSTEMPROXYSERVICE_CID },
-    { NULL }
+    { nullptr }
 };
 
 static const mozilla::Module kSysProxyModule = {
     mozilla::Module::kVersion,
     kSysProxyCIDs,
     kSysProxyContracts
 };
 
--- a/toolkit/xre/EventTracer.cpp
+++ b/toolkit/xre/EventTracer.cpp
@@ -64,17 +64,17 @@
 #include <prtime.h>
 
 using mozilla::TimeDuration;
 using mozilla::TimeStamp;
 using mozilla::FireAndWaitForTracerEvent;
 
 namespace {
 
-PRThread* sTracerThread = NULL;
+PRThread* sTracerThread = nullptr;
 bool sExit = false;
 
 struct TracerStartClosure {
   bool mLogTracing;
 };
 
 /*
  * The tracer thread fires events at the native event loop roughly
@@ -95,22 +95,22 @@ void TracerThread(void *arg)
   // These are the defaults. They can be overridden by environment vars.
   // This should be set to the maximum latency we'd like to allow
   // for responsiveness.
   PRIntervalTime threshold = PR_MillisecondsToInterval(20);
   // This is the sampling interval.
   PRIntervalTime interval = PR_MillisecondsToInterval(10);
 
   sExit = false;
-  FILE* log = NULL;
+  FILE* log = nullptr;
   char* envfile = PR_GetEnv("MOZ_INSTRUMENT_EVENT_LOOP_OUTPUT");
   if (envfile) {
     log = fopen(envfile, "w");
   }
-  if (log == NULL)
+  if (log == nullptr)
     log = stdout;
 
   char* thresholdenv = PR_GetEnv("MOZ_INSTRUMENT_EVENT_LOOP_THRESHOLD");
   if (thresholdenv && *thresholdenv) {
     int val = atoi(thresholdenv);
     if (val != 0 && val != INT_MAX && val != INT_MIN) {
       threshold = PR_MillisecondsToInterval(val);
     }
@@ -192,29 +192,29 @@ bool InitEventTracing(bool aLog)
   NS_ABORT_IF_FALSE(!sTracerThread, "Event tracing already initialized!");
   sTracerThread = PR_CreateThread(PR_USER_THREAD,
                                   TracerThread,
                                   args,
                                   PR_PRIORITY_NORMAL,
                                   PR_GLOBAL_THREAD,
                                   PR_JOINABLE_THREAD,
                                   0);
-  return sTracerThread != NULL;
+  return sTracerThread != nullptr;
 }
 
 void ShutdownEventTracing()
 {
   if (!sTracerThread)
     return;
 
   sExit = true;
   // Ensure that the tracer thread doesn't hang.
   SignalTracerThread();
 
   if (sTracerThread)
     PR_JoinThread(sTracerThread);
-  sTracerThread = NULL;
+  sTracerThread = nullptr;
 
   // Allow the widget backend to clean up.
   CleanUpWidgetTracing();
 }
 
 }  // namespace mozilla
--- a/toolkit/xre/MacQuirks.h
+++ b/toolkit/xre/MacQuirks.h
@@ -34,20 +34,20 @@ struct VersionPart {
  * @returns A pointer to the next versionpart, or null if none.
  */
 static char*
 ParseVP(char *part, VersionPart &result)
 {
   char *dot;
 
   result.numA = 0;
-  result.strB = NULL;
+  result.strB = nullptr;
   result.strBlen = 0;
   result.numC = 0;
-  result.extraD = NULL;
+  result.extraD = nullptr;
 
   if (!part)
     return part;
 
   dot = strchr(part, '.');
   if (dot)
     *dot = '\0';
 
@@ -55,17 +55,17 @@ ParseVP(char *part, VersionPart &result)
     result.numA = INT32_MAX;
     result.strB = "";
   }
   else {
     result.numA = strtol(part, const_cast<char**>(&result.strB), 10);
   }
 
   if (!*result.strB) {
-    result.strB = NULL;
+    result.strB = nullptr;
     result.strBlen = 0;
   }
   else {
     if (result.strB[0] == '+') {
       static const char kPre[] = "pre";
 
       ++result.numA;
       result.strB = kPre;
@@ -76,26 +76,26 @@ ParseVP(char *part, VersionPart &result)
       if (!numstart) {
   result.strBlen = strlen(result.strB);
       }
       else {
   result.strBlen = numstart - result.strB;
 
   result.numC = strtol(numstart, &result.extraD, 10);
   if (!*result.extraD)
-    result.extraD = NULL;
+    result.extraD = nullptr;
       }
     }
   }
 
   if (dot) {
     ++dot;
 
     if (!*dot)
-      dot = NULL;
+      dot = nullptr;
   }
 
   return dot;
 }
 
 
 // compare two null-terminated strings, which may be null pointers
 static int32_t
@@ -210,17 +210,17 @@ TriggerQuirks()
   int mib[2];
 
   mib[0] = CTL_KERN;
   mib[1] = KERN_OSRELEASE;
   // we won't support versions greater than 10.7.99
   char release[sizeof("10.7.99")];
   size_t len = sizeof(release);
   // sysctl will return ENOMEM if the release string is longer than sizeof(release)
-  int ret = sysctl(mib, 2, release, &len, NULL, 0);
+  int ret = sysctl(mib, 2, release, &len, nullptr, 0);
   // we only want to trigger this on OS X 10.6, on versions 10.6.8 or newer
   // Darwin version 10 corresponds to OS X version 10.6, version 11 is 10.7
   // http://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
   if (ret == 0 && NS_CompareVersions(release, "10.8.0") >= 0 && NS_CompareVersions(release, "11") < 0) {
     CFBundleRef mainBundle = CFBundleGetMainBundle();
     if (mainBundle) {
       CFRetain(mainBundle);
 
--- a/toolkit/xre/ProfileReset.cpp
+++ b/toolkit/xre/ProfileReset.cpp
@@ -135,17 +135,17 @@ ProfileResetCleanup(nsIToolkitProfile* a
   nsCOMPtr<nsIAppStartup> appStartup(do_GetService(NS_APPSTARTUP_CONTRACTID));
   if (!appStartup) return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIDOMWindow> progressWindow;
   rv = windowWatcher->OpenWindow(nullptr,
                                  kResetProgressURL,
                                  "_blank",
                                  "centerscreen,chrome,titlebar",
-                                 NULL,
+                                 nullptr,
                                  getter_AddRefs(progressWindow));
   if (NS_FAILED(rv)) return rv;
 
   // Create a new thread to do the bulk of profile cleanup to stay responsive.
   nsCOMPtr<nsIThreadManager> tm = do_GetService(NS_THREADMANAGER_CONTRACTID);
   nsCOMPtr<nsIThread> cleanupThread;
   rv = tm->NewThread(0, 0, getter_AddRefs(cleanupThread));
   if (NS_SUCCEEDED(rv)) {
--- a/toolkit/xre/glxtest.cpp
+++ b/toolkit/xre/glxtest.cpp
@@ -134,22 +134,22 @@ static void glxtest()
       !glXCreateContext ||
       !glXMakeCurrent ||
       !glXDestroyContext ||
       !glGetString)
   {
     fatal_error("glXGetProcAddress couldn't find required functions");
   }
   ///// Open a connection to the X server /////
-  Display *dpy = XOpenDisplay(NULL);
+  Display *dpy = XOpenDisplay(nullptr);
   if (!dpy)
     fatal_error("Unable to open a connection to the X server");
   
   ///// Check that the GLX extension is present /////
-  if (!glXQueryExtension(dpy, NULL, NULL))
+  if (!glXQueryExtension(dpy, nullptr, nullptr))
     fatal_error("GLX extension missing");
 
   XSetErrorHandler(x_error_handler);
 
   ///// Get a visual /////
    int attribs[] = {
       GLX_RGBA,
       GLX_RED_SIZE, 1,
@@ -169,17 +169,17 @@ static void glxtest()
 
   swa.border_pixel = 0;
   window = XCreateWindow(dpy, RootWindow(dpy, vInfo->screen),
                        0, 0, 16, 16,
                        0, vInfo->depth, InputOutput, vInfo->visual,
                        CWBorderPixel | CWColormap, &swa);
 
   ///// Get a GL context and make it current //////
-  GLXContext context = glXCreateContext(dpy, vInfo, NULL, True);
+  GLXContext context = glXCreateContext(dpy, vInfo, nullptr, True);
   glXMakeCurrent(dpy, window, context);
 
   ///// Look for this symbol to determine texture_from_pixmap support /////
   void* glXBindTexImageEXT = glXGetProcAddress("glXBindTexImageEXT"); 
 
   ///// Get GL vendor/renderer/versions strings /////
   enum { bufsize = 1024 };
   char buf[bufsize];
@@ -197,17 +197,17 @@ static void glxtest()
                         versionString,
                         glXBindTexImageEXT ? "TRUE" : "FALSE");
   if (length >= bufsize)
     fatal_error("GL strings length too large for buffer size");
 
   ///// Clean up. Indeed, the parent process might fail to kill us (e.g. if it doesn't need to check GL info)
   ///// so we might be staying alive for longer than expected, so it's important to consume as little memory as
   ///// possible. Also we want to check that we're able to do that too without generating X errors.
-  glXMakeCurrent(dpy, None, NULL); // must release the GL context before destroying it
+  glXMakeCurrent(dpy, None, nullptr); // must release the GL context before destroying it
   glXDestroyContext(dpy, context);
   XDestroyWindow(dpy, window);
   XFreeColormap(dpy, swa.colormap);
   XCloseDisplay(dpy);
   dlclose(libgl);
 
   ///// Finally write data to the pipe
   write(write_end_of_the_pipe, buf, length);
--- a/toolkit/xre/nsAndroidStartup.cpp
+++ b/toolkit/xre/nsAndroidStartup.cpp
@@ -61,17 +61,17 @@ GeckoStart(void *data, const nsXREAppDat
         LOG("Failed to get arguments for GeckoStart\n");
         return;
     }
 
     nsTArray<char *> targs;
     char *arg = strtok(static_cast<char *>(data), " ");
     while (arg) {
         targs.AppendElement(arg);
-        arg = strtok(NULL, " ");
+        arg = strtok(nullptr, " ");
     }
     targs.AppendElement(static_cast<char *>(nullptr));
 
     int result = XRE_main(targs.Length() - 1, targs.Elements(), appData, 0);
 
     if (result)
         LOG("XRE_main returned %d", result);
 
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -386,17 +386,17 @@ static void Output(bool isError, const c
     wchar_t wide_msg[1024];
     MultiByteToWideChar(CP_ACP,
                         0,
                         msg,
                         -1,
                         wide_msg,
                         sizeof(wide_msg) / sizeof(wchar_t));
 
-    MessageBoxW(NULL, wide_msg, L"XULRunner", flags);
+    MessageBoxW(nullptr, wide_msg, L"XULRunner", flags);
     PR_smprintf_free(msg);
   }
 #else
   vfprintf(stderr, fmt, ap);
 #endif
 
   va_end(ap);
 }
@@ -1150,31 +1150,31 @@ ProfileServiceFactoryConstructor(const m
   nsCOMPtr<nsIFactory> factory;
   NS_NewToolkitProfileFactory(getter_AddRefs(factory));
   return factory.forget();
 }
 
 NS_DEFINE_NAMED_CID(APPINFO_CID);
 
 static const mozilla::Module::CIDEntry kXRECIDs[] = {
-  { &kAPPINFO_CID, false, NULL, AppInfoConstructor },
-  { &kProfileServiceCID, false, ProfileServiceFactoryConstructor, NULL },
-  { &kNativeAppSupportCID, false, NULL, ScopedXPCOMStartup::CreateAppSupport },
-  { NULL }
+  { &kAPPINFO_CID, false, nullptr, AppInfoConstructor },
+  { &kProfileServiceCID, false, ProfileServiceFactoryConstructor, nullptr },
+  { &kNativeAppSupportCID, false, nullptr, ScopedXPCOMStartup::CreateAppSupport },
+  { nullptr }
 };
 
 static const mozilla::Module::ContractIDEntry kXREContracts[] = {
   { XULAPPINFO_SERVICE_CONTRACTID, &kAPPINFO_CID },
   { XULRUNTIME_SERVICE_CONTRACTID, &kAPPINFO_CID },
 #ifdef MOZ_CRASHREPORTER
   { NS_CRASHREPORTER_CONTRACTID, &kAPPINFO_CID },
 #endif
   { NS_PROFILESERVICE_CONTRACTID, &kProfileServiceCID },
   { NS_NATIVEAPPSUPPORT_CONTRACTID, &kNativeAppSupportCID },
-  { NULL }
+  { nullptr }
 };
 
 static const mozilla::Module kXREModule = {
   mozilla::Module::kVersion,
   kXRECIDs,
   kXREContracts
 };
 
@@ -1536,17 +1536,17 @@ typedef BOOL (WINAPI* SetProcessDEPPolic
 // that can be used to pass it on to the OS/2 Dos* APIs (which otherwise
 // don't know anything about the stuff set by PR_SetEnv() or setenv()).
 char *createEnv()
 {
   // just allocate the maximum amount (24 kB = 0x60000 bytes), to be able to
   // copy the existing environment
   char *env = (char *)calloc(0x6000, sizeof(char));
   if (!env) {
-    return NULL;
+    return nullptr;
   }
 
   // walk along the environ string array of the C library and copy
   // everything (that fits) into the output environment array, leaving
   // null bytes between the entries
   char *penv = env; // movable pointer to result environment ASCIIZ array
   int i = 0, space = 0x6000;
   while (environ[i] && environ[i][0]) {
@@ -2616,17 +2616,17 @@ static PRFuncPtr FindFunction(const char
 static void MOZ_gdk_display_close(GdkDisplay *display)
 {
   // XXX wallpaper for bug 417163: don't close the Display if we're using the
   // Qt theme because we crash (in Qt code) when using jemalloc.
   bool theme_is_qt = false;
   GtkSettings* settings =
     gtk_settings_get_for_screen(gdk_display_get_default_screen(display));
   gchar *theme_name;
-  g_object_get(settings, "gtk-theme-name", &theme_name, NULL);
+  g_object_get(settings, "gtk-theme-name", &theme_name, nullptr);
   if (theme_name) {
     theme_is_qt = strcmp(theme_name, "Qt") == 0;
     if (theme_is_qt)
       NS_WARNING("wallpaper bug 417163 for Qt theme");
     g_free(theme_name);
   }
 
 #if CLEANUP_MEMORY
@@ -2656,17 +2656,17 @@ static void MOZ_gdk_display_close(GdkDis
   // the fontmap's finalize, though.
   if (PANGO_IS_FC_FONT_MAP(fontmap))
       pango_fc_font_map_shutdown(PANGO_FC_FONT_MAP(fontmap));
   g_object_unref(pangoContext);
   // PangoCairo still holds a reference to the fontmap.
   // Now that we have finished with GTK and Pango, we could unref fontmap,
   // which would allow us to call FcFini, but removing what is really
   // Pango's ref feels a bit evil.  Pango-1.22 will have support for
-  // pango_cairo_font_map_set_default(NULL), which would release the
+  // pango_cairo_font_map_set_default(nullptr), which would release the
   // reference on the old fontmap.
 
   // cairo_debug_reset_static_data() is prototyped through cairo.h included
   // by gtk.h.
 #ifdef cairo_debug_reset_static_data
 #error "Looks like we're including Mozilla's cairo instead of system cairo"
 #endif
   cairo_debug_reset_static_data();
@@ -2864,17 +2864,18 @@ XREMain::XRE_mainInit(bool* aExitFlag)
     // DirectWrite client library will assume the service isn't around and do
     // manual font file I/O on _all_ system fonts.  To avoid this, load the
     // dwrite library and create a factory as early as possible so that the
     // FntCache service is ready by the time it's needed.
       
     OSVERSIONINFO vinfo;
     vinfo.dwOSVersionInfoSize = sizeof(vinfo);
     if (GetVersionEx(&vinfo) && vinfo.dwMajorVersion >= 6) {
-      CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&InitDwriteBG, NULL, 0, NULL);
+      CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)&InitDwriteBG,
+                   nullptr, 0, nullptr);
     }
   }
 #endif
 
 #ifdef XP_UNIX
   const char *home = PR_GetEnv("HOME");
   if (!home || !*home) {
     struct passwd *pw = getpwuid(geteuid());
@@ -3919,17 +3920,17 @@ XREMain::XRE_main(int argc, char* argv[]
 #if defined(MOZ_WIDGET_GTK)
 #if defined(MOZ_MEMORY) || defined(__FreeBSD__) \
   || defined(__NetBSD__) && __NetBSD_Version__ >= 500000000
   // Disable the slice allocator, since jemalloc already uses similar layout
   // algorithms, and using a sub-allocator tends to increase fragmentation.
   // This must be done before g_thread_init() is called.
   g_slice_set_config(G_SLICE_CONFIG_ALWAYS_MALLOC, 1);
 #endif
-  g_thread_init(NULL);
+  g_thread_init(nullptr);
 #endif
 
   // init
   bool exit = false;
   int result = XRE_mainInit(&exit);
   if (result != 0 || exit)
     return result;
 
--- a/toolkit/xre/nsAppRunner.h
+++ b/toolkit/xre/nsAppRunner.h
@@ -93,17 +93,17 @@ NS_LockProfilePath(nsIFile* aPath, nsIFi
                    nsIProfileUnlocker* *aUnlocker, nsIProfileLock* *aResult);
 
 NS_HIDDEN_(void)
 WriteConsoleLog();
 
 #ifdef XP_WIN
 BOOL
 WinLaunchChild(const PRUnichar *exePath, int argc, 
-               char **argv, HANDLE userToken = NULL,
+               char **argv, HANDLE userToken = nullptr,
                HANDLE *hProcess = nullptr);
 BOOL
 WriteStatusPending(LPCWSTR updateDirPath);
 BOOL
 WriteStatusApplied(LPCWSTR updateDirPath);
 #endif
 
 #define NS_NATIVEAPPSUPPORT_CONTRACTID "@mozilla.org/toolkit/native-app-support;1"
--- a/toolkit/xre/nsCommandLineServiceMac.cpp
+++ b/toolkit/xre/nsCommandLineServiceMac.cpp
@@ -8,17 +8,17 @@
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <Carbon/Carbon.h>
 
 namespace CommandLineServiceMac {
 
 static const int kArgsGrowSize = 20;
 
-static char** sArgs = NULL;
+static char** sArgs = nullptr;
 static int sArgsAllocated = 0;
 static int sArgsUsed = 0;
 
 static bool sBuildingCommandLine = false;
 
 void AddToCommandLine(const char* inArgText)
 {
   if (sArgsUsed >= sArgsAllocated - 1) {
@@ -30,28 +30,28 @@ void AddToCommandLine(const char* inArgT
     sArgsAllocated += kArgsGrowSize;
   }
 
   char *temp2 = strdup(inArgText);
   if (!temp2)
     return;
 
   sArgs[sArgsUsed++] = temp2;
-  sArgs[sArgsUsed] = NULL;
+  sArgs[sArgsUsed] = nullptr;
 
   return;
 }
 
 void SetupMacCommandLine(int& argc, char**& argv, bool forRestart)
 {
   sArgs = static_cast<char **>(malloc(kArgsGrowSize * sizeof(char*)));
   if (!sArgs)
     return;
   sArgsAllocated = kArgsGrowSize;
-  sArgs[0] = NULL;
+  sArgs[0] = nullptr;
   sArgsUsed = 0;
 
   sBuildingCommandLine = true;
 
   // Copy args, stripping anything we don't want.
   for (int arg = 0; arg < argc; arg++) {
     char* flag = argv[arg];
     // Don't pass on the psn (Process Serial Number) flag from the OS.
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -389,30 +389,30 @@ XRE_InitChildProcess(int aArgc,
       !XRE_SetRemoteExceptionHandler(crashReporterArg)) {
     // Bug 684322 will add better visibility into this condition
     NS_WARNING("Could not setup crash reporting\n");
   }
 #  elif defined(OS_LINUX)
   // on POSIX, |crashReporterArg| is "true" if crash reporting is
   // enabled, false otherwise
   if (0 != strcmp("false", crashReporterArg) && 
-      !XRE_SetRemoteExceptionHandler(NULL)) {
+      !XRE_SetRemoteExceptionHandler(nullptr)) {
     // Bug 684322 will add better visibility into this condition
     NS_WARNING("Could not setup crash reporting\n");
   }
 #  else
 #    error "OOP crash reporting unsupported on this platform"
 #  endif   
 #endif // if defined(MOZ_CRASHREPORTER)
 
   gArgv = aArgv;
   gArgc = aArgc;
 
 #if defined(MOZ_WIDGET_GTK)
-  g_thread_init(NULL);
+  g_thread_init(nullptr);
 #endif
 
 #if defined(MOZ_WIDGET_QT)
   nsQAppInstance::AddRef();
 #endif
 
   if (PR_GetEnv("MOZ_DEBUG_CHILD_PROCESS")) {
 #ifdef OS_POSIX
--- a/toolkit/xre/nsNativeAppSupportOS2.cpp
+++ b/toolkit/xre/nsNativeAppSupportOS2.cpp
@@ -372,17 +372,17 @@ bool nsNativeAppSupportOS2::mCanHandleRe
 // Added this as pmddeml has no api like this
 int DdeCmpStringHandles( HSZ hsz1, HSZ hsz2 )
 {
   char chhsz1[CCHMAXPATH], chhsz2[CCHMAXPATH];
   int rc = -1;
 
   /* I am assuming that the strings will never be more that CCHMAXPATH in
    * length.  Safe bet (for now).  To find true length, call WinDdeQueryString
-   * and pass in (hsz, NULL, 0L, 0) and it will return iLength.  Passing 0
+   * and pass in (hsz, nullptr, 0L, 0) and it will return iLength.  Passing 0
    * for codepage will use the codepage of the current thread.
    */
   WinDdeQueryString( hsz1, chhsz1, sizeof( chhsz1 ), 0 );
   WinDdeQueryString( hsz2, chhsz2, sizeof( chhsz2 ),0 );
 
   rc = stricmp( chhsz1, chhsz2 );
 
   return(rc);
@@ -392,26 +392,26 @@ int DdeCmpStringHandles( HSZ hsz1, HSZ h
 char *GetCommandLine()
 {
    /* This function is meant to be like the Window's GetCommandLine() function.
     * The value returned by pPIB->pib_pchcmd is of the format:
     * <executable>\0<command line parameters>.  So the first string is the
     * .exe and the second string is what followed on the command line.  Dorky,
     * but I guess it'll have to do.
     */
-   PTIB pTIB = NULL;
-   PPIB pPIB = NULL;
+   PTIB pTIB = nullptr;
+   PPIB pPIB = nullptr;
    APIRET rc = NO_ERROR;
-   char *pchParam = NULL;
+   char *pchParam = nullptr;
 
    rc = DosGetInfoBlocks( &pTIB, &pPIB );
    if( rc == NO_ERROR )
    {
       INT iLen = 0;
-      char *pchTemp = NULL;
+      char *pchTemp = nullptr;
       pchParam = pPIB->pib_pchcmd;
       strcpy( szCommandLine, pchParam );
       iLen = strlen( pchParam );
 
       /* szCommandLine[iLen] is '\0', so see what's next.  Probably be another
        * '\0', a space or start of the arguments
        */
       pchTemp = &(pchParam[iLen+1]);
@@ -464,38 +464,38 @@ DDEMLFN ddemlfnTable[] =
    { (PFN *)&WinDdeNameService          ,118 },
    { (PFN *)&WinDdePostAdvise           ,119 },
    { (PFN *)&WinDdeQueryConvInfo        ,120 },
    { (PFN *)&WinDdeQueryNextServer      ,121 },
    { (PFN *)&WinDdeQueryString          ,122 },
    { (PFN *)&WinDdeReconnect            ,123 },
    { (PFN *)&WinDdeSetUserHandle        ,124 },
    { (PFN *)&WinDdeUninitialize         ,126 },
-   { (PFN *)NULL                           ,  0 }
+   { (PFN *)nullptr                     ,  0 }
 };
 
 /* SetupOS2ddeml makes sure that we can get pointers to all of the DDEML 
  * functions in demlfnTable using entrypoints.  If we can't find one of them
  * or can't load pmddeml.dll, then returns FALSE
  */
 BOOL SetupOS2ddeml()
 {
     BOOL bRC = FALSE;
     HMODULE hmodDDEML = NULLHANDLE;
     APIRET rc = NO_ERROR;
 
-    rc = DosLoadModule( NULL, 0, "PMDDEML", &hmodDDEML );
+    rc = DosLoadModule( nullptr, 0, "PMDDEML", &hmodDDEML );
     if( rc == NO_ERROR )
     {
        int i;
        /* all of this had better work.  Get ready to be a success! */
        bRC = TRUE;
        for( i=0; ddemlfnTable[i].ord != 0; i++ )
        {
-          rc = DosQueryProcAddr( hmodDDEML, ddemlfnTable[i].ord, NULL,
+          rc = DosQueryProcAddr( hmodDDEML, ddemlfnTable[i].ord, nullptr,
                                  ddemlfnTable[i].fn );
           if( rc != NO_ERROR )
           {
              /* we're horked.  Return rc = horked */
              bRC = FALSE;
              break;
           }
        }
@@ -575,25 +575,25 @@ struct MessageWindow {
 
         /* Giving a size but offscreen so that won't be seen, even if all
          * goes wrong.  Giving a size so that can be seen and understood by
          * tools
          */
         const char * pszClassName = className();
         mHandle = WinCreateWindow( HWND_OBJECT,
                                    pszClassName,
-                                   NULL,        // name
-                                   WS_DISABLED, // style
-                                   0,0,     // x, y
-                                   0,0,       // cx,cy
-                                   HWND_DESKTOP,// owner
+                                   nullptr,      // name
+                                   WS_DISABLED,  // style
+                                   0,0,          // x, y
+                                   0,0,          // cx,cy
+                                   HWND_DESKTOP, // owner
                                    HWND_BOTTOM,  // hwndbehind
                                    (USHORT)mMsgWindowAtom, // id
-                                   NULL,        // pCtlData
-                                   NULL );      // pres params
+                                   nullptr,      // pCtlData
+                                   nullptr );    // pres params
 
 #if MOZ_DEBUG_DDE
         printf( "Message window = 0x%08X\n", (int)mHandle );
 #endif
 
         return NS_OK;
     }
 
@@ -604,17 +604,17 @@ struct MessageWindow {
         if ( mHandle ) {
            HATOMTBL hatomtbl = WinQuerySystemAtomTable();
            WinDeleteAtom(hatomtbl, mMsgWindowAtom);
            
             // DestroyWindow can only destroy windows created from
             //  the same thread.
             BOOL desRes = WinDestroyWindow( mHandle );
             if ( FALSE != desRes ) {
-                mHandle = NULL;
+                mHandle = nullptr;
             }
             else {
                 retval = NS_ERROR_FAILURE;
             }
         }
 
         return retval;
     }
@@ -627,37 +627,37 @@ struct MessageWindow {
     /* Nothing like WM_COPYDATA in OS/2, where the OS allows pointers to be
      * passed to a different process and automatically accessible by that
      * process.  So we have to create shared mem on our side and then the
      * process that gets the WM_COPYDATA message has to do a 
      * DosGetSharedMem on this pointer to be able to access the data
     */
 
         COPYDATASTRUCT *pcds;
-        PVOID pvData = NULL;
+        PVOID pvData = nullptr;
 
         if (!cmd)
             return NS_ERROR_FAILURE;
 
         ULONG ulSize = sizeof(COPYDATASTRUCT)+strlen(cmd)+1+CCHMAXPATH;
 #ifdef MOZ_OS2_HIGH_MEMORY
-        APIRET rc = DosAllocSharedMem( &pvData, NULL, ulSize,
+        APIRET rc = DosAllocSharedMem( &pvData, nullptr, ulSize,
                                        PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE | OBJ_ANY);
         if (rc != NO_ERROR) { // Did the kernel handle OBJ_ANY?
             // Try again without OBJ_ANY and if the first failure was not caused
             // by OBJ_ANY then we will get the same failure, else we have taken
             // care of pre-FP13 systems where the kernel couldn't handle it.
-            rc = DosAllocSharedMem( &pvData, NULL, ulSize,
+            rc = DosAllocSharedMem( &pvData, nullptr, ulSize,
                                     PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE);
             if (rc != NO_ERROR) {
                 return NS_ERROR_OUT_OF_MEMORY;
             }
         }
 #else
-        if (DosAllocSharedMem( &pvData, NULL, ulSize,
+        if (DosAllocSharedMem( &pvData, nullptr, ulSize,
                                PAG_COMMIT | PAG_READ | PAG_WRITE | OBJ_GETTABLE | OBJ_ANY))
             return NS_ERROR_OUT_OF_MEMORY;
 #endif
 
         // We used to set dwData to zero, when we didn't send the
         // working dir.  Now we're using it as a version number.
         // The commandline goes in the buffer space immediately after
         // the COPYDATASTRUCT;  the current directory follows that.
@@ -1012,17 +1012,17 @@ static nsCString uTypeDesc( UINT uType )
     default: result = "XTYP_?????";
     }
     return result;
 }
 
 static nsCString hszValue( DWORD instance, HSZ hsz ) {
     // Extract string from HSZ.
     nsCString result("[");
-    DWORD len = WinDdeQueryString( hsz, NULL, NULL, CP_WINANSI );
+    DWORD len = WinDdeQueryString( hsz, nullptr, nullptr, CP_WINANSI );
     if ( len ) {
         char buffer[ 256 ];
         WinDdeQueryString( hsz, buffer, sizeof buffer, CP_WINANSI );
         result += buffer;
     }
     result += "]";
     return result;
 }
@@ -1352,17 +1352,17 @@ void nsNativeAppSupportOS2::ParseDDEArg(
         // Extract result.
         aString.Assign( args + offset, end - offset );
     }
     return;
 }
 
 // Utility to parse out argument from a DDE item string.
 void nsNativeAppSupportOS2::ParseDDEArg( HSZ args, int index, nsCString& aString) {
-    DWORD argLen = WinDdeQueryString( args, NULL, NULL, CP_WINANSI );
+    DWORD argLen = WinDdeQueryString( args, nullptr, nullptr, CP_WINANSI );
     // there wasn't any string, so return empty string
     if ( !argLen ) return;
     nsAutoCString temp;
     // Ensure result's buffer is sufficiently big.
     temp.SetLength( argLen );
     // Now get the string contents.
     WinDdeQueryString( args, temp.BeginWriting(), temp.Length(), CP_WINANSI );
     // Parse out the given arg.
--- a/toolkit/xre/nsNativeAppSupportUnix.cpp
+++ b/toolkit/xre/nsNativeAppSupportUnix.cpp
@@ -143,17 +143,17 @@ nsNativeAppSupportUnix::Start(bool *aRet
 // initialized before making any other library calls.
 #ifdef MOZ_ENABLE_DBUS
   dbus_threads_init_default();
 #endif
 
 #if (MOZ_WIDGET_GTK == 2)
   if (gtk_major_version < MIN_GTK_MAJOR_VERSION ||
       (gtk_major_version == MIN_GTK_MAJOR_VERSION && gtk_minor_version < MIN_GTK_MINOR_VERSION)) {
-    GtkWidget* versionErrDialog = gtk_message_dialog_new(NULL,
+    GtkWidget* versionErrDialog = gtk_message_dialog_new(nullptr,
                      GtkDialogFlags(GTK_DIALOG_MODAL |
                                     GTK_DIALOG_DESTROY_WITH_PARENT),
                      GTK_MESSAGE_ERROR,
                      GTK_BUTTONS_OK,
                      UNSUPPORTED_GTK_MSG,
                      gtk_major_version,
                      gtk_minor_version,
                      MIN_GTK_MAJOR_VERSION,
@@ -197,17 +197,18 @@ nsNativeAppSupportUnix::Start(bool *aRet
   // Set GNOME_ACCESSIBILITY to 0 can avoid this
   static const char *accEnv = "GNOME_ACCESSIBILITY";
   const char *accOldValue = getenv(accEnv);
   setenv(accEnv, "0", 1);
 #endif
 
 #if defined(MOZ_X11) && (MOZ_WIDGET_GTK == 2)
   if (!gnome_program_get()) {
-    gnome_program_init("Gecko", "1.0", libgnomeui_module_info_get(), gArgc, gArgv, NULL);
+    gnome_program_init("Gecko", "1.0", libgnomeui_module_info_get(),
+                       gArgc, gArgv, nullptr);
   }
 #endif /* MOZ_X11 && (MOZ_WIDGET_GTK == 2) */
 
 #ifdef ACCESSIBILITY
   if (accOldValue) { 
     setenv(accEnv, accOldValue, 1);
   } else {
     unsetenv(accEnv);
@@ -222,18 +223,18 @@ nsNativeAppSupportUnix::Start(bool *aRet
 #if defined(MOZ_X11) && (MOZ_WIDGET_GTK == 2)
   gnome_client_set_restart_command = (_gnome_client_set_restart_command_fn)
     PR_FindFunctionSymbol(gnomeuiLib, "gnome_client_set_restart_command");
 
   _gnome_master_client_fn gnome_master_client = (_gnome_master_client_fn)
     PR_FindFunctionSymbol(gnomeuiLib, "gnome_master_client");
 
   GnomeClient *client = gnome_master_client();
-  g_signal_connect(client, "save-yourself", G_CALLBACK(save_yourself_cb), NULL);
-  g_signal_connect(client, "die", G_CALLBACK(die_cb), NULL);
+  g_signal_connect(client, "save-yourself", G_CALLBACK(save_yourself_cb), nullptr);
+  g_signal_connect(client, "die", G_CALLBACK(die_cb), nullptr);
 
   // Set the correct/requested restart command in any case.
 
   // Is there a request to suppress default binary launcher?
   nsAutoCString path;
   char* argv1 = getenv("MOZ_APP_LAUNCHER");
 
   if(!argv1) {
--- a/toolkit/xre/nsNativeAppSupportWin.cpp
+++ b/toolkit/xre/nsNativeAppSupportWin.cpp
@@ -528,17 +528,17 @@ struct MessageWindow {
     NS_IMETHOD Destroy() {
         nsresult retval = NS_OK;
 
         if ( mHandle ) {
             // DestroyWindow can only destroy windows created from
             //  the same thread.
             BOOL desRes = DestroyWindow( mHandle );
             if ( FALSE != desRes ) {
-                mHandle = NULL;
+                mHandle = nullptr;
             }
             else {
                 retval = NS_ERROR_FAILURE;
             }
         }
 
         return retval;
     }
@@ -853,17 +853,17 @@ static nsCString uTypeDesc( UINT uType )
     default: result = "XTYP_?????";
     }
     return result;
 }
 
 static nsCString hszValue( DWORD instance, HSZ hsz ) {
     // Extract string from HSZ.
     nsCString result("[");
-    DWORD len = DdeQueryString( instance, hsz, NULL, NULL, CP_WINANSI );
+    DWORD len = DdeQueryString( instance, hsz, nullptr, nullptr, CP_WINANSI );
     if ( len ) {
         char buffer[ 256 ];
         DdeQueryString( instance, hsz, buffer, sizeof buffer, CP_WINANSI );
         result += buffer;
     }
     result += "]";
     return result;
 }
@@ -1206,17 +1206,17 @@ void nsNativeAppSupportWin::ParseDDEArg(
         // Extract result.
         aString.Assign( args + offset, end - offset );
     }
     return;
 }
 
 // Utility to parse out argument from a DDE item string.
 void nsNativeAppSupportWin::ParseDDEArg( HSZ args, int index, nsString& aString) {
-    DWORD argLen = DdeQueryStringW( mInstance, args, NULL, 0, CP_WINUNICODE );
+    DWORD argLen = DdeQueryStringW( mInstance, args, nullptr, 0, CP_WINUNICODE );
     // there wasn't any string, so return empty string
     if ( !argLen ) return;
     nsAutoString temp;
     // Ensure result's buffer is sufficiently big.
     temp.SetLength( argLen );
     // Now get the string contents.
     DdeQueryString( mInstance, args, temp.BeginWriting(), temp.Length(), CP_WINUNICODE );
     // Parse out the given arg.
--- a/toolkit/xre/nsQAppInstance.cpp
+++ b/toolkit/xre/nsQAppInstance.cpp
@@ -8,19 +8,19 @@
 #include <QApplication>
 #ifdef MOZ_ENABLE_MEEGOTOUCH
 #include <MComponentData>
 #include <MApplicationService>
 #endif
 #include "prenv.h"
 #include <stdlib.h>
 
-QApplication *nsQAppInstance::sQAppInstance = NULL;
+QApplication *nsQAppInstance::sQAppInstance = nullptr;
 #ifdef MOZ_ENABLE_MEEGOTOUCH
-MComponentData* nsQAppInstance::sMComponentData = NULL;
+MComponentData* nsQAppInstance::sMComponentData = nullptr;
 #endif
 int nsQAppInstance::sQAppRefCount = 0;
 
 void nsQAppInstance::AddRef(int& aArgc, char** aArgv, bool aDefaultProcess) {
   if (qApp)
     return;
   if (!sQAppInstance) {
 #if (QT_VERSION < QT_VERSION_CHECK(5,0,0))
@@ -33,14 +33,14 @@ void nsQAppInstance::AddRef(int& aArgc, 
   }
   sQAppRefCount++;
 }
 
 void nsQAppInstance::Release(void) {
   if (sQAppInstance && !--sQAppRefCount) {
 #ifdef MOZ_ENABLE_MEEGOTOUCH
     delete sMComponentData;
-    sMComponentData = NULL;
+    sMComponentData = nullptr;
 #endif
     delete sQAppInstance;
-    sQAppInstance = NULL;
+    sQAppInstance = nullptr;
   }
 }
--- a/toolkit/xre/nsSigHandlers.cpp
+++ b/toolkit/xre/nsSigHandlers.cpp
@@ -104,17 +104,17 @@ child_ah_crap_handler(int signum)
 
 #ifdef MOZ_WIDGET_GTK
 // Need this include for version test below.
 #include <glib.h>
 #endif
 
 #if defined(MOZ_WIDGET_GTK) && (GLIB_MAJOR_VERSION > 2 || (GLIB_MAJOR_VERSION == 2 && GLIB_MINOR_VERSION >= 6))
 
-static GLogFunc orig_log_func = NULL;
+static GLogFunc orig_log_func = nullptr;
 
 extern "C" {
 static void
 my_glib_log_func(const gchar *log_domain, GLogLevelFlags log_level,
                  const gchar *message, gpointer user_data);
 }
 
 /* static */ void
@@ -122,17 +122,17 @@ my_glib_log_func(const gchar *log_domain
                  const gchar *message, gpointer user_data)
 {
   if (log_level & (G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION)) {
     NS_DebugBreak(NS_DEBUG_ASSERTION, message, "glib assertion", __FILE__, __LINE__);
   } else if (log_level & (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING)) {
     NS_DebugBreak(NS_DEBUG_WARNING, message, "glib warning", __FILE__, __LINE__);
   }
 
-  orig_log_func(log_domain, log_level, message, NULL);
+  orig_log_func(log_domain, log_level, message, nullptr);
 }
 
 #endif
 
 #ifdef SA_SIGINFO
 static void fpehandler(int signum, siginfo_t *si, void *context)
 {
   /* Integer divide by zero or integer overflow. */
@@ -296,17 +296,17 @@ void InstallSignalHandlers(const char *P
   const char *assertString = PR_GetEnv("XPCOM_DEBUG_BREAK");
   if (assertString &&
       (!strcmp(assertString, "suspend") ||
        !strcmp(assertString, "stack") ||
        !strcmp(assertString, "abort") ||
        !strcmp(assertString, "trap") ||
        !strcmp(assertString, "break"))) {
     // Override the default glib logging function so we get stacks for it too.
-    orig_log_func = g_log_set_default_handler(my_glib_log_func, NULL);
+    orig_log_func = g_log_set_default_handler(my_glib_log_func, nullptr);
   }
 #endif
 }
 
 #elif XP_WIN
 
 #include <windows.h>
 
--- a/toolkit/xre/nsUpdateDriver.cpp
+++ b/toolkit/xre/nsUpdateDriver.cpp
@@ -553,20 +553,20 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIF
     argv[5] = (char*) appFilePath.get();
     for (int i = 1; i < appArgc; ++i)
       argv[5 + i] = appArgv[i];
 #ifdef XP_WIN
     if (immersiveArgc) {
       argv[argc - 1] = "-ServerName:DefaultBrowserServer";
     }
 #endif
-    argv[argc] = NULL;
+    argv[argc] = nullptr;
   } else {
     argc = 4;
-    argv[4] = NULL;
+    argv[4] = nullptr;
   }
 
   if (gSafeMode) {
     PR_SetEnv("MOZ_SAFE_MODE_RESTART=1");
   }
 
   LOG(("spawning updater process for replacing [%s]\n", updaterPath.get()));
 
@@ -587,17 +587,17 @@ SwitchToUpdatedApp(nsIFile *greDir, nsIF
 #elif defined(XP_MACOSX)
   CommandLineServiceMac::SetupMacCommandLine(argc, argv, true);
   // LaunchChildMac uses posix_spawnp and prefers the current
   // architecture when launching. It doesn't require a
   // null-terminated string but it doesn't matter if we pass one.
   LaunchChildMac(argc, argv);
   exit(0);
 #else
-  PR_CreateProcessDetached(updaterPath.get(), argv, NULL, NULL);
+  PR_CreateProcessDetached(updaterPath.get(), argv, nullptr, nullptr);
   exit(0);
 #endif
 }
 
 #if defined(MOZ_WIDGET_GONK)
 static nsresult
 GetOSApplyToDir(nsACString& applyToDir)
 {
@@ -837,20 +837,20 @@ ApplyUpdate(nsIFile *greDir, nsIFile *up
     argv[5] = (char*) appFilePath.get();
     for (int i = 1; i < appArgc; ++i)
       argv[5 + i] = appArgv[i];
 #ifdef XP_WIN
     if (immersiveArgc) {
       argv[argc - 1] = "-ServerName:DefaultBrowserServer";
     }
 #endif
-    argv[argc] = NULL;
+    argv[argc] = nullptr;
   } else {
     argc = 4;
-    argv[4] = NULL;
+    argv[4] = nullptr;
   }
 
   if (gSafeMode) {
     PR_SetEnv("MOZ_SAFE_MODE_RESTART=1");
   }
 
   if (isOSUpdate) {
     PR_SetEnv("MOZ_OS_UPDATE=1");
@@ -875,21 +875,21 @@ ApplyUpdate(nsIFile *greDir, nsIFile *up
 
   LOG(("spawning updater process [%s]\n", updaterPath.get()));
 
 #if defined(USE_EXECV)
   // Don't use execv for background updates.
   if (restart) {
     execv(updaterPath.get(), argv);
   } else {
-    *outpid = PR_CreateProcess(updaterPath.get(), argv, NULL, NULL);
+    *outpid = PR_CreateProcess(updaterPath.get(), argv, nullptr, nullptr);
   }
 #elif defined(XP_WIN)
   // Launch the update using updater.exe
-  if (!WinLaunchChild(updaterPathW.get(), argc, argv, NULL, outpid)) {
+  if (!WinLaunchChild(updaterPathW.get(), argc, argv, nullptr, outpid)) {
     return;
   }
 
   if (restart) {
     // We are going to process an update so we should exit now
     _exit(0);
   }
 #elif defined(XP_MACOSX)
@@ -897,17 +897,17 @@ ApplyUpdate(nsIFile *greDir, nsIFile *up
   // LaunchChildMac uses posix_spawnp and prefers the current
   // architecture when launching. It doesn't require a
   // null-terminated string but it doesn't matter if we pass one.
   LaunchChildMac(argc, argv, 0, outpid);
   if (restart) {
     exit(0);
   }
 #else
-  *outpid = PR_CreateProcess(updaterPath.get(), argv, NULL, NULL);
+  *outpid = PR_CreateProcess(updaterPath.get(), argv, nullptr, nullptr);
   if (restart) {
     exit(0);
   }
 #endif
 }
 
 /**
  * Wait for a process until it terminates.  This call is blocking.
--- a/toolkit/xre/nsWindowsDllBlocklist.cpp
+++ b/toolkit/xre/nsWindowsDllBlocklist.cpp
@@ -130,17 +130,17 @@ static DllBlockInfo sWindowsDllBlocklist
   { "pmnx.dll", MAKE_VERSION(1, 3, 334, 9) },
   { "opnx.dll", MAKE_VERSION(1, 3, 334, 9) },
   { "prnx.dll", MAKE_VERSION(1, 3, 334, 9) },
 
   // Older belgian ID card software causes Firefox to crash or hang on
   // shutdown, bug 831285 and 918399.
   { "beid35cardlayer.dll", MAKE_VERSION(3, 5, 6, 6968) },
 
-  { NULL, 0 }
+  { nullptr, 0 }
 };
 
 #ifndef STATUS_DLL_NOT_FOUND
 #define STATUS_DLL_NOT_FOUND ((DWORD)0xC0000135L)
 #endif
 
 // define this for very verbose dll load debug spew
 #undef DEBUG_very_verbose
@@ -183,20 +183,21 @@ private:
 };
 
 bool
 CheckASLR(const wchar_t* path)
 {
   bool retval = false;
 
   HANDLE file = ::CreateFileW(path, GENERIC_READ, FILE_SHARE_READ,
-                              NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
-                              NULL);
+                              nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
+                              nullptr);
   if (file != INVALID_HANDLE_VALUE) {
-    HANDLE map = ::CreateFileMappingW(file, NULL, PAGE_READONLY, 0, 0, NULL);
+    HANDLE map = ::CreateFileMappingW(file, nullptr, PAGE_READONLY, 0, 0,
+                                      nullptr);
     if (map) {
       RVAMap<IMAGE_DOS_HEADER> peHeader(map, 0);
       if (peHeader) {
         RVAMap<IMAGE_NT_HEADERS> ntHeader(map, peHeader->e_lfanew);
         if (ntHeader) {
           // If the DLL has no code, permit it regardless of ASLR status.
           if (ntHeader->OptionalHeader.SizeOfCode == 0) {
             retval = true;
@@ -273,33 +274,35 @@ CRITICAL_SECTION ReentrancySentinel::sLo
 std::map<DWORD, const char*>* ReentrancySentinel::sThreadMap;
 
 static
 wchar_t* getFullPath (PWCHAR filePath, wchar_t* fname)
 {
   // In Windows 8, the first parameter seems to be used for more than just the
   // path name.  For example, its numerical value can be 1.  Passing a non-valid
   // pointer to SearchPathW will cause a crash, so we need to check to see if we
-  // are handed a valid pointer, and otherwise just pass NULL to SearchPathW.
-  PWCHAR sanitizedFilePath = (intptr_t(filePath) < 1024) ? NULL : filePath;
+  // are handed a valid pointer, and otherwise just pass nullptr to SearchPathW.
+  PWCHAR sanitizedFilePath = (intptr_t(filePath) < 1024) ? nullptr : filePath;
 
   // figure out the length of the string that we need
-  DWORD pathlen = SearchPathW(sanitizedFilePath, fname, L".dll", 0, NULL, NULL);
+  DWORD pathlen = SearchPathW(sanitizedFilePath, fname, L".dll", 0, nullptr,
+                              nullptr);
   if (pathlen == 0) {
     return nullptr;
   }
 
   wchar_t* full_fname = new wchar_t[pathlen+1];
   if (!full_fname) {
     // couldn't allocate memory?
     return nullptr;
   }
 
   // now actually grab it
-  SearchPathW(sanitizedFilePath, fname, L".dll", pathlen+1, full_fname, NULL);
+  SearchPathW(sanitizedFilePath, fname, L".dll", pathlen + 1, full_fname,
+              nullptr);
   return full_fname;
 }
 
 static bool
 IsWin8OrLater()
 {
   OSVERSIONINFOW osInfo;
   osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
--- a/toolkit/xre/nsWindowsDllInterceptor.h
+++ b/toolkit/xre/nsWindowsDllInterceptor.h
@@ -99,24 +99,24 @@ public:
       // mov edi, edi
       *((uint16_t*)fn) = 0xff8b;
 
       // Restore the old protection.
       VirtualProtectEx(GetCurrentProcess(), fn, 2, op, &op);
 
       // I don't think this is actually necessary, but it can't hurt.
       FlushInstructionCache(GetCurrentProcess(),
-                            /* ignored */ NULL,
+                            /* ignored */ nullptr,
                             /* ignored */ 0);
     }
   }
 
   void Init(const char *modulename)
   {
-    mModule = LoadLibraryExA(modulename, NULL, 0);
+    mModule = LoadLibraryExA(modulename, nullptr, 0);
     if (!mModule) {
       //printf("LoadLibraryEx for '%s' failed\n", modulename);
       return;
     }
   }
 
 #if defined(_M_IX86)
   bool AddHook(const char *pname, intptr_t hookDest, void **origFunc)
@@ -189,17 +189,17 @@ public:
     // and hookDest might use the origFunc pointer.
     *origFunc = fn + 2;
 
     // Short jump up into our long jump.
     *((uint16_t*)(fn)) = 0xf9eb; // jmp $-5
 
     // I think this routine is safe without this, but it can't hurt.
     FlushInstructionCache(GetCurrentProcess(),
-                          /* ignored */ NULL,
+                          /* ignored */ nullptr,
                           /* ignored */ 0);
 
     return true;
   }
 #else
   bool AddHook(const char *pname, intptr_t hookDest, void **origFunc)
   {
     // Not implemented except on x86-32.
@@ -251,29 +251,30 @@ public:
     }
   }
 
   void Init(const char *modulename, int nhooks = 0)
   {
     if (mModule)
       return;
 
-    mModule = LoadLibraryExA(modulename, NULL, 0);
+    mModule = LoadLibraryExA(modulename, nullptr, 0);
     if (!mModule) {
       //printf("LoadLibraryEx for '%s' failed\n", modulename);
       return;
     }
 
     int hooksPerPage = 4096 / kHookSize;
     if (nhooks == 0)
       nhooks = hooksPerPage;
 
     mMaxHooks = nhooks + (hooksPerPage % nhooks);
 
-    mHookPage = (byteptr_t) VirtualAllocEx(GetCurrentProcess(), NULL, mMaxHooks * kHookSize,
+    mHookPage = (byteptr_t) VirtualAllocEx(GetCurrentProcess(), nullptr,
+             mMaxHooks * kHookSize,
              MEM_COMMIT | MEM_RESERVE,
              PAGE_EXECUTE_READWRITE);
 
     if (!mHookPage) {
       mModule = 0;
       return;
     }
   }
@@ -322,17 +323,17 @@ protected:
   byteptr_t mHookPage;
   int mMaxHooks;
   int mCurHooks;
 
   void CreateTrampoline(void *origFunction,
                         intptr_t dest,
                         void **outTramp)
   {
-    *outTramp = NULL;
+    *outTramp = nullptr;
 
     byteptr_t tramp = FindTrampolineSpace();
     if (!tramp)
       return;
 
     byteptr_t origBytes = (byteptr_t) origFunction;
 
     int nBytes = 0;
@@ -637,17 +638,17 @@ class WindowsDllInterceptor
   internal::WindowsDllNopSpacePatcher mNopSpacePatcher;
   internal::WindowsDllDetourPatcher mDetourPatcher;
 
   const char *mModuleName;
   int mNHooks;
 
 public:
   WindowsDllInterceptor()
-    : mModuleName(NULL)
+    : mModuleName(nullptr)
     , mNHooks(0)
   {}
 
   void Init(const char *moduleName, int nhooks = 0)
   {
     if (mModuleName) {
       return;
     }
--- a/toolkit/xre/nsWindowsRestart.cpp
+++ b/toolkit/xre/nsWindowsRestart.cpp
@@ -23,19 +23,19 @@
  * Get the length that the string will take and takes into account the
  * additional length if the string needs to be quoted and if characters need to
  * be escaped.
  */
 static int ArgStrLen(const PRUnichar *s)
 {
   int backslashes = 0;
   int i = wcslen(s);
-  BOOL hasDoubleQuote = wcschr(s, L'"') != NULL;
+  BOOL hasDoubleQuote = wcschr(s, L'"') != nullptr;
   // Only add doublequotes if the string contains a space or a tab
-  BOOL addDoubleQuotes = wcspbrk(s, L" \t") != NULL;
+  BOOL addDoubleQuotes = wcspbrk(s, L" \t") != nullptr;
 
   if (addDoubleQuotes) {
     i += 2; // initial and final duoblequote
   }
 
   if (hasDoubleQuote) {
     while (*s) {
       if (*s == '\\') {
@@ -63,19 +63,19 @@ static int ArgStrLen(const PRUnichar *s)
  * The CRT parses this to retrieve the original argc/argv that we meant,
  * see STDARGV.C in the MSVC CRT sources.
  *
  * @return the end of the string
  */
 static PRUnichar* ArgToString(PRUnichar *d, const PRUnichar *s)
 {
   int backslashes = 0;
-  BOOL hasDoubleQuote = wcschr(s, L'"') != NULL;
+  BOOL hasDoubleQuote = wcschr(s, L'"') != nullptr;
   // Only add doublequotes if the string contains a space or a tab
-  BOOL addDoubleQuotes = wcspbrk(s, L" \t") != NULL;
+  BOOL addDoubleQuotes = wcspbrk(s, L" \t") != nullptr;
 
   if (addDoubleQuotes) {
     *d = '"'; // initial doublequote
     ++d;
   }
 
   if (hasDoubleQuote) {
     int i;
@@ -127,17 +127,17 @@ MakeCommandLine(int argc, PRUnichar **ar
     len += ArgStrLen(argv[i]) + 1;
 
   // Protect against callers that pass 0 arguments
   if (len == 0)
     len = 1;
 
   PRUnichar *s = (PRUnichar*) malloc(len * sizeof(PRUnichar));
   if (!s)
-    return NULL;
+    return nullptr;
 
   PRUnichar *c = s;
   for (i = 0; i < argc; ++i) {
     c = ArgToString(c, argv[i]);
     if (i + 1 != argc) {
       *c = ' ';
       ++c;
     }
@@ -154,17 +154,17 @@ MakeCommandLine(int argc, PRUnichar **ar
  */
 static PRUnichar*
 AllocConvertUTF8toUTF16(const char *arg)
 {
   // UTF16 can't be longer in units than UTF8
   int len = strlen(arg);
   PRUnichar *s = new PRUnichar[(len + 1) * sizeof(PRUnichar)];
   if (!s)
-    return NULL;
+    return nullptr;
 
   ConvertUTF8toUTF16 convert(s);
   convert.write(arg, len);
   convert.write_terminator();
   return s;
 }
 
 static void
@@ -184,18 +184,18 @@ FreeAllocStrings(int argc, PRUnichar **a
  * Launch a child process with the specified arguments.
  * @note argv[0] is ignored
  * @note The form of this function that takes char **argv expects UTF-8
  */
 
 BOOL
 WinLaunchChild(const PRUnichar *exePath, 
                int argc, PRUnichar **argv, 
-               HANDLE userToken = NULL,
-               HANDLE *hProcess = NULL);
+               HANDLE userToken = nullptr,
+               HANDLE *hProcess = nullptr);
 
 BOOL
 WinLaunchChild(const PRUnichar *exePath, 
                int argc, char **argv, 
                HANDLE userToken,
                HANDLE *hProcess)
 {
   PRUnichar** argvConverted = new PRUnichar*[argc];
@@ -230,70 +230,70 @@ WinLaunchChild(const PRUnichar *exePath,
     return FALSE;
   }
 
   STARTUPINFOW si = {0};
   si.cb = sizeof(STARTUPINFOW);
   si.lpDesktop = L"winsta0\\Default";
   PROCESS_INFORMATION pi = {0};
 
-  if (userToken == NULL) {
+  if (userToken == nullptr) {
     ok = CreateProcessW(exePath,
                         cl,
-                        NULL,  // no special security attributes
-                        NULL,  // no special thread attributes
+                        nullptr,  // no special security attributes
+                        nullptr,  // no special thread attributes
                         FALSE, // don't inherit filehandles
                         0,     // creation flags
-                        NULL,  // inherit my environment
-                        NULL,  // use my current directory
+                        nullptr,  // inherit my environment
+                        nullptr,  // use my current directory
                         &si,
                         &pi);
   } else {
     // Create an environment block for the process we're about to start using
     // the user's token.
-    LPVOID environmentBlock = NULL;
+    LPVOID environmentBlock = nullptr;
     if (!CreateEnvironmentBlock(&environmentBlock, userToken, TRUE)) {
-      environmentBlock = NULL;
+      environmentBlock = nullptr;
     }
 
     ok = CreateProcessAsUserW(userToken, 
                               exePath,
                               cl,
-                              NULL,  // no special security attributes
-                              NULL,  // no special thread attributes
-                              FALSE, // don't inherit filehandles
-                              0,     // creation flags
+                              nullptr,  // no special security attributes
+                              nullptr,  // no special thread attributes
+                              FALSE,    // don't inherit filehandles
+                              0,        // creation flags
                               environmentBlock,
-                              NULL,  // use my current directory
+                              nullptr,  // use my current directory
                               &si,
                               &pi);
 
     if (environmentBlock) {
       DestroyEnvironmentBlock(environmentBlock);
     }
   }
 
   if (ok) {
     if (hProcess) {
       *hProcess = pi.hProcess; // the caller now owns the HANDLE
     } else {
       CloseHandle(pi.hProcess);
     }
     CloseHandle(pi.hThread);
   } else {
-    LPVOID lpMsgBuf = NULL;
+    LPVOID lpMsgBuf = nullptr;
     FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
                   FORMAT_MESSAGE_FROM_SYSTEM |
                   FORMAT_MESSAGE_IGNORE_INSERTS,
-                  NULL,
+                  nullptr,
                   GetLastError(),
                   MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                   (LPTSTR) &lpMsgBuf,
                   0,
-                  NULL);
+                  nullptr);
     wprintf(L"Error restarting: %s\n", lpMsgBuf ? lpMsgBuf : L"(null)");
     if (lpMsgBuf)
       LocalFree(lpMsgBuf);
   }
 
   free(cl);
 
   return ok;
--- a/toolkit/xre/nsWindowsWMain.cpp
+++ b/toolkit/xre/nsWindowsWMain.cpp
@@ -50,17 +50,17 @@ int main(int argc, char **argv, char **e
 
 static char*
 AllocConvertUTF16toUTF8(const WCHAR *arg)
 {
   // be generous... UTF16 units can expand up to 3 UTF8 units
   int len = wcslen(arg);
   char *s = new char[len * 3 + 1];
   if (!s)
-    return NULL;
+    return nullptr;
 
   ConvertUTF16toUTF8 convert(s);
   convert.write(arg, len);
   convert.write_terminator();
   return s;
 }
 
 static void
@@ -86,17 +86,17 @@ int wmain(int argc, WCHAR **argv)
     return 127;
 
   for (int i = 0; i < argc; ++i) {
     argvConverted[i] = AllocConvertUTF16toUTF8(argv[i]);
     if (!argvConverted[i]) {
       return 127;
     }
   }
-  argvConverted[argc] = NULL;
+  argvConverted[argc] = nullptr;
 
   // need to save argvConverted copy for later deletion.
   char **deleteUs = new char*[argc+1];
   if (!deleteUs) {
     FreeAllocStrings(argc, argvConverted);
     return 127;
   }
   for (int i = 0; i < argc; i++)
--- a/toolkit/xre/nsX11ErrorHandler.cpp
+++ b/toolkit/xre/nsX11ErrorHandler.cpp
@@ -31,17 +31,17 @@ X11Error(Display *display, XErrorEvent *
     // Extension request
 
     // man XSetErrorHandler says "the error handler should not call any
     // functions (directly or indirectly) on the display that will generate
     // protocol requests or that will look for input events" so we use another
     // temporary Display to request extension information.  This assumes on
     // the DISPLAY environment variable has been set and matches what was used
     // to open |display|.
-    Display *tmpDisplay = XOpenDisplay(NULL);
+    Display *tmpDisplay = XOpenDisplay(nullptr);
     if (tmpDisplay) {
       int nExts;
       char** extNames = XListExtensions(tmpDisplay, &nExts);
       int first_error;
       if (extNames) {
         for (int i = 0; i < nExts; ++i) {
           int major_opcode, first_event;
           if (XQueryExtension(tmpDisplay, extNames[i],
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -877,19 +877,19 @@ static nsresult
 GetShellFolderPath(int folder, nsAString& _retval)
 {
   PRUnichar* buf;
   uint32_t bufLength = _retval.GetMutableData(&buf, MAXPATHLEN + 3);
   NS_ENSURE_TRUE(bufLength >= (MAXPATHLEN + 3), NS_ERROR_OUT_OF_MEMORY);
 
   nsresult rv = NS_OK;
 
-  LPITEMIDLIST pItemIDList = NULL;
+  LPITEMIDLIST pItemIDList = nullptr;
 
-  if (SUCCEEDED(SHGetSpecialFolderLocation(NULL, folder, &pItemIDList)) &&
+  if (SUCCEEDED(SHGetSpecialFolderLocation(nullptr, folder, &pItemIDList)) &&
       SHGetPathFromIDListW(pItemIDList, buf)) {
     // We're going to use wcslen (wcsnlen not available in msvc7.1) so make
     // sure to null terminate.
     buf[bufLength - 1] = L'\0';
     _retval.SetLength(wcslen(buf));
   } else {
     _retval.SetLength(0);
     rv = NS_ERROR_NOT_AVAILABLE;
@@ -914,18 +914,18 @@ GetRegWindowsAppDataFolder(bool aLocal, 
   DWORD res = ::RegOpenKeyExW(HKEY_CURRENT_USER, keyName.get(), 0, KEY_READ,
                               &key);
   if (res != ERROR_SUCCESS) {
     _retval.SetLength(0);
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   DWORD type, size;
-  res = RegQueryValueExW(key, (aLocal ? L"Local AppData" : L"AppData"), NULL,
-                         &type, NULL, &size);
+  res = RegQueryValueExW(key, (aLocal ? L"Local AppData" : L"AppData"),
+                         nullptr, &type, nullptr, &size);
   // The call to RegQueryValueExW must succeed, the type must be REG_SZ, the
   // buffer size must not equal 0, and the buffer size be a multiple of 2.
   if (res != ERROR_SUCCESS || type != REG_SZ || size == 0 || size % 2 != 0) {
     ::RegCloseKey(key);
     _retval.SetLength(0);
     return NS_ERROR_NOT_AVAILABLE;
   }
 
@@ -936,18 +936,18 @@ GetRegWindowsAppDataFolder(bool aLocal, 
   nsAString::iterator begin;
   _retval.BeginWriting(begin);
   if (begin.size_forward() != resultLen) {
     ::RegCloseKey(key);
     _retval.SetLength(0);
     return NS_ERROR_NOT_AVAILABLE;
   }
 
-  res = RegQueryValueExW(key, (aLocal ? L"Local AppData" : L"AppData"), NULL,
-                         NULL, (LPBYTE) begin.get(), &size);
+  res = RegQueryValueExW(key, (aLocal ? L"Local AppData" : L"AppData"),
+                         nullptr, nullptr, (LPBYTE) begin.get(), &size);
   ::RegCloseKey(key);
   if (res != ERROR_SUCCESS) {
     _retval.SetLength(0);
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   return NS_OK;
 }
@@ -959,17 +959,17 @@ GetCachedHash(HKEY rootKey, const nsAStr
   HKEY baseKey;
   if (RegOpenKeyExW(rootKey, regPath.BeginReading(), 0, KEY_READ, &baseKey) !=
       ERROR_SUCCESS) {
     return false;
   }
 
   wchar_t cachedHashRaw[512];
   DWORD bufferSize = sizeof(cachedHashRaw);
-  LONG result = RegQueryValueExW(baseKey, path.BeginReading(), 0, NULL,
+  LONG result = RegQueryValueExW(baseKey, path.BeginReading(), 0, nullptr,
                                  (LPBYTE)cachedHashRaw, &bufferSize);
   RegCloseKey(baseKey);
   if (result == ERROR_SUCCESS) {
     cachedHash.Assign(cachedHashRaw);
   }
   return ERROR_SUCCESS == result;
 }