Bug 1046841 - Fix more style violations in previously touched .cpp files in xpcom/. r=froydnj
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Mon, 25 Aug 2014 12:17:15 -0700
changeset 223093 b373c1d4e8ae1c06a2cf3b4c1d6a4a9569b79936
parent 223092 c2a0935b1b7676b30e3c98ceb7a86d11811be543
child 223094 db05fccb028c0c46217203d2d8e9fa8020b727d5
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1046841
milestone34.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 1046841 - Fix more style violations in previously touched .cpp files in xpcom/. r=froydnj
xpcom/base/AvailableMemoryTracker.cpp
xpcom/base/CycleCollectedJSRuntime.cpp
xpcom/base/SystemMemoryReporter.cpp
xpcom/base/VisualEventTracer.cpp
xpcom/base/nsConsoleService.cpp
xpcom/base/nsCycleCollector.cpp
xpcom/base/nsDebugImpl.cpp
xpcom/base/nsDumpUtils.cpp
xpcom/base/nsErrorService.cpp
xpcom/base/nsMacUtilsImpl.cpp
xpcom/base/nsMemoryInfoDumper.cpp
xpcom/base/nsMemoryReporterManager.cpp
xpcom/base/nsStackWalk.cpp
xpcom/base/nsSystemInfo.cpp
xpcom/base/nsTraceRefcnt.cpp
xpcom/base/nsUUIDGenerator.cpp
xpcom/base/nsVersionComparatorImpl.cpp
xpcom/build/nsXPComInit.cpp
xpcom/components/ManifestParser.cpp
xpcom/components/nsCategoryManager.cpp
xpcom/glue/BlockingResourceBase.cpp
xpcom/glue/FileUtils.cpp
xpcom/glue/nsCOMPtr.cpp
xpcom/glue/nsDeque.cpp
xpcom/glue/nsEnumeratorUtils.cpp
xpcom/glue/pldhash.cpp
xpcom/io/Base64.cpp
xpcom/io/nsAppFileLocationProvider.cpp
xpcom/io/nsBinaryStream.cpp
xpcom/io/nsDirectoryService.cpp
xpcom/io/nsLinebreakConverter.cpp
xpcom/io/nsLocalFileCommon.cpp
xpcom/io/nsLocalFileUnix.cpp
xpcom/io/nsLocalFileWin.cpp
xpcom/io/nsMultiplexInputStream.cpp
xpcom/io/nsScriptableInputStream.cpp
xpcom/io/nsStorageStream.cpp
xpcom/io/nsStreamUtils.cpp
xpcom/io/nsStringStream.cpp
xpcom/io/nsUnicharInputStream.cpp
xpcom/string/nsReadableUtils.cpp
xpcom/string/nsTString.cpp
xpcom/string/nsTSubstringTuple.cpp
xpcom/string/nsUTF8UtilsSSE2.cpp
xpcom/threads/ThreadStackHelper.cpp
xpcom/threads/nsEventQueue.cpp
xpcom/threads/nsThread.cpp
xpcom/threads/nsTimerImpl.cpp
--- a/xpcom/base/AvailableMemoryTracker.cpp
+++ b/xpcom/base/AvailableMemoryTracker.cpp
@@ -144,28 +144,26 @@ bool sHooksActive = false;
 
 // Alas, we'd like to use mozilla::TimeStamp, but we can't, because it acquires
 // a lock!
 volatile bool sHasScheduledOneLowMemoryNotification = false;
 volatile PRIntervalTime sLastLowMemoryNotificationTime;
 
 // These are function pointers to the functions we wrap in Init().
 
-void* (WINAPI* sVirtualAllocOrig)
-  (LPVOID aAddress, SIZE_T aSize, DWORD aAllocationType, DWORD aProtect);
+void* (WINAPI* sVirtualAllocOrig)(LPVOID aAddress, SIZE_T aSize,
+                                  DWORD aAllocationType, DWORD aProtect);
 
-void* (WINAPI* sMapViewOfFileOrig)
-  (HANDLE aFileMappingObject, DWORD aDesiredAccess,
-   DWORD aFileOffsetHigh, DWORD aFileOffsetLow,
-   SIZE_T aNumBytesToMap);
+void* (WINAPI* sMapViewOfFileOrig)(HANDLE aFileMappingObject,
+                                   DWORD aDesiredAccess, DWORD aFileOffsetHigh,
+                                   DWORD aFileOffsetLow, SIZE_T aNumBytesToMap);
 
-HBITMAP (WINAPI* sCreateDIBSectionOrig)
-  (HDC aDC, const BITMAPINFO* aBitmapInfo,
-   UINT aUsage, VOID** aBits,
-   HANDLE aSection, DWORD aOffset);
+HBITMAP(WINAPI* sCreateDIBSectionOrig)(HDC aDC, const BITMAPINFO* aBitmapInfo,
+                                       UINT aUsage, VOID** aBits,
+                                       HANDLE aSection, DWORD aOffset);
 
 /**
  * Fire a memory pressure event if it's been long enough since the last one we
  * fired.
  */
 bool
 MaybeScheduleMemoryPressureEvent()
 {
--- a/xpcom/base/CycleCollectedJSRuntime.cpp
+++ b/xpcom/base/CycleCollectedJSRuntime.cpp
@@ -152,17 +152,18 @@ TraceWeakMappingChild(JSTracer* aTrc, vo
     return;
   }
 
   if (!xpc_IsGrayGCThing(thing) && !tracer->mCb.WantAllTraces()) {
     return;
   }
 
   if (AddToCCKind(aKind)) {
-    tracer->mCb.NoteWeakMapping(tracer->mMap, tracer->mKey, tracer->mKeyDelegate, thing);
+    tracer->mCb.NoteWeakMapping(tracer->mMap, tracer->mKey,
+                                tracer->mKeyDelegate, thing);
     tracer->mTracedAny = true;
   } else {
     JS_TraceChildren(aTrc, thing, aKind);
   }
 }
 
 struct NoteWeakMapsTracer : public js::WeakMapTracer
 {
@@ -300,17 +301,18 @@ struct Closure
   {
   }
 
   bool mCycleCollectionEnabled;
   nsCycleCollectionNoteRootCallback* mCb;
 };
 
 static void
-CheckParticipatesInCycleCollection(void* aThing, const char* aName, void* aClosure)
+CheckParticipatesInCycleCollection(void* aThing, const char* aName,
+                                   void* aClosure)
 {
   Closure* closure = static_cast<Closure*>(aClosure);
 
   if (closure->mCycleCollectionEnabled) {
     return;
   }
 
   if (AddToCCKind(js::GCThingTraceKind(aThing)) &&
@@ -341,35 +343,35 @@ NoteJSHolder(void* aHolder, nsScriptObje
 
   return PL_DHASH_NEXT;
 }
 
 NS_IMETHODIMP
 JSGCThingParticipant::Traverse(void* aPtr,
                                nsCycleCollectionTraversalCallback& aCb)
 {
-  CycleCollectedJSRuntime* runtime = reinterpret_cast<CycleCollectedJSRuntime*>
-    (reinterpret_cast<char*>(this) -
-     offsetof(CycleCollectedJSRuntime, mGCThingCycleCollectorGlobal));
+  auto runtime = reinterpret_cast<CycleCollectedJSRuntime*>(
+    reinterpret_cast<char*>(this) - offsetof(CycleCollectedJSRuntime,
+                                             mGCThingCycleCollectorGlobal));
 
   runtime->TraverseGCThing(CycleCollectedJSRuntime::TRAVERSE_FULL,
                            aPtr, js::GCThingTraceKind(aPtr), aCb);
   return NS_OK;
 }
 
 // NB: This is only used to initialize the participant in
 // CycleCollectedJSRuntime. It should never be used directly.
 static JSGCThingParticipant sGCThingCycleCollectorGlobal;
 
 NS_IMETHODIMP
 JSZoneParticipant::Traverse(void* aPtr, nsCycleCollectionTraversalCallback& aCb)
 {
-  CycleCollectedJSRuntime* runtime = reinterpret_cast<CycleCollectedJSRuntime*>
-    (reinterpret_cast<char*>(this) -
-     offsetof(CycleCollectedJSRuntime, mJSZoneCycleCollectorGlobal));
+  auto runtime = reinterpret_cast<CycleCollectedJSRuntime*>(
+    reinterpret_cast<char*>(this) - offsetof(CycleCollectedJSRuntime,
+                                             mJSZoneCycleCollectorGlobal));
 
   MOZ_ASSERT(!aCb.WantAllTraces());
   JS::Zone* zone = static_cast<JS::Zone*>(aPtr);
 
   runtime->TraverseZone(zone, aCb);
   return NS_OK;
 }
 
@@ -484,17 +486,18 @@ CycleCollectedJSRuntime::CycleCollectedJ
   }
 
   if (!JS_AddExtraGCRootsTracer(mJSRuntime, TraceBlackJS, this)) {
     MOZ_CRASH();
   }
   JS_SetGrayGCRootsTracer(mJSRuntime, TraceGrayJS, this);
   JS_SetGCCallback(mJSRuntime, GCCallback, this);
   JS::SetOutOfMemoryCallback(mJSRuntime, OutOfMemoryCallback, this);
-  JS::SetLargeAllocationFailureCallback(mJSRuntime, LargeAllocationFailureCallback, this);
+  JS::SetLargeAllocationFailureCallback(mJSRuntime,
+                                        LargeAllocationFailureCallback, this);
   JS_SetContextCallback(mJSRuntime, ContextCallback, this);
   JS_SetDestroyZoneCallback(mJSRuntime, XPCStringConvert::FreeZoneCache);
   JS_SetSweepZoneCallback(mJSRuntime, XPCStringConvert::ClearZoneCache);
 
   static js::DOMCallbacks DOMcallbacks = {
     InstanceClassHasProtoAtDepth
   };
   SetDOMCallbacks(mJSRuntime, &DOMcallbacks);
@@ -607,17 +610,18 @@ CycleCollectedJSRuntime::NoteGCThingJSCh
                                                nsCycleCollectionTraversalCallback& aCb) const
 {
   MOZ_ASSERT(mJSRuntime);
   TraversalTracer trc(mJSRuntime, aCb);
   JS_TraceChildren(&trc, aThing, aTraceKind);
 }
 
 void
-CycleCollectedJSRuntime::NoteGCThingXPCOMChildren(const js::Class* aClasp, JSObject* aObj,
+CycleCollectedJSRuntime::NoteGCThingXPCOMChildren(const js::Class* aClasp,
+                                                  JSObject* aObj,
                                                   nsCycleCollectionTraversalCallback& aCb) const
 {
   MOZ_ASSERT(aClasp);
   MOZ_ASSERT(aClasp == js::GetObjectClass(aObj));
 
   if (NoteCustomGCThingXPCOMChildren(aClasp, aObj, aCb)) {
     // Nothing else to do!
     return;
@@ -760,17 +764,17 @@ CycleCollectedJSRuntime::GCCallback(JSRu
   CycleCollectedJSRuntime* self = static_cast<CycleCollectedJSRuntime*>(aData);
 
   MOZ_ASSERT(aRuntime == self->Runtime());
 
   self->OnGC(aStatus);
 }
 
 /* static */ void
-CycleCollectedJSRuntime::OutOfMemoryCallback(JSContext *aContext,
+CycleCollectedJSRuntime::OutOfMemoryCallback(JSContext* aContext,
                                              void* aData)
 {
   CycleCollectedJSRuntime* self = static_cast<CycleCollectedJSRuntime*>(aData);
 
   MOZ_ASSERT(JS_GetRuntime(aContext) == self->Runtime());
 
   self->OnOutOfMemory();
 }
@@ -1096,17 +1100,18 @@ IncrementalFinalizeRunnable::DeferredFin
 
 IncrementalFinalizeRunnable::IncrementalFinalizeRunnable(CycleCollectedJSRuntime* aRt,
                                                          nsTArray<nsISupports*>& aSupports,
                                                          DeferredFinalizerTable& aFinalizers)
   : mRuntime(aRt)
   , mFinalizeFunctionToRun(0)
 {
   this->mSupports.SwapElements(aSupports);
-  DeferredFinalizeFunctionHolder* function = mDeferredFinalizeFunctions.AppendElement();
+  DeferredFinalizeFunctionHolder* function =
+    mDeferredFinalizeFunctions.AppendElement();
   function->run = ReleaseSliceNow;
   function->data = &this->mSupports;
 
   // Enumerate the hashtable into our array.
   aFinalizers.Enumerate(DeferredFinalizerEnumerator, &mDeferredFinalizeFunctions);
 }
 
 IncrementalFinalizeRunnable::~IncrementalFinalizeRunnable()
@@ -1196,18 +1201,19 @@ CycleCollectedJSRuntime::FinalizeDeferre
   if (aType == FinalizeIncrementally) {
     NS_DispatchToCurrentThread(mFinalizeRunnable);
   } else {
     mFinalizeRunnable->ReleaseNow(false);
     MOZ_ASSERT(!mFinalizeRunnable);
   }
 }
 
-void 
-CycleCollectedJSRuntime::AnnotateAndSetOutOfMemory(OOMState *aStatePtr, OOMState aNewState)
+void
+CycleCollectedJSRuntime::AnnotateAndSetOutOfMemory(OOMState* aStatePtr,
+                                                   OOMState aNewState)
 {
   *aStatePtr = aNewState;
 #ifdef MOZ_CRASHREPORTER
   CrashReporter::AnnotateCrashReport(aStatePtr == &mOutOfMemoryState
                                      ? NS_LITERAL_CSTRING("JSOutOfMemory")
                                      : NS_LITERAL_CSTRING("JSLargeAllocationFailure"),
                                      aNewState == OOMState::Reporting
                                      ? NS_LITERAL_CSTRING("Reporting")
--- a/xpcom/base/SystemMemoryReporter.cpp
+++ b/xpcom/base/SystemMemoryReporter.cpp
@@ -158,18 +158,19 @@ public:
 #define REPORT(_path, _amount, _desc) \
   REPORT_WITH_CLEANUP(_path, UNITS_BYTES, _amount, _desc, (void)0)
 
   NS_IMETHOD CollectReports(nsIHandleReportCallback* aHandleReport,
                             nsISupports* aData, bool aAnonymize)
   {
     // There is lots of privacy-sensitive data in /proc. Just skip this
     // reporter entirely when anonymization is required.
-    if (aAnonymize)
+    if (aAnonymize) {
       return NS_OK;
+    }
 
     if (!Preferences::GetBool("memory.system_memory_reporter")) {
       return NS_OK;
     }
 
     // Read relevant fields from /proc/meminfo.
     int64_t memTotal = 0, memFree = 0;
     nsresult rv = ReadMemInfo(&memTotal, &memFree);
@@ -208,40 +209,41 @@ public:
     return rv;
   }
 
 private:
   // These are the cross-cutting measurements across all processes.
   class ProcessSizes
   {
   public:
-    void Add(const nsACString &aKey, size_t aSize)
+    void Add(const nsACString& aKey, size_t aSize)
     {
       mTagged.Put(aKey, mTagged.Get(aKey) + aSize);
     }
 
-    void Report(nsIHandleReportCallback *aHandleReport, nsISupports *aData)
+    void Report(nsIHandleReportCallback* aHandleReport, nsISupports* aData)
     {
       EnumArgs env = { aHandleReport, aData };
       mTagged.EnumerateRead(ReportSizes, &env);
     }
 
   private:
     nsDataHashtable<nsCStringHashKey, size_t> mTagged;
 
-    struct EnumArgs {
+    struct EnumArgs
+    {
       nsIHandleReportCallback* mHandleReport;
       nsISupports* mData;
     };
 
     static PLDHashOperator ReportSizes(nsCStringHashKey::KeyType aKey,
                                        size_t aAmount,
-                                       void *aUserArg)
+                                       void* aUserArg)
     {
-      const EnumArgs *envp = reinterpret_cast<const EnumArgs*>(aUserArg);
+      const EnumArgs* envp = reinterpret_cast<const EnumArgs*>(aUserArg);
 
       nsAutoCString path("processes/");
       path.Append(aKey);
 
       nsAutoCString desc("This is the sum of all processes' '");
       desc.Append(aKey);
       desc.AppendLiteral("' numbers.");
 
@@ -330,18 +332,18 @@ private:
                                     &processSizes, aTotalPss);
         fclose(f);
         if (NS_FAILED(rv)) {
           continue;
         }
 
         // Report the open file descriptors for this process.
         nsPrintfCString procFdPath("/proc/%s/fd", pidStr);
-        rv = CollectOpenFileReports(
-                  aHandleReport, aData, procFdPath, processName);
+        rv = CollectOpenFileReports(aHandleReport, aData, procFdPath,
+                                    processName);
         if (NS_FAILED(rv)) {
           break;
         }
       }
     }
     closedir(d);
 
     // Report the "processes/" tree.
@@ -942,22 +944,22 @@ private:
         } else {
           category = "";
           descriptionPrefix = "An uncategorized";
         }
 
 #undef CHECK_PREFIX
 
         const nsCString processName(aProcessName);
-        nsPrintfCString entryPath(
-            "open-fds/%s/%s%s/%s", processName.get(), category, linkPath, fd);
-        nsPrintfCString entryDescription(
-            "%s file descriptor opened by the process", descriptionPrefix);
-        REPORT_WITH_CLEANUP(
-            entryPath, UNITS_COUNT, 1, entryDescription, closedir(d));
+        nsPrintfCString entryPath("open-fds/%s/%s%s/%s",
+                                  processName.get(), category, linkPath, fd);
+        nsPrintfCString entryDescription("%s file descriptor opened by the process",
+                                         descriptionPrefix);
+        REPORT_WITH_CLEANUP(entryPath, UNITS_COUNT, 1, entryDescription,
+                            closedir(d));
       }
     }
 
     closedir(d);
     return NS_OK;
   }
 
   nsresult
@@ -968,18 +970,18 @@ private:
     // /sys/kernel/debug/kgsl/proc/<pid>/mem. This file format includes a
     // header and then entries with types as follows:
     //   gpuaddr useraddr size id  flags type usage sglen
     //   hexaddr hexaddr  int  int str   str  str   int
     // We care primarily about the usage and size.
 
     // For simplicity numbers will be uint64_t, strings 63 chars max.
     const char* const kScanFormat =
-        "%" SCNx64 " %" SCNx64 " %" SCNu64 " %" SCNu64
-        " %63s %63s %63s %" SCNu64;
+      "%" SCNx64 " %" SCNx64 " %" SCNu64 " %" SCNu64
+      " %63s %63s %63s %" SCNu64;
     const int kNumFields = 8;
     const size_t kStringSize = 64;
 
     DIR* d = opendir("/sys/kernel/debug/kgsl/proc/");
     if (!d) {
       if (NS_WARN_IF(errno != ENOENT && errno != EACCES)) {
         return NS_ERROR_FAILURE;
       }
--- a/xpcom/base/VisualEventTracer.cpp
+++ b/xpcom/base/VisualEventTracer.cpp
@@ -434,17 +434,18 @@ void
 Init()
 {
 #ifdef MOZ_VISUAL_EVENT_TRACER
   const char* logEvents = PR_GetEnv("MOZ_PROFILING_EVENTS");
   if (logEvents && *logEvents) {
     gEventFilter = EventFilter::Build(logEvents);
   }
 
-  PRStatus status = PR_NewThreadPrivateIndex(&gThreadPrivateIndex, &RecordBatch::Close);
+  PRStatus status = PR_NewThreadPrivateIndex(&gThreadPrivateIndex,
+                                             &RecordBatch::Close);
   if (status != PR_SUCCESS) {
     return;
   }
 
   gMonitor = new mozilla::Monitor("Profiler");
   if (!gMonitor) {
     return;
   }
@@ -492,18 +493,18 @@ Mark(uint32_t aType, void* aItem, const 
   if (aType == eNone) {
     return;
   }
 
   if (!CheckEventFilters(aType, aItem, aText)) { // Events use just aText
     return;
   }
 
-  RecordBatch* threadLogPrivate = static_cast<RecordBatch*>(
-    PR_GetThreadPrivate(gThreadPrivateIndex));
+  RecordBatch* threadLogPrivate =
+    static_cast<RecordBatch*>(PR_GetThreadPrivate(gThreadPrivateIndex));
   if (!threadLogPrivate) {
     threadLogPrivate = RecordBatch::Register();
     if (!threadLogPrivate) {
       return;
     }
 
     PR_SetThreadPrivate(gThreadPrivateIndex, threadLogPrivate);
   }
--- a/xpcom/base/nsConsoleService.cpp
+++ b/xpcom/base/nsConsoleService.cpp
@@ -29,17 +29,19 @@
 #ifdef XP_WIN
 #include <windows.h>
 #endif
 
 using namespace mozilla;
 
 NS_IMPL_ADDREF(nsConsoleService)
 NS_IMPL_RELEASE(nsConsoleService)
-NS_IMPL_CLASSINFO(nsConsoleService, nullptr, nsIClassInfo::THREADSAFE | nsIClassInfo::SINGLETON, NS_CONSOLESERVICE_CID)
+NS_IMPL_CLASSINFO(nsConsoleService, nullptr,
+                  nsIClassInfo::THREADSAFE | nsIClassInfo::SINGLETON,
+                  NS_CONSOLESERVICE_CID)
 NS_IMPL_QUERY_INTERFACE_CI(nsConsoleService, nsIConsoleService)
 NS_IMPL_CI_INTERFACE_GETTER(nsConsoleService, nsIConsoleService)
 
 static bool sLoggingEnabled = true;
 static bool sLoggingBuffered = true;
 
 nsConsoleService::nsConsoleService()
   : mMessages(nullptr)
@@ -52,17 +54,17 @@ nsConsoleService::nsConsoleService()
   // hm, but worry about circularity, bc we want to be able to report
   // prefs errs...
   mBufferSize = 250;
 }
 
 nsConsoleService::~nsConsoleService()
 {
   uint32_t i = 0;
-  while (i < mBufferSize && mMessages[i] != nullptr) {
+  while (i < mBufferSize && mMessages[i]) {
     NS_RELEASE(mMessages[i]);
     i++;
   }
 
   if (mMessages) {
     nsMemory::Free(mMessages);
   }
 }
@@ -261,17 +263,18 @@ nsConsoleService::LogStringMessage(const
     return NS_OK;
   }
 
   nsRefPtr<nsConsoleMessage> msg(new nsConsoleMessage(aMessage));
   return this->LogMessage(msg);
 }
 
 NS_IMETHODIMP
-nsConsoleService::GetMessageArray(uint32_t* aCount, nsIConsoleMessage*** aMessages)
+nsConsoleService::GetMessageArray(uint32_t* aCount,
+                                  nsIConsoleMessage*** aMessages)
 {
   nsIConsoleMessage** messageArray;
 
   /*
    * Lock the whole method, as we don't want anyone mucking with mCurrent or
    * mFull while we're copying out the buffer.
    */
   MutexAutoLock lock(mLock);
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -378,17 +378,18 @@ public:
   {
     return !mSentinelAndBlocks[0].block &&
            !mSentinelAndBlocks[1].block;
   }
 #endif
 
 private:
   struct Block;
-  union PtrInfoOrBlock {
+  union PtrInfoOrBlock
+  {
     // Use a union to avoid reinterpret_cast and the ensuing
     // potential aliasing bugs.
     PtrInfo* ptrInfo;
     Block* block;
   };
   struct Block
   {
     enum { BlockSize = 16 * 1024 };
@@ -425,25 +426,19 @@ private:
   {
     return mSentinelAndBlocks[1].block;
   }
 
 public:
   class Iterator
   {
   public:
-    Iterator() : mPointer(nullptr)
-  {
-  }
-    explicit Iterator(PtrInfoOrBlock* aPointer) : mPointer(aPointer)
-  {
-  }
-    Iterator(const Iterator& aOther) : mPointer(aOther.mPointer)
-  {
-  }
+    Iterator() : mPointer(nullptr) {}
+    explicit Iterator(PtrInfoOrBlock* aPointer) : mPointer(aPointer) {}
+    Iterator(const Iterator& aOther) : mPointer(aOther.mPointer) {}
 
     Iterator& operator++()
     {
       if (!mPointer->ptrInfo) {
         // Null pointer is a sentinel for link to the next block.
         mPointer = (mPointer + 1)->block->mPointers;
       }
       ++mPointer;
@@ -958,17 +953,18 @@ CanonicalizeParticipant(void** aParti, n
     ToParticipant(nsparti, &xcp);
     *aParti = nsparti;
     *aCp = xcp;
   }
 }
 
 struct nsPurpleBufferEntry
 {
-  union {
+  union
+  {
     void* mObject;                        // when low bit unset
     nsPurpleBufferEntry* mNextInFreeList; // when low bit set
   };
 
   nsCycleCollectingAutoRefCnt* mRefCnt;
 
   nsCycleCollectionParticipant* mParticipant; // nullptr for nsISupports
 };
@@ -993,17 +989,17 @@ private:
       // Ensure Block is the right size (see above).
       static_assert(
         sizeof(Block) == 16384 ||       // 32-bit
         sizeof(Block) == 32768,         // 64-bit
         "ill-sized nsPurpleBuffer::Block"
       );
     }
 
-    template <class PurpleVisitor>
+    template<class PurpleVisitor>
     void VisitEntries(nsPurpleBuffer& aBuffer, PurpleVisitor& aVisitor)
     {
       nsPurpleBufferEntry* eEnd = ArrayEnd(mEntries);
       for (nsPurpleBufferEntry* e = mEntries; e != eEnd; ++e) {
         if (!(uintptr_t(e->mObject) & uintptr_t(1))) {
           aVisitor.Visit(aBuffer, e);
         }
       }
@@ -1022,17 +1018,17 @@ public:
     InitBlocks();
   }
 
   ~nsPurpleBuffer()
   {
     FreeBlocks();
   }
 
-  template <class PurpleVisitor>
+  template<class PurpleVisitor>
   void VisitEntries(PurpleVisitor& aVisitor)
   {
     for (Block* b = &mFirstBlock; b; b = b->mNext) {
       b->VisitEntries(*this, aVisitor);
     }
   }
 
   void InitBlocks()
@@ -1213,24 +1209,26 @@ nsPurpleBuffer::SelectPointers(CCGraphBu
 
   NS_ASSERTION(mCount == 0, "AddPurpleRoot failed");
   if (mCount == 0) {
     FreeBlocks();
     InitBlocks();
   }
 }
 
-enum ccPhase {
+enum ccPhase
+{
   IdlePhase,
   GraphBuildingPhase,
   ScanAndCollectWhitePhase,
   CleanupPhase
 };
 
-enum ccType {
+enum ccType
+{
   SliceCC,     /* If a CC is in progress, continue it. Otherwise, start a new one. */
   ManualCC,    /* Explicitly triggered. */
   ShutdownCC   /* Shutdown CC, used for finding leaks. */
 };
 
 #ifdef MOZ_NUWA_PROCESS
 #include "ipc/Nuwa.h"
 #endif
@@ -1350,17 +1348,17 @@ NS_IMPL_ISUPPORTS(nsCycleCollector, nsIM
 
 /**
  * GraphWalker is templatized over a Visitor class that must provide
  * the following two methods:
  *
  * bool ShouldVisitNode(PtrInfo const *pi);
  * void VisitNode(PtrInfo *pi);
  */
-template <class Visitor>
+template<class Visitor>
 class GraphWalker
 {
 private:
   Visitor mVisitor;
 
   void DoWalk(nsDeque& aQueue);
 
   void CheckedPush(nsDeque& aQueue, PtrInfo* aPi)
@@ -1423,38 +1421,38 @@ ToParticipant(nsISupports* aPtr, nsXPCOM
 {
   // We use QI to move from an nsISupports to an
   // nsXPCOMCycleCollectionParticipant, which is a per-class singleton helper
   // object that implements traversal and unlinking logic for the nsISupports
   // in question.
   CallQueryInterface(aPtr, aCp);
 }
 
-template <class Visitor>
+template<class Visitor>
 MOZ_NEVER_INLINE void
 GraphWalker<Visitor>::Walk(PtrInfo* aPi)
 {
   nsDeque queue;
   CheckedPush(queue, aPi);
   DoWalk(queue);
 }
 
-template <class Visitor>
+template<class Visitor>
 MOZ_NEVER_INLINE void
 GraphWalker<Visitor>::WalkFromRoots(CCGraph& aGraph)
 {
   nsDeque queue;
   NodePool::Enumerator etor(aGraph.mNodes);
   for (uint32_t i = 0; i < aGraph.mRootCount; ++i) {
     CheckedPush(queue, etor.GetNext());
   }
   DoWalk(queue);
 }
 
-template <class Visitor>
+template<class Visitor>
 MOZ_NEVER_INLINE void
 GraphWalker<Visitor>::DoWalk(nsDeque& aQueue)
 {
   // Use a aQueue to match the breadth-first traversal used when we
   // built the graph, for hopefully-better locality.
   while (aQueue.GetSize() > 0) {
     PtrInfo* pi = static_cast<PtrInfo*>(aQueue.PopFront());
 
@@ -1471,17 +1469,18 @@ GraphWalker<Visitor>::DoWalk(nsDeque& aQ
 
 struct CCGraphDescriber : public LinkedListElement<CCGraphDescriber>
 {
   CCGraphDescriber()
     : mAddress("0x"), mCnt(0), mType(eUnknown)
   {
   }
 
-  enum Type {
+  enum Type
+  {
     eRefCountedObject,
     eGCedObject,
     eGCMarkedObject,
     eEdge,
     eRoot,
     eGarbage,
     eUnknown
   };
@@ -1585,17 +1584,18 @@ private:
       fclose(mGCLog.mStream);
     }
     if (mCCLog.mStream) {
       MozillaUnRegisterDebugFILE(mCCLog.mStream);
       fclose(mCCLog.mStream);
     }
   }
 
-  struct FileInfo {
+  struct FileInfo
+  {
     const char* const mPrefix;
     nsCOMPtr<nsIFile> mFile;
     FILE* mStream;
 
     explicit FileInfo(const char* aPrefix) : mPrefix(aPrefix), mStream(nullptr) { }
   };
 
   /**
@@ -1622,19 +1622,17 @@ private:
       NS_NewNativeLocalFile(nsCString(env), /* followLinks = */ true,
                             &logFile);
     }
 
     // On Android or B2G, this function will open a file named
     // aFilename under a memory-reporting-specific folder
     // (/data/local/tmp/memory-reports). Otherwise, it will open a
     // file named aFilename under "NS_OS_TEMP_DIR".
-    nsresult rv = nsDumpUtils::OpenTempFile(
-                                            filename,
-                                            &logFile,
+    nsresult rv = nsDumpUtils::OpenTempFile(filename, &logFile,
                                             NS_LITERAL_CSTRING("memory-reports"));
     if (NS_FAILED(rv)) {
       NS_IF_RELEASE(logFile);
       return nullptr;
     }
 
     return dont_AddRef(logFile);
   }
@@ -1646,62 +1644,66 @@ private:
     // completes.  (We do this because we don't want scripts which poll
     // the filesystem looking for GC/CC dumps to grab a file before we're
     // finished writing to it.)
     nsAutoCString incomplete;
     incomplete += "incomplete-";
     incomplete += aLog->mPrefix;
     MOZ_ASSERT(!aLog->mFile);
     aLog->mFile = CreateTempFile(incomplete.get());
-    if (NS_WARN_IF(!aLog->mFile))
+    if (NS_WARN_IF(!aLog->mFile)) {
       return NS_ERROR_UNEXPECTED;
+    }
 
     MOZ_ASSERT(!aLog->mStream);
     aLog->mFile->OpenANSIFileDesc("w", &aLog->mStream);
-    if (NS_WARN_IF(!aLog->mStream))
+    if (NS_WARN_IF(!aLog->mStream)) {
       return NS_ERROR_UNEXPECTED;
+    }
     MozillaRegisterDebugFILE(aLog->mStream);
     return NS_OK;
   }
 
   nsresult CloseLog(FileInfo* aLog, const nsAString& aCollectorKind)
   {
     MOZ_ASSERT(aLog->mStream);
     MOZ_ASSERT(aLog->mFile);
 
     MozillaUnRegisterDebugFILE(aLog->mStream);
     fclose(aLog->mStream);
     aLog->mStream = nullptr;
 
     // Strip off "incomplete-".
     nsCOMPtr<nsIFile> logFileFinalDestination =
       CreateTempFile(aLog->mPrefix);
-    if (NS_WARN_IF(!logFileFinalDestination))
+    if (NS_WARN_IF(!logFileFinalDestination)) {
       return NS_ERROR_UNEXPECTED;
+    }
 
     nsAutoString logFileFinalDestinationName;
     logFileFinalDestination->GetLeafName(logFileFinalDestinationName);
-    if (NS_WARN_IF(logFileFinalDestinationName.IsEmpty()))
+    if (NS_WARN_IF(logFileFinalDestinationName.IsEmpty())) {
       return NS_ERROR_UNEXPECTED;
+    }
 
     aLog->mFile->MoveTo(/* directory */ nullptr, logFileFinalDestinationName);
 
     // Save the file path.
     aLog->mFile = logFileFinalDestination;
 
     // Log to the error console.
     nsCOMPtr<nsIConsoleService> cs =
       do_GetService(NS_CONSOLESERVICE_CONTRACTID);
     if (cs) {
       // Copy out the path.
       nsAutoString logPath;
       logFileFinalDestination->GetPath(logPath);
 
-      nsString msg = aCollectorKind
-        + NS_LITERAL_STRING(" Collector log dumped to ") + logPath;
+      nsString msg = aCollectorKind +
+        NS_LITERAL_STRING(" Collector log dumped to ") + logPath;
       cs->LogStringMessage(msg.get());
     }
     return NS_OK;
   }
 
   int32_t mProcessIdentifier;
   nsString mFilenameIdentifier;
   FileInfo mGCLog;
@@ -1839,17 +1841,17 @@ public:
               aMarked ? ".marked" : "", aObjectDescription);
     }
     if (mWantAfterProcessing) {
       CCGraphDescriber* d =  new CCGraphDescriber();
       mDescribers.insertBack(d);
       mCurrentAddress.AssignLiteral("0x");
       mCurrentAddress.AppendInt(aAddress, 16);
       d->mType = aMarked ? CCGraphDescriber::eGCMarkedObject :
-        CCGraphDescriber::eGCedObject;
+                           CCGraphDescriber::eGCedObject;
       d->mAddress = mCurrentAddress;
       d->mName.Append(aObjectDescription);
       if (aCompartmentAddress) {
         d->mCompartmentOrToAddress.AssignLiteral("0x");
         d->mCompartmentOrToAddress.AppendInt(aCompartmentAddress, 16);
       } else {
         d->mCompartmentOrToAddress.SetIsVoid(true);
       }
@@ -2351,17 +2353,18 @@ CCGraphBuilder::AddWeakMapNode(void* aNo
 
   if (JS::Zone* zone = MergeZone(aNode)) {
     return AddNode(zone, mJSZoneParticipant);
   }
   return AddNode(aNode, mJSParticipant);
 }
 
 NS_IMETHODIMP_(void)
-CCGraphBuilder::NoteWeakMapping(void* aMap, void* aKey, void* aKdelegate, void* aVal)
+CCGraphBuilder::NoteWeakMapping(void* aMap, void* aKey, void* aKdelegate,
+                                void* aVal)
 {
   // Don't try to optimize away the entry here, as we've already attempted to
   // do that in TraceWeakMapping in nsXPConnect.
   WeakMapping* mapping = mGraph.mWeakMaps.AppendElement();
   mapping->mMap = aMap ? AddWeakMapNode(aMap) : nullptr;
   mapping->mKey = aKey ? AddWeakMapNode(aKey) : nullptr;
   mapping->mKeyDelegate = aKdelegate ? AddWeakMapNode(aKdelegate) : mapping->mKey;
   mapping->mVal = aVal ? AddWeakMapNode(aVal) : nullptr;
@@ -2645,28 +2648,28 @@ public:
 
   virtual void Trace(JS::Heap<JS::Value>* aValue, const char* aName,
                      void* aClosure) const
   {
     JS::Value val = *aValue;
     if (val.isMarkable()) {
       void* thing = val.toGCThing();
       if (thing && xpc_GCThingIsGrayCCThing(thing)) {
-        MOZ_ASSERT(!js::gc::IsInsideNursery((js::gc::Cell *)thing));
+        MOZ_ASSERT(!js::gc::IsInsideNursery((js::gc::Cell*)thing));
         mCollector->GetJSPurpleBuffer()->mValues.AppendElement(val);
       }
     }
   }
 
   virtual void Trace(JS::Heap<jsid>* aId, const char* aName,
                      void* aClosure) const
   {
   }
 
-  void AppendJSObjectToPurpleBuffer(JSObject *obj) const
+  void AppendJSObjectToPurpleBuffer(JSObject* obj) const
   {
     if (obj && xpc_GCThingIsGrayCCThing(obj)) {
       MOZ_ASSERT(!js::gc::IsInsideNursery(JS::AsCell(obj)));
       mCollector->GetJSPurpleBuffer()->mObjects.AppendElement(obj);
     }
   }
 
   virtual void Trace(JS::Heap<JSObject*>* aObject, const char* aName,
@@ -2897,19 +2900,20 @@ struct ScanBlackVisitor
 private:
   uint32_t& mWhiteNodeCount;
   bool& mFailed;
 };
 
 static void
 FloodBlackNode(uint32_t& aWhiteNodeCount, bool& aFailed, PtrInfo* aPi)
 {
-    GraphWalker<ScanBlackVisitor>(ScanBlackVisitor(aWhiteNodeCount, aFailed)).Walk(aPi);
-    MOZ_ASSERT(aPi->mColor == black || !aPi->WasTraversed(),
-               "FloodBlackNode should make aPi black");
+  GraphWalker<ScanBlackVisitor>(ScanBlackVisitor(aWhiteNodeCount,
+                                                 aFailed)).Walk(aPi);
+  MOZ_ASSERT(aPi->mColor == black || !aPi->WasTraversed(),
+             "FloodBlackNode should make aPi black");
 }
 
 // Iterate over the WeakMaps.  If we mark anything while iterating
 // over the WeakMaps, we must iterate over all of the WeakMaps again.
 void
 nsCycleCollector::ScanWeakMaps()
 {
   bool anyChanged;
@@ -3006,23 +3010,26 @@ nsCycleCollector::ScanIncrementalRoots()
   // refcounted object is purple, it may have been AddRef'd during the current
   // ICC. (It may also have only been released.) If that is the case, we cannot
   // be sure that the set of things pointing to the object in the CC graph
   // is accurate. Therefore, for safety, we treat any purple objects as being
   // live during the current CC. We don't remove anything from the purple
   // buffer here, so these objects will be suspected and freed in the next CC
   // if they are garbage.
   bool failed = false;
-  PurpleScanBlackVisitor purpleScanBlackVisitor(mGraph, mListener, mWhiteNodeCount, failed);
+  PurpleScanBlackVisitor purpleScanBlackVisitor(mGraph, mListener,
+                                                mWhiteNodeCount, failed);
   mPurpleBuf.VisitEntries(purpleScanBlackVisitor);
   timeLog.Checkpoint("ScanIncrementalRoots::fix purple");
 
   bool hasJSRuntime = !!mJSRuntime;
-  nsCycleCollectionParticipant* jsParticipant = hasJSRuntime ? mJSRuntime->GCThingParticipant() : nullptr;
-  nsCycleCollectionParticipant* zoneParticipant = hasJSRuntime ? mJSRuntime->ZoneParticipant() : nullptr;
+  nsCycleCollectionParticipant* jsParticipant =
+    hasJSRuntime ? mJSRuntime->GCThingParticipant() : nullptr;
+  nsCycleCollectionParticipant* zoneParticipant =
+    hasJSRuntime ? mJSRuntime->ZoneParticipant() : nullptr;
   bool hasListener = !!mListener;
 
   NodePool::Enumerator etor(mGraph.mNodes);
   while (!etor.IsDone()) {
     PtrInfo* pi = etor.GetNext();
 
     // As an optimization, if an object has already been determined to be live,
     // don't consider it further.  We can't do this if there is a listener,
@@ -3258,29 +3265,31 @@ nsCycleCollector::CollectWhite()
 
   if (mBeforeUnlinkCB) {
     mBeforeUnlinkCB();
     timeLog.Checkpoint("CollectWhite::BeforeUnlinkCB");
   }
 
   for (uint32_t i = 0; i < count; ++i) {
     PtrInfo* pinfo = whiteNodes.ElementAt(i);
-    MOZ_ASSERT(pinfo->mParticipant, "Unlink shouldn't see objects removed from graph.");
+    MOZ_ASSERT(pinfo->mParticipant,
+               "Unlink shouldn't see objects removed from graph.");
     pinfo->mParticipant->Unlink(pinfo->mPointer);
 #ifdef DEBUG
     if (mJSRuntime) {
       mJSRuntime->AssertNoObjectsToTrace(pinfo->mPointer);
     }
 #endif
   }
   timeLog.Checkpoint("CollectWhite::Unlink");
 
   for (uint32_t i = 0; i < count; ++i) {
     PtrInfo* pinfo = whiteNodes.ElementAt(i);
-    MOZ_ASSERT(pinfo->mParticipant, "Unroot shouldn't see objects removed from graph.");
+    MOZ_ASSERT(pinfo->mParticipant,
+               "Unroot shouldn't see objects removed from graph.");
     pinfo->mParticipant->Unroot(pinfo->mPointer);
   }
   timeLog.Checkpoint("CollectWhite::Unroot");
 
   nsCycleCollector_dispatchDeferredDeletion(false);
   timeLog.Checkpoint("CollectWhite::dispatchDeferredDeletion");
 
   mIncrementalPhase = CleanupPhase;
@@ -3471,18 +3480,18 @@ nsCycleCollector::FixGrayBits(bool aForc
     CC_TELEMETRY(_NEED_GC, needGC);
     if (!needGC) {
       return;
     }
     mResults.mForcedGC = true;
   }
 
   TimeLog timeLog;
-  mJSRuntime->GarbageCollect(aForceGC ? JS::gcreason::SHUTDOWN_CC
-                                      : JS::gcreason::CC_FORCED);
+  mJSRuntime->GarbageCollect(aForceGC ? JS::gcreason::SHUTDOWN_CC :
+                                        JS::gcreason::CC_FORCED);
   timeLog.Checkpoint("GC()");
 }
 
 void
 nsCycleCollector::CleanupAfterCollection()
 {
   TimeLog timeLog;
   MOZ_ASSERT(mIncrementalPhase == CleanupPhase);
@@ -3738,17 +3747,18 @@ nsCycleCollector::BeginCollection(ccType
 
   // Set up the data structures for building the graph.
   mGraph.Init();
   mResults.Init();
   bool mergeZones = ShouldMergeZones(aCCType);
   mResults.mMergedZones = mergeZones;
 
   MOZ_ASSERT(!mBuilder, "Forgot to clear mBuilder");
-  mBuilder = new CCGraphBuilder(mGraph, mResults, mJSRuntime, mListener, mergeZones);
+  mBuilder = new CCGraphBuilder(mGraph, mResults, mJSRuntime, mListener,
+                                mergeZones);
 
   if (mJSRuntime) {
     mJSRuntime->TraverseRoots(*mBuilder);
     timeLog.Checkpoint("mJSRuntime->TraverseRoots()");
   }
 
   AutoRestore<bool> ar(mScanInProgress);
   MOZ_ASSERT(!mScanInProgress);
@@ -4100,17 +4110,17 @@ nsCycleCollector_forgetSkippable(bool aR
 {
   CollectorData* data = sCollectorData.get();
 
   // We should have started the cycle collector by now.
   MOZ_ASSERT(data);
   MOZ_ASSERT(data->mCollector);
 
   PROFILER_LABEL("nsCycleCollector", "forgetSkippable",
-    js::ProfileEntry::Category::CC);
+                 js::ProfileEntry::Category::CC);
 
   TimeLog timeLog;
   data->mCollector->ForgetSkippable(aRemoveChildlessNodes,
                                     aAsyncSnowWhiteFreeing);
   timeLog.Checkpoint("ForgetSkippable()");
 }
 
 void
@@ -4150,33 +4160,33 @@ nsCycleCollector_collect(nsICycleCollect
 {
   CollectorData* data = sCollectorData.get();
 
   // We should have started the cycle collector by now.
   MOZ_ASSERT(data);
   MOZ_ASSERT(data->mCollector);
 
   PROFILER_LABEL("nsCycleCollector", "collect",
-    js::ProfileEntry::Category::CC);
+                 js::ProfileEntry::Category::CC);
 
   SliceBudget unlimitedBudget;
   data->mCollector->Collect(ManualCC, unlimitedBudget, aManualListener);
 }
 
 void
 nsCycleCollector_collectSlice(int64_t aSliceTime)
 {
   CollectorData* data = sCollectorData.get();
 
   // We should have started the cycle collector by now.
   MOZ_ASSERT(data);
   MOZ_ASSERT(data->mCollector);
 
   PROFILER_LABEL("nsCycleCollector", "collectSlice",
-    js::ProfileEntry::Category::CC);
+                 js::ProfileEntry::Category::CC);
 
   SliceBudget budget;
   if (aSliceTime >= 0) {
     budget = SliceBudget(SliceBudget::TimeBudget(aSliceTime));
   }
   data->mCollector->Collect(SliceCC, budget, nullptr);
 }
 
@@ -4185,17 +4195,17 @@ nsCycleCollector_collectSliceWork(int64_
 {
   CollectorData* data = sCollectorData.get();
 
   // We should have started the cycle collector by now.
   MOZ_ASSERT(data);
   MOZ_ASSERT(data->mCollector);
 
   PROFILER_LABEL("nsCycleCollector", "collectSliceWork",
-    js::ProfileEntry::Category::CC);
+                 js::ProfileEntry::Category::CC);
 
   SliceBudget budget;
   if (aSliceWork >= 0) {
     budget = SliceBudget(SliceBudget::WorkBudget(aSliceWork));
   }
   data->mCollector->Collect(SliceCC, budget, nullptr);
 }
 
@@ -4230,17 +4240,17 @@ nsCycleCollector_finishAnyCurrentCollect
 void
 nsCycleCollector_shutdown()
 {
   CollectorData* data = sCollectorData.get();
 
   if (data) {
     MOZ_ASSERT(data->mCollector);
     PROFILER_LABEL("nsCycleCollector", "shutdown",
-      js::ProfileEntry::Category::CC);
+                   js::ProfileEntry::Category::CC);
 
     data->mCollector->Shutdown();
     data->mCollector = nullptr;
     if (!data->mRuntime) {
       delete data;
       sCollectorData.set(nullptr);
     }
   }
--- a/xpcom/base/nsDebugImpl.cpp
+++ b/xpcom/base/nsDebugImpl.cpp
@@ -231,17 +231,18 @@ static PRLogModuleInfo* gDebugLog;
 static void
 InitLog()
 {
   if (0 == gDebugLog) {
     gDebugLog = PR_NewLogModule("nsDebug");
   }
 }
 
-enum nsAssertBehavior {
+enum nsAssertBehavior
+{
   NS_ASSERT_UNINITIALIZED,
   NS_ASSERT_WARN,
   NS_ASSERT_SUSPEND,
   NS_ASSERT_STACK,
   NS_ASSERT_TRAP,
   NS_ASSERT_ABORT,
   NS_ASSERT_STACK_AND_ABORT
 };
@@ -506,17 +507,18 @@ RealBreak()
 // Abort() calls this function, don't call it!
 static void
 Break(const char* aMsg)
 {
 #if defined(_WIN32)
   static int ignoreDebugger;
   if (!ignoreDebugger) {
     const char* shouldIgnoreDebugger = getenv("XPCOM_DEBUG_DLG");
-    ignoreDebugger = 1 + (shouldIgnoreDebugger && !strcmp(shouldIgnoreDebugger, "1"));
+    ignoreDebugger =
+      1 + (shouldIgnoreDebugger && !strcmp(shouldIgnoreDebugger, "1"));
   }
   if ((ignoreDebugger == 2) || !::IsDebuggerPresent()) {
     DWORD code = IDRETRY;
 
     /* Create the debug dialog out of process to avoid the crashes caused by
      * Windows events leaking into our event loop from an in process dialog.
      * We do this by launching windbgdlg.exe (built in xpcom/windbgdlg).
      * See http://bugzilla.mozilla.org/show_bug.cgi?id=54792
@@ -582,18 +584,17 @@ static const nsDebugImpl kImpl;
 
 nsresult
 nsDebugImpl::Create(nsISupports* aOuter, const nsIID& aIID, void** aInstancePtr)
 {
   if (NS_WARN_IF(aOuter)) {
     return NS_ERROR_NO_AGGREGATION;
   }
 
-  return const_cast<nsDebugImpl*>(&kImpl)->
-    QueryInterface(aIID, aInstancePtr);
+  return const_cast<nsDebugImpl*>(&kImpl)->QueryInterface(aIID, aInstancePtr);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 
 nsresult
 NS_ErrorAccordingToNSPR()
 {
   PRErrorCode err = PR_GetError();
--- a/xpcom/base/nsDumpUtils.cpp
+++ b/xpcom/base/nsDumpUtils.cpp
@@ -470,18 +470,17 @@ nsDumpUtils::OpenTempFile(const nsACStri
     (*aFile)->Create(nsIFile::DIRECTORY_TYPE, 0777);
 
     nsAutoCString dirPath;
     rv = (*aFile)->GetNativePath(dirPath);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
-    while (chmod(dirPath.get(), 0777) == -1 && errno == EINTR)
-    {
+    while (chmod(dirPath.get(), 0777) == -1 && errno == EINTR) {
     }
   }
 #endif
 
   nsCOMPtr<nsIFile> file(*aFile);
 
   rv = file->AppendNative(aFilename);
   if (NS_WARN_IF(NS_FAILED(rv))) {
@@ -498,15 +497,14 @@ nsDumpUtils::OpenTempFile(const nsACStri
   // CreateUnique call above are not sufficient on Android, which runs with a
   // umask.
   nsAutoCString path;
   rv = file->GetNativePath(path);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
-  while (chmod(path.get(), 0666) == -1 && errno == EINTR)
-  {
+  while (chmod(path.get(), 0666) == -1 && errno == EINTR) {
   }
 #endif
 
   return NS_OK;
 }
--- a/xpcom/base/nsErrorService.cpp
+++ b/xpcom/base/nsErrorService.cpp
@@ -6,27 +6,29 @@
 
 #include "nsErrorService.h"
 #include "nsCRTGlue.h"
 #include "nsAutoPtr.h"
 
 NS_IMPL_ISUPPORTS(nsErrorService, nsIErrorService)
 
 nsresult
-nsErrorService::Create(nsISupports* aOuter, const nsIID& aIID, void** aInstancePtr)
+nsErrorService::Create(nsISupports* aOuter, const nsIID& aIID,
+                       void** aInstancePtr)
 {
   if (NS_WARN_IF(aOuter)) {
     return NS_ERROR_NO_AGGREGATION;
   }
   nsRefPtr<nsErrorService> serv = new nsErrorService();
   return serv->QueryInterface(aIID, aInstancePtr);
 }
 
 NS_IMETHODIMP
-nsErrorService::RegisterErrorStringBundle(int16_t aErrorModule, const char* aStringBundleURL)
+nsErrorService::RegisterErrorStringBundle(int16_t aErrorModule,
+                                          const char* aStringBundleURL)
 {
   mErrorStringBundleURLMap.Put(aErrorModule, new nsCString(aStringBundleURL));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsErrorService::UnregisterErrorStringBundle(int16_t aErrorModule)
 {
--- a/xpcom/base/nsMacUtilsImpl.cpp
+++ b/xpcom/base/nsMacUtilsImpl.cpp
@@ -32,17 +32,18 @@ nsMacUtilsImpl::GetArchString(nsAString&
 
   CFArrayRef archList = ::CFBundleCopyExecutableArchitectures(mainBundle);
   if (!archList) {
     return NS_ERROR_FAILURE;
   }
 
   CFIndex archCount = ::CFArrayGetCount(archList);
   for (CFIndex i = 0; i < archCount; i++) {
-    CFNumberRef arch = static_cast<CFNumberRef>(::CFArrayGetValueAtIndex(archList, i));
+    CFNumberRef arch =
+      static_cast<CFNumberRef>(::CFArrayGetValueAtIndex(archList, i));
 
     int archInt = 0;
     if (!::CFNumberGetValue(arch, kCFNumberIntType, &archInt)) {
       ::CFRelease(archList);
       return NS_ERROR_FAILURE;
     }
 
     if (archInt == kCFBundleExecutableArchitecturePPC) {
--- a/xpcom/base/nsMemoryInfoDumper.cpp
+++ b/xpcom/base/nsMemoryInfoDumper.cpp
@@ -119,17 +119,18 @@ public:
 private:
   ~GCAndCCLogDumpRunnable() {}
 
   const nsString mIdentifier;
   const bool mDumpAllTraces;
   const bool mDumpChildProcesses;
 };
 
-NS_IMPL_ISUPPORTS_INHERITED(GCAndCCLogDumpRunnable, nsRunnable, nsIDumpGCAndCCLogsCallback)
+NS_IMPL_ISUPPORTS_INHERITED(GCAndCCLogDumpRunnable, nsRunnable,
+                            nsIDumpGCAndCCLogsCallback)
 
 } // anonymous namespace
 
 #if defined(MOZ_SUPPORTS_RT_SIGNALS) // {
 namespace {
 
 /*
  * The following code supports dumping about:memory upon receiving a signal.
@@ -173,34 +174,34 @@ void doMemoryReport(const uint8_t aRecvS
   NS_DispatchToMainThread(runnable);
 }
 
 void doGCCCDump(const uint8_t aRecvSig)
 {
   LOG("SignalWatcher(sig %d) dispatching GC/CC log runnable.", aRecvSig);
   // Dump GC and CC logs (from the main thread).
   nsRefPtr<GCAndCCLogDumpRunnable> runnable =
-    new GCAndCCLogDumpRunnable(
-      /* identifier = */ EmptyString(),
-      /* allTraces = */ true,
-      /* dumpChildProcesses = */ true);
+    new GCAndCCLogDumpRunnable(/* identifier = */ EmptyString(),
+                               /* allTraces = */ true,
+                               /* dumpChildProcesses = */ true);
   NS_DispatchToMainThread(runnable);
 }
 
 } // anonymous namespace
 #endif // MOZ_SUPPORTS_RT_SIGNALS }
 
 #if defined(MOZ_SUPPORTS_FIFO) // {
 namespace {
 
 void
 doMemoryReport(const nsCString& aInputStr)
 {
   bool minimize = aInputStr.EqualsLiteral("minimize memory report");
-  LOG("FifoWatcher(command:%s) dispatching memory report runnable.", aInputStr.get());
+  LOG("FifoWatcher(command:%s) dispatching memory report runnable.",
+      aInputStr.get());
   nsRefPtr<DumpMemoryInfoToTempDirRunnable> runnable =
     new DumpMemoryInfoToTempDirRunnable(/* identifier = */ EmptyString(),
                                         /* anonymize = */ false,
                                         minimize);
   NS_DispatchToMainThread(runnable);
 }
 
 void
@@ -309,17 +310,18 @@ EnsureNonEmptyIdentifier(nsAString& aIde
   // generates and also the files generated by this process's children, allowing
   // us to identify which files are from the same memory report request.
   aIdentifier.AppendInt(static_cast<int64_t>(PR_Now()) / 1000000);
 }
 
 // Use XPCOM refcounting to fire |onFinish| when all reference-holders
 // (remote dump actors or the |DumpGCAndCCLogsToFile| activation itself)
 // have gone away.
-class nsDumpGCAndCCLogsCallbackHolder MOZ_FINAL : public nsIDumpGCAndCCLogsCallback
+class nsDumpGCAndCCLogsCallbackHolder MOZ_FINAL
+  : public nsIDumpGCAndCCLogsCallback
 {
 public:
   NS_DECL_ISUPPORTS
 
   explicit nsDumpGCAndCCLogsCallbackHolder(nsIDumpGCAndCCLogsCallback* aCallback)
     : mCallback(aCallback)
   {
   }
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -1168,46 +1168,46 @@ nsMemoryReporterManager::GetReportsExten
                                            aHandleReport,
                                            aHandleReportData,
                                            aFinishReporting,
                                            aFinishReportingData,
                                            aDMDDumpIdent);
   }
 
   if (aMinimize) {
-    rv = MinimizeMemoryUsage(NS_NewRunnableMethod(this, &nsMemoryReporterManager::StartGettingReports));
+    rv = MinimizeMemoryUsage(NS_NewRunnableMethod(
+      this, &nsMemoryReporterManager::StartGettingReports));
   } else {
     rv = StartGettingReports();
   }
   return rv;
 }
 
 nsresult
 nsMemoryReporterManager::StartGettingReports()
 {
   GetReportsState* s = mGetReportsState;
 
   // Get reports for this process.
-  FILE *parentDMDFile = nullptr;
+  FILE* parentDMDFile = nullptr;
 #ifdef MOZ_DMD
   nsresult rv = nsMemoryInfoDumper::OpenDMDFile(s->mDMDDumpIdent, getpid(),
                                                 &parentDMDFile);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     // Proceed with the memory report as if DMD were disabled.
     parentDMDFile = nullptr;
   }
 #endif
   GetReportsForThisProcessExtended(s->mHandleReport, s->mHandleReportData,
                                    s->mAnonymize, parentDMDFile);
   s->mParentDone = true;
 
   // If there are no remaining child processes, we can finish up immediately.
-  return (s->mNumChildProcessesCompleted >= s->mNumChildProcesses)
-    ? FinishReporting()
-    : NS_OK;
+  return (s->mNumChildProcessesCompleted >= s->mNumChildProcesses) ?
+    FinishReporting() : NS_OK;
 }
 
 typedef nsCOMArray<nsIMemoryReporter> MemoryReporterArray;
 
 static PLDHashOperator
 StrongEnumerator(nsRefPtrHashKey<nsIMemoryReporter>* aElem, void* aData)
 {
   MemoryReporterArray* allReporters = static_cast<MemoryReporterArray*>(aData);
--- a/xpcom/base/nsStackWalk.cpp
+++ b/xpcom/base/nsStackWalk.cpp
@@ -250,17 +250,17 @@ PrintError(const char* aPrefix)
 {
   LPVOID lpMsgBuf;
   DWORD lastErr = GetLastError();
   FormatMessageA(
     FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
     nullptr,
     lastErr,
     MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
-    (LPSTR) &lpMsgBuf,
+    (LPSTR)&lpMsgBuf,
     0,
     nullptr
   );
   fprintf(stderr, "### ERROR: %s: %s",
           aPrefix, lpMsgBuf ? lpMsgBuf : "(null)\n");
   fflush(stderr);
   LocalFree(lpMsgBuf);
 }
@@ -281,19 +281,18 @@ EnsureWalkThreadReady()
                                FALSE /* initially non-signaled */,
                                nullptr);
     if (!readyEvent) {
       PrintError("CreateEvent");
       return false;
     }
 
     unsigned int threadID;
-    stackWalkThread = (HANDLE)
-      _beginthreadex(nullptr, 0, WalkStackThread, (void*)readyEvent,
-                     0, &threadID);
+    stackWalkThread = (HANDLE)_beginthreadex(nullptr, 0, WalkStackThread,
+                                             (void*)readyEvent, 0, &threadID);
     if (!stackWalkThread) {
       PrintError("CreateThread");
       ::CloseHandle(readyEvent);
       readyEvent = nullptr;
       return false;
     }
     gStackWalkThread = threadID;
     ::CloseHandle(stackWalkThread);
@@ -450,17 +449,17 @@ WalkStackThread(void* aData)
   // Call PeekMessage to force creation of a message queue so that
   // other threads can safely post events to us.
   ::PeekMessage(&msg, nullptr, WM_USER, WM_USER, PM_NOREMOVE);
 
   // and tell the thread that created us that we're ready.
   HANDLE readyEvent = (HANDLE)aData;
   ::SetEvent(readyEvent);
 
-  while ((msgRet = ::GetMessage(&msg, (HWND) - 1, 0, 0)) != 0) {
+  while ((msgRet = ::GetMessage(&msg, (HWND)-1, 0, 0)) != 0) {
     if (msgRet == -1) {
       PrintError("GetMessage");
     } else {
       DWORD ret;
 
       struct WalkStackData* data = (WalkStackData*)msg.lParam;
       if (!data) {
         continue;
@@ -967,17 +966,17 @@ struct my_user_args {
 static void myinit();
 
 #pragma init (myinit)
 
 static void
 myinit()
 {
 
-  if (! initialized) {
+  if (!initialized) {
 #ifndef __GNUC__
     void *handle;
     const char *libdem = "libdemangle.so.1";
 
     /* load libdemangle if we can and need to (only try this once) */
     if ((handle = dlopen(libdem, RTLD_LAZY)) != nullptr) {
       demf = (demf_t *)dlsym(handle,
                              "cplus_demangle"); /*lint !e611 */
--- a/xpcom/base/nsSystemInfo.cpp
+++ b/xpcom/base/nsSystemInfo.cpp
@@ -197,17 +197,18 @@ nsSystemInfo::Init()
   NS_ENSURE_SUCCESS(rv, rv);
   double versionDouble = version.ToDouble(&rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = SetPropertyAsBool(NS_ConvertASCIItoUTF16("hasWindowsTouchInterface"),
                          versionDouble >= 6.2);
   NS_ENSURE_SUCCESS(rv, rv);
 #else
-  rv = SetPropertyAsBool(NS_ConvertASCIItoUTF16("hasWindowsTouchInterface"), false);
+  rv = SetPropertyAsBool(NS_ConvertASCIItoUTF16("hasWindowsTouchInterface"),
+                         false);
   NS_ENSURE_SUCCESS(rv, rv);
 #endif
 
   // Additional informations not available through PR_GetSystemInfo.
   SetInt32Property(NS_LITERAL_STRING("pagesize"), PR_GetPageSize());
   SetInt32Property(NS_LITERAL_STRING("pageshift"), PR_GetPageShift());
   SetInt32Property(NS_LITERAL_STRING("memmapalign"), PR_GetMemMapAlignment());
   SetInt32Property(NS_LITERAL_STRING("cpucount"), PR_GetNumberOfProcessors());
@@ -230,17 +231,18 @@ nsSystemInfo::Init()
     rv = SetPropertyAsBool(NS_LITERAL_STRING("isWow64"), !!isWow64);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
   if (NS_FAILED(GetProfileHDDInfo())) {
     // We might have been called before profile-do-change. We'll observe that
     // event so that we can fill this in later.
-    nsCOMPtr<nsIObserverService> obsService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv);
+    nsCOMPtr<nsIObserverService> obsService =
+      do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
     rv = obsService->AddObserver(this, "profile-do-change", false);
     if (NS_FAILED(rv)) {
       return rv;
     }
   }
@@ -258,17 +260,18 @@ nsSystemInfo::Init()
     rv = SetPropertyAsACString(NS_LITERAL_STRING("winHDDRevision"),
                                hddRevision);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 #endif
 
 #if defined(MOZ_WIDGET_GTK)
   // This must be done here because NSPR can only separate OS's when compiled, not libraries.
-  char* gtkver = PR_smprintf("GTK %u.%u.%u", gtk_major_version, gtk_minor_version, gtk_micro_version);
+  char* gtkver = PR_smprintf("GTK %u.%u.%u", gtk_major_version,
+                             gtk_minor_version, gtk_micro_version);
   if (gtkver) {
     rv = SetPropertyAsACString(NS_LITERAL_STRING("secondaryLibrary"),
                                nsDependentCString(gtkver));
     PR_smprintf_free(gtkver);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
   }
@@ -391,18 +394,18 @@ nsSystemInfo::SetUint64Property(const ns
 
 #if defined(XP_WIN)
 NS_IMETHODIMP
 nsSystemInfo::Observe(nsISupports* aSubject, const char* aTopic,
                       const char16_t* aData)
 {
   if (!strcmp(aTopic, "profile-do-change")) {
     nsresult rv;
-    nsCOMPtr<nsIObserverService> obsService = do_GetService(
-                                              NS_OBSERVERSERVICE_CONTRACTID, &rv);
+    nsCOMPtr<nsIObserverService> obsService =
+      do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv);
     if (NS_FAILED(rv)) {
       return rv;
     }
     rv = obsService->RemoveObserver(this, "profile-do-change");
     if (NS_FAILED(rv)) {
       return rv;
     }
     return GetProfileHDDInfo();
--- a/xpcom/base/nsTraceRefcnt.cpp
+++ b/xpcom/base/nsTraceRefcnt.cpp
@@ -420,17 +420,18 @@ public:
   }
 
   static bool HaveLeaks(nsTraceRefcntStats* aStats)
   {
     return ((aStats->mAddRefs != aStats->mReleases) ||
             (aStats->mCreates != aStats->mDestroys));
   }
 
-  bool PrintDumpHeader(FILE* aOut, const char* aMsg, nsTraceRefcnt::StatisticsType aType)
+  bool PrintDumpHeader(FILE* aOut, const char* aMsg,
+                       nsTraceRefcnt::StatisticsType aType)
   {
     fprintf(aOut, "\n== BloatView: %s, %s process %d\n", aMsg,
             XRE_ChildProcessTypeToString(XRE_GetProcessType()), getpid());
     nsTraceRefcntStats& stats =
       (aType == nsTraceRefcnt::NEW_STATS) ? mNewStats : mAllStats;
     if (gLogLeaksOnly && !HaveLeaks(&stats)) {
       return false;
     }
@@ -442,17 +443,18 @@ public:
 
     this->DumpTotal(aOut);
 
     return true;
   }
 
   void Dump(int aIndex, FILE* aOut, nsTraceRefcnt::StatisticsType aType)
   {
-    nsTraceRefcntStats* stats = (aType == nsTraceRefcnt::NEW_STATS) ? &mNewStats : &mAllStats;
+    nsTraceRefcntStats* stats =
+      (aType == nsTraceRefcnt::NEW_STATS) ? &mNewStats : &mAllStats;
     if (gLogLeaksOnly && !HaveLeaks(stats)) {
       return;
     }
 
     double meanRefs;
     double stddevRefs;
     NS_MeanAndStdDev(stats->mAddRefs + stats->mReleases,
                      stats->mRefsOutstandingTotal,
@@ -568,17 +570,17 @@ DumpSerialNumbers(PLHashEntry* aHashEntr
           record->serialNumber,
           NS_INT32_TO_PTR(aHashEntry->key),
           record->refCount);
 #endif
   return HT_ENUMERATE_NEXT;
 }
 
 
-template <>
+template<>
 class nsDefaultComparator<BloatEntry*, BloatEntry*>
 {
 public:
   bool Equals(BloatEntry* const& aEntry1, BloatEntry* const& aEntry2) const
   {
     return PL_strcmp(aEntry1->GetClassName(), aEntry2->GetClassName()) == 0;
   }
   bool LessThan(BloatEntry* const& aEntry1, BloatEntry* const& aEntry2) const
@@ -672,46 +674,53 @@ LogThisType(const char* aTypeName)
 {
   void* he = PL_HashTableLookup(gTypesToLog, aTypeName);
   return he != nullptr;
 }
 
 static intptr_t
 GetSerialNumber(void* aPtr, bool aCreate)
 {
-  PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
+  PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers,
+                                            PLHashNumber(NS_PTR_TO_INT32(aPtr)),
+                                            aPtr);
   if (hep && *hep) {
     return reinterpret_cast<serialNumberRecord*>((*hep)->value)->serialNumber;
   } else if (aCreate) {
     serialNumberRecord* record = PR_NEW(serialNumberRecord);
     record->serialNumber = ++gNextSerialNumber;
     record->refCount = 0;
     record->COMPtrCount = 0;
-    PL_HashTableRawAdd(gSerialNumbers, hep, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr, reinterpret_cast<void*>(record));
+    PL_HashTableRawAdd(gSerialNumbers, hep, PLHashNumber(NS_PTR_TO_INT32(aPtr)),
+                       aPtr, reinterpret_cast<void*>(record));
     return gNextSerialNumber;
   }
   return 0;
 }
 
 static int32_t*
 GetRefCount(void* aPtr)
 {
-  PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
+  PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers,
+                                            PLHashNumber(NS_PTR_TO_INT32(aPtr)),
+                                            aPtr);
   if (hep && *hep) {
     return &((reinterpret_cast<serialNumberRecord*>((*hep)->value))->refCount);
   } else {
     return nullptr;
   }
 }
 
 #if defined(NS_IMPL_REFCNT_LOGGING) && defined(HAVE_CPP_DYNAMIC_CAST_TO_VOID_PTR)
 static int32_t*
 GetCOMPtrCount(void* aPtr)
 {
-  PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers, PLHashNumber(NS_PTR_TO_INT32(aPtr)), aPtr);
+  PLHashEntry** hep = PL_HashTableRawLookup(gSerialNumbers,
+                                            PLHashNumber(NS_PTR_TO_INT32(aPtr)),
+                                            aPtr);
   if (hep && *hep) {
     return &((reinterpret_cast<serialNumberRecord*>((*hep)->value))->COMPtrCount);
   }
   return nullptr;
 }
 #endif
 
 static void
@@ -954,17 +963,17 @@ PrintStackFrame(void* aPC, void* aSP, vo
   NS_DescribeCodeAddress(aPC, &details);
   NS_FormatCodeAddressDetails(aPC, &details, buf, sizeof(buf));
   fputs(buf, stream);
 }
 
 static void
 PrintStackFrameCached(void* aPC, void* aSP, void* aClosure)
 {
-  CodeAddressServiceWriter *writer = static_cast<CodeAddressServiceWriter*>(aClosure);
+  auto writer = static_cast<CodeAddressServiceWriter*>(aClosure);
   gCodeAddressService->WriteLocation(*writer, aPC);
 }
 #endif
 
 }
 
 void
 nsTraceRefcnt::WalkTheStack(FILE* aStream)
@@ -978,18 +987,18 @@ nsTraceRefcnt::WalkTheStack(FILE* aStrea
 void
 nsTraceRefcnt::WalkTheStackCached(FILE* aStream)
 {
 #ifdef STACKWALKING_AVAILABLE
   if (!gCodeAddressService) {
     gCodeAddressService = new WalkTheStackCodeAddressService();
   }
   CodeAddressServiceWriter writer(aStream);
-  NS_StackWalk(PrintStackFrameCached, /* skipFrames */ 2, /* maxFrames */ 0, &writer,
-               0, nullptr);
+  NS_StackWalk(PrintStackFrameCached, /* skipFrames */ 2, /* maxFrames */ 0,
+               &writer, 0, nullptr);
 #endif
 }
 
 //----------------------------------------------------------------------
 
 // This thing is exported by libstdc++
 // Yes, this is a gcc only hack
 #if defined(MOZ_DEMANGLE_SYMBOLS)
@@ -1087,88 +1096,89 @@ LogTerm()
 #endif
   }
 }
 
 } // namespace mozilla
 
 EXPORT_XPCOM_API(void)
 NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt,
-             const char* aClazz, uint32_t aClassSize)
+             const char* aClass, uint32_t aClassSize)
 {
 #ifdef NS_IMPL_REFCNT_LOGGING
   ASSERT_ACTIVITY_IS_LEGAL;
   if (!gInitialized) {
     InitTraceLog();
   }
   if (gLogging) {
     LOCK_TRACELOG();
 
     if (gBloatLog) {
-      BloatEntry* entry = GetBloatEntry(aClazz, aClassSize);
+      BloatEntry* entry = GetBloatEntry(aClass, aClassSize);
       if (entry) {
         entry->AddRef(aRefcnt);
       }
     }
 
     // Here's the case where MOZ_COUNT_CTOR was not used,
     // yet we still want to see creation information:
 
-    bool loggingThisType = (!gTypesToLog || LogThisType(aClazz));
+    bool loggingThisType = (!gTypesToLog || LogThisType(aClass));
     intptr_t serialno = 0;
     if (gSerialNumbers && loggingThisType) {
       serialno = GetSerialNumber(aPtr, aRefcnt == 1);
       NS_ASSERTION(serialno != 0,
                    "Serial number requested for unrecognized pointer!  "
                    "Are you memmoving a refcounted object?");
       int32_t* count = GetRefCount(aPtr);
       if (count) {
         (*count)++;
       }
 
     }
 
     bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
     if (aRefcnt == 1 && gAllocLog && loggingThisType && loggingThisObject) {
       fprintf(gAllocLog, "\n<%s> 0x%08X %" PRIdPTR " Create\n",
-              aClazz, NS_PTR_TO_INT32(aPtr), serialno);
+              aClass, NS_PTR_TO_INT32(aPtr), serialno);
       nsTraceRefcnt::WalkTheStackCached(gAllocLog);
     }
 
     if (gRefcntsLog && loggingThisType && loggingThisObject) {
       // Can't use PR_LOG(), b/c it truncates the line
       fprintf(gRefcntsLog,
-              "\n<%s> 0x%08X %" PRIuPTR " AddRef %" PRIuPTR "\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
+              "\n<%s> 0x%08X %" PRIuPTR " AddRef %" PRIuPTR "\n",
+              aClass, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
       nsTraceRefcnt::WalkTheStackCached(gRefcntsLog);
       fflush(gRefcntsLog);
     }
     UNLOCK_TRACELOG();
   }
 #endif
 }
 
 EXPORT_XPCOM_API(void)
-NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClazz)
+NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClass)
 {
 #ifdef NS_IMPL_REFCNT_LOGGING
   ASSERT_ACTIVITY_IS_LEGAL;
   if (!gInitialized) {
     InitTraceLog();
   }
   if (gLogging) {
     LOCK_TRACELOG();
 
     if (gBloatLog) {
-      BloatEntry* entry = GetBloatEntry(aClazz, 0);
+      BloatEntry* entry = GetBloatEntry(aClass, 0);
       if (entry) {
         entry->Release(aRefcnt);
       }
     }
 
-    bool loggingThisType = (!gTypesToLog || LogThisType(aClazz));
+    bool loggingThisType = (!gTypesToLog || LogThisType(aClass));
     intptr_t serialno = 0;
     if (gSerialNumbers && loggingThisType) {
       serialno = GetSerialNumber(aPtr, false);
       NS_ASSERTION(serialno != 0,
                    "Serial number requested for unrecognized pointer!  "
                    "Are you memmoving a refcounted object?");
       int32_t* count = GetRefCount(aPtr);
       if (count) {
@@ -1176,28 +1186,29 @@ NS_LogRelease(void* aPtr, nsrefcnt aRefc
       }
 
     }
 
     bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno));
     if (gRefcntsLog && loggingThisType && loggingThisObject) {
       // Can't use PR_LOG(), b/c it truncates the line
       fprintf(gRefcntsLog,
-              "\n<%s> 0x%08X %" PRIuPTR " Release %" PRIuPTR "\n", aClazz, NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
+              "\n<%s> 0x%08X %" PRIuPTR " Release %" PRIuPTR "\n", aClass,
+              NS_PTR_TO_INT32(aPtr), serialno, aRefcnt);
       nsTraceRefcnt::WalkTheStackCached(gRefcntsLog);
       fflush(gRefcntsLog);
     }
 
     // Here's the case where MOZ_COUNT_DTOR was not used,
     // yet we still want to see deletion information:
 
     if (aRefcnt == 0 && gAllocLog && loggingThisType && loggingThisObject) {
       fprintf(gAllocLog,
               "\n<%s> 0x%08X %" PRIdPTR " Destroy\n",
-              aClazz, NS_PTR_TO_INT32(aPtr), serialno);
+              aClass, NS_PTR_TO_INT32(aPtr), serialno);
       nsTraceRefcnt::WalkTheStackCached(gAllocLog);
     }
 
     if (aRefcnt == 0 && gSerialNumbers && loggingThisType) {
       RecycleSerialNumberPtr(aPtr);
     }
 
     UNLOCK_TRACELOG();
--- a/xpcom/base/nsUUIDGenerator.cpp
+++ b/xpcom/base/nsUUIDGenerator.cpp
@@ -12,17 +12,17 @@
 #else
 #include <stdlib.h>
 #include "prrng.h"
 #endif
 
 #include "nsUUIDGenerator.h"
 
 #ifdef ANDROID
-extern "C" NS_EXPORT void arc4random_buf(void *, size_t);
+extern "C" NS_EXPORT void arc4random_buf(void*, size_t);
 #endif
 
 using namespace mozilla;
 
 NS_IMPL_ISUPPORTS(nsUUIDGenerator, nsIUUIDGenerator)
 
 nsUUIDGenerator::nsUUIDGenerator()
   : mLock("nsUUIDGenerator.mLock")
--- a/xpcom/base/nsVersionComparatorImpl.cpp
+++ b/xpcom/base/nsVersionComparatorImpl.cpp
@@ -6,16 +6,17 @@
 
 #include "nsVersionComparatorImpl.h"
 #include "nsVersionComparator.h"
 #include "nsString.h"
 
 NS_IMPL_ISUPPORTS(nsVersionComparatorImpl, nsIVersionComparator)
 
 NS_IMETHODIMP
-nsVersionComparatorImpl::Compare(const nsACString& aStr1, const nsACString& aStr2,
+nsVersionComparatorImpl::Compare(const nsACString& aStr1,
+                                 const nsACString& aStr2,
                                  int32_t* aResult)
 {
   *aResult = mozilla::CompareVersions(PromiseFlatCString(aStr1).get(),
                                       PromiseFlatCString(aStr2).get());
 
   return NS_OK;
 }
--- a/xpcom/build/nsXPComInit.cpp
+++ b/xpcom/build/nsXPComInit.cpp
@@ -442,18 +442,19 @@ private:
 
 NS_IMPL_ISUPPORTS(VPXReporter, nsIMemoryReporter)
 
 /* static */ template<> Atomic<size_t>
 CountingAllocatorBase<VPXReporter>::sAmount(0);
 #endif /* MOZ_VPX */
 
 #ifdef MOZ_WEBM
-class NesteggReporter MOZ_FINAL : public nsIMemoryReporter
-                                , public CountingAllocatorBase<NesteggReporter>
+class NesteggReporter MOZ_FINAL
+  : public nsIMemoryReporter
+  , public CountingAllocatorBase<NesteggReporter>
 {
 public:
   NS_DECL_ISUPPORTS
 
 private:
   NS_IMETHODIMP
   CollectReports(nsIHandleReportCallback* aHandleReport, nsISupports* aData,
                  bool aAnonymize)
@@ -812,17 +813,17 @@ ShutdownXPCOM(nsIServiceManager* aServMg
 
     nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
     if (NS_WARN_IF(!thread)) {
       return NS_ERROR_UNEXPECTED;
     }
 
     nsRefPtr<nsObserverService> observerService;
     CallGetService("@mozilla.org/observer-service;1",
-                   (nsObserverService**) getter_AddRefs(observerService));
+                   (nsObserverService**)getter_AddRefs(observerService));
 
     if (observerService) {
       observerService->NotifyObservers(nullptr,
                                        NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID,
                                        nullptr);
 
       nsCOMPtr<nsIServiceManager> mgr;
       rv = NS_GetServiceManager(getter_AddRefs(mgr));
--- a/xpcom/components/ManifestParser.cpp
+++ b/xpcom/components/ManifestParser.cpp
@@ -220,17 +220,17 @@ LogMessageWithContext(FileLocation& aFil
   aFile.GetURIString(file);
 
   nsCOMPtr<nsIScriptError> error =
     do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
   if (!error) {
     // This can happen early in component registration. Fall back to a
     // generic console message.
     LogMessage("Warning: in '%s', line %i: %s", file.get(),
-               aLineNumber, (char*) formatted);
+               aLineNumber, (char*)formatted);
     return;
   }
 
   nsCOMPtr<nsIConsoleService> console =
     do_GetService(NS_CONSOLESERVICE_CONTRACTID);
   if (!console) {
     return;
   }
--- a/xpcom/components/nsCategoryManager.cpp
+++ b/xpcom/components/nsCategoryManager.cpp
@@ -208,22 +208,17 @@ EntryEnumerator::Create(nsTHashtable<Cat
 
 //
 // CategoryNode implementations
 //
 
 CategoryNode*
 CategoryNode::Create(PLArenaPool* aArena)
 {
-  CategoryNode* node = new(aArena) CategoryNode();
-  if (!node) {
-    return nullptr;
-  }
-
-  return node;
+  return new (aArena) CategoryNode();
 }
 
 CategoryNode::~CategoryNode()
 {
 }
 
 void*
 CategoryNode::operator new(size_t aSize, PLArenaPool* aArena)
--- a/xpcom/glue/BlockingResourceBase.cpp
+++ b/xpcom/glue/BlockingResourceBase.cpp
@@ -30,18 +30,17 @@
 #endif // ifdef DEBUG
 
 namespace mozilla {
 //
 // BlockingResourceBase implementation
 //
 
 // static members
-const char* const BlockingResourceBase::kResourceTypeName[] =
-{
+const char* const BlockingResourceBase::kResourceTypeName[] = {
   // needs to be kept in sync with BlockingResourceType
   "Mutex", "ReentrantMonitor", "CondVar"
 };
 
 #ifdef DEBUG
 
 PRCallOnceType BlockingResourceBase::sCallOnce;
 unsigned BlockingResourceBase::sResourceAcqnChainFrontTPI = (unsigned)-1;
@@ -83,31 +82,35 @@ BlockingResourceBase::GetStackTrace(Acqu
  *
  * *NOT* thread safe.  Calls |Print()|.
  *
  * FIXME bug 456272 hack alert: because we can't write call
  * contexts into strings, all info is written to stderr, but only
  * some info is written into |aOut|
  */
 bool
-PrintCycle(const BlockingResourceBase::DDT::ResourceAcquisitionArray* aCycle, nsACString& aOut)
+PrintCycle(const BlockingResourceBase::DDT::ResourceAcquisitionArray* aCycle,
+           nsACString& aOut)
 {
   NS_ASSERTION(aCycle->Length() > 1, "need > 1 element for cycle!");
 
   bool maybeImminent = true;
 
   fputs("=== Cyclical dependency starts at\n", stderr);
   aOut += "Cyclical dependency starts at\n";
 
-  const BlockingResourceBase::DDT::ResourceAcquisitionArray::elem_type res = aCycle->ElementAt(0);
+  const BlockingResourceBase::DDT::ResourceAcquisitionArray::elem_type res =
+    aCycle->ElementAt(0);
   maybeImminent &= res->Print(aOut);
 
   BlockingResourceBase::DDT::ResourceAcquisitionArray::index_type i;
-  BlockingResourceBase::DDT::ResourceAcquisitionArray::size_type len = aCycle->Length();
-  const BlockingResourceBase::DDT::ResourceAcquisitionArray::elem_type* it = 1 + aCycle->Elements();
+  BlockingResourceBase::DDT::ResourceAcquisitionArray::size_type len =
+    aCycle->Length();
+  const BlockingResourceBase::DDT::ResourceAcquisitionArray::elem_type* it =
+    1 + aCycle->Elements();
   for (i = 1; i < len - 1; ++i, ++it) {
     fputs("\n--- Next dependency:\n", stderr);
     aOut += "\nNext dependency:\n";
 
     maybeImminent &= (*it)->Print(aOut);
   }
 
   fputs("\n=== Cycle completed at\n", stderr);
--- a/xpcom/glue/FileUtils.cpp
+++ b/xpcom/glue/FileUtils.cpp
@@ -137,18 +137,18 @@ mozilla::ReadSysFile(
   }
   ScopedClose autoClose(fd);
   if (aBufSize == 0) {
     return true;
   }
   ssize_t bytesRead;
   size_t offset = 0;
   do {
-    bytesRead = MOZ_TEMP_FAILURE_RETRY(
-      read(fd, aBuf + offset, aBufSize - offset));
+    bytesRead = MOZ_TEMP_FAILURE_RETRY(read(fd, aBuf + offset,
+                                            aBufSize - offset));
     if (bytesRead == -1) {
       return false;
     }
     offset += bytesRead;
   } while (bytesRead > 0 && offset < aBufSize);
   MOZ_ASSERT(offset <= aBufSize);
   if (offset > 0 && aBuf[offset - 1] == '\n') {
     offset--;
--- a/xpcom/glue/nsCOMPtr.cpp
+++ b/xpcom/glue/nsCOMPtr.cpp
@@ -11,34 +11,36 @@ nsQueryInterface::operator()(const nsIID
 {
   nsresult status;
   if (mRawPtr) {
     status = mRawPtr->QueryInterface(aIID, aAnswer);
 #ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
     NS_ASSERTION(NS_SUCCEEDED(status),
                  "interface not found---were you expecting that?");
 #endif
-  } else
+  } else {
     status = NS_ERROR_NULL_POINTER;
+  }
 
   return status;
 }
 
 nsresult
 nsQueryInterfaceWithError::operator()(const nsIID& aIID, void** aAnswer) const
 {
   nsresult status;
   if (mRawPtr) {
     status = mRawPtr->QueryInterface(aIID, aAnswer);
 #ifdef NSCAP_FEATURE_TEST_NONNULL_QUERY_SUCCEEDS
     NS_ASSERTION(NS_SUCCEEDED(status),
                  "interface not found---were you expecting that?");
 #endif
-  } else
+  } else {
     status = NS_ERROR_NULL_POINTER;
+  }
 
   if (mErrorPtr) {
     *mErrorPtr = status;
   }
   return status;
 }
 
 void
--- a/xpcom/glue/nsDeque.cpp
+++ b/xpcom/glue/nsDeque.cpp
@@ -64,17 +64,17 @@ nsDeque::~nsDeque()
 {
   MOZ_COUNT_DTOR(nsDeque);
 
 #ifdef DEBUG_rickg
   char buffer[30];
   printf("Capacity: %i\n", mCapacity);
 
   static int mCaps[15] = {0};
-  switch(mCapacity) {
+  switch (mCapacity) {
     case 4:     mCaps[0]++; break;
     case 8:     mCaps[1]++; break;
     case 16:    mCaps[2]++; break;
     case 32:    mCaps[3]++; break;
     case 64:    mCaps[4]++; break;
     case 128:   mCaps[5]++; break;
     case 256:   mCaps[6]++; break;
     case 512:   mCaps[7]++; break;
@@ -361,17 +361,18 @@ nsDeque::RemoveObjectAt(int32_t aIndex)
   if (aIndex < 0 || aIndex >= mSize) {
     return 0;
   }
   void* result = mData[modulus(mOrigin + aIndex, mCapacity)];
 
   // "Shuffle down" all elements in the array by 1, overwritting the element
   // being removed.
   for (int32_t i = aIndex; i < mSize; ++i) {
-    mData[modulus(mOrigin + i, mCapacity)] = mData[modulus(mOrigin + i + 1, mCapacity)];
+    mData[modulus(mOrigin + i, mCapacity)] =
+      mData[modulus(mOrigin + i + 1, mCapacity)];
   }
   mSize--;
 
   return result;
 }
 
 /**
  * Create and return an iterator pointing to
--- a/xpcom/glue/nsEnumeratorUtils.cpp
+++ b/xpcom/glue/nsEnumeratorUtils.cpp
@@ -222,17 +222,17 @@ nsUnionEnumerator::HasMoreElements(bool*
 
   nsresult rv;
 
   if (mConsumed) {
     *aResult = false;
     return NS_OK;
   }
 
-  if (! mAtSecond) {
+  if (!mAtSecond) {
     rv = mFirstEnumerator->HasMoreElements(aResult);
     if (NS_FAILED(rv)) {
       return rv;
     }
 
     if (*aResult) {
       return NS_OK;
     }
@@ -261,32 +261,32 @@ nsUnionEnumerator::GetNext(nsISupports**
   if (!aResult) {
     return NS_ERROR_NULL_POINTER;
   }
 
   if (mConsumed) {
     return NS_ERROR_UNEXPECTED;
   }
 
-  if (! mAtSecond) {
+  if (!mAtSecond) {
     return mFirstEnumerator->GetNext(aResult);
   }
 
   return mSecondEnumerator->GetNext(aResult);
 }
 
 nsresult
 NS_NewUnionEnumerator(nsISimpleEnumerator** aResult,
                       nsISimpleEnumerator* aFirstEnumerator,
                       nsISimpleEnumerator* aSecondEnumerator)
 {
   *aResult = nullptr;
-  if (! aFirstEnumerator) {
+  if (!aFirstEnumerator) {
     *aResult = aSecondEnumerator;
-  } else if (! aSecondEnumerator) {
+  } else if (!aSecondEnumerator) {
     *aResult = aFirstEnumerator;
   } else {
     nsUnionEnumerator* enumer = new nsUnionEnumerator(aFirstEnumerator,
                                                       aSecondEnumerator);
     if (!enumer) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
     *aResult = enumer;
--- a/xpcom/glue/pldhash.cpp
+++ b/xpcom/glue/pldhash.cpp
@@ -253,18 +253,19 @@ PL_DHashTableInit(PLDHashTable* aTable, 
 
   capacity = 1u << log2;
   MOZ_ASSERT(capacity <= PL_DHASH_MAX_CAPACITY);
   aTable->hashShift = PL_DHASH_BITS - log2;
   aTable->entrySize = aEntrySize;
   aTable->entryCount = aTable->removedCount = 0;
   aTable->generation = 0;
   uint32_t nbytes;
-  if (!SizeOfEntryStore(capacity, aEntrySize, &nbytes))
-    return false;   // overflowed
+  if (!SizeOfEntryStore(capacity, aEntrySize, &nbytes)) {
+    return false;  // overflowed
+  }
 
   aTable->entryStore = (char*)aOps->allocTable(aTable, nbytes);
   if (!aTable->entryStore) {
     return false;
   }
   memset(aTable->entryStore, 0, nbytes);
   METER(memset(&aTable->stats, 0, sizeof(aTable->stats)));
 
--- a/xpcom/io/Base64.cpp
+++ b/xpcom/io/Base64.cpp
@@ -14,17 +14,17 @@
 namespace {
 
 // BEGIN base64 encode code copied and modified from NSPR
 const unsigned char* base =
   (unsigned char*)"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
                   "abcdefghijklmnopqrstuvwxyz"
                   "0123456789+/";
 
-template <typename T>
+template<typename T>
 static void
 Encode3to4(const unsigned char* aSrc, T* aDest)
 {
   uint32_t b32 = (uint32_t)0;
   int i, j = 18;
 
   for (i = 0; i < 3; ++i) {
     b32 <<= 8;
@@ -32,37 +32,37 @@ Encode3to4(const unsigned char* aSrc, T*
   }
 
   for (i = 0; i < 4; ++i) {
     aDest[i] = base[(uint32_t)((b32 >> j) & 0x3F)];
     j -= 6;
   }
 }
 
-template <typename T>
+template<typename T>
 static void
 Encode2to4(const unsigned char* aSrc, T* aDest)
 {
   aDest[0] = base[(uint32_t)((aSrc[0] >> 2) & 0x3F)];
   aDest[1] = base[(uint32_t)(((aSrc[0] & 0x03) << 4) | ((aSrc[1] >> 4) & 0x0F))];
   aDest[2] = base[(uint32_t)((aSrc[1] & 0x0F) << 2)];
   aDest[3] = (unsigned char)'=';
 }
 
-template <typename T>
+template<typename T>
 static void
 Encode1to4(const unsigned char* aSrc, T* aDest)
 {
   aDest[0] = base[(uint32_t)((aSrc[0] >> 2) & 0x3F)];
   aDest[1] = base[(uint32_t)((aSrc[0] & 0x03) << 4)];
   aDest[2] = (unsigned char)'=';
   aDest[3] = (unsigned char)'=';
 }
 
-template <typename T>
+template<typename T>
 static void
 Encode(const unsigned char* aSrc, uint32_t aSrcLen, T* aDest)
 {
   while (aSrcLen >= 3) {
     Encode3to4(aSrc, aDest);
     aSrc += 3;
     aDest += 4;
     aSrcLen -= 3;
@@ -79,25 +79,25 @@ Encode(const unsigned char* aSrc, uint32
       break;
     default:
       NS_NOTREACHED("coding error");
   }
 }
 
 // END base64 encode code copied and modified from NSPR.
 
-template <typename T>
+template<typename T>
 struct EncodeInputStream_State
 {
   unsigned char c[3];
   uint8_t charsOnStack;
   typename T::char_type* buffer;
 };
 
-template <typename T>
+template<typename T>
 NS_METHOD
 EncodeInputStream_Encoder(nsIInputStream* aStream,
                           void* aClosure,
                           const char* aFromSegment,
                           uint32_t aToOffset,
                           uint32_t aCount,
                           uint32_t* aWriteCount)
 {
@@ -147,17 +147,17 @@ EncodeInputStream_Encoder(nsIInputStream
     state->c[0] = src[0];
     state->c[1] = (countRemaining == 2) ? src[1] : '\0';
     state->charsOnStack = countRemaining;
   }
 
   return NS_OK;
 }
 
-template <typename T>
+template<typename T>
 nsresult
 EncodeInputStream(nsIInputStream* aInputStream,
                   T& aDest,
                   uint32_t aCount,
                   uint32_t aOffset)
 {
   nsresult rv;
   uint64_t count64 = aCount;
--- a/xpcom/io/nsAppFileLocationProvider.cpp
+++ b/xpcom/io/nsAppFileLocationProvider.cpp
@@ -148,33 +148,36 @@ nsAppFileLocationProvider::GetFile(const
   } else if (nsCRT::strcmp(aProp, NS_APP_PLUGINS_DIR) == 0) {
     rv = CloneMozBinDirectory(getter_AddRefs(localFile));
     if (NS_SUCCEEDED(rv)) {
       rv = localFile->AppendRelativeNativePath(PLUGINS_DIR_NAME);
     }
   }
 #ifdef MOZ_WIDGET_COCOA
   else if (nsCRT::strcmp(aProp, NS_MACOSX_USER_PLUGIN_DIR) == 0) {
-    if (::FSFindFolder(kUserDomain, kInternetPlugInFolderType, false, &fileRef) == noErr) {
+    if (::FSFindFolder(kUserDomain, kInternetPlugInFolderType, false,
+                       &fileRef) == noErr) {
       rv = NS_NewLocalFileWithFSRef(&fileRef, true, getter_AddRefs(macFile));
       if (NS_SUCCEEDED(rv)) {
         localFile = macFile;
       }
     }
   } else if (nsCRT::strcmp(aProp, NS_MACOSX_LOCAL_PLUGIN_DIR) == 0) {
-    if (::FSFindFolder(kLocalDomain, kInternetPlugInFolderType, false, &fileRef) == noErr) {
+    if (::FSFindFolder(kLocalDomain, kInternetPlugInFolderType, false,
+                       &fileRef) == noErr) {
       rv = NS_NewLocalFileWithFSRef(&fileRef, true, getter_AddRefs(macFile));
       if (NS_SUCCEEDED(rv)) {
         localFile = macFile;
       }
     }
   } else if (nsCRT::strcmp(aProp, NS_MACOSX_JAVA2_PLUGIN_DIR) == 0) {
     static const char* const java2PluginDirPath =
       "/System/Library/Java/Support/Deploy.bundle/Contents/Resources/";
-    rv = NS_NewNativeLocalFile(nsDependentCString(java2PluginDirPath), true, getter_AddRefs(localFile));
+    rv = NS_NewNativeLocalFile(nsDependentCString(java2PluginDirPath), true,
+                               getter_AddRefs(localFile));
   }
 #else
   else if (nsCRT::strcmp(aProp, NS_ENV_PLUGINS_DIR) == 0) {
     NS_ERROR("Don't use nsAppFileLocationProvider::GetFile(NS_ENV_PLUGINS_DIR, ...). "
              "Use nsAppFileLocationProvider::GetFiles(...).");
     const char* pathVar = PR_GetEnv("MOZ_PLUGIN_PATH");
     if (pathVar && *pathVar)
       rv = NS_NewNativeLocalFile(nsDependentCString(pathVar), true,
@@ -289,17 +292,18 @@ nsAppFileLocationProvider::GetProductDir
   }
 
   nsresult rv;
   bool exists;
   nsCOMPtr<nsIFile> localDir;
 
 #if defined(MOZ_WIDGET_COCOA)
   FSRef fsRef;
-  OSType folderType = aLocal ? (OSType) kCachedDataFolderType : (OSType) kDomainLibraryFolderType;
+  OSType folderType = aLocal ? (OSType)kCachedDataFolderType :
+                               (OSType)kDomainLibraryFolderType;
   OSErr err = ::FSFindFolder(kUserDomain, folderType, kCreateFolder, &fsRef);
   if (err) {
     return NS_ERROR_FAILURE;
   }
   NS_NewLocalFile(EmptyString(), true, getter_AddRefs(localDir));
   if (!localDir) {
     return NS_ERROR_FAILURE;
   }
@@ -315,17 +319,18 @@ nsAppFileLocationProvider::GetProductDir
     return rv;
   }
   const char* prop = aLocal ? NS_WIN_LOCAL_APPDATA_DIR : NS_WIN_APPDATA_DIR;
   rv = directoryService->Get(prop, NS_GET_IID(nsIFile), getter_AddRefs(localDir));
   if (NS_FAILED(rv)) {
     return rv;
   }
 #elif defined(XP_UNIX)
-  rv = NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), true, getter_AddRefs(localDir));
+  rv = NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), true,
+                             getter_AddRefs(localDir));
   if (NS_FAILED(rv)) {
     return rv;
   }
 #else
 #error dont_know_how_to_get_product_dir_on_your_platform
 #endif
 
   rv = localDir->AppendRelativeNativePath(DEFAULT_PRODUCT_DIR);
--- a/xpcom/io/nsBinaryStream.cpp
+++ b/xpcom/io/nsBinaryStream.cpp
@@ -821,17 +821,17 @@ NS_IMETHODIMP
 nsBinaryInputStream::ReadByteArray(uint32_t aLength, uint8_t** aResult)
 {
   return ReadBytes(aLength, reinterpret_cast<char**>(aResult));
 }
 
 NS_IMETHODIMP
 nsBinaryInputStream::ReadArrayBuffer(uint32_t aLength,
                                      JS::Handle<JS::Value> aBuffer,
-                                     JSContext* aCx, uint32_t *rLength)
+                                     JSContext* aCx, uint32_t* aReadLength)
 {
   if (!aBuffer.isObject()) {
     return NS_ERROR_FAILURE;
   }
   JS::RootedObject buffer(aCx, &aBuffer.toObject());
   if (!JS_IsArrayBufferObject(buffer)) {
     return NS_ERROR_FAILURE;
   }
@@ -845,17 +845,17 @@ nsBinaryInputStream::ReadArrayBuffer(uin
   if (!data) {
     return NS_ERROR_FAILURE;
   }
 
   uint32_t bufSize = std::min<uint32_t>(aLength, 4096);
   UniquePtr<char[]> buf = MakeUnique<char[]>(bufSize);
 
   uint32_t remaining = aLength;
-  *rLength = 0;
+  *aReadLength = 0;
   do {
     // Read data into temporary buffer.
     uint32_t bytesRead;
     uint32_t amount = std::min(remaining, bufSize);
     nsresult rv = Read(buf.get(), amount, &bytesRead);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
@@ -865,17 +865,17 @@ nsBinaryInputStream::ReadArrayBuffer(uin
       break;
     }
 
     // Copy data into actual buffer.
     if (bufferLength != JS_GetArrayBufferByteLength(buffer)) {
       return NS_ERROR_FAILURE;
     }
 
-    *rLength += bytesRead;
+    *aReadLength += bytesRead;
     PodCopy(data, buf.get(), bytesRead);
 
     remaining -= bytesRead;
     data += bytesRead;
   } while (remaining > 0);
 
   return NS_OK;
 }
--- a/xpcom/io/nsDirectoryService.cpp
+++ b/xpcom/io/nsDirectoryService.cpp
@@ -72,27 +72,29 @@ nsDirectoryService::GetCurrentProcessDir
                                   NS_GET_IID(nsIProperties),
                                   getter_AddRefs(dirService));  // needs to be around for life of product
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   if (dirService) {
     nsCOMPtr <nsIFile> aLocalFile;
-    dirService->Get(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(aLocalFile));
+    dirService->Get(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile),
+                    getter_AddRefs(aLocalFile));
     if (aLocalFile) {
       *aFile = aLocalFile;
       NS_ADDREF(*aFile);
       return NS_OK;
     }
   }
 
   nsLocalFile* localFile = new nsLocalFile;
-  if (localFile == nullptr)
+  if (!localFile) {
     return NS_ERROR_OUT_OF_MEMORY;
+  }
   NS_ADDREF(localFile);
 
 #ifdef XP_WIN
   wchar_t buf[MAX_PATH + 1];
   SetLastError(ERROR_SUCCESS);
   if (GetModuleFileNameW(0, buf, mozilla::ArrayLength(buf)) &&
       GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
     // chop off the executable name by finding the rightmost backslash
@@ -469,17 +471,18 @@ nsDirectoryService::RegisterCategoryProv
   }
 
   bool more;
   while (NS_SUCCEEDED(strings->HasMore(&more)) && more) {
     nsAutoCString entry;
     strings->GetNext(entry);
 
     nsXPIDLCString contractID;
-    catman->GetCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY, entry.get(), getter_Copies(contractID));
+    catman->GetCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY, entry.get(),
+                             getter_Copies(contractID));
 
     if (contractID) {
       nsCOMPtr<nsIDirectoryServiceProvider> provider = do_GetService(contractID.get());
       if (provider) {
         RegisterProvider(provider);
       }
     }
   }
--- a/xpcom/io/nsLinebreakConverter.cpp
+++ b/xpcom/io/nsLinebreakConverter.cpp
@@ -284,17 +284,18 @@ nsLinebreakConverter::ConvertLineBreaks(
   if (!aSrc) {
     return nullptr;
   }
 
   int32_t sourceLen = (aSrcLen == kIgnoreLen) ? strlen(aSrc) + 1 : aSrcLen;
 
   char* resultString;
   if (aSrcBreaks == eLinebreakAny) {
-    resultString = ConvertUnknownBreaks(aSrc, sourceLen, GetLinebreakString(aDestBreaks));
+    resultString = ConvertUnknownBreaks(aSrc, sourceLen,
+                                        GetLinebreakString(aDestBreaks));
   } else
     resultString = ConvertBreaks(aSrc, sourceLen,
                                  GetLinebreakString(aSrcBreaks),
                                  GetLinebreakString(aDestBreaks));
 
   if (aOutLen) {
     *aOutLen = sourceLen;
   }
@@ -371,17 +372,18 @@ nsLinebreakConverter::ConvertUnicharLine
   if (!aSrc) {
     return nullptr;
   }
 
   int32_t bufLen = (aSrcLen == kIgnoreLen) ? NS_strlen(aSrc) + 1 : aSrcLen;
 
   char16_t* resultString;
   if (aSrcBreaks == eLinebreakAny) {
-    resultString = ConvertUnknownBreaks(aSrc, bufLen, GetLinebreakString(aDestBreaks));
+    resultString = ConvertUnknownBreaks(aSrc, bufLen,
+                                        GetLinebreakString(aDestBreaks));
   } else
     resultString = ConvertBreaks(aSrc, bufLen, GetLinebreakString(aSrcBreaks),
                                  GetLinebreakString(aDestBreaks));
 
   if (aOutLen) {
     *aOutLen = bufLen;
   }
   return resultString;
--- a/xpcom/io/nsLocalFileCommon.cpp
+++ b/xpcom/io/nsLocalFileCommon.cpp
@@ -236,19 +236,21 @@ nsLocalFile::GetRelativeDescriptor(nsIFi
   fromPath.BeginWriting(fromPathPtr);
 
   thisNodeCnt = SplitPath(thisPathPtr, thisNodes, kMaxNodesInPath);
   fromNodeCnt = SplitPath(fromPathPtr, fromNodes, kMaxNodesInPath);
   if (thisNodeCnt < 0 || fromNodeCnt < 0) {
     return NS_ERROR_FAILURE;
   }
 
-  for (nodeIndex = 0; nodeIndex < thisNodeCnt && nodeIndex < fromNodeCnt; ++nodeIndex) {
+  for (nodeIndex = 0; nodeIndex < thisNodeCnt &&
+       nodeIndex < fromNodeCnt; ++nodeIndex) {
 #ifdef XP_WIN
-    if (_wcsicmp(char16ptr_t(thisNodes[nodeIndex]), char16ptr_t(fromNodes[nodeIndex]))) {
+    if (_wcsicmp(char16ptr_t(thisNodes[nodeIndex]),
+                 char16ptr_t(fromNodes[nodeIndex]))) {
       break;
     }
 #else
     if (nsCRT::strcmp(thisNodes[nodeIndex], fromNodes[nodeIndex])) {
       break;
     }
 #endif
   }
--- a/xpcom/io/nsLocalFileUnix.cpp
+++ b/xpcom/io/nsLocalFileUnix.cpp
@@ -124,17 +124,18 @@ nsDirEnumeratorUnix::nsDirEnumeratorUnix
 {
 }
 
 nsDirEnumeratorUnix::~nsDirEnumeratorUnix()
 {
   Close();
 }
 
-NS_IMPL_ISUPPORTS(nsDirEnumeratorUnix, nsISimpleEnumerator, nsIDirectoryEnumerator)
+NS_IMPL_ISUPPORTS(nsDirEnumeratorUnix, nsISimpleEnumerator,
+                  nsIDirectoryEnumerator)
 
 NS_IMETHODIMP
 nsDirEnumeratorUnix::Init(nsLocalFile* aParent,
                           bool aResolveSymlinks /*ignored*/)
 {
   nsAutoCString dirPath;
   if (NS_FAILED(aParent->GetNativePath(dirPath)) ||
       dirPath.IsEmpty()) {
@@ -389,17 +390,17 @@ nsLocalFile::CreateAllAncestors(uint32_t
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLocalFile::OpenNSPRFileDesc(int32_t aFlags, int32_t aMode,
                               PRFileDesc** aResult)
 {
   *aResult = PR_Open(mPath.get(), aFlags, aMode);
-  if (! *aResult) {
+  if (!*aResult) {
     return NS_ErrorAccordingToNSPR();
   }
 
   if (aFlags & DELETE_ON_CLOSE) {
     PR_Delete(mPath.get());
   }
 
 #if defined(HAVE_POSIX_FADVISE)
@@ -410,17 +411,17 @@ nsLocalFile::OpenNSPRFileDesc(int32_t aF
 #endif
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLocalFile::OpenANSIFileDesc(const char* aMode, FILE** aResult)
 {
   *aResult = fopen(mPath.get(), aMode);
-  if (! *aResult) {
+  if (!*aResult) {
     return NS_ERROR_FAILURE;
   }
 
   return NS_OK;
 }
 
 static int
 do_create(const char* aPath, int aFlags, mode_t aMode, PRFileDesc** aResult)
@@ -1402,17 +1403,18 @@ nsLocalFile::GetDiskSpaceAvailable(int64
   if (!quotactl(QCMD(Q_GETQUOTA, USRQUOTA), deviceName.get(),
                 getuid(), (caddr_t)&dq)
 #ifdef QIF_BLIMITS
       && dq.dqb_valid & QIF_BLIMITS
 #endif
       && dq.dqb_bhardlimit) {
     int64_t QuotaSpaceAvailable = 0;
     if (dq.dqb_bhardlimit > dq.dqb_curspace) {
-      QuotaSpaceAvailable = int64_t(fs_buf.F_BSIZE * (dq.dqb_bhardlimit - dq.dqb_curspace));
+      QuotaSpaceAvailable =
+        int64_t(fs_buf.F_BSIZE * (dq.dqb_bhardlimit - dq.dqb_curspace));
     }
     if (QuotaSpaceAvailable < *aDiskSpaceAvailable) {
       *aDiskSpaceAvailable = QuotaSpaceAvailable;
     }
   }
 #endif
 
   return NS_OK;
@@ -1944,17 +1946,18 @@ nsLocalFile::SetPersistentDescriptor(con
   }
   PR_Free(decodedData);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   Boolean changed;
   FSRef resolvedFSRef;
-  OSErr err = ::FSResolveAlias(nullptr, (AliasHandle)newHandle, &resolvedFSRef, &changed);
+  OSErr err = ::FSResolveAlias(nullptr, (AliasHandle)newHandle, &resolvedFSRef,
+                               &changed);
 
   rv = MacErrorMapper(err);
   DisposeHandle(newHandle);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   return InitWithFSRef(&resolvedFSRef);
@@ -1963,17 +1966,18 @@ nsLocalFile::SetPersistentDescriptor(con
 #endif
 }
 
 NS_IMETHODIMP
 nsLocalFile::Reveal()
 {
 #ifdef MOZ_WIDGET_GTK
   nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
-  nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
+  nsCOMPtr<nsIGnomeVFSService> gnomevfs =
+    do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
   if (!giovfs && !gnomevfs) {
     return NS_ERROR_FAILURE;
   }
 
   bool isDirectory;
   if (NS_FAILED(IsDirectory(&isDirectory))) {
     return NS_ERROR_FAILURE;
   }
@@ -1981,17 +1985,18 @@ nsLocalFile::Reveal()
   if (isDirectory) {
     if (giovfs) {
       return giovfs->ShowURIForInput(mPath);
     } else
       /* Fallback to GnomeVFS */
     {
       return gnomevfs->ShowURIForInput(mPath);
     }
-  } else if (giovfs && NS_SUCCEEDED(giovfs->OrgFreedesktopFileManager1ShowItems(mPath))) {
+  } else if (giovfs &&
+             NS_SUCCEEDED(giovfs->OrgFreedesktopFileManager1ShowItems(mPath))) {
     return NS_OK;
   } else {
     nsCOMPtr<nsIFile> parentDir;
     nsAutoCString dirPath;
     if (NS_FAILED(GetParent(getter_AddRefs(parentDir)))) {
       return NS_ERROR_FAILURE;
     }
     if (NS_FAILED(parentDir->GetNativePath(dirPath))) {
@@ -2017,17 +2022,18 @@ nsLocalFile::Reveal()
 #endif
 }
 
 NS_IMETHODIMP
 nsLocalFile::Launch()
 {
 #ifdef MOZ_WIDGET_GTK
   nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
-  nsCOMPtr<nsIGnomeVFSService> gnomevfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
+  nsCOMPtr<nsIGnomeVFSService> gnomevfs =
+    do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
   if (giovfs) {
     return giovfs->ShowURIForInput(mPath);
   } else if (gnomevfs) {
     /* GnomeVFS fallback */
     return gnomevfs->ShowURIForInput(mPath);
   }
 
   return NS_ERROR_FAILURE;
@@ -2398,17 +2404,18 @@ nsLocalFile::GetFSSpec(FSSpec* aResult)
 {
   if (NS_WARN_IF(!aResult)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   FSRef fsRef;
   nsresult rv = GetFSRef(&fsRef);
   if (NS_SUCCEEDED(rv)) {
-    OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoNone, nullptr, nullptr, aResult, nullptr);
+    OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoNone, nullptr, nullptr,
+                                   aResult, nullptr);
     return MacErrorMapper(err);
   }
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsLocalFile::GetFileSizeWithResFork(int64_t* aFileSizeWithResFork)
@@ -2425,17 +2432,18 @@ nsLocalFile::GetFileSizeWithResFork(int6
 
   FSCatalogInfo catalogInfo;
   OSErr err = ::FSGetCatalogInfo(&fsRef, kFSCatInfoDataSizes + kFSCatInfoRsrcSizes,
                                  &catalogInfo, nullptr, nullptr, nullptr);
   if (err != noErr) {
     return MacErrorMapper(err);
   }
 
-  *aFileSizeWithResFork = catalogInfo.dataLogicalSize + catalogInfo.rsrcLogicalSize;
+  *aFileSizeWithResFork =
+    catalogInfo.dataLogicalSize + catalogInfo.rsrcLogicalSize;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLocalFile::GetFileType(OSType* aFileType)
 {
   CFURLRef url;
   if (NS_SUCCEEDED(GetCFURL(&url))) {
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -404,20 +404,20 @@ ShortcutResolver::SetShortcut(bool aUpda
     }
   } else {
     if (!aTargetPath) {
       return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST;
     }
 
     // Since we reuse our IPersistFile, we have to clear out any values that
     // may be left over from previous calls to SetShortcut.
-    if (FAILED(mShellLink->SetWorkingDirectory(L""))
-        || FAILED(mShellLink->SetArguments(L""))
-        || FAILED(mShellLink->SetDescription(L""))
-        || FAILED(mShellLink->SetIconLocation(L"", 0))) {
+    if (FAILED(mShellLink->SetWorkingDirectory(L"")) ||
+        FAILED(mShellLink->SetArguments(L"")) ||
+        FAILED(mShellLink->SetDescription(L"")) ||
+        FAILED(mShellLink->SetIconLocation(L"", 0))) {
       return NS_ERROR_FAILURE;
     }
   }
 
   if (aTargetPath && FAILED(mShellLink->SetPath(aTargetPath))) {
     return NS_ERROR_FAILURE;
   }
 
@@ -564,17 +564,18 @@ IsShortcutPath(const nsAString& aPath)
 // |PR_ImportFile|, we define it here. Currently, |_PR_HAVE_PEEK_BUFFER|
 // and |PR_STRICT_ADDR_LEN| are not defined for the 'w95'-dependent portion
 // of NSPR so that fields of |PRFilePrivate| #ifdef'd by them are not copied.
 // Similarly, |_MDFileDesc| is taken from nsprpub/pr/include/md/_win95.h.
 // In an unlikely case we switch to 'NT'-dependent NSPR AND this temporary
 // workaround last beyond the switch, |PRFilePrivate| and |_MDFileDesc|
 // need to be changed to match the definitions for WinNT.
 //-----------------------------------------------------------------------------
-typedef enum {
+typedef enum
+{
   _PR_TRI_TRUE = 1,
   _PR_TRI_FALSE = 0,
   _PR_TRI_UNKNOWN = -1
 } _PRTriStateBool;
 
 struct _MDFileDesc
 {
   PROsfd osfd;
@@ -1001,18 +1002,19 @@ nsLocalFile::nsLocalFileConstructor(nsIS
   if (NS_WARN_IF(!aInstancePtr)) {
     return NS_ERROR_INVALID_ARG;
   }
   if (NS_WARN_IF(aOuter)) {
     return NS_ERROR_NO_AGGREGATION;
   }
 
   nsLocalFile* inst = new nsLocalFile();
-  if (inst == nullptr)
+  if (!inst) {
     return NS_ERROR_OUT_OF_MEMORY;
+  }
 
   nsresult rv = inst->QueryInterface(aIID, aInstancePtr);
   if (NS_FAILED(rv)) {
     delete inst;
     return rv;
   }
   return NS_OK;
 }
@@ -1412,19 +1414,19 @@ nsresult
 nsLocalFile::AppendInternal(const nsAFlatString& aNode,
                             bool aMultipleComponents)
 {
   if (aNode.IsEmpty()) {
     return NS_OK;
   }
 
   // check the relative path for validity
-  if (aNode.First() == L'\\'                  // can't start with an '\'
-      || aNode.FindChar(L'/') != kNotFound    // can't contain /
-      || aNode.EqualsASCII("..")) {           // can't be ..
+  if (aNode.First() == L'\\' ||               // can't start with an '\'
+      aNode.FindChar(L'/') != kNotFound ||    // can't contain /
+      aNode.EqualsASCII("..")) {              // can't be ..
     return NS_ERROR_FILE_UNRECOGNIZED_PATH;
   }
 
   if (aMultipleComponents) {
     // can't contain .. as a path component. Ensure that the valid components
     // "foo..foo", "..foo", and "foo.." are not falsely detected,
     // but the invalid paths "..\", "foo\..", "foo\..\foo",
     // "..\foo", etc are.
@@ -1691,18 +1693,18 @@ nsLocalFile::GetVersionInfoField(const c
 {
   nsresult rv = ResolveAndStat();
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   rv = NS_ERROR_FAILURE;
 
-  const WCHAR* path = mFollowSymlinks ? mResolvedPath.get()
-                                      : mWorkingPath.get();
+  const WCHAR* path =
+    mFollowSymlinks ? mResolvedPath.get() : mWorkingPath.get();
 
   DWORD dummy;
   DWORD size = ::GetFileVersionInfoSizeW(path, &dummy);
   if (!size) {
     return rv;
   }
 
   void* ver = calloc(size, 1);
@@ -1715,18 +1717,17 @@ nsLocalFile::GetVersionInfoField(const c
     UINT pageCount;
     BOOL queryResult = ::VerQueryValueW(ver, L"\\VarFileInfo\\Translation",
                                         (void**)&translate, &pageCount);
     if (queryResult && translate) {
       for (int32_t i = 0; i < 2; ++i) {
         wchar_t subBlock[MAX_PATH];
         _snwprintf(subBlock, MAX_PATH,
                    L"\\StringFileInfo\\%04x%04x\\%s",
-                   (i == 0 ? translate[0].wLanguage
-                           : ::GetUserDefaultLangID()),
+                   (i == 0 ? translate[0].wLanguage : ::GetUserDefaultLangID()),
                    translate[0].wCodePage,
                    NS_ConvertASCIItoUTF16(
                      nsDependentCString(aField)).get());
         subBlock[MAX_PATH - 1] = 0;
         LPVOID value = nullptr;
         UINT size;
         queryResult = ::VerQueryValueW(ver, subBlock, &value, &size);
         if (queryResult && value) {
@@ -1990,18 +1991,19 @@ nsLocalFile::CopyMove(nsIFile* aParentDi
       if (followSymlinks) {
         bool isLink;
         newParentDir->IsSymlink(&isLink);
         if (isLink) {
           nsAutoString target;
           newParentDir->GetTarget(target);
 
           nsCOMPtr<nsIFile> realDest = new nsLocalFile();
-          if (realDest == nullptr)
+          if (!realDest) {
             return NS_ERROR_OUT_OF_MEMORY;
+          }
 
           rv = realDest->InitWithPath(target);
 
           if (NS_FAILED(rv)) {
             return rv;
           }
 
           return CopyMove(realDest, aNewName, aOptions);
@@ -2263,17 +2265,17 @@ nsLocalFile::Load(PRLibrary** aResult)
 
   bool isFile;
   nsresult rv = IsFile(&isFile);
 
   if (NS_FAILED(rv)) {
     return rv;
   }
 
-  if (! isFile) {
+  if (!isFile) {
     return NS_ERROR_FILE_IS_DIRECTORY;
   }
 
 #ifdef NS_BUILD_REFCNT_LOGGING
   nsTraceRefcnt::SetActivityIsLegal(false);
 #endif
 
   PRLibSpec libSpec;
@@ -2750,17 +2752,18 @@ nsLocalFile::GetParent(nsIFile** aParent
 
   if (offset > 0) {
     parentPath.Truncate(offset);
   } else {
     parentPath.AssignLiteral("\\\\.");
   }
 
   nsCOMPtr<nsIFile> localFile;
-  nsresult rv = NS_NewLocalFile(parentPath, mFollowSymlinks, getter_AddRefs(localFile));
+  nsresult rv = NS_NewLocalFile(parentPath, mFollowSymlinks,
+                                getter_AddRefs(localFile));
 
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   localFile.forget(aParent);
   return NS_OK;
 }
@@ -3335,18 +3338,19 @@ nsLocalFile::Launch()
   mythread->Dispatch(runnable, NS_DISPATCH_NORMAL);
   return NS_OK;
 }
 
 nsresult
 NS_NewLocalFile(const nsAString& aPath, bool aFollowLinks, nsIFile** aResult)
 {
   nsLocalFile* file = new nsLocalFile();
-  if (file == nullptr)
+  if (!file) {
     return NS_ERROR_OUT_OF_MEMORY;
+  }
   NS_ADDREF(file);
 
   file->SetFollowLinks(aFollowLinks);
 
   if (!aPath.IsEmpty()) {
     nsresult rv = file->InitWithPath(aPath);
     if (NS_FAILED(rv)) {
       NS_RELEASE(file);
--- a/xpcom/io/nsMultiplexInputStream.cpp
+++ b/xpcom/io/nsMultiplexInputStream.cpp
@@ -145,25 +145,27 @@ SeekableStreamAtBeginning(nsIInputStream
   return true;
 }
 #endif
 
 /* void appendStream (in nsIInputStream stream); */
 NS_IMETHODIMP
 nsMultiplexInputStream::AppendStream(nsIInputStream* aStream)
 {
-  NS_ASSERTION(SeekableStreamAtBeginning(aStream), "Appended stream not at beginning.");
+  NS_ASSERTION(SeekableStreamAtBeginning(aStream),
+               "Appended stream not at beginning.");
   return mStreams.AppendElement(aStream) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
 }
 
 /* void insertStream (in nsIInputStream stream, in unsigned long index); */
 NS_IMETHODIMP
 nsMultiplexInputStream::InsertStream(nsIInputStream* aStream, uint32_t aIndex)
 {
-  NS_ASSERTION(SeekableStreamAtBeginning(aStream), "Inserted stream not at beginning.");
+  NS_ASSERTION(SeekableStreamAtBeginning(aStream),
+               "Inserted stream not at beginning.");
   mStreams.InsertElementAt(aIndex, aStream);
   if (mCurrentStream > aIndex ||
       (mCurrentStream == aIndex && mStartedReadingCurrent)) {
     ++mCurrentStream;
   }
   return NS_OK;
 }
 
--- a/xpcom/io/nsScriptableInputStream.cpp
+++ b/xpcom/io/nsScriptableInputStream.cpp
@@ -51,17 +51,18 @@ nsScriptableInputStream::Read(uint32_t a
   }
 
   rv = mInputStream->Available(&count64);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   // bug716556 - Ensure count+1 doesn't overflow
-  uint32_t count = XPCOM_MIN((uint32_t)XPCOM_MIN<uint64_t>(count64, aCount), UINT32_MAX - 1);
+  uint32_t count =
+    XPCOM_MIN((uint32_t)XPCOM_MIN<uint64_t>(count64, aCount), UINT32_MAX - 1);
   buffer = (char*)moz_malloc(count + 1);  // make room for '\0'
   if (!buffer) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   rv = ReadHelper(buffer, count);
   if (NS_FAILED(rv)) {
     nsMemory::Free(buffer);
--- a/xpcom/io/nsStorageStream.cpp
+++ b/xpcom/io/nsStorageStream.cpp
@@ -474,17 +474,17 @@ nsStorageInputStream::ReadSegments(nsWri
       mReadCursor = 0;
       mSegmentEnd = XPCOM_MIN(mSegmentSize, available);
       availableInSegment = mSegmentEnd;
     }
     const char* cur = mStorageStream->mSegmentedBuffer->GetSegment(mSegmentNum);
 
     count = XPCOM_MIN(availableInSegment, remainingCapacity);
     rv = aWriter(this, aClosure, cur + mReadCursor, aCount - remainingCapacity,
-                count, &bytesConsumed);
+                 count, &bytesConsumed);
     if (NS_FAILED(rv) || (bytesConsumed == 0)) {
       break;
     }
     remainingCapacity -= bytesConsumed;
     mReadCursor += bytesConsumed;
     mLogicalCursor += bytesConsumed;
   };
 
@@ -604,17 +604,18 @@ nsStorageInputStream::Serialize(InputStr
   MOZ_ASSERT(NS_SUCCEEDED(rv));
 
   StringInputStreamParams params;
   params.data() = combined;
   aParams = params;
 }
 
 bool
-nsStorageInputStream::Deserialize(const InputStreamParams& aParams, const FileDescriptorArray&)
+nsStorageInputStream::Deserialize(const InputStreamParams& aParams,
+                                  const FileDescriptorArray&)
 {
   NS_NOTREACHED("We should never attempt to deserialize a storage input stream.");
   return false;
 }
 
 nsresult
 NS_NewStorageStream(uint32_t aSegmentSize, uint32_t aMaxSize,
                     nsIStorageStream** aResult)
--- a/xpcom/io/nsStreamUtils.cpp
+++ b/xpcom/io/nsStreamUtils.cpp
@@ -611,39 +611,39 @@ NS_AsyncCopy(nsIInputStream*         aSo
   }
 
   // Start() takes an owning ref to the copier...
   NS_ADDREF(copier);
   rv = copier->Start(aSource, aSink, aTarget, aCallback, aClosure, aChunkSize,
                      aCloseSource, aCloseSink, aProgressCallback);
 
   if (aCopierCtx) {
-    *aCopierCtx = static_cast<nsISupports*>(
-      static_cast<nsIRunnable*>(copier));
+    *aCopierCtx = static_cast<nsISupports*>(static_cast<nsIRunnable*>(copier));
     NS_ADDREF(*aCopierCtx);
   }
   NS_RELEASE(copier);
 
   return rv;
 }
 
 //-----------------------------------------------------------------------------
 
 nsresult
 NS_CancelAsyncCopy(nsISupports* aCopierCtx, nsresult aReason)
 {
-  nsAStreamCopier* copier = static_cast<nsAStreamCopier*>(
-    static_cast<nsIRunnable *>(aCopierCtx));
+  nsAStreamCopier* copier =
+    static_cast<nsAStreamCopier*>(static_cast<nsIRunnable *>(aCopierCtx));
   return copier->Cancel(aReason);
 }
 
 //-----------------------------------------------------------------------------
 
 nsresult
-NS_ConsumeStream(nsIInputStream* aStream, uint32_t aMaxCount, nsACString& aResult)
+NS_ConsumeStream(nsIInputStream* aStream, uint32_t aMaxCount,
+                 nsACString& aResult)
 {
   nsresult rv = NS_OK;
   aResult.Truncate();
 
   while (aMaxCount) {
     uint64_t avail64;
     rv = aStream->Available(&avail64);
     if (NS_FAILED(rv)) {
@@ -707,18 +707,17 @@ NS_InputStreamIsBuffered(nsIInputStream*
 {
   nsCOMPtr<nsIBufferedInputStream> bufferedIn = do_QueryInterface(aStream);
   if (bufferedIn) {
     return true;
   }
 
   bool result = false;
   uint32_t n;
-  nsresult rv = aStream->ReadSegments(TestInputStream,
-                                     &result, 1, &n);
+  nsresult rv = aStream->ReadSegments(TestInputStream, &result, 1, &n);
   return result || NS_SUCCEEDED(rv);
 }
 
 static NS_METHOD
 TestOutputStream(nsIOutputStream* aOutStr,
                  void* aClosure,
                  char* aBuffer,
                  uint32_t aOffset,
--- a/xpcom/io/nsStringStream.cpp
+++ b/xpcom/io/nsStringStream.cpp
@@ -226,17 +226,18 @@ nsStringInputStream::ReadSegments(nsWrit
   if (maxCount == 0) {
     *aResult = 0;
     return NS_OK;
   }
 
   if (aCount > maxCount) {
     aCount = maxCount;
   }
-  nsresult rv = aWriter(this, aClosure, mData.BeginReading() + mOffset, 0, aCount, aResult);
+  nsresult rv = aWriter(this, aClosure, mData.BeginReading() + mOffset, 0,
+                        aCount, aResult);
   if (NS_SUCCEEDED(rv)) {
     NS_ASSERTION(*aResult <= aCount,
                  "writer should not write more than we asked it to write");
     mOffset += *aResult;
   }
 
   // errors returned from the writer end here!
   return NS_OK;
@@ -339,17 +340,17 @@ nsStringInputStream::Deserialize(const I
 nsresult
 NS_NewByteInputStream(nsIInputStream** aStreamResult,
                       const char* aStringToRead, int32_t aLength,
                       nsAssignmentType aAssignment)
 {
   NS_PRECONDITION(aStreamResult, "null out ptr");
 
   nsStringInputStream* stream = new nsStringInputStream();
-  if (! stream) {
+  if (!stream) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   NS_ADDREF(stream);
 
   nsresult rv;
   switch (aAssignment) {
     case NS_ASSIGNMENT_COPY:
@@ -385,31 +386,32 @@ NS_NewStringInputStream(nsIInputStream**
 
 nsresult
 NS_NewCStringInputStream(nsIInputStream** aStreamResult,
                          const nsACString& aStringToRead)
 {
   NS_PRECONDITION(aStreamResult, "null out ptr");
 
   nsStringInputStream* stream = new nsStringInputStream();
-  if (! stream) {
+  if (!stream) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   NS_ADDREF(stream);
 
   stream->SetData(aStringToRead);
 
   *aStreamResult = stream;
   return NS_OK;
 }
 
 // factory method for constructing a nsStringInputStream object
 nsresult
-nsStringInputStreamConstructor(nsISupports* aOuter, REFNSIID aIID, void** aResult)
+nsStringInputStreamConstructor(nsISupports* aOuter, REFNSIID aIID,
+                               void** aResult)
 {
   *aResult = nullptr;
 
   if (NS_WARN_IF(aOuter)) {
     return NS_ERROR_NO_AGGREGATION;
   }
 
   nsStringInputStream* inst = new nsStringInputStream();
--- a/xpcom/io/nsUnicharInputStream.cpp
+++ b/xpcom/io/nsUnicharInputStream.cpp
@@ -417,18 +417,19 @@ nsSimpleUnicharStreamFactory::CreateInst
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   NS_ADDREF(*aResult = it);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSimpleUnicharStreamFactory::CreateInstanceFromUTF8Stream(nsIInputStream* aStreamToWrap,
-                                                           nsIUnicharInputStream** aResult)
+nsSimpleUnicharStreamFactory::CreateInstanceFromUTF8Stream(
+    nsIInputStream* aStreamToWrap,
+    nsIUnicharInputStream** aResult)
 {
   *aResult = nullptr;
 
   // Create converter input stream
   nsRefPtr<UTF8InputStream> it = new UTF8InputStream();
   if (!it) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
--- a/xpcom/string/nsReadableUtils.cpp
+++ b/xpcom/string/nsReadableUtils.cpp
@@ -82,47 +82,50 @@ LossyAppendUTF16toASCII(const nsAString&
   nsACString::iterator dest;
   aDest.BeginWriting(dest);
 
   dest.advance(old_dest_length);
 
   // right now, this won't work on multi-fragment destinations
   LossyConvertEncoding16to8 converter(dest.get());
 
-  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
+  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
+              converter);
 }
 
 void
 AppendASCIItoUTF16(const nsACString& aSource, nsAString& aDest)
 {
   if (!AppendASCIItoUTF16(aSource, aDest, mozilla::fallible_t())) {
     NS_ABORT_OOM(aDest.Length() + aSource.Length());
   }
 }
 
 bool
 AppendASCIItoUTF16(const nsACString& aSource, nsAString& aDest,
                    const mozilla::fallible_t&)
 {
   uint32_t old_dest_length = aDest.Length();
-  if (!aDest.SetLength(old_dest_length + aSource.Length(), mozilla::fallible_t())) {
+  if (!aDest.SetLength(old_dest_length + aSource.Length(),
+                       mozilla::fallible_t())) {
     return false;
   }
 
   nsACString::const_iterator fromBegin, fromEnd;
 
   nsAString::iterator dest;
   aDest.BeginWriting(dest);
 
   dest.advance(old_dest_length);
 
   // right now, this won't work on multi-fragment destinations
   LossyConvertEncoding8to16 converter(dest.get());
 
-  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
+  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
+              converter);
   return true;
 }
 
 void
 LossyAppendUTF16toASCII(const char16_t* aSource, nsACString& aDest)
 {
   if (aSource) {
     LossyAppendUTF16toASCII(nsDependentString(aSource), aDest);
@@ -249,17 +252,18 @@ AppendUTF8toUTF16(const char* aSource, n
  * @return a new buffer (of the type specified by the second parameter) which you must free with |nsMemory::Free|.
  *
  */
 template <class FromStringT, class ToCharT>
 inline
 ToCharT*
 AllocateStringCopy(const FromStringT& aSource, ToCharT*)
 {
-  return static_cast<ToCharT*>(nsMemory::Alloc((aSource.Length() + 1) * sizeof(ToCharT)));
+  return static_cast<ToCharT*>(nsMemory::Alloc(
+    (aSource.Length() + 1) * sizeof(ToCharT)));
 }
 
 
 char*
 ToNewCString(const nsAString& aSource)
 {
   char* result = AllocateStringCopy(aSource, (char*)0);
   if (!result) {
@@ -306,33 +310,35 @@ ToNewCString(const nsACString& aSource)
 
   char* result = AllocateStringCopy(aSource, (char*)0);
   if (!result) {
     return nullptr;
   }
 
   nsACString::const_iterator fromBegin, fromEnd;
   char* toBegin = result;
-  *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), toBegin) = char(0);
+  *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
+               toBegin) = char(0);
   return result;
 }
 
 char16_t*
 ToNewUnicode(const nsAString& aSource)
 {
   // no conversion needed, just allocate a buffer of the correct length and copy into it
 
   char16_t* result = AllocateStringCopy(aSource, (char16_t*)0);
   if (!result) {
     return nullptr;
   }
 
   nsAString::const_iterator fromBegin, fromEnd;
   char16_t* toBegin = result;
-  *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), toBegin) = char16_t(0);
+  *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
+               toBegin) = char16_t(0);
   return result;
 }
 
 char16_t*
 ToNewUnicode(const nsACString& aSource)
 {
   char16_t* result = AllocateStringCopy(aSource, (char16_t*)0);
   if (!result) {
@@ -638,17 +644,18 @@ protected:
 void
 ToUpperCase(const nsACString& aSource, nsACString& aDest)
 {
   nsACString::const_iterator fromBegin, fromEnd;
   nsACString::iterator toBegin;
   aDest.SetLength(aSource.Length());
 
   CopyToUpperCase converter(aDest.BeginWriting(toBegin));
-  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
+  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
+              converter);
 }
 
 /**
  * A character sink for case conversion.
  */
 class ConvertToLowerCase
 {
 public:
@@ -718,17 +725,18 @@ protected:
 void
 ToLowerCase(const nsACString& aSource, nsACString& aDest)
 {
   nsACString::const_iterator fromBegin, fromEnd;
   nsACString::iterator toBegin;
   aDest.SetLength(aSource.Length());
 
   CopyToLowerCase converter(aDest.BeginWriting(toBegin));
-  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
+  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd),
+              converter);
 }
 
 bool
 ParseString(const nsACString& aSource, char aDelimiter,
             nsTArray<nsCString>& aArray)
 {
   nsACString::const_iterator start, end;
   aSource.BeginReading(start);
--- a/xpcom/string/nsTString.cpp
+++ b/xpcom/string/nsTString.cpp
@@ -18,17 +18,17 @@ nsTAdoptingString_CharT::operator=(const
     // non-null.  Should we be able to assert that str is not void here?
     NS_ASSERTION(str.mData, "String with null mData?");
     Finalize();
     mData = str.mData;
     mLength = str.mLength;
     SetDataFlags(F_TERMINATED | F_OWNED);
 
     // Make str forget the buffer we just took ownership of.
-    new(mutable_str) self_type();
+    new (mutable_str) self_type();
   } else {
     Assign(str);
 
     mutable_str->Truncate();
   }
 
   return *this;
 }
--- a/xpcom/string/nsTSubstringTuple.cpp
+++ b/xpcom/string/nsTSubstringTuple.cpp
@@ -71,22 +71,23 @@ nsTSubstringTuple_CharT::WriteTo(char_ty
 
 
 /**
  * returns true if this tuple is dependent on (i.e., overlapping with)
  * the given char sequence.
  */
 
 bool
-nsTSubstringTuple_CharT::IsDependentOn(const char_type* start, const char_type* end) const
+nsTSubstringTuple_CharT::IsDependentOn(const char_type* aStart,
+                                       const char_type* aEnd) const
 {
-  // we start with the right-most fragment since it is faster to check.
+  // we aStart with the right-most fragment since it is faster to check.
 
-  if (TO_SUBSTRING(mFragB).IsDependentOn(start, end)) {
+  if (TO_SUBSTRING(mFragB).IsDependentOn(aStart, aEnd)) {
     return true;
   }
 
   if (mHead) {
-    return mHead->IsDependentOn(start, end);
+    return mHead->IsDependentOn(aStart, aEnd);
   }
 
-  return TO_SUBSTRING(mFragA).IsDependentOn(start, end);
+  return TO_SUBSTRING(mFragA).IsDependentOn(aStart, aEnd);
 }
--- a/xpcom/string/nsUTF8UtilsSSE2.cpp
+++ b/xpcom/string/nsUTF8UtilsSSE2.cpp
@@ -13,17 +13,18 @@ void
 LossyConvertEncoding16to8::write_sse2(const char16_t* aSource,
                                       uint32_t aSourceLength)
 {
   char* dest = mDestination;
 
   // Align source to a 16-byte boundary.
   uint32_t i = 0;
   uint32_t alignLen =
-    XPCOM_MIN<uint32_t>(aSourceLength, uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf) / sizeof(char16_t));
+    XPCOM_MIN<uint32_t>(aSourceLength,
+                        uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf) / sizeof(char16_t));
   for (; i < alignLen; ++i) {
     dest[i] = static_cast<unsigned char>(aSource[i]);
   }
 
   // Walk 64 bytes (four XMM registers) at a time.
   __m128i vectmask = _mm_set1_epi16(0x00ff);
   for (; aSourceLength - i > 31; i += 32) {
     __m128i source1 = _mm_load_si128(reinterpret_cast<const __m128i*>(aSource + i));
@@ -66,17 +67,18 @@ LossyConvertEncoding8to16::write_sse2(co
 {
   char16_t* dest = mDestination;
 
   // Align source to a 16-byte boundary.  We choose to align source rather than
   // dest because we'd rather have our loads than our stores be fast. You have
   // to wait for a load to complete, but you can keep on moving after issuing a
   // store.
   uint32_t i = 0;
-  uint32_t alignLen = XPCOM_MIN(aSourceLength, uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf));
+  uint32_t alignLen = XPCOM_MIN(aSourceLength,
+                                uint32_t(-NS_PTR_TO_INT32(aSource) & 0xf));
   for (; i < alignLen; ++i) {
     dest[i] = static_cast<unsigned char>(aSource[i]);
   }
 
   // Walk 32 bytes (two XMM registers) at a time.
   for (; aSourceLength - i > 31; i += 32) {
     __m128i source1 = _mm_load_si128(reinterpret_cast<const __m128i*>(aSource + i));
     __m128i source2 = _mm_load_si128(reinterpret_cast<const __m128i*>(aSource + i + 16));
--- a/xpcom/threads/ThreadStackHelper.cpp
+++ b/xpcom/threads/ThreadStackHelper.cpp
@@ -182,18 +182,17 @@ void ThreadStackHelper::GetThreadStackBa
 #else
     mThreadStackBase = intptr_t(stackAddr);
 #endif
   }
   MOZ_ALWAYS_TRUE(!::pthread_attr_destroy(&pthr_attr));
 
 #elif defined(XP_WIN)
   ::MEMORY_BASIC_INFORMATION meminfo = {};
-  NS_ENSURE_TRUE_VOID(::VirtualQuery(
-    &meminfo, &meminfo, sizeof(meminfo)));
+  NS_ENSURE_TRUE_VOID(::VirtualQuery(&meminfo, &meminfo, sizeof(meminfo)));
 #ifdef MOZ_THREADSTACKHELPER_STACK_GROWS_DOWN
   mThreadStackBase = intptr_t(meminfo.BaseAddress) + meminfo.RegionSize;
 #else
   mThreadStackBase = intptr_t(meminfo.AllocationBase);
 #endif
 
 #elif defined(XP_MACOSX)
   ::pthread_t pthr = ::pthread_self();
@@ -201,17 +200,17 @@ void ThreadStackHelper::GetThreadStackBa
 
 #else
   #error "Unsupported platform"
 #endif // platform
 }
 #endif // MOZ_THREADSTACKHELPER_NATIVE
 
 namespace {
-template <typename T>
+template<typename T>
 class ScopedSetPtr
 {
 private:
   T*& mPtr;
 public:
   ScopedSetPtr(T*& p, T* val) : mPtr(p) { mPtr = val; }
   ~ScopedSetPtr() { mPtr = nullptr; }
 };
@@ -273,60 +272,68 @@ ThreadStackHelper::GetStack(Stack& aStac
 
   MOZ_ALWAYS_TRUE(::thread_resume(mThreadID) == KERN_SUCCESS);
 
 #endif
 }
 
 #ifdef MOZ_THREADSTACKHELPER_NATIVE
 class ThreadStackHelper::CodeModulesProvider
-  : public google_breakpad::CodeModules {
+  : public google_breakpad::CodeModules
+{
 private:
   typedef google_breakpad::CodeModule CodeModule;
   typedef google_breakpad::BasicCodeModule BasicCodeModule;
 
   const SharedLibraryInfo mLibs;
   mutable ScopedDeletePtr<BasicCodeModule> mModule;
 
 public:
   CodeModulesProvider() : mLibs(SharedLibraryInfo::GetInfoForSelf()) {}
   virtual ~CodeModulesProvider() {}
 
-  virtual unsigned int module_count() const {
+  virtual unsigned int module_count() const
+  {
     return mLibs.GetSize();
   }
 
-  virtual const CodeModule* GetModuleForAddress(uint64_t address) const {
+  virtual const CodeModule* GetModuleForAddress(uint64_t aAddress) const
+  {
     MOZ_CRASH("Not implemented");
   }
 
-  virtual const CodeModule* GetMainModule() const {
+  virtual const CodeModule* GetMainModule() const
+  {
     return nullptr;
   }
 
-  virtual const CodeModule* GetModuleAtSequence(unsigned int sequence) const {
+  virtual const CodeModule* GetModuleAtSequence(unsigned int aSequence) const
+  {
     MOZ_CRASH("Not implemented");
   }
 
-  virtual const CodeModule* GetModuleAtIndex(unsigned int index) const {
-    const SharedLibrary& lib = mLibs.GetEntry(index);
+  virtual const CodeModule* GetModuleAtIndex(unsigned int aIndex) const
+  {
+    const SharedLibrary& lib = mLibs.GetEntry(aIndex);
     mModule = new BasicCodeModule(lib.GetStart(), lib.GetEnd() - lib.GetStart(),
                                   lib.GetName(), lib.GetBreakpadId(),
                                   lib.GetName(), lib.GetBreakpadId(), "");
     // Keep mModule valid until the next GetModuleAtIndex call.
     return mModule;
   }
 
-  virtual const CodeModules* Copy() const {
+  virtual const CodeModules* Copy() const
+  {
     MOZ_CRASH("Not implemented");
   }
 };
 
 class ThreadStackHelper::ThreadContext
-  : public google_breakpad::MemoryRegion {
+  : public google_breakpad::MemoryRegion
+{
 public:
 #if defined(MOZ_THREADSTACKHELPER_X86)
   typedef MDRawContextX86 Context;
 #elif defined(MOZ_THREADSTACKHELPER_X64)
   typedef MDRawContextAMD64 Context;
 #elif defined(MOZ_THREADSTACKHELPER_ARM)
   typedef MDRawContextARM Context;
 #endif
@@ -342,49 +349,51 @@ public:
   UniquePtr<uint8_t[]> mStack;
   // Start of stack area
   uintptr_t mStackBase;
   // Size of stack area
   size_t mStackSize;
   // End of stack area
   const void* mStackEnd;
 
-  ThreadContext() : mValid(false)
-                  , mStackBase(0)
-                  , mStackSize(0)
-                  , mStackEnd(nullptr) {}
+  ThreadContext()
+    : mValid(false)
+    , mStackBase(0)
+    , mStackSize(0)
+    , mStackEnd(nullptr) {}
   virtual ~ThreadContext() {}
 
-  virtual uint64_t GetBase() const {
-    return uint64_t(mStackBase);
-  }
-  virtual uint32_t GetSize() const {
-    return mStackSize;
-  }
-  virtual bool GetMemoryAtAddress(uint64_t address, uint8_t*  value) const {
-    return GetMemoryAtAddressInternal(address, value);
+  virtual uint64_t GetBase() const { return uint64_t(mStackBase); }
+  virtual uint32_t GetSize() const { return mStackSize; }
+  virtual bool GetMemoryAtAddress(uint64_t aAddress, uint8_t* aValue) const
+  {
+    return GetMemoryAtAddressInternal(aAddress, aValue);
   }
-  virtual bool GetMemoryAtAddress(uint64_t address, uint16_t*  value) const {
-    return GetMemoryAtAddressInternal(address, value);
+  virtual bool GetMemoryAtAddress(uint64_t aAddress, uint16_t* aValue) const
+  {
+    return GetMemoryAtAddressInternal(aAddress, aValue);
   }
-  virtual bool GetMemoryAtAddress(uint64_t address, uint32_t*  value) const {
-    return GetMemoryAtAddressInternal(address, value);
+  virtual bool GetMemoryAtAddress(uint64_t aAddress, uint32_t* aValue) const
+  {
+    return GetMemoryAtAddressInternal(aAddress, aValue);
   }
-  virtual bool GetMemoryAtAddress(uint64_t address, uint64_t*  value) const {
-    return GetMemoryAtAddressInternal(address, value);
+  virtual bool GetMemoryAtAddress(uint64_t aAddress, uint64_t* aValue) const
+  {
+    return GetMemoryAtAddressInternal(aAddress, aValue);
   }
 
 private:
-  template <typename T>
-  bool GetMemoryAtAddressInternal(uint64_t address, T* value) const {
-    const intptr_t offset = intptr_t(address) - intptr_t(GetBase());
+  template<typename T>
+  bool GetMemoryAtAddressInternal(uint64_t aAddress, T* aValue) const
+  {
+    const intptr_t offset = intptr_t(aAddress) - intptr_t(GetBase());
     if (offset < 0 || uintptr_t(offset) > (GetSize() - sizeof(T))) {
       return false;
     }
-    *value = *reinterpret_cast<const T*>(&mStack[offset]);
+    *aValue = *reinterpret_cast<const T*>(&mStack[offset]);
     return true;
   }
 };
 #endif // MOZ_THREADSTACKHELPER_NATIVE
 
 void
 ThreadStackHelper::GetNativeStack(Stack& aStack)
 {
--- a/xpcom/threads/nsEventQueue.cpp
+++ b/xpcom/threads/nsEventQueue.cpp
@@ -80,20 +80,20 @@ nsEventQueue::GetEvent(bool aMayWait, ns
       }
     }
   }
 
   return true;
 }
 
 void
-nsEventQueue::PutEvent(nsIRunnable *runnable)
+nsEventQueue::PutEvent(nsIRunnable* aRunnable)
 {
   // Avoid calling AddRef+Release while holding our monitor.
-  nsRefPtr<nsIRunnable> event(runnable);
+  nsRefPtr<nsIRunnable> event(aRunnable);
 
   if (ChaosMode::isActive()) {
     // With probability 0.5, yield so other threads have a chance to
     // dispatch events to this queue first.
     if (ChaosMode::randomUint32LessThan(2)) {
       PR_Sleep(PR_INTERVAL_NO_WAIT);
     }
   }
@@ -103,21 +103,21 @@ nsEventQueue::PutEvent(nsIRunnable *runn
   if (!mHead) {
     mHead = NewPage();
     MOZ_ASSERT(mHead);
 
     mTail = mHead;
     mOffsetHead = 0;
     mOffsetTail = 0;
   } else if (mOffsetTail == EVENTS_PER_PAGE) {
-    Page *page = NewPage();
+    Page* page = NewPage();
     MOZ_ASSERT(page);
 
     mTail->mNext = page;
     mTail = page;
     mOffsetTail = 0;
   }
 
   event.swap(mTail->mEvents[mOffsetTail]);
   ++mOffsetTail;
-  LOG(("EVENTQ(%p): notify\n", this)); 
+  LOG(("EVENTQ(%p): notify\n", this));
   mon.NotifyAll();
 }
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -209,19 +209,17 @@ public:
     ReentrantMonitorAutoEnter mon(mMon);
     while (!mInitialized) {
       mon.Wait();
     }
   }
 
   // This method needs to be public to support older compilers (xlC_r on AIX).
   // It should be called directly as this class type is reference counted.
-  virtual ~nsThreadStartupEvent()
-  {
-  }
+  virtual ~nsThreadStartupEvent() {}
 
 private:
   NS_IMETHOD Run()
   {
     ReentrantMonitorAutoEnter mon(mMon);
     mInitialized = true;
     mon.Notify();
     return NS_OK;
@@ -683,17 +681,18 @@ void canary_alarm_handler(int signum)
   PR_END_MACRO
 
 NS_IMETHODIMP
 nsThread::ProcessNextEvent(bool aMayWait, bool* aResult)
 {
   LOG(("THRD(%p) ProcessNextEvent [%u %u]\n", this, aMayWait, mRunningEvent));
 
   // If we're on the main thread, we shouldn't be dispatching CPOWs.
-  MOZ_RELEASE_ASSERT(mIsMainThread != MAIN_THREAD || !ipc::ProcessingUrgentMessages());
+  MOZ_RELEASE_ASSERT(mIsMainThread != MAIN_THREAD ||
+                     !ipc::ProcessingUrgentMessages());
 
   if (NS_WARN_IF(PR_GetCurrentThread() != mThread)) {
     return NS_ERROR_NOT_SAME_THREAD;
   }
 
   // The toplevel event loop normally blocks waiting for the next event, but
   // if we're trying to shut this thread down, we must exit the event loop when
   // the event queue is empty.
--- a/xpcom/threads/nsTimerImpl.cpp
+++ b/xpcom/threads/nsTimerImpl.cpp
@@ -552,17 +552,17 @@ nsTimerImpl::SetTarget(nsIEventTarget* a
 void
 nsTimerImpl::Fire()
 {
   if (mCanceled) {
     return;
   }
 
   PROFILER_LABEL("Timer", "Fire",
-    js::ProfileEntry::Category::OTHER);
+                 js::ProfileEntry::Category::OTHER);
 
 #ifdef MOZ_TASK_TRACER
   mozilla::tasktracer::AutoRunFakeTracedTask runTracedTask(mTracedTask);
 #endif
 
 #ifdef DEBUG_TIMERS
   TimeStamp now = TimeStamp::Now();
   if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) {