Bug 1022456 - Convert xpcom/glue/ to Gecko style. r=froydnj
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Thu, 26 Jun 2014 18:35:39 -0700
changeset 213033 909655c3ec14f84a1feb5551f99db5368ffe8380
parent 213032 b3124d14db161bd4e77695cbb84c8e6a623b069c
child 213034 37dc4a16c312561c28a4cdae33b8de427b01154f
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1022456
milestone33.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 1022456 - Convert xpcom/glue/ to Gecko style. r=froydnj
xpcom/glue/AppData.cpp
xpcom/glue/AppData.h
xpcom/glue/AutoRestore.h
xpcom/glue/BlockingResourceBase.cpp
xpcom/glue/BlockingResourceBase.h
xpcom/glue/CondVar.h
xpcom/glue/DeadlockDetector.cpp
xpcom/glue/DeadlockDetector.h
xpcom/glue/EnumeratedArrayCycleCollection.h
xpcom/glue/FileUtils.cpp
xpcom/glue/FileUtils.h
xpcom/glue/GenericFactory.cpp
xpcom/glue/GenericFactory.h
xpcom/glue/GenericModule.cpp
xpcom/glue/HoldDropJSObjects.h
xpcom/glue/IntentionalCrash.h
xpcom/glue/MainThreadUtils.h
xpcom/glue/Monitor.h
xpcom/glue/Mutex.h
xpcom/glue/Observer.h
xpcom/glue/ReentrantMonitor.h
xpcom/glue/nsArrayEnumerator.cpp
xpcom/glue/nsArrayEnumerator.h
xpcom/glue/nsArrayUtils.cpp
xpcom/glue/nsArrayUtils.h
xpcom/glue/nsBaseHashtable.h
xpcom/glue/nsCOMArray.cpp
xpcom/glue/nsCOMArray.h
xpcom/glue/nsCOMPtr.cpp
xpcom/glue/nsCOMPtr.h
xpcom/glue/nsCRTGlue.cpp
xpcom/glue/nsCRTGlue.h
xpcom/glue/nsCategoryCache.cpp
xpcom/glue/nsCategoryCache.h
xpcom/glue/nsClassHashtable.h
xpcom/glue/nsClassInfoImpl.cpp
xpcom/glue/nsComponentManagerUtils.cpp
xpcom/glue/nsComponentManagerUtils.h
xpcom/glue/nsCycleCollectionNoteChild.h
xpcom/glue/nsCycleCollectionNoteRootCallback.h
xpcom/glue/nsCycleCollectionParticipant.cpp
xpcom/glue/nsCycleCollectionParticipant.h
xpcom/glue/nsCycleCollectionTraversalCallback.h
xpcom/glue/nsDataHashtable.h
xpcom/glue/nsDebug.h
xpcom/glue/nsDeque.cpp
xpcom/glue/nsDeque.h
xpcom/glue/nsEnumeratorUtils.cpp
xpcom/glue/nsEnumeratorUtils.h
xpcom/glue/nsHashKeys.h
xpcom/glue/nsIClassInfoImpl.h
xpcom/glue/nsID.cpp
xpcom/glue/nsID.h
xpcom/glue/nsIInterfaceRequestorUtils.cpp
xpcom/glue/nsIInterfaceRequestorUtils.h
xpcom/glue/nsINIParser.cpp
xpcom/glue/nsINIParser.h
xpcom/glue/nsISupportsImpl.cpp
xpcom/glue/nsISupportsImpl.h
xpcom/glue/nsISupportsUtils.h
xpcom/glue/nsIWeakReferenceUtils.h
xpcom/glue/nsInterfaceHashtable.h
xpcom/glue/nsJSThingHashtable.h
xpcom/glue/nsMemory.cpp
xpcom/glue/nsMemory.h
xpcom/glue/nsProxyRelease.cpp
xpcom/glue/nsProxyRelease.h
xpcom/glue/nsQuickSort.h
xpcom/glue/nsRefPtrHashtable.h
xpcom/glue/nsServiceManagerUtils.h
xpcom/glue/nsStringAPI.cpp
xpcom/glue/nsStringAPI.h
xpcom/glue/nsTArray-inl.h
xpcom/glue/nsTArray.cpp
xpcom/glue/nsTArray.h
xpcom/glue/nsTHashtable.cpp
xpcom/glue/nsTHashtable.h
xpcom/glue/nsTObserverArray.cpp
xpcom/glue/nsTObserverArray.h
xpcom/glue/nsTPriorityQueue.h
xpcom/glue/nsTWeakRef.h
xpcom/glue/nsTextFormatter.cpp
xpcom/glue/nsTextFormatter.h
xpcom/glue/nsThreadIDs.h
xpcom/glue/nsThreadUtils.cpp
xpcom/glue/nsThreadUtils.h
xpcom/glue/nsVersionComparator.cpp
xpcom/glue/nsVersionComparator.h
xpcom/glue/nsVoidArray.cpp
xpcom/glue/nsVoidArray.h
xpcom/glue/nsWeakReference.cpp
xpcom/glue/nsWeakReference.h
xpcom/glue/nsXPTCUtils.h
xpcom/glue/pldhash.cpp
xpcom/glue/pldhash.h
xpcom/glue/tests/gtest/TestFileUtils.cpp
xpcom/glue/tests/gtest/TestGCPostBarriers.cpp
xpcom/glue/unused.h
--- a/xpcom/glue/AppData.cpp
+++ b/xpcom/glue/AppData.cpp
@@ -8,36 +8,34 @@
 #include "nsINIParser.h"
 #include "nsIFile.h"
 #include "nsCRTGlue.h"
 #include "nsAutoPtr.h"
 
 namespace mozilla {
 
 void
-SetAllocatedString(const char *&str, const char *newvalue)
+SetAllocatedString(const char*& aStr, const char* aNewValue)
 {
-  NS_Free(const_cast<char*>(str));
-  if (newvalue) {
-    str = NS_strdup(newvalue);
-  }
-  else {
-    str = nullptr;
+  NS_Free(const_cast<char*>(aStr));
+  if (aNewValue) {
+    aStr = NS_strdup(aNewValue);
+  } else {
+    aStr = nullptr;
   }
 }
 
 void
-SetAllocatedString(const char *&str, const nsACString &newvalue)
+SetAllocatedString(const char*& aStr, const nsACString& aNewValue)
 {
-  NS_Free(const_cast<char*>(str));
-  if (newvalue.IsEmpty()) {
-    str = nullptr;
-  }
-  else {
-    str = ToNewCString(newvalue);
+  NS_Free(const_cast<char*>(aStr));
+  if (aNewValue.IsEmpty()) {
+    aStr = nullptr;
+  } else {
+    aStr = ToNewCString(aNewValue);
   }
 }
 
 ScopedAppData::ScopedAppData(const nsXREAppData* aAppData)
 {
   Zero();
 
   this->size = aAppData->size;
@@ -74,17 +72,17 @@ ScopedAppData::~ScopedAppData()
   SetAllocatedString(this->version, nullptr);
   SetAllocatedString(this->buildID, nullptr);
   SetAllocatedString(this->ID, nullptr);
   SetAllocatedString(this->copyright, nullptr);
   SetAllocatedString(this->profile, nullptr);
 
   NS_IF_RELEASE(this->directory);
 
-  SetStrongPtr(this->xreDirectory, (nsIFile*) nullptr);
+  SetStrongPtr(this->xreDirectory, (nsIFile*)nullptr);
   SetAllocatedString(this->minVersion, nullptr);
   SetAllocatedString(this->maxVersion, nullptr);
 
   SetAllocatedString(this->crashReporterURL, nullptr);
   SetAllocatedString(this->UAName, nullptr);
 }
 
 } // namespace mozilla
--- a/xpcom/glue/AppData.h
+++ b/xpcom/glue/AppData.h
@@ -13,46 +13,50 @@
 
 namespace mozilla {
 
 // Like nsXREAppData, but releases all strong refs/allocated memory
 // in the destructor.
 class NS_COM_GLUE ScopedAppData : public nsXREAppData
 {
 public:
-  ScopedAppData() { Zero(); this->size = sizeof(*this); }
+  ScopedAppData()
+  {
+    Zero();
+    this->size = sizeof(*this);
+  }
 
   ScopedAppData(const nsXREAppData* aAppData);
 
   void Zero() { memset(this, 0, sizeof(*this)); }
 
   ~ScopedAppData();
 };
 
 /**
- * Given "str" is holding a string allocated with NS_Alloc, or null:
- * replace the value in "str" with a new value.
+ * Given |aStr| is holding a string allocated with NS_Alloc, or null:
+ * replace the value in |aStr| with a new value.
  *
- * @param newvalue Null is permitted. The string is cloned with
- *                 NS_strdup
+ * @param aNewValue Null is permitted. The string is cloned with NS_strdup.
  */
-void SetAllocatedString(const char *&str, const char *newvalue);
+void SetAllocatedString(const char*& aStr, const char* aNewValue);
 
 /**
  * Given "str" is holding a string allocated with NS_Alloc, or null:
  * replace the value in "str" with a new value.
  *
- * @param newvalue If "newvalue" is the empty string, "str" will be set
- *                 to null.
+ * @param aNewValue If |aNewValue| is the empty string, |aStr| will be set
+ *                  to null.
  */
-void SetAllocatedString(const char *&str, const nsACString &newvalue);
+void SetAllocatedString(const char*& aStr, const nsACString& aNewValue);
 
 template<class T>
-void SetStrongPtr(T *&ptr, T* newvalue)
+void
+SetStrongPtr(T*& aPtr, T* aNewValue)
 {
-  NS_IF_RELEASE(ptr);
-  ptr = newvalue;
-  NS_IF_ADDREF(ptr);
+  NS_IF_RELEASE(aPtr);
+  aPtr = aNewValue;
+  NS_IF_ADDREF(aPtr);
 }
 
 } // namespace mozilla
 
 #endif
--- a/xpcom/glue/AutoRestore.h
+++ b/xpcom/glue/AutoRestore.h
@@ -8,39 +8,43 @@
 #ifndef mozilla_AutoRestore_h_
 #define mozilla_AutoRestore_h_
 
 #include "mozilla/Attributes.h" // MOZ_STACK_CLASS
 #include "mozilla/GuardObjects.h"
 
 namespace mozilla {
 
-  /**
-   * Save the current value of a variable and restore it when the object
-   * goes out of scope.  For example:
-   *   {
-   *     AutoRestore<bool> savePainting(mIsPainting);
-   *     mIsPainting = true;
-   *     
-   *     // ... your code here ...
-   *
-   *     // mIsPainting is reset to its old value at the end of this block
-   *   }
-   */
-  template <class T>
-  class MOZ_STACK_CLASS AutoRestore
+/**
+ * Save the current value of a variable and restore it when the object
+ * goes out of scope.  For example:
+ *   {
+ *     AutoRestore<bool> savePainting(mIsPainting);
+ *     mIsPainting = true;
+ *
+ *     // ... your code here ...
+ *
+ *     // mIsPainting is reset to its old value at the end of this block
+ *   }
+ */
+template<class T>
+class MOZ_STACK_CLASS AutoRestore
+{
+private:
+  T& mLocation;
+  T mValue;
+  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+public:
+  AutoRestore(T& aValue MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
+    : mLocation(aValue)
+    , mValue(aValue)
   {
-  private:
-    T& mLocation;
-    T mValue;
-    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
-  public:
-    AutoRestore(T& aValue MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
-      : mLocation(aValue), mValue(aValue)
-    {
-      MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-    }
-    ~AutoRestore() { mLocation = mValue; }
-  };
+    MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+  }
+  ~AutoRestore()
+  {
+    mLocation = mValue;
+  }
+};
 
 } // namespace mozilla
 
 #endif /* !defined(mozilla_AutoRestore_h_) */
--- a/xpcom/glue/BlockingResourceBase.cpp
+++ b/xpcom/glue/BlockingResourceBase.cpp
@@ -22,342 +22,343 @@
 namespace mozilla {
 //
 // BlockingResourceBase implementation
 //
 
 // static members
 const char* const BlockingResourceBase::kResourceTypeName[] =
 {
-    // needs to be kept in sync with BlockingResourceType
-    "Mutex", "ReentrantMonitor", "CondVar"
+  // needs to be kept in sync with BlockingResourceType
+  "Mutex", "ReentrantMonitor", "CondVar"
 };
 
 #ifdef DEBUG
 
 PRCallOnceType BlockingResourceBase::sCallOnce;
 unsigned BlockingResourceBase::sResourceAcqnChainFrontTPI = (unsigned)-1;
 BlockingResourceBase::DDT* BlockingResourceBase::sDeadlockDetector;
 
 bool
 BlockingResourceBase::DeadlockDetectorEntry::Print(
     const DDT::ResourceAcquisition& aFirstSeen,
-    nsACString& out,
+    nsACString& aOut,
     bool aPrintFirstSeenCx) const
 {
-    CallStack lastAcquisition = mAcquisitionContext; // RACY, but benign
-    bool maybeCurrentlyAcquired = (CallStack::kNone != lastAcquisition);
-    CallStack printAcquisition =
-        (aPrintFirstSeenCx || !maybeCurrentlyAcquired) ?
-            aFirstSeen.mCallContext : lastAcquisition;
+  CallStack lastAcquisition = mAcquisitionContext; // RACY, but benign
+  bool maybeCurrentlyAcquired = (CallStack::kNone != lastAcquisition);
+  CallStack printAcquisition =
+    (aPrintFirstSeenCx || !maybeCurrentlyAcquired) ?
+      aFirstSeen.mCallContext : lastAcquisition;
 
-    fprintf(stderr, "--- %s : %s",
-            kResourceTypeName[mType], mName);
-    out += BlockingResourceBase::kResourceTypeName[mType];
-    out += " : ";
-    out += mName;
+  fprintf(stderr, "--- %s : %s",
+          kResourceTypeName[mType], mName);
+  aOut += BlockingResourceBase::kResourceTypeName[mType];
+  aOut += " : ";
+  aOut += mName;
 
-    if (maybeCurrentlyAcquired) {
-        fputs(" (currently acquired)\n", stderr);
-        out += " (currently acquired)\n";
-    }
+  if (maybeCurrentlyAcquired) {
+    fputs(" (currently acquired)\n", stderr);
+    aOut += " (currently acquired)\n";
+  }
 
-    fputs(" calling context\n", stderr);
-    printAcquisition.Print(stderr);
+  fputs(" calling context\n", stderr);
+  printAcquisition.Print(stderr);
 
-    return maybeCurrentlyAcquired;
+  return maybeCurrentlyAcquired;
 }
 
 
 BlockingResourceBase::BlockingResourceBase(
     const char* aName,
     BlockingResourceBase::BlockingResourceType aType)
 {
-    // PR_CallOnce guaranatees that InitStatics is called in a
-    // thread-safe way
-    if (PR_SUCCESS != PR_CallOnce(&sCallOnce, InitStatics))
-        NS_RUNTIMEABORT("can't initialize blocking resource static members");
+  // PR_CallOnce guaranatees that InitStatics is called in a
+  // thread-safe way
+  if (PR_SUCCESS != PR_CallOnce(&sCallOnce, InitStatics)) {
+    NS_RUNTIMEABORT("can't initialize blocking resource static members");
+  }
 
-    mDDEntry = new BlockingResourceBase::DeadlockDetectorEntry(aName, aType);
-    mChainPrev = 0;
-    sDeadlockDetector->Add(mDDEntry);
+  mDDEntry = new BlockingResourceBase::DeadlockDetectorEntry(aName, aType);
+  mChainPrev = 0;
+  sDeadlockDetector->Add(mDDEntry);
 }
 
 
 BlockingResourceBase::~BlockingResourceBase()
 {
-    // we don't check for really obviously bad things like freeing
-    // Mutexes while they're still locked.  it is assumed that the
-    // base class, or its underlying primitive, will check for such
-    // stupid mistakes.
-    mChainPrev = 0;             // racy only for stupidly buggy client code
-    mDDEntry = 0;               // owned by deadlock detector
+  // we don't check for really obviously bad things like freeing
+  // Mutexes while they're still locked.  it is assumed that the
+  // base class, or its underlying primitive, will check for such
+  // stupid mistakes.
+  mChainPrev = 0;             // racy only for stupidly buggy client code
+  mDDEntry = 0;               // owned by deadlock detector
 }
 
 
 void
 BlockingResourceBase::CheckAcquire(const CallStack& aCallContext)
 {
-    if (eCondVar == mDDEntry->mType) {
-        NS_NOTYETIMPLEMENTED(
-            "FIXME bug 456272: annots. to allow CheckAcquire()ing condvars");
-        return;
-    }
+  if (mDDEntry->mType == eCondVar) {
+    NS_NOTYETIMPLEMENTED(
+      "FIXME bug 456272: annots. to allow CheckAcquire()ing condvars");
+    return;
+  }
 
-    BlockingResourceBase* chainFront = ResourceChainFront();
-    nsAutoPtr<DDT::ResourceAcquisitionArray> cycle(
-        sDeadlockDetector->CheckAcquisition(
-            chainFront ? chainFront->mDDEntry : 0, mDDEntry,
-            aCallContext));
-    if (!cycle)
-        return;
+  BlockingResourceBase* chainFront = ResourceChainFront();
+  nsAutoPtr<DDT::ResourceAcquisitionArray> cycle(
+    sDeadlockDetector->CheckAcquisition(
+      chainFront ? chainFront->mDDEntry : 0, mDDEntry, aCallContext));
+  if (!cycle) {
+    return;
+  }
 
-    fputs("###!!! ERROR: Potential deadlock detected:\n", stderr);
-    nsAutoCString out("Potential deadlock detected:\n");
-    bool maybeImminent = PrintCycle(cycle, out);
+  fputs("###!!! ERROR: Potential deadlock detected:\n", stderr);
+  nsAutoCString out("Potential deadlock detected:\n");
+  bool maybeImminent = PrintCycle(cycle, out);
 
-    if (maybeImminent) {
-        fputs("\n###!!! Deadlock may happen NOW!\n\n", stderr);
-        out.AppendLiteral("\n###!!! Deadlock may happen NOW!\n\n");
-    } else {
-        fputs("\nDeadlock may happen for some other execution\n\n",
-              stderr);
-        out.AppendLiteral("\nDeadlock may happen for some other execution\n\n");
-    }
+  if (maybeImminent) {
+    fputs("\n###!!! Deadlock may happen NOW!\n\n", stderr);
+    out.AppendLiteral("\n###!!! Deadlock may happen NOW!\n\n");
+  } else {
+    fputs("\nDeadlock may happen for some other execution\n\n",
+          stderr);
+    out.AppendLiteral("\nDeadlock may happen for some other execution\n\n");
+  }
 
-    // XXX can customize behavior on whether we /think/ deadlock is
-    // XXX about to happen.  for example:
-    // XXX   if (maybeImminent)
-    //           NS_RUNTIMEABORT(out.get());
-    NS_ERROR(out.get());
+  // XXX can customize behavior on whether we /think/ deadlock is
+  // XXX about to happen.  for example:
+  // XXX   if (maybeImminent)
+  //           NS_RUNTIMEABORT(out.get());
+  NS_ERROR(out.get());
 }
 
 
 void
 BlockingResourceBase::Acquire(const CallStack& aCallContext)
 {
-    if (eCondVar == mDDEntry->mType) {
-        NS_NOTYETIMPLEMENTED(
-            "FIXME bug 456272: annots. to allow Acquire()ing condvars");
-        return;
-    }
-    NS_ASSERTION(mDDEntry->mAcquisitionContext == CallStack::kNone,
-                 "reacquiring already acquired resource");
+  if (mDDEntry->mType == eCondVar) {
+    NS_NOTYETIMPLEMENTED(
+      "FIXME bug 456272: annots. to allow Acquire()ing condvars");
+    return;
+  }
+  NS_ASSERTION(mDDEntry->mAcquisitionContext == CallStack::kNone,
+               "reacquiring already acquired resource");
 
-    ResourceChainAppend(ResourceChainFront());
-    mDDEntry->mAcquisitionContext = aCallContext;
+  ResourceChainAppend(ResourceChainFront());
+  mDDEntry->mAcquisitionContext = aCallContext;
 }
 
 
 void
 BlockingResourceBase::Release()
 {
-    if (eCondVar == mDDEntry->mType) {
-        NS_NOTYETIMPLEMENTED(
-            "FIXME bug 456272: annots. to allow Release()ing condvars");
-        return;
-    }
-      
-    BlockingResourceBase* chainFront = ResourceChainFront();
-    NS_ASSERTION(chainFront
-                 && CallStack::kNone != mDDEntry->mAcquisitionContext,
-                 "Release()ing something that hasn't been Acquire()ed");
+  if (mDDEntry->mType == eCondVar) {
+    NS_NOTYETIMPLEMENTED(
+      "FIXME bug 456272: annots. to allow Release()ing condvars");
+    return;
+  }
+
+  BlockingResourceBase* chainFront = ResourceChainFront();
+  NS_ASSERTION(chainFront && mDDEntry->mAcquisitionContext != CallStack::kNone,
+               "Release()ing something that hasn't been Acquire()ed");
 
-    if (chainFront == this) {
-        ResourceChainRemove();
+  if (chainFront == this) {
+    ResourceChainRemove();
+  } else {
+    // not an error, but makes code hard to reason about.
+    NS_WARNING("Resource acquired at calling context\n");
+    mDDEntry->mAcquisitionContext.Print(stderr);
+    NS_WARNING("\nis being released in non-LIFO order; why?");
+
+    // remove this resource from wherever it lives in the chain
+    // we walk backwards in order of acquisition:
+    //  (1)  ...node<-prev<-curr...
+    //              /     /
+    //  (2)  ...prev<-curr...
+    BlockingResourceBase* curr = chainFront;
+    BlockingResourceBase* prev = nullptr;
+    while (curr && (prev = curr->mChainPrev) && (prev != this)) {
+      curr = prev;
     }
-    else {
-        // not an error, but makes code hard to reason about.
-        NS_WARNING("Resource acquired at calling context\n");
-        mDDEntry->mAcquisitionContext.Print(stderr);
-        NS_WARNING("\nis being released in non-LIFO order; why?");
-        
-        // remove this resource from wherever it lives in the chain
-        // we walk backwards in order of acquisition:
-        //  (1)  ...node<-prev<-curr...
-        //              /     /
-        //  (2)  ...prev<-curr...
-        BlockingResourceBase* curr = chainFront;
-        BlockingResourceBase* prev = nullptr;
-        while (curr && (prev = curr->mChainPrev) && (prev != this))
-            curr = prev;
-        if (prev == this)
-            curr->mChainPrev = prev->mChainPrev;
+    if (prev == this) {
+      curr->mChainPrev = prev->mChainPrev;
     }
+  }
 
-    mDDEntry->mAcquisitionContext = CallStack::kNone;
+  mDDEntry->mAcquisitionContext = CallStack::kNone;
 }
 
 
 bool
 BlockingResourceBase::PrintCycle(const DDT::ResourceAcquisitionArray* aCycle,
-                                 nsACString& out)
+                                 nsACString& aOut)
 {
-    NS_ASSERTION(aCycle->Length() > 1, "need > 1 element for cycle!");
+  NS_ASSERTION(aCycle->Length() > 1, "need > 1 element for cycle!");
 
-    bool maybeImminent = true;
+  bool maybeImminent = true;
 
-    fputs("=== Cyclical dependency starts at\n", stderr);
-    out += "Cyclical dependency starts at\n";
+  fputs("=== Cyclical dependency starts at\n", stderr);
+  aOut += "Cyclical dependency starts at\n";
 
-    const DDT::ResourceAcquisition res = aCycle->ElementAt(0);
-    maybeImminent &= res.mResource->Print(res, out);
+  const DDT::ResourceAcquisition res = aCycle->ElementAt(0);
+  maybeImminent &= res.mResource->Print(res, aOut);
 
-    DDT::ResourceAcquisitionArray::index_type i;
-    DDT::ResourceAcquisitionArray::size_type len = aCycle->Length();
-    const DDT::ResourceAcquisition* it = 1 + aCycle->Elements();
-    for (i = 1; i < len - 1; ++i, ++it) {
-        fputs("\n--- Next dependency:\n", stderr);
-        out += "\nNext dependency:\n";
+  DDT::ResourceAcquisitionArray::index_type i;
+  DDT::ResourceAcquisitionArray::size_type len = aCycle->Length();
+  const DDT::ResourceAcquisition* it = 1 + aCycle->Elements();
+  for (i = 1; i < len - 1; ++i, ++it) {
+    fputs("\n--- Next dependency:\n", stderr);
+    aOut += "\nNext dependency:\n";
 
-        maybeImminent &= it->mResource->Print(*it, out);
-    }
+    maybeImminent &= it->mResource->Print(*it, aOut);
+  }
 
-    fputs("\n=== Cycle completed at\n", stderr);
-    out += "Cycle completed at\n";
-    it->mResource->Print(*it, out, true);
+  fputs("\n=== Cycle completed at\n", stderr);
+  aOut += "Cycle completed at\n";
+  it->mResource->Print(*it, aOut, true);
 
-    return maybeImminent;
+  return maybeImminent;
 }
 
 
 //
 // Debug implementation of (OffTheBooks)Mutex
 void
 OffTheBooksMutex::Lock()
 {
-    CallStack callContext = CallStack();
+  CallStack callContext = CallStack();
 
-    CheckAcquire(callContext);
-    PR_Lock(mLock);
-    Acquire(callContext);       // protected by mLock
+  CheckAcquire(callContext);
+  PR_Lock(mLock);
+  Acquire(callContext);       // protected by mLock
 }
 
 void
 OffTheBooksMutex::Unlock()
 {
-    Release();                  // protected by mLock
-    PRStatus status = PR_Unlock(mLock);
-    NS_ASSERTION(PR_SUCCESS == status, "bad Mutex::Unlock()");
+  Release();                  // protected by mLock
+  PRStatus status = PR_Unlock(mLock);
+  NS_ASSERTION(PR_SUCCESS == status, "bad Mutex::Unlock()");
 }
 
 
 //
 // Debug implementation of ReentrantMonitor
 void
 ReentrantMonitor::Enter()
 {
-    BlockingResourceBase* chainFront = ResourceChainFront();
+  BlockingResourceBase* chainFront = ResourceChainFront();
+
+  // the code below implements monitor reentrancy semantics
+
+  if (this == chainFront) {
+    // immediately re-entered the monitor: acceptable
+    PR_EnterMonitor(mReentrantMonitor);
+    ++mEntryCount;
+    return;
+  }
+
+  CallStack callContext = CallStack();
 
-    // the code below implements monitor reentrancy semantics
+  // this is sort of a hack around not recording the thread that
+  // owns this monitor
+  if (chainFront) {
+    for (BlockingResourceBase* br = ResourceChainPrev(chainFront);
+         br;
+         br = ResourceChainPrev(br)) {
+      if (br == this) {
+        NS_WARNING(
+          "Re-entering ReentrantMonitor after acquiring other resources.\n"
+          "At calling context\n");
+        GetAcquisitionContext().Print(stderr);
 
-    if (this == chainFront) {
-        // immediately re-entered the monitor: acceptable
+        // show the caller why this is potentially bad
+        CheckAcquire(callContext);
+
         PR_EnterMonitor(mReentrantMonitor);
         ++mEntryCount;
         return;
+      }
     }
-
-    CallStack callContext = CallStack();
-    
-    // this is sort of a hack around not recording the thread that
-    // owns this monitor
-    if (chainFront) {
-        for (BlockingResourceBase* br = ResourceChainPrev(chainFront);
-             br;
-             br = ResourceChainPrev(br)) {
-            if (br == this) {
-                NS_WARNING(
-                    "Re-entering ReentrantMonitor after acquiring other resources.\n"
-                    "At calling context\n");
-                GetAcquisitionContext().Print(stderr);
+  }
 
-                // show the caller why this is potentially bad
-                CheckAcquire(callContext);
-
-                PR_EnterMonitor(mReentrantMonitor);
-                ++mEntryCount;
-                return;
-            }
-        }
-    }
-
-    CheckAcquire(callContext);
-    PR_EnterMonitor(mReentrantMonitor);
-    NS_ASSERTION(0 == mEntryCount, "ReentrantMonitor isn't free!");
-    Acquire(callContext);       // protected by mReentrantMonitor
-    mEntryCount = 1;
+  CheckAcquire(callContext);
+  PR_EnterMonitor(mReentrantMonitor);
+  NS_ASSERTION(mEntryCount == 0, "ReentrantMonitor isn't free!");
+  Acquire(callContext);       // protected by mReentrantMonitor
+  mEntryCount = 1;
 }
 
 void
 ReentrantMonitor::Exit()
 {
-    if (0 == --mEntryCount)
-        Release();              // protected by mReentrantMonitor
-    PRStatus status = PR_ExitMonitor(mReentrantMonitor);
-    NS_ASSERTION(PR_SUCCESS == status, "bad ReentrantMonitor::Exit()");
+  if (--mEntryCount == 0) {
+    Release();              // protected by mReentrantMonitor
+  }
+  PRStatus status = PR_ExitMonitor(mReentrantMonitor);
+  NS_ASSERTION(PR_SUCCESS == status, "bad ReentrantMonitor::Exit()");
 }
 
 nsresult
-ReentrantMonitor::Wait(PRIntervalTime interval)
+ReentrantMonitor::Wait(PRIntervalTime aInterval)
 {
-    AssertCurrentThreadIn();
+  AssertCurrentThreadIn();
 
-    // save monitor state and reset it to empty
-    int32_t savedEntryCount = mEntryCount;
-    CallStack savedAcquisitionContext = GetAcquisitionContext();
-    BlockingResourceBase* savedChainPrev = mChainPrev;
-    mEntryCount = 0;
-    SetAcquisitionContext(CallStack::kNone);
-    mChainPrev = 0;
+  // save monitor state and reset it to empty
+  int32_t savedEntryCount = mEntryCount;
+  CallStack savedAcquisitionContext = GetAcquisitionContext();
+  BlockingResourceBase* savedChainPrev = mChainPrev;
+  mEntryCount = 0;
+  SetAcquisitionContext(CallStack::kNone);
+  mChainPrev = 0;
 
-    nsresult rv;
+  nsresult rv;
 #ifdef MOZILLA_INTERNAL_API
-    {
-        GeckoProfilerSleepRAII profiler_sleep;
+  {
+    GeckoProfilerSleepRAII profiler_sleep;
 #endif //MOZILLA_INTERNAL_API
 
     // give up the monitor until we're back from Wait()
-    rv = PR_Wait(mReentrantMonitor, interval) == PR_SUCCESS ?
-            NS_OK : NS_ERROR_FAILURE;
+    rv = PR_Wait(mReentrantMonitor, aInterval) == PR_SUCCESS ? NS_OK :
+                                                               NS_ERROR_FAILURE;
 
 #ifdef MOZILLA_INTERNAL_API
-    }
+  }
 #endif //MOZILLA_INTERNAL_API
 
-    // restore saved state
-    mEntryCount = savedEntryCount;
-    SetAcquisitionContext(savedAcquisitionContext);
-    mChainPrev = savedChainPrev;
+  // restore saved state
+  mEntryCount = savedEntryCount;
+  SetAcquisitionContext(savedAcquisitionContext);
+  mChainPrev = savedChainPrev;
 
-    return rv;
+  return rv;
 }
 
 
 //
 // Debug implementation of CondVar
 nsresult
-CondVar::Wait(PRIntervalTime interval)
+CondVar::Wait(PRIntervalTime aInterval)
 {
-    AssertCurrentThreadOwnsMutex();
+  AssertCurrentThreadOwnsMutex();
 
-    // save mutex state and reset to empty
-    CallStack savedAcquisitionContext = mLock->GetAcquisitionContext();
-    BlockingResourceBase* savedChainPrev = mLock->mChainPrev;
-    mLock->SetAcquisitionContext(CallStack::kNone);
-    mLock->mChainPrev = 0;
+  // save mutex state and reset to empty
+  CallStack savedAcquisitionContext = mLock->GetAcquisitionContext();
+  BlockingResourceBase* savedChainPrev = mLock->mChainPrev;
+  mLock->SetAcquisitionContext(CallStack::kNone);
+  mLock->mChainPrev = 0;
 
-    // give up mutex until we're back from Wait()
-    nsresult rv =
-        PR_WaitCondVar(mCvar, interval) == PR_SUCCESS ?
-            NS_OK : NS_ERROR_FAILURE;
+  // give up mutex until we're back from Wait()
+  nsresult rv =
+    PR_WaitCondVar(mCvar, aInterval) == PR_SUCCESS ? NS_OK : NS_ERROR_FAILURE;
 
-    // restore saved state
-    mLock->SetAcquisitionContext(savedAcquisitionContext);
-    mLock->mChainPrev = savedChainPrev;
+  // restore saved state
+  mLock->SetAcquisitionContext(savedAcquisitionContext);
+  mLock->mChainPrev = savedChainPrev;
 
-    return rv;
+  return rv;
 }
 
 #endif // ifdef DEBUG
 
 
 } // namespace mozilla
--- a/xpcom/glue/BlockingResourceBase.h
+++ b/xpcom/glue/BlockingResourceBase.h
@@ -29,318 +29,315 @@
 // This header is not meant to be included by client code.
 //
 
 namespace mozilla {
 
 
 /**
  * BlockingResourceBase
- * Base class of resources that might block clients trying to acquire them.  
+ * Base class of resources that might block clients trying to acquire them.
  * Does debugging and deadlock detection in DEBUG builds.
  **/
 class NS_COM_GLUE BlockingResourceBase
 {
 public:
-    // Needs to be kept in sync with kResourceTypeNames.
-    enum BlockingResourceType { eMutex, eReentrantMonitor, eCondVar };
+  // Needs to be kept in sync with kResourceTypeNames.
+  enum BlockingResourceType { eMutex, eReentrantMonitor, eCondVar };
 
-    /**
-     * kResourceTypeName
-     * Human-readable version of BlockingResourceType enum.
-     */
-    static const char* const kResourceTypeName[];
+  /**
+   * kResourceTypeName
+   * Human-readable version of BlockingResourceType enum.
+   */
+  static const char* const kResourceTypeName[];
 
 
 #ifdef DEBUG
 
 private:
-    // forward declaration for the following typedef
-    struct DeadlockDetectorEntry;
-
-    // ``DDT'' = ``Deadlock Detector Type''
-    typedef DeadlockDetector<DeadlockDetectorEntry> DDT;
+  // forward declaration for the following typedef
+  struct DeadlockDetectorEntry;
 
-    /**
-     * DeadlockDetectorEntry
-     * We free BlockingResources, but we never free entries in the
-     * deadlock detector.  This struct outlives its BlockingResource
-     * and preserves all the state needed to print subsequent
-     * error messages.
-     *
-     * These objects are owned by the deadlock detector.
-     */
-    struct DeadlockDetectorEntry
-    {
-        DeadlockDetectorEntry(const char* aName,
-                              BlockingResourceType aType) :
-            mName(aName),
-            mType(aType),
-            mAcquisitionContext(CallStack::kNone)
-        {
-            NS_ABORT_IF_FALSE(mName, "Name must be nonnull");
-        }
-        
-        /**
-         * Print
-         * Write a description of this blocking resource to |out|.  If
-         * the resource appears to be currently acquired, the current
-         * acquisition context is printed and true is returned.
-         * Otherwise, we print the context from |aFirstSeen|, the
-         * first acquisition from which the code calling |Print()|
-         * became interested in us, and return false.  |Print()| can
-         * be forced to print the context from |aFirstSeen| regardless
-         * by passing |aPrintFirstSeenCx=true|.
-         *
-         * *NOT* thread safe.  Reads |mAcquisitionContext| without
-         * synchronization, but this will not cause correctness
-         * problems.
-         *
-         * 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 |out|
-         */
-        bool Print(const DDT::ResourceAcquisition& aFirstSeen,
-                   nsACString& out,
-                   bool aPrintFirstSeenCx=false) const;
-
-        /**
-         * mName
-         * A descriptive name for this resource.  Used in error
-         * messages etc.
-         */
-        const char* mName;
-        /**
-         * mType
-         * The more specific type of this resource.  Used to implement
-         * special semantics (e.g., reentrancy of monitors).
-         **/
-        BlockingResourceType mType;
-        /**
-         * mAcquisitionContext
-         * The calling context from which this resource was acquired, or
-         * |CallStack::kNone| if it is currently free (or freed).
-         */
-        CallStack mAcquisitionContext;
-    };
+  // ``DDT'' = ``Deadlock Detector Type''
+  typedef DeadlockDetector<DeadlockDetectorEntry> DDT;
 
-protected:
-    /**
-     * BlockingResourceBase
-     * Initialize this blocking resource.  Also hooks the resource into
-     * instrumentation code.
-     *
-     * Thread safe.
-     *
-     * @param aName A meaningful, unique name that can be used in
-     *              error messages, et al.
-     * @param aType The specific type of |this|, if any.
-     **/
-    BlockingResourceBase(const char* aName, BlockingResourceType aType);
-
-    ~BlockingResourceBase();
-
-    /**
-     * CheckAcquire
-     *
-     * Thread safe.
-     *
-     * @param aCallContext the client's calling context from which the
-     *        original acquisition request was made.
-     **/
-    void CheckAcquire(const CallStack& aCallContext);
-
-    /**
-     * Acquire
-     *
-     * *NOT* thread safe.  Requires ownership of underlying resource.
-     *
-     * @param aCallContext the client's calling context from which the
-     *        original acquisition request was made.
-     **/
-    void Acquire(const CallStack& aCallContext); //NS_NEEDS_RESOURCE(this)
-
-    /**
-     * Release
-     * Remove this resource from the current thread's acquisition chain.
-     * The resource does not have to be at the front of the chain, although
-     * it is confusing to release resources in a different order than they
-     * are acquired.  This generates a warning.
-     *
-     * *NOT* thread safe.  Requires ownership of underlying resource.
-     **/
-    void Release();             //NS_NEEDS_RESOURCE(this)
-
-    /**
-     * PrintCycle
-     * Append to |out| detailed information about the circular
-     * dependency in |cycle|.  Returns true if it *appears* that this
-     * cycle may represent an imminent deadlock, but this is merely a
-     * heuristic; the value returned may be a false positive or false
-     * negative.
-     *
-     * *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 |out|
-     */
-    static bool PrintCycle(const DDT::ResourceAcquisitionArray* cycle,
-                           nsACString& out);
-
-    /**
-     * ResourceChainFront
-     *
-     * Thread safe.
-     *
-     * @return the front of the resource acquisition chain, i.e., the last
-     *         resource acquired.
-     */
-    static BlockingResourceBase* ResourceChainFront()
+  /**
+   * DeadlockDetectorEntry
+   * We free BlockingResources, but we never free entries in the
+   * deadlock detector.  This struct outlives its BlockingResource
+   * and preserves all the state needed to print subsequent
+   * error messages.
+   *
+   * These objects are owned by the deadlock detector.
+   */
+  struct DeadlockDetectorEntry
+  {
+    DeadlockDetectorEntry(const char* aName,
+                          BlockingResourceType aType)
+      : mName(aName)
+      , mType(aType)
+      , mAcquisitionContext(CallStack::kNone)
     {
-        return (BlockingResourceBase*)
-            PR_GetThreadPrivate(sResourceAcqnChainFrontTPI);
+      NS_ABORT_IF_FALSE(mName, "Name must be nonnull");
     }
 
     /**
-     * ResourceChainPrev
+     * Print
+     * Write a description of this blocking resource to |aOut|.  If
+     * the resource appears to be currently acquired, the current
+     * acquisition context is printed and true is returned.
+     * Otherwise, we print the context from |aFirstSeen|, the
+     * first acquisition from which the code calling |Print()|
+     * became interested in us, and return false.  |Print()| can
+     * be forced to print the context from |aFirstSeen| regardless
+     * by passing |aPrintFirstSeenCx=true|.
      *
-     * *NOT* thread safe.  Requires ownership of underlying resource.
-     */
-    static BlockingResourceBase*
-    ResourceChainPrev(const BlockingResourceBase* aResource)
-    {
-        return aResource->mChainPrev;
-    } //NS_NEEDS_RESOURCE(this)
-
-    /**
-     * ResourceChainAppend
-     * Set |this| to the front of the resource acquisition chain, and link
-     * |this| to |aPrev|.
+     * *NOT* thread safe.  Reads |mAcquisitionContext| without
+     * synchronization, but this will not cause correctness
+     * problems.
      *
-     * *NOT* thread safe.  Requires ownership of underlying resource.
-     */
-    void ResourceChainAppend(BlockingResourceBase* aPrev)
-    {
-        mChainPrev = aPrev;
-        PR_SetThreadPrivate(sResourceAcqnChainFrontTPI, this);
-    } //NS_NEEDS_RESOURCE(this)
-
-    /**
-     * ResourceChainRemove
-     * Remove |this| from the front of the resource acquisition chain.
-     *
-     * *NOT* thread safe.  Requires ownership of underlying resource.
+     * 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|
      */
-    void ResourceChainRemove()
-    {
-        NS_ASSERTION(this == ResourceChainFront(), "not at chain front");
-        PR_SetThreadPrivate(sResourceAcqnChainFrontTPI, mChainPrev);
-    } //NS_NEEDS_RESOURCE(this)
-
-    /**
-     * GetAcquisitionContext
-     * Return the calling context from which this resource was acquired,
-     * or CallStack::kNone if it's currently free.
-     *
-     * *NOT* thread safe.  Requires ownership of underlying resource.
-     */
-    CallStack
-    GetAcquisitionContext()
-    {
-        return mDDEntry->mAcquisitionContext;
-    }
-
-    /**
-     * SetAcquisitionContext
-     * Set the calling context from which this resource was acquired.
-     *
-     * *NOT* thread safe.  Requires ownership of underlying resource.
-     */
-    void
-    SetAcquisitionContext(CallStack aAcquisitionContext)
-    {
-        mDDEntry->mAcquisitionContext = aAcquisitionContext;
-    }
+    bool Print(const DDT::ResourceAcquisition& aFirstSeen,
+               nsACString& aOut,
+               bool aPrintFirstSeenCx = false) const;
 
     /**
-     * mChainPrev
-     * A series of resource acquisitions creates a chain of orders.  This
-     * chain is implemented as a linked list; |mChainPrev| points to the
-     * resource most recently Acquire()'d before this one.
+     * mName
+     * A descriptive name for this resource.  Used in error
+     * messages etc.
+     */
+    const char* mName;
+    /**
+     * mType
+     * The more specific type of this resource.  Used to implement
+     * special semantics (e.g., reentrancy of monitors).
      **/
-    BlockingResourceBase* mChainPrev;
+    BlockingResourceType mType;
+    /**
+     * mAcquisitionContext
+     * The calling context from which this resource was acquired, or
+     * |CallStack::kNone| if it is currently free (or freed).
+     */
+    CallStack mAcquisitionContext;
+  };
+
+protected:
+  /**
+   * BlockingResourceBase
+   * Initialize this blocking resource.  Also hooks the resource into
+   * instrumentation code.
+   *
+   * Thread safe.
+   *
+   * @param aName A meaningful, unique name that can be used in
+   *              error messages, et al.
+   * @param aType The specific type of |this|, if any.
+   **/
+  BlockingResourceBase(const char* aName, BlockingResourceType aType);
+
+  ~BlockingResourceBase();
+
+  /**
+   * CheckAcquire
+   *
+   * Thread safe.
+   *
+   * @param aCallContext the client's calling context from which the
+   *        original acquisition request was made.
+   **/
+  void CheckAcquire(const CallStack& aCallContext);
+
+  /**
+   * Acquire
+   *
+   * *NOT* thread safe.  Requires ownership of underlying resource.
+   *
+   * @param aCallContext the client's calling context from which the
+   *        original acquisition request was made.
+   **/
+  void Acquire(const CallStack& aCallContext); //NS_NEEDS_RESOURCE(this)
+
+  /**
+   * Release
+   * Remove this resource from the current thread's acquisition chain.
+   * The resource does not have to be at the front of the chain, although
+   * it is confusing to release resources in a different order than they
+   * are acquired.  This generates a warning.
+   *
+   * *NOT* thread safe.  Requires ownership of underlying resource.
+   **/
+  void Release();             //NS_NEEDS_RESOURCE(this)
+
+  /**
+   * PrintCycle
+   * Append to |aOut| detailed information about the circular
+   * dependency in |aCycle|.  Returns true if it *appears* that this
+   * cycle may represent an imminent deadlock, but this is merely a
+   * heuristic; the value returned may be a false positive or false
+   * negative.
+   *
+   * *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|
+   */
+  static bool PrintCycle(const DDT::ResourceAcquisitionArray* aCycle,
+                         nsACString& aOut);
+
+  /**
+   * ResourceChainFront
+   *
+   * Thread safe.
+   *
+   * @return the front of the resource acquisition chain, i.e., the last
+   *         resource acquired.
+   */
+  static BlockingResourceBase* ResourceChainFront()
+  {
+    return
+      (BlockingResourceBase*)PR_GetThreadPrivate(sResourceAcqnChainFrontTPI);
+  }
+
+  /**
+   * ResourceChainPrev
+   *
+   * *NOT* thread safe.  Requires ownership of underlying resource.
+   */
+  static BlockingResourceBase* ResourceChainPrev(
+      const BlockingResourceBase* aResource)
+  {
+    return aResource->mChainPrev;
+  } //NS_NEEDS_RESOURCE(this)
+
+  /**
+   * ResourceChainAppend
+   * Set |this| to the front of the resource acquisition chain, and link
+   * |this| to |aPrev|.
+   *
+   * *NOT* thread safe.  Requires ownership of underlying resource.
+   */
+  void ResourceChainAppend(BlockingResourceBase* aPrev)
+  {
+    mChainPrev = aPrev;
+    PR_SetThreadPrivate(sResourceAcqnChainFrontTPI, this);
+  } //NS_NEEDS_RESOURCE(this)
+
+  /**
+   * ResourceChainRemove
+   * Remove |this| from the front of the resource acquisition chain.
+   *
+   * *NOT* thread safe.  Requires ownership of underlying resource.
+   */
+  void ResourceChainRemove()
+  {
+    NS_ASSERTION(this == ResourceChainFront(), "not at chain front");
+    PR_SetThreadPrivate(sResourceAcqnChainFrontTPI, mChainPrev);
+  } //NS_NEEDS_RESOURCE(this)
+
+  /**
+   * GetAcquisitionContext
+   * Return the calling context from which this resource was acquired,
+   * or CallStack::kNone if it's currently free.
+   *
+   * *NOT* thread safe.  Requires ownership of underlying resource.
+   */
+  CallStack GetAcquisitionContext()
+  {
+    return mDDEntry->mAcquisitionContext;
+  }
+
+  /**
+   * SetAcquisitionContext
+   * Set the calling context from which this resource was acquired.
+   *
+   * *NOT* thread safe.  Requires ownership of underlying resource.
+   */
+  void SetAcquisitionContext(CallStack aAcquisitionContext)
+  {
+    mDDEntry->mAcquisitionContext = aAcquisitionContext;
+  }
+
+  /**
+   * mChainPrev
+   * A series of resource acquisitions creates a chain of orders.  This
+   * chain is implemented as a linked list; |mChainPrev| points to the
+   * resource most recently Acquire()'d before this one.
+   **/
+  BlockingResourceBase* mChainPrev;
 
 private:
-    /**
-     * mDDEntry
-     * The key for this BlockingResourceBase in the deadlock detector.
-     */
-    DeadlockDetectorEntry* mDDEntry;
+  /**
+   * mDDEntry
+   * The key for this BlockingResourceBase in the deadlock detector.
+   */
+  DeadlockDetectorEntry* mDDEntry;
 
-    /**
-     * sCallOnce
-     * Ensures static members are initialized only once, and in a
-     * thread-safe way.
-     */
-    static PRCallOnceType sCallOnce;
+  /**
+   * sCallOnce
+   * Ensures static members are initialized only once, and in a
+   * thread-safe way.
+   */
+  static PRCallOnceType sCallOnce;
 
-    /**
-     * sResourceAcqnChainFrontTPI
-     * Thread-private index to the front of each thread's resource
-     * acquisition chain.
-     */
-    static unsigned sResourceAcqnChainFrontTPI;
+  /**
+   * sResourceAcqnChainFrontTPI
+   * Thread-private index to the front of each thread's resource
+   * acquisition chain.
+   */
+  static unsigned sResourceAcqnChainFrontTPI;
 
-    /**
-     * sDeadlockDetector
-     * Does as named.
-     */
-    static DDT* sDeadlockDetector;
+  /**
+   * sDeadlockDetector
+   * Does as named.
+   */
+  static DDT* sDeadlockDetector;
 
-    /**
-     * InitStatics
-     * Inititialize static members of BlockingResourceBase that can't
-     * be statically initialized.
-     *
-     * *NOT* thread safe.
-     */
-    static PRStatus InitStatics() {
-        PR_NewThreadPrivateIndex(&sResourceAcqnChainFrontTPI, 0);
-        sDeadlockDetector = new DDT();
-        if (!sDeadlockDetector)
-            NS_RUNTIMEABORT("can't allocate deadlock detector");
-        return PR_SUCCESS;
+  /**
+   * InitStatics
+   * Inititialize static members of BlockingResourceBase that can't
+   * be statically initialized.
+   *
+   * *NOT* thread safe.
+   */
+  static PRStatus InitStatics()
+  {
+    PR_NewThreadPrivateIndex(&sResourceAcqnChainFrontTPI, 0);
+    sDeadlockDetector = new DDT();
+    if (!sDeadlockDetector) {
+      NS_RUNTIMEABORT("can't allocate deadlock detector");
     }
+    return PR_SUCCESS;
+  }
 
-    /**
-     * Shutdown
-     * Free static members.
-     *
-     * *NOT* thread safe.
-     */
-    static void Shutdown() {
-        delete sDeadlockDetector;
-        sDeadlockDetector = 0;
-    }
+  /**
+   * Shutdown
+   * Free static members.
+   *
+   * *NOT* thread safe.
+   */
+  static void Shutdown()
+  {
+    delete sDeadlockDetector;
+    sDeadlockDetector = 0;
+  }
 
 #  ifdef MOZILLA_INTERNAL_API
-    // so it can call BlockingResourceBase::Shutdown()
-    friend void LogTerm();
+  // so it can call BlockingResourceBase::Shutdown()
+  friend void LogTerm();
 #  endif  // ifdef MOZILLA_INTERNAL_API
 
 #else  // non-DEBUG implementation
 
-    BlockingResourceBase(const char* aName, BlockingResourceType aType)
-    {
-    }
+  BlockingResourceBase(const char* aName, BlockingResourceType aType) {}
 
-    ~BlockingResourceBase()
-    {
-    }
+  ~BlockingResourceBase() {}
 
 #endif
 };
 
 
 } // namespace mozilla
 
 
--- a/xpcom/glue/CondVar.h
+++ b/xpcom/glue/CondVar.h
@@ -16,134 +16,129 @@
 #include "GeckoProfiler.h"
 #endif //MOZILLA_INTERNAL_API
 
 namespace mozilla {
 
 
 /**
  * CondVar
- * Vanilla condition variable.  Please don't use this unless you have a 
+ * Vanilla condition variable.  Please don't use this unless you have a
  * compelling reason --- Monitor provides a simpler API.
  */
 class NS_COM_GLUE CondVar : BlockingResourceBase
 {
 public:
-    /**
-     * CondVar
-     *
-     * The CALLER owns |lock|.
-     *
-     * @param aLock A Mutex to associate with this condition variable.
-     * @param aName A name which can reference this monitor
-     * @returns If failure, nullptr.
-     *          If success, a valid Monitor* which must be destroyed
-     *          by Monitor::DestroyMonitor()
-     **/
-    CondVar(Mutex& aLock, const char* aName) :
-        BlockingResourceBase(aName, eCondVar),
-        mLock(&aLock)
-    {
-        MOZ_COUNT_CTOR(CondVar);
-        // |lock| must necessarily already be known to the deadlock detector
-        mCvar = PR_NewCondVar(mLock->mLock);
-        if (!mCvar)
-            NS_RUNTIMEABORT("Can't allocate mozilla::CondVar");
+  /**
+   * CondVar
+   *
+   * The CALLER owns |aLock|.
+   *
+   * @param aLock A Mutex to associate with this condition variable.
+   * @param aName A name which can reference this monitor
+   * @returns If failure, nullptr.
+   *          If success, a valid Monitor* which must be destroyed
+   *          by Monitor::DestroyMonitor()
+   **/
+  CondVar(Mutex& aLock, const char* aName)
+    : BlockingResourceBase(aName, eCondVar)
+    , mLock(&aLock)
+  {
+    MOZ_COUNT_CTOR(CondVar);
+    // |aLock| must necessarily already be known to the deadlock detector
+    mCvar = PR_NewCondVar(mLock->mLock);
+    if (!mCvar) {
+      NS_RUNTIMEABORT("Can't allocate mozilla::CondVar");
     }
+  }
 
-    /**
-     * ~CondVar
-     * Clean up after this CondVar, but NOT its associated Mutex.
-     **/
-    ~CondVar()
-    {
-        NS_ASSERTION(mCvar && mLock,
-                     "improperly constructed CondVar or double free");
-        PR_DestroyCondVar(mCvar);
-        mCvar = 0;
-        mLock = 0;
-        MOZ_COUNT_DTOR(CondVar);
-    }
+  /**
+   * ~CondVar
+   * Clean up after this CondVar, but NOT its associated Mutex.
+   **/
+  ~CondVar()
+  {
+    NS_ASSERTION(mCvar && mLock,
+                 "improperly constructed CondVar or double free");
+    PR_DestroyCondVar(mCvar);
+    mCvar = 0;
+    mLock = 0;
+    MOZ_COUNT_DTOR(CondVar);
+  }
 
 #ifndef DEBUG
-    /** 
-     * Wait
-     * @see prcvar.h 
-     **/      
-    nsresult Wait(PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT)
-    {
+  /**
+   * Wait
+   * @see prcvar.h
+   **/
+  nsresult Wait(PRIntervalTime aInterval = PR_INTERVAL_NO_TIMEOUT)
+  {
 
 #ifdef MOZILLA_INTERNAL_API
-        GeckoProfilerSleepRAII profiler_sleep;
+    GeckoProfilerSleepRAII profiler_sleep;
 #endif //MOZILLA_INTERNAL_API
-        // NSPR checks for lock ownership
-        return PR_WaitCondVar(mCvar, interval) == PR_SUCCESS
-            ? NS_OK : NS_ERROR_FAILURE;
-    }
+    // NSPR checks for lock ownership
+    return PR_WaitCondVar(mCvar, aInterval) == PR_SUCCESS ? NS_OK :
+                                                            NS_ERROR_FAILURE;
+  }
 #else
-    nsresult Wait(PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT);
+  nsresult Wait(PRIntervalTime aInterval = PR_INTERVAL_NO_TIMEOUT);
 #endif // ifndef DEBUG
 
-    /** 
-     * Notify
-     * @see prcvar.h 
-     **/      
-    nsresult Notify()
-    {
-        // NSPR checks for lock ownership
-        return PR_NotifyCondVar(mCvar) == PR_SUCCESS
-            ? NS_OK : NS_ERROR_FAILURE;
-    }
+  /**
+   * Notify
+   * @see prcvar.h
+   **/
+  nsresult Notify()
+  {
+    // NSPR checks for lock ownership
+    return PR_NotifyCondVar(mCvar) == PR_SUCCESS ? NS_OK : NS_ERROR_FAILURE;
+  }
 
-    /** 
-     * NotifyAll
-     * @see prcvar.h 
-     **/      
-    nsresult NotifyAll()
-    {
-        // NSPR checks for lock ownership
-        return PR_NotifyAllCondVar(mCvar) == PR_SUCCESS
-            ? NS_OK : NS_ERROR_FAILURE;
-    }
+  /**
+   * NotifyAll
+   * @see prcvar.h
+   **/
+  nsresult NotifyAll()
+  {
+    // NSPR checks for lock ownership
+    return PR_NotifyAllCondVar(mCvar) == PR_SUCCESS ? NS_OK : NS_ERROR_FAILURE;
+  }
 
 #ifdef DEBUG
-    /**
-     * AssertCurrentThreadOwnsMutex
-     * @see Mutex::AssertCurrentThreadOwns
-     **/
-    void AssertCurrentThreadOwnsMutex()
-    {
-        mLock->AssertCurrentThreadOwns();
-    }
+  /**
+   * AssertCurrentThreadOwnsMutex
+   * @see Mutex::AssertCurrentThreadOwns
+   **/
+  void AssertCurrentThreadOwnsMutex()
+  {
+    mLock->AssertCurrentThreadOwns();
+  }
 
-    /**
-     * AssertNotCurrentThreadOwnsMutex
-     * @see Mutex::AssertNotCurrentThreadOwns
-     **/
-    void AssertNotCurrentThreadOwnsMutex()
-    {
-        mLock->AssertNotCurrentThreadOwns();
-    }
+  /**
+   * AssertNotCurrentThreadOwnsMutex
+   * @see Mutex::AssertNotCurrentThreadOwns
+   **/
+  void AssertNotCurrentThreadOwnsMutex()
+  {
+    mLock->AssertNotCurrentThreadOwns();
+  }
 
 #else
-    void AssertCurrentThreadOwnsMutex()
-    {
-    }
-    void AssertNotCurrentThreadOwnsMutex()
-    {
-    }
+  void AssertCurrentThreadOwnsMutex() {}
+  void AssertNotCurrentThreadOwnsMutex() {}
 
 #endif  // ifdef DEBUG
 
 private:
-    CondVar();
-    CondVar(CondVar&);
-    CondVar& operator=(CondVar&);
+  CondVar();
+  CondVar(CondVar&);
+  CondVar& operator=(CondVar&);
 
-    Mutex* mLock;
-    PRCondVar* mCvar;
+  Mutex* mLock;
+  PRCondVar* mCvar;
 };
 
 
 } // namespace mozilla
 
 
 #endif  // ifndef mozilla_CondVar_h  
--- a/xpcom/glue/DeadlockDetector.cpp
+++ b/xpcom/glue/DeadlockDetector.cpp
@@ -2,10 +2,10 @@
  * vim: sw=4 ts=4 et :
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "DeadlockDetector.h"
 
 namespace mozilla {
-const CallStack CallStack::kNone((CallStack::callstack_id) -1);
+const CallStack CallStack::kNone((CallStack::callstack_id)-1);
 }
--- a/xpcom/glue/DeadlockDetector.h
+++ b/xpcom/glue/DeadlockDetector.h
@@ -23,81 +23,81 @@ namespace mozilla {
 
 
 // FIXME bug 456272: split this off into a convenience API on top of
 // nsStackWalk?
 class NS_COM_GLUE CallStack
 {
 private:
 #ifdef NS_TRACE_MALLOC
-    typedef nsTMStackTraceID callstack_id;
-    // needs to be a macro to avoid disturbing the backtrace
+  typedef nsTMStackTraceID callstack_id;
+  // needs to be a macro to avoid disturbing the backtrace
 #   define NS_GET_BACKTRACE() NS_TraceMallocGetStackTrace()
 #   define NS_DEADLOCK_DETECTOR_CONSTEXPR
 #else
-    typedef void* callstack_id;
+  typedef void* callstack_id;
 #   define NS_GET_BACKTRACE() 0
 #   define NS_DEADLOCK_DETECTOR_CONSTEXPR MOZ_CONSTEXPR
 #endif  // ifdef NS_TRACE_MALLOC
 
-    callstack_id mCallStack;
+  callstack_id mCallStack;
 
 public:
-    /**
-     * CallStack
-     * *ALWAYS* *ALWAYS* *ALWAYS* call this with no arguments.  This
-     * constructor takes an argument *ONLY* so that |GET_BACKTRACE()|
-     * can be evaluated in the stack frame of the caller, rather than
-     * that of the constructor.
-     *
-     * *BEWARE*: this means that calling this constructor with no
-     * arguments is not the same as a "default, do-nothing"
-     * constructor: it *will* construct a backtrace.  This can cause
-     * unexpected performance issues.
-     */
-    NS_DEADLOCK_DETECTOR_CONSTEXPR
-    CallStack(const callstack_id aCallStack = NS_GET_BACKTRACE()) :
-        mCallStack(aCallStack)
-    {
-    }
-    NS_DEADLOCK_DETECTOR_CONSTEXPR
-    CallStack(const CallStack& aFrom) :
-        mCallStack(aFrom.mCallStack)
-    {
+  /**
+   * CallStack
+   * *ALWAYS* *ALWAYS* *ALWAYS* call this with no arguments.  This
+   * constructor takes an argument *ONLY* so that |GET_BACKTRACE()|
+   * can be evaluated in the stack frame of the caller, rather than
+   * that of the constructor.
+   *
+   * *BEWARE*: this means that calling this constructor with no
+   * arguments is not the same as a "default, do-nothing"
+   * constructor: it *will* construct a backtrace.  This can cause
+   * unexpected performance issues.
+   */
+  NS_DEADLOCK_DETECTOR_CONSTEXPR
+  CallStack(const callstack_id aCallStack = NS_GET_BACKTRACE())
+    : mCallStack(aCallStack)
+  {
+  }
+  NS_DEADLOCK_DETECTOR_CONSTEXPR
+  CallStack(const CallStack& aFrom)
+    : mCallStack(aFrom.mCallStack)
+  {
+  }
+  CallStack& operator=(const CallStack& aFrom)
+  {
+    mCallStack = aFrom.mCallStack;
+    return *this;
+  }
+  bool operator==(const CallStack& aOther) const
+  {
+    return mCallStack == aOther.mCallStack;
+  }
+  bool operator!=(const CallStack& aOther) const
+  {
+    return mCallStack != aOther.mCallStack;
+  }
+
+  // FIXME bug 456272: if this is split off,
+  // NS_TraceMallocPrintStackTrace should be modified to print into
+  // an nsACString
+  void Print(FILE* aFile) const
+  {
+#ifdef NS_TRACE_MALLOC
+    if (this != &kNone && mCallStack) {
+      NS_TraceMallocPrintStackTrace(aFile, mCallStack);
+      return;
     }
-    CallStack& operator=(const CallStack& aFrom)
-    {
-        mCallStack = aFrom.mCallStack;
-        return *this;
-    }
-    bool operator==(const CallStack& aOther) const
-    {
-        return mCallStack == aOther.mCallStack;
-    }
-    bool operator!=(const CallStack& aOther) const
-    {
-        return mCallStack != aOther.mCallStack;
-    }
+#endif
+    fputs("  [stack trace unavailable]\n", aFile);
+  }
 
-    // FIXME bug 456272: if this is split off,
-    // NS_TraceMallocPrintStackTrace should be modified to print into
-    // an nsACString
-    void Print(FILE* f) const
-    {
-#ifdef NS_TRACE_MALLOC
-        if (this != &kNone && mCallStack) {
-            NS_TraceMallocPrintStackTrace(f, mCallStack);
-            return;
-        }
-#endif
-        fputs("  [stack trace unavailable]\n", f);
-    }
-
-    /** The "null" callstack. */
-    static const CallStack kNone;
+  /** The "null" callstack. */
+  static const CallStack kNone;
 };
 
 
 /**
  * DeadlockDetector
  *
  * The following is an approximate description of how the deadlock detector
  * works.
@@ -135,423 +135,429 @@ public:
  *
  *   l2.lock()   // current chain: [ l1, l3, l2 ]
  *               // order: { l1 <_P l2, l2 <_P l3, l1 <_P l3,
  *                                      l3 <_P l2 (!!!) }
  * BEEP BEEP!  Here the detector will flag a potential error, since
  * l2 and l3 were used inconsistently (and potentially in ways that
  * would deadlock).
  */
-template <typename T>
+template<typename T>
 class DeadlockDetector
 {
 public:
-    /**
-     * ResourceAcquisition
-     * Consists simply of a resource and the calling context from
-     * which it was acquired.  We pack this information together so
-     * that it can be returned back to the caller when a potential
-     * deadlock has been found.
-     */
-    struct ResourceAcquisition
-    {
-        const T* mResource;
-        CallStack mCallContext;
+  /**
+   * ResourceAcquisition
+   * Consists simply of a resource and the calling context from
+   * which it was acquired.  We pack this information together so
+   * that it can be returned back to the caller when a potential
+   * deadlock has been found.
+   */
+  struct ResourceAcquisition
+  {
+    const T* mResource;
+    CallStack mCallContext;
 
-        ResourceAcquisition(
-            const T* aResource,
-            const CallStack aCallContext=CallStack::kNone) :
-            mResource(aResource),
-            mCallContext(aCallContext)
-        {
-        }
-        ResourceAcquisition(const ResourceAcquisition& aFrom) :
-            mResource(aFrom.mResource),
-            mCallContext(aFrom.mCallContext)
-        {
-        }
-        ResourceAcquisition& operator=(const ResourceAcquisition& aFrom)
-        {
-            mResource = aFrom.mResource;
-            mCallContext = aFrom.mCallContext;
-            return *this;
-        }
-    };
-    typedef nsTArray<ResourceAcquisition> ResourceAcquisitionArray;
+    ResourceAcquisition(const T* aResource,
+                        const CallStack aCallContext = CallStack::kNone)
+      : mResource(aResource)
+      , mCallContext(aCallContext)
+    {
+    }
+    ResourceAcquisition(const ResourceAcquisition& aFrom)
+      : mResource(aFrom.mResource)
+      , mCallContext(aFrom.mCallContext)
+    {
+    }
+    ResourceAcquisition& operator=(const ResourceAcquisition& aFrom)
+    {
+      mResource = aFrom.mResource;
+      mCallContext = aFrom.mCallContext;
+      return *this;
+    }
+  };
+  typedef nsTArray<ResourceAcquisition> ResourceAcquisitionArray;
 
 private:
-    typedef nsTArray<PLHashEntry*> HashEntryArray;
-    typedef typename HashEntryArray::index_type index_type;
-    typedef typename HashEntryArray::size_type size_type;
-    static const HashEntryArray::index_type NoIndex = HashEntryArray::NoIndex;
+  typedef nsTArray<PLHashEntry*> HashEntryArray;
+  typedef typename HashEntryArray::index_type index_type;
+  typedef typename HashEntryArray::size_type size_type;
+  static const HashEntryArray::index_type NoIndex = HashEntryArray::NoIndex;
 
-    /**
-     * Value type for the ordering table.  Contains the other
-     * resources on which an ordering constraint |key < other|
-     * exists.  The catch is that we also store the calling context at
-     * which the other resource was acquired; this improves the
-     * quality of error messages when potential deadlock is detected.
-     */
-    struct OrderingEntry
-    {
-        OrderingEntry() :
-            mFirstSeen(CallStack::kNone),
-            mOrderedLT()        // FIXME bug 456272: set to empirical
-        {                       // dep size?
-        }
-        ~OrderingEntry()
-        {
-        }
-
-        CallStack mFirstSeen; // first site from which the resource appeared
-        HashEntryArray mOrderedLT; // this <_o Other
-    };
-
-    static void* TableAlloc(void* /*pool*/, size_t size)
+  /**
+   * Value type for the ordering table.  Contains the other
+   * resources on which an ordering constraint |key < other|
+   * exists.  The catch is that we also store the calling context at
+   * which the other resource was acquired; this improves the
+   * quality of error messages when potential deadlock is detected.
+   */
+  struct OrderingEntry
+  {
+    OrderingEntry()
+      : mFirstSeen(CallStack::kNone)
+      , mOrderedLT()        // FIXME bug 456272: set to empirical dep size?
     {
-        return operator new(size);
     }
-    static void TableFree(void* /*pool*/, void* item)
-    {
-        operator delete(item);
-    }
-    static PLHashEntry* EntryAlloc(void* /*pool*/, const void* key)
-    {
-        return new PLHashEntry;
-    }
-    static void EntryFree(void* /*pool*/, PLHashEntry* entry, unsigned flag)
+    ~OrderingEntry()
     {
-        delete static_cast<T*>(const_cast<void*>(entry->key));
-        delete static_cast<OrderingEntry*>(entry->value);
-        entry->value = 0;
-        if (HT_FREE_ENTRY == flag)
-            delete entry;
-    }
-    static PLHashNumber HashKey(const void* aKey)
-    {
-        return static_cast<PLHashNumber>(NS_PTR_TO_INT32(aKey) >> 2);
-    }
-    static const PLHashAllocOps kAllocOps;
-
-    // Hash table "interface" the rest of the code should use
-
-    PLHashEntry** GetEntry(const T* aKey)
-    {
-        return PL_HashTableRawLookup(mOrdering, HashKey(aKey), aKey);
     }
 
-    void PutEntry(T* aKey)
-    {
-        PL_HashTableAdd(mOrdering, aKey, new OrderingEntry());
-    }
-
-    // XXX need these helper methods because OrderingEntry doesn't have
-    // XXX access to underlying PLHashEntry
+    CallStack mFirstSeen; // first site from which the resource appeared
+    HashEntryArray mOrderedLT; // this <_o Other
+  };
 
-    /**
-     * Add the order |aFirst <_o aSecond|.
-     *
-     * WARNING: this does not check whether it's sane to add this
-     * order.  In the "best" bad case, when this order already exists,
-     * adding it anyway may unnecessarily result in O(n^2) space.  In
-     * the "worst" bad case, adding it anyway will cause
-     * |InTransitiveClosure()| to diverge.
-     */
-    void AddOrder(PLHashEntry* aLT, PLHashEntry* aGT)
-    {
-        static_cast<OrderingEntry*>(aLT->value)->mOrderedLT
-            .InsertElementSorted(aGT);
+  static void* TableAlloc(void* /*aPool*/, size_t aSize)
+  {
+    return operator new(aSize);
+  }
+  static void TableFree(void* /*aPool*/, void* aItem)
+  {
+    operator delete(aItem);
+  }
+  static PLHashEntry* EntryAlloc(void* /*aPool*/, const void* aKey)
+  {
+    return new PLHashEntry;
+  }
+  static void EntryFree(void* /*aPool*/, PLHashEntry* aEntry, unsigned aFlag)
+  {
+    delete static_cast<T*>(const_cast<void*>(aEntry->key));
+    delete static_cast<OrderingEntry*>(aEntry->value);
+    aEntry->value = 0;
+    if (aFlag == HT_FREE_ENTRY) {
+      delete aEntry;
     }
+  }
+  static PLHashNumber HashKey(const void* aKey)
+  {
+    return static_cast<PLHashNumber>(NS_PTR_TO_INT32(aKey) >> 2);
+  }
+  static const PLHashAllocOps kAllocOps;
 
-    /**
-     * Return true iff the order |aFirst < aSecond| has been
-     * *explicitly* added.
-     *
-     * Does not consider transitivity.
-     */
-    bool IsOrdered(const PLHashEntry* aFirst, const PLHashEntry* aSecond)
-        const
-    {
-        return NoIndex !=
-            static_cast<const OrderingEntry*>(aFirst->value)->mOrderedLT
-                .BinaryIndexOf(aSecond);
-    }
+  // Hash table "interface" the rest of the code should use
+
+  PLHashEntry** GetEntry(const T* aKey)
+  {
+    return PL_HashTableRawLookup(mOrdering, HashKey(aKey), aKey);
+  }
+
+  void PutEntry(T* aKey)
+  {
+    PL_HashTableAdd(mOrdering, aKey, new OrderingEntry());
+  }
+
+  // XXX need these helper methods because OrderingEntry doesn't have
+  // XXX access to underlying PLHashEntry
 
-    /**
-     * Return a pointer to the array of all elements "that" for
-     * which the order |this < that| has been explicitly added.
-     *
-     * NOTE: this does *not* consider transitive orderings.
-     */
-    PLHashEntry* const* GetOrders(const PLHashEntry* aEntry) const
-    {
-        return static_cast<const OrderingEntry*>(aEntry->value)->mOrderedLT
-            .Elements();
-    }
+  /**
+   * Add the order |aFirst <_o aSecond|.
+   *
+   * WARNING: this does not check whether it's sane to add this
+   * order.  In the "best" bad case, when this order already exists,
+   * adding it anyway may unnecessarily result in O(n^2) space.  In
+   * the "worst" bad case, adding it anyway will cause
+   * |InTransitiveClosure()| to diverge.
+   */
+  void AddOrder(PLHashEntry* aLT, PLHashEntry* aGT)
+  {
+    static_cast<OrderingEntry*>(aLT->value)->mOrderedLT
+      .InsertElementSorted(aGT);
+  }
+
+  /**
+   * Return true iff the order |aFirst < aSecond| has been
+   * *explicitly* added.
+   *
+   * Does not consider transitivity.
+   */
+  bool IsOrdered(const PLHashEntry* aFirst, const PLHashEntry* aSecond)
+  const
+  {
+    const OrderingEntry* entry =
+      static_cast<const OrderingEntry*>(aFirst->value);
+    return entry->mOrderedLT.BinaryIndexOf(aSecond) != NoIndex;
+  }
 
-    /**
-     * Return the number of elements "that" for which the order
-     * |this < that| has been explicitly added.
-     *
-     * NOTE: this does *not* consider transitive orderings.
-     */
-    size_type NumOrders(const PLHashEntry* aEntry) const
-    {
-        return static_cast<const OrderingEntry*>(aEntry->value)->mOrderedLT
-            .Length();
-    }
+  /**
+   * Return a pointer to the array of all elements "that" for
+   * which the order |this < that| has been explicitly added.
+   *
+   * NOTE: this does *not* consider transitive orderings.
+   */
+  PLHashEntry* const* GetOrders(const PLHashEntry* aEntry) const
+  {
+    return
+      static_cast<const OrderingEntry*>(aEntry->value)->mOrderedLT.Elements();
+  }
 
-    /** Make a ResourceAcquisition out of |aEntry|. */
-    ResourceAcquisition MakeResourceAcquisition(const PLHashEntry* aEntry)
-        const
-    {
-        return ResourceAcquisition(
-            static_cast<const T*>(aEntry->key),
-            static_cast<const OrderingEntry*>(aEntry->value)->mFirstSeen);
-    }
+  /**
+   * Return the number of elements "that" for which the order
+   * |this < that| has been explicitly added.
+   *
+   * NOTE: this does *not* consider transitive orderings.
+   */
+  size_type NumOrders(const PLHashEntry* aEntry) const
+  {
+    return
+      static_cast<const OrderingEntry*>(aEntry->value)->mOrderedLT.Length();
+  }
 
-    // Throwaway RAII lock to make the following code safer.
-    struct PRAutoLock
-    {
-        PRAutoLock(PRLock* aLock) : mLock(aLock) { PR_Lock(mLock); }
-        ~PRAutoLock() { PR_Unlock(mLock); }
-        PRLock* mLock;
-    };
+  /** Make a ResourceAcquisition out of |aEntry|. */
+  ResourceAcquisition MakeResourceAcquisition(const PLHashEntry* aEntry) const
+  {
+    return ResourceAcquisition(
+      static_cast<const T*>(aEntry->key),
+      static_cast<const OrderingEntry*>(aEntry->value)->mFirstSeen);
+  }
+
+  // Throwaway RAII lock to make the following code safer.
+  struct PRAutoLock
+  {
+    PRAutoLock(PRLock* aLock) : mLock(aLock) { PR_Lock(mLock); }
+    ~PRAutoLock() { PR_Unlock(mLock); }
+    PRLock* mLock;
+  };
 
 public:
-    static const uint32_t kDefaultNumBuckets;
+  static const uint32_t kDefaultNumBuckets;
 
-    /**
-     * DeadlockDetector
-     * Create a new deadlock detector.
-     *
-     * @param aNumResourcesGuess Guess at approximate number of resources
-     *        that will be checked.
-     */
-    DeadlockDetector(uint32_t aNumResourcesGuess = kDefaultNumBuckets)
-    {
-        mOrdering = PL_NewHashTable(aNumResourcesGuess,
-                                    HashKey,
-                                    PL_CompareValues, PL_CompareValues,
-                                    &kAllocOps, 0);
-        if (!mOrdering)
-            NS_RUNTIMEABORT("couldn't initialize resource ordering table");
-
-        mLock = PR_NewLock();
-        if (!mLock)
-            NS_RUNTIMEABORT("couldn't allocate deadlock detector lock");
+  /**
+   * DeadlockDetector
+   * Create a new deadlock detector.
+   *
+   * @param aNumResourcesGuess Guess at approximate number of resources
+   *        that will be checked.
+   */
+  DeadlockDetector(uint32_t aNumResourcesGuess = kDefaultNumBuckets)
+  {
+    mOrdering = PL_NewHashTable(aNumResourcesGuess,
+                                HashKey,
+                                PL_CompareValues, PL_CompareValues,
+                                &kAllocOps, 0);
+    if (!mOrdering) {
+      NS_RUNTIMEABORT("couldn't initialize resource ordering table");
     }
 
-    /**
-     * ~DeadlockDetector
-     *
-     * *NOT* thread safe.
-     */
-    ~DeadlockDetector()
-    {
-        PL_HashTableDestroy(mOrdering);
-        PR_DestroyLock(mLock);
+    mLock = PR_NewLock();
+    if (!mLock) {
+      NS_RUNTIMEABORT("couldn't allocate deadlock detector lock");
+    }
+  }
+
+  /**
+   * ~DeadlockDetector
+   *
+   * *NOT* thread safe.
+   */
+  ~DeadlockDetector()
+  {
+    PL_HashTableDestroy(mOrdering);
+    PR_DestroyLock(mLock);
+  }
+
+  /**
+   * Add
+   * Make the deadlock detector aware of |aResource|.
+   *
+   * WARNING: The deadlock detector owns |aResource|.
+   *
+   * Thread safe.
+   *
+   * @param aResource Resource to make deadlock detector aware of.
+   */
+  void Add(T* aResource)
+  {
+    PRAutoLock _(mLock);
+    PutEntry(aResource);
+  }
+
+  // Nb: implementing a Remove() method makes the detector "more
+  // unsound."  By removing a resource from the orderings, deadlocks
+  // may be missed that would otherwise have been found.  However,
+  // removing resources possibly reduces the # of false positives,
+  // and additionally saves space.  So it's a trade off; we have
+  // chosen to err on the side of caution and not implement Remove().
+
+  /**
+   * CheckAcquisition This method is called after acquiring |aLast|,
+   * but before trying to acquire |aProposed| from |aCallContext|.
+   * It determines whether actually trying to acquire |aProposed|
+   * will create problems.  It is OK if |aLast| is nullptr; this is
+   * interpreted as |aProposed| being the thread's first acquisition
+   * of its current chain.
+   *
+   * Iff acquiring |aProposed| may lead to deadlock for some thread
+   * interleaving (including the current one!), the cyclical
+   * dependency from which this was deduced is returned.  Otherwise,
+   * 0 is returned.
+   *
+   * If a potential deadlock is detected and a resource cycle is
+   * returned, it is the *caller's* responsibility to free it.
+   *
+   * Thread safe.
+   *
+   * @param aLast Last resource acquired by calling thread (or 0).
+   * @param aProposed Resource calling thread proposes to acquire.
+   * @param aCallContext Calling context whence acquisiton request came.
+   */
+  ResourceAcquisitionArray* CheckAcquisition(const T* aLast,
+                                             const T* aProposed,
+                                             const CallStack& aCallContext)
+  {
+    NS_ASSERTION(aProposed, "null resource");
+    PRAutoLock _(mLock);
+
+    PLHashEntry* second = *GetEntry(aProposed);
+    OrderingEntry* e = static_cast<OrderingEntry*>(second->value);
+    if (CallStack::kNone == e->mFirstSeen) {
+      e->mFirstSeen = aCallContext;
     }
 
-    /**
-     * Add
-     * Make the deadlock detector aware of |aResource|.
-     *
-     * WARNING: The deadlock detector owns |aResource|.
-     *
-     * Thread safe.
-     *
-     * @param aResource Resource to make deadlock detector aware of.
-     */
-    void Add(T* aResource)
-    {
-        PRAutoLock _(mLock);
-        PutEntry(aResource);
+    if (!aLast) {
+      // don't check if |0 < aProposed|; just vamoose
+      return 0;
     }
 
-    // Nb: implementing a Remove() method makes the detector "more
-    // unsound."  By removing a resource from the orderings, deadlocks
-    // may be missed that would otherwise have been found.  However,
-    // removing resources possibly reduces the # of false positives,
-    // and additionally saves space.  So it's a trade off; we have
-    // chosen to err on the side of caution and not implement Remove().
+    PLHashEntry* first = *GetEntry(aLast);
 
-    /**
-     * CheckAcquisition This method is called after acquiring |aLast|,
-     * but before trying to acquire |aProposed| from |aCallContext|.
-     * It determines whether actually trying to acquire |aProposed|
-     * will create problems.  It is OK if |aLast| is nullptr; this is
-     * interpreted as |aProposed| being the thread's first acquisition
-     * of its current chain.
-     *
-     * Iff acquiring |aProposed| may lead to deadlock for some thread
-     * interleaving (including the current one!), the cyclical
-     * dependency from which this was deduced is returned.  Otherwise,
-     * 0 is returned.
-     *
-     * If a potential deadlock is detected and a resource cycle is
-     * returned, it is the *caller's* responsibility to free it.
-     *
-     * Thread safe.
-     *
-     * @param aLast Last resource acquired by calling thread (or 0).
-     * @param aProposed Resource calling thread proposes to acquire.
-     * @param aCallContext Calling context whence acquisiton request came.
-     */
-    ResourceAcquisitionArray* CheckAcquisition(const T* aLast,
-                                               const T* aProposed,
-                                               const CallStack& aCallContext)
-    {
-        NS_ASSERTION(aProposed, "null resource");
-        PRAutoLock _(mLock);
-
-        PLHashEntry* second = *GetEntry(aProposed);
-        OrderingEntry* e = static_cast<OrderingEntry*>(second->value);
-        if (CallStack::kNone == e->mFirstSeen)
-            e->mFirstSeen = aCallContext;
+    // this is the crux of the deadlock detector algorithm
 
-        if (!aLast)
-            // don't check if |0 < proposed|; just vamoose
-            return 0;
-
-        PLHashEntry* first = *GetEntry(aLast);
-
-        // this is the crux of the deadlock detector algorithm
+    if (first == second) {
+      // reflexive deadlock.  fastpath b/c InTransitiveClosure is
+      // not applicable here.
+      ResourceAcquisitionArray* cycle = new ResourceAcquisitionArray();
+      if (!cycle) {
+        NS_RUNTIMEABORT("can't allocate dep. cycle array");
+      }
+      cycle->AppendElement(MakeResourceAcquisition(first));
+      cycle->AppendElement(ResourceAcquisition(aProposed,
+                                               aCallContext));
+      return cycle;
+    }
+    if (InTransitiveClosure(first, second)) {
+      // we've already established |aLast < aProposed|.  all is well.
+      return 0;
+    }
+    if (InTransitiveClosure(second, first)) {
+      // the order |aProposed < aLast| has been deduced, perhaps
+      // transitively.  we're attempting to violate that
+      // constraint by acquiring resources in the order
+      // |aLast < aProposed|, and thus we may deadlock under the
+      // right conditions.
+      ResourceAcquisitionArray* cycle = GetDeductionChain(second, first);
+      // show how acquiring |aProposed| would complete the cycle
+      cycle->AppendElement(ResourceAcquisition(aProposed,
+                                               aCallContext));
+      return cycle;
+    }
+    // |aLast|, |aProposed| are unordered according to our
+    // poset.  this is fine, but we now need to add this
+    // ordering constraint.
+    AddOrder(first, second);
+    return 0;
+  }
 
-        if (first == second) {
-            // reflexive deadlock.  fastpath b/c InTransitiveClosure is
-            // not applicable here.
-            ResourceAcquisitionArray* cycle = new ResourceAcquisitionArray();
-            if (!cycle)
-                NS_RUNTIMEABORT("can't allocate dep. cycle array");
-            cycle->AppendElement(MakeResourceAcquisition(first));
-            cycle->AppendElement(ResourceAcquisition(aProposed,
-                                                     aCallContext));
-            return cycle;
-        }
-        if (InTransitiveClosure(first, second)) {
-            // we've already established |last < proposed|.  all is well.
-            return 0;
-        }
-        if (InTransitiveClosure(second, first)) {
-            // the order |proposed < last| has been deduced, perhaps
-            // transitively.  we're attempting to violate that
-            // constraint by acquiring resources in the order
-            // |last < proposed|, and thus we may deadlock under the
-            // right conditions.
-            ResourceAcquisitionArray* cycle = GetDeductionChain(second, first);
-            // show how acquiring |proposed| would complete the cycle
-            cycle->AppendElement(ResourceAcquisition(aProposed,
-                                                     aCallContext));
-            return cycle;
-        }
-        // |last|, |proposed| are unordered according to our
-        // poset.  this is fine, but we now need to add this
-        // ordering constraint.
-        AddOrder(first, second);
-        return 0;
+  /**
+   * Return true iff |aTarget| is in the transitive closure of |aStart|
+   * over the ordering relation `<_this'.
+   *
+   * @precondition |aStart != aTarget|
+   */
+  bool InTransitiveClosure(const PLHashEntry* aStart,
+                           const PLHashEntry* aTarget) const
+  {
+    if (IsOrdered(aStart, aTarget)) {
+      return true;
     }
 
-    /**
-     * Return true iff |aTarget| is in the transitive closure of |aStart|
-     * over the ordering relation `<_this'.
-     *
-     * @precondition |aStart != aTarget|
-     */
-    bool InTransitiveClosure(const PLHashEntry* aStart,
-                             const PLHashEntry* aTarget) const
-    {
-        if (IsOrdered(aStart, aTarget))
-            return true;
+    index_type i = 0;
+    size_type len = NumOrders(aStart);
+    for (const PLHashEntry* const* it = GetOrders(aStart); i < len; ++i, ++it) {
+      if (InTransitiveClosure(*it, aTarget)) {
+        return true;
+      }
+    }
+    return false;
+  }
 
-        index_type i = 0;
-        size_type len = NumOrders(aStart);
-        for (const PLHashEntry* const* it = GetOrders(aStart);
-             i < len; ++i, ++it)
-            if (InTransitiveClosure(*it, aTarget))
-                return true;
-        return false;
+  /**
+   * Return an array of all resource acquisitions
+   *   aStart <_this r1 <_this r2 <_ ... <_ aTarget
+   * from which |aStart <_this aTarget| was deduced, including
+   * |aStart| and |aTarget|.
+   *
+   * Nb: there may be multiple deductions of |aStart <_this
+   * aTarget|.  This function returns the first ordering found by
+   * depth-first search.
+   *
+   * Nb: |InTransitiveClosure| could be replaced by this function.
+   * However, this one is more expensive because we record the DFS
+   * search stack on the heap whereas the other doesn't.
+   *
+   * @precondition |aStart != aTarget|
+   */
+  ResourceAcquisitionArray* GetDeductionChain(const PLHashEntry* aStart,
+                                              const PLHashEntry* aTarget)
+  {
+    ResourceAcquisitionArray* chain = new ResourceAcquisitionArray();
+    if (!chain) {
+      NS_RUNTIMEABORT("can't allocate dep. cycle array");
+    }
+    chain->AppendElement(MakeResourceAcquisition(aStart));
+
+    NS_ASSERTION(GetDeductionChain_Helper(aStart, aTarget, chain),
+                 "GetDeductionChain called when there's no deadlock");
+    return chain;
+  }
+
+  // precondition: |aStart != aTarget|
+  // invariant: |aStart| is the last element in |aChain|
+  bool GetDeductionChain_Helper(const PLHashEntry* aStart,
+                                const PLHashEntry* aTarget,
+                                ResourceAcquisitionArray* aChain)
+  {
+    if (IsOrdered(aStart, aTarget)) {
+      aChain->AppendElement(MakeResourceAcquisition(aTarget));
+      return true;
     }
 
-    /**
-     * Return an array of all resource acquisitions
-     *   aStart <_this r1 <_this r2 <_ ... <_ aTarget
-     * from which |aStart <_this aTarget| was deduced, including
-     * |aStart| and |aTarget|.
-     *
-     * Nb: there may be multiple deductions of |aStart <_this
-     * aTarget|.  This function returns the first ordering found by
-     * depth-first search.
-     *
-     * Nb: |InTransitiveClosure| could be replaced by this function.
-     * However, this one is more expensive because we record the DFS
-     * search stack on the heap whereas the other doesn't.
-     *
-     * @precondition |aStart != aTarget|
-     */
-    ResourceAcquisitionArray* GetDeductionChain(
-        const PLHashEntry* aStart,
-        const PLHashEntry* aTarget)
-    {
-        ResourceAcquisitionArray* chain = new ResourceAcquisitionArray();
-        if (!chain)
-            NS_RUNTIMEABORT("can't allocate dep. cycle array");
-        chain->AppendElement(MakeResourceAcquisition(aStart));
-
-        NS_ASSERTION(GetDeductionChain_Helper(aStart, aTarget, chain),
-                     "GetDeductionChain called when there's no deadlock");
-        return chain;
+    index_type i = 0;
+    size_type len = NumOrders(aStart);
+    for (const PLHashEntry* const* it = GetOrders(aStart); i < len; ++i, ++it) {
+      aChain->AppendElement(MakeResourceAcquisition(*it));
+      if (GetDeductionChain_Helper(*it, aTarget, aChain)) {
+        return true;
+      }
+      aChain->RemoveElementAt(aChain->Length() - 1);
     }
+    return false;
+  }
 
-    // precondition: |aStart != aTarget|
-    // invariant: |aStart| is the last element in |aChain|
-    bool GetDeductionChain_Helper(const PLHashEntry* aStart,
-                                  const PLHashEntry* aTarget,
-                                  ResourceAcquisitionArray* aChain)
-    {
-        if (IsOrdered(aStart, aTarget)) {
-            aChain->AppendElement(MakeResourceAcquisition(aTarget));
-            return true;
-        }
+  /**
+   * The partial order on resource acquisitions used by the deadlock
+   * detector.
+   */
+  PLHashTable* mOrdering;     // T* -> PLHashEntry<OrderingEntry>
 
-        index_type i = 0;
-        size_type len = NumOrders(aStart);
-        for (const PLHashEntry* const* it = GetOrders(aStart);
-             i < len; ++i, ++it) {
-            aChain->AppendElement(MakeResourceAcquisition(*it));
-            if (GetDeductionChain_Helper(*it, aTarget, aChain))
-                return true;
-            aChain->RemoveElementAt(aChain->Length() - 1);
-        }
-        return false;
-    }
-
-    /**
-     * The partial order on resource acquisitions used by the deadlock
-     * detector.
-     */
-    PLHashTable* mOrdering;     // T* -> PLHashEntry<OrderingEntry>
-
-    /**
-     * Protects contentious methods.
-     * Nb: can't use mozilla::Mutex since we are used as its deadlock
-     * detector.
-     */
-    PRLock* mLock;
+  /**
+   * Protects contentious methods.
+   * Nb: can't use mozilla::Mutex since we are used as its deadlock
+   * detector.
+   */
+  PRLock* mLock;
 
 private:
-    DeadlockDetector(const DeadlockDetector& aDD) MOZ_DELETE;
-    DeadlockDetector& operator=(const DeadlockDetector& aDD) MOZ_DELETE;
+  DeadlockDetector(const DeadlockDetector& aDD) MOZ_DELETE;
+  DeadlockDetector& operator=(const DeadlockDetector& aDD) MOZ_DELETE;
 };
 
 
 template<typename T>
 const PLHashAllocOps DeadlockDetector<T>::kAllocOps = {
-    DeadlockDetector<T>::TableAlloc, DeadlockDetector<T>::TableFree,
-    DeadlockDetector<T>::EntryAlloc, DeadlockDetector<T>::EntryFree
+  DeadlockDetector<T>::TableAlloc, DeadlockDetector<T>::TableFree,
+  DeadlockDetector<T>::EntryAlloc, DeadlockDetector<T>::EntryFree
 };
 
 
 template<typename T>
 // FIXME bug 456272: tune based on average workload
 const uint32_t DeadlockDetector<T>::kDefaultNumBuckets = 64;
 
 
--- a/xpcom/glue/EnumeratedArrayCycleCollection.h
+++ b/xpcom/glue/EnumeratedArrayCycleCollection.h
@@ -5,32 +5,32 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef EnumeratedArrayCycleCollection_h_
 #define EnumeratedArrayCycleCollection_h_
 
 #include "mozilla/EnumeratedArray.h"
 #include "nsCycleCollectionTraversalCallback.h"
 
-template <typename IndexType,
-          MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(IndexType) SizeAsEnumValue,
-          typename ValueType>
+template<typename IndexType,
+         MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(IndexType) SizeAsEnumValue,
+         typename ValueType>
 inline void
 ImplCycleCollectionUnlink(mozilla::EnumeratedArray<IndexType,
                                                    SizeAsEnumValue,
                                                    ValueType>& aField)
 {
-  for (size_t i = 0; i < size_t(SizeAsEnumValue); i++) {
+  for (size_t i = 0; i < size_t(SizeAsEnumValue); ++i) {
     aField[IndexType(i)] = nullptr;
   }
 }
 
-template <typename IndexType,
-          MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(IndexType) SizeAsEnumValue,
-          typename ValueType>
+template<typename IndexType,
+         MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(IndexType) SizeAsEnumValue,
+         typename ValueType>
 inline void
 ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
                             mozilla::EnumeratedArray<IndexType,
                                                      SizeAsEnumValue,
                                                      ValueType>& aField,
                             const char* aName,
                             uint32_t aFlags = 0)
 {
--- a/xpcom/glue/FileUtils.cpp
+++ b/xpcom/glue/FileUtils.cpp
@@ -32,81 +32,92 @@
 #elif defined(XP_WIN)
 #include <windows.h>
 #endif
 
 // Functions that are not to be used in standalone glue must be implemented
 // within this #if block
 #if !defined(XPCOM_GLUE)
 
-bool 
-mozilla::fallocate(PRFileDesc *aFD, int64_t aLength) 
+bool
+mozilla::fallocate(PRFileDesc* aFD, int64_t aLength)
 {
 #if defined(HAVE_POSIX_FALLOCATE)
   return posix_fallocate(PR_FileDesc2NativeHandle(aFD), 0, aLength) == 0;
 #elif defined(XP_WIN)
   int64_t oldpos = PR_Seek64(aFD, 0, PR_SEEK_CUR);
-  if (oldpos == -1)
+  if (oldpos == -1) {
     return false;
+  }
 
-  if (PR_Seek64(aFD, aLength, PR_SEEK_SET) != aLength)
+  if (PR_Seek64(aFD, aLength, PR_SEEK_SET) != aLength) {
     return false;
+  }
 
   bool retval = (0 != SetEndOfFile((HANDLE)PR_FileDesc2NativeHandle(aFD)));
 
   PR_Seek64(aFD, oldpos, PR_SEEK_SET);
   return retval;
 #elif defined(XP_MACOSX)
   int fd = PR_FileDesc2NativeHandle(aFD);
   fstore_t store = {F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, aLength};
   // Try to get a continous chunk of disk space
   int ret = fcntl(fd, F_PREALLOCATE, &store);
-  if (-1 == ret) {
+  if (ret == -1) {
     // OK, perhaps we are too fragmented, allocate non-continuous
     store.fst_flags = F_ALLOCATEALL;
     ret = fcntl(fd, F_PREALLOCATE, &store);
-    if (-1 == ret)
+    if (ret == -1) {
       return false;
+    }
   }
-  return 0 == ftruncate(fd, aLength);
+  return ftruncate(fd, aLength) == 0;
 #elif defined(XP_UNIX)
   // The following is copied from fcntlSizeHint in sqlite
   /* If the OS does not have posix_fallocate(), fake it. First use
   ** ftruncate() to set the file size, then write a single byte to
   ** the last byte in each block within the extended region. This
   ** is the same technique used by glibc to implement posix_fallocate()
   ** on systems that do not have a real fallocate() system call.
   */
   int64_t oldpos = PR_Seek64(aFD, 0, PR_SEEK_CUR);
-  if (oldpos == -1)
+  if (oldpos == -1) {
     return false;
+  }
 
   struct stat buf;
   int fd = PR_FileDesc2NativeHandle(aFD);
-  if (fstat(fd, &buf))
+  if (fstat(fd, &buf)) {
     return false;
+  }
 
-  if (buf.st_size >= aLength)
+  if (buf.st_size >= aLength) {
     return false;
+  }
 
   const int nBlk = buf.st_blksize;
 
-  if (!nBlk)
+  if (!nBlk) {
     return false;
+  }
 
-  if (ftruncate(fd, aLength))
+  if (ftruncate(fd, aLength)) {
     return false;
+  }
 
   int nWrite; // Return value from write()
   int64_t iWrite = ((buf.st_size + 2 * nBlk - 1) / nBlk) * nBlk - 1; // Next offset to write to
   while (iWrite < aLength) {
     nWrite = 0;
-    if (PR_Seek64(aFD, iWrite, PR_SEEK_SET) == iWrite)
+    if (PR_Seek64(aFD, iWrite, PR_SEEK_SET) == iWrite) {
       nWrite = PR_Write(aFD, "", 1);
-    if (nWrite != 1) break;
+    }
+    if (nWrite != 1) {
+      break;
+    }
     iWrite += nBlk;
   }
 
   PR_Seek64(aFD, oldpos, PR_SEEK_SET);
   return nWrite == 1;
 #endif
   return false;
 }
@@ -254,44 +265,44 @@ static const uint32_t CPU_TYPE = CPU_TYP
 #define segment_command segment_command_64
 #else
 #define cpu_mach_header mach_header
 #endif
 
 class ScopedMMap
 {
 public:
-  ScopedMMap(const char *aFilePath)
+  ScopedMMap(const char* aFilePath)
     : buf(nullptr)
   {
     fd = open(aFilePath, O_RDONLY);
     if (fd < 0) {
       return;
     }
     struct stat st;
     if (fstat(fd, &st) < 0) {
       return;
     }
     size = st.st_size;
-    buf = (char *)mmap(nullptr, size, PROT_READ, MAP_PRIVATE, fd, 0);
+    buf = (char*)mmap(nullptr, size, PROT_READ, MAP_PRIVATE, fd, 0);
   }
   ~ScopedMMap()
   {
     if (buf) {
       munmap(buf, size);
     }
     if (fd >= 0) {
       close(fd);
     }
   }
-  operator char *() { return buf; }
+  operator char*() { return buf; }
   int getFd() { return fd; }
 private:
   int fd;
-  char *buf;
+  char* buf;
   size_t size;
 };
 #endif
 
 void
 mozilla::ReadAhead(mozilla::filedesc_t aFd, const size_t aOffset,
                    const size_t aCount)
 {
@@ -365,17 +376,18 @@ mozilla::ReadAheadLib(mozilla::pathstr_t
 #if defined(XP_WIN)
   ReadAheadFile(aFilePath);
 #elif defined(LINUX) && !defined(ANDROID)
   int fd = open(aFilePath, O_RDONLY);
   if (fd < 0) {
     return;
   }
 
-  union {
+  union
+  {
     char buf[bufsize];
     Elf_Ehdr ehdr;
   } elf;
   // Read ELF header (ehdr) and program header table (phdr).
   // We check that the ELF magic is found, that the ELF class matches
   // our own, and that the program header table as defined in the ELF
   // headers fits in the buffer we read.
   if ((read(fd, elf.buf, bufsize) <= 0) ||
@@ -385,73 +397,73 @@ mozilla::ReadAheadLib(mozilla::pathstr_t
     close(fd);
     return;
   }
   // The program header table contains segment definitions. One such
   // segment type is PT_LOAD, which describes how the dynamic loader
   // is going to map the file in memory. We use that information to
   // find the biggest offset from the library that will be mapped in
   // memory.
-  Elf_Phdr *phdr = (Elf_Phdr *)&elf.buf[elf.ehdr.e_phoff];
+  Elf_Phdr* phdr = (Elf_Phdr*)&elf.buf[elf.ehdr.e_phoff];
   Elf_Off end = 0;
   for (int phnum = elf.ehdr.e_phnum; phnum; phdr++, phnum--) {
     if ((phdr->p_type == PT_LOAD) &&
         (end < phdr->p_offset + phdr->p_filesz)) {
       end = phdr->p_offset + phdr->p_filesz;
     }
   }
   // Let the kernel read ahead what the dynamic loader is going to
   // map in memory soon after.
   if (end > 0) {
     ReadAhead(fd, 0, end);
   }
   close(fd);
 #elif defined(XP_MACOSX)
   ScopedMMap buf(aFilePath);
-  char *base = buf;
+  char* base = buf;
   if (!base) {
     return;
   }
 
   // An OSX binary might either be a fat (universal) binary or a
   // Mach-O binary. A fat binary actually embeds several Mach-O
   // binaries. If we have a fat binary, find the offset where the
   // Mach-O binary for our CPU type can be found.
-  struct fat_header *fh = (struct fat_header *)base;
+  struct fat_header* fh = (struct fat_header*)base;
 
   if (OSSwapBigToHostInt32(fh->magic) == FAT_MAGIC) {
     uint32_t nfat_arch = OSSwapBigToHostInt32(fh->nfat_arch);
-    struct fat_arch *arch = (struct fat_arch *)&buf[sizeof(struct fat_header)];
+    struct fat_arch* arch = (struct fat_arch*)&buf[sizeof(struct fat_header)];
     for (; nfat_arch; arch++, nfat_arch--) {
       if (OSSwapBigToHostInt32(arch->cputype) == CPU_TYPE) {
         base += OSSwapBigToHostInt32(arch->offset);
         break;
       }
     }
     if (base == buf) {
       return;
     }
   }
 
   // Check Mach-O magic in the Mach header
-  struct cpu_mach_header *mh = (struct cpu_mach_header *)base;
+  struct cpu_mach_header* mh = (struct cpu_mach_header*)base;
   if (mh->magic != MH_MAGIC) {
     return;
   }
 
   // The Mach header is followed by a sequence of load commands.
   // Each command has a header containing the command type and the
   // command size. LD_SEGMENT commands describes how the dynamic
   // loader is going to map the file in memory. We use that
   // information to find the biggest offset from the library that
   // will be mapped in memory.
-  char *cmd = &base[sizeof(struct cpu_mach_header)];
+  char* cmd = &base[sizeof(struct cpu_mach_header)];
   uint32_t end = 0;
   for (uint32_t ncmds = mh->ncmds; ncmds; ncmds--) {
-    struct segment_command *sh = (struct segment_command *)cmd;
+    struct segment_command* sh = (struct segment_command*)cmd;
     if (sh->cmd != LC_SEGMENT) {
       continue;
     }
     if (end < sh->fileoff + sh->filesize) {
       end = sh->fileoff + sh->filesize;
     }
     cmd += sh->cmdsize;
   }
--- a/xpcom/glue/FileUtils.h
+++ b/xpcom/glue/FileUtils.h
@@ -34,20 +34,20 @@ typedef const char* pathstr_t;
  * ScopedCloseFD is a RAII wrapper for POSIX file descriptors
  *
  * Instances |close()| their fds when they go out of scope.
  */
 struct ScopedCloseFDTraits
 {
   typedef int type;
   static type empty() { return -1; }
-  static void release(type fd) {
-    if (fd != -1) {
-      while ((close(fd) == -1) && (errno == EINTR)) {
-        ;
+  static void release(type aFd)
+  {
+    if (aFd != -1) {
+      while (close(aFd) == -1 && errno == EINTR) {
       }
     }
   }
 };
 typedef Scoped<ScopedCloseFDTraits> ScopedClose;
 
 #if !defined(XPCOM_GLUE)
 
@@ -55,103 +55,105 @@ typedef Scoped<ScopedCloseFDTraits> Scop
  * AutoFDClose is a RAII wrapper for PRFileDesc.
  *
  * Instances |PR_Close| their fds when they go out of scope.
  **/
 struct ScopedClosePRFDTraits
 {
   typedef PRFileDesc* type;
   static type empty() { return nullptr; }
-  static void release(type fd) {
-    if (fd != nullptr) {
-      PR_Close(fd);
+  static void release(type aFd)
+  {
+    if (aFd) {
+      PR_Close(aFd);
     }
   }
 };
 typedef Scoped<ScopedClosePRFDTraits> AutoFDClose;
 
 /* RAII wrapper for FILE descriptors */
 struct ScopedCloseFileTraits
 {
-  typedef FILE *type;
+  typedef FILE* type;
   static type empty() { return nullptr; }
-  static void release(type f) {
-    if (f) {
-      fclose(f);
+  static void release(type aFile)
+  {
+    if (aFile) {
+      fclose(aFile);
     }
   }
 };
 typedef Scoped<ScopedCloseFileTraits> ScopedCloseFile;
 
 /**
  * Fallocate efficiently and continuously allocates files via fallocate-type APIs.
  * This is useful for avoiding fragmentation.
  * On sucess the file be padded with zeros to grow to aLength.
  *
  * @param aFD file descriptor.
  * @param aLength length of file to grow to.
  * @return true on success.
  */
-NS_COM_GLUE bool fallocate(PRFileDesc *aFD, int64_t aLength);
+NS_COM_GLUE bool fallocate(PRFileDesc* aFD, int64_t aLength);
 
 /**
  * Use readahead to preload shared libraries into the file cache before loading.
- * WARNING: This function should not be used without a telemetry field trial 
+ * WARNING: This function should not be used without a telemetry field trial
  *          demonstrating a clear performance improvement!
  *
  * @param aFile nsIFile representing path to shared library
  */
 NS_COM_GLUE void ReadAheadLib(nsIFile* aFile);
 
 /**
  * Use readahead to preload a file into the file cache before reading.
- * WARNING: This function should not be used without a telemetry field trial 
+ * WARNING: This function should not be used without a telemetry field trial
  *          demonstrating a clear performance improvement!
  *
  * @param aFile nsIFile representing path to shared library
  * @param aOffset Offset into the file to begin preloading
  * @param aCount Number of bytes to preload (SIZE_MAX implies file size)
  * @param aOutFd Pointer to file descriptor. If specified, ReadAheadFile will
  *        return its internal, opened file descriptor instead of closing it.
  */
 NS_COM_GLUE void ReadAheadFile(nsIFile* aFile, const size_t aOffset = 0,
                                const size_t aCount = SIZE_MAX,
                                filedesc_t* aOutFd = nullptr);
 
 #endif // !defined(XPCOM_GLUE)
 
 /**
  * Use readahead to preload shared libraries into the file cache before loading.
- * WARNING: This function should not be used without a telemetry field trial 
+ * WARNING: This function should not be used without a telemetry field trial
  *          demonstrating a clear performance improvement!
  *
  * @param aFilePath path to shared library
  */
 NS_COM_GLUE void ReadAheadLib(pathstr_t aFilePath);
 
 /**
  * Use readahead to preload a file into the file cache before loading.
- * WARNING: This function should not be used without a telemetry field trial 
+ * WARNING: This function should not be used without a telemetry field trial
  *          demonstrating a clear performance improvement!
  *
  * @param aFilePath path to shared library
  * @param aOffset Offset into the file to begin preloading
  * @param aCount Number of bytes to preload (SIZE_MAX implies file size)
  * @param aOutFd Pointer to file descriptor. If specified, ReadAheadFile will
  *        return its internal, opened file descriptor instead of closing it.
  */
 NS_COM_GLUE void ReadAheadFile(pathstr_t aFilePath, const size_t aOffset = 0,
                                const size_t aCount = SIZE_MAX,
                                filedesc_t* aOutFd = nullptr);
 
 /**
  * Use readahead to preload a file into the file cache before reading.
  * When this function exits, the file pointer is guaranteed to be in the same
  * position it was in before this function was called.
- * WARNING: This function should not be used without a telemetry field trial 
+ * WARNING: This function should not be used without a telemetry field trial
  *          demonstrating a clear performance improvement!
  *
  * @param aFd file descriptor opened for read access
  * (on Windows, file must be opened with FILE_FLAG_SEQUENTIAL_SCAN)
  * @param aOffset Offset into the file to begin preloading
  * @param aCount Number of bytes to preload (SIZE_MAX implies file size)
  */
 NS_COM_GLUE void ReadAhead(filedesc_t aFd, const size_t aOffset = 0,
@@ -182,37 +184,27 @@ and run in non-GONK builds. */
  * The output buffer will always be '\0'-terminated on successful completion.
  * If aBufSize == 0, then this function will return true if the file exists
  * and is readable (it will not attempt to read anything from it).
  * On failure the contents of aBuf after this call will be undefined and the
  * value of the global variable errno will be set accordingly.
  * @return true on success, notice that less than requested bytes could have
  * been read if the file was smaller
  */
-bool
-ReadSysFile(
-  const char* aFilename,
-  char* aBuf,
-  size_t aBufSize);
+bool ReadSysFile(const char* aFilename, char* aBuf, size_t aBufSize);
 
 /**
  * Parse the contents of a file, assuming it contains a decimal integer.
  * @return true on success
  */
-bool
-ReadSysFile(
-  const char* aFilename,
-  int* aVal);
+bool ReadSysFile(const char* aFilename, int* aVal);
 
 /**
  * Parse the contents of a file, assuming it contains a boolean value
  * (either 0 or 1).
  * @return true on success
  */
-bool
-ReadSysFile(
-  const char* aFilename,
-  bool* aVal);
+bool ReadSysFile(const char* aFilename, bool* aVal);
 
 #endif /* (MOZ_WIDGET_GONK || DEBUG) && XP_UNIX */
 
 } // namespace mozilla
 #endif
--- a/xpcom/glue/GenericFactory.cpp
+++ b/xpcom/glue/GenericFactory.cpp
@@ -6,17 +6,17 @@
 #include "mozilla/GenericFactory.h"
 
 namespace mozilla {
 
 NS_IMPL_ISUPPORTS(GenericFactory, nsIFactory)
 
 NS_IMETHODIMP
 GenericFactory::CreateInstance(nsISupports* aOuter, REFNSIID aIID,
-			       void** aResult)
+                               void** aResult)
 {
   return mCtor(aOuter, aIID, aResult);
 }
 
 NS_IMETHODIMP
 GenericFactory::LockFactory(bool aLock)
 {
   NS_ERROR("Vestigial method, never called!");
--- a/xpcom/glue/GenericFactory.h
+++ b/xpcom/glue/GenericFactory.h
@@ -20,18 +20,18 @@ namespace mozilla {
 class GenericFactory MOZ_FINAL : public nsIFactory
 {
 public:
   typedef Module::ConstructorProcPtr ConstructorProcPtr;
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIFACTORY
 
-  GenericFactory(ConstructorProcPtr ctor)
-    : mCtor(ctor)
+  GenericFactory(ConstructorProcPtr aCtor)
+    : mCtor(aCtor)
   {
     NS_ASSERTION(mCtor, "GenericFactory with no constructor");
   }
 
 private:
   ConstructorProcPtr mCtor;
 };
 
--- a/xpcom/glue/GenericModule.cpp
+++ b/xpcom/glue/GenericModule.cpp
@@ -23,52 +23,57 @@ GenericModule::GetClassObject(nsICompone
                               const nsIID& aIID,
                               void** aResult)
 {
   for (const Module::CIDEntry* e = mData->mCIDs; e->cid; ++e) {
     if (e->cid->Equals(aCID)) {
       nsCOMPtr<nsIFactory> f;
       if (e->getFactoryProc) {
         f = e->getFactoryProc(*mData, *e);
-      }
-      else {
+      } else {
         NS_ASSERTION(e->constructorProc, "No constructor proc?");
         f = new GenericFactory(e->constructorProc);
       }
-      if (!f)
+      if (!f) {
         return NS_ERROR_FAILURE;
+      }
 
       return f->QueryInterface(aIID, aResult);
     }
   }
   NS_ERROR("Asking a module for a CID it doesn't implement.");
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 GenericModule::RegisterSelf(nsIComponentManager* aCompMgr,
                             nsIFile* aLocation,
                             const char* aLoaderStr,
                             const char* aType)
 {
   nsCOMPtr<nsIComponentRegistrar> r = do_QueryInterface(aCompMgr);
-  for (const Module::CIDEntry* e = mData->mCIDs; e->cid; ++e)
-    r->RegisterFactoryLocation(*e->cid, "", nullptr, aLocation, aLoaderStr, aType);
+  for (const Module::CIDEntry* e = mData->mCIDs; e->cid; ++e) {
+    r->RegisterFactoryLocation(*e->cid, "", nullptr, aLocation,
+                               aLoaderStr, aType);
+  }
 
   for (const Module::ContractIDEntry* e = mData->mContractIDs;
        e && e->contractid;
-       ++e)
-    r->RegisterFactoryLocation(*e->cid, "", e->contractid, aLocation, aLoaderStr, aType);
+       ++e) {
+    r->RegisterFactoryLocation(*e->cid, "", e->contractid, aLocation,
+                               aLoaderStr, aType);
+  }
 
   nsCOMPtr<nsICategoryManager> catman;
   for (const Module::CategoryEntry* e = mData->mCategoryEntries;
        e && e->category;
        ++e) {
-    if (!catman)
+    if (!catman) {
       catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
+    }
 
     nsAutoCString r;
     catman->AddCategoryEntry(e->category, e->entry, e->value, true, true,
                              getter_Copies(r));
   }
   return NS_OK;
 }
 
--- a/xpcom/glue/HoldDropJSObjects.h
+++ b/xpcom/glue/HoldDropJSObjects.h
@@ -22,22 +22,23 @@ namespace cyclecollector {
 void HoldJSObjectsImpl(void* aHolder, nsScriptObjectTracer* aTracer);
 void HoldJSObjectsImpl(nsISupports* aHolder);
 void DropJSObjectsImpl(void* aHolder);
 void DropJSObjectsImpl(nsISupports* aHolder);
 
 } // namespace cyclecollector
 
 
-template<class T, bool isISupports=IsBaseOf<nsISupports, T>::value>
+template<class T, bool isISupports = IsBaseOf<nsISupports, T>::value>
 struct HoldDropJSObjectsHelper
 {
   static void Hold(T* aHolder)
   {
-    cyclecollector::HoldJSObjectsImpl(aHolder, NS_CYCLE_COLLECTION_PARTICIPANT(T));
+    cyclecollector::HoldJSObjectsImpl(aHolder,
+                                      NS_CYCLE_COLLECTION_PARTICIPANT(T));
   }
   static void Drop(T* aHolder)
   {
     cyclecollector::DropJSObjectsImpl(aHolder);
   }
 };
 
 template<class T>
@@ -50,22 +51,24 @@ struct HoldDropJSObjectsHelper<T, true>
   static void Drop(T* aHolder)
   {
     cyclecollector::DropJSObjectsImpl(ToSupports(aHolder));
   }
 };
 
 
 template<class T>
-void HoldJSObjects(T* aHolder)
+void
+HoldJSObjects(T* aHolder)
 {
   HoldDropJSObjectsHelper<T>::Hold(aHolder);
 }
 
 template<class T>
-void DropJSObjects(T* aHolder)
+void
+DropJSObjects(T* aHolder)
 {
   HoldDropJSObjectsHelper<T>::Drop(aHolder);
 }
 
 } // namespace mozilla
 
 #endif // mozilla_HoldDropJSObjects_h
--- a/xpcom/glue/IntentionalCrash.h
+++ b/xpcom/glue/IntentionalCrash.h
@@ -15,38 +15,39 @@
 #endif
 
 #ifndef mozilla_IntentionalCrash_h
 #define mozilla_IntentionalCrash_h
 
 namespace mozilla {
 
 inline void
-NoteIntentionalCrash(const char* processType)
+NoteIntentionalCrash(const char* aProcessType)
 {
   char* f = getenv("XPCOM_MEM_BLOAT_LOG");
-
-  if (!f) 
+  if (!f) {
     return;
+  }
 
   fprintf(stderr, "XPCOM_MEM_BLOAT_LOG: %s\n", f);
 
   std::string bloatLog(f);
-  
+
   bool hasExt = false;
   if (bloatLog.size() >= 4 &&
-      0 == bloatLog.compare(bloatLog.size() - 4, 4, ".log", 4)) {
+      bloatLog.compare(bloatLog.size() - 4, 4, ".log", 4) == 0) {
     hasExt = true;
     bloatLog.erase(bloatLog.size() - 4, 4);
   }
 
   std::ostringstream bloatName;
-  bloatName << bloatLog << "_" << processType << "_pid" << getpid();
-  if (hasExt)
+  bloatName << bloatLog << "_" << aProcessType << "_pid" << getpid();
+  if (hasExt) {
     bloatName << ".log";
+  }
 
   fprintf(stderr, "Writing to log: %s\n", bloatName.str().c_str());
 
   FILE* processfd = fopen(bloatName.str().c_str(), "a");
   fprintf(processfd, "==> process %d will purposefully crash\n", getpid());
   fclose(processfd);
 }
 
--- a/xpcom/glue/MainThreadUtils.h
+++ b/xpcom/glue/MainThreadUtils.h
@@ -10,42 +10,40 @@
 #include "nscore.h"
 #include "mozilla/threads/nsThreadIDs.h"
 
 class nsIThread;
 
 /**
  * Get a reference to the main thread.
  *
- * @param result
+ * @param aResult
  *   The resulting nsIThread object.
  */
-extern NS_COM_GLUE NS_METHOD
-NS_GetMainThread(nsIThread **result);
+extern NS_COM_GLUE NS_METHOD NS_GetMainThread(nsIThread** aResult);
 
 #ifdef MOZILLA_INTERNAL_API
 // Fast access to the current thread.  Do not release the returned pointer!  If
 // you want to use this pointer from some other thread, then you will need to
 // AddRef it.  Otherwise, you should only consider this pointer valid from code
 // running on the current thread.
-extern NS_COM_GLUE nsIThread *NS_GetCurrentThread();
+extern NS_COM_GLUE nsIThread* NS_GetCurrentThread();
 #endif
 
 #if defined(MOZILLA_INTERNAL_API) && defined(XP_WIN)
 bool NS_IsMainThread();
 #elif defined(MOZILLA_INTERNAL_API) && defined(NS_TLS)
 // This is defined in nsThreadManager.cpp and initialized to `Main` for the
 // main thread by nsThreadManager::Init.
 extern NS_TLS mozilla::threads::ID gTLSThreadID;
 #ifdef MOZ_ASAN
 // Temporary workaround, see bug 895845
 MOZ_ASAN_BLACKLIST bool NS_IsMainThread();
 #else
-inline
-bool NS_IsMainThread()
+inline bool NS_IsMainThread()
 {
   return gTLSThreadID == mozilla::threads::Main;
 }
 #endif
 #else
 /**
  * Test to see if the current thread is the main thread.
  *
--- a/xpcom/glue/Monitor.h
+++ b/xpcom/glue/Monitor.h
@@ -20,139 +20,119 @@ namespace mozilla {
  *
  * Instead of directly calling Monitor methods, it's safer and simpler
  * to instead use the RAII wrappers MonitorAutoLock and
  * MonitorAutoUnlock.
  */
 class NS_COM_GLUE Monitor
 {
 public:
-    Monitor(const char* aName) :
-        mMutex(aName),
-        mCondVar(mMutex, "[Monitor.mCondVar]")
-    {}
-
-    ~Monitor() {}
+  Monitor(const char* aName)
+    : mMutex(aName)
+    , mCondVar(mMutex, "[Monitor.mCondVar]")
+  {
+  }
 
-    void Lock()
-    {
-        mMutex.Lock();
-    }
+  ~Monitor() {}
 
-    void Unlock()
-    {
-        mMutex.Unlock();
-    }
+  void Lock() { mMutex.Lock(); }
+  void Unlock() { mMutex.Unlock(); }
 
-    nsresult Wait(PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT)
-    {
-        return mCondVar.Wait(interval);
-    }
+  nsresult Wait(PRIntervalTime aInterval = PR_INTERVAL_NO_TIMEOUT)
+  {
+    return mCondVar.Wait(aInterval);
+  }
 
-    nsresult Notify()
-    {
-        return mCondVar.Notify();
-    }
+  nsresult Notify() { return mCondVar.Notify(); }
+  nsresult NotifyAll() { return mCondVar.NotifyAll(); }
 
-    nsresult NotifyAll()
-    {
-        return mCondVar.NotifyAll();
-    }
+  void AssertCurrentThreadOwns() const
+  {
+    mMutex.AssertCurrentThreadOwns();
+  }
 
-    void AssertCurrentThreadOwns() const
-    {
-        mMutex.AssertCurrentThreadOwns();
-    }
-
-    void AssertNotCurrentThreadOwns() const
-    {
-        mMutex.AssertNotCurrentThreadOwns();
-    }
+  void AssertNotCurrentThreadOwns() const
+  {
+    mMutex.AssertNotCurrentThreadOwns();
+  }
 
 private:
-    Monitor();
-    Monitor(const Monitor&);
-    Monitor& operator =(const Monitor&);
+  Monitor();
+  Monitor(const Monitor&);
+  Monitor& operator=(const Monitor&);
 
-    Mutex mMutex;
-    CondVar mCondVar;
+  Mutex mMutex;
+  CondVar mCondVar;
 };
 
 /**
  * Lock the monitor for the lexical scope instances of this class are
  * bound to (except for MonitorAutoUnlock in nested scopes).
  *
  * The monitor must be unlocked when instances of this class are
  * created.
  */
 class NS_COM_GLUE MOZ_STACK_CLASS MonitorAutoLock
 {
 public:
-    MonitorAutoLock(Monitor& aMonitor) :
-        mMonitor(&aMonitor)
-    {
-        mMonitor->Lock();
-    }
-    
-    ~MonitorAutoLock()
-    {
-        mMonitor->Unlock();
-    }
- 
-    nsresult Wait(PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT)
-    {
-       return mMonitor->Wait(interval);
-    }
+  MonitorAutoLock(Monitor& aMonitor)
+    : mMonitor(&aMonitor)
+  {
+    mMonitor->Lock();
+  }
 
-    nsresult Notify()
-    {
-        return mMonitor->Notify();
-    }
+  ~MonitorAutoLock()
+  {
+    mMonitor->Unlock();
+  }
 
-    nsresult NotifyAll()
-    {
-        return mMonitor->NotifyAll();
-    }
+  nsresult Wait(PRIntervalTime aInterval = PR_INTERVAL_NO_TIMEOUT)
+  {
+    return mMonitor->Wait(aInterval);
+  }
+
+  nsresult Notify() { return mMonitor->Notify(); }
+  nsresult NotifyAll() { return mMonitor->NotifyAll(); }
 
 private:
-    MonitorAutoLock();
-    MonitorAutoLock(const MonitorAutoLock&);
-    MonitorAutoLock& operator =(const MonitorAutoLock&);
-    static void* operator new(size_t) CPP_THROW_NEW;
-    static void operator delete(void*);
+  MonitorAutoLock();
+  MonitorAutoLock(const MonitorAutoLock&);
+  MonitorAutoLock& operator=(const MonitorAutoLock&);
+  static void* operator new(size_t) CPP_THROW_NEW;
+  static void operator delete(void*);
 
-    Monitor* mMonitor;
+  Monitor* mMonitor;
 };
 
 /**
  * Unlock the monitor for the lexical scope instances of this class
  * are bound to (except for MonitorAutoLock in nested scopes).
  *
  * The monitor must be locked by the current thread when instances of
  * this class are created.
  */
 class NS_COM_GLUE MOZ_STACK_CLASS MonitorAutoUnlock
 {
 public:
-    MonitorAutoUnlock(Monitor& aMonitor) :
-        mMonitor(&aMonitor)
-    {
-        mMonitor->Unlock();
-    }
-    
-    ~MonitorAutoUnlock()
-    {
-        mMonitor->Lock();
-    }
- 
+  MonitorAutoUnlock(Monitor& aMonitor)
+    : mMonitor(&aMonitor)
+  {
+    mMonitor->Unlock();
+  }
+
+  ~MonitorAutoUnlock()
+  {
+    mMonitor->Lock();
+  }
+
 private:
-    MonitorAutoUnlock();
-    MonitorAutoUnlock(const MonitorAutoUnlock&);
-    MonitorAutoUnlock& operator =(const MonitorAutoUnlock&);
-    static void* operator new(size_t) CPP_THROW_NEW;
-    static void operator delete(void*);
+  MonitorAutoUnlock();
+  MonitorAutoUnlock(const MonitorAutoUnlock&);
+  MonitorAutoUnlock& operator=(const MonitorAutoUnlock&);
+  static void* operator new(size_t) CPP_THROW_NEW;
+  static void operator delete(void*);
 
-    Monitor* mMonitor;
+  Monitor* mMonitor;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_Monitor_h
--- a/xpcom/glue/Mutex.h
+++ b/xpcom/glue/Mutex.h
@@ -11,17 +11,17 @@
 
 #include "mozilla/BlockingResourceBase.h"
 #include "mozilla/GuardObjects.h"
 
 //
 // Provides:
 //
 //  - Mutex, a non-recursive mutex
-//  - MutexAutoLock, an RAII class for ensuring that Mutexes are properly 
+//  - MutexAutoLock, an RAII class for ensuring that Mutexes are properly
 //    locked and unlocked
 //  - MutexAutoUnlock, complementary sibling to MutexAutoLock
 //
 //  - OffTheBooksMutex, a non-recursive mutex that doesn't do leak checking
 //  - OffTheBooksMutexAuto{Lock,Unlock} - Like MutexAuto{Lock,Unlock}, but for
 //    an OffTheBooksMutex.
 //
 // Using MutexAutoLock/MutexAutoUnlock etc. is MUCH preferred to making bare
@@ -32,203 +32,195 @@ namespace mozilla {
 /**
  * OffTheBooksMutex is identical to Mutex, except that OffTheBooksMutex doesn't
  * include leak checking.  Sometimes you want to intentionally "leak" a mutex
  * until shutdown; in these cases, OffTheBooksMutex is for you.
  */
 class NS_COM_GLUE OffTheBooksMutex : BlockingResourceBase
 {
 public:
-    /**
-     * @param name A name which can reference this lock
-     * @returns If failure, nullptr
-     *          If success, a valid Mutex* which must be destroyed
-     *          by Mutex::DestroyMutex()
-     **/
-    OffTheBooksMutex(const char* name) :
-        BlockingResourceBase(name, eMutex)
-    {
-        mLock = PR_NewLock();
-        if (!mLock)
-            NS_RUNTIMEABORT("Can't allocate mozilla::Mutex");
+  /**
+   * @param aName A name which can reference this lock
+   * @returns If failure, nullptr
+   *          If success, a valid Mutex* which must be destroyed
+   *          by Mutex::DestroyMutex()
+   **/
+  OffTheBooksMutex(const char* aName)
+    : BlockingResourceBase(aName, eMutex)
+  {
+    mLock = PR_NewLock();
+    if (!mLock) {
+      NS_RUNTIMEABORT("Can't allocate mozilla::Mutex");
     }
+  }
 
-    ~OffTheBooksMutex()
-    {
-        NS_ASSERTION(mLock,
-                     "improperly constructed Lock or double free");
-        // NSPR does consistency checks for us
-        PR_DestroyLock(mLock);
-        mLock = 0;
-    }
+  ~OffTheBooksMutex()
+  {
+    NS_ASSERTION(mLock,
+                 "improperly constructed Lock or double free");
+    // NSPR does consistency checks for us
+    PR_DestroyLock(mLock);
+    mLock = 0;
+  }
 
 #ifndef DEBUG
-    /**
-     * Lock
-     * @see prlock.h
-     **/
-    void Lock()
-    {
-        PR_Lock(mLock);
-    }
+  /**
+   * Lock
+   * @see prlock.h
+   **/
+  void Lock() { PR_Lock(mLock); }
+
+  /**
+   * Unlock
+   * @see prlock.h
+   **/
+  void Unlock() { PR_Unlock(mLock); }
 
-    /**
-     * Unlock
-     * @see prlock.h
-     **/
-    void Unlock()
-    {
-        PR_Unlock(mLock);
-    }
+  /**
+   * AssertCurrentThreadOwns
+   * @see prlock.h
+   **/
+  void AssertCurrentThreadOwns() const {}
 
-    /**
-     * AssertCurrentThreadOwns
-     * @see prlock.h
-     **/
-    void AssertCurrentThreadOwns () const
-    {
-    }
-
-    /**
-     * AssertNotCurrentThreadOwns
-     * @see prlock.h
-     **/
-    void AssertNotCurrentThreadOwns () const
-    {
-    }
+  /**
+   * AssertNotCurrentThreadOwns
+   * @see prlock.h
+   **/
+  void AssertNotCurrentThreadOwns() const {}
 
 #else
-    void Lock();
-    void Unlock();
+  void Lock();
+  void Unlock();
 
-    void AssertCurrentThreadOwns () const
-    {
-        PR_ASSERT_CURRENT_THREAD_OWNS_LOCK(mLock);
-    }
+  void AssertCurrentThreadOwns() const
+  {
+    PR_ASSERT_CURRENT_THREAD_OWNS_LOCK(mLock);
+  }
 
-    void AssertNotCurrentThreadOwns () const
-    {
-        // FIXME bug 476536
-    }
+  void AssertNotCurrentThreadOwns() const
+  {
+    // FIXME bug 476536
+  }
 
 #endif  // ifndef DEBUG
 
 private:
-    OffTheBooksMutex();
-    OffTheBooksMutex(const OffTheBooksMutex&);
-    OffTheBooksMutex& operator=(const OffTheBooksMutex&);
+  OffTheBooksMutex();
+  OffTheBooksMutex(const OffTheBooksMutex&);
+  OffTheBooksMutex& operator=(const OffTheBooksMutex&);
 
-    PRLock* mLock;
+  PRLock* mLock;
 
-    friend class CondVar;
+  friend class CondVar;
 };
 
 /**
  * Mutex
  * When possible, use MutexAutoLock/MutexAutoUnlock to lock/unlock this
  * mutex within a scope, instead of calling Lock/Unlock directly.
  */
 class NS_COM_GLUE Mutex : public OffTheBooksMutex
 {
 public:
-   Mutex(const char* name)
-       : OffTheBooksMutex(name)
-   {
-       MOZ_COUNT_CTOR(Mutex);
-   }
+  Mutex(const char* aName)
+    : OffTheBooksMutex(aName)
+  {
+    MOZ_COUNT_CTOR(Mutex);
+  }
 
-   ~Mutex()
-   {
-       MOZ_COUNT_DTOR(Mutex);
-   }
+  ~Mutex()
+  {
+    MOZ_COUNT_DTOR(Mutex);
+  }
 
 private:
-    Mutex();
-    Mutex(const Mutex&);
-    Mutex& operator=(const Mutex&);
+  Mutex();
+  Mutex(const Mutex&);
+  Mutex& operator=(const Mutex&);
 };
 
 /**
  * MutexAutoLock
- * Acquires the Mutex when it enters scope, and releases it when it leaves 
+ * Acquires the Mutex when it enters scope, and releases it when it leaves
  * scope.
  *
  * MUCH PREFERRED to bare calls to Mutex.Lock and Unlock.
- */ 
+ */
 template<typename T>
 class NS_COM_GLUE MOZ_STACK_CLASS BaseAutoLock
 {
 public:
-    /**
-     * Constructor
-     * The constructor aquires the given lock.  The destructor
-     * releases the lock.
-     * 
-     * @param aLock A valid mozilla::Mutex* returned by 
-     *              mozilla::Mutex::NewMutex. 
-     **/
-    BaseAutoLock(T& aLock MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
-        mLock(&aLock)
-    {
-        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-        NS_ASSERTION(mLock, "null mutex");
-        mLock->Lock();
-    }
-    
-    ~BaseAutoLock(void) {
-        mLock->Unlock();
-    }
- 
+  /**
+   * Constructor
+   * The constructor aquires the given lock.  The destructor
+   * releases the lock.
+   *
+   * @param aLock A valid mozilla::Mutex* returned by
+   *              mozilla::Mutex::NewMutex.
+   **/
+  BaseAutoLock(T& aLock MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
+    : mLock(&aLock)
+  {
+    MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+    NS_ASSERTION(mLock, "null mutex");
+    mLock->Lock();
+  }
+
+  ~BaseAutoLock(void)
+  {
+    mLock->Unlock();
+  }
+
 private:
-    BaseAutoLock();
-    BaseAutoLock(BaseAutoLock&);
-    BaseAutoLock& operator=(BaseAutoLock&);
-    static void* operator new(size_t) CPP_THROW_NEW;
-    static void operator delete(void*);
+  BaseAutoLock();
+  BaseAutoLock(BaseAutoLock&);
+  BaseAutoLock& operator=(BaseAutoLock&);
+  static void* operator new(size_t) CPP_THROW_NEW;
+  static void operator delete(void*);
 
-    T* mLock;
-    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+  T* mLock;
+  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 typedef BaseAutoLock<Mutex> MutexAutoLock;
 typedef BaseAutoLock<OffTheBooksMutex> OffTheBooksMutexAutoLock;
 
 /**
  * MutexAutoUnlock
- * Releases the Mutex when it enters scope, and re-acquires it when it leaves 
+ * Releases the Mutex when it enters scope, and re-acquires it when it leaves
  * scope.
  *
  * MUCH PREFERRED to bare calls to Mutex.Unlock and Lock.
- */ 
+ */
 template<typename T>
-class NS_COM_GLUE MOZ_STACK_CLASS BaseAutoUnlock 
+class NS_COM_GLUE MOZ_STACK_CLASS BaseAutoUnlock
 {
 public:
-    BaseAutoUnlock(T& aLock MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
-        mLock(&aLock)
-    {
-        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
-        NS_ASSERTION(mLock, "null lock");
-        mLock->Unlock();
-    }
+  BaseAutoUnlock(T& aLock MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
+    : mLock(&aLock)
+  {
+    MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+    NS_ASSERTION(mLock, "null lock");
+    mLock->Unlock();
+  }
 
-    ~BaseAutoUnlock() 
-    {
-        mLock->Lock();
-    }
+  ~BaseAutoUnlock()
+  {
+    mLock->Lock();
+  }
 
 private:
-    BaseAutoUnlock();
-    BaseAutoUnlock(BaseAutoUnlock&);
-    BaseAutoUnlock& operator =(BaseAutoUnlock&);
-    static void* operator new(size_t) CPP_THROW_NEW;
-    static void operator delete(void*);
-     
-    T* mLock;
-    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+  BaseAutoUnlock();
+  BaseAutoUnlock(BaseAutoUnlock&);
+  BaseAutoUnlock& operator=(BaseAutoUnlock&);
+  static void* operator new(size_t) CPP_THROW_NEW;
+  static void operator delete(void*);
+
+  T* mLock;
+  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 typedef BaseAutoUnlock<Mutex> MutexAutoUnlock;
 typedef BaseAutoUnlock<OffTheBooksMutex> OffTheBooksMutexAutoUnlock;
 
 } // namespace mozilla
 
 
--- a/xpcom/glue/Observer.h
+++ b/xpcom/glue/Observer.h
@@ -13,62 +13,66 @@ namespace mozilla {
 /**
  * Observer<T> provides a way for a class to observe something.
  * When an event has to be broadcasted to all Observer<T>, Notify() method
  * is called.
  * T represents the type of the object passed in argument to Notify().
  *
  * @see ObserverList.
  */
-template <class T>
+template<class T>
 class Observer
 {
 public:
-  virtual ~Observer() { }
+  virtual ~Observer() {}
   virtual void Notify(const T& aParam) = 0;
 };
 
 /**
  * ObserverList<T> tracks Observer<T> and can notify them when Broadcast() is
  * called.
  * T represents the type of the object passed in argument to Broadcast() and
  * sent to Observer<T> objects through Notify().
  *
  * @see Observer.
  */
-template <class T>
+template<class T>
 class ObserverList
 {
 public:
   /**
    * Note: When calling AddObserver, it's up to the caller to make sure the
    * object isn't going to be release as long as RemoveObserver hasn't been
    * called.
    *
    * @see RemoveObserver()
    */
-  void AddObserver(Observer<T>* aObserver) {
+  void AddObserver(Observer<T>* aObserver)
+  {
     mObservers.AppendElement(aObserver);
   }
 
   /**
    * Remove the observer from the observer list.
    * @return Whether the observer has been found in the list.
    */
-  bool RemoveObserver(Observer<T>* aObserver) {
+  bool RemoveObserver(Observer<T>* aObserver)
+  {
     return mObservers.RemoveElement(aObserver);
   }
 
-  uint32_t Length() {
+  uint32_t Length()
+  {
     return mObservers.Length();
   }
 
-  void Broadcast(const T& aParam) {
+  void Broadcast(const T& aParam)
+  {
     uint32_t size = mObservers.Length();
-    for (uint32_t i=0; i<size; ++i) {
+    for (uint32_t i = 0; i < size; ++i) {
       mObservers[i]->Notify(aParam);
     }
   }
 
 protected:
   nsTArray<Observer<T>*> mObservers;
 };
 
--- a/xpcom/glue/ReentrantMonitor.h
+++ b/xpcom/glue/ReentrantMonitor.h
@@ -17,251 +17,235 @@
 
 //
 // Provides:
 //
 //  - ReentrantMonitor, a Java-like monitor
 //  - ReentrantMonitorAutoEnter, an RAII class for ensuring that
 //    ReentrantMonitors are properly entered and exited
 //
-// Using ReentrantMonitorAutoEnter is MUCH preferred to making bare calls to 
+// Using ReentrantMonitorAutoEnter is MUCH preferred to making bare calls to
 // ReentrantMonitor.Enter and Exit.
 //
 namespace mozilla {
 
 
 /**
  * ReentrantMonitor
  * Java-like monitor.
  * When possible, use ReentrantMonitorAutoEnter to hold this monitor within a
  * scope, instead of calling Enter/Exit directly.
  **/
 class NS_COM_GLUE ReentrantMonitor : BlockingResourceBase
 {
 public:
-    /**
-     * ReentrantMonitor
-     * @param aName A name which can reference this monitor
-     */
-    ReentrantMonitor(const char* aName) :
-        BlockingResourceBase(aName, eReentrantMonitor)
+  /**
+   * ReentrantMonitor
+   * @param aName A name which can reference this monitor
+   */
+  ReentrantMonitor(const char* aName)
+    : BlockingResourceBase(aName, eReentrantMonitor)
 #ifdef DEBUG
-        , mEntryCount(0)
+    , mEntryCount(0)
 #endif
-    {
-        MOZ_COUNT_CTOR(ReentrantMonitor);
-        mReentrantMonitor = PR_NewMonitor();
-        if (!mReentrantMonitor)
-            NS_RUNTIMEABORT("Can't allocate mozilla::ReentrantMonitor");
+  {
+    MOZ_COUNT_CTOR(ReentrantMonitor);
+    mReentrantMonitor = PR_NewMonitor();
+    if (!mReentrantMonitor) {
+      NS_RUNTIMEABORT("Can't allocate mozilla::ReentrantMonitor");
     }
+  }
 
-    /**
-     * ~ReentrantMonitor
-     **/
-    ~ReentrantMonitor()
-    {
-        NS_ASSERTION(mReentrantMonitor,
-                     "improperly constructed ReentrantMonitor or double free");
-        PR_DestroyMonitor(mReentrantMonitor);
-        mReentrantMonitor = 0;
-        MOZ_COUNT_DTOR(ReentrantMonitor);
-    }
+  /**
+   * ~ReentrantMonitor
+   **/
+  ~ReentrantMonitor()
+  {
+    NS_ASSERTION(mReentrantMonitor,
+                 "improperly constructed ReentrantMonitor or double free");
+    PR_DestroyMonitor(mReentrantMonitor);
+    mReentrantMonitor = 0;
+    MOZ_COUNT_DTOR(ReentrantMonitor);
+  }
 
 #ifndef DEBUG
-    /** 
-     * Enter
-     * @see prmon.h 
-     **/
-    void Enter()
-    {
-        PR_EnterMonitor(mReentrantMonitor);
-    }
+  /**
+   * Enter
+   * @see prmon.h
+   **/
+  void Enter() { PR_EnterMonitor(mReentrantMonitor); }
+
+  /**
+   * Exit
+   * @see prmon.h
+   **/
+  void Exit() { PR_ExitMonitor(mReentrantMonitor); }
 
-    /** 
-     * Exit
-     * @see prmon.h 
-     **/
-    void Exit()
-    {
-        PR_ExitMonitor(mReentrantMonitor);
-    }
-
-    /**
-     * Wait
-     * @see prmon.h
-     **/      
-    nsresult Wait(PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT)
-    {
+  /**
+   * Wait
+   * @see prmon.h
+   **/
+  nsresult Wait(PRIntervalTime aInterval = PR_INTERVAL_NO_TIMEOUT)
+  {
 #ifdef MOZILLA_INTERNAL_API
-        GeckoProfilerSleepRAII profiler_sleep;
+    GeckoProfilerSleepRAII profiler_sleep;
 #endif //MOZILLA_INTERNAL_API
-        return PR_Wait(mReentrantMonitor, interval) == PR_SUCCESS ?
-            NS_OK : NS_ERROR_FAILURE;
-    }
+    return PR_Wait(mReentrantMonitor, aInterval) == PR_SUCCESS ?
+      NS_OK : NS_ERROR_FAILURE;
+  }
 
 #else // ifndef DEBUG
-    void Enter();
-    void Exit();
-    nsresult Wait(PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT);
+  void Enter();
+  void Exit();
+  nsresult Wait(PRIntervalTime aInterval = PR_INTERVAL_NO_TIMEOUT);
 
 #endif  // ifndef DEBUG
 
-    /** 
-     * Notify
-     * @see prmon.h 
-     **/      
-    nsresult Notify()
-    {
-        return PR_Notify(mReentrantMonitor) == PR_SUCCESS
-            ? NS_OK : NS_ERROR_FAILURE;
-    }
+  /**
+   * Notify
+   * @see prmon.h
+   **/
+  nsresult Notify()
+  {
+    return PR_Notify(mReentrantMonitor) == PR_SUCCESS ? NS_OK :
+                                                        NS_ERROR_FAILURE;
+  }
 
-    /** 
-     * NotifyAll
-     * @see prmon.h 
-     **/      
-    nsresult NotifyAll()
-    {
-        return PR_NotifyAll(mReentrantMonitor) == PR_SUCCESS
-            ? NS_OK : NS_ERROR_FAILURE;
-    }
+  /**
+   * NotifyAll
+   * @see prmon.h
+   **/
+  nsresult NotifyAll()
+  {
+    return PR_NotifyAll(mReentrantMonitor) == PR_SUCCESS ? NS_OK :
+                                                           NS_ERROR_FAILURE;
+  }
 
 #ifdef DEBUG
-    /**
-     * AssertCurrentThreadIn
-     * @see prmon.h
-     **/
-    void AssertCurrentThreadIn()
-    {
-        PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mReentrantMonitor);
-    }
+  /**
+   * AssertCurrentThreadIn
+   * @see prmon.h
+   **/
+  void AssertCurrentThreadIn()
+  {
+    PR_ASSERT_CURRENT_THREAD_IN_MONITOR(mReentrantMonitor);
+  }
 
-    /**
-     * AssertNotCurrentThreadIn
-     * @see prmon.h
-     **/
-    void AssertNotCurrentThreadIn()
-    {
-        // FIXME bug 476536
-    }
+  /**
+   * AssertNotCurrentThreadIn
+   * @see prmon.h
+   **/
+  void AssertNotCurrentThreadIn()
+  {
+    // FIXME bug 476536
+  }
 
 #else
-    void AssertCurrentThreadIn()
-    {
-    }
-    void AssertNotCurrentThreadIn()
-    {
-    }
+  void AssertCurrentThreadIn() {}
+  void AssertNotCurrentThreadIn() {}
 
 #endif  // ifdef DEBUG
 
 private:
-    ReentrantMonitor();
-    ReentrantMonitor(const ReentrantMonitor&);
-    ReentrantMonitor& operator =(const ReentrantMonitor&);
+  ReentrantMonitor();
+  ReentrantMonitor(const ReentrantMonitor&);
+  ReentrantMonitor& operator=(const ReentrantMonitor&);
 
-    PRMonitor* mReentrantMonitor;
+  PRMonitor* mReentrantMonitor;
 #ifdef DEBUG
-    int32_t mEntryCount;
+  int32_t mEntryCount;
 #endif
 };
 
 
 /**
  * ReentrantMonitorAutoEnter
  * Enters the ReentrantMonitor when it enters scope, and exits it when
  * it leaves scope.
  *
  * MUCH PREFERRED to bare calls to ReentrantMonitor.Enter and Exit.
- */ 
+ */
 class NS_COM_GLUE MOZ_STACK_CLASS ReentrantMonitorAutoEnter
 {
 public:
-    /**
-     * Constructor
-     * The constructor aquires the given lock.  The destructor
-     * releases the lock.
-     * 
-     * @param aReentrantMonitor A valid mozilla::ReentrantMonitor*. 
-     **/
-    ReentrantMonitorAutoEnter(mozilla::ReentrantMonitor &aReentrantMonitor) :
-        mReentrantMonitor(&aReentrantMonitor)
-    {
-        NS_ASSERTION(mReentrantMonitor, "null monitor");
-        mReentrantMonitor->Enter();
-    }
-    
-    ~ReentrantMonitorAutoEnter(void)
-    {
-        mReentrantMonitor->Exit();
-    }
- 
-    nsresult Wait(PRIntervalTime interval = PR_INTERVAL_NO_TIMEOUT)
-    {
-       return mReentrantMonitor->Wait(interval);
-    }
+  /**
+   * Constructor
+   * The constructor aquires the given lock.  The destructor
+   * releases the lock.
+   *
+   * @param aReentrantMonitor A valid mozilla::ReentrantMonitor*.
+   **/
+  ReentrantMonitorAutoEnter(mozilla::ReentrantMonitor& aReentrantMonitor)
+    : mReentrantMonitor(&aReentrantMonitor)
+  {
+    NS_ASSERTION(mReentrantMonitor, "null monitor");
+    mReentrantMonitor->Enter();
+  }
 
-    nsresult Notify()
-    {
-        return mReentrantMonitor->Notify();
-    }
+  ~ReentrantMonitorAutoEnter(void)
+  {
+    mReentrantMonitor->Exit();
+  }
 
-    nsresult NotifyAll()
-    {
-        return mReentrantMonitor->NotifyAll();
-    }
+  nsresult Wait(PRIntervalTime aInterval = PR_INTERVAL_NO_TIMEOUT)
+  {
+    return mReentrantMonitor->Wait(aInterval);
+  }
+
+  nsresult Notify() { return mReentrantMonitor->Notify(); }
+  nsresult NotifyAll() { return mReentrantMonitor->NotifyAll(); }
 
 private:
-    ReentrantMonitorAutoEnter();
-    ReentrantMonitorAutoEnter(const ReentrantMonitorAutoEnter&);
-    ReentrantMonitorAutoEnter& operator =(const ReentrantMonitorAutoEnter&);
-    static void* operator new(size_t) CPP_THROW_NEW;
-    static void operator delete(void*);
+  ReentrantMonitorAutoEnter();
+  ReentrantMonitorAutoEnter(const ReentrantMonitorAutoEnter&);
+  ReentrantMonitorAutoEnter& operator=(const ReentrantMonitorAutoEnter&);
+  static void* operator new(size_t) CPP_THROW_NEW;
+  static void operator delete(void*);
 
-    mozilla::ReentrantMonitor* mReentrantMonitor;
+  mozilla::ReentrantMonitor* mReentrantMonitor;
 };
 
 /**
  * ReentrantMonitorAutoExit
  * Exit the ReentrantMonitor when it enters scope, and enters it when it leaves
  * scope.
  *
  * MUCH PREFERRED to bare calls to ReentrantMonitor.Exit and Enter.
  */
 class MOZ_STACK_CLASS ReentrantMonitorAutoExit
 {
 public:
-    /**
-     * Constructor
-     * The constructor releases the given lock.  The destructor
-     * acquires the lock. The lock must be held before constructing
-     * this object!
-     *
-     * @param aReentrantMonitor A valid mozilla::ReentrantMonitor*. It
-     *                 must be already locked.
-     **/
-    ReentrantMonitorAutoExit(ReentrantMonitor& aReentrantMonitor) :
-        mReentrantMonitor(&aReentrantMonitor)
-    {
-        NS_ASSERTION(mReentrantMonitor, "null monitor");
-        mReentrantMonitor->AssertCurrentThreadIn();
-        mReentrantMonitor->Exit();
-    }
+  /**
+   * Constructor
+   * The constructor releases the given lock.  The destructor
+   * acquires the lock. The lock must be held before constructing
+   * this object!
+   *
+   * @param aReentrantMonitor A valid mozilla::ReentrantMonitor*. It
+   *                 must be already locked.
+   **/
+  ReentrantMonitorAutoExit(ReentrantMonitor& aReentrantMonitor)
+    : mReentrantMonitor(&aReentrantMonitor)
+  {
+    NS_ASSERTION(mReentrantMonitor, "null monitor");
+    mReentrantMonitor->AssertCurrentThreadIn();
+    mReentrantMonitor->Exit();
+  }
 
-    ~ReentrantMonitorAutoExit(void)
-    {
-        mReentrantMonitor->Enter();
-    }
+  ~ReentrantMonitorAutoExit(void)
+  {
+    mReentrantMonitor->Enter();
+  }
 
 private:
-    ReentrantMonitorAutoExit();
-    ReentrantMonitorAutoExit(const ReentrantMonitorAutoExit&);
-    ReentrantMonitorAutoExit& operator =(const ReentrantMonitorAutoExit&);
-    static void* operator new(size_t) CPP_THROW_NEW;
-    static void operator delete(void*);
+  ReentrantMonitorAutoExit();
+  ReentrantMonitorAutoExit(const ReentrantMonitorAutoExit&);
+  ReentrantMonitorAutoExit& operator=(const ReentrantMonitorAutoExit&);
+  static void* operator new(size_t) CPP_THROW_NEW;
+  static void operator delete(void*);
 
-    ReentrantMonitor* mReentrantMonitor;
+  ReentrantMonitor* mReentrantMonitor;
 };
 
 } // namespace mozilla
 
 
 #endif // ifndef mozilla_ReentrantMonitor_h
--- a/xpcom/glue/nsArrayEnumerator.cpp
+++ b/xpcom/glue/nsArrayEnumerator.cpp
@@ -11,197 +11,209 @@
 #include "nsISimpleEnumerator.h"
 
 #include "nsCOMArray.h"
 #include "nsCOMPtr.h"
 
 class nsSimpleArrayEnumerator MOZ_FINAL : public nsISimpleEnumerator
 {
 public:
-    // nsISupports interface
-    NS_DECL_ISUPPORTS
+  // nsISupports interface
+  NS_DECL_ISUPPORTS
+
+  // nsISimpleEnumerator interface
+  NS_DECL_NSISIMPLEENUMERATOR
 
-    // nsISimpleEnumerator interface
-    NS_DECL_NSISIMPLEENUMERATOR
-
-    // nsSimpleArrayEnumerator methods
-    nsSimpleArrayEnumerator(nsIArray* aValueArray) :
-        mValueArray(aValueArray), mIndex(0) {
-    }
+  // nsSimpleArrayEnumerator methods
+  nsSimpleArrayEnumerator(nsIArray* aValueArray)
+    : mValueArray(aValueArray)
+    , mIndex(0)
+  {
+  }
 
 private:
-    ~nsSimpleArrayEnumerator() {}
+  ~nsSimpleArrayEnumerator() {}
 
 protected:
-    nsCOMPtr<nsIArray> mValueArray;
-    uint32_t mIndex;
+  nsCOMPtr<nsIArray> mValueArray;
+  uint32_t mIndex;
 };
 
 NS_IMPL_ISUPPORTS(nsSimpleArrayEnumerator, nsISimpleEnumerator)
 
 NS_IMETHODIMP
 nsSimpleArrayEnumerator::HasMoreElements(bool* aResult)
 {
-    NS_PRECONDITION(aResult != 0, "null ptr");
-    if (! aResult)
-        return NS_ERROR_NULL_POINTER;
+  NS_PRECONDITION(aResult != 0, "null ptr");
+  if (!aResult) {
+    return NS_ERROR_NULL_POINTER;
+  }
 
-    if (!mValueArray) {
-        *aResult = false;
-        return NS_OK;
-    }
+  if (!mValueArray) {
+    *aResult = false;
+    return NS_OK;
+  }
 
-    uint32_t cnt;
-    nsresult rv = mValueArray->GetLength(&cnt);
-    if (NS_FAILED(rv)) return rv;
-    *aResult = (mIndex < cnt);
-    return NS_OK;
+  uint32_t cnt;
+  nsresult rv = mValueArray->GetLength(&cnt);
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
+  *aResult = (mIndex < cnt);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSimpleArrayEnumerator::GetNext(nsISupports** aResult)
 {
-    NS_PRECONDITION(aResult != 0, "null ptr");
-    if (! aResult)
-        return NS_ERROR_NULL_POINTER;
+  NS_PRECONDITION(aResult != 0, "null ptr");
+  if (!aResult) {
+    return NS_ERROR_NULL_POINTER;
+  }
+
+  if (!mValueArray) {
+    *aResult = nullptr;
+    return NS_OK;
+  }
 
-    if (!mValueArray) {
-        *aResult = nullptr;
-        return NS_OK;
-    }
+  uint32_t cnt;
+  nsresult rv = mValueArray->GetLength(&cnt);
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
+  if (mIndex >= cnt) {
+    return NS_ERROR_UNEXPECTED;
+  }
 
-    uint32_t cnt;
-    nsresult rv = mValueArray->GetLength(&cnt);
-    if (NS_FAILED(rv)) return rv;
-    if (mIndex >= cnt)
-        return NS_ERROR_UNEXPECTED;
-
-    return mValueArray->QueryElementAt(mIndex++, NS_GET_IID(nsISupports), (void**)aResult);
+  return mValueArray->QueryElementAt(mIndex++, NS_GET_IID(nsISupports),
+                                     (void**)aResult);
 }
 
 nsresult
-NS_NewArrayEnumerator(nsISimpleEnumerator* *result,
-                      nsIArray* array)
+NS_NewArrayEnumerator(nsISimpleEnumerator** aResult, nsIArray* aArray)
 {
-    nsSimpleArrayEnumerator* enumer = new nsSimpleArrayEnumerator(array);
-    if (enumer == nullptr)
-        return NS_ERROR_OUT_OF_MEMORY;
+  nsSimpleArrayEnumerator* enumer = new nsSimpleArrayEnumerator(aArray);
+  if (!enumer) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
 
-    NS_ADDREF(*result = enumer);
-    return NS_OK;
+  NS_ADDREF(*aResult = enumer);
+  return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 
 // enumerator implementation for nsCOMArray
 // creates a snapshot of the array in question
 // you MUST use NS_NewArrayEnumerator to create this, so that
 // allocation is done correctly
 class nsCOMArrayEnumerator MOZ_FINAL : public nsISimpleEnumerator
 {
 public:
-    // nsISupports interface
-    NS_DECL_ISUPPORTS
+  // nsISupports interface
+  NS_DECL_ISUPPORTS
 
-    // nsISimpleEnumerator interface
-    NS_DECL_NSISIMPLEENUMERATOR
+  // nsISimpleEnumerator interface
+  NS_DECL_NSISIMPLEENUMERATOR
 
-    // nsSimpleArrayEnumerator methods
-    nsCOMArrayEnumerator() : mIndex(0) {
-    }
+  // nsSimpleArrayEnumerator methods
+  nsCOMArrayEnumerator() : mIndex(0) {}
 
-    // specialized operator to make sure we make room for mValues
-    void* operator new (size_t size, const nsCOMArray_base& aArray) CPP_THROW_NEW;
-    void operator delete(void* ptr) {
-        ::operator delete(ptr);
-    }
+  // specialized operator to make sure we make room for mValues
+  void* operator new(size_t aSize, const nsCOMArray_base& aArray) CPP_THROW_NEW;
+  void operator delete(void* aPtr) { ::operator delete(aPtr); }
 
 private:
-    ~nsCOMArrayEnumerator(void);
+  ~nsCOMArrayEnumerator(void);
 
 protected:
-    uint32_t mIndex;            // current position
-    uint32_t mArraySize;        // size of the array
-    
-    // this is actually bigger
-    nsISupports* mValueArray[1];
+  uint32_t mIndex;            // current position
+  uint32_t mArraySize;        // size of the array
+
+  // this is actually bigger
+  nsISupports* mValueArray[1];
 };
 
 NS_IMPL_ISUPPORTS(nsCOMArrayEnumerator, nsISimpleEnumerator)
 
 nsCOMArrayEnumerator::~nsCOMArrayEnumerator()
 {
-    // only release the entries that we haven't visited yet
-    for (; mIndex < mArraySize; ++mIndex) {
-        NS_IF_RELEASE(mValueArray[mIndex]);
-    }
+  // only release the entries that we haven't visited yet
+  for (; mIndex < mArraySize; ++mIndex) {
+    NS_IF_RELEASE(mValueArray[mIndex]);
+  }
 }
 
 NS_IMETHODIMP
 nsCOMArrayEnumerator::HasMoreElements(bool* aResult)
 {
-    NS_PRECONDITION(aResult != 0, "null ptr");
-    if (! aResult)
-        return NS_ERROR_NULL_POINTER;
+  NS_PRECONDITION(aResult != 0, "null ptr");
+  if (!aResult) {
+    return NS_ERROR_NULL_POINTER;
+  }
 
-    *aResult = (mIndex < mArraySize);
-    return NS_OK;
+  *aResult = (mIndex < mArraySize);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsCOMArrayEnumerator::GetNext(nsISupports** aResult)
 {
-    NS_PRECONDITION(aResult != 0, "null ptr");
-    if (! aResult)
-        return NS_ERROR_NULL_POINTER;
+  NS_PRECONDITION(aResult != 0, "null ptr");
+  if (!aResult) {
+    return NS_ERROR_NULL_POINTER;
+  }
 
-    if (mIndex >= mArraySize)
-        return NS_ERROR_UNEXPECTED;
+  if (mIndex >= mArraySize) {
+    return NS_ERROR_UNEXPECTED;
+  }
 
-    // pass the ownership of the reference to the caller. Since
-    // we AddRef'ed during creation of |this|, there is no need
-    // to AddRef here
-    *aResult = mValueArray[mIndex++];
+  // pass the ownership of the reference to the caller. Since
+  // we AddRef'ed during creation of |this|, there is no need
+  // to AddRef here
+  *aResult = mValueArray[mIndex++];
 
-    // this really isn't necessary. just pretend this happens, since
-    // we'll never visit this value again!
-    // mValueArray[(mIndex-1)] = nullptr;
-    
-    return NS_OK;
+  // this really isn't necessary. just pretend this happens, since
+  // we'll never visit this value again!
+  // mValueArray[(mIndex-1)] = nullptr;
+
+  return NS_OK;
 }
 
 void*
-nsCOMArrayEnumerator::operator new (size_t size, const nsCOMArray_base& aArray)
-    CPP_THROW_NEW
+nsCOMArrayEnumerator::operator new(size_t aSize,
+                                   const nsCOMArray_base& aArray) CPP_THROW_NEW
 {
-    // create enough space such that mValueArray points to a large
-    // enough value. Note that the initial value of size gives us
-    // space for mValueArray[0], so we must subtract
-    size += (aArray.Count() - 1) * sizeof(aArray[0]);
+  // create enough space such that mValueArray points to a large
+  // enough value. Note that the initial value of aSize gives us
+  // space for mValueArray[0], so we must subtract
+  aSize += (aArray.Count() - 1) * sizeof(aArray[0]);
 
-    // do the actual allocation
-    nsCOMArrayEnumerator * result =
-        static_cast<nsCOMArrayEnumerator*>(::operator new(size));
+  // do the actual allocation
+  nsCOMArrayEnumerator* result =
+    static_cast<nsCOMArrayEnumerator*>(::operator new(aSize));
 
-    // now need to copy over the values, and addref each one
-    // now this might seem like a lot of work, but we're actually just
-    // doing all our AddRef's ahead of time since GetNext() doesn't
-    // need to AddRef() on the way out
-    uint32_t i;
-    uint32_t max = result->mArraySize = aArray.Count();
-    for (i = 0; i<max; i++) {
-        result->mValueArray[i] = aArray[i];
-        NS_IF_ADDREF(result->mValueArray[i]);
-    }
+  // now need to copy over the values, and addref each one
+  // now this might seem like a lot of work, but we're actually just
+  // doing all our AddRef's ahead of time since GetNext() doesn't
+  // need to AddRef() on the way out
+  uint32_t i;
+  uint32_t max = result->mArraySize = aArray.Count();
+  for (i = 0; i < max; ++i) {
+    result->mValueArray[i] = aArray[i];
+    NS_IF_ADDREF(result->mValueArray[i]);
+  }
 
-    return result;
+  return result;
 }
 
 nsresult
-NS_NewArrayEnumerator(nsISimpleEnumerator* *aResult,
+NS_NewArrayEnumerator(nsISimpleEnumerator** aResult,
                       const nsCOMArray_base& aArray)
 {
-    nsCOMArrayEnumerator *enumerator = new (aArray) nsCOMArrayEnumerator();
-    if (!enumerator) return NS_ERROR_OUT_OF_MEMORY;
+  nsCOMArrayEnumerator* enumerator = new (aArray) nsCOMArrayEnumerator();
+  if (!enumerator) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
 
-    NS_ADDREF(*aResult = enumerator);
-    return NS_OK;
+  NS_ADDREF(*aResult = enumerator);
+  return NS_OK;
 }
--- a/xpcom/glue/nsArrayEnumerator.h
+++ b/xpcom/glue/nsArrayEnumerator.h
@@ -12,20 +12,20 @@
 
 class nsISimpleEnumerator;
 class nsIArray;
 class nsCOMArray_base;
 
 // Create an enumerator for an existing nsIArray implementation
 // The enumerator holds an owning reference to the array.
 NS_COM_GLUE nsresult
-NS_NewArrayEnumerator(nsISimpleEnumerator* *result,
-                      nsIArray* array);
+NS_NewArrayEnumerator(nsISimpleEnumerator** aResult,
+                      nsIArray* aArray);
 
 // create an enumerator for an existing nsCOMArray<T> implementation
 // The enumerator will hold an owning reference to each ELEMENT in
 // the array. This means that the nsCOMArray<T> can safely go away
 // without its objects going away.
 NS_COM_GLUE nsresult
-NS_NewArrayEnumerator(nsISimpleEnumerator* *aResult,
+NS_NewArrayEnumerator(nsISimpleEnumerator** aResult,
                       const nsCOMArray_base& aArray);
 
 #endif
--- a/xpcom/glue/nsArrayUtils.cpp
+++ b/xpcom/glue/nsArrayUtils.cpp
@@ -5,18 +5,18 @@
 
 #include "nsArrayUtils.h"
 
 //
 // do_QueryElementAt helper stuff
 //
 nsresult
 nsQueryArrayElementAt::operator()(const nsIID& aIID, void** aResult) const
-  {
-    nsresult status = mArray
-        ? mArray->QueryElementAt(mIndex, aIID, aResult)
-        : NS_ERROR_NULL_POINTER;
+{
+  nsresult status = mArray ? mArray->QueryElementAt(mIndex, aIID, aResult) :
+                             NS_ERROR_NULL_POINTER;
 
-    if (mErrorPtr)
-      *mErrorPtr = status;
+  if (mErrorPtr) {
+    *mErrorPtr = status;
+  }
 
-    return status;
-  }
+  return status;
+}
--- a/xpcom/glue/nsArrayUtils.h
+++ b/xpcom/glue/nsArrayUtils.h
@@ -6,35 +6,33 @@
 #ifndef nsArrayUtils_h__
 #define nsArrayUtils_h__
 
 #include "nsCOMPtr.h"
 #include "nsIArray.h"
 
 // helper class for do_QueryElementAt
 class NS_COM_GLUE nsQueryArrayElementAt : public nsCOMPtr_helper
+{
+public:
+  nsQueryArrayElementAt(nsIArray* aArray, uint32_t aIndex,
+                        nsresult* aErrorPtr)
+    : mArray(aArray)
+    , mIndex(aIndex)
+    , mErrorPtr(aErrorPtr)
   {
-    public:
-      nsQueryArrayElementAt(nsIArray* aArray, uint32_t aIndex,
-                            nsresult* aErrorPtr)
-          : mArray(aArray),
-            mIndex(aIndex),
-            mErrorPtr(aErrorPtr)
-        {
-          // nothing else to do here
-        }
-
-      virtual nsresult NS_FASTCALL operator()(const nsIID& aIID, void**) const;
-
-    private:
-      nsIArray*  mArray;
-      uint32_t   mIndex;
-      nsresult*  mErrorPtr;
-  };
-
-inline
-const nsQueryArrayElementAt
-do_QueryElementAt(nsIArray* aArray, uint32_t aIndex, nsresult* aErrorPtr = 0)
-  {
-    return nsQueryArrayElementAt(aArray, aIndex, aErrorPtr);
   }
 
+  virtual nsresult NS_FASTCALL operator()(const nsIID& aIID, void**) const;
+
+private:
+  nsIArray*  mArray;
+  uint32_t   mIndex;
+  nsresult*  mErrorPtr;
+};
+
+inline const nsQueryArrayElementAt
+do_QueryElementAt(nsIArray* aArray, uint32_t aIndex, nsresult* aErrorPtr = 0)
+{
+  return nsQueryArrayElementAt(aArray, aIndex, aErrorPtr);
+}
+
 #endif // nsArrayUtils_h__
--- a/xpcom/glue/nsBaseHashtable.h
+++ b/xpcom/glue/nsBaseHashtable.h
@@ -7,273 +7,274 @@
 #define nsBaseHashtable_h__
 
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Move.h"
 #include "nsTHashtable.h"
 #include "prlock.h"
 #include "nsDebug.h"
 
-template<class KeyClass,class DataType,class UserDataType>
+template<class KeyClass, class DataType, class UserDataType>
 class nsBaseHashtable; // forward declaration
 
 /**
  * the private nsTHashtable::EntryType class used by nsBaseHashtable
  * @see nsTHashtable for the specification of this class
  * @see nsBaseHashtable for template parameters
  */
-template<class KeyClass,class DataType>
+template<class KeyClass, class DataType>
 class nsBaseHashtableET : public KeyClass
 {
 public:
   DataType mData;
-  friend class nsTHashtable< nsBaseHashtableET<KeyClass,DataType> >;
+  friend class nsTHashtable<nsBaseHashtableET<KeyClass, DataType>>;
 
 private:
   typedef typename KeyClass::KeyType KeyType;
   typedef typename KeyClass::KeyTypePointer KeyTypePointer;
-  
+
   nsBaseHashtableET(KeyTypePointer aKey);
-  nsBaseHashtableET(nsBaseHashtableET<KeyClass,DataType>&& toMove);
+  nsBaseHashtableET(nsBaseHashtableET<KeyClass, DataType>&& aToMove);
   ~nsBaseHashtableET();
 };
 
 /**
  * templated hashtable for simple data types
  * This class manages simple data types that do not need construction or
  * destruction.
  *
  * @param KeyClass a wrapper-class for the hashtable key, see nsHashKeys.h
  *   for a complete specification.
  * @param DataType the datatype stored in the hashtable,
  *   for example, uint32_t or nsCOMPtr.  If UserDataType is not the same,
  *   DataType must implicitly cast to UserDataType
  * @param UserDataType the user sees, for example uint32_t or nsISupports*
  */
-template<class KeyClass,class DataType,class UserDataType>
-class nsBaseHashtable :
-  protected nsTHashtable< nsBaseHashtableET<KeyClass,DataType> >
+template<class KeyClass, class DataType, class UserDataType>
+class nsBaseHashtable
+  : protected nsTHashtable<nsBaseHashtableET<KeyClass, DataType>>
 {
   typedef mozilla::fallible_t fallible_t;
 
 public:
   typedef typename KeyClass::KeyType KeyType;
-  typedef nsBaseHashtableET<KeyClass,DataType> EntryType;
+  typedef nsBaseHashtableET<KeyClass, DataType> EntryType;
 
   using nsTHashtable<EntryType>::Contains;
 
-  nsBaseHashtable()
-  {
-  }
+  nsBaseHashtable() {}
   explicit nsBaseHashtable(uint32_t aInitSize)
     : nsTHashtable<EntryType>(aInitSize)
   {
   }
 
   /**
    * Return the number of entries in the table.
    * @return    number of entries
    */
-  uint32_t Count() const
-  { return nsTHashtable<EntryType>::Count(); }
+  uint32_t Count() const { return nsTHashtable<EntryType>::Count(); }
 
   /**
    * retrieve the value for a key.
    * @param aKey the key to retreive
-   * @param pData data associated with this key will be placed at this
-   *   pointer.  If you only need to check if the key exists, pData
+   * @param aData data associated with this key will be placed at this
+   *   pointer.  If you only need to check if the key exists, aData
    *   may be null.
-   * @return true if the key exists. If key does not exist, pData is not
+   * @return true if the key exists. If key does not exist, aData is not
    *   modified.
    */
-  bool Get(KeyType aKey, UserDataType* pData) const
+  bool Get(KeyType aKey, UserDataType* aData) const
   {
     EntryType* ent = this->GetEntry(aKey);
-
-    if (!ent)
+    if (!ent) {
       return false;
+    }
 
-    if (pData)
-      *pData = ent->mData;
+    if (aData) {
+      *aData = ent->mData;
+    }
 
     return true;
   }
 
   /**
    * For pointer types, get the value, returning nullptr if the entry is not
    * present in the table.
    *
    * @param aKey the key to retrieve
    * @return The found value, or nullptr if no entry was found with the given key.
    * @note If nullptr values are stored in the table, it is not possible to
    *       distinguish between a nullptr value and a missing entry.
    */
   UserDataType Get(KeyType aKey) const
   {
     EntryType* ent = this->GetEntry(aKey);
-    if (!ent)
+    if (!ent) {
       return 0;
+    }
 
     return ent->mData;
   }
 
   /**
    * put a new value for the associated key
    * @param aKey the key to put
    * @param aData the new data
    * @return always true, unless memory allocation failed
    */
   void Put(KeyType aKey, const UserDataType& aData)
   {
-    if (!Put(aKey, aData, fallible_t()))
+    if (!Put(aKey, aData, fallible_t())) {
       NS_ABORT_OOM(this->mTable.entrySize * this->mTable.entryCount);
+    }
   }
 
-  bool Put(KeyType aKey, const UserDataType& aData, const fallible_t&) NS_WARN_UNUSED_RESULT
-  {
+  NS_WARN_UNUSED_RESULT bool Put(KeyType aKey, const UserDataType& aData,
+                                 const fallible_t&) {
     EntryType* ent = this->PutEntry(aKey);
-
-    if (!ent)
+    if (!ent) {
       return false;
+    }
 
     ent->mData = aData;
 
     return true;
   }
 
   /**
    * remove the data for the associated key
    * @param aKey the key to remove from the hashtable
    */
   void Remove(KeyType aKey) { this->RemoveEntry(aKey); }
 
   /**
    * function type provided by the application for enumeration.
    * @param aKey the key being enumerated
    * @param aData data being enumerated
-   * @parm userArg passed unchanged from Enumerate
+   * @param aUserArg passed unchanged from Enumerate
    * @return either
    *   @link PLDHashOperator::PL_DHASH_NEXT PL_DHASH_NEXT @endlink or
    *   @link PLDHashOperator::PL_DHASH_STOP PL_DHASH_STOP @endlink
    */
-  typedef PLDHashOperator
-    (* EnumReadFunction)(KeyType      aKey,
-                         UserDataType aData,
-                         void*        userArg);
+  typedef PLDHashOperator (*EnumReadFunction)(KeyType aKey,
+                                              UserDataType aData,
+                                              void* aUserArg);
 
   /**
    * enumerate entries in the hashtable, without allowing changes
-   * @param enumFunc enumeration callback
-   * @param userArg passed unchanged to the EnumReadFunction
+   * @param aEnumFunc enumeration callback
+   * @param aUserArg passed unchanged to the EnumReadFunction
    */
-  uint32_t EnumerateRead(EnumReadFunction enumFunc, void* userArg) const
+  uint32_t EnumerateRead(EnumReadFunction aEnumFunc, void* aUserArg) const
   {
     NS_ASSERTION(this->mTable.entrySize,
                  "nsBaseHashtable was not initialized properly.");
 
-    s_EnumReadArgs enumData = { enumFunc, userArg };
+    s_EnumReadArgs enumData = { aEnumFunc, aUserArg };
     return PL_DHashTableEnumerate(const_cast<PLDHashTable*>(&this->mTable),
                                   s_EnumReadStub,
                                   &enumData);
   }
 
   /**
    * function type provided by the application for enumeration.
    * @param aKey the key being enumerated
    * @param aData Reference to data being enumerated, may be altered. e.g. for
    *        nsInterfaceHashtable this is an nsCOMPtr reference...
-   * @parm userArg passed unchanged from Enumerate
+   * @parm aUserArg passed unchanged from Enumerate
    * @return bitflag combination of
    *   @link PLDHashOperator::PL_DHASH_REMOVE @endlink,
    *   @link PLDHashOperator::PL_DHASH_NEXT PL_DHASH_NEXT @endlink, or
    *   @link PLDHashOperator::PL_DHASH_STOP PL_DHASH_STOP @endlink
    */
-  typedef PLDHashOperator
-    (* EnumFunction)(KeyType       aKey,
-                     DataType&     aData,
-                     void*         userArg);
+  typedef PLDHashOperator (*EnumFunction)(KeyType aKey,
+                                          DataType& aData,
+                                          void* aUserArg);
 
   /**
    * enumerate entries in the hashtable, allowing changes. This
    * functions write-locks the hashtable.
-   * @param enumFunc enumeration callback
-   * @param userArg passed unchanged to the EnumFunction
+   * @param aEnumFunc enumeration callback
+   * @param aUserArg passed unchanged to the EnumFunction
    */
-  uint32_t Enumerate(EnumFunction enumFunc, void* userArg)
+  uint32_t Enumerate(EnumFunction aEnumFunc, void* aUserArg)
   {
     NS_ASSERTION(this->mTable.entrySize,
                  "nsBaseHashtable was not initialized properly.");
 
-    s_EnumArgs enumData = { enumFunc, userArg };
+    s_EnumArgs enumData = { aEnumFunc, aUserArg };
     return PL_DHashTableEnumerate(&this->mTable,
                                   s_EnumStub,
                                   &enumData);
   }
 
   /**
    * reset the hashtable, removing all entries
    */
   void Clear() { nsTHashtable<EntryType>::Clear(); }
 
   /**
    * client must provide a SizeOfEntryExcludingThisFun function for
    *   SizeOfExcludingThis.
    * @param     aKey the key being enumerated
    * @param     aData Reference to data being enumerated.
-   * @param     mallocSizeOf the function used to measure heap-allocated blocks
-   * @param     userArg passed unchanged from SizeOf{In,Ex}cludingThis
+   * @param     aMallocSizeOf the function used to measure heap-allocated blocks
+   * @param     aUserArg passed unchanged from SizeOf{In,Ex}cludingThis
    * @return    summed size of the things pointed to by the entries
    */
   typedef size_t
-    (* SizeOfEntryExcludingThisFun)(KeyType           aKey,
-                                    const DataType    &aData,
-                                    mozilla::MallocSizeOf mallocSizeOf,
-                                    void*             userArg);
+    (*SizeOfEntryExcludingThisFun)(KeyType aKey,
+                                   const DataType &aData,
+                                   mozilla::MallocSizeOf aMallocSizeOf,
+                                   void* aUserArg);
 
   /**
    * Measure the size of the table's entry storage and the table itself.
-   * If |sizeOfEntryExcludingThis| is non-nullptr, measure the size of things
+   * If |aSizeOfEntryExcludingThis| is non-nullptr, measure the size of things
    * pointed to by entries.
    *
-   * @param    sizeOfEntryExcludingThis
+   * @param    aSizeOfEntryExcludingThis
    *           the <code>SizeOfEntryExcludingThisFun</code> function to call
-   * @param    mallocSizeOf the function used to meeasure heap-allocated blocks
-   * @param    userArg a point to pass to the
+   * @param    aMallocSizeOf the function used to meeasure heap-allocated blocks
+   * @param    aUserArg a point to pass to the
    *           <code>SizeOfEntryExcludingThisFun</code> function
    * @return   the summed size of the entries, the table, and the table's storage
    */
-  size_t SizeOfIncludingThis(SizeOfEntryExcludingThisFun sizeOfEntryExcludingThis,
-                             mozilla::MallocSizeOf mallocSizeOf, void *userArg = nullptr)
+  size_t SizeOfIncludingThis(SizeOfEntryExcludingThisFun aSizeOfEntryExcludingThis,
+                             mozilla::MallocSizeOf aMallocSizeOf,
+                             void* aUserArg = nullptr)
   {
-    return mallocSizeOf(this) + this->SizeOfExcludingThis(sizeOfEntryExcludingThis,
-                                                          mallocSizeOf, userArg);
+    return aMallocSizeOf(this) +
+      this->SizeOfExcludingThis(aSizeOfEntryExcludingThis, aMallocSizeOf,
+                                aUserArg);
   }
 
   /**
    * Measure the size of the table's entry storage, and if
-   * |sizeOfEntryExcludingThis| is non-nullptr, measure the size of things pointed
-   * to by entries.
-   * 
-   * @param     sizeOfEntryExcludingThis the
+   * |aSizeOfEntryExcludingThis| is non-nullptr, measure the size of things
+   * pointed to by entries.
+   *
+   * @param     aSizeOfEntryExcludingThis the
    *            <code>SizeOfEntryExcludingThisFun</code> function to call
-   * @param     mallocSizeOf the function used to measure heap-allocated blocks
-   * @param     userArg a pointer to pass to the
+   * @param     aMallocSizeOf the function used to measure heap-allocated blocks
+   * @param     aUserArg a pointer to pass to the
    *            <code>SizeOfEntryExcludingThisFun</code> function
    * @return    the summed size of all the entries
    */
-  size_t SizeOfExcludingThis(SizeOfEntryExcludingThisFun sizeOfEntryExcludingThis,
-                             mozilla::MallocSizeOf mallocSizeOf, void *userArg = nullptr) const
+  size_t SizeOfExcludingThis(SizeOfEntryExcludingThisFun aSizeOfEntryExcludingThis,
+                             mozilla::MallocSizeOf aMallocSizeOf,
+                             void* aUserArg = nullptr) const
   {
-    if (sizeOfEntryExcludingThis) {
-      s_SizeOfArgs args = { sizeOfEntryExcludingThis, userArg };
+    if (aSizeOfEntryExcludingThis) {
+      s_SizeOfArgs args = { aSizeOfEntryExcludingThis, aUserArg };
       return PL_DHashTableSizeOfExcludingThis(&this->mTable, s_SizeOfStub,
-                                              mallocSizeOf, &args);
+                                              aMallocSizeOf, &args);
     }
     return PL_DHashTableSizeOfExcludingThis(&this->mTable, nullptr,
-                                            mallocSizeOf);
+                                            aMallocSizeOf);
   }
 
 #ifdef DEBUG
   using nsTHashtable<EntryType>::MarkImmutable;
 #endif
 
 protected:
   /**
@@ -282,63 +283,63 @@ protected:
    * @param userArg the userArg passed to EnumerateRead
    */
   struct s_EnumReadArgs
   {
     EnumReadFunction func;
     void* userArg;
   };
 
-  static PLDHashOperator s_EnumReadStub(PLDHashTable    *table,
-                                        PLDHashEntryHdr *hdr,
-                                        uint32_t         number,
-                                        void            *arg);
+  static PLDHashOperator s_EnumReadStub(PLDHashTable* aTable,
+                                        PLDHashEntryHdr* aHdr,
+                                        uint32_t aNumber,
+                                        void* aArg);
 
   struct s_EnumArgs
   {
     EnumFunction func;
     void* userArg;
   };
 
-  static PLDHashOperator s_EnumStub(PLDHashTable      *table,
-                                    PLDHashEntryHdr   *hdr,
-                                    uint32_t           number,
-                                    void              *arg);
+  static PLDHashOperator s_EnumStub(PLDHashTable* aTable,
+                                    PLDHashEntryHdr* aHdr,
+                                    uint32_t aNumber,
+                                    void* aArg);
 
   struct s_SizeOfArgs
   {
     SizeOfEntryExcludingThisFun func;
     void* userArg;
   };
-  
-  static size_t s_SizeOfStub(PLDHashEntryHdr *entry,
-                             mozilla::MallocSizeOf mallocSizeOf,
-                             void *arg);
+
+  static size_t s_SizeOfStub(PLDHashEntryHdr* aEntry,
+                             mozilla::MallocSizeOf aMallocSizeOf,
+                             void* aArg);
 };
 
 class nsCycleCollectionTraversalCallback;
 
 struct MOZ_STACK_CLASS nsBaseHashtableCCTraversalData
 {
   nsBaseHashtableCCTraversalData(nsCycleCollectionTraversalCallback& aCallback,
                                  const char* aName,
                                  uint32_t aFlags)
-  : mCallback(aCallback),
-    mName(aName),
-    mFlags(aFlags)
+    : mCallback(aCallback)
+    , mName(aName)
+    , mFlags(aFlags)
   {
   }
 
   nsCycleCollectionTraversalCallback& mCallback;
   const char* mName;
   uint32_t mFlags;
 
 };
 
-template <typename K, typename T>
+template<typename K, typename T>
 PLDHashOperator
 ImplCycleCollectionTraverse_EnumFunc(K aKey,
                                      T aData,
                                      void* aUserData)
 {
   nsBaseHashtableCCTraversalData* userData =
     static_cast<nsBaseHashtableCCTraversalData*>(aUserData);
 
@@ -348,71 +349,75 @@ ImplCycleCollectionTraverse_EnumFunc(K a
                            userData->mFlags);
   return PL_DHASH_NEXT;
 }
 
 //
 // nsBaseHashtableET definitions
 //
 
-template<class KeyClass,class DataType>
-nsBaseHashtableET<KeyClass,DataType>::nsBaseHashtableET(KeyTypePointer aKey) :
-  KeyClass(aKey)
-{ }
+template<class KeyClass, class DataType>
+nsBaseHashtableET<KeyClass, DataType>::nsBaseHashtableET(KeyTypePointer aKey)
+  : KeyClass(aKey)
+{
+}
 
-template<class KeyClass,class DataType>
-nsBaseHashtableET<KeyClass,DataType>::nsBaseHashtableET
-  (nsBaseHashtableET<KeyClass,DataType>&& toMove) :
-  KeyClass(mozilla::Move(toMove)),
-  mData(mozilla::Move(toMove.mData))
-{ }
+template<class KeyClass, class DataType>
+nsBaseHashtableET<KeyClass, DataType>::nsBaseHashtableET(
+      nsBaseHashtableET<KeyClass, DataType>&& aToMove)
+  : KeyClass(mozilla::Move(aToMove))
+  , mData(mozilla::Move(aToMove.mData))
+{
+}
 
-template<class KeyClass,class DataType>
-nsBaseHashtableET<KeyClass,DataType>::~nsBaseHashtableET()
-{ }
+template<class KeyClass, class DataType>
+nsBaseHashtableET<KeyClass, DataType>::~nsBaseHashtableET()
+{
+}
 
 
 //
 // nsBaseHashtable definitions
 //
 
-template<class KeyClass,class DataType,class UserDataType>
+template<class KeyClass, class DataType, class UserDataType>
 PLDHashOperator
-nsBaseHashtable<KeyClass,DataType,UserDataType>::s_EnumReadStub
-  (PLDHashTable *table, PLDHashEntryHdr *hdr, uint32_t number, void* arg)
+nsBaseHashtable<KeyClass, DataType, UserDataType>::s_EnumReadStub(
+    PLDHashTable* aTable, PLDHashEntryHdr* aHdr, uint32_t aNumber, void* aArg)
 {
-  EntryType* ent = static_cast<EntryType*>(hdr);
-  s_EnumReadArgs* eargs = (s_EnumReadArgs*) arg;
+  EntryType* ent = static_cast<EntryType*>(aHdr);
+  s_EnumReadArgs* eargs = (s_EnumReadArgs*)aArg;
 
   PLDHashOperator res = (eargs->func)(ent->GetKey(), ent->mData, eargs->userArg);
 
-  NS_ASSERTION( !(res & PL_DHASH_REMOVE ),
-                "PL_DHASH_REMOVE return during const enumeration; ignoring.");
+  NS_ASSERTION(!(res & PL_DHASH_REMOVE),
+               "PL_DHASH_REMOVE return during const enumeration; ignoring.");
 
-  if (res & PL_DHASH_STOP)
+  if (res & PL_DHASH_STOP) {
     return PL_DHASH_STOP;
+  }
 
   return PL_DHASH_NEXT;
 }
 
-template<class KeyClass,class DataType,class UserDataType>
+template<class KeyClass, class DataType, class UserDataType>
 PLDHashOperator
-nsBaseHashtable<KeyClass,DataType,UserDataType>::s_EnumStub
-  (PLDHashTable *table, PLDHashEntryHdr *hdr, uint32_t number, void* arg)
+nsBaseHashtable<KeyClass, DataType, UserDataType>::s_EnumStub(
+    PLDHashTable* aTable, PLDHashEntryHdr* aHdr, uint32_t aNumber, void* aArg)
 {
-  EntryType* ent = static_cast<EntryType*>(hdr);
-  s_EnumArgs* eargs = (s_EnumArgs*) arg;
+  EntryType* ent = static_cast<EntryType*>(aHdr);
+  s_EnumArgs* eargs = (s_EnumArgs*)aArg;
 
   return (eargs->func)(ent->GetKey(), ent->mData, eargs->userArg);
 }
 
-template<class KeyClass,class DataType,class UserDataType>
+template<class KeyClass, class DataType, class UserDataType>
 size_t
-nsBaseHashtable<KeyClass,DataType,UserDataType>::s_SizeOfStub
-  (PLDHashEntryHdr *hdr, mozilla::MallocSizeOf mallocSizeOf, void *arg)
+nsBaseHashtable<KeyClass, DataType, UserDataType>::s_SizeOfStub(
+    PLDHashEntryHdr* aHdr, mozilla::MallocSizeOf aMallocSizeOf, void* aArg)
 {
-  EntryType* ent = static_cast<EntryType*>(hdr);
-  s_SizeOfArgs* eargs = static_cast<s_SizeOfArgs*>(arg);
+  EntryType* ent = static_cast<EntryType*>(aHdr);
+  s_SizeOfArgs* eargs = static_cast<s_SizeOfArgs*>(aArg);
 
-  return (eargs->func)(ent->GetKey(), ent->mData, mallocSizeOf, eargs->userArg);
+  return (eargs->func)(ent->GetKey(), ent->mData, aMallocSizeOf, eargs->userArg);
 }
 
 #endif // nsBaseHashtable_h__
--- a/xpcom/glue/nsCOMArray.cpp
+++ b/xpcom/glue/nsCOMArray.cpp
@@ -9,299 +9,326 @@
 
 #include "nsCOMPtr.h"
 
 // This specialization is private to nsCOMArray.
 // It exists solely to automatically zero-out newly created array elements.
 template<>
 class nsTArrayElementTraits<nsISupports*>
 {
-    typedef nsISupports* E;
+  typedef nsISupports* E;
 public:
-    // Zero out the value
-    static inline void Construct(E *e) {
-        new (static_cast<void *>(e)) E();
-    }
-    // Invoke the copy-constructor in place.
-    template<class A>
-    static inline void Construct(E *e, const A &arg) {
-        new (static_cast<void *>(e)) E(arg);
-    }
-    // Invoke the destructor in place.
-    static inline void Destruct(E *e) {
-        e->~E();
-    }
+  // Zero out the value
+  static inline void Construct(E* aE)
+  {
+    new (static_cast<void*>(aE)) E();
+  }
+  // Invoke the copy-constructor in place.
+  template<class A>
+  static inline void Construct(E* aE, const A& aArg)
+  {
+    new (static_cast<void*>(aE)) E(aArg);
+  }
+  // Invoke the destructor in place.
+  static inline void Destruct(E* aE)
+  {
+    aE->~E();
+  }
 };
 
-static void ReleaseObjects(nsTArray<nsISupports*> &aArray);
+static void ReleaseObjects(nsTArray<nsISupports*>& aArray);
 
 // implementations of non-trivial methods in nsCOMArray_base
 
 nsCOMArray_base::nsCOMArray_base(const nsCOMArray_base& aOther)
 {
-    // make sure we do only one allocation
-    mArray.SetCapacity(aOther.Count());
-    AppendObjects(aOther);
+  // make sure we do only one allocation
+  mArray.SetCapacity(aOther.Count());
+  AppendObjects(aOther);
 }
 
 nsCOMArray_base::~nsCOMArray_base()
 {
-    Clear();
+  Clear();
 }
 
 int32_t
 nsCOMArray_base::IndexOf(nsISupports* aObject, uint32_t aStartIndex) const
 {
   return mArray.IndexOf(aObject, aStartIndex);
 }
 
 int32_t
 nsCOMArray_base::IndexOfObject(nsISupports* aObject) const
 {
-    nsCOMPtr<nsISupports> supports = do_QueryInterface(aObject);
-    if (NS_WARN_IF(!supports))
-        return -1;
+  nsCOMPtr<nsISupports> supports = do_QueryInterface(aObject);
+  if (NS_WARN_IF(!supports)) {
+    return -1;
+  }
 
-    uint32_t i, count;
-    int32_t retval = -1;
-    count = mArray.Length();
-    for (i = 0; i < count; ++i) {
-        nsCOMPtr<nsISupports> arrayItem = do_QueryInterface(mArray[i]);
-        if (arrayItem == supports) {
-            retval = i;
-            break;
-        }
+  uint32_t i, count;
+  int32_t retval = -1;
+  count = mArray.Length();
+  for (i = 0; i < count; ++i) {
+    nsCOMPtr<nsISupports> arrayItem = do_QueryInterface(mArray[i]);
+    if (arrayItem == supports) {
+      retval = i;
+      break;
     }
-    return retval;
+  }
+  return retval;
 }
 
 bool
 nsCOMArray_base::EnumerateForwards(nsBaseArrayEnumFunc aFunc, void* aData) const
 {
-    for (uint32_t index = 0; index < mArray.Length(); index++)
-        if (!(*aFunc)(mArray[index], aData))
-            return false;
+  for (uint32_t index = 0; index < mArray.Length(); ++index) {
+    if (!(*aFunc)(mArray[index], aData)) {
+      return false;
+    }
+  }
 
-    return true;
+  return true;
 }
 
 bool
 nsCOMArray_base::EnumerateBackwards(nsBaseArrayEnumFunc aFunc, void* aData) const
 {
-    for (uint32_t index = mArray.Length(); index--; )
-        if (!(*aFunc)(mArray[index], aData))
-            return false;
+  for (uint32_t index = mArray.Length(); index--; ) {
+    if (!(*aFunc)(mArray[index], aData)) {
+      return false;
+    }
+  }
 
-    return true;
+  return true;
 }
 
 int
-nsCOMArray_base::nsCOMArrayComparator(const void* aElement1, const void* aElement2, void* aData)
+nsCOMArray_base::nsCOMArrayComparator(const void* aElement1,
+                                      const void* aElement2,
+                                      void* aData)
 {
-    nsCOMArrayComparatorContext* ctx = static_cast<nsCOMArrayComparatorContext*>(aData);
-    return (*ctx->mComparatorFunc)(*static_cast<nsISupports* const*>(aElement1),
-                                   *static_cast<nsISupports* const*>(aElement2),
-                                   ctx->mData);
+  nsCOMArrayComparatorContext* ctx =
+    static_cast<nsCOMArrayComparatorContext*>(aData);
+  return (*ctx->mComparatorFunc)(*static_cast<nsISupports* const*>(aElement1),
+                                 *static_cast<nsISupports* const*>(aElement2),
+                                 ctx->mData);
 }
 
 void
 nsCOMArray_base::Sort(nsBaseArrayComparatorFunc aFunc, void* aData)
 {
-    if (mArray.Length() > 1) {
-        nsCOMArrayComparatorContext ctx = {aFunc, aData};
-        NS_QuickSort(mArray.Elements(), mArray.Length(), sizeof(nsISupports*),
-                     nsCOMArrayComparator, &ctx);
-    }
+  if (mArray.Length() > 1) {
+    nsCOMArrayComparatorContext ctx = {aFunc, aData};
+    NS_QuickSort(mArray.Elements(), mArray.Length(), sizeof(nsISupports*),
+                 nsCOMArrayComparator, &ctx);
+  }
 }
 
 bool
 nsCOMArray_base::InsertObjectAt(nsISupports* aObject, int32_t aIndex)
 {
-    if ((uint32_t)aIndex > mArray.Length())
-        return false;
+  if ((uint32_t)aIndex > mArray.Length()) {
+    return false;
+  }
 
-    if (!mArray.InsertElementAt(aIndex, aObject))
-        return false;
+  if (!mArray.InsertElementAt(aIndex, aObject)) {
+    return false;
+  }
 
-    NS_IF_ADDREF(aObject);
-    return true;
+  NS_IF_ADDREF(aObject);
+  return true;
 }
 
 void
 nsCOMArray_base::InsertElementAt(uint32_t aIndex, nsISupports* aElement)
 {
-    mArray.InsertElementAt(aIndex, aElement);
-    NS_IF_ADDREF(aElement);
+  mArray.InsertElementAt(aIndex, aElement);
+  NS_IF_ADDREF(aElement);
 }
 
 bool
 nsCOMArray_base::InsertObjectsAt(const nsCOMArray_base& aObjects, int32_t aIndex)
 {
-    if ((uint32_t)aIndex > mArray.Length())
-        return false;
+  if ((uint32_t)aIndex > mArray.Length()) {
+    return false;
+  }
 
-    if (!mArray.InsertElementsAt(aIndex, aObjects.mArray))
-        return false;
+  if (!mArray.InsertElementsAt(aIndex, aObjects.mArray)) {
+    return false;
+  }
 
-    // need to addref all these
-    uint32_t count = aObjects.Length();
-    for (uint32_t i = 0; i < count; ++i)
-        NS_IF_ADDREF(aObjects[i]);
+  // need to addref all these
+  uint32_t count = aObjects.Length();
+  for (uint32_t i = 0; i < count; ++i) {
+    NS_IF_ADDREF(aObjects[i]);
+  }
 
-    return true;
+  return true;
 }
 
 void
-nsCOMArray_base::InsertElementsAt(uint32_t aIndex, const nsCOMArray_base& aElements)
+nsCOMArray_base::InsertElementsAt(uint32_t aIndex,
+                                  const nsCOMArray_base& aElements)
 {
-    mArray.InsertElementsAt(aIndex, aElements.mArray);
+  mArray.InsertElementsAt(aIndex, aElements.mArray);
 
-    // need to addref all these
-    uint32_t count = aElements.Length();
-    for (uint32_t i = 0; i < count; ++i)
-        NS_IF_ADDREF(aElements[i]);
+  // need to addref all these
+  uint32_t count = aElements.Length();
+  for (uint32_t i = 0; i < count; ++i) {
+    NS_IF_ADDREF(aElements[i]);
+  }
 }
 
 void
-nsCOMArray_base::InsertElementsAt(uint32_t aIndex, nsISupports* const* aElements, uint32_t aCount)
+nsCOMArray_base::InsertElementsAt(uint32_t aIndex,
+                                  nsISupports* const* aElements,
+                                  uint32_t aCount)
 {
-    mArray.InsertElementsAt(aIndex, aElements, aCount);
+  mArray.InsertElementsAt(aIndex, aElements, aCount);
 
-    // need to addref all these
-    for (uint32_t i = 0; i < aCount; ++i)
-        NS_IF_ADDREF(aElements[i]);
+  // need to addref all these
+  for (uint32_t i = 0; i < aCount; ++i) {
+    NS_IF_ADDREF(aElements[i]);
+  }
 }
 
 bool
 nsCOMArray_base::ReplaceObjectAt(nsISupports* aObject, int32_t aIndex)
 {
   mArray.EnsureLengthAtLeast(aIndex + 1);
-  nsISupports *oldObject = mArray[aIndex];
+  nsISupports* oldObject = mArray[aIndex];
   // Make sure to addref first, in case aObject == oldObject
   NS_IF_ADDREF(mArray[aIndex] = aObject);
   NS_IF_RELEASE(oldObject);
   // XXX make this return void
   return true;
 }
 
 bool
-nsCOMArray_base::RemoveObject(nsISupports *aObject)
+nsCOMArray_base::RemoveObject(nsISupports* aObject)
 {
-    bool result = mArray.RemoveElement(aObject);
-    if (result)
-        NS_IF_RELEASE(aObject);
-    return result;
+  bool result = mArray.RemoveElement(aObject);
+  if (result) {
+    NS_IF_RELEASE(aObject);
+  }
+  return result;
 }
 
 bool
 nsCOMArray_base::RemoveObjectAt(int32_t aIndex)
 {
-    if (uint32_t(aIndex) < mArray.Length()) {
-        nsISupports* element = mArray[aIndex];
+  if (uint32_t(aIndex) < mArray.Length()) {
+    nsISupports* element = mArray[aIndex];
 
-        mArray.RemoveElementAt(aIndex);
-        NS_IF_RELEASE(element);
-        return true;
-    }
+    mArray.RemoveElementAt(aIndex);
+    NS_IF_RELEASE(element);
+    return true;
+  }
 
-    return false;
+  return false;
 }
 
 void
 nsCOMArray_base::RemoveElementAt(uint32_t aIndex)
 {
-    nsISupports* element = mArray[aIndex];
-    mArray.RemoveElementAt(aIndex);
-    NS_IF_RELEASE(element);
+  nsISupports* element = mArray[aIndex];
+  mArray.RemoveElementAt(aIndex);
+  NS_IF_RELEASE(element);
 }
 
 bool
 nsCOMArray_base::RemoveObjectsAt(int32_t aIndex, int32_t aCount)
 {
-    if (uint32_t(aIndex) + uint32_t(aCount) <= mArray.Length()) {
-        nsTArray<nsISupports*> elementsToDestroy(aCount);
-        elementsToDestroy.AppendElements(mArray.Elements() + aIndex, aCount);
-        mArray.RemoveElementsAt(aIndex, aCount);
-        ReleaseObjects(elementsToDestroy);
-        return true;
-    }
+  if (uint32_t(aIndex) + uint32_t(aCount) <= mArray.Length()) {
+    nsTArray<nsISupports*> elementsToDestroy(aCount);
+    elementsToDestroy.AppendElements(mArray.Elements() + aIndex, aCount);
+    mArray.RemoveElementsAt(aIndex, aCount);
+    ReleaseObjects(elementsToDestroy);
+    return true;
+  }
 
-    return false;
+  return false;
 }
 
 void
 nsCOMArray_base::RemoveElementsAt(uint32_t aIndex, uint32_t aCount)
 {
-    nsTArray<nsISupports*> elementsToDestroy(aCount);
-    elementsToDestroy.AppendElements(mArray.Elements() + aIndex, aCount);
-    mArray.RemoveElementsAt(aIndex, aCount);
-    ReleaseObjects(elementsToDestroy);
+  nsTArray<nsISupports*> elementsToDestroy(aCount);
+  elementsToDestroy.AppendElements(mArray.Elements() + aIndex, aCount);
+  mArray.RemoveElementsAt(aIndex, aCount);
+  ReleaseObjects(elementsToDestroy);
 }
 
 // useful for destructors
 void
-ReleaseObjects(nsTArray<nsISupports*> &aArray)
+ReleaseObjects(nsTArray<nsISupports*>& aArray)
 {
-    for (uint32_t i = 0; i < aArray.Length(); i++)
-        NS_IF_RELEASE(aArray[i]);
+  for (uint32_t i = 0; i < aArray.Length(); ++i) {
+    NS_IF_RELEASE(aArray[i]);
+  }
 }
 
 void
 nsCOMArray_base::Clear()
 {
-    nsTArray<nsISupports*> objects;
-    objects.SwapElements(mArray);
-    ReleaseObjects(objects);
+  nsTArray<nsISupports*> objects;
+  objects.SwapElements(mArray);
+  ReleaseObjects(objects);
 }
 
 bool
 nsCOMArray_base::SetCount(int32_t aNewCount)
 {
-    NS_ASSERTION(aNewCount >= 0,"SetCount(negative index)");
-    if (aNewCount < 0)
-        return false;
+  NS_ASSERTION(aNewCount >= 0, "SetCount(negative index)");
+  if (aNewCount < 0) {
+    return false;
+  }
 
-    int32_t count = mArray.Length();
-    if (count > aNewCount)
-        RemoveObjectsAt(aNewCount, mArray.Length() - aNewCount);
-    mArray.SetLength(aNewCount);
-    return true;
+  int32_t count = mArray.Length();
+  if (count > aNewCount) {
+    RemoveObjectsAt(aNewCount, mArray.Length() - aNewCount);
+  }
+  mArray.SetLength(aNewCount);
+  return true;
 }
 
 size_t
 nsCOMArray_base::SizeOfExcludingThis(
-                   nsBaseArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis,
-                   mozilla::MallocSizeOf aMallocSizeOf, void* aData) const
+    nsBaseArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis,
+    mozilla::MallocSizeOf aMallocSizeOf, void* aData) const
 {
-    size_t n = mArray.SizeOfExcludingThis(aMallocSizeOf);
+  size_t n = mArray.SizeOfExcludingThis(aMallocSizeOf);
 
-    if (aSizeOfElementIncludingThis)
-        for (uint32_t index = 0; index < mArray.Length(); index++)
-            n += aSizeOfElementIncludingThis(mArray[index], aMallocSizeOf, aData);
+  if (aSizeOfElementIncludingThis) {
+    for (uint32_t index = 0; index < mArray.Length(); ++index) {
+      n += aSizeOfElementIncludingThis(mArray[index], aMallocSizeOf, aData);
+    }
+  }
 
-    return n;
+  return n;
 }
 
 
 void
 nsCOMArray_base::Adopt(nsISupports** aElements, uint32_t aSize)
 {
-    Clear();
-    mArray.AppendElements(aElements, aSize);
+  Clear();
+  mArray.AppendElements(aElements, aSize);
 
-    // Free the allocated array as well.
-    NS_Free(aElements);
+  // Free the allocated array as well.
+  NS_Free(aElements);
 }
 
 uint32_t
-nsCOMArray_base::Forget(nsISupports*** elements)
+nsCOMArray_base::Forget(nsISupports*** aElements)
 {
-    uint32_t length = Length();
-    size_t array_size = sizeof(nsISupports*) * length;
-    nsISupports** array = static_cast<nsISupports**>(NS_Alloc(array_size));
-    memmove(array, Elements(), array_size);
-    *elements = array;
-    // Don't Release the contained pointers; the caller of the method will
-    // do this eventually.
-    mArray.Clear();
+  uint32_t length = Length();
+  size_t array_size = sizeof(nsISupports*) * length;
+  nsISupports** array = static_cast<nsISupports**>(NS_Alloc(array_size));
+  memmove(array, Elements(), array_size);
+  *aElements = array;
+  // Don't Release the contained pointers; the caller of the method will
+  // do this eventually.
+  mArray.Clear();
 
-    return length;
+  return length;
 }
--- a/xpcom/glue/nsCOMArray.h
+++ b/xpcom/glue/nsCOMArray.h
@@ -14,196 +14,195 @@
 #include "nsISupports.h"
 
 // See below for the definition of nsCOMArray<T>
 
 // a class that's nsISupports-specific, so that we can contain the
 // work of this class in the XPCOM dll
 class NS_COM_GLUE nsCOMArray_base
 {
-    friend class nsArrayBase;
+  friend class nsArrayBase;
 protected:
-    nsCOMArray_base() {}
-    nsCOMArray_base(int32_t aCount) : mArray(aCount) {}
-    nsCOMArray_base(const nsCOMArray_base& other);
-    ~nsCOMArray_base();
+  nsCOMArray_base() {}
+  nsCOMArray_base(int32_t aCount) : mArray(aCount) {}
+  nsCOMArray_base(const nsCOMArray_base& aOther);
+  ~nsCOMArray_base();
 
-    int32_t IndexOf(nsISupports* aObject, uint32_t aStartIndex = 0) const;
-    bool Contains(nsISupports* aObject) const {
-        return IndexOf(aObject) != -1;
-    }
+  int32_t IndexOf(nsISupports* aObject, uint32_t aStartIndex = 0) const;
+  bool Contains(nsISupports* aObject) const
+  {
+    return IndexOf(aObject) != -1;
+  }
 
-    int32_t IndexOfObject(nsISupports* aObject) const;
-    bool ContainsObject(nsISupports* aObject) const {
-        return IndexOfObject(aObject) != -1;
-    }
+  int32_t IndexOfObject(nsISupports* aObject) const;
+  bool ContainsObject(nsISupports* aObject) const
+  {
+    return IndexOfObject(aObject) != -1;
+  }
 
-    typedef bool (* nsBaseArrayEnumFunc)
-        (void* aElement, void *aData);
+  typedef bool (*nsBaseArrayEnumFunc)(void* aElement, void* aData);
 
-    // enumerate through the array with a callback.
-    bool EnumerateForwards(nsBaseArrayEnumFunc aFunc, void* aData) const;
+  // enumerate through the array with a callback.
+  bool EnumerateForwards(nsBaseArrayEnumFunc aFunc, void* aData) const;
 
-    bool EnumerateBackwards(nsBaseArrayEnumFunc aFunc, void* aData) const;
+  bool EnumerateBackwards(nsBaseArrayEnumFunc aFunc, void* aData) const;
 
-    typedef int (* nsBaseArrayComparatorFunc)
-        (nsISupports* aElement1, nsISupports* aElement2, void* aData);
+  typedef int (*nsBaseArrayComparatorFunc)(nsISupports* aElement1,
+                                           nsISupports* aElement2,
+                                           void* aData);
 
-    struct nsCOMArrayComparatorContext {
-        nsBaseArrayComparatorFunc mComparatorFunc;
-        void* mData;
-    };
+  struct nsCOMArrayComparatorContext
+  {
+    nsBaseArrayComparatorFunc mComparatorFunc;
+    void* mData;
+  };
 
-    static int nsCOMArrayComparator(const void* aElement1, const void* aElement2, void* aData);
-    void Sort(nsBaseArrayComparatorFunc aFunc, void* aData);
+  static int nsCOMArrayComparator(const void* aElement1, const void* aElement2,
+                                  void* aData);
+  void Sort(nsBaseArrayComparatorFunc aFunc, void* aData);
 
-    bool InsertObjectAt(nsISupports* aObject, int32_t aIndex);
-    void InsertElementAt(uint32_t aIndex, nsISupports* aElement);
-    bool InsertObjectsAt(const nsCOMArray_base& aObjects, int32_t aIndex);
-    void InsertElementsAt(uint32_t aIndex, const nsCOMArray_base& aElements);
-    void InsertElementsAt(uint32_t aIndex, nsISupports* const* aElements, uint32_t aCount);
-    bool ReplaceObjectAt(nsISupports* aObject, int32_t aIndex);
-    void ReplaceElementAt(uint32_t aIndex, nsISupports* aElement) {
-        nsISupports* oldElement = mArray[aIndex];
-        NS_IF_ADDREF(mArray[aIndex] = aElement);
-        NS_IF_RELEASE(oldElement);
-    }
-    bool AppendObject(nsISupports *aObject) {
-        return InsertObjectAt(aObject, Count());
-    }
-    void AppendElement(nsISupports* aElement) {
-        InsertElementAt(Length(), aElement);
-    }
-    bool AppendObjects(const nsCOMArray_base& aObjects) {
-        return InsertObjectsAt(aObjects, Count());
-    }
-    void AppendElements(const nsCOMArray_base& aElements) {
-        return InsertElementsAt(Length(), aElements);
-    }
-    void AppendElements(nsISupports* const* aElements, uint32_t aCount) {
-        return InsertElementsAt(Length(), aElements, aCount);
-    }
-    bool RemoveObject(nsISupports *aObject);
-    nsISupports** Elements() {
-        return mArray.Elements();
-    }
-    void SwapElements(nsCOMArray_base& aOther) {
-        mArray.SwapElements(aOther.mArray);
-    }
+  bool InsertObjectAt(nsISupports* aObject, int32_t aIndex);
+  void InsertElementAt(uint32_t aIndex, nsISupports* aElement);
+  bool InsertObjectsAt(const nsCOMArray_base& aObjects, int32_t aIndex);
+  void InsertElementsAt(uint32_t aIndex, const nsCOMArray_base& aElements);
+  void InsertElementsAt(uint32_t aIndex, nsISupports* const* aElements,
+                        uint32_t aCount);
+  bool ReplaceObjectAt(nsISupports* aObject, int32_t aIndex);
+  void ReplaceElementAt(uint32_t aIndex, nsISupports* aElement)
+  {
+    nsISupports* oldElement = mArray[aIndex];
+    NS_IF_ADDREF(mArray[aIndex] = aElement);
+    NS_IF_RELEASE(oldElement);
+  }
+  bool AppendObject(nsISupports* aObject)
+  {
+    return InsertObjectAt(aObject, Count());
+  }
+  void AppendElement(nsISupports* aElement)
+  {
+    InsertElementAt(Length(), aElement);
+  }
+  bool AppendObjects(const nsCOMArray_base& aObjects)
+  {
+    return InsertObjectsAt(aObjects, Count());
+  }
+  void AppendElements(const nsCOMArray_base& aElements)
+  {
+    return InsertElementsAt(Length(), aElements);
+  }
+  void AppendElements(nsISupports* const* aElements, uint32_t aCount)
+  {
+    return InsertElementsAt(Length(), aElements, aCount);
+  }
+  bool RemoveObject(nsISupports* aObject);
+  nsISupports** Elements() { return mArray.Elements(); }
+  void SwapElements(nsCOMArray_base& aOther)
+  {
+    mArray.SwapElements(aOther.mArray);
+  }
 
-    void Adopt(nsISupports** aElements, uint32_t aCount);
-    uint32_t Forget(nsISupports*** aElements);
+  void Adopt(nsISupports** aElements, uint32_t aCount);
+  uint32_t Forget(nsISupports*** aElements);
 public:
-    // elements in the array (including null elements!)
-    int32_t Count() const {
-        return mArray.Length();
+  // elements in the array (including null elements!)
+  int32_t Count() const { return mArray.Length(); }
+  // nsTArray-compatible version
+  uint32_t Length() const { return mArray.Length(); }
+  bool IsEmpty() const { return mArray.IsEmpty(); }
+
+  // If the array grows, the newly created entries will all be null;
+  // if the array shrinks, the excess entries will all be released.
+  bool SetCount(int32_t aNewCount);
+  // nsTArray-compatible version
+  void TruncateLength(uint32_t aNewLength)
+  {
+    if (mArray.Length() > aNewLength) {
+      RemoveElementsAt(aNewLength, mArray.Length() - aNewLength);
     }
-    // nsTArray-compatible version
-    uint32_t Length() const {
-        return mArray.Length();
-    }
-    bool IsEmpty() const {
-        return mArray.IsEmpty();
-    }
+  }
 
-    // If the array grows, the newly created entries will all be null;
-    // if the array shrinks, the excess entries will all be released.
-    bool SetCount(int32_t aNewCount);
-    // nsTArray-compatible version
-    void TruncateLength(uint32_t aNewLength) {
-        if (mArray.Length() > aNewLength)
-            RemoveElementsAt(aNewLength, mArray.Length() - aNewLength);
-    }
+  // remove all elements in the array, and call NS_RELEASE on each one
+  void Clear();
+
+  nsISupports* ObjectAt(int32_t aIndex) const { return mArray[aIndex]; }
+  // nsTArray-compatible version
+  nsISupports* ElementAt(uint32_t aIndex) const { return mArray[aIndex]; }
 
-    // remove all elements in the array, and call NS_RELEASE on each one
-    void Clear();
+  nsISupports* SafeObjectAt(int32_t aIndex) const
+  {
+    return mArray.SafeElementAt(aIndex, nullptr);
+  }
+  // nsTArray-compatible version
+  nsISupports* SafeElementAt(uint32_t aIndex) const
+  {
+    return mArray.SafeElementAt(aIndex, nullptr);
+  }
 
-    nsISupports* ObjectAt(int32_t aIndex) const {
-        return mArray[aIndex];
-    }
-    // nsTArray-compatible version
-    nsISupports* ElementAt(uint32_t aIndex) const {
-        return mArray[aIndex];
-    }
+  nsISupports* operator[](int32_t aIndex) const { return mArray[aIndex]; }
 
-    nsISupports* SafeObjectAt(int32_t aIndex) const {
-        return mArray.SafeElementAt(aIndex, nullptr);
-    }
-    // nsTArray-compatible version
-    nsISupports* SafeElementAt(uint32_t aIndex) const {
-        return mArray.SafeElementAt(aIndex, nullptr);
-    }
+  // remove an element at a specific position, shrinking the array
+  // as necessary
+  bool RemoveObjectAt(int32_t aIndex);
+  // nsTArray-compatible version
+  void RemoveElementAt(uint32_t aIndex);
 
-    nsISupports* operator[](int32_t aIndex) const {
-        return mArray[aIndex];
-    }
+  // remove a range of elements at a specific position, shrinking the array
+  // as necessary
+  bool RemoveObjectsAt(int32_t aIndex, int32_t aCount);
+  // nsTArray-compatible version
+  void RemoveElementsAt(uint32_t aIndex, uint32_t aCount);
 
-    // remove an element at a specific position, shrinking the array
-    // as necessary
-    bool RemoveObjectAt(int32_t aIndex);
-    // nsTArray-compatible version
-    void RemoveElementAt(uint32_t aIndex);
-
-    // remove a range of elements at a specific position, shrinking the array
-    // as necessary
-    bool RemoveObjectsAt(int32_t aIndex, int32_t aCount);
-    // nsTArray-compatible version
-    void RemoveElementsAt(uint32_t aIndex, uint32_t aCount);
+  void SwapElementsAt(uint32_t aIndex1, uint32_t aIndex2)
+  {
+    nsISupports* tmp = mArray[aIndex1];
+    mArray[aIndex1] = mArray[aIndex2];
+    mArray[aIndex2] = tmp;
+  }
 
-    void SwapElementsAt(uint32_t aIndex1, uint32_t aIndex2) {
-        nsISupports *tmp = mArray[aIndex1];
-        mArray[aIndex1] = mArray[aIndex2];
-        mArray[aIndex2] = tmp;
-    }
+  // Ensures there is enough space to store a total of aCapacity objects.
+  // This method never deletes any objects.
+  void SetCapacity(uint32_t aCapacity) { mArray.SetCapacity(aCapacity); }
+  uint32_t Capacity() { return mArray.Capacity(); }
 
-    // Ensures there is enough space to store a total of aCapacity objects.
-    // This method never deletes any objects.
-    void SetCapacity(uint32_t aCapacity) {
-        mArray.SetCapacity(aCapacity);
-    }
-    uint32_t Capacity() {
-        return mArray.Capacity();
-    }
+  typedef size_t (*nsBaseArraySizeOfElementIncludingThisFunc)(
+    nsISupports* aElement, mozilla::MallocSizeOf aMallocSizeOf, void* aData);
 
-    typedef size_t (* nsBaseArraySizeOfElementIncludingThisFunc)
-        (nsISupports* aElement, mozilla::MallocSizeOf aMallocSizeOf, void *aData);
-
-    // Measures the size of the array's element storage, and if
-    // |aSizeOfElement| is non-nullptr, measures the size of things pointed to
-    // by elements.
-    size_t SizeOfExcludingThis(
-             nsBaseArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis,
-             mozilla::MallocSizeOf aMallocSizeOf, void* aData = nullptr) const;
+  // Measures the size of the array's element storage, and if
+  // |aSizeOfElement| is non-nullptr, measures the size of things pointed to
+  // by elements.
+  size_t SizeOfExcludingThis(
+    nsBaseArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis,
+    mozilla::MallocSizeOf aMallocSizeOf, void* aData = nullptr) const;
 
 private:
 
-    // the actual storage
-    nsTArray<nsISupports*> mArray;
+  // the actual storage
+  nsTArray<nsISupports*> mArray;
 
-    // don't implement these, defaults will muck with refcounts!
-    nsCOMArray_base& operator=(const nsCOMArray_base& other) MOZ_DELETE;
+  // don't implement these, defaults will muck with refcounts!
+  nsCOMArray_base& operator=(const nsCOMArray_base& aOther) MOZ_DELETE;
 };
 
 inline void
 ImplCycleCollectionUnlink(nsCOMArray_base& aField)
 {
-    aField.Clear();
+  aField.Clear();
 }
 
 inline void
 ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
                             nsCOMArray_base& aField,
                             const char* aName,
                             uint32_t aFlags = 0)
 {
-    aFlags |= CycleCollectionEdgeNameArrayFlag;
-    int32_t length = aField.Count();
-    for (int32_t i = 0; i < length; ++i) {
-        CycleCollectionNoteChild(aCallback, aField[i], aName, aFlags);
-    }
+  aFlags |= CycleCollectionEdgeNameArrayFlag;
+  int32_t length = aField.Count();
+  for (int32_t i = 0; i < length; ++i) {
+    CycleCollectionNoteChild(aCallback, aField[i], aName, aFlags);
+  }
 }
 
 
 // a non-XPCOM, refcounting array of XPCOM objects
 // used as a member variable or stack variable - this object is NOT
 // refcounted, but the objects that it holds are
 //
 // most of the read-only accessors like ObjectAt()/etc do NOT refcount
@@ -215,242 +214,263 @@ ImplCycleCollectionTraverse(nsCycleColle
 // * avoids the refcount, but foo might go stale if array[i] is ever
 // * modified/removed. Be careful not to NS_RELEASE(foo)!
 // T* foo = array[i];
 //
 // This array will accept null as an argument for any object, and will
 // store null in the array, just like nsVoidArray. But that also means
 // that methods like ObjectAt() may return null when referring to an
 // existing, but null entry in the array.
-template <class T>
+template<class T>
 class nsCOMArray : public nsCOMArray_base
 {
- public:
-    nsCOMArray() {}
-
-    explicit
-    nsCOMArray(int32_t aCount) : nsCOMArray_base(aCount) {}
-
-    explicit
-    nsCOMArray(const nsCOMArray<T>& aOther) : nsCOMArray_base(aOther) { }
+public:
+  nsCOMArray() {}
+  explicit nsCOMArray(int32_t aCount) : nsCOMArray_base(aCount) {}
+  explicit nsCOMArray(const nsCOMArray<T>& aOther) : nsCOMArray_base(aOther) {}
+  nsCOMArray(nsCOMArray<T>&& aOther) { SwapElements(aOther); }
+  ~nsCOMArray() {}
 
-    nsCOMArray(nsCOMArray<T>&& aOther) { SwapElements(aOther); }
-
-    ~nsCOMArray() {}
+  // We have a move assignment operator, but no copy assignment operator.
+  nsCOMArray<T>& operator=(nsCOMArray<T> && aOther)
+  {
+    SwapElements(aOther);
+    return *this;
+  }
 
-    // We have a move assignment operator, but no copy assignment operator.
-    nsCOMArray<T>& operator=(nsCOMArray<T>&& aOther) {
-        SwapElements(aOther);
-        return *this;
-    }
+  // these do NOT refcount on the way out, for speed
+  T* ObjectAt(int32_t aIndex) const
+  {
+    return static_cast<T*>(nsCOMArray_base::ObjectAt(aIndex));
+  }
+  // nsTArray-compatible version
+  T* ElementAt(uint32_t aIndex) const
+  {
+    return static_cast<T*>(nsCOMArray_base::ElementAt(aIndex));
+  }
 
-    // these do NOT refcount on the way out, for speed
-    T* ObjectAt(int32_t aIndex) const {
-        return static_cast<T*>(nsCOMArray_base::ObjectAt(aIndex));
-    }
-    // nsTArray-compatible version
-    T* ElementAt(uint32_t aIndex) const {
-        return static_cast<T*>(nsCOMArray_base::ElementAt(aIndex));
-    }
+  // these do NOT refcount on the way out, for speed
+  T* SafeObjectAt(int32_t aIndex) const
+  {
+    return static_cast<T*>(nsCOMArray_base::SafeObjectAt(aIndex));
+  }
+  // nsTArray-compatible version
+  T* SafeElementAt(uint32_t aIndex) const
+  {
+    return static_cast<T*>(nsCOMArray_base::SafeElementAt(aIndex));
+  }
 
-    // these do NOT refcount on the way out, for speed
-    T* SafeObjectAt(int32_t aIndex) const {
-        return static_cast<T*>(nsCOMArray_base::SafeObjectAt(aIndex));
-    }
-    // nsTArray-compatible version
-    T* SafeElementAt(uint32_t aIndex) const {
-        return static_cast<T*>(nsCOMArray_base::SafeElementAt(aIndex));
-    }
+  // indexing operator for syntactic sugar
+  T* operator[](int32_t aIndex) const { return ObjectAt(aIndex); }
 
-    // indexing operator for syntactic sugar
-    T* operator[](int32_t aIndex) const {
-        return ObjectAt(aIndex);
-    }
+  // index of the element in question.. does NOT refcount
+  // note: this does not check COM object identity. Use
+  // IndexOfObject() for that purpose
+  int32_t IndexOf(T* aObject, uint32_t aStartIndex = 0) const
+  {
+    return nsCOMArray_base::IndexOf(aObject, aStartIndex);
+  }
+  bool Contains(T* aObject) const
+  {
+    return nsCOMArray_base::Contains(aObject);
+  }
 
-    // index of the element in question.. does NOT refcount
-    // note: this does not check COM object identity. Use
-    // IndexOfObject() for that purpose
-    int32_t IndexOf(T* aObject, uint32_t aStartIndex = 0) const {
-        return nsCOMArray_base::IndexOf(aObject, aStartIndex);
-    }
-    bool Contains(T* aObject) const {
-        return nsCOMArray_base::Contains(aObject);
-    }
+  // index of the element in question.. be careful!
+  // this is much slower than IndexOf() because it uses
+  // QueryInterface to determine actual COM identity of the object
+  // if you need to do this frequently then consider enforcing
+  // COM object identity before adding/comparing elements
+  int32_t IndexOfObject(T* aObject) const
+  {
+    return nsCOMArray_base::IndexOfObject(aObject);
+  }
+  bool ContainsObject(nsISupports* aObject) const
+  {
+    return nsCOMArray_base::ContainsObject(aObject);
+  }
 
-    // index of the element in question.. be careful!
-    // this is much slower than IndexOf() because it uses
-    // QueryInterface to determine actual COM identity of the object
-    // if you need to do this frequently then consider enforcing
-    // COM object identity before adding/comparing elements
-    int32_t IndexOfObject(T* aObject) const {
-        return nsCOMArray_base::IndexOfObject(aObject);
-    }
-    bool ContainsObject(nsISupports* aObject) const {
-        return nsCOMArray_base::ContainsObject(aObject);
-    }
+  // inserts aObject at aIndex, shifting the objects at aIndex and
+  // later to make space
+  bool InsertObjectAt(T* aObject, int32_t aIndex)
+  {
+    return nsCOMArray_base::InsertObjectAt(aObject, aIndex);
+  }
+  // nsTArray-compatible version
+  void InsertElementAt(uint32_t aIndex, T* aElement)
+  {
+    nsCOMArray_base::InsertElementAt(aIndex, aElement);
+  }
 
-    // inserts aObject at aIndex, shifting the objects at aIndex and
-    // later to make space
-    bool InsertObjectAt(T* aObject, int32_t aIndex) {
-        return nsCOMArray_base::InsertObjectAt(aObject, aIndex);
-    }
-    // nsTArray-compatible version
-    void InsertElementAt(uint32_t aIndex, T* aElement) {
-        nsCOMArray_base::InsertElementAt(aIndex, aElement);
-    }
+  // inserts the objects from aObject at aIndex, shifting the
+  // objects at aIndex and later to make space
+  bool InsertObjectsAt(const nsCOMArray<T>& aObjects, int32_t aIndex)
+  {
+    return nsCOMArray_base::InsertObjectsAt(aObjects, aIndex);
+  }
+  // nsTArray-compatible version
+  void InsertElementsAt(uint32_t aIndex, const nsCOMArray<T>& aElements)
+  {
+    nsCOMArray_base::InsertElementsAt(aIndex, aElements);
+  }
+  void InsertElementsAt(uint32_t aIndex, T* const* aElements, uint32_t aCount)
+  {
+    nsCOMArray_base::InsertElementsAt(
+      aIndex, reinterpret_cast<nsISupports* const*>(aElements), aCount);
+  }
 
-    // inserts the objects from aObject at aIndex, shifting the
-    // objects at aIndex and later to make space
-    bool InsertObjectsAt(const nsCOMArray<T>& aObjects, int32_t aIndex) {
-        return nsCOMArray_base::InsertObjectsAt(aObjects, aIndex);
-    }
-    // nsTArray-compatible version
-    void InsertElementsAt(uint32_t aIndex, const nsCOMArray<T>& aElements) {
-        nsCOMArray_base::InsertElementsAt(aIndex, aElements);
-    }
-    void InsertElementsAt(uint32_t aIndex, T* const* aElements, uint32_t aCount) {
-        nsCOMArray_base::InsertElementsAt(aIndex, reinterpret_cast<nsISupports* const*>(aElements), aCount);
-    }
+  // replaces an existing element. Warning: if the array grows,
+  // the newly created entries will all be null
+  bool ReplaceObjectAt(T* aObject, int32_t aIndex)
+  {
+    return nsCOMArray_base::ReplaceObjectAt(aObject, aIndex);
+  }
+  // nsTArray-compatible version
+  void ReplaceElementAt(uint32_t aIndex, T* aElement)
+  {
+    nsCOMArray_base::ReplaceElementAt(aIndex, aElement);
+  }
 
-    // replaces an existing element. Warning: if the array grows,
-    // the newly created entries will all be null
-    bool ReplaceObjectAt(T* aObject, int32_t aIndex) {
-        return nsCOMArray_base::ReplaceObjectAt(aObject, aIndex);
-    }
-    // nsTArray-compatible version
-    void ReplaceElementAt(uint32_t aIndex, T* aElement) {
-        nsCOMArray_base::ReplaceElementAt(aIndex, aElement);
-    }
+  // Enumerator callback function. Return false to stop
+  // Here's a more readable form:
+  // bool enumerate(T* aElement, void* aData)
+  typedef bool (*nsCOMArrayEnumFunc)(T* aElement, void* aData);
 
-    // Enumerator callback function. Return false to stop
-    // Here's a more readable form:
-    // bool enumerate(T* aElement, void* aData)
-    typedef bool (* nsCOMArrayEnumFunc)
-        (T* aElement, void *aData);
+  // enumerate through the array with a callback.
+  bool EnumerateForwards(nsCOMArrayEnumFunc aFunc, void* aData)
+  {
+    return nsCOMArray_base::EnumerateForwards(nsBaseArrayEnumFunc(aFunc),
+                                              aData);
+  }
 
-    // enumerate through the array with a callback. 
-    bool EnumerateForwards(nsCOMArrayEnumFunc aFunc, void* aData) {
-        return nsCOMArray_base::EnumerateForwards(nsBaseArrayEnumFunc(aFunc),
-                                                  aData);
-    }
+  bool EnumerateBackwards(nsCOMArrayEnumFunc aFunc, void* aData)
+  {
+    return nsCOMArray_base::EnumerateBackwards(nsBaseArrayEnumFunc(aFunc),
+                                               aData);
+  }
 
-    bool EnumerateBackwards(nsCOMArrayEnumFunc aFunc, void* aData) {
-        return nsCOMArray_base::EnumerateBackwards(nsBaseArrayEnumFunc(aFunc),
-                                                  aData);
-    }
+  typedef int (*nsCOMArrayComparatorFunc)(T* aElement1, T* aElement2,
+                                          void* aData);
 
-    typedef int (* nsCOMArrayComparatorFunc)
-        (T* aElement1, T* aElement2, void* aData);
+  void Sort(nsCOMArrayComparatorFunc aFunc, void* aData)
+  {
+    nsCOMArray_base::Sort(nsBaseArrayComparatorFunc(aFunc), aData);
+  }
 
-    void Sort(nsCOMArrayComparatorFunc aFunc, void* aData) {
-        nsCOMArray_base::Sort(nsBaseArrayComparatorFunc(aFunc), aData);
-    }
+  // append an object, growing the array as necessary
+  bool AppendObject(T* aObject)
+  {
+    return nsCOMArray_base::AppendObject(aObject);
+  }
+  // nsTArray-compatible version
+  void AppendElement(T* aElement)
+  {
+    nsCOMArray_base::AppendElement(aElement);
+  }
 
-    // append an object, growing the array as necessary
-    bool AppendObject(T *aObject) {
-        return nsCOMArray_base::AppendObject(aObject);
-    }
-    // nsTArray-compatible version
-    void AppendElement(T* aElement) {
-        nsCOMArray_base::AppendElement(aElement);
-    }
-
-    // append objects, growing the array as necessary
-    bool AppendObjects(const nsCOMArray<T>& aObjects) {
-        return nsCOMArray_base::AppendObjects(aObjects);
-    }
-    // nsTArray-compatible version
-    void AppendElements(const nsCOMArray<T>& aElements) {
-        return nsCOMArray_base::AppendElements(aElements);
-    }
-    void AppendElements(T* const* aElements, uint32_t aCount) {
-        InsertElementsAt(Length(), aElements, aCount);
-    }
+  // append objects, growing the array as necessary
+  bool AppendObjects(const nsCOMArray<T>& aObjects)
+  {
+    return nsCOMArray_base::AppendObjects(aObjects);
+  }
+  // nsTArray-compatible version
+  void AppendElements(const nsCOMArray<T>& aElements)
+  {
+    return nsCOMArray_base::AppendElements(aElements);
+  }
+  void AppendElements(T* const* aElements, uint32_t aCount)
+  {
+    InsertElementsAt(Length(), aElements, aCount);
+  }
 
-    // remove the first instance of the given object and shrink the
-    // array as necessary
-    // Warning: if you pass null here, it will remove the first null element
-    bool RemoveObject(T *aObject) {
-        return nsCOMArray_base::RemoveObject(aObject);
-    }
-    // nsTArray-compatible version
-    bool RemoveElement(T* aElement) {
-        return nsCOMArray_base::RemoveObject(aElement);
-    }
+  // remove the first instance of the given object and shrink the
+  // array as necessary
+  // Warning: if you pass null here, it will remove the first null element
+  bool RemoveObject(T* aObject)
+  {
+    return nsCOMArray_base::RemoveObject(aObject);
+  }
+  // nsTArray-compatible version
+  bool RemoveElement(T* aElement)
+  {
+    return nsCOMArray_base::RemoveObject(aElement);
+  }
 
-    T** Elements() {
-        return reinterpret_cast<T**>(nsCOMArray_base::Elements());
-    }
-    void SwapElements(nsCOMArray<T>& aOther) {
-        nsCOMArray_base::SwapElements(aOther);
-    }
+  T** Elements()
+  {
+    return reinterpret_cast<T**>(nsCOMArray_base::Elements());
+  }
+  void SwapElements(nsCOMArray<T>& aOther)
+  {
+    nsCOMArray_base::SwapElements(aOther);
+  }
 
-    // Each element in an nsCOMArray<T> is actually a T*, so this function is
-    // "IncludingThis" rather than "ExcludingThis" because it needs to measure
-    // the memory taken by the T itself as well as anything it points to.
-    typedef size_t (* nsCOMArraySizeOfElementIncludingThisFunc)
-        (T* aElement, mozilla::MallocSizeOf aMallocSizeOf, void *aData);
+  // Each element in an nsCOMArray<T> is actually a T*, so this function is
+  // "IncludingThis" rather than "ExcludingThis" because it needs to measure
+  // the memory taken by the T itself as well as anything it points to.
+  typedef size_t (*nsCOMArraySizeOfElementIncludingThisFunc)(
+    T* aElement, mozilla::MallocSizeOf aMallocSizeOf, void* aData);
 
-    size_t SizeOfExcludingThis(
-             nsCOMArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis, 
-             mozilla::MallocSizeOf aMallocSizeOf, void *aData = nullptr) const {
-        return nsCOMArray_base::SizeOfExcludingThis(
-                 nsBaseArraySizeOfElementIncludingThisFunc(aSizeOfElementIncludingThis),
-                 aMallocSizeOf, aData);
-    }
+  size_t SizeOfExcludingThis(
+      nsCOMArraySizeOfElementIncludingThisFunc aSizeOfElementIncludingThis,
+      mozilla::MallocSizeOf aMallocSizeOf, void* aData = nullptr) const
+  {
+    return nsCOMArray_base::SizeOfExcludingThis(
+      nsBaseArraySizeOfElementIncludingThisFunc(aSizeOfElementIncludingThis),
+      aMallocSizeOf, aData);
+  }
 
-    /**
-     * Adopt parameters that resulted from an XPIDL outparam. The aElements
-     * parameter will be freed as a result of the call.
-     *
-     * Example usage:
-     * nsCOMArray<nsISomeInterface> array;
-     * nsISomeInterface** elements;
-     * uint32_t length;
-     * ptr->GetSomeArray(&elements, &length);
-     * array.Adopt(elements, length);
-     */
-    void Adopt(T** aElements, uint32_t aSize) {
-        nsCOMArray_base::Adopt(reinterpret_cast<nsISupports**>(aElements),
-            aSize);
-    }
+  /**
+   * Adopt parameters that resulted from an XPIDL outparam. The aElements
+   * parameter will be freed as a result of the call.
+   *
+   * Example usage:
+   * nsCOMArray<nsISomeInterface> array;
+   * nsISomeInterface** elements;
+   * uint32_t length;
+   * ptr->GetSomeArray(&elements, &length);
+   * array.Adopt(elements, length);
+   */
+  void Adopt(T** aElements, uint32_t aSize)
+  {
+    nsCOMArray_base::Adopt(reinterpret_cast<nsISupports**>(aElements), aSize);
+  }
 
-    /**
-     * Export the contents of this array to an XPIDL outparam. The array will be
-     * Clear()'d after this operation.
-     *
-     * Example usage:
-     * nsCOMArray<nsISomeInterface> array;
-     * *length = array.Forget(retval);
-     */
-    uint32_t Forget(T*** elements) {
-        return nsCOMArray_base::Forget(
-            reinterpret_cast<nsISupports***>(elements));
-    }
+  /**
+   * Export the contents of this array to an XPIDL outparam. The array will be
+   * Clear()'d after this operation.
+   *
+   * Example usage:
+   * nsCOMArray<nsISomeInterface> array;
+   * *length = array.Forget(retval);
+   */
+  uint32_t Forget(T*** aElements)
+  {
+    return nsCOMArray_base::Forget(reinterpret_cast<nsISupports***>(aElements));
+  }
 
 private:
 
-    // don't implement these!
-    nsCOMArray<T>& operator=(const nsCOMArray<T>& other) MOZ_DELETE;
+  // don't implement these!
+  nsCOMArray<T>& operator=(const nsCOMArray<T>& aOther) MOZ_DELETE;
 };
 
-template <typename T>
+template<typename T>
 inline void
 ImplCycleCollectionUnlink(nsCOMArray<T>& aField)
 {
-    aField.Clear();
+  aField.Clear();
 }
 
-template <typename E>
+template<typename E>
 inline void
 ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
                             nsCOMArray<E>& aField,
                             const char* aName,
                             uint32_t aFlags = 0)
 {
-    aFlags |= CycleCollectionEdgeNameArrayFlag;
-    int32_t length = aField.Count();
-    for (int32_t i = 0; i < length; ++i) {
-        CycleCollectionNoteChild(aCallback, aField[i], aName, aFlags);
-    }
+  aFlags |= CycleCollectionEdgeNameArrayFlag;
+  int32_t length = aField.Count();
+  for (int32_t i = 0; i < length; ++i) {
+    CycleCollectionNoteChild(aCallback, aField[i], aName, aFlags);
+  }
 }
 
 #endif
--- a/xpcom/glue/nsCOMPtr.cpp
+++ b/xpcom/glue/nsCOMPtr.cpp
@@ -1,120 +1,133 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsCOMPtr.h"
 
 nsresult
-nsQueryInterface::operator()( const nsIID& aIID, void** answer ) const
-	{
-		nsresult status;
-		if ( mRawPtr )
-			{
-				status = mRawPtr->QueryInterface(aIID, answer);
+nsQueryInterface::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?");
+    NS_ASSERTION(NS_SUCCEEDED(status),
+                 "interface not found---were you expecting that?");
 #endif
-			}
-		else
-			status = NS_ERROR_NULL_POINTER;
-		
-		return status;
-	}
+  } else
+    status = NS_ERROR_NULL_POINTER;
+
+  return status;
+}
 
 nsresult
-nsQueryInterfaceWithError::operator()( const nsIID& aIID, void** answer ) const
-	{
-		nsresult status;
-		if ( mRawPtr )
-			{
-				status = mRawPtr->QueryInterface(aIID, answer);
+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?");
+    NS_ASSERTION(NS_SUCCEEDED(status),
+                 "interface not found---were you expecting that?");
 #endif
-			}
-		else
-			status = NS_ERROR_NULL_POINTER;
-		
-		if ( mErrorPtr )
-			*mErrorPtr = status;
-		return status;
-	}
+  } else
+    status = NS_ERROR_NULL_POINTER;
+
+  if (mErrorPtr) {
+    *mErrorPtr = status;
+  }
+  return status;
+}
 
 void
-nsCOMPtr_base::assign_with_AddRef( nsISupports* rawPtr )
-	{
-    if ( rawPtr )
-    	NSCAP_ADDREF(this, rawPtr);
-    assign_assuming_AddRef(rawPtr);
-	}
+nsCOMPtr_base::assign_with_AddRef(nsISupports* aRawPtr)
+{
+  if (aRawPtr) {
+    NSCAP_ADDREF(this, aRawPtr);
+  }
+  assign_assuming_AddRef(aRawPtr);
+}
 
 void
-nsCOMPtr_base::assign_from_qi( const nsQueryInterface qi, const nsIID& iid )
-  {
-    void* newRawPtr;
-    if ( NS_FAILED( qi(iid, &newRawPtr) ) )
-      newRawPtr = 0;
-    assign_assuming_AddRef(static_cast<nsISupports*>(newRawPtr));
+nsCOMPtr_base::assign_from_qi(const nsQueryInterface aQI, const nsIID& aIID)
+{
+  void* newRawPtr;
+  if (NS_FAILED(aQI(aIID, &newRawPtr))) {
+    newRawPtr = 0;
   }
+  assign_assuming_AddRef(static_cast<nsISupports*>(newRawPtr));
+}
 
 void
-nsCOMPtr_base::assign_from_qi_with_error( const nsQueryInterfaceWithError& qi, const nsIID& iid )
-  {
-    void* newRawPtr;
-    if ( NS_FAILED( qi(iid, &newRawPtr) ) )
-      newRawPtr = 0;
-    assign_assuming_AddRef(static_cast<nsISupports*>(newRawPtr));
+nsCOMPtr_base::assign_from_qi_with_error(const nsQueryInterfaceWithError& aQI,
+                                         const nsIID& aIID)
+{
+  void* newRawPtr;
+  if (NS_FAILED(aQI(aIID, &newRawPtr))) {
+    newRawPtr = 0;
   }
+  assign_assuming_AddRef(static_cast<nsISupports*>(newRawPtr));
+}
 
 void
-nsCOMPtr_base::assign_from_gs_cid( const nsGetServiceByCID gs, const nsIID& iid )
-  {
-    void* newRawPtr;
-    if ( NS_FAILED( gs(iid, &newRawPtr) ) )
-      newRawPtr = 0;
-    assign_assuming_AddRef(static_cast<nsISupports*>(newRawPtr));
+nsCOMPtr_base::assign_from_gs_cid(const nsGetServiceByCID aGS,
+                                  const nsIID& aIID)
+{
+  void* newRawPtr;
+  if (NS_FAILED(aGS(aIID, &newRawPtr))) {
+    newRawPtr = 0;
   }
+  assign_assuming_AddRef(static_cast<nsISupports*>(newRawPtr));
+}
 
 void
-nsCOMPtr_base::assign_from_gs_cid_with_error( const nsGetServiceByCIDWithError& gs, const nsIID& iid )
-  {
-    void* newRawPtr;
-    if ( NS_FAILED( gs(iid, &newRawPtr) ) )
-      newRawPtr = 0;
-    assign_assuming_AddRef(static_cast<nsISupports*>(newRawPtr));
+nsCOMPtr_base::assign_from_gs_cid_with_error(
+    const nsGetServiceByCIDWithError& aGS, const nsIID& aIID)
+{
+  void* newRawPtr;
+  if (NS_FAILED(aGS(aIID, &newRawPtr))) {
+    newRawPtr = 0;
   }
+  assign_assuming_AddRef(static_cast<nsISupports*>(newRawPtr));
+}
 
 void
-nsCOMPtr_base::assign_from_gs_contractid( const nsGetServiceByContractID gs, const nsIID& iid )
-  {
-    void* newRawPtr;
-    if ( NS_FAILED( gs(iid, &newRawPtr) ) )
-      newRawPtr = 0;
-    assign_assuming_AddRef(static_cast<nsISupports*>(newRawPtr));
+nsCOMPtr_base::assign_from_gs_contractid(const nsGetServiceByContractID aGS,
+                                         const nsIID& aIID)
+{
+  void* newRawPtr;
+  if (NS_FAILED(aGS(aIID, &newRawPtr))) {
+    newRawPtr = 0;
   }
+  assign_assuming_AddRef(static_cast<nsISupports*>(newRawPtr));
+}
 
 void
-nsCOMPtr_base::assign_from_gs_contractid_with_error( const nsGetServiceByContractIDWithError& gs, const nsIID& iid )
-  {
-    void* newRawPtr;
-    if ( NS_FAILED( gs(iid, &newRawPtr) ) )
-      newRawPtr = 0;
-    assign_assuming_AddRef(static_cast<nsISupports*>(newRawPtr));
+nsCOMPtr_base::assign_from_gs_contractid_with_error(
+    const nsGetServiceByContractIDWithError& aGS, const nsIID& aIID)
+{
+  void* newRawPtr;
+  if (NS_FAILED(aGS(aIID, &newRawPtr))) {
+    newRawPtr = 0;
   }
+  assign_assuming_AddRef(static_cast<nsISupports*>(newRawPtr));
+}
 
 void
-nsCOMPtr_base::assign_from_helper( const nsCOMPtr_helper& helper, const nsIID& iid )
-  {
-    void* newRawPtr;
-    if ( NS_FAILED( helper(iid, &newRawPtr) ) )
-      newRawPtr = 0;
-    assign_assuming_AddRef(static_cast<nsISupports*>(newRawPtr));
+nsCOMPtr_base::assign_from_helper(const nsCOMPtr_helper& aHelper,
+                                  const nsIID& aIID)
+{
+  void* newRawPtr;
+  if (NS_FAILED(aHelper(aIID, &newRawPtr))) {
+    newRawPtr = 0;
   }
+  assign_assuming_AddRef(static_cast<nsISupports*>(newRawPtr));
+}
 
 void**
 nsCOMPtr_base::begin_assignment()
-  {
-    assign_assuming_AddRef(0);
-    return reinterpret_cast<void**>(&mRawPtr);
-  }
+{
+  assign_assuming_AddRef(0);
+  return reinterpret_cast<void**>(&mRawPtr);
+}
--- a/xpcom/glue/nsCOMPtr.h
+++ b/xpcom/glue/nsCOMPtr.h
@@ -3,17 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef nsCOMPtr_h___
 #define nsCOMPtr_h___
 
 /*
   Having problems?
-  
+
   See the User Manual at:
     http://www.mozilla.org/projects/xpcom/nsCOMPtr.html
 
 
   nsCOMPtr
     better than a raw pointer
   for owning objects
                        -- scc
@@ -108,1551 +108,1436 @@
 #endif
 
 namespace mozilla {
 
 struct unused_t;
 
 } // namespace mozilla
 
-template <class T>
+template<class T>
 struct already_AddRefed
-    /*
-      ...cooperates with |nsCOMPtr| to allow you to assign in a pointer _without_
-      |AddRef|ing it.  You might want to use this as a return type from a function
-      that produces an already |AddRef|ed pointer as a result.
+/*
+  ...cooperates with |nsCOMPtr| to allow you to assign in a pointer _without_
+  |AddRef|ing it.  You might want to use this as a return type from a function
+  that produces an already |AddRef|ed pointer as a result.
 
-      See also |getter_AddRefs()|, |dont_AddRef()|, and |class nsGetterAddRefs|.
+  See also |getter_AddRefs()|, |dont_AddRef()|, and |class nsGetterAddRefs|.
 
-      This type should be a nested class inside |nsCOMPtr<T>|.
+  This type should be a nested class inside |nsCOMPtr<T>|.
 
-      Yes, |already_AddRefed| could have been implemented as an |nsCOMPtr_helper| to
-      avoid adding specialized machinery to |nsCOMPtr| ... but this is the simplest
-      case, and perhaps worth the savings in time and space that its specific
-      implementation affords over the more general solution offered by
-      |nsCOMPtr_helper|.
-    */
+  Yes, |already_AddRefed| could have been implemented as an |nsCOMPtr_helper| to
+  avoid adding specialized machinery to |nsCOMPtr| ... but this is the simplest
+  case, and perhaps worth the savings in time and space that its specific
+  implementation affords over the more general solution offered by
+  |nsCOMPtr_helper|.
+*/
+{
+  /*
+   * Prohibit all one-argument overloads but already_AddRefed(T*) and
+   * already_AddRefed(decltype(nullptr)), and funnel the nullptr case through
+   * the T* constructor.
+   */
+  template<typename N>
+  already_AddRefed(N,
+                   typename mozilla::EnableIf<mozilla::IsNullPointer<N>::value,
+                                              int>::Type aDummy = 0)
+    : mRawPtr(nullptr)
   {
-    /*
-     * Prohibit all one-argument overloads but already_AddRefed(T*) and
-     * already_AddRefed(decltype(nullptr)), and funnel the nullptr case through
-     * the T* constructor.
-     */
-    template<typename N>
-    already_AddRefed(N,
-                     typename mozilla::EnableIf<mozilla::IsNullPointer<N>::value,
-                                                int>::Type dummy = 0)
-      : mRawPtr(nullptr)
-    {
-      // nothing else to do here
-    }
+  }
 
 #ifdef MOZ_HAVE_CXX11_NULLPTR
-    // We have to keep this constructor implicit if we don't have nullptr support
-    // so that returning nullptr from a function which returns an already_AddRefed
-    // type works on the older b2g toolchains.
-    explicit
+  // We have to keep this constructor implicit if we don't have nullptr support
+  // so that returning nullptr from a function which returns an already_AddRefed
+  // type works on the older b2g toolchains.
+  explicit
 #endif
-    already_AddRefed( T* aRawPtr )
-      : mRawPtr(aRawPtr)
-    {
-      // nothing else to do here
-    }
-
-    // Disallowed.  Use move semantics instead.
-    already_AddRefed(const already_AddRefed<T>& aOther) MOZ_DELETE;
-
-    already_AddRefed(already_AddRefed<T>&& aOther)
-      : mRawPtr(aOther.take())
-    {
-      // nothing else to do here
-    }
+  already_AddRefed(T* aRawPtr) : mRawPtr(aRawPtr) {}
 
-    ~already_AddRefed()
-    {
-      MOZ_ASSERT(!mRawPtr);
-    }
+  // Disallowed.  Use move semantics instead.
+  already_AddRefed(const already_AddRefed<T>& aOther) MOZ_DELETE;
 
-    // Specialize the unused operator<< for already_AddRefed, to allow
-    // nsCOMPtr<nsIFoo> foo;
-    // unused << foo.forget();
-    friend void operator<<(const mozilla::unused_t& unused,
-                           const already_AddRefed<T>& rhs)
-    {
-      auto mutableAlreadyAddRefed = const_cast<already_AddRefed<T>*>(&rhs);
-      unused << mutableAlreadyAddRefed->take();
-    }
+  already_AddRefed(already_AddRefed<T>&& aOther) : mRawPtr(aOther.take()) {}
 
-    MOZ_WARN_UNUSED_RESULT T* take()
-    {
-      T* rawPtr = mRawPtr;
-      mRawPtr = nullptr;
-      return rawPtr;
-    }
+  ~already_AddRefed() { MOZ_ASSERT(!mRawPtr); }
 
-    /**
-     * This helper is useful in cases like
-     *
-     *  already_AddRefed<BaseClass>
-     *  Foo()
-     *  {
-     *    nsRefPtr<SubClass> x = ...;
-     *    return x.forget();
-     *  }
-     *
-     * The autoconversion allows one to omit the idiom
-     *
-     *    nsRefPtr<BaseClass> y = x.forget();
-     *    return y.forget();
-     */
-    template<class U>
-    operator already_AddRefed<U>()
-    {
-      U* tmp = mRawPtr;
-      mRawPtr = nullptr;
-      return already_AddRefed<U>(tmp);
-    }
+  // Specialize the unused operator<< for already_AddRefed, to allow
+  // nsCOMPtr<nsIFoo> foo;
+  // unused << foo.forget();
+  friend void operator<<(const mozilla::unused_t& aUnused,
+                         const already_AddRefed<T>& aRhs)
+  {
+    auto mutableAlreadyAddRefed = const_cast<already_AddRefed<T>*>(&aRhs);
+    aUnused << mutableAlreadyAddRefed->take();
+  }
 
-    /**
-     * This helper provides a static_cast replacement for already_AddRefed, so
-     * if you have
-     *
-     *   already_AddRefed<Parent> F();
-     *
-     * you can write
-     *
-     *   already_AddRefed<Child>
-     *   G()
-     *   {
-     *     return F().downcast<Child>();
-     *   }
-     *
-     * instead of
-     *
-     *     return dont_AddRef(static_cast<Child*>(F().get()));
-     */
-    template<class U>
-    already_AddRefed<U> downcast()
-    {
-      U* tmp = static_cast<U*>(mRawPtr);
-      mRawPtr = nullptr;
-      return already_AddRefed<U>(tmp);
-    }
-
-  private:
-    T* mRawPtr;
-  };
-
-template <class T>
-inline
-already_AddRefed<T>
-dont_AddRef( T* aRawPtr )
+  MOZ_WARN_UNUSED_RESULT T* take()
   {
-    return already_AddRefed<T>(aRawPtr);
+    T* rawPtr = mRawPtr;
+    mRawPtr = nullptr;
+    return rawPtr;
   }
 
-template <class T>
-inline
-already_AddRefed<T>&&
-dont_AddRef( already_AddRefed<T>&& aAlreadyAddRefedPtr )
+  /**
+   * This helper is useful in cases like
+   *
+   *  already_AddRefed<BaseClass>
+   *  Foo()
+   *  {
+   *    nsRefPtr<SubClass> x = ...;
+   *    return x.forget();
+   *  }
+   *
+   * The autoconversion allows one to omit the idiom
+   *
+   *    nsRefPtr<BaseClass> y = x.forget();
+   *    return y.forget();
+   */
+  template<class U>
+  operator already_AddRefed<U>()
   {
-    return mozilla::Move(aAlreadyAddRefedPtr);
+    U* tmp = mRawPtr;
+    mRawPtr = nullptr;
+    return already_AddRefed<U>(tmp);
   }
 
+  /**
+   * This helper provides a static_cast replacement for already_AddRefed, so
+   * if you have
+   *
+   *   already_AddRefed<Parent> F();
+   *
+   * you can write
+   *
+   *   already_AddRefed<Child>
+   *   G()
+   *   {
+   *     return F().downcast<Child>();
+   *   }
+   *
+   * instead of
+   *
+   *     return dont_AddRef(static_cast<Child*>(F().get()));
+   */
+  template<class U>
+  already_AddRefed<U> downcast()
+  {
+    U* tmp = static_cast<U*>(mRawPtr);
+    mRawPtr = nullptr;
+    return already_AddRefed<U>(tmp);
+  }
+
+private:
+  T* mRawPtr;
+};
+
+template<class T>
+inline already_AddRefed<T>
+dont_AddRef(T* aRawPtr)
+{
+  return already_AddRefed<T>(aRawPtr);
+}
+
+template<class T>
+inline already_AddRefed<T>&&
+dont_AddRef(already_AddRefed<T>&& aAlreadyAddRefedPtr)
+{
+  return mozilla::Move(aAlreadyAddRefedPtr);
+}
+
 
 
 class nsCOMPtr_helper
-    /*
-      An |nsCOMPtr_helper| transforms commonly called getters into typesafe forms
-      that are more convenient to call, and more efficient to use with |nsCOMPtr|s.
-      Good candidates for helpers are |QueryInterface()|, |CreateInstance()|, etc.
+/*
+  An |nsCOMPtr_helper| transforms commonly called getters into typesafe forms
+  that are more convenient to call, and more efficient to use with |nsCOMPtr|s.
+  Good candidates for helpers are |QueryInterface()|, |CreateInstance()|, etc.
 
-      Here are the rules for a helper:
-        - it implements |operator()| to produce an interface pointer
-        - (except for its name) |operator()| is a valid [XP]COM `getter'
-        - the interface pointer that it returns is already |AddRef()|ed (as from any good getter)
-        - it matches the type requested with the supplied |nsIID| argument
-        - its constructor provides an optional |nsresult*| that |operator()| can fill
-          in with an error when it is executed
-          
-      See |class nsGetInterface| for an example.
-    */
-  {
-    public:
-      virtual nsresult NS_FASTCALL operator()( const nsIID&, void** ) const = 0;
-  };
+  Here are the rules for a helper:
+    - it implements |operator()| to produce an interface pointer
+    - (except for its name) |operator()| is a valid [XP]COM `getter'
+    - the interface pointer that it returns is already |AddRef()|ed (as from any good getter)
+    - it matches the type requested with the supplied |nsIID| argument
+    - its constructor provides an optional |nsresult*| that |operator()| can fill
+      in with an error when it is executed
+
+  See |class nsGetInterface| for an example.
+*/
+{
+public:
+  virtual nsresult NS_FASTCALL operator()(const nsIID&, void**) const = 0;
+};
 
 /*
   |nsQueryInterface| could have been implemented as an |nsCOMPtr_helper| to
   avoid adding specialized machinery in |nsCOMPtr|, But |do_QueryInterface|
   is called often enough that the codesize savings are big enough to
   warrant the specialcasing.
 */
 
-class
-  NS_COM_GLUE
-  MOZ_STACK_CLASS
-nsQueryInterface MOZ_FINAL
-  {
-    public:
-      explicit
-      nsQueryInterface( nsISupports* aRawPtr )
-          : mRawPtr(aRawPtr)
-        {
-          // nothing else to do here
-        }
+class NS_COM_GLUE MOZ_STACK_CLASS nsQueryInterface MOZ_FINAL
+{
+public:
+  explicit
+  nsQueryInterface(nsISupports* aRawPtr) : mRawPtr(aRawPtr) {}
 
-      nsresult NS_FASTCALL operator()( const nsIID& aIID, void** ) const;
+  nsresult NS_FASTCALL operator()(const nsIID& aIID, void**) const;
 
-    private:
-      nsISupports*  mRawPtr;
-  };
+private:
+  nsISupports* mRawPtr;
+};
 
 class NS_COM_GLUE nsQueryInterfaceWithError
+{
+public:
+  nsQueryInterfaceWithError(nsISupports* aRawPtr, nsresult* aError)
+    : mRawPtr(aRawPtr)
+    , mErrorPtr(aError)
   {
-    public:
-      nsQueryInterfaceWithError( nsISupports* aRawPtr, nsresult* error )
-          : mRawPtr(aRawPtr),
-            mErrorPtr(error)
-        {
-          // nothing else to do here
-        }
-
-      nsresult NS_FASTCALL operator()( const nsIID& aIID, void** ) const;
-
-    private:
-      nsISupports*  mRawPtr;
-      nsresult*     mErrorPtr;
-  };
-
-inline
-nsQueryInterface
-do_QueryInterface( nsISupports* aRawPtr )
-  {
-    return nsQueryInterface(aRawPtr);
   }
 
-inline
-nsQueryInterfaceWithError
-do_QueryInterface( nsISupports* aRawPtr, nsresult* error )
-  {
-    return nsQueryInterfaceWithError(aRawPtr, error);
-  }
+  nsresult NS_FASTCALL operator()(const nsIID& aIID, void**) const;
+
+private:
+  nsISupports* mRawPtr;
+  nsresult* mErrorPtr;
+};
+
+inline nsQueryInterface
+do_QueryInterface(nsISupports* aRawPtr)
+{
+  return nsQueryInterface(aRawPtr);
+}
 
-template <class T>
-inline
-void
-do_QueryInterface( already_AddRefed<T>& )
-  {
-    // This signature exists solely to _stop_ you from doing the bad thing.
-    //  Saying |do_QueryInterface()| on a pointer that is not otherwise owned by
-    //  someone else is an automatic leak.  See <http://bugzilla.mozilla.org/show_bug.cgi?id=8221>.
-  }
+inline nsQueryInterfaceWithError
+do_QueryInterface(nsISupports* aRawPtr, nsresult* aError)
+{
+  return nsQueryInterfaceWithError(aRawPtr, aError);
+}
 
-template <class T>
-inline
-void
-do_QueryInterface( already_AddRefed<T>&, nsresult* )
-  {
-    // This signature exists solely to _stop_ you from doing the bad thing.
-    //  Saying |do_QueryInterface()| on a pointer that is not otherwise owned by
-    //  someone else is an automatic leak.  See <http://bugzilla.mozilla.org/show_bug.cgi?id=8221>.
-  }
+template<class T>
+inline void
+do_QueryInterface(already_AddRefed<T>&)
+{
+  // This signature exists solely to _stop_ you from doing the bad thing.
+  //  Saying |do_QueryInterface()| on a pointer that is not otherwise owned by
+  //  someone else is an automatic leak.  See <http://bugzilla.mozilla.org/show_bug.cgi?id=8221>.
+}
+
+template<class T>
+inline void
+do_QueryInterface(already_AddRefed<T>&, nsresult*)
+{
+  // This signature exists solely to _stop_ you from doing the bad thing.
+  //  Saying |do_QueryInterface()| on a pointer that is not otherwise owned by
+  //  someone else is an automatic leak.  See <http://bugzilla.mozilla.org/show_bug.cgi?id=8221>.
+}
 
 
 ////////////////////////////////////////////////////////////////////////////
 // Using servicemanager with COMPtrs
 class NS_COM_GLUE nsGetServiceByCID
 {
- public:
-    explicit nsGetServiceByCID(const nsCID& aCID)
-        : mCID(aCID)
-        {
-            // nothing else to do
-        }
-    
-    nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
-    
- private:
-    const nsCID&                mCID;
+public:
+  explicit nsGetServiceByCID(const nsCID& aCID) : mCID(aCID) {}
+
+  nsresult NS_FASTCALL operator()(const nsIID&, void**) const;
+
+private:
+  const nsCID& mCID;
 };
 
 class NS_COM_GLUE nsGetServiceByCIDWithError
 {
- public:
-    nsGetServiceByCIDWithError( const nsCID& aCID, nsresult* aErrorPtr )
-        : mCID(aCID),
-          mErrorPtr(aErrorPtr)
-        {
-            // nothing else to do
-        }
-    
-    nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
-    
- private:
-    const nsCID&                mCID;
-    nsresult*                   mErrorPtr;
+public:
+  nsGetServiceByCIDWithError(const nsCID& aCID, nsresult* aErrorPtr)
+    : mCID(aCID)
+    , mErrorPtr(aErrorPtr)
+  {
+  }
+
+  nsresult NS_FASTCALL operator()(const nsIID&, void**) const;
+
+private:
+  const nsCID& mCID;
+  nsresult* mErrorPtr;
 };
 
 class NS_COM_GLUE nsGetServiceByContractID
 {
- public:
-    explicit nsGetServiceByContractID(const char* aContractID)
-        : mContractID(aContractID)
-        {
-            // nothing else to do
-        }
-    
-    nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
-    
- private:
-    const char*                 mContractID;
+public:
+  explicit nsGetServiceByContractID(const char* aContractID)
+    : mContractID(aContractID)
+  {
+  }
+
+  nsresult NS_FASTCALL operator()(const nsIID&, void**) const;
+
+private:
+  const char* mContractID;
 };
 
 class NS_COM_GLUE nsGetServiceByContractIDWithError
 {
- public:
-    nsGetServiceByContractIDWithError(const char* aContractID, nsresult* aErrorPtr)
-        : mContractID(aContractID),
-          mErrorPtr(aErrorPtr)
-        {
-            // nothing else to do
-        }
-    
-    nsresult NS_FASTCALL operator()( const nsIID&, void** ) const;
-    
- private:
-    const char*                 mContractID;
-    nsresult*                   mErrorPtr;
+public:
+  nsGetServiceByContractIDWithError(const char* aContractID, nsresult* aErrorPtr)
+    : mContractID(aContractID)
+    , mErrorPtr(aErrorPtr)
+  {
+  }
+
+  nsresult NS_FASTCALL operator()(const nsIID&, void**) const;
+
+private:
+  const char* mContractID;
+  nsresult* mErrorPtr;
 };
 
-class
-nsCOMPtr_base
-    /*
-      ...factors implementation for all template versions of |nsCOMPtr|.
+class nsCOMPtr_base
+/*
+  ...factors implementation for all template versions of |nsCOMPtr|.
+
+  This should really be an |nsCOMPtr<nsISupports>|, but this wouldn't work
+  because unlike the
+
+  Here's the way people normally do things like this
 
-      This should really be an |nsCOMPtr<nsISupports>|, but this wouldn't work
-      because unlike the
+    template<class T> class Foo { ... };
+    template<> class Foo<void*> { ... };
+    template<class T> class Foo<T*> : private Foo<void*> { ... };
+*/
+{
+public:
+  explicit nsCOMPtr_base(nsISupports* aRawPtr = 0) : mRawPtr(aRawPtr) {}
 
-      Here's the way people normally do things like this
-      
-        template <class T> class Foo { ... };
-        template <> class Foo<void*> { ... };
-        template <class T> class Foo<T*> : private Foo<void*> { ... };
-    */
+  NS_COM_GLUE NS_CONSTRUCTOR_FASTCALL ~nsCOMPtr_base()
   {
-    public:
-
-      explicit nsCOMPtr_base( nsISupports* rawPtr = 0 )
-          : mRawPtr(rawPtr)
-        {
-          // nothing else to do here
-        }
-
-      NS_COM_GLUE NS_CONSTRUCTOR_FASTCALL ~nsCOMPtr_base()
-        {
-          NSCAP_LOG_RELEASE(this, mRawPtr);
-            if ( mRawPtr )
-              NSCAP_RELEASE(this, mRawPtr);
-        }
+    NSCAP_LOG_RELEASE(this, mRawPtr);
+    if (mRawPtr) {
+      NSCAP_RELEASE(this, mRawPtr);
+    }
+  }
 
-      NS_COM_GLUE void NS_FASTCALL   assign_with_AddRef( nsISupports* );
-      NS_COM_GLUE void NS_FASTCALL   assign_from_qi( const nsQueryInterface, const nsIID& );
-      NS_COM_GLUE void NS_FASTCALL   assign_from_qi_with_error( const nsQueryInterfaceWithError&, const nsIID& );
-      NS_COM_GLUE void NS_FASTCALL   assign_from_gs_cid( const nsGetServiceByCID, const nsIID& );
-      NS_COM_GLUE void NS_FASTCALL   assign_from_gs_cid_with_error( const nsGetServiceByCIDWithError&, const nsIID& );
-      NS_COM_GLUE void NS_FASTCALL   assign_from_gs_contractid( const nsGetServiceByContractID, const nsIID& );
-      NS_COM_GLUE void NS_FASTCALL   assign_from_gs_contractid_with_error( const nsGetServiceByContractIDWithError&, const nsIID& );
-      NS_COM_GLUE void NS_FASTCALL   assign_from_helper( const nsCOMPtr_helper&, const nsIID& );
-      NS_COM_GLUE void** NS_FASTCALL begin_assignment();
+  NS_COM_GLUE void NS_FASTCALL
+  assign_with_AddRef(nsISupports*);
+  NS_COM_GLUE void NS_FASTCALL
+  assign_from_qi(const nsQueryInterface, const nsIID&);
+  NS_COM_GLUE void NS_FASTCALL
+  assign_from_qi_with_error(const nsQueryInterfaceWithError&, const nsIID&);
+  NS_COM_GLUE void NS_FASTCALL
+  assign_from_gs_cid(const nsGetServiceByCID, const nsIID&);
+  NS_COM_GLUE void NS_FASTCALL
+  assign_from_gs_cid_with_error(const nsGetServiceByCIDWithError&, const nsIID&);
+  NS_COM_GLUE void NS_FASTCALL
+  assign_from_gs_contractid(const nsGetServiceByContractID, const nsIID&);
+  NS_COM_GLUE void NS_FASTCALL
+  assign_from_gs_contractid_with_error(const nsGetServiceByContractIDWithError&,
+                                       const nsIID&);
+  NS_COM_GLUE void NS_FASTCALL
+  assign_from_helper(const nsCOMPtr_helper&, const nsIID&);
+  NS_COM_GLUE void** NS_FASTCALL
+  begin_assignment();
 
-    protected:
-      NS_MAY_ALIAS_PTR(nsISupports) mRawPtr;
+protected:
+  NS_MAY_ALIAS_PTR(nsISupports) mRawPtr;
 
-      void
-      assign_assuming_AddRef( nsISupports* newPtr )
-        {
-            /*
-              |AddRef()|ing the new value (before entering this function) before
-              |Release()|ing the old lets us safely ignore the self-assignment case.
-              We must, however, be careful only to |Release()| _after_ doing the
-              assignment, in case the |Release()| leads to our _own_ destruction,
-              which would, in turn, cause an incorrect second |Release()| of our old
-              pointer.  Thank <waterson@netscape.com> for discovering this.
-            */
-          nsISupports* oldPtr = mRawPtr;
-          mRawPtr = newPtr;
-          NSCAP_LOG_ASSIGNMENT(this, newPtr);
-          NSCAP_LOG_RELEASE(this, oldPtr);
-          if ( oldPtr )
-            NSCAP_RELEASE(this, oldPtr);
-        }
-  };
+  void assign_assuming_AddRef(nsISupports* aNewPtr)
+  {
+    /*
+      |AddRef()|ing the new value (before entering this function) before
+      |Release()|ing the old lets us safely ignore the self-assignment case.
+      We must, however, be careful only to |Release()| _after_ doing the
+      assignment, in case the |Release()| leads to our _own_ destruction,
+      which would, in turn, cause an incorrect second |Release()| of our old
+      pointer.  Thank <waterson@netscape.com> for discovering this.
+    */
+    nsISupports* oldPtr = mRawPtr;
+    mRawPtr = aNewPtr;
+    NSCAP_LOG_ASSIGNMENT(this, aNewPtr);
+    NSCAP_LOG_RELEASE(this, oldPtr);
+    if (oldPtr) {
+      NSCAP_RELEASE(this, oldPtr);
+    }
+  }
+};
 
-// template <class T> class nsGetterAddRefs;
+// template<class T> class nsGetterAddRefs;
 
-template <class T>
+template<class T>
 class nsCOMPtr MOZ_FINAL
 #ifdef NSCAP_FEATURE_USE_BASE
-    : private nsCOMPtr_base
+  : private nsCOMPtr_base
 #endif
-  {
+{
 
 #ifdef NSCAP_FEATURE_USE_BASE
   #define NSCAP_CTOR_BASE(x) nsCOMPtr_base(x)
 #else
   #define NSCAP_CTOR_BASE(x) mRawPtr(x)
 
-    private:
-      void    assign_with_AddRef( nsISupports* );
-      void    assign_from_qi( const nsQueryInterface, const nsIID& );
-      void    assign_from_qi_with_error( const nsQueryInterfaceWithError&, const nsIID& );
-      void    assign_from_gs_cid( const nsGetServiceByCID, const nsIID& );
-      void    assign_from_gs_cid_with_error( const nsGetServiceByCIDWithError&, const nsIID& );
-      void    assign_from_gs_contractid( const nsGetServiceByContractID, const nsIID& );
-      void    assign_from_gs_contractid_with_error( const nsGetServiceByContractIDWithError&, const nsIID& );
-      void    assign_from_helper( const nsCOMPtr_helper&, const nsIID& );
-      void**  begin_assignment();
+private:
+  void assign_with_AddRef(nsISupports*);
+  void assign_from_qi(const nsQueryInterface, const nsIID&);
+  void assign_from_qi_with_error(const nsQueryInterfaceWithError&, const nsIID&);
+  void assign_from_gs_cid(const nsGetServiceByCID, const nsIID&);
+  void assign_from_gs_cid_with_error(const nsGetServiceByCIDWithError&,
+                                     const nsIID&);
+  void assign_from_gs_contractid(const nsGetServiceByContractID, const nsIID&);
+  void assign_from_gs_contractid_with_error(
+    const nsGetServiceByContractIDWithError&, const nsIID&);
+  void assign_from_helper(const nsCOMPtr_helper&, const nsIID&);
+  void** begin_assignment();
 
-      void
-      assign_assuming_AddRef( T* newPtr )
-        {
-          T* oldPtr = mRawPtr;
-          mRawPtr = newPtr;
-          NSCAP_LOG_ASSIGNMENT(this, newPtr);
-          NSCAP_LOG_RELEASE(this, oldPtr);
-          if ( oldPtr )
-            NSCAP_RELEASE(this, oldPtr);
-        }
+  void assign_assuming_AddRef(T* aNewPtr)
+  {
+    T* oldPtr = mRawPtr;
+    mRawPtr = aNewPtr;
+    NSCAP_LOG_ASSIGNMENT(this, aNewPtr);
+    NSCAP_LOG_RELEASE(this, oldPtr);
+    if (oldPtr) {
+      NSCAP_RELEASE(this, oldPtr);
+    }
+  }
 
-    private:
-      T* mRawPtr;
+private:
+  T* mRawPtr;
 #endif
 
-    public:
-      typedef T element_type;
-      
+public:
+  typedef T element_type;
+
 #ifndef NSCAP_FEATURE_USE_BASE
-     ~nsCOMPtr()
-        {
-          NSCAP_LOG_RELEASE(this, mRawPtr);
-          if ( mRawPtr )
-            NSCAP_RELEASE(this, mRawPtr);
-        }
+  ~nsCOMPtr()
+  {
+    NSCAP_LOG_RELEASE(this, mRawPtr);
+    if (mRawPtr) {
+      NSCAP_RELEASE(this, mRawPtr);
+    }
+  }
 #endif
 
 #ifdef NSCAP_FEATURE_TEST_DONTQUERY_CASES
-      void
-      Assert_NoQueryNeeded()
-        {
-          if ( mRawPtr )
-            {
-              nsCOMPtr<T> query_result( do_QueryInterface(mRawPtr) );
-              NS_ASSERTION(query_result.get() == mRawPtr, "QueryInterface needed");
-            }
-        }
+  void Assert_NoQueryNeeded()
+  {
+    if (mRawPtr) {
+      nsCOMPtr<T> query_result(do_QueryInterface(mRawPtr));
+      NS_ASSERTION(query_result.get() == mRawPtr, "QueryInterface needed");
+    }
+  }
 
   #define NSCAP_ASSERT_NO_QUERY_NEEDED() Assert_NoQueryNeeded();
 #else
   #define NSCAP_ASSERT_NO_QUERY_NEEDED()
 #endif
 
 
-        // Constructors
+  // Constructors
 
-      nsCOMPtr()
-            : NSCAP_CTOR_BASE(0)
-          // default constructor
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-        }
+  nsCOMPtr()
+    : NSCAP_CTOR_BASE(0)
+    // default constructor
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+  }
 
-      nsCOMPtr( const nsCOMPtr<T>& aSmartPtr )
-            : NSCAP_CTOR_BASE(aSmartPtr.mRawPtr)
-          // copy-constructor
-        {
-          if ( mRawPtr )
-            NSCAP_ADDREF(this, mRawPtr);
-          NSCAP_LOG_ASSIGNMENT(this, aSmartPtr.mRawPtr);
-        }
-
-      MOZ_IMPLICIT nsCOMPtr( T* aRawPtr )
-            : NSCAP_CTOR_BASE(aRawPtr)
-          // construct from a raw pointer (of the right type)
-        {
-          if ( mRawPtr )
-            NSCAP_ADDREF(this, mRawPtr);
-          NSCAP_LOG_ASSIGNMENT(this, aRawPtr);
-          NSCAP_ASSERT_NO_QUERY_NEEDED();
-        }
+  nsCOMPtr(const nsCOMPtr<T>& aSmartPtr)
+    : NSCAP_CTOR_BASE(aSmartPtr.mRawPtr)
+    // copy-constructor
+  {
+    if (mRawPtr) {
+      NSCAP_ADDREF(this, mRawPtr);
+    }
+    NSCAP_LOG_ASSIGNMENT(this, aSmartPtr.mRawPtr);
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( already_AddRefed<T>& aSmartPtr )
-            : NSCAP_CTOR_BASE(aSmartPtr.take())
-          // construct from |already_AddRefed|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, mRawPtr);
-          NSCAP_ASSERT_NO_QUERY_NEEDED();
-        }
+  MOZ_IMPLICIT nsCOMPtr(T* aRawPtr)
+    : NSCAP_CTOR_BASE(aRawPtr)
+    // construct from a raw pointer (of the right type)
+  {
+    if (mRawPtr) {
+      NSCAP_ADDREF(this, mRawPtr);
+    }
+    NSCAP_LOG_ASSIGNMENT(this, aRawPtr);
+    NSCAP_ASSERT_NO_QUERY_NEEDED();
+  }
+
+  MOZ_IMPLICIT nsCOMPtr(already_AddRefed<T>& aSmartPtr)
+    : NSCAP_CTOR_BASE(aSmartPtr.take())
+    // construct from |already_AddRefed|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, mRawPtr);
+    NSCAP_ASSERT_NO_QUERY_NEEDED();
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( already_AddRefed<T>&& aSmartPtr )
-            : NSCAP_CTOR_BASE(aSmartPtr.take())
-          // construct from |otherComPtr.forget()|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, mRawPtr);
-          NSCAP_ASSERT_NO_QUERY_NEEDED();
-        }
+  MOZ_IMPLICIT nsCOMPtr(already_AddRefed<T>&& aSmartPtr)
+    : NSCAP_CTOR_BASE(aSmartPtr.take())
+    // construct from |otherComPtr.forget()|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, mRawPtr);
+    NSCAP_ASSERT_NO_QUERY_NEEDED();
+  }
 
-      template<typename U>
-      MOZ_IMPLICIT nsCOMPtr( already_AddRefed<U>& aSmartPtr )
-            : NSCAP_CTOR_BASE(static_cast<T*>(aSmartPtr.take()))
-          // construct from |already_AddRefed|
-        {
-          // But make sure that U actually inherits from T
-          static_assert(mozilla::IsBaseOf<T, U>::value,
-                        "U is not a subclass of T");
-          NSCAP_LOG_ASSIGNMENT(this, static_cast<T*>(mRawPtr));
-          NSCAP_ASSERT_NO_QUERY_NEEDED();
-        }
+  template<typename U>
+  MOZ_IMPLICIT nsCOMPtr(already_AddRefed<U>& aSmartPtr)
+    : NSCAP_CTOR_BASE(static_cast<T*>(aSmartPtr.take()))
+    // construct from |already_AddRefed|
+  {
+    // But make sure that U actually inherits from T
+    static_assert(mozilla::IsBaseOf<T, U>::value,
+                  "U is not a subclass of T");
+    NSCAP_LOG_ASSIGNMENT(this, static_cast<T*>(mRawPtr));
+    NSCAP_ASSERT_NO_QUERY_NEEDED();
+  }
 
-      template<typename U>
-      MOZ_IMPLICIT nsCOMPtr( already_AddRefed<U>&& aSmartPtr )
-            : NSCAP_CTOR_BASE(static_cast<T*>(aSmartPtr.take()))
-          // construct from |otherComPtr.forget()|
-        {
-          // But make sure that U actually inherits from T
-          static_assert(mozilla::IsBaseOf<T, U>::value,
-                        "U is not a subclass of T");
-          NSCAP_LOG_ASSIGNMENT(this, static_cast<T*>(mRawPtr));
-          NSCAP_ASSERT_NO_QUERY_NEEDED();
-        }
+  template<typename U>
+  MOZ_IMPLICIT nsCOMPtr(already_AddRefed<U>&& aSmartPtr)
+    : NSCAP_CTOR_BASE(static_cast<T*>(aSmartPtr.take()))
+    // construct from |otherComPtr.forget()|
+  {
+    // But make sure that U actually inherits from T
+    static_assert(mozilla::IsBaseOf<T, U>::value,
+                  "U is not a subclass of T");
+    NSCAP_LOG_ASSIGNMENT(this, static_cast<T*>(mRawPtr));
+    NSCAP_ASSERT_NO_QUERY_NEEDED();
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( const nsQueryInterface qi )
-            : NSCAP_CTOR_BASE(0)
-          // construct from |do_QueryInterface(expr)|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-          assign_from_qi(qi, NS_GET_TEMPLATE_IID(T));
-        }
+  MOZ_IMPLICIT nsCOMPtr(const nsQueryInterface aQI)
+    : NSCAP_CTOR_BASE(0)
+    // construct from |do_QueryInterface(expr)|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+    assign_from_qi(aQI, NS_GET_TEMPLATE_IID(T));
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( const nsQueryInterfaceWithError& qi )
-            : NSCAP_CTOR_BASE(0)
-          // construct from |do_QueryInterface(expr, &rv)|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-          assign_from_qi_with_error(qi, NS_GET_TEMPLATE_IID(T));
-        }
+  MOZ_IMPLICIT nsCOMPtr(const nsQueryInterfaceWithError& aQI)
+    : NSCAP_CTOR_BASE(0)
+    // construct from |do_QueryInterface(expr, &rv)|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+    assign_from_qi_with_error(aQI, NS_GET_TEMPLATE_IID(T));
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( const nsGetServiceByCID gs )
-            : NSCAP_CTOR_BASE(0)
-          // construct from |do_GetService(cid_expr)|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-          assign_from_gs_cid(gs, NS_GET_TEMPLATE_IID(T));
-        }
+  MOZ_IMPLICIT nsCOMPtr(const nsGetServiceByCID aGS)
+    : NSCAP_CTOR_BASE(0)
+    // construct from |do_GetService(cid_expr)|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+    assign_from_gs_cid(aGS, NS_GET_TEMPLATE_IID(T));
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( const nsGetServiceByCIDWithError& gs )
-            : NSCAP_CTOR_BASE(0)
-          // construct from |do_GetService(cid_expr, &rv)|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-          assign_from_gs_cid_with_error(gs, NS_GET_TEMPLATE_IID(T));
-        }
+  MOZ_IMPLICIT nsCOMPtr(const nsGetServiceByCIDWithError& aGS)
+    : NSCAP_CTOR_BASE(0)
+    // construct from |do_GetService(cid_expr, &rv)|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+    assign_from_gs_cid_with_error(aGS, NS_GET_TEMPLATE_IID(T));
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( const nsGetServiceByContractID gs )
-            : NSCAP_CTOR_BASE(0)
-          // construct from |do_GetService(contractid_expr)|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-          assign_from_gs_contractid(gs, NS_GET_TEMPLATE_IID(T));
-        }
+  MOZ_IMPLICIT nsCOMPtr(const nsGetServiceByContractID aGS)
+    : NSCAP_CTOR_BASE(0)
+    // construct from |do_GetService(contractid_expr)|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+    assign_from_gs_contractid(aGS, NS_GET_TEMPLATE_IID(T));
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( const nsGetServiceByContractIDWithError& gs )
-            : NSCAP_CTOR_BASE(0)
-          // construct from |do_GetService(contractid_expr, &rv)|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-          assign_from_gs_contractid_with_error(gs, NS_GET_TEMPLATE_IID(T));
-        }
+  MOZ_IMPLICIT nsCOMPtr(const nsGetServiceByContractIDWithError& aGS)
+    : NSCAP_CTOR_BASE(0)
+    // construct from |do_GetService(contractid_expr, &rv)|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+    assign_from_gs_contractid_with_error(aGS, NS_GET_TEMPLATE_IID(T));
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( const nsCOMPtr_helper& helper )
-            : NSCAP_CTOR_BASE(0)
-          // ...and finally, anything else we might need to construct from
-          //  can exploit the |nsCOMPtr_helper| facility
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-          assign_from_helper(helper, NS_GET_TEMPLATE_IID(T));
-          NSCAP_ASSERT_NO_QUERY_NEEDED();
-        }
+  MOZ_IMPLICIT nsCOMPtr(const nsCOMPtr_helper& aHelper)
+    : NSCAP_CTOR_BASE(0)
+    // ...and finally, anything else we might need to construct from
+    //  can exploit the |nsCOMPtr_helper| facility
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+    assign_from_helper(aHelper, NS_GET_TEMPLATE_IID(T));
+    NSCAP_ASSERT_NO_QUERY_NEEDED();
+  }
 
 
-        // Assignment operators
+  // Assignment operators
+
+  nsCOMPtr<T>& operator=(const nsCOMPtr<T>& aRhs)
+  // copy assignment operator
+  {
+    assign_with_AddRef(aRhs.mRawPtr);
+    return *this;
+  }
 
-      nsCOMPtr<T>&
-      operator=( const nsCOMPtr<T>& rhs )
-          // copy assignment operator
-        {
-          assign_with_AddRef(rhs.mRawPtr);
-          return *this;
-        }
+  nsCOMPtr<T>& operator=(T* aRhs)
+  // assign from a raw pointer (of the right type)
+  {
+    assign_with_AddRef(aRhs);
+    NSCAP_ASSERT_NO_QUERY_NEEDED();
+    return *this;
+  }
 
-      nsCOMPtr<T>&
-      operator=( T* rhs )
-          // assign from a raw pointer (of the right type)
-        {
-          assign_with_AddRef(rhs);
-          NSCAP_ASSERT_NO_QUERY_NEEDED();
-          return *this;
-        }
+  template<typename U>
+  nsCOMPtr<T>& operator=(already_AddRefed<U>& aRhs)
+  // assign from |already_AddRefed|
+  {
+    // Make sure that U actually inherits from T
+    static_assert(mozilla::IsBaseOf<T, U>::value,
+                  "U is not a subclass of T");
+    assign_assuming_AddRef(static_cast<T*>(aRhs.take()));
+    NSCAP_ASSERT_NO_QUERY_NEEDED();
+    return *this;
+  }
 
-      template<typename U>
-      nsCOMPtr<T>&
-      operator=( already_AddRefed<U>& rhs )
-          // assign from |already_AddRefed|
-        {
-          // Make sure that U actually inherits from T
-          static_assert(mozilla::IsBaseOf<T, U>::value,
-                        "U is not a subclass of T");
-          assign_assuming_AddRef(static_cast<T*>(rhs.take()));
-          NSCAP_ASSERT_NO_QUERY_NEEDED();
-          return *this;
-        }
+  template<typename U>
+  nsCOMPtr<T>& operator=(already_AddRefed<U> && aRhs)
+  // assign from |otherComPtr.forget()|
+  {
+    // Make sure that U actually inherits from T
+    static_assert(mozilla::IsBaseOf<T, U>::value,
+                  "U is not a subclass of T");
+    assign_assuming_AddRef(static_cast<T*>(aRhs.take()));
+    NSCAP_ASSERT_NO_QUERY_NEEDED();
+    return *this;
+  }
 
-      template<typename U>
-      nsCOMPtr<T>&
-      operator=( already_AddRefed<U>&& rhs )
-          // assign from |otherComPtr.forget()|
-        {
-          // Make sure that U actually inherits from T
-          static_assert(mozilla::IsBaseOf<T, U>::value,
-                        "U is not a subclass of T");
-          assign_assuming_AddRef(static_cast<T*>(rhs.take()));
-          NSCAP_ASSERT_NO_QUERY_NEEDED();
-          return *this;
-        }
+  nsCOMPtr<T>& operator=(const nsQueryInterface aRhs)
+  // assign from |do_QueryInterface(expr)|
+  {
+    assign_from_qi(aRhs, NS_GET_TEMPLATE_IID(T));
+    return *this;
+  }
 
-      nsCOMPtr<T>&
-      operator=( const nsQueryInterface rhs )
-          // assign from |do_QueryInterface(expr)|
-        {
-          assign_from_qi(rhs, NS_GET_TEMPLATE_IID(T));
-          return *this;
-        }
+  nsCOMPtr<T>& operator=(const nsQueryInterfaceWithError& aRhs)
+  // assign from |do_QueryInterface(expr, &rv)|
+  {
+    assign_from_qi_with_error(aRhs, NS_GET_TEMPLATE_IID(T));
+    return *this;
+  }
 
-      nsCOMPtr<T>&
-      operator=( const nsQueryInterfaceWithError& rhs )
-          // assign from |do_QueryInterface(expr, &rv)|
-        {
-          assign_from_qi_with_error(rhs, NS_GET_TEMPLATE_IID(T));
-          return *this;
-        }
+  nsCOMPtr<T>& operator=(const nsGetServiceByCID aRhs)
+  // assign from |do_GetService(cid_expr)|
+  {
+    assign_from_gs_cid(aRhs, NS_GET_TEMPLATE_IID(T));
+    return *this;
+  }
 
-      nsCOMPtr<T>&
-      operator=( const nsGetServiceByCID rhs )
-          // assign from |do_GetService(cid_expr)|
-        {
-          assign_from_gs_cid(rhs, NS_GET_TEMPLATE_IID(T));
-          return *this;
-        }
+  nsCOMPtr<T>& operator=(const nsGetServiceByCIDWithError& aRhs)
+  // assign from |do_GetService(cid_expr, &rv)|
+  {
+    assign_from_gs_cid_with_error(aRhs, NS_GET_TEMPLATE_IID(T));
+    return *this;
+  }
 
-      nsCOMPtr<T>&
-      operator=( const nsGetServiceByCIDWithError& rhs )
-          // assign from |do_GetService(cid_expr, &rv)|
-        {
-          assign_from_gs_cid_with_error(rhs, NS_GET_TEMPLATE_IID(T));
-          return *this;
-        }
+  nsCOMPtr<T>& operator=(const nsGetServiceByContractID aRhs)
+  // assign from |do_GetService(contractid_expr)|
+  {
+    assign_from_gs_contractid(aRhs, NS_GET_TEMPLATE_IID(T));
+    return *this;
+  }
 
-      nsCOMPtr<T>&
-      operator=( const nsGetServiceByContractID rhs )
-          // assign from |do_GetService(contractid_expr)|
-        {
-          assign_from_gs_contractid(rhs, NS_GET_TEMPLATE_IID(T));
-          return *this;
-        }
+  nsCOMPtr<T>& operator=(const nsGetServiceByContractIDWithError& aRhs)
+  // assign from |do_GetService(contractid_expr, &rv)|
+  {
+    assign_from_gs_contractid_with_error(aRhs, NS_GET_TEMPLATE_IID(T));
+    return *this;
+  }
 
-      nsCOMPtr<T>&
-      operator=( const nsGetServiceByContractIDWithError& rhs )
-          // assign from |do_GetService(contractid_expr, &rv)|
-        {
-          assign_from_gs_contractid_with_error(rhs, NS_GET_TEMPLATE_IID(T));
-          return *this;
-        }
+  nsCOMPtr<T>& operator=(const nsCOMPtr_helper& aRhs)
+  // ...and finally, anything else we might need to assign from
+  //  can exploit the |nsCOMPtr_helper| facility.
+  {
+    assign_from_helper(aRhs, NS_GET_TEMPLATE_IID(T));
+    NSCAP_ASSERT_NO_QUERY_NEEDED();
+    return *this;
+  }
 
-      nsCOMPtr<T>&
-      operator=( const nsCOMPtr_helper& rhs )
-          // ...and finally, anything else we might need to assign from
-          //  can exploit the |nsCOMPtr_helper| facility.
-        {
-          assign_from_helper(rhs, NS_GET_TEMPLATE_IID(T));
-          NSCAP_ASSERT_NO_QUERY_NEEDED();
-          return *this;
-        }
-
-      void
-      swap( nsCOMPtr<T>& rhs )
-          // ...exchange ownership with |rhs|; can save a pair of refcount operations
-        {
+  void swap(nsCOMPtr<T>& aRhs)
+  // ...exchange ownership with |aRhs|; can save a pair of refcount operations
+  {
 #ifdef NSCAP_FEATURE_USE_BASE
-          nsISupports* temp = rhs.mRawPtr;
+    nsISupports* temp = aRhs.mRawPtr;
 #else
-          T* temp = rhs.mRawPtr;
+    T* temp = aRhs.mRawPtr;
 #endif
-          NSCAP_LOG_ASSIGNMENT(&rhs, mRawPtr);
-          NSCAP_LOG_ASSIGNMENT(this, temp);
-          NSCAP_LOG_RELEASE(this, mRawPtr);
-          NSCAP_LOG_RELEASE(&rhs, temp);
-          rhs.mRawPtr = mRawPtr;
-          mRawPtr = temp;
-          // |rhs| maintains the same invariants, so we don't need to |NSCAP_ASSERT_NO_QUERY_NEEDED|
-        }
+    NSCAP_LOG_ASSIGNMENT(&aRhs, mRawPtr);
+    NSCAP_LOG_ASSIGNMENT(this, temp);
+    NSCAP_LOG_RELEASE(this, mRawPtr);
+    NSCAP_LOG_RELEASE(&aRhs, temp);
+    aRhs.mRawPtr = mRawPtr;
+    mRawPtr = temp;
+    // |aRhs| maintains the same invariants, so we don't need to |NSCAP_ASSERT_NO_QUERY_NEEDED|
+  }
 
-      void
-      swap( T*& rhs )
-          // ...exchange ownership with |rhs|; can save a pair of refcount operations
-        {
+  void swap(T*& aRhs)
+  // ...exchange ownership with |aRhs|; can save a pair of refcount operations
+  {
 #ifdef NSCAP_FEATURE_USE_BASE
-          nsISupports* temp = rhs;
+    nsISupports* temp = aRhs;
 #else
-          T* temp = rhs;
+    T* temp = aRhs;
 #endif
-          NSCAP_LOG_ASSIGNMENT(this, temp);
-          NSCAP_LOG_RELEASE(this, mRawPtr);
-          rhs = reinterpret_cast<T*>(mRawPtr);
-          mRawPtr = temp;
-          NSCAP_ASSERT_NO_QUERY_NEEDED();
-        }
+    NSCAP_LOG_ASSIGNMENT(this, temp);
+    NSCAP_LOG_RELEASE(this, mRawPtr);
+    aRhs = reinterpret_cast<T*>(mRawPtr);
+    mRawPtr = temp;
+    NSCAP_ASSERT_NO_QUERY_NEEDED();
+  }
 
 
-        // Other pointer operators
+  // Other pointer operators
 
-      already_AddRefed<T>
-      forget()
-          // return the value of mRawPtr and null out mRawPtr. Useful for
-          // already_AddRefed return values.
-        {
-          T* temp = 0;
-          swap(temp);
-          return already_AddRefed<T>(temp);
-        }
+  already_AddRefed<T> forget()
+  // return the value of mRawPtr and null out mRawPtr. Useful for
+  // already_AddRefed return values.
+  {
+    T* temp = 0;
+    swap(temp);
+    return already_AddRefed<T>(temp);
+  }
 
-      template <typename I>
-      void
-      forget( I** rhs )
-          // Set the target of rhs to the value of mRawPtr and null out mRawPtr.
-          // Useful to avoid unnecessary AddRef/Release pairs with "out"
-          // parameters where rhs bay be a T** or an I** where I is a base class
-          // of T.
-        {
-          NS_ASSERTION(rhs, "Null pointer passed to forget!");
-          NSCAP_LOG_RELEASE(this, mRawPtr);
-          *rhs = get();
-          mRawPtr = 0;
-        }
+  template<typename I>
+  void forget(I** aRhs)
+  // Set the target of aRhs to the value of mRawPtr and null out mRawPtr.
+  // Useful to avoid unnecessary AddRef/Release pairs with "out"
+  // parameters where aRhs bay be a T** or an I** where I is a base class
+  // of T.
+  {
+    NS_ASSERTION(aRhs, "Null pointer passed to forget!");
+    NSCAP_LOG_RELEASE(this, mRawPtr);
+    *aRhs = get();
+    mRawPtr = 0;
+  }
 
-      T*
-      get() const
-          /*
-            Prefer the implicit conversion provided automatically by |operator T*() const|.
-            Use |get()| to resolve ambiguity or to get a castable pointer.
-          */
-        {
-          return reinterpret_cast<T*>(mRawPtr);
-        }
+  /*
+    Prefer the implicit conversion provided automatically by |operator T*() const|.
+    Use |get()| to resolve ambiguity or to get a castable pointer.
+  */
+  T* get() const { return reinterpret_cast<T*>(mRawPtr); }
 
-      operator T*() const
-          /*
-            ...makes an |nsCOMPtr| act like its underlying raw pointer type whenever it
-            is used in a context where a raw pointer is expected.  It is this operator
-            that makes an |nsCOMPtr| substitutable for a raw pointer.
+  /*
+    Makes an |nsCOMPtr| act like its underlying raw pointer type whenever it
+    is used in a context where a raw pointer is expected.  It is this operator
+    that makes an |nsCOMPtr| substitutable for a raw pointer.
 
-            Prefer the implicit use of this operator to calling |get()|, except where
-            necessary to resolve ambiguity.
-          */
-        {
-          return get();
-        }
+    Prefer the implicit use of this operator to calling |get()|, except where
+    necessary to resolve ambiguity.
+  */
+  operator T*() const { return get(); }
 
-      T*
-      operator->() const
-        {
-          NS_ABORT_IF_FALSE(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator->().");
-          return get();
-        }
+  T* operator->() const
+  {
+    NS_ABORT_IF_FALSE(mRawPtr != 0,
+                      "You can't dereference a NULL nsCOMPtr with operator->().");
+    return get();
+  }
 
-      nsCOMPtr<T>*
-      get_address()
-          // This is not intended to be used by clients.  See |address_of|
-          // below.
-        {
-          return this;
-        }
+  // These are not intended to be used by clients. See |address_of| below.
+  nsCOMPtr<T>* get_address() { return this; }
+  const nsCOMPtr<T>* get_address() const { return this; }
 
-      const nsCOMPtr<T>*
-      get_address() const
-          // This is not intended to be used by clients.  See |address_of|
-          // below.
-        {
-          return this;
-        }
+public:
+  T& operator*() const
+  {
+    NS_ABORT_IF_FALSE(mRawPtr != 0,
+                      "You can't dereference a NULL nsCOMPtr with operator*().");
+    return *get();
+  }
 
-    public:
-      T&
-      operator*() const
-        {
-          NS_ABORT_IF_FALSE(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator*().");
-          return *get();
-        }
-
-      T**
-      StartAssignment()
-        {
+  T** StartAssignment()
+  {
 #ifndef NSCAP_FEATURE_INLINE_STARTASSIGNMENT
-          return reinterpret_cast<T**>(begin_assignment());
+    return reinterpret_cast<T**>(begin_assignment());
 #else
-          assign_assuming_AddRef(0);
-          return reinterpret_cast<T**>(&mRawPtr);
+    assign_assuming_AddRef(0);
+    return reinterpret_cast<T**>(&mRawPtr);
 #endif
-        }
-  };
+  }
+};
 
 
 
-  /*
-    Specializing |nsCOMPtr| for |nsISupports| allows us to use |nsCOMPtr<nsISupports>| the
-    same way people use |nsISupports*| and |void*|, i.e., as a `catch-all' pointer pointing
-    to any valid [XP]COM interface.  Otherwise, an |nsCOMPtr<nsISupports>| would only be able
-    to point to the single [XP]COM-correct |nsISupports| instance within an object; extra
-    querying ensues.  Clients need to be able to pass around arbitrary interface pointers,
-    without hassles, through intermediary code that doesn't know the exact type.
-  */
+/*
+  Specializing |nsCOMPtr| for |nsISupports| allows us to use |nsCOMPtr<nsISupports>| the
+  same way people use |nsISupports*| and |void*|, i.e., as a `catch-all' pointer pointing
+  to any valid [XP]COM interface.  Otherwise, an |nsCOMPtr<nsISupports>| would only be able
+  to point to the single [XP]COM-correct |nsISupports| instance within an object; extra
+  querying ensues.  Clients need to be able to pass around arbitrary interface pointers,
+  without hassles, through intermediary code that doesn't know the exact type.
+*/
 
-template <>
+template<>
 class nsCOMPtr<nsISupports>
-    : private nsCOMPtr_base
-  {
-    public:
-      typedef nsISupports element_type;
+  : private nsCOMPtr_base
+{
+public:
+  typedef nsISupports element_type;
 
-        // Constructors
+  // Constructors
 
-      nsCOMPtr()
-            : nsCOMPtr_base(0)
-          // default constructor
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-        }
+  nsCOMPtr()
+    : nsCOMPtr_base(0)
+    // default constructor
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+  }
 
-      nsCOMPtr( const nsCOMPtr<nsISupports>& aSmartPtr )
-            : nsCOMPtr_base(aSmartPtr.mRawPtr)
-          // copy constructor
-        {
-          if ( mRawPtr )
-            NSCAP_ADDREF(this, mRawPtr);
-          NSCAP_LOG_ASSIGNMENT(this, aSmartPtr.mRawPtr);
-        }
+  nsCOMPtr(const nsCOMPtr<nsISupports>& aSmartPtr)
+    : nsCOMPtr_base(aSmartPtr.mRawPtr)
+    // copy constructor
+  {
+    if (mRawPtr) {
+      NSCAP_ADDREF(this, mRawPtr);
+    }
+    NSCAP_LOG_ASSIGNMENT(this, aSmartPtr.mRawPtr);
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( nsISupports* aRawPtr )
-            : nsCOMPtr_base(aRawPtr)
-          // construct from a raw pointer (of the right type)
-        {
-          if ( mRawPtr )
-            NSCAP_ADDREF(this, mRawPtr);
-          NSCAP_LOG_ASSIGNMENT(this, aRawPtr);
-        }
+  MOZ_IMPLICIT nsCOMPtr(nsISupports* aRawPtr)
+    : nsCOMPtr_base(aRawPtr)
+    // construct from a raw pointer (of the right type)
+  {
+    if (mRawPtr) {
+      NSCAP_ADDREF(this, mRawPtr);
+    }
+    NSCAP_LOG_ASSIGNMENT(this, aRawPtr);
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( already_AddRefed<nsISupports>& aSmartPtr )
-            : nsCOMPtr_base(aSmartPtr.take())
-          // construct from |already_AddRefed|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, mRawPtr);
-        }
-
-      MOZ_IMPLICIT nsCOMPtr( already_AddRefed<nsISupports>&& aSmartPtr )
-            : nsCOMPtr_base(aSmartPtr.take())
-          // construct from |otherComPtr.forget()|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, mRawPtr);
-        }
+  MOZ_IMPLICIT nsCOMPtr(already_AddRefed<nsISupports>& aSmartPtr)
+    : nsCOMPtr_base(aSmartPtr.take())
+    // construct from |already_AddRefed|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, mRawPtr);
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( const nsQueryInterface qi )
-            : nsCOMPtr_base(0)
-          // assign from |do_QueryInterface(expr)|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-          assign_from_qi(qi, NS_GET_IID(nsISupports));
-        }
+  MOZ_IMPLICIT nsCOMPtr(already_AddRefed<nsISupports>&& aSmartPtr)
+    : nsCOMPtr_base(aSmartPtr.take())
+    // construct from |otherComPtr.forget()|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, mRawPtr);
+  }
+
+  MOZ_IMPLICIT nsCOMPtr(const nsQueryInterface aQI)
+    : nsCOMPtr_base(0)
+    // assign from |do_QueryInterface(expr)|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+    assign_from_qi(aQI, NS_GET_IID(nsISupports));
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( const nsQueryInterfaceWithError& qi )
-            : nsCOMPtr_base(0)
-          // assign from |do_QueryInterface(expr, &rv)|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-          assign_from_qi_with_error(qi, NS_GET_IID(nsISupports));
-        }
+  MOZ_IMPLICIT nsCOMPtr(const nsQueryInterfaceWithError& aQI)
+    : nsCOMPtr_base(0)
+    // assign from |do_QueryInterface(expr, &rv)|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+    assign_from_qi_with_error(aQI, NS_GET_IID(nsISupports));
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( const nsGetServiceByCID gs )
-            : nsCOMPtr_base(0)
-          // assign from |do_GetService(cid_expr)|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-          assign_from_gs_cid(gs, NS_GET_IID(nsISupports));
-        }
+  MOZ_IMPLICIT nsCOMPtr(const nsGetServiceByCID aGS)
+    : nsCOMPtr_base(0)
+    // assign from |do_GetService(cid_expr)|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+    assign_from_gs_cid(aGS, NS_GET_IID(nsISupports));
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( const nsGetServiceByCIDWithError& gs )
-            : nsCOMPtr_base(0)
-          // assign from |do_GetService(cid_expr, &rv)|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-          assign_from_gs_cid_with_error(gs, NS_GET_IID(nsISupports));
-        }
+  MOZ_IMPLICIT nsCOMPtr(const nsGetServiceByCIDWithError& aGS)
+    : nsCOMPtr_base(0)
+    // assign from |do_GetService(cid_expr, &rv)|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+    assign_from_gs_cid_with_error(aGS, NS_GET_IID(nsISupports));
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( const nsGetServiceByContractID gs )
-            : nsCOMPtr_base(0)
-          // assign from |do_GetService(contractid_expr)|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-          assign_from_gs_contractid(gs, NS_GET_IID(nsISupports));
-        }
+  MOZ_IMPLICIT nsCOMPtr(const nsGetServiceByContractID aGS)
+    : nsCOMPtr_base(0)
+    // assign from |do_GetService(contractid_expr)|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+    assign_from_gs_contractid(aGS, NS_GET_IID(nsISupports));
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( const nsGetServiceByContractIDWithError& gs )
-            : nsCOMPtr_base(0)
-          // assign from |do_GetService(contractid_expr, &rv)|
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-          assign_from_gs_contractid_with_error(gs, NS_GET_IID(nsISupports));
-        }
+  MOZ_IMPLICIT nsCOMPtr(const nsGetServiceByContractIDWithError& aGS)
+    : nsCOMPtr_base(0)
+    // assign from |do_GetService(contractid_expr, &rv)|
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+    assign_from_gs_contractid_with_error(aGS, NS_GET_IID(nsISupports));
+  }
 
-      MOZ_IMPLICIT nsCOMPtr( const nsCOMPtr_helper& helper )
-            : nsCOMPtr_base(0)
-          // ...and finally, anything else we might need to construct from
-          //  can exploit the |nsCOMPtr_helper| facility
-        {
-          NSCAP_LOG_ASSIGNMENT(this, 0);
-          assign_from_helper(helper, NS_GET_IID(nsISupports));
-        }
+  MOZ_IMPLICIT nsCOMPtr(const nsCOMPtr_helper& aHelper)
+    : nsCOMPtr_base(0)
+    // ...and finally, anything else we might need to construct from
+    //  can exploit the |nsCOMPtr_helper| facility
+  {
+    NSCAP_LOG_ASSIGNMENT(this, 0);
+    assign_from_helper(aHelper, NS_GET_IID(nsISupports));
+  }
 
 
-        // Assignment operators
+  // Assignment operators
 
-      nsCOMPtr<nsISupports>&
-      operator=( const nsCOMPtr<nsISupports>& rhs )
-          // copy assignment operator
-        {
-          assign_with_AddRef(rhs.mRawPtr);
-          return *this;
-        }
+  nsCOMPtr<nsISupports>& operator=(const nsCOMPtr<nsISupports>& aRhs)
+  // copy assignment operator
+  {
+    assign_with_AddRef(aRhs.mRawPtr);
+    return *this;
+  }
 
-      nsCOMPtr<nsISupports>&
-      operator=( nsISupports* rhs )
-          // assign from a raw pointer (of the right type)
-        {
-          assign_with_AddRef(rhs);
-          return *this;
-        }
+  nsCOMPtr<nsISupports>& operator=(nsISupports* aRhs)
+  // assign from a raw pointer (of the right type)
+  {
+    assign_with_AddRef(aRhs);
+    return *this;
+  }
 
-      nsCOMPtr<nsISupports>&
-      operator=( already_AddRefed<nsISupports>& rhs )
-          // assign from |already_AddRefed|
-        {
-          assign_assuming_AddRef(rhs.take());
-          return *this;
-        }
-
-      nsCOMPtr<nsISupports>&
-      operator=( already_AddRefed<nsISupports>&& rhs )
-          // assign from |otherComPtr.forget()|
-        {
-          assign_assuming_AddRef(rhs.take());
-          return *this;
-        }
+  nsCOMPtr<nsISupports>& operator=(already_AddRefed<nsISupports>& aRhs)
+  // assign from |already_AddRefed|
+  {
+    assign_assuming_AddRef(aRhs.take());
+    return *this;
+  }
 
-      nsCOMPtr<nsISupports>&
-      operator=( const nsQueryInterface rhs )
-          // assign from |do_QueryInterface(expr)|
-        {
-          assign_from_qi(rhs, NS_GET_IID(nsISupports));
-          return *this;
-        }
+  nsCOMPtr<nsISupports>& operator=(already_AddRefed<nsISupports> && aRhs)
+  // assign from |otherComPtr.forget()|
+  {
+    assign_assuming_AddRef(aRhs.take());
+    return *this;
+  }
 
-      nsCOMPtr<nsISupports>&
-      operator=( const nsQueryInterfaceWithError& rhs )
-          // assign from |do_QueryInterface(expr, &rv)|
-        {
-          assign_from_qi_with_error(rhs, NS_GET_IID(nsISupports));
-          return *this;
-        }
+  nsCOMPtr<nsISupports>& operator=(const nsQueryInterface aRhs)
+  // assign from |do_QueryInterface(expr)|
+  {
+    assign_from_qi(aRhs, NS_GET_IID(nsISupports));
+    return *this;
+  }
 
-      nsCOMPtr<nsISupports>&
-      operator=( const nsGetServiceByCID rhs )
-          // assign from |do_GetService(cid_expr)|
-        {
-          assign_from_gs_cid(rhs, NS_GET_IID(nsISupports));
-          return *this;
-        }
+  nsCOMPtr<nsISupports>& operator=(const nsQueryInterfaceWithError& aRhs)
+  // assign from |do_QueryInterface(expr, &rv)|
+  {
+    assign_from_qi_with_error(aRhs, NS_GET_IID(nsISupports));
+    return *this;
+  }
 
-      nsCOMPtr<nsISupports>&
-      operator=( const nsGetServiceByCIDWithError& rhs )
-          // assign from |do_GetService(cid_expr, &rv)|
-        {
-          assign_from_gs_cid_with_error(rhs, NS_GET_IID(nsISupports));
-          return *this;
-        }
+  nsCOMPtr<nsISupports>& operator=(const nsGetServiceByCID aRhs)
+  // assign from |do_GetService(cid_expr)|
+  {
+    assign_from_gs_cid(aRhs, NS_GET_IID(nsISupports));
+    return *this;
+  }
 
-      nsCOMPtr<nsISupports>&
-      operator=( const nsGetServiceByContractID rhs )
-          // assign from |do_GetService(contractid_expr)|
-        {
-          assign_from_gs_contractid(rhs, NS_GET_IID(nsISupports));
-          return *this;
-        }
+  nsCOMPtr<nsISupports>& operator=(const nsGetServiceByCIDWithError& aRhs)
+  // assign from |do_GetService(cid_expr, &rv)|
+  {
+    assign_from_gs_cid_with_error(aRhs, NS_GET_IID(nsISupports));
+    return *this;
+  }
 
-      nsCOMPtr<nsISupports>&
-      operator=( const nsGetServiceByContractIDWithError& rhs )
-          // assign from |do_GetService(contractid_expr, &rv)|
-        {
-          assign_from_gs_contractid_with_error(rhs, NS_GET_IID(nsISupports));
-          return *this;
-        }
+  nsCOMPtr<nsISupports>& operator=(const nsGetServiceByContractID aRhs)
+  // assign from |do_GetService(contractid_expr)|
+  {
+    assign_from_gs_contractid(aRhs, NS_GET_IID(nsISupports));
+    return *this;
+  }
 
-      nsCOMPtr<nsISupports>&
-      operator=( const nsCOMPtr_helper& rhs )
-          // ...and finally, anything else we might need to assign from
-          //  can exploit the |nsCOMPtr_helper| facility.
-        {
-          assign_from_helper(rhs, NS_GET_IID(nsISupports));
-          return *this;
-        }
+  nsCOMPtr<nsISupports>& operator=(const nsGetServiceByContractIDWithError& aRhs)
+  // assign from |do_GetService(contractid_expr, &rv)|
+  {
+    assign_from_gs_contractid_with_error(aRhs, NS_GET_IID(nsISupports));
+    return *this;
+  }
 
-      void
-      swap( nsCOMPtr<nsISupports>& rhs )
-          // ...exchange ownership with |rhs|; can save a pair of refcount operations
-        {
-          nsISupports* temp = rhs.mRawPtr;
-          NSCAP_LOG_ASSIGNMENT(&rhs, mRawPtr);
-          NSCAP_LOG_ASSIGNMENT(this, temp);
-          NSCAP_LOG_RELEASE(this, mRawPtr);
-          NSCAP_LOG_RELEASE(&rhs, temp);
-          rhs.mRawPtr = mRawPtr;
-          mRawPtr = temp;
-        }
+  nsCOMPtr<nsISupports>& operator=(const nsCOMPtr_helper& aRhs)
+  // ...and finally, anything else we might need to assign from
+  //  can exploit the |nsCOMPtr_helper| facility.
+  {
+    assign_from_helper(aRhs, NS_GET_IID(nsISupports));
+    return *this;
+  }
 
-      void
-      swap( nsISupports*& rhs )
-          // ...exchange ownership with |rhs|; can save a pair of refcount operations
-        {
-          nsISupports* temp = rhs;
-          NSCAP_LOG_ASSIGNMENT(this, temp);
-          NSCAP_LOG_RELEASE(this, mRawPtr);
-          rhs = mRawPtr;
-          mRawPtr = temp;
-        }
-
-      already_AddRefed<nsISupports>
-      forget()
-          // return the value of mRawPtr and null out mRawPtr. Useful for
-          // already_AddRefed return values.
-        {
-          nsISupports* temp = 0;
-          swap(temp);
-          return already_AddRefed<nsISupports>(temp);
-        }
+  void swap(nsCOMPtr<nsISupports>& aRhs)
+  // ...exchange ownership with |aRhs|; can save a pair of refcount operations
+  {
+    nsISupports* temp = aRhs.mRawPtr;
+    NSCAP_LOG_ASSIGNMENT(&aRhs, mRawPtr);
+    NSCAP_LOG_ASSIGNMENT(this, temp);
+    NSCAP_LOG_RELEASE(this, mRawPtr);
+    NSCAP_LOG_RELEASE(&aRhs, temp);
+    aRhs.mRawPtr = mRawPtr;
+    mRawPtr = temp;
+  }
 
-      void
-      forget( nsISupports** rhs )
-          // Set the target of rhs to the value of mRawPtr and null out mRawPtr.
-          // Useful to avoid unnecessary AddRef/Release pairs with "out"
-          // parameters.
-        {
-          NS_ASSERTION(rhs, "Null pointer passed to forget!");
-          *rhs = 0;
-          swap(*rhs);
-        }
-
-        // Other pointer operators
+  void swap(nsISupports*& aRhs)
+  // ...exchange ownership with |aRhs|; can save a pair of refcount operations
+  {
+    nsISupports* temp = aRhs;
+    NSCAP_LOG_ASSIGNMENT(this, temp);
+    NSCAP_LOG_RELEASE(this, mRawPtr);
+    aRhs = mRawPtr;
+    mRawPtr = temp;
+  }
 
-      nsISupports*
-      get() const
-          /*
-            Prefer the implicit conversion provided automatically by
-            |operator nsISupports*() const|.
-            Use |get()| to resolve ambiguity or to get a castable pointer.
-          */
-        {
-          return reinterpret_cast<nsISupports*>(mRawPtr);
-        }
+  already_AddRefed<nsISupports> forget()
+  // return the value of mRawPtr and null out mRawPtr. Useful for
+  // already_AddRefed return values.
+  {
+    nsISupports* temp = 0;
+    swap(temp);
+    return already_AddRefed<nsISupports>(temp);
+  }
 
-      operator nsISupports*() const
-          /*
-            ...makes an |nsCOMPtr| act like its underlying raw pointer type whenever it
-            is used in a context where a raw pointer is expected.  It is this operator
-            that makes an |nsCOMPtr| substitutable for a raw pointer.
+  void forget(nsISupports** aRhs)
+  // Set the target of aRhs to the value of mRawPtr and null out mRawPtr.
+  // Useful to avoid unnecessary AddRef/Release pairs with "out"
+  // parameters.
+  {
+    NS_ASSERTION(aRhs, "Null pointer passed to forget!");
+    *aRhs = 0;
+    swap(*aRhs);
+  }
+
+  // Other pointer operators
 
-            Prefer the implicit use of this operator to calling |get()|, except where
-            necessary to resolve ambiguity.
-          */
-        {
-          return get();
-        }
+  /*
+    Prefer the implicit conversion provided automatically by
+    |operator nsISupports*() const|.
+    Use |get()| to resolve ambiguity or to get a castable pointer.
+  */
+  nsISupports* get() const { return reinterpret_cast<nsISupports*>(mRawPtr); }
+
+  /*
+    Makes an |nsCOMPtr| act like its underlying raw pointer type whenever it
+    is used in a context where a raw pointer is expected.  It is this operator
+    that makes an |nsCOMPtr| substitutable for a raw pointer.
 
-      nsISupports*
-      operator->() const
-        {
-          NS_ABORT_IF_FALSE(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator->().");
-          return get();
-        }
+    Prefer the implicit use of this operator to calling |get()|, except where
+    necessary to resolve ambiguity.
+  */
+  operator nsISupports*() const { return get(); }
 
-      nsCOMPtr<nsISupports>*
-      get_address()
-          // This is not intended to be used by clients.  See |address_of|
-          // below.
-        {
-          return this;
-        }
+  nsISupports* operator->() const
+  {
+    NS_ABORT_IF_FALSE(mRawPtr != 0,
+                      "You can't dereference a NULL nsCOMPtr with operator->().");
+    return get();
+  }
 
-      const nsCOMPtr<nsISupports>*
-      get_address() const
-          // This is not intended to be used by clients.  See |address_of|
-          // below.
-        {
-          return this;
-        }
+  // These are not intended to be used by clients. See |address_of| below.
+  nsCOMPtr<nsISupports>* get_address() { return this; }
+  const nsCOMPtr<nsISupports>* get_address() const { return this; }
+
+public:
 
-    public:
+  nsISupports& operator*() const
+  {
+    NS_ABORT_IF_FALSE(mRawPtr != 0,
+                      "You can't dereference a NULL nsCOMPtr with operator*().");
+    return *get();
+  }
 
-      nsISupports&
-      operator*() const
-        {
-          NS_ABORT_IF_FALSE(mRawPtr != 0, "You can't dereference a NULL nsCOMPtr with operator*().");
-          return *get();
-        }
+  nsISupports** StartAssignment()
+  {
+#ifndef NSCAP_FEATURE_INLINE_STARTASSIGNMENT
+    return reinterpret_cast<nsISupports**>(begin_assignment());
+#else
+    assign_assuming_AddRef(0);
+    return reinterpret_cast<nsISupports**>(&mRawPtr);
+#endif
+  }
+};
 
-      nsISupports**
-      StartAssignment()
-        {
-#ifndef NSCAP_FEATURE_INLINE_STARTASSIGNMENT
-          return reinterpret_cast<nsISupports**>(begin_assignment());
-#else
-          assign_assuming_AddRef(0);
-          return reinterpret_cast<nsISupports**>(&mRawPtr);
-#endif
-        }
-  };
-
-template <typename T>
+template<typename T>
 inline void
 ImplCycleCollectionUnlink(nsCOMPtr<T>& aField)
 {
   aField = nullptr;
 }
 
-template <typename T>
+template<typename T>
 inline void
 ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback,
                             nsCOMPtr<T>& aField,
                             const char* aName,
                             uint32_t aFlags = 0)
 {
   CycleCollectionNoteChild(aCallback, aField.get(), aName, aFlags);
 }
 
 #ifndef NSCAP_FEATURE_USE_BASE
-template <class T>
+template<class T>
+void
+nsCOMPtr<T>::assign_with_AddRef(nsISupports* aRawPtr)
+{
+  if (aRawPtr) {
+    NSCAP_ADDREF(this, aRawPtr);
+  }
+  assign_assuming_AddRef(reinterpret_cast<T*>(aRawPtr));
+}
+
+template<class T>
+void
+nsCOMPtr<T>::assign_from_qi(const nsQueryInterface aQI, const nsIID& aIID)
+{
+  void* newRawPtr;
+  if (NS_FAILED(aQI(aIID, &newRawPtr))) {
+    newRawPtr = 0;
+  }
+  assign_assuming_AddRef(static_cast<T*>(newRawPtr));
+}
+
+template<class T>
 void
-nsCOMPtr<T>::assign_with_AddRef( nsISupports* rawPtr )
-  {
-    if ( rawPtr )
-      NSCAP_ADDREF(this, rawPtr);
-    assign_assuming_AddRef(reinterpret_cast<T*>(rawPtr));
+nsCOMPtr<T>::assign_from_qi_with_error(const nsQueryInterfaceWithError& aQI,
+                                       const nsIID& aIID)
+{
+  void* newRawPtr;
+  if (NS_FAILED(aQI(aIID, &newRawPtr))) {
+    newRawPtr = 0;
   }
+  assign_assuming_AddRef(static_cast<T*>(newRawPtr));
+}
 
-template <class T>
+template<class T>
+void
+nsCOMPtr<T>::assign_from_gs_cid(const nsGetServiceByCID aGS, const nsIID& aIID)
+{
+  void* newRawPtr;
+  if (NS_FAILED(aGS(aIID, &newRawPtr))) {
+    newRawPtr = 0;
+  }
+  assign_assuming_AddRef(static_cast<T*>(newRawPtr));
+}
+
+template<class T>
 void
-nsCOMPtr<T>::assign_from_qi( const nsQueryInterface qi, const nsIID& aIID )
-  {
-    void* newRawPtr;
-    if ( NS_FAILED( qi(aIID, &newRawPtr) ) )
-      newRawPtr = 0;
-    assign_assuming_AddRef(static_cast<T*>(newRawPtr));
+nsCOMPtr<T>::assign_from_gs_cid_with_error(const nsGetServiceByCIDWithError& aGS,
+                                           const nsIID& aIID)
+{
+  void* newRawPtr;
+  if (NS_FAILED(aGS(aIID, &newRawPtr))) {
+    newRawPtr = 0;
   }
+  assign_assuming_AddRef(static_cast<T*>(newRawPtr));
+}
 
-template <class T>
+template<class T>
+void
+nsCOMPtr<T>::assign_from_gs_contractid(const nsGetServiceByContractID aGS,
+                                       const nsIID& aIID)
+{
+  void* newRawPtr;
+  if (NS_FAILED(aGS(aIID, &newRawPtr))) {
+    newRawPtr = 0;
+  }
+  assign_assuming_AddRef(static_cast<T*>(newRawPtr));
+}
+
+template<class T>
 void
-nsCOMPtr<T>::assign_from_qi_with_error( const nsQueryInterfaceWithError& qi, const nsIID& aIID )
-  {
-    void* newRawPtr;
-    if ( NS_FAILED( qi(aIID, &newRawPtr) ) )
-      newRawPtr = 0;
-    assign_assuming_AddRef(static_cast<T*>(newRawPtr));
+nsCOMPtr<T>::assign_from_gs_contractid_with_error(
+    const nsGetServiceByContractIDWithError& aGS, const nsIID& aIID)
+{
+  void* newRawPtr;
+  if (NS_FAILED(aGS(aIID, &newRawPtr))) {
+    newRawPtr = 0;
   }
+  assign_assuming_AddRef(static_cast<T*>(newRawPtr));
+}
 
-template <class T>
+template<class T>
 void
-nsCOMPtr<T>::assign_from_gs_cid( const nsGetServiceByCID gs, const nsIID& aIID )
+nsCOMPtr<T>::assign_from_helper(const nsCOMPtr_helper& helper, const nsIID& aIID)
+{
+  void* newRawPtr;
+  if (NS_FAILED(helper(aIID, &newRawPtr))) {
+    newRawPtr = 0;
+  }
+  assign_assuming_AddRef(static_cast<T*>(newRawPtr));
+}
+
+template<class T>
+void**
+nsCOMPtr<T>::begin_assignment()
+{
+  assign_assuming_AddRef(0);
+  union
   {
-    void* newRawPtr;
-    if ( NS_FAILED( gs(aIID, &newRawPtr) ) )
-      newRawPtr = 0;
-    assign_assuming_AddRef(static_cast<T*>(newRawPtr));
-  }
+    T** mT;
+    void** mVoid;
+  } result;
+  result.mT = &mRawPtr;
+  return result.mVoid;
+}
+#endif
 
-template <class T>
-void
-nsCOMPtr<T>::assign_from_gs_cid_with_error( const nsGetServiceByCIDWithError& gs, const nsIID& aIID )
-  {
-    void* newRawPtr;
-    if ( NS_FAILED( gs(aIID, &newRawPtr) ) )
-      newRawPtr = 0;
-    assign_assuming_AddRef(static_cast<T*>(newRawPtr));
-  }
+template<class T>
+inline nsCOMPtr<T>*
+address_of(nsCOMPtr<T>& aPtr)
+{
+  return aPtr.get_address();
+}
+
+template<class T>
+inline const nsCOMPtr<T>*
+address_of(const nsCOMPtr<T>& aPtr)
+{
+  return aPtr.get_address();
+}
 
-template <class T>
-void
-nsCOMPtr<T>::assign_from_gs_contractid( const nsGetServiceByContractID gs, const nsIID& aIID )
+template<class T>
+class nsGetterAddRefs
+/*
+  ...
+
+  This class is designed to be used for anonymous temporary objects in the
+  argument list of calls that return COM interface pointers, e.g.,
+
+    nsCOMPtr<IFoo> fooP;
+    ...->QueryInterface(iid, getter_AddRefs(fooP))
+
+  DO NOT USE THIS TYPE DIRECTLY IN YOUR CODE.  Use |getter_AddRefs()| instead.
+
+  When initialized with a |nsCOMPtr|, as in the example above, it returns
+  a |void**|, a |T**|, or an |nsISupports**| as needed, that the outer call (|QueryInterface| in this
+  case) can fill in.
+
+  This type should be a nested class inside |nsCOMPtr<T>|.
+*/
+{
+public:
+  explicit nsGetterAddRefs(nsCOMPtr<T>& aSmartPtr)
+    : mTargetSmartPtr(aSmartPtr)
   {
-    void* newRawPtr;
-    if ( NS_FAILED( gs(aIID, &newRawPtr) ) )
-      newRawPtr = 0;
-    assign_assuming_AddRef(static_cast<T*>(newRawPtr));
-  }
-
-template <class T>
-void
-nsCOMPtr<T>::assign_from_gs_contractid_with_error( const nsGetServiceByContractIDWithError& gs, const nsIID& aIID )
-  {
-    void* newRawPtr;
-    if ( NS_FAILED( gs(aIID, &newRawPtr) ) )
-      newRawPtr = 0;
-    assign_assuming_AddRef(static_cast<T*>(newRawPtr));
   }
 
-template <class T>
-void
-nsCOMPtr<T>::assign_from_helper( const nsCOMPtr_helper& helper, const nsIID& aIID )
-  {
-    void* newRawPtr;
-    if ( NS_FAILED( helper(aIID, &newRawPtr) ) )
-      newRawPtr = 0;
-    assign_assuming_AddRef(static_cast<T*>(newRawPtr));
-  }
-
-template <class T>
-void**
-nsCOMPtr<T>::begin_assignment()
-  {
-    assign_assuming_AddRef(0);
-    union { T** mT; void** mVoid; } result;
-    result.mT = &mRawPtr;
-    return result.mVoid;
-  }
-#endif
-
-template <class T>
-inline
-nsCOMPtr<T>*
-address_of( nsCOMPtr<T>& aPtr )
-  {
-    return aPtr.get_address();
-  }
-
-template <class T>
-inline
-const nsCOMPtr<T>*
-address_of( const nsCOMPtr<T>& aPtr )
+#if defined(NSCAP_FEATURE_TEST_DONTQUERY_CASES) || defined(NSCAP_LOG_EXTERNAL_ASSIGNMENT)
+  ~nsGetterAddRefs()
   {
-    return aPtr.get_address();
-  }
-
-template <class T>
-class nsGetterAddRefs
-    /*
-      ...
-
-      This class is designed to be used for anonymous temporary objects in the
-      argument list of calls that return COM interface pointers, e.g.,
-
-        nsCOMPtr<IFoo> fooP;
-        ...->QueryInterface(iid, getter_AddRefs(fooP))
-
-      DO NOT USE THIS TYPE DIRECTLY IN YOUR CODE.  Use |getter_AddRefs()| instead.
-
-      When initialized with a |nsCOMPtr|, as in the example above, it returns
-      a |void**|, a |T**|, or an |nsISupports**| as needed, that the outer call (|QueryInterface| in this
-      case) can fill in.
-
-      This type should be a nested class inside |nsCOMPtr<T>|.
-    */
-  {
-    public:
-      explicit
-      nsGetterAddRefs( nsCOMPtr<T>& aSmartPtr )
-          : mTargetSmartPtr(aSmartPtr)
-        {
-          // nothing else to do
-        }
-
-#if defined(NSCAP_FEATURE_TEST_DONTQUERY_CASES) || defined(NSCAP_LOG_EXTERNAL_ASSIGNMENT)
-     ~nsGetterAddRefs()
-        {
 #ifdef NSCAP_LOG_EXTERNAL_ASSIGNMENT
-          NSCAP_LOG_ASSIGNMENT(reinterpret_cast<void *>(address_of(mTargetSmartPtr)), mTargetSmartPtr.get());
+    NSCAP_LOG_ASSIGNMENT(reinterpret_cast<void*>(address_of(mTargetSmartPtr)),
+                         mTargetSmartPtr.get());
 #endif
 
 #ifdef NSCAP_FEATURE_TEST_DONTQUERY_CASES
-          mTargetSmartPtr.Assert_NoQueryNeeded();
+    mTargetSmartPtr.Assert_NoQueryNeeded();
 #endif
-        }
+  }
 #endif
 
-      operator void**()
-        {
-          return reinterpret_cast<void**>(mTargetSmartPtr.StartAssignment());
-        }
-      operator T**()
-        {
-          return mTargetSmartPtr.StartAssignment();
-        }
+  operator void**()
+  {
+    return reinterpret_cast<void**>(mTargetSmartPtr.StartAssignment());
+  }
 
-      T*&
-      operator*()
-        {
-          return *(mTargetSmartPtr.StartAssignment());
-        }
+  operator T**() { return mTargetSmartPtr.StartAssignment(); }
+  T*& operator*() { return *(mTargetSmartPtr.StartAssignment()); }
 
-    private:
-      nsCOMPtr<T>& mTargetSmartPtr;
-  };
+private:
+  nsCOMPtr<T>& mTargetSmartPtr;
+};
 
 
-template <>
+template<>
 class nsGetterAddRefs<nsISupports>
+{
+public:
+  explicit nsGetterAddRefs(nsCOMPtr<nsISupports>& aSmartPtr)
+    : mTargetSmartPtr(aSmartPtr)
   {
-    public:
-      explicit
-      nsGetterAddRefs( nsCOMPtr<nsISupports>& aSmartPtr )
-          : mTargetSmartPtr(aSmartPtr)
-        {
-          // nothing else to do
-        }
+  }
 
 #ifdef NSCAP_LOG_EXTERNAL_ASSIGNMENT
-     ~nsGetterAddRefs()
-        {
-          NSCAP_LOG_ASSIGNMENT(reinterpret_cast<void *>(address_of(mTargetSmartPtr)), mTargetSmartPtr.get());
-        }
+  ~nsGetterAddRefs()
+  {
+    NSCAP_LOG_ASSIGNMENT(reinterpret_cast<void*>(address_of(mTargetSmartPtr)),
+                         mTargetSmartPtr.get());
+  }
 #endif
 
-      operator void**()
-        {
-          return reinterpret_cast<void**>(mTargetSmartPtr.StartAssignment());
-        }
-
-      operator nsISupports**()
-        {
-          return mTargetSmartPtr.StartAssignment();
-        }
+  operator void**()
+  {
+    return reinterpret_cast<void**>(mTargetSmartPtr.StartAssignment());
+  }
 
-      nsISupports*&
-      operator*()
-        {
-          return *(mTargetSmartPtr.StartAssignment());
-        }
+  operator nsISupports**() { return mTargetSmartPtr.StartAssignment(); }
+  nsISupports*& operator*() { return *(mTargetSmartPtr.StartAssignment()); }
 
-    private:
-      nsCOMPtr<nsISupports>& mTargetSmartPtr;
-  };
+private:
+  nsCOMPtr<nsISupports>& mTargetSmartPtr;
+};
 
 
-template <class T>
-inline
-nsGetterAddRefs<T>
-getter_AddRefs( nsCOMPtr<T>& aSmartPtr )
-    /*
-      Used around a |nsCOMPtr| when 
-      ...makes the class |nsGetterAddRefs<T>| invisible.
-    */
-  {
-    return nsGetterAddRefs<T>(aSmartPtr);
-  }
+template<class T>
+inline nsGetterAddRefs<T>
+getter_AddRefs(nsCOMPtr<T>& aSmartPtr)
+/*
+  Used around a |nsCOMPtr| when
+  ...makes the class |nsGetterAddRefs<T>| invisible.
+*/
+{
+  return nsGetterAddRefs<T>(aSmartPtr);
+}
 
-template <class T, class DestinationType>
-inline
-nsresult
-CallQueryInterface( T* aSource, nsGetterAddRefs<DestinationType> aDestination )
+template<class T, class DestinationType>
+inline nsresult
+CallQueryInterface(T* aSource, nsGetterAddRefs<DestinationType> aDestination)
 {
-    return CallQueryInterface(aSource,
-                              static_cast<DestinationType**>(aDestination));
+  return CallQueryInterface(aSource,
+                            static_cast<DestinationType**>(aDestination));
+}
+
+
+// Comparing two |nsCOMPtr|s
+
+template<class T, class U>
+inline bool
+operator==(const nsCOMPtr<T>& aLhs, const nsCOMPtr<U>& aRhs)
+{
+  return static_cast<const T*>(aLhs.get()) == static_cast<const U*>(aRhs.get());
+}
+
+
+template<class T, class U>
+inline bool
+operator!=(const nsCOMPtr<T>& aLhs, const nsCOMPtr<U>& aRhs)
+{
+  return static_cast<const T*>(aLhs.get()) != static_cast<const U*>(aRhs.get());
 }
 
 
-  // Comparing two |nsCOMPtr|s
+// Comparing an |nsCOMPtr| to a raw pointer
 
-template <class T, class U>
-inline
-bool
-operator==( const nsCOMPtr<T>& lhs, const nsCOMPtr<U>& rhs )
-  {
-    return static_cast<const T*>(lhs.get()) == static_cast<const U*>(rhs.get());
-  }
-
-
-template <class T, class U>
-inline
-bool
-operator!=( const nsCOMPtr<T>& lhs, const nsCOMPtr<U>& rhs )
-  {
-    return static_cast<const T*>(lhs.get()) != static_cast<const U*>(rhs.get());
-  }
+template<class T, class U>
+inline bool
+operator==(const nsCOMPtr<T>& aLhs, const U* aRhs)
+{
+  return static_cast<const T*>(aLhs.get()) == aRhs;
+}
 
-
-  // Comparing an |nsCOMPtr| to a raw pointer
+template<class T, class U>
+inline bool
+operator==(const U* aLhs, const nsCOMPtr<T>& aRhs)
+{
+  return aLhs == static_cast<const T*>(aRhs.get());
+}
 
-template <class T, class U>
-inline
-bool
-operator==( const nsCOMPtr<T>& lhs, const U* rhs )
-  {
-    return static_cast<const T*>(lhs.get()) == rhs;
-  }
-
-template <class T, class U>
-inline
-bool
-operator==( const U* lhs, const nsCOMPtr<T>& rhs )
-  {
-    return lhs == static_cast<const T*>(rhs.get());
-  }
+template<class T, class U>
+inline bool
+operator!=(const nsCOMPtr<T>& aLhs, const U* aRhs)
+{
+  return static_cast<const T*>(aLhs.get()) != aRhs;
+}
 
-template <class T, class U>
-inline
-bool
-operator!=( const nsCOMPtr<T>& lhs, const U* rhs )
-  {
-    return static_cast<const T*>(lhs.get()) != rhs;
-  }
+template<class T, class U>
+inline bool
+operator!=(const U* aLhs, const nsCOMPtr<T>& aRhs)
+{
+  return aLhs != static_cast<const T*>(aRhs.get());
+}
 
-template <class T, class U>
-inline
-bool
-operator!=( const U* lhs, const nsCOMPtr<T>& rhs )
-  {
-    return lhs != static_cast<const T*>(rhs.get());
-  }
-
-template <class T, class U>
-inline
-bool
-operator==( const nsCOMPtr<T>& lhs, U* rhs )
-  {
-    return static_cast<const T*>(lhs.get()) == const_cast<const U*>(rhs);
-  }
+template<class T, class U>
+inline bool
+operator==(const nsCOMPtr<T>& aLhs, U* aRhs)
+{
+  return static_cast<const T*>(aLhs.get()) == const_cast<const U*>(aRhs);
+}
 
-template <class T, class U>
-inline
-bool
-operator==( U* lhs, const nsCOMPtr<T>& rhs )
-  {
-    return const_cast<const U*>(lhs) == static_cast<const T*>(rhs.get());
-  }
+template<class T, class U>
+inline bool
+operator==(U* aLhs, const nsCOMPtr<T>& aRhs)
+{
+  return const_cast<const U*>(aLhs) == static_cast<const T*>(aRhs.get());
+}
 
-template <class T, class U>
-inline
-bool
-operator!=( const nsCOMPtr<T>& lhs, U* rhs )
-  {
-    return static_cast<const T*>(lhs.get()) != const_cast<const U*>(rhs);
-  }
+template<class T, class U>
+inline bool
+operator!=(const nsCOMPtr<T>& aLhs, U* aRhs)
+{
+  return static_cast<const T*>(aLhs.get()) != const_cast<const U*>(aRhs);
+}
 
-template <class T, class U>
-inline
-bool
-operator!=( U* lhs, const nsCOMPtr<T>& rhs )
-  {
-    return const_cast<const U*>(lhs) != static_cast<const T*>(rhs.get());
-  }
+template<class T, class U>
+inline bool
+operator!=(U* aLhs, const nsCOMPtr<T>& aRhs)
+{
+  return const_cast<const U*>(aLhs) != static_cast<const T*>(aRhs.get());
+}
 
 
 
-  // Comparing an |nsCOMPtr| to |0|
+// Comparing an |nsCOMPtr| to |0|
 
 class NSCAP_Zero;
 
-template <class T>
-inline
-bool
-operator==( const nsCOMPtr<T>& lhs, NSCAP_Zero* rhs )
-    // specifically to allow |smartPtr == 0|
-  {
-    return static_cast<const void*>(lhs.get()) == reinterpret_cast<const void*>(rhs);
-  }
+template<class T>
+inline bool
+operator==(const nsCOMPtr<T>& aLhs, NSCAP_Zero* aRhs)
+// specifically to allow |smartPtr == 0|
+{
+  return static_cast<const void*>(aLhs.get()) == reinterpret_cast<const void*>(aRhs);
+}
 
-template <class T>
-inline
-bool
-operator==( NSCAP_Zero* lhs, const nsCOMPtr<T>& rhs )
-    // specifically to allow |0 == smartPtr|
-  {
-    return reinterpret_cast<const void*>(lhs) == static_cast<const void*>(rhs.get());
-  }
+template<class T>
+inline bool
+operator==(NSCAP_Zero* aLhs, const nsCOMPtr<T>& aRhs)
+// specifically to allow |0 == smartPtr|
+{
+  return reinterpret_cast<const void*>(aLhs) == static_cast<const void*>(aRhs.get());
+}
 
-template <class T>
-inline
-bool
-operator!=( const nsCOMPtr<T>& lhs, NSCAP_Zero* rhs )
-    // specifically to allow |smartPtr != 0|
-  {
-    return static_cast<const void*>(lhs.get()) != reinterpret_cast<const void*>(rhs);
-  }
+template<class T>
+inline bool
+operator!=(const nsCOMPtr<T>& aLhs, NSCAP_Zero* aRhs)
+// specifically to allow |smartPtr != 0|
+{
+  return static_cast<const void*>(aLhs.get()) != reinterpret_cast<const void*>(aRhs);
+}
 
-template <class T>
-inline
-bool
-operator!=( NSCAP_Zero* lhs, const nsCOMPtr<T>& rhs )
-    // specifically to allow |0 != smartPtr|
-  {
-    return reinterpret_cast<const void*>(lhs) != static_cast<const void*>(rhs.get());
-  }
+template<class T>
+inline bool
+operator!=(NSCAP_Zero* aLhs, const nsCOMPtr<T>& aRhs)
+// specifically to allow |0 != smartPtr|
+{
+  return reinterpret_cast<const void*>(aLhs) != static_cast<const void*>(aRhs.get());
+}
 
 
 #ifdef HAVE_CPP_TROUBLE_COMPARING_TO_ZERO
 
-  // We need to explicitly define comparison operators for `int'
-  // because the compiler is lame.
+// We need to explicitly define comparison operators for `int'
+// because the compiler is lame.
 
-template <class T>
-inline
-bool
-operator==( const nsCOMPtr<T>& lhs, int rhs )
-    // specifically to allow |smartPtr == 0|
-  {
-    return static_cast<const void*>(lhs.get()) == reinterpret_cast<const void*>(rhs);
-  }
+template<class T>
+inline bool
+operator==(const nsCOMPtr<T>& lhs, int rhs)
+// specifically to allow |smartPtr == 0|
+{
+  return static_cast<const void*>(lhs.get()) == reinterpret_cast<const void*>(rhs);
+}
 
-template <class T>
-inline
-bool
-operator==( int lhs, const nsCOMPtr<T>& rhs )
-    // specifically to allow |0 == smartPtr|
-  {
-    return reinterpret_cast<const void*>(lhs) == static_cast<const void*>(rhs.get());
-  }
+template<class T>
+inline bool
+operator==(int lhs, const nsCOMPtr<T>& rhs)
+// specifically to allow |0 == smartPtr|
+{
+  return reinterpret_cast<const void*>(lhs) == static_cast<const void*>(rhs.get());
+}
 
 #endif // !defined(HAVE_CPP_TROUBLE_COMPARING_TO_ZERO)
 
-  // Comparing any two [XP]COM objects for identity
+// Comparing any two [XP]COM objects for identity
 
-inline
-bool
-SameCOMIdentity( nsISupports* lhs, nsISupports* rhs )
-  {
-    return nsCOMPtr<nsISupports>( do_QueryInterface(lhs) ) == nsCOMPtr<nsISupports>( do_QueryInterface(rhs) );
-  }
+inline bool
+SameCOMIdentity(nsISupports* aLhs, nsISupports* aRhs)
+{
+  return nsCOMPtr<nsISupports>(do_QueryInterface(aLhs)) ==
+    nsCOMPtr<nsISupports>(do_QueryInterface(aRhs));
+}
 
 
 
-template <class SourceType, class DestinationType>
-inline
-nsresult
-CallQueryInterface( nsCOMPtr<SourceType>& aSourcePtr, DestinationType** aDestPtr )
-  {
-    return CallQueryInterface(aSourcePtr.get(), aDestPtr);
-  }
+template<class SourceType, class DestinationType>
+inline nsresult
+CallQueryInterface(nsCOMPtr<SourceType>& aSourcePtr, DestinationType** aDestPtr)
+{
+  return CallQueryInterface(aSourcePtr.get(), aDestPtr);
+}
 
 #endif // !defined(nsCOMPtr_h___)
--- a/xpcom/glue/nsCRTGlue.cpp
+++ b/xpcom/glue/nsCRTGlue.cpp
@@ -17,110 +17,112 @@
 #include <windows.h>
 #endif
 
 #ifdef ANDROID
 #include <android/log.h>
 #endif
 
 const char*
-NS_strspnp(const char *delims, const char *str)
+NS_strspnp(const char* aDelims, const char* aStr)
 {
-  const char *d;
+  const char* d;
   do {
-    for (d = delims; *d != '\0'; ++d) {
-      if (*str == *d) {
-        ++str;
+    for (d = aDelims; *d != '\0'; ++d) {
+      if (*aStr == *d) {
+        ++aStr;
         break;
       }
     }
   } while (*d);
 
-  return str;
+  return aStr;
 }
 
 char*
-NS_strtok(const char *delims, char **str)
+NS_strtok(const char* aDelims, char** aStr)
 {
-  if (!*str)
-    return nullptr;
-
-  char *ret = (char*) NS_strspnp(delims, *str);
-
-  if (!*ret) {
-    *str = ret;
+  if (!*aStr) {
     return nullptr;
   }
 
-  char *i = ret;
+  char* ret = (char*)NS_strspnp(aDelims, *aStr);
+
+  if (!*ret) {
+    *aStr = ret;
+    return nullptr;
+  }
+
+  char* i = ret;
   do {
-    for (const char *d = delims; *d != '\0'; ++d) {
+    for (const char* d = aDelims; *d != '\0'; ++d) {
       if (*i == *d) {
         *i = '\0';
-        *str = ++i;
+        *aStr = ++i;
         return ret;
       }
     }
     ++i;
   } while (*i);
 
-  *str = nullptr;
+  *aStr = nullptr;
   return ret;
 }
 
 uint32_t
-NS_strlen(const char16_t *aString)
+NS_strlen(const char16_t* aString)
 {
-  const char16_t *end;
+  const char16_t* end;
 
   for (end = aString; *end; ++end) {
     // empty loop
   }
 
   return end - aString;
 }
 
 int
-NS_strcmp(const char16_t *a, const char16_t *b)
+NS_strcmp(const char16_t* aStrA, const char16_t* aStrB)
 {
-  while (*b) {
-    int r = *a - *b;
-    if (r)
+  while (*aStrB) {
+    int r = *aStrA - *aStrB;
+    if (r) {
       return r;
+    }
 
-    ++a;
-    ++b;
+    ++aStrA;
+    ++aStrB;
   }
 
-  return *a != '\0';
+  return *aStrA != '\0';
 }
 
 char16_t*
-NS_strdup(const char16_t *aString)
+NS_strdup(const char16_t* aString)
 {
   uint32_t len = NS_strlen(aString);
   return NS_strndup(aString, len);
 }
 
 char16_t*
-NS_strndup(const char16_t *aString, uint32_t aLen)
+NS_strndup(const char16_t* aString, uint32_t aLen)
 {
-  char16_t *newBuf = (char16_t*) NS_Alloc((aLen + 1) * sizeof(char16_t));
+  char16_t* newBuf = (char16_t*)NS_Alloc((aLen + 1) * sizeof(char16_t));
   if (newBuf) {
     memcpy(newBuf, aString, aLen * sizeof(char16_t));
     newBuf[aLen] = '\0';
   }
   return newBuf;
 }
 
 char*
-NS_strdup(const char *aString)
+NS_strdup(const char* aString)
 {
   uint32_t len = strlen(aString);
-  char *str = (char*) NS_Alloc(len + 1);
+  char* str = (char*)NS_Alloc(len + 1);
   if (str) {
     memcpy(str, aString, len);
     str[len] = '\0';
   }
   return str;
 }
 
 // This table maps uppercase characters to lower case characters;
@@ -168,105 +170,118 @@ const unsigned char nsLowerUpperUtils::k
   160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,
   176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
   192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
   208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
   224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
   240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
 };
 
-bool NS_IsUpper(char aChar)
+bool
+NS_IsUpper(char aChar)
 {
   return aChar != (char)nsLowerUpperUtils::kUpper2Lower[(unsigned char)aChar];
 }
 
-bool NS_IsLower(char aChar)
+bool
+NS_IsLower(char aChar)
 {
   return aChar != (char)nsLowerUpperUtils::kLower2Upper[(unsigned char)aChar];
 }
 
-bool NS_IsAscii(char16_t aChar)
+bool
+NS_IsAscii(char16_t aChar)
 {
   return (0x0080 > aChar);
 }
 
-bool NS_IsAscii(const char16_t *aString)
+bool
+NS_IsAscii(const char16_t* aString)
 {
-  while(*aString) {
-    if( 0x0080 <= *aString)
+  while (*aString) {
+    if (0x0080 <= *aString) {
       return false;
+    }
     aString++;
   }
   return true;
 }
 
-bool NS_IsAscii(const char *aString)
+bool
+NS_IsAscii(const char* aString)
 {
-  while(*aString) {
-    if( 0x80 & *aString)
+  while (*aString) {
+    if (0x80 & *aString) {
       return false;
+    }
     aString++;
   }
   return true;
 }
 
-bool NS_IsAscii(const char* aString, uint32_t aLength)
+bool
+NS_IsAscii(const char* aString, uint32_t aLength)
 {
   const char* end = aString + aLength;
   while (aString < end) {
-    if (0x80 & *aString)
+    if (0x80 & *aString) {
       return false;
+    }
     ++aString;
   }
   return true;
 }
 
-bool NS_IsAsciiAlpha(char16_t aChar)
+bool
+NS_IsAsciiAlpha(char16_t aChar)
 {
-  return ((aChar >= 'A') && (aChar <= 'Z')) ||
-         ((aChar >= 'a') && (aChar <= 'z'));
+  return (aChar >= 'A' && aChar <= 'Z') ||
+         (aChar >= 'a' && aChar <= 'z');
 }
 
-bool NS_IsAsciiWhitespace(char16_t aChar)
+bool
+NS_IsAsciiWhitespace(char16_t aChar)
 {
   return aChar == ' ' ||
          aChar == '\r' ||
          aChar == '\n' ||
          aChar == '\t';
 }
 
-bool NS_IsAsciiDigit(char16_t aChar)
+bool
+NS_IsAsciiDigit(char16_t aChar)
 {
   return aChar >= '0' && aChar <= '9';
 }
 
 
 #ifndef XPCOM_GLUE_AVOID_NSPR
 #define TABLE_SIZE 36
 static const char table[] = {
-  'a','b','c','d','e','f','g','h','i','j',
-  'k','l','m','n','o','p','q','r','s','t',
-  'u','v','w','x','y','z','0','1','2','3',
-  '4','5','6','7','8','9'
+  'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
+  'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
+  'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
+  '4', '5', '6', '7', '8', '9'
 };
 
-void NS_MakeRandomString(char *aBuf, int32_t aBufLen)
+void
+NS_MakeRandomString(char* aBuf, int32_t aBufLen)
 {
   // turn PR_Now() into milliseconds since epoch
   // and salt rand with that.
   static unsigned int seed = 0;
   if (seed == 0) {
     double fpTime = double(PR_Now());
     seed = (unsigned int)(fpTime * 1e-6 + 0.5); // use 1e-6, granularity of PR_Now() on the mac is seconds
     srand(seed);
   }
 
   int32_t i;
-  for (i=0;i<aBufLen;i++) {
-    *aBuf++ = table[rand()%TABLE_SIZE];
+  for (i = 0; i < aBufLen; ++i) {
+    *aBuf++ = table[rand() % TABLE_SIZE];
   }
   *aBuf = 0;
 }
 
 #endif
 
 static StderrCallback sStderrCallback = nullptr;
 
@@ -282,87 +297,88 @@ set_stderr_callback(StderrCallback aCall
 #define VARARGS_ASSIGN(foo, bar)     foo[0] = bar[0]
 #else
 #define VARARGS_ASSIGN(foo, bar)     (foo) = (bar)
 #endif
 
 #if defined(XP_WIN)
 
 void
-vprintf_stderr(const char *fmt, va_list args)
+vprintf_stderr(const char* aFmt, va_list aArgs)
 {
   if (sStderrCallback) {
     va_list argsCpy;
-    VARARGS_ASSIGN(argsCpy, args);
-    sStderrCallback(fmt, args);
+    VARARGS_ASSIGN(argsCpy, aArgs);
+    sStderrCallback(aFmt, aArgs);
     va_end(argsCpy);
   }
 
   if (IsDebuggerPresent()) {
     char buf[2048];
     va_list argsCpy;
-    VARARGS_ASSIGN(argsCpy, args);
-    vsnprintf(buf, sizeof(buf), fmt, argsCpy);
+    VARARGS_ASSIGN(argsCpy, aArgs);
+    vsnprintf(buf, sizeof(buf), aFmt, argsCpy);
     buf[sizeof(buf) - 1] = '\0';
     va_end(argsCpy);
     OutputDebugStringA(buf);
   }
 
-  FILE *fp = _fdopen(_dup(2), "a");
-  if (!fp)
-      return;
+  FILE* fp = _fdopen(_dup(2), "a");
+  if (!fp) {
+    return;
+  }
 
-  vfprintf(fp, fmt, args);
+  vfprintf(fp, aFmt, aArgs);
 
   fclose(fp);
 }
 
 #elif defined(ANDROID)
 void
-vprintf_stderr(const char *fmt, va_list args)
+vprintf_stderr(const char* aFmt, va_list aArgs)
 {
   if (sStderrCallback) {
     va_list argsCpy;
-    VARARGS_ASSIGN(argsCpy, args);
-    sStderrCallback(fmt, args);
+    VARARGS_ASSIGN(argsCpy, aArgs);
+    sStderrCallback(aFmt, aArgs);
     va_end(argsCpy);
   }
 
-  __android_log_vprint(ANDROID_LOG_INFO, "Gecko", fmt, args);
+  __android_log_vprint(ANDROID_LOG_INFO, "Gecko", aFmt, aArgs);
 }
 #else
 void
-vprintf_stderr(const char *fmt, va_list args)
+vprintf_stderr(const char* aFmt, va_list aArgs)
 {
   if (sStderrCallback) {
     va_list argsCpy;
-    VARARGS_ASSIGN(argsCpy, args);
-    sStderrCallback(fmt, args);
+    VARARGS_ASSIGN(argsCpy, aArgs);
+    sStderrCallback(aFmt, aArgs);
     va_end(argsCpy);
   }
 
-  vfprintf(stderr, fmt, args);
+  vfprintf(stderr, aFmt, aArgs);
 }
 #endif
 
 void
-printf_stderr(const char *fmt, ...)
+printf_stderr(const char* aFmt, ...)
 {
   va_list args;
-  va_start(args, fmt);
-  vprintf_stderr(fmt, args);
+  va_start(args, aFmt);
+  vprintf_stderr(aFmt, args);
   va_end(args);
 }
 
 void
-fprintf_stderr(FILE* aFile, const char *fmt, ...)
+fprintf_stderr(FILE* aFile, const char* aFmt, ...)
 {
   va_list args;
-  va_start(args, fmt);
+  va_start(args, aFmt);
   if (aFile == stderr) {
-    vprintf_stderr(fmt, args);
+    vprintf_stderr(aFmt, args);
   } else {
-    vfprintf(aFile, fmt, args);
+    vfprintf(aFile, aFmt, args);
   }
   va_end(args);
 }
 
 
--- a/xpcom/glue/nsCRTGlue.h
+++ b/xpcom/glue/nsCRTGlue.h
@@ -7,105 +7,101 @@
 
 #include "nscore.h"
 
 /**
  * Scan a string for the first character that is *not* in a set of
  * delimiters.  If the string is only delimiter characters, the end of the
  * string is returned.
  *
- * @param delims The set of delimiters (null-terminated)
- * @param str    The string to search (null-terminated)