Bug 1022456 - Convert xpcom/ds/ to Gecko style. r=froydnj
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Wed, 09 Jul 2014 08:15:21 -0700
changeset 193189 57038b3a8c97d91bd5a6a947d47e85a8882ec167
parent 193188 80191d079b3260d6f7bd7c9abf0308f93a713fe6
child 193190 672b11fd55272080ae335010ecd821b50ebfe1ff
push idunknown
push userunknown
push dateunknown
reviewersfroydnj
bugs1022456
milestone33.0a1
Bug 1022456 - Convert xpcom/ds/ to Gecko style. r=froydnj
xpcom/ds/CharTokenizer.h
xpcom/ds/TimeStamp.cpp
xpcom/ds/TimeStamp.h
xpcom/ds/TimeStamp_darwin.cpp
xpcom/ds/TimeStamp_posix.cpp
xpcom/ds/TimeStamp_windows.cpp
xpcom/ds/TimeStamp_windows.h
xpcom/ds/nsArray.cpp
xpcom/ds/nsArray.h
xpcom/ds/nsAtomService.cpp
xpcom/ds/nsAtomService.h
xpcom/ds/nsAtomTable.cpp
xpcom/ds/nsCRT.cpp
xpcom/ds/nsCRT.h
xpcom/ds/nsCheapSets.h
xpcom/ds/nsExpirationTracker.h
xpcom/ds/nsHashPropertyBag.cpp
xpcom/ds/nsHashPropertyBag.h
xpcom/ds/nsINIParserImpl.cpp
xpcom/ds/nsINIParserImpl.h
xpcom/ds/nsMathUtils.h
xpcom/ds/nsObserverList.cpp
xpcom/ds/nsObserverList.h
xpcom/ds/nsObserverService.cpp
xpcom/ds/nsObserverService.h
xpcom/ds/nsPersistentProperties.cpp
xpcom/ds/nsPersistentProperties.h
xpcom/ds/nsProperties.cpp
xpcom/ds/nsProperties.h
xpcom/ds/nsStaticAtom.h
xpcom/ds/nsStaticNameTable.cpp
xpcom/ds/nsStaticNameTable.h
xpcom/ds/nsStringEnumerator.cpp
xpcom/ds/nsSupportsArray.cpp
xpcom/ds/nsSupportsArray.h
xpcom/ds/nsSupportsArrayEnumerator.cpp
xpcom/ds/nsSupportsArrayEnumerator.h
xpcom/ds/nsSupportsPrimitives.cpp
xpcom/ds/nsSupportsPrimitives.h
xpcom/ds/nsVariant.cpp
xpcom/ds/nsVariant.h
xpcom/ds/nsWindowsRegKey.cpp
xpcom/ds/nsWindowsRegKey.h
--- a/xpcom/ds/CharTokenizer.h
+++ b/xpcom/ds/CharTokenizer.h
@@ -9,85 +9,79 @@
 #include "nsDependentSubstring.h"
 
 namespace mozilla {
 
 template<char16_t delimiter>
 class CharTokenizer
 {
 public:
-    CharTokenizer(const nsSubstring& aSource)
-    {
-      aSource.BeginReading(mIter);
-      aSource.EndReading(mEnd);
-    }
+  CharTokenizer(const nsSubstring& aSource)
+  {
+    aSource.BeginReading(mIter);
+    aSource.EndReading(mEnd);
+  }
+
+  /**
+   * Checks if any more tokens are available.
+   */
+  bool hasMoreTokens() { return mIter != mEnd; }
 
-    /**
-     * Checks if any more tokens are available.
-     */
-    bool hasMoreTokens()
-    {
-      return mIter != mEnd;
+  /**
+   * Returns the next token.
+   */
+  const nsDependentSubstring nextToken()
+  {
+    nsSubstring::const_char_iterator begin = mIter;
+    while (mIter != mEnd && (*mIter) != delimiter) {
+      ++mIter;
+    }
+    nsSubstring::const_char_iterator end = mIter;
+    if (mIter != mEnd) {
+      ++mIter;
     }
 
-    /**
-     * Returns the next token.
-     */
-    const nsDependentSubstring nextToken()
-    {
-      nsSubstring::const_char_iterator begin = mIter;
-      while (mIter != mEnd && (*mIter) != delimiter) {
-        ++mIter;
-      }
-      nsSubstring::const_char_iterator end = mIter;
-      if (mIter != mEnd) {
-        ++mIter;
-      }
-
-      return Substring(begin, end);
-    }
+    return Substring(begin, end);
+  }
 
 private:
-    nsSubstring::const_char_iterator mIter, mEnd;
+  nsSubstring::const_char_iterator mIter, mEnd;
 };
 
 template<char delimiter>
 class CCharTokenizer
 {
 public:
-    CCharTokenizer(const nsCSubstring& aSource)
-    {
-      aSource.BeginReading(mIter);
-      aSource.EndReading(mEnd);
-    }
+  CCharTokenizer(const nsCSubstring& aSource)
+  {
+    aSource.BeginReading(mIter);
+    aSource.EndReading(mEnd);
+  }
+
+  /**
+   * Checks if any more tokens are available.
+   */
+  bool hasMoreTokens() { return mIter != mEnd; }
 
-    /**
-     * Checks if any more tokens are available.
-     */
-    bool hasMoreTokens()
-    {
-      return mIter != mEnd;
+  /**
+   * Returns the next token.
+   */
+  const nsDependentCSubstring nextToken()
+  {
+    nsCSubstring::const_char_iterator begin = mIter;
+    while (mIter != mEnd && (*mIter) != delimiter) {
+      ++mIter;
+    }
+    nsCSubstring::const_char_iterator end = mIter;
+    if (mIter != mEnd) {
+      ++mIter;
     }
 
-    /**
-     * Returns the next token.
-     */
-    const nsDependentCSubstring nextToken()
-    {
-      nsCSubstring::const_char_iterator begin = mIter;
-      while (mIter != mEnd && (*mIter) != delimiter) {
-        ++mIter;
-      }
-      nsCSubstring::const_char_iterator end = mIter;
-      if (mIter != mEnd) {
-        ++mIter;
-      }
-
-      return Substring(begin, end);
-    }
+    return Substring(begin, end);
+  }
 
 private:
-    nsCSubstring::const_char_iterator mIter, mEnd;
+  nsCSubstring::const_char_iterator mIter, mEnd;
 };
 
 } // namespace mozilla
 
 #endif /* mozilla_CharTokenizer_h */
--- a/xpcom/ds/TimeStamp.cpp
+++ b/xpcom/ds/TimeStamp.cpp
@@ -11,49 +11,52 @@
 #include "mozilla/TimeStamp.h"
 #include "prenv.h"
 
 namespace mozilla {
 
 /**
  * Wrapper class used to initialize static data used by the TimeStamp class
  */
-struct TimeStampInitialization {
+struct TimeStampInitialization
+{
   /**
    * First timestamp taken when the class static initializers are run. This
    * timestamp is used to sanitize timestamps coming from different sources.
    */
   TimeStamp mFirstTimeStamp;
 
   /**
    * Timestamp representing the time when the process was created. This field
    * is populated lazily the first time this information is required and is
    * replaced every time the process is restarted.
    */
   TimeStamp mProcessCreation;
 
-  TimeStampInitialization() {
+  TimeStampInitialization()
+  {
     TimeStamp::Startup();
     mFirstTimeStamp = TimeStamp::Now();
   };
 
-  ~TimeStampInitialization() {
+  ~TimeStampInitialization()
+  {
     TimeStamp::Shutdown();
   };
 };
 
 static TimeStampInitialization sInitOnce;
 
 TimeStamp
 TimeStamp::ProcessCreation(bool& aIsInconsistent)
 {
   aIsInconsistent = false;
 
   if (sInitOnce.mProcessCreation.IsNull()) {
-    char *mozAppRestart = PR_GetEnv("MOZ_APP_RESTART");
+    char* mozAppRestart = PR_GetEnv("MOZ_APP_RESTART");
     TimeStamp ts;
 
     /* When calling PR_SetEnv() with an empty value the existing variable may
      * be unset or set to the empty string depending on the underlying platform
      * thus we have to check if the variable is present and not empty. */
     if (mozAppRestart && (strcmp(mozAppRestart, "") != 0)) {
       /* Firefox was restarted, use the first time-stamp we've taken as the new
        * process startup time. */
--- a/xpcom/ds/TimeStamp.h
+++ b/xpcom/ds/TimeStamp.h
@@ -9,17 +9,17 @@
 
 #include <stdint.h>
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 #include "nscore.h"
 #include "nsDebug.h"
 
 namespace IPC {
-template <typename T> struct ParamTraits;
+template<typename T> struct ParamTraits;
 }
 
 #ifdef XP_WIN
 // defines TimeStampValue as a complex value keeping both
 // GetTickCount and QueryPerformanceCounter values
 #include "TimeStamp_windows.h"
 #endif
 
@@ -29,132 +29,150 @@ namespace mozilla {
 typedef uint64_t TimeStampValue;
 #endif
 
 class TimeStamp;
 
 /**
  * Instances of this class represent the length of an interval of time.
  * Negative durations are allowed, meaning the end is before the start.
- * 
+ *
  * Internally the duration is stored as a int64_t in units of
  * PR_TicksPerSecond() when building with NSPR interval timers, or a
  * system-dependent unit when building with system clocks.  The
  * system-dependent unit must be constant, otherwise the semantics of
  * this class would be broken.
  */
 class TimeDuration
 {
 public:
   // The default duration is 0.
   MOZ_CONSTEXPR TimeDuration() : mValue(0) {}
   // Allow construction using '0' as the initial value, for readability,
   // but no other numbers (so we don't have any implicit unit conversions).
   struct _SomethingVeryRandomHere;
-  TimeDuration(_SomethingVeryRandomHere* aZero) : mValue(0) {
+  TimeDuration(_SomethingVeryRandomHere* aZero) : mValue(0)
+  {
     MOZ_ASSERT(!aZero, "Who's playing funny games here?");
   }
   // Default copy-constructor and assignment are OK
 
   double ToSeconds() const;
   // Return a duration value that includes digits of time we think to
   // be significant.  This method should be used when displaying a
   // time to humans.
   double ToSecondsSigDigits() const;
-  double ToMilliseconds() const {
-    return ToSeconds() * 1000.0;
-  }
-  double ToMicroseconds() const {
-    return ToMilliseconds() * 1000.0;
-  }
+  double ToMilliseconds() const { return ToSeconds() * 1000.0; }
+  double ToMicroseconds() const { return ToMilliseconds() * 1000.0; }
 
   // Using a double here is safe enough; with 53 bits we can represent
   // durations up to over 280,000 years exactly.  If the units of
   // mValue do not allow us to represent durations of that length,
   // long durations are clamped to the max/min representable value
   // instead of overflowing.
-  static inline TimeDuration FromSeconds(double aSeconds) {
+  static inline TimeDuration FromSeconds(double aSeconds)
+  {
     return FromMilliseconds(aSeconds * 1000.0);
   }
   static TimeDuration FromMilliseconds(double aMilliseconds);
-  static inline TimeDuration FromMicroseconds(double aMicroseconds) {
+  static inline TimeDuration FromMicroseconds(double aMicroseconds)
+  {
     return FromMilliseconds(aMicroseconds / 1000.0);
   }
 
-  static TimeDuration Forever() {
+  static TimeDuration Forever()
+  {
     return FromTicks(INT64_MAX);
   }
 
-  TimeDuration operator+(const TimeDuration& aOther) const {
+  TimeDuration operator+(const TimeDuration& aOther) const
+  {
     return TimeDuration::FromTicks(mValue + aOther.mValue);
   }
-  TimeDuration operator-(const TimeDuration& aOther) const {
+  TimeDuration operator-(const TimeDuration& aOther) const
+  {
     return TimeDuration::FromTicks(mValue - aOther.mValue);
   }
-  TimeDuration& operator+=(const TimeDuration& aOther) {
+  TimeDuration& operator+=(const TimeDuration& aOther)
+  {
     mValue += aOther.mValue;
     return *this;
   }
-  TimeDuration& operator-=(const TimeDuration& aOther) {
+  TimeDuration& operator-=(const TimeDuration& aOther)
+  {
     mValue -= aOther.mValue;
     return *this;
   }
 
 private:
   // Block double multiplier (slower, imprecise if long duration) - Bug 853398.
   // If required, use MultDouble explicitly and with care.
   TimeDuration operator*(const double aMultiplier) const MOZ_DELETE;
 
 public:
-  TimeDuration MultDouble(double aMultiplier) const {
+  TimeDuration MultDouble(double aMultiplier) const
+  {
     return TimeDuration::FromTicks(static_cast<int64_t>(mValue * aMultiplier));
   }
-  TimeDuration operator*(const int32_t aMultiplier) const {
+  TimeDuration operator*(const int32_t aMultiplier) const
+  {
     return TimeDuration::FromTicks(mValue * int64_t(aMultiplier));
   }
-  TimeDuration operator*(const uint32_t aMultiplier) const {
+  TimeDuration operator*(const uint32_t aMultiplier) const
+  {
     return TimeDuration::FromTicks(mValue * int64_t(aMultiplier));
   }
-  TimeDuration operator*(const int64_t aMultiplier) const {
+  TimeDuration operator*(const int64_t aMultiplier) const
+  {
     return TimeDuration::FromTicks(mValue * aMultiplier);
   }
-  TimeDuration operator*(const uint64_t aMultiplier) const {
+  TimeDuration operator*(const uint64_t aMultiplier) const
+  {
     if (aMultiplier > INT64_MAX) {
       NS_WARNING("Out-of-range multiplier when multiplying TimeDuration");
       return TimeDuration::Forever();
     }
     return TimeDuration::FromTicks(mValue * int64_t(aMultiplier));
   }
-  TimeDuration operator/(const int64_t aDivisor) const {
+  TimeDuration operator/(const int64_t aDivisor) const
+  {
     return TimeDuration::FromTicks(mValue / aDivisor);
   }
-  double operator/(const TimeDuration& aOther) const {
+  double operator/(const TimeDuration& aOther) const
+  {
     return static_cast<double>(mValue) / aOther.mValue;
   }
-  TimeDuration operator%(const TimeDuration& aOther) const {
+  TimeDuration operator%(const TimeDuration& aOther) const
+  {
     MOZ_ASSERT(aOther.mValue != 0, "Division by zero");
     return TimeDuration::FromTicks(mValue % aOther.mValue);
   }
 
-  bool operator<(const TimeDuration& aOther) const {
+  bool operator<(const TimeDuration& aOther) const
+  {
     return mValue < aOther.mValue;
   }
-  bool operator<=(const TimeDuration& aOther) const {
+  bool operator<=(const TimeDuration& aOther) const
+  {
     return mValue <= aOther.mValue;
   }
-  bool operator>=(const TimeDuration& aOther) const {
+  bool operator>=(const TimeDuration& aOther) const
+  {
     return mValue >= aOther.mValue;
   }
-  bool operator>(const TimeDuration& aOther) const {
+  bool operator>(const TimeDuration& aOther) const
+  {
     return mValue > aOther.mValue;
   }
-  bool operator==(const TimeDuration& aOther) const {
+  bool operator==(const TimeDuration& aOther) const
+  {
     return mValue == aOther.mValue;
   }
-  bool operator!=(const TimeDuration& aOther) const {
+  bool operator!=(const TimeDuration& aOther) const
+  {
     return mValue != aOther.mValue;
   }
 
   // Return a best guess at the system's current timing resolution,
   // which might be variable.  TimeDurations below this order of
   // magnitude are meaningless, and those at the same order of
   // magnitude or just above are suspect.
   static TimeDuration Resolution();
@@ -165,31 +183,35 @@ public:
   // but let's do that on demand.
   // Comparing durations for equality will only lead to bugs on
   // platforms with high-resolution timers.
 
 private:
   friend class TimeStamp;
   friend struct IPC::ParamTraits<mozilla::TimeDuration>;
 
-  static TimeDuration FromTicks(int64_t aTicks) {
+  static TimeDuration FromTicks(int64_t aTicks)
+  {
     TimeDuration t;
     t.mValue = aTicks;
     return t;
   }
 
-  static TimeDuration FromTicks(double aTicks) {
+  static TimeDuration FromTicks(double aTicks)
+  {
     // NOTE: this MUST be a >= test, because int64_t(double(INT64_MAX))
     // overflows and gives INT64_MIN.
-    if (aTicks >= double(INT64_MAX))
+    if (aTicks >= double(INT64_MAX)) {
       return TimeDuration::FromTicks(INT64_MAX);
+    }
 
     // This MUST be a <= test.
-    if (aTicks <= double(INT64_MIN))
+    if (aTicks <= double(INT64_MIN)) {
       return TimeDuration::FromTicks(INT64_MIN);
+    }
 
     return TimeDuration::FromTicks(int64_t(aTicks));
   }
 
   // Duration, result is implementation-specific difference of two TimeStamps
   int64_t mValue;
 };
 
@@ -199,17 +221,17 @@ private:
  * local time, since they can be reset, causing apparent backward
  * travel in time, which can confuse algorithms. Instead we measure
  * elapsed time according to the system.  This time can never go
  * backwards (i.e. it never wraps around, at least not in less than
  * five million years of system elapsed time). It might not advance
  * while the system is sleeping. If TimeStamp::SetNow() is not called
  * at all for hours or days, we might not notice the passage of some
  * of that time.
- * 
+ *
  * We deliberately do not expose a way to convert TimeStamps to some
  * particular unit. All you can do is compute a difference between two
  * TimeStamps to get a TimeDuration. You can also add a TimeDuration
  * to a TimeStamp to get a new TimeStamp. You can't do something
  * meaningless like add two TimeStamps.
  *
  * Internally this is implemented as either a wrapper around
  *   - high-resolution, monotonic, system clocks if they exist on this
@@ -231,16 +253,17 @@ public:
    */
   MOZ_CONSTEXPR TimeStamp() : mValue(0) {}
   // Default copy-constructor and assignment are OK
 
   /**
    * Return true if this is the "null" moment
    */
   bool IsNull() const { return mValue == 0; }
+
   /**
    * Return a timestamp reflecting the current elapsed system time. This
    * is monotonically increasing (i.e., does not decrease) over the
    * lifetime of this process' XPCOM session.
    *
    * Now() is trying to ensure the best possible precision on each platform,
    * at least one millisecond.
    *
@@ -271,17 +294,18 @@ public:
    * the time when the browser was restarted instead of the actual time when
    * the process was created.
    */
   static void RecordProcessRestart();
 
   /**
    * Compute the difference between two timestamps. Both must be non-null.
    */
-  TimeDuration operator-(const TimeStamp& aOther) const {
+  TimeDuration operator-(const TimeStamp& aOther) const
+  {
     MOZ_ASSERT(!IsNull(), "Cannot compute with a null value");
     MOZ_ASSERT(!aOther.IsNull(), "Cannot compute with aOther null value");
     static_assert(-INT64_MAX > INT64_MIN, "int64_t sanity check");
     int64_t ticks = int64_t(mValue - aOther.mValue);
     // Check for overflow.
     if (mValue > aOther.mValue) {
       if (ticks < 0) {
         ticks = INT64_MAX;
@@ -289,62 +313,72 @@ public:
     } else {
       if (ticks > 0) {
         ticks = INT64_MIN;
       }
     }
     return TimeDuration::FromTicks(ticks);
   }
 
-  TimeStamp operator+(const TimeDuration& aOther) const {
+  TimeStamp operator+(const TimeDuration& aOther) const
+  {
     MOZ_ASSERT(!IsNull(), "Cannot compute with a null value");
     return TimeStamp(mValue + aOther.mValue);
   }
-  TimeStamp operator-(const TimeDuration& aOther) const {
+  TimeStamp operator-(const TimeDuration& aOther) const
+  {
     MOZ_ASSERT(!IsNull(), "Cannot compute with a null value");
     return TimeStamp(mValue - aOther.mValue);
   }
-  TimeStamp& operator+=(const TimeDuration& aOther) {
+  TimeStamp& operator+=(const TimeDuration& aOther)
+  {
     MOZ_ASSERT(!IsNull(), "Cannot compute with a null value");
     mValue += aOther.mValue;
     return *this;
   }
-  TimeStamp& operator-=(const TimeDuration& aOther) {
+  TimeStamp& operator-=(const TimeDuration& aOther)
+  {
     MOZ_ASSERT(!IsNull(), "Cannot compute with a null value");
     mValue -= aOther.mValue;
     return *this;
   }
 
-  bool operator<(const TimeStamp& aOther) const {
+  bool operator<(const TimeStamp& aOther) const
+  {
     MOZ_ASSERT(!IsNull(), "Cannot compute with a null value");
     MOZ_ASSERT(!aOther.IsNull(), "Cannot compute with aOther null value");
     return mValue < aOther.mValue;
   }
-  bool operator<=(const TimeStamp& aOther) const {
+  bool operator<=(const TimeStamp& aOther) const
+  {
     MOZ_ASSERT(!IsNull(), "Cannot compute with a null value");
     MOZ_ASSERT(!aOther.IsNull(), "Cannot compute with aOther null value");
     return mValue <= aOther.mValue;
   }
-  bool operator>=(const TimeStamp& aOther) const {
+  bool operator>=(const TimeStamp& aOther) const
+  {
     MOZ_ASSERT(!IsNull(), "Cannot compute with a null value");
     MOZ_ASSERT(!aOther.IsNull(), "Cannot compute with aOther null value");
     return mValue >= aOther.mValue;
   }
-  bool operator>(const TimeStamp& aOther) const {
+  bool operator>(const TimeStamp& aOther) const
+  {
     MOZ_ASSERT(!IsNull(), "Cannot compute with a null value");
     MOZ_ASSERT(!aOther.IsNull(), "Cannot compute with aOther null value");
     return mValue > aOther.mValue;
   }
-  bool operator==(const TimeStamp& aOther) const {
+  bool operator==(const TimeStamp& aOther) const
+  {
     // Maybe it's ok to check == with null timestamps?
     MOZ_ASSERT(!IsNull() && "Cannot compute with a null value");
     MOZ_ASSERT(!aOther.IsNull(), "Cannot compute with aOther null value");
     return mValue == aOther.mValue;
   }
-  bool operator!=(const TimeStamp& aOther) const {
+  bool operator!=(const TimeStamp& aOther) const
+  {
     // Maybe it's ok to check != with null timestamps?
     MOZ_ASSERT(!IsNull(), "Cannot compute with a null value");
     MOZ_ASSERT(!aOther.IsNull(), "Cannot compute with aOther null value");
     return mValue != aOther.mValue;
   }
 
   // Comparing TimeStamps for equality should be discouraged. Adding
   // two TimeStamps, or scaling TimeStamps, is nonsense and must never
@@ -372,17 +406,17 @@ private:
   static uint64_t ComputeProcessUptime();
 
   /**
    * When built with PRIntervalTime, a value of 0 means this instance
    * is "null". Otherwise, the low 32 bits represent a PRIntervalTime,
    * and the high 32 bits represent a counter of the number of
    * rollovers of PRIntervalTime that we've seen. This counter starts
    * at 1 to avoid a real time colliding with the "null" value.
-   * 
+   *
    * PR_INTERVAL_MAX is set at 100,000 ticks per second. So the minimum
    * time to wrap around is about 2^64/100000 seconds, i.e. about
    * 5,849,424 years.
    *
    * When using a system clock, a value is system dependent.
    */
   TimeStampValue mValue;
 };
--- a/xpcom/ds/TimeStamp_darwin.cpp
+++ b/xpcom/ds/TimeStamp_darwin.cpp
@@ -60,18 +60,19 @@ ClockResolutionNs()
   // 10 total trials is arbitrary: what we're trying to avoid by
   // looping is getting unlucky and being interrupted by a context
   // switch or signal, or being bitten by paging/cache effects
   for (int i = 0; i < 9; ++i) {
     start = ClockTime();
     end = ClockTime();
 
     uint64_t candidate = (start - end);
-    if (candidate < minres)
+    if (candidate < minres) {
       minres = candidate;
+    }
   }
 
   if (0 == minres) {
     // measurable resolution is either incredibly low, ~1ns, or very
     // high.  fall back on NSPR's resolution assumption
     minres = 1 * kNsPerMs;
   }
 
@@ -110,36 +111,38 @@ TimeDuration::Resolution()
 {
   NS_ABORT_IF_FALSE(gInitialized, "calling TimeDuration too early");
   return TimeDuration::FromTicks(int64_t(sResolution));
 }
 
 nsresult
 TimeStamp::Startup()
 {
-  if (gInitialized)
+  if (gInitialized) {
     return NS_OK;
+  }
 
   mach_timebase_info_data_t timebaseInfo;
   // Apple's QA1398 suggests that the output from mach_timebase_info
   // will not change while a program is running, so it should be safe
   // to cache the result.
   kern_return_t kr = mach_timebase_info(&timebaseInfo);
-  if (kr != KERN_SUCCESS)
+  if (kr != KERN_SUCCESS) {
     NS_RUNTIMEABORT("mach_timebase_info failed");
+  }
 
   sNsPerTick = double(timebaseInfo.numer) / timebaseInfo.denom;
 
   sResolution = ClockResolutionNs();
 
   // find the number of significant digits in sResolution, for the
   // sake of ToSecondsSigDigits()
   for (sResolutionSigDigs = 1;
-       !(sResolutionSigDigs == sResolution
-         || 10*sResolutionSigDigs > sResolution);
+       !(sResolutionSigDigs == sResolution ||
+         10 * sResolutionSigDigs > sResolution);
        sResolutionSigDigs *= 10);
 
   gInitialized = true;
 
   return NS_OK;
 }
 
 void
@@ -173,23 +176,25 @@ TimeStamp::ComputeProcessUptime()
     getpid(),
   };
   u_int mibLen = sizeof(mib) / sizeof(mib[0]);
 
   struct kinfo_proc proc;
   size_t bufferSize = sizeof(proc);
   rv = sysctl(mib, mibLen, &proc, &bufferSize, nullptr, 0);
 
-  if (rv == -1)
+  if (rv == -1) {
     return 0;
+  }
 
   uint64_t startTime =
     ((uint64_t)proc.kp_proc.p_un.__p_starttime.tv_sec * kUsPerSec) +
     proc.kp_proc.p_un.__p_starttime.tv_usec;
   uint64_t now = (tv.tv_sec * kUsPerSec) + tv.tv_usec;
 
-  if (startTime > now)
+  if (startTime > now) {
     return 0;
+  }
 
   return now - startTime;
 }
 
 } // namespace mozilla
--- a/xpcom/ds/TimeStamp_posix.cpp
+++ b/xpcom/ds/TimeStamp_posix.cpp
@@ -53,25 +53,25 @@
 #include "nsDebug.h"
 
 // Estimate of the smallest duration of time we can measure.
 static uint64_t sResolution;
 static uint64_t sResolutionSigDigs;
 
 static const uint16_t kNsPerUs   =       1000;
 static const uint64_t kNsPerMs   =    1000000;
-static const uint64_t kNsPerSec  = 1000000000; 
+static const uint64_t kNsPerSec  = 1000000000;
 static const double kNsPerMsd    =    1000000.0;
 static const double kNsPerSecd   = 1000000000.0;
 
 static uint64_t
-TimespecToNs(const struct timespec& ts)
+TimespecToNs(const struct timespec& aTs)
 {
-  uint64_t baseNs = uint64_t(ts.tv_sec) * kNsPerSec;
-  return baseNs + uint64_t(ts.tv_nsec);
+  uint64_t baseNs = uint64_t(aTs.tv_sec) * kNsPerSec;
+  return baseNs + uint64_t(aTs.tv_nsec);
 }
 
 static uint64_t
 ClockTimeNs()
 {
   struct timespec ts;
   // this can't fail: we know &ts is valid, and TimeStamp::Startup()
   // checks that CLOCK_MONOTONIC is supported (and aborts if not)
@@ -103,18 +103,19 @@ ClockResolutionNs()
   // 10 total trials is arbitrary: what we're trying to avoid by
   // looping is getting unlucky and being interrupted by a context
   // switch or signal, or being bitten by paging/cache effects
   for (int i = 0; i < 9; ++i) {
     start = ClockTimeNs();
     end = ClockTimeNs();
 
     uint64_t candidate = (start - end);
-    if (candidate < minres)
+    if (candidate < minres) {
       minres = candidate;
+    }
   }
 
   if (0 == minres) {
     // measurable resolution is either incredibly low, ~1ns, or very
     // high.  fall back on clock_getres()
     struct timespec ts;
     if (0 == clock_getres(CLOCK_MONOTONIC, &ts)) {
       minres = TimespecToNs(ts);
@@ -160,30 +161,32 @@ TimeDuration::Resolution()
   return TimeDuration::FromTicks(int64_t(sResolution));
 }
 
 static bool gInitialized = false;
 
 nsresult
 TimeStamp::Startup()
 {
-  if (gInitialized)
+  if (gInitialized) {
     return NS_OK;
+  }
 
   struct timespec dummy;
-  if (0 != clock_gettime(CLOCK_MONOTONIC, &dummy))
-      NS_RUNTIMEABORT("CLOCK_MONOTONIC is absent!");
+  if (clock_gettime(CLOCK_MONOTONIC, &dummy) != 0) {
+    NS_RUNTIMEABORT("CLOCK_MONOTONIC is absent!");
+  }
 
   sResolution = ClockResolutionNs();
 
   // find the number of significant digits in sResolution, for the
   // sake of ToSecondsSigDigits()
   for (sResolutionSigDigs = 1;
-       !(sResolutionSigDigs == sResolution
-         || 10*sResolutionSigDigs > sResolution);
+       !(sResolutionSigDigs == sResolution ||
+         10 * sResolutionSigDigs > sResolution);
        sResolutionSigDigs *= 10);
 
   gInitialized = true;
 
   return NS_OK;
 }
 
 void
@@ -199,87 +202,93 @@ TimeStamp::Now(bool aHighResolution)
 
 #if defined(LINUX) || defined(ANDROID)
 
 // Calculates the amount of jiffies that have elapsed since boot and up to the
 // starttime value of a specific process as found in its /proc/*/stat file.
 // Returns 0 if an error occurred.
 
 static uint64_t
-JiffiesSinceBoot(const char *aFile)
+JiffiesSinceBoot(const char* aFile)
 {
   char stat[512];
 
-  FILE *f = fopen(aFile, "r");
-  if (!f)
+  FILE* f = fopen(aFile, "r");
+  if (!f) {
     return 0;
+  }
 
   int n = fread(&stat, 1, sizeof(stat) - 1, f);
 
   fclose(f);
 
-  if (n <= 0)
+  if (n <= 0) {
     return 0;
+  }
 
   stat[n] = 0;
 
   long long unsigned startTime = 0; // instead of uint64_t to keep GCC quiet
-  char *s = strrchr(stat, ')');
+  char* s = strrchr(stat, ')');
 
-  if (!s)
+  if (!s) {
     return 0;
+  }
 
   int rv = sscanf(s + 2,
                   "%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u "
                   "%*u %*u %*u %*d %*d %*d %*d %*d %*d %llu",
                   &startTime);
 
-  if (rv != 1 || !startTime)
+  if (rv != 1 || !startTime) {
     return 0;
+  }
 
   return startTime;
 }
 
 // Computes the interval that has elapsed between the thread creation and the
 // process creation by comparing the starttime fields in the respective
 // /proc/*/stat files. The resulting value will be a good approximation of the
 // process uptime. This value will be stored at the address pointed by aTime;
 // if an error occurred 0 will be stored instead.
 
 static void
-ComputeProcessUptimeThread(void *aTime)
+ComputeProcessUptimeThread(void* aTime)
 {
-  uint64_t *uptime = static_cast<uint64_t *>(aTime);
+  uint64_t* uptime = static_cast<uint64_t*>(aTime);
   long hz = sysconf(_SC_CLK_TCK);
 
   *uptime = 0;
 
-  if (!hz)
+  if (!hz) {
     return;
+  }
 
   char threadStat[40];
-  sprintf(threadStat, "/proc/self/task/%d/stat", (pid_t) syscall(__NR_gettid));
+  sprintf(threadStat, "/proc/self/task/%d/stat", (pid_t)syscall(__NR_gettid));
 
   uint64_t threadJiffies = JiffiesSinceBoot(threadStat);
   uint64_t selfJiffies = JiffiesSinceBoot("/proc/self/stat");
 
-  if (!threadJiffies || !selfJiffies)
+  if (!threadJiffies || !selfJiffies) {
     return;
+  }
 
   *uptime = ((threadJiffies - selfJiffies) * kNsPerSec) / hz;
 }
 
 // Computes and returns the process uptime in us on Linux & its derivatives.
 // Returns 0 if an error was encountered.
 
 uint64_t
 TimeStamp::ComputeProcessUptime()
 {
   uint64_t uptime = 0;
-  PRThread *thread = PR_CreateThread(PR_USER_THREAD,
+  PRThread* thread = PR_CreateThread(PR_USER_THREAD,
                                      ComputeProcessUptimeThread,
                                      &uptime,
                                      PR_PRIORITY_NORMAL,
                                      PR_GLOBAL_THREAD,
                                      PR_JOINABLE_THREAD,
                                      0);
 
   PR_JoinThread(thread);
@@ -314,25 +323,27 @@ TimeStamp::ComputeProcessUptime()
 #endif
   };
   u_int mibLen = sizeof(mib) / sizeof(mib[0]);
 
   KINFO_PROC proc;
   size_t bufferSize = sizeof(proc);
   rv = sysctl(mib, mibLen, &proc, &bufferSize, nullptr, 0);
 
-  if (rv == -1)
+  if (rv == -1) {
     return 0;
+  }
 
-  uint64_t startTime = ((uint64_t)proc.KP_START_SEC * kNsPerSec)
-    + (proc.KP_START_USEC * kNsPerUs);
+  uint64_t startTime = ((uint64_t)proc.KP_START_SEC * kNsPerSec) +
+    (proc.KP_START_USEC * kNsPerUs);
   uint64_t now = ((uint64_t)ts.tv_sec * kNsPerSec) + ts.tv_nsec;
 
-  if (startTime > now)
+  if (startTime > now) {
     return 0;
+  }
 
   return (now - startTime) / kNsPerUs;
 }
 
 #else
 
 uint64_t
 TimeStamp::ComputeProcessUptime()
--- a/xpcom/ds/TimeStamp_windows.cpp
+++ b/xpcom/ds/TimeStamp_windows.cpp
@@ -28,19 +28,20 @@
 //    set NSPR_LOG_MODULES=TimeStampWindows:5
 //    set NSPR_LOG_FILE=nspr.log
 //
 // this enables PR_LOG_DEBUG level information and places all output in
 // the file nspr.log
 static PRLogModuleInfo*
 GetTimeStampLog()
 {
-  static PRLogModuleInfo *sLog;
-  if (!sLog)
+  static PRLogModuleInfo* sLog;
+  if (!sLog) {
     sLog = PR_NewLogModule("TimeStampWindows");
+  }
   return sLog;
 }
   #define LOG(x)  PR_LOG(GetTimeStampLog(), PR_LOG_DEBUG, x)
 #else
   #define LOG(x)
 #endif /* PR_LOGGING */
 
 // Estimate of the smallest duration of time we can measure.
@@ -189,18 +190,19 @@ MozGetTickCount64()
 {
   DWORD GTC = ::GetTickCount();
 
   // Cheaper then CMPXCHG8B
   AutoCriticalSection lock(&sTimeStampLock);
 
   // Pull the rollover counter forward only if new value of GTC goes way
   // down under the last saved result
-  if ((sLastGTCResult > GTC) && ((sLastGTCResult - GTC) > (1UL << 30)))
+  if ((sLastGTCResult > GTC) && ((sLastGTCResult - GTC) > (1UL << 30))) {
     ++sLastGTCRollover;
+  }
 
   sLastGTCResult = GTC;
   return ULONGLONG(sLastGTCRollover) << 32 | sLastGTCResult;
 }
 
 // Result is in [mt]
 static inline ULONGLONG
 PerformanceCounter()
@@ -216,18 +218,19 @@ InitThresholds()
   DWORD timeAdjustment = 0, timeIncrement = 0;
   BOOL timeAdjustmentDisabled;
   GetSystemTimeAdjustment(&timeAdjustment,
                           &timeIncrement,
                           &timeAdjustmentDisabled);
 
   LOG(("TimeStamp: timeIncrement=%d [100ns]", timeIncrement));
 
-  if (!timeIncrement)
+  if (!timeIncrement) {
     timeIncrement = kDefaultTimeIncrement;
+  }
 
   // Ceiling to a millisecond
   // Example values: 156001, 210000
   DWORD timeIncrementCeil = timeIncrement;
   // Don't want to round up if already rounded, values will be: 156000, 209999
   timeIncrementCeil -= 1;
   // Convert to ms, values will be: 15, 20
   timeIncrementCeil /= 10000;
@@ -258,18 +261,19 @@ InitResolution()
 
   ULONGLONG minres = ~0ULL;
   int loops = 10;
   do {
     ULONGLONG start = PerformanceCounter();
     ULONGLONG end = PerformanceCounter();
 
     ULONGLONG candidate = (end - start);
-    if (candidate < minres)
+    if (candidate < minres) {
       minres = candidate;
+    }
   } while (--loops && minres);
 
   if (0 == minres) {
     minres = 1;
   }
 
   // Converting minres that is in [mt] to nanosecods, multiplicating
   // the argument to preserve resolution.
@@ -279,18 +283,17 @@ InitResolution()
   }
 
   sResolution = result;
 
   // find the number of significant digits in mResolution, for the
   // sake of ToSecondsSigDigits()
   ULONGLONG sigDigs;
   for (sigDigs = 1;
-       !(sigDigs == result
-         || 10*sigDigs > result);
+       !(sigDigs == result || 10 * sigDigs > result);
        sigDigs *= 10);
 
   sResolutionSigDigs = sigDigs;
 }
 
 // ----------------------------------------------------------------------------
 // TimeStampValue implementation
 // ----------------------------------------------------------------------------
@@ -317,89 +320,94 @@ TimeStampValue::operator-=(const int64_t
   mGTC -= aOther;
   mQPC -= aOther;
   return *this;
 }
 
 // If the duration is less then two seconds, perform check of QPC stability
 // by comparing both GTC and QPC calculated durations of this and aOther.
 uint64_t
-TimeStampValue::CheckQPC(const TimeStampValue &aOther) const
+TimeStampValue::CheckQPC(const TimeStampValue& aOther) const
 {
   uint64_t deltaGTC = mGTC - aOther.mGTC;
 
-  if (!mHasQPC || !aOther.mHasQPC) // Both not holding QPC
+  if (!mHasQPC || !aOther.mHasQPC) { // Both not holding QPC
     return deltaGTC;
+  }
 
   uint64_t deltaQPC = mQPC - aOther.mQPC;
 
-  if (sHasStableTSC) // For stable TSC there is no need to check
+  if (sHasStableTSC) { // For stable TSC there is no need to check
     return deltaQPC;
+  }
 
-  if (!sUseQPC) // QPC globally disabled
+  if (!sUseQPC) { // QPC globally disabled
     return deltaGTC;
+  }
 
   // Check QPC is sane before using it.
   int64_t diff = DeprecatedAbs(int64_t(deltaQPC) - int64_t(deltaGTC));
-  if (diff <= sGTCResulutionThreshold)
+  if (diff <= sGTCResulutionThreshold) {
     return deltaQPC;
+  }
 
   // Treat absolutely for calibration purposes
   int64_t duration = DeprecatedAbs(int64_t(deltaGTC));
   int64_t overflow = diff - sGTCResulutionThreshold;
 
   LOG(("TimeStamp: QPC check after %llums with overflow %1.4fms",
        mt2ms(duration), mt2ms_f(overflow)));
 
-  if (overflow <= sFailureThreshold) // We are in the limit, let go.
-    return deltaQPC; // XXX Should we return GTC here?
+  if (overflow <= sFailureThreshold) {  // We are in the limit, let go.
+    return deltaQPC;  // XXX Should we return GTC here?
+  }
 
   // QPC deviates, don't use it, since now this method may only return deltaGTC.
   LOG(("TimeStamp: QPC jittered over failure threshold"));
 
   if (duration < sHardFailureLimit) {
     // Interval between the two time stamps is very short, consider
     // QPC as unstable and record a failure.
     uint64_t now = ms2mt(sGetTickCount64());
 
     AutoCriticalSection lock(&sTimeStampLock);
 
     if (sFaultIntoleranceCheckpoint && sFaultIntoleranceCheckpoint > now) {
       // There's already been an error in the last fault intollerant interval.
       // Time since now to the checkpoint actually holds information on how many
       // failures there were in the failure free interval we have defined.
-      uint64_t failureCount = (sFaultIntoleranceCheckpoint - now + sFailureFreeInterval - 1) /
-                               sFailureFreeInterval;
+      uint64_t failureCount =
+        (sFaultIntoleranceCheckpoint - now + sFailureFreeInterval - 1) /
+        sFailureFreeInterval;
       if (failureCount > kMaxFailuresPerInterval) {
         sUseQPC = false;
         LOG(("TimeStamp: QPC disabled"));
-      }
-      else {
+      } else {
         // Move the fault intolerance checkpoint more to the future, prolong it
         // to reflect the number of detected failures.
         ++failureCount;
         sFaultIntoleranceCheckpoint = now + failureCount * sFailureFreeInterval;
         LOG(("TimeStamp: recording %dth QPC failure", failureCount));
       }
-    }
-    else {
+    } else {
       // Setup fault intolerance checkpoint in the future for first detected error.
       sFaultIntoleranceCheckpoint = now + sFailureFreeInterval;
       LOG(("TimeStamp: recording 1st QPC failure"));
     }
   }
 
   return deltaGTC;
 }
 
 uint64_t
-TimeStampValue::operator-(const TimeStampValue &aOther) const
+TimeStampValue::operator-(const TimeStampValue& aOther) const
 {
-  if (mIsNull && aOther.mIsNull)
+  if (mIsNull && aOther.mIsNull) {
     return uint64_t(0);
+  }
 
   return CheckQPC(aOther);
 }
 
 // ----------------------------------------------------------------------------
 // TimeDuration and TimeStamp implementation
 // ----------------------------------------------------------------------------
 
@@ -432,52 +440,57 @@ TimeDuration
 TimeDuration::Resolution()
 {
   return TimeDuration::FromTicks(int64_t(sResolution));
 }
 
 static bool
 HasStableTSC()
 {
-  union {
+  union
+  {
     int regs[4];
-    struct {
+    struct
+    {
       int nIds;
       char cpuString[12];
     };
   } cpuInfo;
 
   __cpuid(cpuInfo.regs, 0);
   // Only allow Intel CPUs for now
   // The order of the registers is reg[1], reg[3], reg[2].  We just adjust the
   // string so that we can compare in one go.
-  if (_strnicmp(cpuInfo.cpuString, "GenuntelineI", sizeof(cpuInfo.cpuString)))
+  if (_strnicmp(cpuInfo.cpuString, "GenuntelineI",
+                sizeof(cpuInfo.cpuString))) {
     return false;
+  }
 
   int regs[4];
 
   // detect if the Advanced Power Management feature is supported
   __cpuid(regs, 0x80000000);
-  if (regs[0] < 0x80000007)
+  if (regs[0] < 0x80000007) {
     return false;
+  }
 
   __cpuid(regs, 0x80000007);
   // if bit 8 is set than TSC will run at a constant rate
   // in all ACPI P-state, C-states and T-states
   return regs[3] & (1 << 8);
 }
 
 nsresult
 TimeStamp::Startup()
 {
   // Decide which implementation to use for the high-performance timer.
 
   HMODULE kernelDLL = GetModuleHandleW(L"kernel32.dll");
-  sGetTickCount64 = reinterpret_cast<GetTickCount64_t>
-    (GetProcAddress(kernelDLL, "GetTickCount64"));
+  sGetTickCount64 = reinterpret_cast<GetTickCount64_t>(
+    GetProcAddress(kernelDLL, "GetTickCount64"));
   if (!sGetTickCount64) {
     // If the platform does not support the GetTickCount64 (Windows XP doesn't),
     // then use our fallback implementation based on GetTickCount.
     sGetTickCount64 = MozGetTickCount64;
   }
 
   InitializeCriticalSectionAndSpinCount(&sTimeStampLock, kLockSpinCount);
 
@@ -528,24 +541,26 @@ uint64_t
 TimeStamp::ComputeProcessUptime()
 {
   SYSTEMTIME nowSys;
   GetSystemTime(&nowSys);
 
   FILETIME now;
   bool success = SystemTimeToFileTime(&nowSys, &now);
 
-  if (!success)
+  if (!success) {
     return 0;
+  }
 
   FILETIME start, foo, bar, baz;
   success = GetProcessTimes(GetCurrentProcess(), &start, &foo, &bar, &baz);
 
-  if (!success)
+  if (!success) {
     return 0;
+  }
 
   ULARGE_INTEGER startUsec = {
     start.dwLowDateTime,
     start.dwHighDateTime
   };
   ULARGE_INTEGER nowUsec = {
     now.dwLowDateTime,
     now.dwHighDateTime
--- a/xpcom/ds/TimeStamp_windows.h
+++ b/xpcom/ds/TimeStamp_windows.h
@@ -18,44 +18,64 @@ class TimeStampValue
   friend void StartupTimelineRecordExternal(int, uint64_t);
 
   // Both QPC and GTC are kept in [mt] units.
   uint64_t mGTC;
   uint64_t mQPC;
   bool mHasQPC;
   bool mIsNull;
 
-  TimeStampValue(uint64_t GTC, uint64_t QPC, bool hasQPC);
+  TimeStampValue(uint64_t aGTC, uint64_t aQPC, bool aHasQPC);
 
-  uint64_t CheckQPC(const TimeStampValue &aOther) const;
+  uint64_t CheckQPC(const TimeStampValue& aOther) const;
 
   struct _SomethingVeryRandomHere;
-  MOZ_CONSTEXPR TimeStampValue(_SomethingVeryRandomHere* nullValue)
-    : mGTC(0), mQPC(0), mHasQPC(false), mIsNull(true) {}
-
+  MOZ_CONSTEXPR TimeStampValue(_SomethingVeryRandomHere* aNullValue)
+    : mGTC(0)
+    , mQPC(0)
+    , mHasQPC(false)
+    , mIsNull(true)
+  {
+  }
 
 public:
-  uint64_t operator-(const TimeStampValue &aOther) const;
+  uint64_t operator-(const TimeStampValue& aOther) const;
 
   TimeStampValue operator+(const int64_t aOther) const
-    { return TimeStampValue(mGTC + aOther, mQPC + aOther, mHasQPC); }
+  {
+    return TimeStampValue(mGTC + aOther, mQPC + aOther, mHasQPC);
+  }
   TimeStampValue operator-(const int64_t aOther) const
-    { return TimeStampValue(mGTC - aOther, mQPC - aOther, mHasQPC); }
+  {
+    return TimeStampValue(mGTC - aOther, mQPC - aOther, mHasQPC);
+  }
   TimeStampValue& operator+=(const int64_t aOther);
   TimeStampValue& operator-=(const int64_t aOther);
 
-  bool operator<(const TimeStampValue &aOther) const
-    { return int64_t(*this - aOther) < 0; }
-  bool operator>(const TimeStampValue &aOther) const
-    { return int64_t(*this - aOther) > 0; }
-  bool operator<=(const TimeStampValue &aOther) const
-    { return int64_t(*this - aOther) <= 0; }
-  bool operator>=(const TimeStampValue &aOther) const
-    { return int64_t(*this - aOther) >= 0; }
-  bool operator==(const TimeStampValue &aOther) const
-    { return int64_t(*this - aOther) == 0; }
-  bool operator!=(const TimeStampValue &aOther) const
-    { return int64_t(*this - aOther) != 0; }
+  bool operator<(const TimeStampValue& aOther) const
+  {
+    return int64_t(*this - aOther) < 0;
+  }
+  bool operator>(const TimeStampValue& aOther) const
+  {
+    return int64_t(*this - aOther) > 0;
+  }
+  bool operator<=(const TimeStampValue& aOther) const
+  {
+    return int64_t(*this - aOther) <= 0;
+  }
+  bool operator>=(const TimeStampValue& aOther) const
+  {
+    return int64_t(*this - aOther) >= 0;
+  }
+  bool operator==(const TimeStampValue& aOther) const
+  {
+    return int64_t(*this - aOther) == 0;
+  }
+  bool operator!=(const TimeStampValue& aOther) const
+  {
+    return int64_t(*this - aOther) != 0;
+  }
 };
 
 }
 
 #endif /* mozilla_TimeStamp_h */
--- a/xpcom/ds/nsArray.cpp
+++ b/xpcom/ds/nsArray.cpp
@@ -7,19 +7,19 @@
 #include "nsArrayEnumerator.h"
 #include "nsIWeakReference.h"
 #include "nsIWeakReferenceUtils.h"
 #include "nsThreadUtils.h"
 
 // used by IndexOf()
 struct findIndexOfClosure
 {
-    nsISupports *targetElement;
-    uint32_t startIndex;
-    uint32_t resultIndex;
+  nsISupports* targetElement;
+  uint32_t startIndex;
+  uint32_t resultIndex;
 };
 
 static bool FindElementCallback(void* aElement, void* aClosure);
 
 NS_INTERFACE_MAP_BEGIN(nsArray)
   NS_INTERFACE_MAP_ENTRY(nsIArray)
   NS_INTERFACE_MAP_ENTRY(nsIMutableArray)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMutableArray)
@@ -28,186 +28,195 @@ NS_INTERFACE_MAP_END
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsArrayCC)
   NS_INTERFACE_MAP_ENTRY(nsIArray)
   NS_INTERFACE_MAP_ENTRY(nsIMutableArray)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIMutableArray)
 NS_INTERFACE_MAP_END
 
 nsArrayBase::~nsArrayBase()
 {
-    Clear();
+  Clear();
 }
 
 
 NS_IMPL_ADDREF(nsArray)
 NS_IMPL_RELEASE(nsArray)
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsArrayCC)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsArrayCC)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsArrayCC)
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsArrayCC)
-    tmp->Clear();
+  tmp->Clear();
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsArrayCC)
-    NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mArray)
+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mArray)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMETHODIMP
 nsArrayBase::GetLength(uint32_t* aLength)
 {
-    *aLength = mArray.Count();
-    return NS_OK;
+  *aLength = mArray.Count();
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsArrayBase::QueryElementAt(uint32_t aIndex,
                             const nsIID& aIID,
                             void** aResult)
 {
-    nsISupports * obj = mArray.SafeObjectAt(aIndex);
-    if (!obj) return NS_ERROR_ILLEGAL_VALUE;
+  nsISupports* obj = mArray.SafeObjectAt(aIndex);
+  if (!obj) {
+    return NS_ERROR_ILLEGAL_VALUE;
+  }
 
-    // no need to worry about a leak here, because SafeObjectAt()
-    // doesn't addref its result
-    return obj->QueryInterface(aIID, aResult);
+  // no need to worry about a leak here, because SafeObjectAt()
+  // doesn't addref its result
+  return obj->QueryInterface(aIID, aResult);
 }
 
 NS_IMETHODIMP
 nsArrayBase::IndexOf(uint32_t aStartIndex, nsISupports* aElement,
                      uint32_t* aResult)
 {
-    // optimize for the common case by forwarding to mArray
-    if (aStartIndex == 0) {
-        uint32_t idx = mArray.IndexOf(aElement);
-        if (idx == UINT32_MAX)
-            return NS_ERROR_FAILURE;
-
-        *aResult = idx;
-        return NS_OK;
+  // optimize for the common case by forwarding to mArray
+  if (aStartIndex == 0) {
+    uint32_t idx = mArray.IndexOf(aElement);
+    if (idx == UINT32_MAX) {
+      return NS_ERROR_FAILURE;
     }
 
-    findIndexOfClosure closure = { aElement, aStartIndex, 0 };
-    bool notFound = mArray.EnumerateForwards(FindElementCallback, &closure);
-    if (notFound)
-        return NS_ERROR_FAILURE;
+    *aResult = idx;
+    return NS_OK;
+  }
 
-    *aResult = closure.resultIndex;
-    return NS_OK;
+  findIndexOfClosure closure = { aElement, aStartIndex, 0 };
+  bool notFound = mArray.EnumerateForwards(FindElementCallback, &closure);
+  if (notFound) {
+    return NS_ERROR_FAILURE;
+  }
+
+  *aResult = closure.resultIndex;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsArrayBase::Enumerate(nsISimpleEnumerator** aResult)
 {
-    return NS_NewArrayEnumerator(aResult, static_cast<nsIArray*>(this));
+  return NS_NewArrayEnumerator(aResult, static_cast<nsIArray*>(this));
 }
 
 // nsIMutableArray implementation
 
 NS_IMETHODIMP
 nsArrayBase::AppendElement(nsISupports* aElement, bool aWeak)
 {
-    bool result;
-    if (aWeak) {
-        nsCOMPtr<nsIWeakReference> elementRef = do_GetWeakReference(aElement);
-        NS_ASSERTION(elementRef, "AppendElement: Trying to use weak references on an object that doesn't support it");
-        if (!elementRef)
-            return NS_ERROR_FAILURE;
-        result = mArray.AppendObject(elementRef);
+  bool result;
+  if (aWeak) {
+    nsCOMPtr<nsIWeakReference> elementRef = do_GetWeakReference(aElement);
+    NS_ASSERTION(elementRef,
+                 "AppendElement: Trying to use weak references on an object that doesn't support it");
+    if (!elementRef) {
+      return NS_ERROR_FAILURE;
     }
+    result = mArray.AppendObject(elementRef);
+  }
 
-    else {
-        // add the object directly
-        result = mArray.AppendObject(aElement);
-    }
-    return result ? NS_OK : NS_ERROR_FAILURE;
+  else {
+    // add the object directly
+    result = mArray.AppendObject(aElement);
+  }
+  return result ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsArrayBase::RemoveElementAt(uint32_t aIndex)
 {
-    bool result = mArray.RemoveObjectAt(aIndex);
-    return result ? NS_OK : NS_ERROR_FAILURE;
+  bool result = mArray.RemoveObjectAt(aIndex);
+  return result ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsArrayBase::InsertElementAt(nsISupports* aElement, uint32_t aIndex, bool aWeak)
 {
-    nsCOMPtr<nsISupports> elementRef;
-    if (aWeak) {
-        elementRef = do_GetWeakReference(aElement);
-        NS_ASSERTION(elementRef, "InsertElementAt: Trying to use weak references on an object that doesn't support it");
-        if (!elementRef)
-            return NS_ERROR_FAILURE;
-    } else {
-        elementRef = aElement;
+  nsCOMPtr<nsISupports> elementRef;
+  if (aWeak) {
+    elementRef = do_GetWeakReference(aElement);
+    NS_ASSERTION(elementRef,
+                 "InsertElementAt: Trying to use weak references on an object that doesn't support it");
+    if (!elementRef) {
+      return NS_ERROR_FAILURE;
     }
-    bool result = mArray.InsertObjectAt(elementRef, aIndex);
-    return result ? NS_OK : NS_ERROR_FAILURE;
+  } else {
+    elementRef = aElement;
+  }
+  bool result = mArray.InsertObjectAt(elementRef, aIndex);
+  return result ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsArrayBase::ReplaceElementAt(nsISupports* aElement, uint32_t aIndex, bool aWeak)
 {
-    nsCOMPtr<nsISupports> elementRef;
-    if (aWeak) {
-        elementRef = do_GetWeakReference(aElement);
-        NS_ASSERTION(elementRef, "ReplaceElementAt: Trying to use weak references on an object that doesn't support it");
-        if (!elementRef)
-            return NS_ERROR_FAILURE;
-    } else {
-        elementRef = aElement;
+  nsCOMPtr<nsISupports> elementRef;
+  if (aWeak) {
+    elementRef = do_GetWeakReference(aElement);
+    NS_ASSERTION(elementRef,
+                 "ReplaceElementAt: Trying to use weak references on an object that doesn't support it");
+    if (!elementRef) {
+      return NS_ERROR_FAILURE;
     }
-    bool result = mArray.ReplaceObjectAt(elementRef, aIndex);
-    return result ? NS_OK : NS_ERROR_FAILURE;
+  } else {
+    elementRef = aElement;
+  }
+  bool result = mArray.ReplaceObjectAt(elementRef, aIndex);
+  return result ? NS_OK : NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsArrayBase::Clear()
 {
-    mArray.Clear();
-    return NS_OK;
+  mArray.Clear();
+  return NS_OK;
 }
 
 //
 // static helper routines
 //
 bool
-FindElementCallback(void *aElement, void* aClosure)
+FindElementCallback(void* aElement, void* aClosure)
 {
-    findIndexOfClosure* closure =
-        static_cast<findIndexOfClosure*>(aClosure);
-
-    nsISupports* element =
-        static_cast<nsISupports*>(aElement);
+  findIndexOfClosure* closure = static_cast<findIndexOfClosure*>(aClosure);
+  nsISupports* element = static_cast<nsISupports*>(aElement);
 
-    // don't start searching until we're past the startIndex
-    if (closure->resultIndex >= closure->startIndex &&
-        element == closure->targetElement) {
-        return false;    // stop! We found it
-    }
-    closure->resultIndex++;
+  // don't start searching until we're past the startIndex
+  if (closure->resultIndex >= closure->startIndex &&
+      element == closure->targetElement) {
+    return false;    // stop! We found it
+  }
+  closure->resultIndex++;
 
-    return true;
+  return true;
 }
 
 nsresult
-nsArrayBase::XPCOMConstructor(nsISupports* aOuter, const nsIID& aIID, void** aResult)
+nsArrayBase::XPCOMConstructor(nsISupports* aOuter, const nsIID& aIID,
+                              void** aResult)
 {
-    if (aOuter)
-        return NS_ERROR_NO_AGGREGATION;
+  if (aOuter) {
+    return NS_ERROR_NO_AGGREGATION;
+  }
 
-    nsCOMPtr<nsIMutableArray> inst = Create();
-    return inst->QueryInterface(aIID, aResult);
+  nsCOMPtr<nsIMutableArray> inst = Create();
+  return inst->QueryInterface(aIID, aResult);
 }
 
 already_AddRefed<nsIMutableArray>
 nsArrayBase::Create()
 {
-    nsCOMPtr<nsIMutableArray> inst;
-    if (NS_IsMainThread()) {
-        inst = new nsArrayCC;
-    } else {
-        inst = new nsArray;
-    }
-    return inst.forget();
+  nsCOMPtr<nsIMutableArray> inst;
+  if (NS_IsMainThread()) {
+    inst = new nsArrayCC;
+  } else {
+    inst = new nsArray;
+  }
+  return inst.forget();
 }
--- a/xpcom/ds/nsArray.h
+++ b/xpcom/ds/nsArray.h
@@ -16,78 +16,58 @@
 #define NS_ARRAY_CID \
 { 0x35c66fd1, 0x95e9, 0x4e0a, \
   { 0x80, 0xc5, 0xc3, 0xbd, 0x2b, 0x37, 0x54, 0x81 } }
 
 // nsArray without any refcounting declarations
 class nsArrayBase : public nsIMutableArray
 {
 public:
-    NS_DECL_NSIARRAY
-    NS_DECL_NSIMUTABLEARRAY
+  NS_DECL_NSIARRAY
+  NS_DECL_NSIMUTABLEARRAY
 
-    /* Both of these factory functions create a cycle-collectable array
-       on the main thread and a non-cycle-collectable array on other
-       threads.  */
-    static already_AddRefed<nsIMutableArray> Create();
-    /* Only for the benefit of the XPCOM module system, use Create()
-       instead.  */
-    static nsresult XPCOMConstructor(nsISupports* aOuter, const nsIID& aIID,
-                                     void** aResult);
+  /* Both of these factory functions create a cycle-collectable array
+     on the main thread and a non-cycle-collectable array on other
+     threads.  */
+  static already_AddRefed<nsIMutableArray> Create();
+  /* Only for the benefit of the XPCOM module system, use Create()
+     instead.  */
+  static nsresult XPCOMConstructor(nsISupports* aOuter, const nsIID& aIID,
+                                   void** aResult);
 protected:
-    nsArrayBase()
-    {
-    }
-    nsArrayBase(const nsArrayBase& other);
-    nsArrayBase(const nsCOMArray_base& aBaseArray)
-        : mArray(aBaseArray)
-    {
-    }
+  nsArrayBase() {}
+  nsArrayBase(const nsArrayBase& aOther);
+  nsArrayBase(const nsCOMArray_base& aBaseArray) : mArray(aBaseArray) {}
+  virtual ~nsArrayBase();
 
-    virtual ~nsArrayBase();
-
-    nsCOMArray_base mArray;
+  nsCOMArray_base mArray;
 };
 
 class nsArray MOZ_FINAL : public nsArrayBase
 {
-    friend class nsArrayBase;
+  friend class nsArrayBase;
 
 public:
-    NS_DECL_ISUPPORTS
+  NS_DECL_ISUPPORTS
 
 private:
-    nsArray()
-        : nsArrayBase()
-    {
-    }
-    nsArray(const nsArray& other);
-    nsArray(const nsCOMArray_base& aBaseArray)
-        : nsArrayBase(aBaseArray)
-    {
-    }
-
-    ~nsArray() {}
+  nsArray() : nsArrayBase() {}
+  nsArray(const nsArray& aOther);
+  nsArray(const nsCOMArray_base& aBaseArray) : nsArrayBase(aBaseArray) {}
+  ~nsArray() {}
 };
 
 class nsArrayCC MOZ_FINAL : public nsArrayBase
 {
-    friend class nsArrayBase;
+  friend class nsArrayBase;
 
 public:
-    NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-    NS_DECL_CYCLE_COLLECTION_CLASS(nsArrayCC)
+  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+  NS_DECL_CYCLE_COLLECTION_CLASS(nsArrayCC)
 
 private:
-    nsArrayCC()
-        : nsArrayBase()
-    {
-    }
-    nsArrayCC(const nsArrayCC& other);
-    nsArrayCC(const nsCOMArray_base& aBaseArray)
-        : nsArrayBase(aBaseArray)
-    {
-    }
-
-    ~nsArrayCC() {}
+  nsArrayCC() : nsArrayBase() {}
+  nsArrayCC(const nsArrayCC& aOther);
+  nsArrayCC(const nsCOMArray_base& aBaseArray) : nsArrayBase(aBaseArray) {}
+  ~nsArrayCC() {}
 };
 
 #endif
--- a/xpcom/ds/nsAtomService.cpp
+++ b/xpcom/ds/nsAtomService.cpp
@@ -8,50 +8,50 @@
 
 NS_IMPL_ISUPPORTS(nsAtomService, nsIAtomService)
 
 nsAtomService::nsAtomService()
 {
 }
 
 nsresult
-nsAtomService::GetAtom(const nsAString& aString, nsIAtom ** aResult)
+nsAtomService::GetAtom(const nsAString& aString, nsIAtom** aResult)
 {
   *aResult = NS_NewAtom(aString).take();
+  if (!*aResult) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
 
-  if (!*aResult)
-    return NS_ERROR_OUT_OF_MEMORY;
-  
   return NS_OK;
 }
 
 nsresult
-nsAtomService::GetPermanentAtom(const nsAString& aString, nsIAtom ** aResult)
+nsAtomService::GetPermanentAtom(const nsAString& aString, nsIAtom** aResult)
 {
   *aResult = NS_NewPermanentAtom(aString);
+  if (!*aResult) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
 
-  if (!*aResult)
-    return NS_ERROR_OUT_OF_MEMORY;
-  
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsAtomService::GetAtomUTF8(const char *aValue, nsIAtom* *aResult)
+nsAtomService::GetAtomUTF8(const char* aValue, nsIAtom** aResult)
 {
-    *aResult = NS_NewAtom(aValue).take();
+  *aResult = NS_NewAtom(aValue).take();
+  if (!*aResult) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
 
-    if (!*aResult)
-        return NS_ERROR_OUT_OF_MEMORY;
-
-    return NS_OK;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
-nsAtomService::GetPermanentAtomUTF8(const char *aValue, nsIAtom* *aResult)
+nsAtomService::GetPermanentAtomUTF8(const char* aValue, nsIAtom** aResult)
 {
-    *aResult = NS_NewPermanentAtom(NS_ConvertUTF8toUTF16(aValue));
+  *aResult = NS_NewPermanentAtom(NS_ConvertUTF8toUTF16(aValue));
+  if (!*aResult) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
 
-    if (!*aResult)
-        return NS_ERROR_OUT_OF_MEMORY;
-
-    return NS_OK;
+  return NS_OK;
 }
--- a/xpcom/ds/nsAtomService.h
+++ b/xpcom/ds/nsAtomService.h
@@ -6,19 +6,19 @@
 #ifndef __nsAtomService_h
 #define __nsAtomService_h
 
 #include "nsIAtomService.h"
 #include "mozilla/Attributes.h"
 
 class nsAtomService MOZ_FINAL : public nsIAtomService
 {
- public:
+public:
   nsAtomService();
   NS_DECL_THREADSAFE_ISUPPORTS
-    
+
   NS_DECL_NSIATOMSERVICE
 
- private:
+private:
   ~nsAtomService() {}
 };
 
 #endif
--- a/xpcom/ds/nsAtomTable.cpp
+++ b/xpcom/ds/nsAtomTable.cpp
@@ -41,45 +41,47 @@ using namespace mozilla;
  * sure it's only manipulated from the main thread.  Probably the latter
  * is better, since the former would hurt performance.
  *
  * If |gAtomTable.ops| is 0, then the table is uninitialized.
  */
 static PLDHashTable gAtomTable;
 
 /**
- * A hashtable of static atoms that existed at app startup. This hashtable helps 
+ * A hashtable of static atoms that existed at app startup. This hashtable helps
  * nsHtml5AtomTable.
  */
 static nsDataHashtable<nsStringHashKey, nsIAtom*>* gStaticAtomTable = 0;
 
 /**
  * Whether it is still OK to add atoms to gStaticAtomTable.
  */
 static bool gStaticAtomTableSealed = false;
 
 //----------------------------------------------------------------------
 
 /**
  * Note that AtomImpl objects are sometimes converted into PermanentAtomImpl
  * objects using placement new and just overwriting the vtable pointer.
  */
 
-class AtomImpl : public nsIAtom {
+class AtomImpl : public nsIAtom
+{
 public:
   AtomImpl(const nsAString& aString, uint32_t aHash);
 
   // This is currently only used during startup when creating a permanent atom
   // from NS_RegisterStaticAtoms
   AtomImpl(nsStringBuffer* aData, uint32_t aLength, uint32_t aHash);
 
 protected:
   // This is only intended to be used when a normal atom is turned into a
   // permanent one.
-  AtomImpl() {
+  AtomImpl()
+  {
     // We can't really assert that mString is a valid nsStringBuffer string,
     // so do the best we can do and check for some consistencies.
     NS_ASSERTION((mLength + 1) * sizeof(char16_t) <=
                  nsStringBuffer::FromData(mString)->StorageSize() &&
                  mString[mLength] == 0,
                  "Not initialized atom");
   }
 
@@ -91,86 +93,90 @@ public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIATOM
 
   enum { REFCNT_PERMANENT_SENTINEL = UINT32_MAX };
 
   virtual bool IsPermanent();
 
   // We can't use the virtual function in the base class destructor.
-  bool IsPermanentInDestructor() {
+  bool IsPermanentInDestructor()
+  {
     return mRefCnt == REFCNT_PERMANENT_SENTINEL;
   }
 
   // for |#ifdef NS_BUILD_REFCNT_LOGGING| access to reference count
   nsrefcnt GetRefCount() { return mRefCnt; }
 
   size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
 };
 
 /**
  * A non-refcounted implementation of nsIAtom.
  */
 
-class PermanentAtomImpl MOZ_FINAL : public AtomImpl {
+class PermanentAtomImpl MOZ_FINAL : public AtomImpl
+{
 public:
   PermanentAtomImpl(const nsAString& aString, PLDHashNumber aKeyHash)
     : AtomImpl(aString, aKeyHash)
-  {}
+  {
+  }
   PermanentAtomImpl(nsStringBuffer* aData, uint32_t aLength,
                     PLDHashNumber aKeyHash)
     : AtomImpl(aData, aLength, aKeyHash)
-  {}
-  PermanentAtomImpl()
-  {}
+  {
+  }
+  PermanentAtomImpl() {}
 
   ~PermanentAtomImpl();
   NS_IMETHOD_(MozExternalRefCountType) AddRef();
   NS_IMETHOD_(MozExternalRefCountType) Release();
 
   virtual bool IsPermanent();
 
   // SizeOfIncludingThis() isn't needed -- the one inherited from AtomImpl is
   // good enough, because PermanentAtomImpl doesn't add any new data members.
 
-  void* operator new(size_t size, AtomImpl* aAtom) CPP_THROW_NEW;
-  void* operator new(size_t size) CPP_THROW_NEW
+  void* operator new(size_t aSize, AtomImpl* aAtom) CPP_THROW_NEW;
+  void* operator new(size_t aSize) CPP_THROW_NEW
   {
-    return ::operator new(size);
+    return ::operator new(aSize);
   }
 };
 
 //----------------------------------------------------------------------
 
-struct AtomTableEntry : public PLDHashEntryHdr {
+struct AtomTableEntry : public PLDHashEntryHdr
+{
   AtomImpl* mAtom;
 };
 
 struct AtomTableKey
 {
   AtomTableKey(const char16_t* aUTF16String, uint32_t aLength,
                /*inout*/ uint32_t& aHash)
-    : mUTF16String(aUTF16String),
-      mUTF8String(nullptr),
-      mLength(aLength)
+    : mUTF16String(aUTF16String)
+    , mUTF8String(nullptr)
+    , mLength(aLength)
   {
     if (aHash) {
       MOZ_ASSERT(aHash == HashString(mUTF16String, mLength));
       mHash = aHash;
     } else {
       UpdateHashKey();
       aHash = mHash;
     }
   }
 
   AtomTableKey(const char* aUTF8String, uint32_t aLength,
                /*inout*/ uint32_t& aHash)
-    : mUTF16String(nullptr),
-      mUTF8String(aUTF8String),
-      mLength(aLength)
+    : mUTF16String(nullptr)
+    , mUTF8String(aUTF8String)
+    , mLength(aLength)
   {
     if (aHash) {
       mozilla::DebugOnly<bool> err;
       MOZ_ASSERT(aHash == HashUTF8AsUTF16(mUTF8String, mLength, &err));
       mHash = aHash;
     } else {
       UpdateHashKey();
       aHash = mHash;
@@ -194,28 +200,28 @@ struct AtomTableKey
       }
     } else {
       mHash = HashString(mUTF16String, mLength);
     }
   }
 };
 
 static PLDHashNumber
-AtomTableGetHash(PLDHashTable *table, const void *key)
+AtomTableGetHash(PLDHashTable* aTable, const void* aKey)
 {
-  const AtomTableKey *k = static_cast<const AtomTableKey*>(key);
+  const AtomTableKey* k = static_cast<const AtomTableKey*>(aKey);
   return k->mHash;
 }
 
 static bool
-AtomTableMatchKey(PLDHashTable *table, const PLDHashEntryHdr *entry,
-                  const void *key)
+AtomTableMatchKey(PLDHashTable* aTable, const PLDHashEntryHdr* aEntry,
+                  const void* aKey)
 {
-  const AtomTableEntry *he = static_cast<const AtomTableEntry*>(entry);
-  const AtomTableKey *k = static_cast<const AtomTableKey*>(key);
+  const AtomTableEntry* he = static_cast<const AtomTableEntry*>(aEntry);
+  const AtomTableKey* k = static_cast<const AtomTableKey*>(aKey);
 
   if (k->mUTF8String) {
     return
       CompareUTF8toUTF16(nsDependentCSubstring(k->mUTF8String,
                                                k->mUTF8String + k->mLength),
                          nsDependentAtomString(he->mAtom)) == 0;
   }
 
@@ -224,38 +230,38 @@ AtomTableMatchKey(PLDHashTable *table, c
     return false;
   }
 
   return memcmp(he->mAtom->GetUTF16String(),
                 k->mUTF16String, length * sizeof(char16_t)) == 0;
 }
 
 static void
-AtomTableClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
+AtomTableClearEntry(PLDHashTable* aTable, PLDHashEntryHdr* aEntry)
 {
   // Normal |AtomImpl| atoms are deleted when their refcount hits 0, and
   // they then remove themselves from the table.  In other words, they
   // are owned by the callers who own references to them.
   // |PermanentAtomImpl| permanent atoms ignore their refcount and are
   // deleted when they are removed from the table at table destruction.
   // In other words, they are owned by the atom table.
 
-  AtomImpl *atom = static_cast<AtomTableEntry*>(entry)->mAtom;
+  AtomImpl* atom = static_cast<AtomTableEntry*>(aEntry)->mAtom;
   if (atom->IsPermanent()) {
     // Note that the cast here is important since AtomImpls doesn't have a
     // virtual dtor.
     delete static_cast<PermanentAtomImpl*>(atom);
   }
 }
 
 static bool
-AtomTableInitEntry(PLDHashTable *table, PLDHashEntryHdr *entry,
-                   const void *key)
+AtomTableInitEntry(PLDHashTable* aTable, PLDHashEntryHdr* aEntry,
+                   const void* aKey)
 {
-  static_cast<AtomTableEntry*>(entry)->mAtom = nullptr;
+  static_cast<AtomTableEntry*>(aEntry)->mAtom = nullptr;
 
   return true;
 }
 
 
 static const PLDHashTableOps AtomTableOps = {
   PL_DHashAllocTable,
   PL_DHashFreeTable,
@@ -265,35 +271,35 @@ static const PLDHashTableOps AtomTableOp
   AtomTableClearEntry,
   PL_DHashFinalizeStub,
   AtomTableInitEntry
 };
 
 
 #ifdef DEBUG
 static PLDHashOperator
-DumpAtomLeaks(PLDHashTable *table, PLDHashEntryHdr *he,
-              uint32_t index, void *arg)
+DumpAtomLeaks(PLDHashTable* aTable, PLDHashEntryHdr* aEntryHdr,
+              uint32_t aIndex, void* aArg)
 {
-  AtomTableEntry *entry = static_cast<AtomTableEntry*>(he);
-  
+  AtomTableEntry* entry = static_cast<AtomTableEntry*>(aEntryHdr);
   AtomImpl* atom = entry->mAtom;
   if (!atom->IsPermanent()) {
-    ++*static_cast<uint32_t*>(arg);
+    ++*static_cast<uint32_t*>(aArg);
     nsAutoCString str;
     atom->ToUTF8String(str);
     fputs(str.get(), stdout);
     fputs("\n", stdout);
   }
   return PL_DHASH_NEXT;
 }
 #endif
 
 static inline
-void PromoteToPermanent(AtomImpl* aAtom)
+void
+PromoteToPermanent(AtomImpl* aAtom)
 {
 #ifdef NS_BUILD_REFCNT_LOGGING
   {
     nsrefcnt refcount = aAtom->GetRefCount();
     do {
       NS_LOG_RELEASE(aAtom, --refcount, "AtomImpl");
     } while (refcount);
   }
@@ -303,17 +309,17 @@ void PromoteToPermanent(AtomImpl* aAtom)
 
 void
 NS_PurgeAtomTable()
 {
   delete gStaticAtomTable;
 
   if (gAtomTable.ops) {
 #ifdef DEBUG
-    const char *dumpAtomLeaks = PR_GetEnv("MOZ_DUMP_ATOM_LEAKS");
+    const char* dumpAtomLeaks = PR_GetEnv("MOZ_DUMP_ATOM_LEAKS");
     if (dumpAtomLeaks && *dumpAtomLeaks) {
       uint32_t leaked = 0;
       printf("*** %d atoms still exist (including permanent):\n",
              gAtomTable.entryCount);
       PL_DHashTableEnumerate(&gAtomTable, DumpAtomLeaks, &leaked);
       printf("*** %u non-permanent atoms leaked\n", leaked);
     }
 #endif
@@ -335,17 +341,17 @@ AtomImpl::AtomImpl(const nsAString& aStr
     CopyUnicodeTo(aString, 0, mString, mLength);
     mString[mLength] = char16_t(0);
   }
 
   mHash = aHash;
   MOZ_ASSERT(mHash == HashString(mString, mLength));
 
   NS_ASSERTION(mString[mLength] == char16_t(0), "null terminated");
-  NS_ASSERTION(buf && buf->StorageSize() >= (mLength+1) * sizeof(char16_t),
+  NS_ASSERTION(buf && buf->StorageSize() >= (mLength + 1) * sizeof(char16_t),
                "enough storage");
   NS_ASSERTION(Equals(aString), "correct data");
 
   // Take ownership of buffer
   mozilla::unused << buf.forget();
 }
 
 AtomImpl::AtomImpl(nsStringBuffer* aStringBuffer, uint32_t aLength,
@@ -357,17 +363,17 @@ AtomImpl::AtomImpl(nsStringBuffer* aStri
   // the static atom buffers have an initial refcount of 2.
   aStringBuffer->AddRef();
 
   mHash = aHash;
   MOZ_ASSERT(mHash == HashString(mString, mLength));
 
   NS_ASSERTION(mString[mLength] == char16_t(0), "null terminated");
   NS_ASSERTION(aStringBuffer &&
-               aStringBuffer->StorageSize() == (mLength+1) * sizeof(char16_t),
+               aStringBuffer->StorageSize() == (mLength + 1) * sizeof(char16_t),
                "correct storage");
 }
 
 AtomImpl::~AtomImpl()
 {
   NS_PRECONDITION(gAtomTable.ops, "uninitialized atom hashtable");
   // Permanent atoms are removed from the hashtable at shutdown, and we
   // don't want to remove them twice.  See comment above in
@@ -388,23 +394,25 @@ AtomImpl::~AtomImpl()
 NS_IMPL_ISUPPORTS(AtomImpl, nsIAtom)
 
 PermanentAtomImpl::~PermanentAtomImpl()
 {
   // So we can tell if we were permanent while running the base class dtor.
   mRefCnt = REFCNT_PERMANENT_SENTINEL;
 }
 
-NS_IMETHODIMP_(MozExternalRefCountType) PermanentAtomImpl::AddRef()
+NS_IMETHODIMP_(MozExternalRefCountType)
+PermanentAtomImpl::AddRef()
 {
   MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
   return 2;
 }
 
-NS_IMETHODIMP_(MozExternalRefCountType) PermanentAtomImpl::Release()
+NS_IMETHODIMP_(MozExternalRefCountType)
+PermanentAtomImpl::Release()
 {
   MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
   return 1;
 }
 
 /* virtual */ bool
 AtomImpl::IsPermanent()
 {
@@ -412,25 +420,27 @@ AtomImpl::IsPermanent()
 }
 
 /* virtual */ bool
 PermanentAtomImpl::IsPermanent()
 {
   return true;
 }
 
-void* PermanentAtomImpl::operator new ( size_t size, AtomImpl* aAtom ) CPP_THROW_NEW {
+void*
+PermanentAtomImpl::operator new(size_t aSize, AtomImpl* aAtom) CPP_THROW_NEW
+{
   MOZ_ASSERT(!aAtom->IsPermanent(),
              "converting atom that's already permanent");
 
   // Just let the constructor overwrite the vtable pointer.
   return aAtom;
 }
 
-NS_IMETHODIMP 
+NS_IMETHODIMP
 AtomImpl::ScriptableToString(nsAString& aBuf)
 {
   nsStringBuffer::FromData(mString)->ToString(mLength, aBuf);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 AtomImpl::ToUTF8String(nsACString& aBuf)
@@ -458,47 +468,48 @@ AtomImpl::IsStaticAtom()
 {
   return IsPermanent();
 }
 
 size_t
 AtomImpl::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
 {
   return aMallocSizeOf(this) +
-         nsStringBuffer::FromData(mString)->
-           SizeOfIncludingThisIfUnshared(aMallocSizeOf);
+         nsStringBuffer::FromData(mString)->SizeOfIncludingThisIfUnshared(
+           aMallocSizeOf);
 }
 
 //----------------------------------------------------------------------
 
 static size_t
-SizeOfAtomTableEntryExcludingThis(PLDHashEntryHdr *aHdr,
+SizeOfAtomTableEntryExcludingThis(PLDHashEntryHdr* aHdr,
                                   MallocSizeOf aMallocSizeOf,
-                                  void *aArg)
+                                  void* aArg)
 {
   AtomTableEntry* entry = static_cast<AtomTableEntry*>(aHdr);
   return entry->mAtom->SizeOfIncludingThis(aMallocSizeOf);
 }
 
 static size_t
 SizeOfStaticAtomTableEntryExcludingThis(const nsAString& aKey,
                                         nsIAtom* const& aData,
                                         MallocSizeOf aMallocSizeOf,
                                         void* aArg)
 {
   return aKey.SizeOfExcludingThisIfUnshared(aMallocSizeOf);
 }
 
 size_t
-NS_SizeOfAtomTablesIncludingThis(MallocSizeOf aMallocSizeOf) {
+NS_SizeOfAtomTablesIncludingThis(MallocSizeOf aMallocSizeOf)
+{
   size_t n = 0;
   if (gAtomTable.ops) {
-      n += PL_DHashTableSizeOfExcludingThis(&gAtomTable,
-                                            SizeOfAtomTableEntryExcludingThis,
-                                            aMallocSizeOf);
+    n += PL_DHashTableSizeOfExcludingThis(&gAtomTable,
+                                          SizeOfAtomTableEntryExcludingThis,
+                                          aMallocSizeOf);
   }
   if (gStaticAtomTable) {
     n += gStaticAtomTable->SizeOfIncludingThis(SizeOfStaticAtomTableEntryExcludingThis,
                                                aMallocSizeOf);
   }
   return n;
 }
 
@@ -514,43 +525,42 @@ EnsureTableExists()
 }
 
 static inline AtomTableEntry*
 GetAtomHashEntry(const char* aString, uint32_t aLength, uint32_t& aHash)
 {
   MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
   EnsureTableExists();
   AtomTableKey key(aString, aLength, aHash);
-  AtomTableEntry* e =
-    static_cast<AtomTableEntry*>
-               (PL_DHashTableOperate(&gAtomTable, &key, PL_DHASH_ADD));
+  AtomTableEntry* e = static_cast<AtomTableEntry*>(
+    PL_DHashTableOperate(&gAtomTable, &key, PL_DHASH_ADD));
   if (!e) {
     NS_ABORT_OOM(gAtomTable.entryCount * gAtomTable.entrySize);
   }
   return e;
 }
 
 static inline AtomTableEntry*
 GetAtomHashEntry(const char16_t* aString, uint32_t aLength, uint32_t& aHash)
 {
   MOZ_ASSERT(NS_IsMainThread(), "wrong thread");
   EnsureTableExists();
   AtomTableKey key(aString, aLength, aHash);
-  AtomTableEntry* e =
-    static_cast<AtomTableEntry*>
-               (PL_DHashTableOperate(&gAtomTable, &key, PL_DHASH_ADD));
+  AtomTableEntry* e = static_cast<AtomTableEntry*>(
+    PL_DHashTableOperate(&gAtomTable, &key, PL_DHASH_ADD));
   if (!e) {
     NS_ABORT_OOM(gAtomTable.entryCount * gAtomTable.entrySize);
   }
   return e;
 }
 
 class CheckStaticAtomSizes
 {
-  CheckStaticAtomSizes() {
+  CheckStaticAtomSizes()
+  {
     static_assert((sizeof(nsFakeStringBuffer<1>().mRefCnt) ==
                    sizeof(nsStringBuffer().mRefCount)) &&
                   (sizeof(nsFakeStringBuffer<1>().mSize) ==
                    sizeof(nsStringBuffer().mStorageSize)) &&
                   (offsetof(nsFakeStringBuffer<1>, mRefCnt) ==
                    offsetof(nsStringBuffer, mRefCount)) &&
                   (offsetof(nsFakeStringBuffer<1>, mSize) ==
                    offsetof(nsStringBuffer, mStorageSize)) &&
@@ -562,46 +572,45 @@ class CheckStaticAtomSizes
 
 nsresult
 RegisterStaticAtoms(const nsStaticAtom* aAtoms, uint32_t aAtomCount)
 {
   // this does three things:
   // 1) wraps each static atom in a wrapper, if necessary
   // 2) initializes the address pointed to by each mBits slot
   // 3) puts the atom into the static atom table as well
-  
+
   if (!gStaticAtomTable && !gStaticAtomTableSealed) {
     gStaticAtomTable = new nsDataHashtable<nsStringHashKey, nsIAtom*>();
   }
-  
-  for (uint32_t i=0; i<aAtomCount; i++) {
+
+  for (uint32_t i = 0; i < aAtomCount; ++i) {
     NS_ASSERTION(nsCRT::IsAscii((char16_t*)aAtoms[i].mStringBuffer->Data()),
                  "Static atoms must be ASCII!");
 
     uint32_t stringLen =
       aAtoms[i].mStringBuffer->StorageSize() / sizeof(char16_t) - 1;
 
     uint32_t hash = 0;
-    AtomTableEntry *he =
+    AtomTableEntry* he =
       GetAtomHashEntry((char16_t*)aAtoms[i].mStringBuffer->Data(),
                        stringLen, hash);
 
     if (he->mAtom) {
       // there already is an atom with this name in the table.. but we
       // still have to update mBits
       if (!he->mAtom->IsPermanent()) {
         // since we wanted to create a static atom but there is
         // already one there, we convert it to a non-refcounting
         // permanent atom
         PromoteToPermanent(he->mAtom);
       }
-      
+
       *aAtoms[i].mAtom = he->mAtom;
-    }
-    else {
+    } else {
       AtomImpl* atom = new PermanentAtomImpl(aAtoms[i].mStringBuffer,
                                              stringLen,
                                              hash);
       he->mAtom = atom;
       *aAtoms[i].mAtom = atom;
 
       if (!gStaticAtomTableSealed) {
         gStaticAtomTable->Put(nsAtomString(atom), atom);
@@ -616,17 +625,17 @@ NS_NewAtom(const char* aUTF8String)
 {
   return NS_NewAtom(nsDependentCString(aUTF8String));
 }
 
 already_AddRefed<nsIAtom>
 NS_NewAtom(const nsACString& aUTF8String)
 {
   uint32_t hash = 0;
-  AtomTableEntry *he = GetAtomHashEntry(aUTF8String.Data(),
+  AtomTableEntry* he = GetAtomHashEntry(aUTF8String.Data(),
                                         aUTF8String.Length(),
                                         hash);
 
   if (he->mAtom) {
     nsCOMPtr<nsIAtom> atom = he->mAtom;
 
     return atom.forget();
   }
@@ -648,17 +657,17 @@ NS_NewAtom(const char16_t* aUTF16String)
 {
   return NS_NewAtom(nsDependentString(aUTF16String));
 }
 
 already_AddRefed<nsIAtom>
 NS_NewAtom(const nsAString& aUTF16String)
 {
   uint32_t hash = 0;
-  AtomTableEntry *he = GetAtomHashEntry(aUTF16String.Data(),
+  AtomTableEntry* he = GetAtomHashEntry(aUTF16String.Data(),
                                         aUTF16String.Length(),
                                         hash);
 
   if (he->mAtom) {
     nsCOMPtr<nsIAtom> atom = he->mAtom;
 
     return atom.forget();
   }
@@ -668,27 +677,26 @@ NS_NewAtom(const nsAString& aUTF16String
 
   return atom.forget();
 }
 
 nsIAtom*
 NS_NewPermanentAtom(const nsAString& aUTF16String)
 {
   uint32_t hash = 0;
-  AtomTableEntry *he = GetAtomHashEntry(aUTF16String.Data(),
+  AtomTableEntry* he = GetAtomHashEntry(aUTF16String.Data(),
                                         aUTF16String.Length(),
                                         hash);
 
   AtomImpl* atom = he->mAtom;
   if (atom) {
     if (!atom->IsPermanent()) {
       PromoteToPermanent(atom);
     }
-  }
-  else {
+  } else {
     atom = new PermanentAtomImpl(aUTF16String, hash);
     he->mAtom = atom;
   }
 
   // No need to addref since permanent atoms aren't refcounted anyway
   return atom;
 }
 
--- a/xpcom/ds/nsCRT.cpp
+++ b/xpcom/ds/nsCRT.cpp
@@ -1,21 +1,21 @@
 /* -*- 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/. */
 
- 
+
 /**
  * MODULE NOTES:
  * @update  gess7/30/98
  *
  * Much as I hate to do it, we were using string compares wrong.
  * Often, programmers call functions like strcmp(s1,s2), and pass
- * one or more null strings. Rather than blow up on these, I've 
+ * one or more null strings. Rather than blow up on these, I've
  * added quick checks to ensure that cases like this don't cause
  * us to fail.
  *
  * In general, if you pass a null into any of these string compare
  * routines, we simply return 0.
  */
 
 
@@ -27,141 +27,160 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 // My lovely strtok routine
 
 #define IS_DELIM(m, c)          ((m)[(c) >> 3] & (1 << ((c) & 7)))
 #define SET_DELIM(m, c)         ((m)[(c) >> 3] |= (1 << ((c) & 7)))
 #define DELIM_TABLE_SIZE        32
 
-char* nsCRT::strtok(char* string, const char* delims, char* *newStr)
+char*
+nsCRT::strtok(char* aString, const char* aDelims, char** aNewStr)
 {
-  NS_ASSERTION(string, "Unlike regular strtok, the first argument cannot be null.");
+  NS_ASSERTION(aString,
+               "Unlike regular strtok, the first argument cannot be null.");
 
   char delimTable[DELIM_TABLE_SIZE];
   uint32_t i;
   char* result;
-  char* str = string;
-
-  for (i = 0; i < DELIM_TABLE_SIZE; i++)
-    delimTable[i] = '\0';
+  char* str = aString;
 
-  for (i = 0; delims[i]; i++) {
-    SET_DELIM(delimTable, static_cast<uint8_t>(delims[i]));
+  for (i = 0; i < DELIM_TABLE_SIZE; ++i) {
+    delimTable[i] = '\0';
   }
-  NS_ASSERTION(delims[i] == '\0', "too many delimiters");
+
+  for (i = 0; aDelims[i]; i++) {
+    SET_DELIM(delimTable, static_cast<uint8_t>(aDelims[i]));
+  }
+  NS_ASSERTION(aDelims[i] == '\0', "too many delimiters");
 
   // skip to beginning
   while (*str && IS_DELIM(delimTable, static_cast<uint8_t>(*str))) {
     str++;
   }
   result = str;
 
   // fix up the end of the token
   while (*str) {
     if (IS_DELIM(delimTable, static_cast<uint8_t>(*str))) {
       *str++ = '\0';
       break;
     }
     str++;
   }
-  *newStr = str;
+  *aNewStr = str;
 
   return str == result ? nullptr : result;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 
 /**
- * Compare unichar string ptrs, stopping at the 1st null 
+ * Compare unichar string ptrs, stopping at the 1st null
  * NOTE: If both are null, we return 0.
  * NOTE: We terminate the search upon encountering a nullptr
  *
  * @update  gess 11/10/99
  * @param   s1 and s2 both point to unichar strings
  * @return  0 if they match, -1 if s1<s2; 1 if s1>s2
  */
-int32_t nsCRT::strcmp(const char16_t* s1, const char16_t* s2) {
-  if(s1 && s2) {
+int32_t
+nsCRT::strcmp(const char16_t* aStr1, const char16_t* aStr2)
+{
+  if (aStr1 && aStr2) {
     for (;;) {
-      char16_t c1 = *s1++;
-      char16_t c2 = *s2++;
+      char16_t c1 = *aStr1++;
+      char16_t c2 = *aStr2++;
       if (c1 != c2) {
-        if (c1 < c2) return -1;
+        if (c1 < c2) {
+          return -1;
+        }
         return 1;
       }
-      if ((0==c1) || (0==c2)) break;
+      if (c1 == 0 || c2 == 0) {
+        break;
+      }
     }
-  }
-  else {
-    if (s1)                     // s2 must have been null
+  } else {
+    if (aStr1) {  // aStr2 must have been null
       return -1;
-    if (s2)                     // s1 must have been null
+    }
+    if (aStr2) {  // aStr1 must have been null
       return 1;
+    }
   }
   return 0;
 }
 
 /**
  * Compare unichar string ptrs, stopping at the 1st null or nth char.
  * NOTE: If either is null, we return 0.
  * NOTE: We DO NOT terminate the search upon encountering nullptr's before N
  *
  * @update  gess 11/10/99
  * @param   s1 and s2 both point to unichar strings
  * @return  0 if they match, -1 if s1<s2; 1 if s1>s2
  */
-int32_t nsCRT::strncmp(const char16_t* s1, const char16_t* s2, uint32_t n) {
-  if(s1 && s2) { 
-    if(n != 0) {
+int32_t
+nsCRT::strncmp(const char16_t* aStr1, const char16_t* aStr2, uint32_t aNum)
+{
+  if (aStr1 && aStr2) {
+    if (aNum != 0) {
       do {
-        char16_t c1 = *s1++;
-        char16_t c2 = *s2++;
+        char16_t c1 = *aStr1++;
+        char16_t c2 = *aStr2++;
         if (c1 != c2) {
-          if (c1 < c2) return -1;
+          if (c1 < c2) {
+            return -1;
+          }
           return 1;
         }
-      } while (--n != 0);
+      } while (--aNum != 0);
     }
   }
   return 0;
 }
 
-const char* nsCRT::memmem(const char* haystack, uint32_t haystackLen,
-                          const char* needle, uint32_t needleLen)
+const char*
+nsCRT::memmem(const char* aHaystack, uint32_t aHaystackLen,
+              const char* aNeedle, uint32_t aNeedleLen)
 {
   // Sanity checking
-  if (!(haystack && needle && haystackLen && needleLen &&
-        needleLen <= haystackLen))
+  if (!(aHaystack && aNeedle && aHaystackLen && aNeedleLen &&
+        aNeedleLen <= aHaystackLen)) {
     return nullptr;
+  }
 
 #ifdef HAVE_MEMMEM
-  return (const char*)::memmem(haystack, haystackLen, needle, needleLen);
+  return (const char*)::memmem(aHaystack, aHaystackLen, aNeedle, aNeedleLen);
 #else
   // No memmem means we need to roll our own.  This isn't really optimized
   // for performance ... if that becomes an issue we can take some inspiration
   // from the js string compare code in jsstr.cpp
-  for (uint32_t i = 0; i < haystackLen - needleLen; i++) {
-    if (!memcmp(haystack + i, needle, needleLen))
-      return haystack + i;
+  for (uint32_t i = 0; i < aHaystackLen - aNeedleLen; i++) {
+    if (!memcmp(aHaystack + i, aNeedle, aNeedleLen)) {
+      return aHaystack + i;
+    }
   }
 #endif
   return nullptr;
 }
 
 // This should use NSPR but NSPR isn't exporting its PR_strtoll function
 // Until then...
-int64_t nsCRT::atoll(const char *str)
+int64_t
+nsCRT::atoll(const char* aStr)
 {
-    if (!str)
-        return 0;
-
-    int64_t ll = 0;
+  if (!aStr) {
+    return 0;
+  }
 
-    while (*str && *str >= '0' && *str <= '9') {
-        ll *= 10;
-        ll += *str - '0';
-        str++;
-    }
+  int64_t ll = 0;
 
-    return ll;
+  while (*aStr && *aStr >= '0' && *aStr <= '9') {
+    ll *= 10;
+    ll += *aStr - '0';
+    aStr++;
+  }
+
+  return ll;
 }
 
--- a/xpcom/ds/nsCRT.h
+++ b/xpcom/ds/nsCRT.h
@@ -53,114 +53,129 @@ extern const char16_t kIsoLatin1ToUCS2[2
   }                                                     \
   void _class::operator delete(void* ptr) {             \
     ::operator delete(ptr);                             \
   }
 
 // Freeing helper
 #define CRTFREEIF(x) if (x) { nsCRT::free(x); x = 0; }
 
-/// This is a wrapper class around all the C runtime functions. 
+/// This is a wrapper class around all the C runtime functions.
 
-class nsCRT {
+class nsCRT
+{
 public:
-  enum {
-    LF='\n'   /* Line Feed */,
-    VTAB='\v' /* Vertical Tab */,
-    CR='\r'   /* Carriage Return */
+  enum
+  {
+    LF = '\n'   /* Line Feed */,
+    VTAB = '\v' /* Vertical Tab */,
+    CR = '\r'   /* Carriage Return */
   };
 
-  /// Compare s1 and s2.
-  static int32_t strcmp(const char* s1, const char* s2) {
-    return int32_t(PL_strcmp(s1, s2));
+  /// String comparison.
+  static int32_t strcmp(const char* aStr1, const char* aStr2)
+  {
+    return int32_t(PL_strcmp(aStr1, aStr2));
   }
 
-  static int32_t strncmp(const char* s1, const char* s2,
-                         uint32_t aMaxLen) {
-    return int32_t(PL_strncmp(s1, s2, aMaxLen));
+  static int32_t strncmp(const char* aStr1, const char* aStr2,
+                         uint32_t aMaxLen)
+  {
+    return int32_t(PL_strncmp(aStr1, aStr2, aMaxLen));
   }
 
   /// Case-insensitive string comparison.
-  static int32_t strcasecmp(const char* s1, const char* s2) {
-    return int32_t(PL_strcasecmp(s1, s2));
+  static int32_t strcasecmp(const char* aStr1, const char* aStr2)
+  {
+    return int32_t(PL_strcasecmp(aStr1, aStr2));
   }
 
   /// Case-insensitive string comparison with length
-  static int32_t strncasecmp(const char* s1, const char* s2, uint32_t aMaxLen) {
-    int32_t result=int32_t(PL_strncasecmp(s1, s2, aMaxLen));
+  static int32_t strncasecmp(const char* aStr1, const char* aStr2,
+                             uint32_t aMaxLen)
+  {
+    int32_t result = int32_t(PL_strncasecmp(aStr1, aStr2, aMaxLen));
     //Egads. PL_strncasecmp is returning *very* negative numbers.
     //Some folks expect -1,0,1, so let's temper its enthusiasm.
-    if (result<0) 
-      result=-1;
+    if (result < 0) {
+      result = -1;
+    }
     return result;
   }
 
-  static int32_t strncmp(const char* s1, const char* s2, int32_t aMaxLen) {
+  static int32_t strncmp(const char* aStr1, const char* aStr2, int32_t aMaxLen)
+  {
     // inline the first test (assumes strings are not null):
-    int32_t diff = ((const unsigned char*)s1)[0] - ((const unsigned char*)s2)[0];
-    if (diff != 0) return diff;
-    return int32_t(PL_strncmp(s1,s2,unsigned(aMaxLen)));
+    int32_t diff =
+      ((const unsigned char*)aStr1)[0] - ((const unsigned char*)aStr2)[0];
+    if (diff != 0) {
+      return diff;
+    }
+    return int32_t(PL_strncmp(aStr1, aStr2, unsigned(aMaxLen)));
   }
-  
+
   /**
 
-    How to use this fancy (thread-safe) version of strtok: 
+    How to use this fancy (thread-safe) version of strtok:
 
     void main(void) {
       printf("%s\n\nTokens:\n", string);
       // Establish string and get the first token:
       char* newStr;
-      token = nsCRT::strtok(string, seps, &newStr);   
+      token = nsCRT::strtok(string, seps, &newStr);
       while (token != nullptr) {
         // While there are tokens in "string"
         printf(" %s\n", token);
         // Get next token:
         token = nsCRT::strtok(newStr, seps, &newStr);
       }
     }
     * WARNING - STRTOK WHACKS str THE FIRST TIME IT IS CALLED *
     * MAKE A COPY OF str IF YOU NEED TO USE IT AFTER strtok() *
   */
-  static char* strtok(char* str, const char* delims, char* *newStr); 
+  static char* strtok(char* aStr, const char* aDelims, char** aNewStr);
 
   /// Like strcmp except for ucs2 strings
-  static int32_t strcmp(const char16_t* s1, const char16_t* s2);
+  static int32_t strcmp(const char16_t* aStr1, const char16_t* aStr2);
   /// Like strcmp except for ucs2 strings
-  static int32_t strncmp(const char16_t* s1, const char16_t* s2,
+  static int32_t strncmp(const char16_t* aStr1, const char16_t* aStr2,
                          uint32_t aMaxLen);
 
   // The GNU libc has memmem, which is strstr except for binary data
   // This is our own implementation that uses memmem on platforms
   // where it's available.
-  static const char* memmem(const char* haystack, uint32_t haystackLen,
-                            const char* needle, uint32_t needleLen);
+  static const char* memmem(const char* aHaystack, uint32_t aHaystackLen,
+                            const char* aNeedle, uint32_t aNeedleLen);
 
   // String to longlong
-  static int64_t atoll(const char *str);
-  
+  static int64_t atoll(const char* aStr);
+
   static char ToUpper(char aChar) { return NS_ToUpper(aChar); }
   static char ToLower(char aChar) { return NS_ToLower(aChar); }
-  
+
   static bool IsUpper(char aChar) { return NS_IsUpper(aChar); }
   static bool IsLower(char aChar) { return NS_IsLower(aChar); }
 
   static bool IsAscii(char16_t aChar) { return NS_IsAscii(aChar); }
   static bool IsAscii(const char16_t* aString) { return NS_IsAscii(aString); }
   static bool IsAsciiAlpha(char16_t aChar) { return NS_IsAsciiAlpha(aChar); }
   static bool IsAsciiDigit(char16_t aChar) { return NS_IsAsciiDigit(aChar); }
   static bool IsAsciiSpace(char16_t aChar) { return NS_IsAsciiWhitespace(aChar); }
   static bool IsAscii(const char* aString) { return NS_IsAscii(aString); }
-  static bool IsAscii(const char* aString, uint32_t aLength) { return NS_IsAscii(aString, aLength); }
+  static bool IsAscii(const char* aString, uint32_t aLength)
+  {
+    return NS_IsAscii(aString, aLength);
+  }
 };
 
 
 inline bool
-NS_IS_SPACE(char16_t c)
+NS_IS_SPACE(char16_t aChar)
 {
-  return ((int(c) & 0x7f) == int(c)) && isspace(int(c));
+  return ((int(aChar) & 0x7f) == int(aChar)) && isspace(int(aChar));
 }
 
 #define NS_IS_CNTRL(i)   ((((unsigned int) (i)) > 0x7f) ? (int) 0 : iscntrl(i))
 #define NS_IS_DIGIT(i)   ((((unsigned int) (i)) > 0x7f) ? (int) 0 : isdigit(i))
 #if defined(XP_WIN)
 #define NS_IS_ALPHA(VAL) (isascii((int)(VAL)) && isalpha((int)(VAL)))
 #else
 #define NS_IS_ALPHA(VAL) ((((unsigned int) (VAL)) > 0x7f) ? (int) 0 : isalpha((int)(VAL)))
--- a/xpcom/ds/nsCheapSets.h
+++ b/xpcom/ds/nsCheapSets.h
@@ -13,147 +13,143 @@
  * A set that takes up minimal size when there are 0 or 1 entries in the set.
  * Use for cases where sizes of 0 and 1 are even slightly common.
  */
 template<typename EntryType>
 class nsCheapSet
 {
 public:
   typedef typename EntryType::KeyType KeyType;
-  typedef PLDHashOperator (* Enumerator)(EntryType* aEntry, void* userArg);
+  typedef PLDHashOperator (*Enumerator)(EntryType* aEntry, void* userArg);
 
-  nsCheapSet() : mState(ZERO)
-  {
-  }
-  ~nsCheapSet()
-  {
-    Clear();
-  }
+  nsCheapSet() : mState(ZERO) {}
+  ~nsCheapSet() { Clear(); }
 
   /**
    * Remove all entries.
    */
   void Clear()
   {
     switch (mState) {
-    case ZERO:
-      break;
-    case ONE:
-      GetSingleEntry()->~EntryType();
-      break;
-    case MANY:
-      delete mUnion.table;
-      break;
-    default:
-      NS_NOTREACHED("bogus state");
-      break;
+      case ZERO:
+        break;
+      case ONE:
+        GetSingleEntry()->~EntryType();
+        break;
+      case MANY:
+        delete mUnion.table;
+        break;
+      default:
+        NS_NOTREACHED("bogus state");
+        break;
     }
     mState = ZERO;
   }
 
   nsresult Put(const KeyType aVal);
 
   void Remove(const KeyType aVal);
 
   bool Contains(const KeyType aVal)
   {
     switch (mState) {
-    case ZERO:
-      return false;
-    case ONE:
-      return GetSingleEntry()->KeyEquals(EntryType::KeyToPointer(aVal));
-    case MANY:
-      return !!mUnion.table->GetEntry(aVal);
-    default:
-      NS_NOTREACHED("bogus state");
-      return false;
+      case ZERO:
+        return false;
+      case ONE:
+        return GetSingleEntry()->KeyEquals(EntryType::KeyToPointer(aVal));
+      case MANY:
+        return !!mUnion.table->GetEntry(aVal);
+      default:
+        NS_NOTREACHED("bogus state");
+        return false;
     }
   }
 
-  uint32_t EnumerateEntries(Enumerator enumFunc, void* userArg)
+  uint32_t EnumerateEntries(Enumerator aEnumFunc, void* aUserArg)
   {
     switch (mState) {
-    case ZERO:
-      return 0;
-    case ONE:
-      if (enumFunc(GetSingleEntry(), userArg) == PL_DHASH_REMOVE) {
-        GetSingleEntry()->~EntryType();
-        mState = ZERO;
-      }
-      return 1;
-    case MANY:
-      return mUnion.table->EnumerateEntries(enumFunc, userArg);
-    default:
-      NS_NOTREACHED("bogus state");
-      return 0;
+      case ZERO:
+        return 0;
+      case ONE:
+        if (aEnumFunc(GetSingleEntry(), aUserArg) == PL_DHASH_REMOVE) {
+          GetSingleEntry()->~EntryType();
+          mState = ZERO;
+        }
+        return 1;
+      case MANY:
+        return mUnion.table->EnumerateEntries(aEnumFunc, aUserArg);
+      default:
+        NS_NOTREACHED("bogus state");
+        return 0;
     }
   }
 
 private:
   EntryType* GetSingleEntry()
   {
     return reinterpret_cast<EntryType*>(&mUnion.singleEntry[0]);
   }
 
-  enum SetState {
+  enum SetState
+  {
     ZERO,
     ONE,
     MANY
   };
 
-  union {
-    nsTHashtable<EntryType> *table;
+  union
+  {
+    nsTHashtable<EntryType>* table;
     char singleEntry[sizeof(EntryType)];
   } mUnion;
   enum SetState mState;
 };
 
 template<typename EntryType>
 nsresult
 nsCheapSet<EntryType>::Put(const KeyType aVal)
 {
   switch (mState) {
-  case ZERO:
-    new (GetSingleEntry()) EntryType(EntryType::KeyToPointer(aVal));
-    mState = ONE;
-    return NS_OK;
-  case ONE:
-    {
-      nsTHashtable<EntryType> *table = new nsTHashtable<EntryType>();
-      EntryType *entry = GetSingleEntry();
+    case ZERO:
+      new (GetSingleEntry()) EntryType(EntryType::KeyToPointer(aVal));
+      mState = ONE;
+      return NS_OK;
+    case ONE: {
+      nsTHashtable<EntryType>* table = new nsTHashtable<EntryType>();
+      EntryType* entry = GetSingleEntry();
       table->PutEntry(entry->GetKey());
       entry->~EntryType();
       mUnion.table = table;
       mState = MANY;
     }
     // Fall through.
-  case MANY:
-    mUnion.table->PutEntry(aVal);
-    return NS_OK;
-  default:
-    NS_NOTREACHED("bogus state");
-    return NS_OK;
+    case MANY:
+      mUnion.table->PutEntry(aVal);
+      return NS_OK;
+    default:
+      NS_NOTREACHED("bogus state");
+      return NS_OK;
   }
 }
 
 template<typename EntryType>
 void
 nsCheapSet<EntryType>::Remove(const KeyType aVal)
 {
   switch (mState) {
-  case ZERO:
-    break;
-  case ONE:
-    if (Contains(aVal)) {
-      GetSingleEntry()->~EntryType();
-      mState = ZERO;
-    }
-    break;
-  case MANY:
-    mUnion.table->RemoveEntry(aVal);
-    break;
-  default:
-    NS_NOTREACHED("bogus state");
-    break;
+    case ZERO:
+      break;
+    case ONE:
+      if (Contains(aVal)) {
+        GetSingleEntry()->~EntryType();
+        mState = ZERO;
+      }
+      break;
+    case MANY:
+      mUnion.table->RemoveEntry(aVal);
+      break;
+    default:
+      NS_NOTREACHED("bogus state");
+      break;
   }
 }
 
 #endif
--- a/xpcom/ds/nsExpirationTracker.h
+++ b/xpcom/ds/nsExpirationTracker.h
@@ -19,19 +19,23 @@
 #include "mozilla/Services.h"
 #include "mozilla/Attributes.h"
 
 /**
  * Data used to track the expiration state of an object. We promise that this
  * is 32 bits so that objects that includes this as a field can pad and align
  * efficiently.
  */
-struct nsExpirationState {
-  enum { NOT_TRACKED = (1U << 4) - 1,
-         MAX_INDEX_IN_GENERATION = (1U << 28) - 1 };
+struct nsExpirationState
+{
+  enum
+  {
+    NOT_TRACKED = (1U << 4) - 1,
+    MAX_INDEX_IN_GENERATION = (1U << 28) - 1
+  };
 
   nsExpirationState() : mGeneration(NOT_TRACKED) {}
   bool IsTracked() { return mGeneration != NOT_TRACKED; }
 
   /**
    * The generation that this object belongs to, or NOT_TRACKED.
    */
   uint32_t mGeneration:4;
@@ -39,345 +43,376 @@ struct nsExpirationState {
 };
 
 /**
  * nsExpirationTracker can track the lifetimes and usage of a large number of
  * objects, and send a notification some window of time after a live object was
  * last used. This is very useful when you manage a large number of objects
  * and want to flush some after they haven't been used for a while.
  * nsExpirationTracker is designed to be very space and time efficient.
- * 
+ *
  * The type parameter T is the object type that we will track pointers to. T
  * must include an accessible method GetExpirationState() that returns a
  * pointer to an nsExpirationState associated with the object (preferably,
  * stored in a field of the object).
- * 
+ *
  * The parameter K is the number of generations that will be used. Increasing
  * the number of generations narrows the window within which we promise
  * to fire notifications, at a slight increase in space cost for the tracker.
  * We require 2 <= K <= nsExpirationState::NOT_TRACKED (currently 15).
- * 
+ *
  * To use this class, you need to inherit from it and override the
  * NotifyExpired() method.
- * 
+ *
  * The approach is to track objects in K generations. When an object is accessed
  * it moves from its current generation to the newest generation. Generations
  * are stored in a cyclic array; when a timer interrupt fires, we advance
  * the current generation pointer to effectively age all objects very efficiently.
  * By storing information in each object about its generation and index within its
  * generation array, we make removal of objects from a generation very cheap.
- * 
+ *
  * Future work:
  * -- Add a method to change the timer period?
  */
-template <class T, uint32_t K> class nsExpirationTracker {
-  public:
-    /**
-     * Initialize the tracker.
-     * @param aTimerPeriod the timer period in milliseconds. The guarantees
-     * provided by the tracker are defined in terms of this period. If the
-     * period is zero, then we don't use a timer and rely on someone calling
-     * AgeOneGeneration explicitly.
-     */
-    nsExpirationTracker(uint32_t aTimerPeriod)
-      : mTimerPeriod(aTimerPeriod), mNewestGeneration(0),
-        mInAgeOneGeneration(false) {
-      static_assert(K >= 2 && K <= nsExpirationState::NOT_TRACKED,
-                    "Unsupported number of generations (must be 2 <= K <= 15)");
-      mObserver = new ExpirationTrackerObserver();
-      mObserver->Init(this);
+template<class T, uint32_t K>
+class nsExpirationTracker
+{
+public:
+  /**
+   * Initialize the tracker.
+   * @param aTimerPeriod the timer period in milliseconds. The guarantees
+   * provided by the tracker are defined in terms of this period. If the
+   * period is zero, then we don't use a timer and rely on someone calling
+   * AgeOneGeneration explicitly.
+   */
+  nsExpirationTracker(uint32_t aTimerPeriod)
+    : mTimerPeriod(aTimerPeriod)
+    , mNewestGeneration(0)
+    , mInAgeOneGeneration(false)
+  {
+    static_assert(K >= 2 && K <= nsExpirationState::NOT_TRACKED,
+                  "Unsupported number of generations (must be 2 <= K <= 15)");
+    mObserver = new ExpirationTrackerObserver();
+    mObserver->Init(this);
+  }
+  ~nsExpirationTracker()
+  {
+    if (mTimer) {
+      mTimer->Cancel();
     }
-    ~nsExpirationTracker() {
-      if (mTimer) {
-        mTimer->Cancel();
-      }
-      mObserver->Destroy();
-    }
+    mObserver->Destroy();
+  }
 
-    /**
-     * Add an object to be tracked. It must not already be tracked. It will
-     * be added to the newest generation, i.e., as if it was just used.
-     * @return an error on out-of-memory
-     */
-    nsresult AddObject(T* aObj) {
-      nsExpirationState* state = aObj->GetExpirationState();
-      NS_ASSERTION(!state->IsTracked(), "Tried to add an object that's already tracked");
-      nsTArray<T*>& generation = mGenerations[mNewestGeneration];
-      uint32_t index = generation.Length();
-      if (index > nsExpirationState::MAX_INDEX_IN_GENERATION) {
-        NS_WARNING("More than 256M elements tracked, this is probably a problem");
-        return NS_ERROR_OUT_OF_MEMORY;
+  /**
+   * Add an object to be tracked. It must not already be tracked. It will
+   * be added to the newest generation, i.e., as if it was just used.
+   * @return an error on out-of-memory
+   */
+  nsresult AddObject(T* aObj)
+  {
+    nsExpirationState* state = aObj->GetExpirationState();
+    NS_ASSERTION(!state->IsTracked(), "Tried to add an object that's already tracked");
+    nsTArray<T*>& generation = mGenerations[mNewestGeneration];
+    uint32_t index = generation.Length();
+    if (index > nsExpirationState::MAX_INDEX_IN_GENERATION) {
+      NS_WARNING("More than 256M elements tracked, this is probably a problem");
+      return NS_ERROR_OUT_OF_MEMORY;
+    }
+    if (index == 0) {
+      // We might need to start the timer
+      nsresult rv = CheckStartTimer();
+      if (NS_FAILED(rv)) {
+        return rv;
       }
-      if (index == 0) {
-        // We might need to start the timer
-        nsresult rv = CheckStartTimer();
-        if (NS_FAILED(rv))
-          return rv;
-      }
-      if (!generation.AppendElement(aObj))
-        return NS_ERROR_OUT_OF_MEMORY;
-      state->mGeneration = mNewestGeneration;
-      state->mIndexInGeneration = index;
+    }
+    if (!generation.AppendElement(aObj)) {
+      return NS_ERROR_OUT_OF_MEMORY;
+    }
+    state->mGeneration = mNewestGeneration;
+    state->mIndexInGeneration = index;
+    return NS_OK;
+  }
+
+  /**
+   * Remove an object from the tracker. It must currently be tracked.
+   */
+  void RemoveObject(T* aObj)
+  {
+    nsExpirationState* state = aObj->GetExpirationState();
+    NS_ASSERTION(state->IsTracked(), "Tried to remove an object that's not tracked");
+    nsTArray<T*>& generation = mGenerations[state->mGeneration];
+    uint32_t index = state->mIndexInGeneration;
+    NS_ASSERTION(generation.Length() > index &&
+                 generation[index] == aObj, "Object is lying about its index");
+    // Move the last object to fill the hole created by removing aObj
+    uint32_t last = generation.Length() - 1;
+    T* lastObj = generation[last];
+    generation[index] = lastObj;
+    lastObj->GetExpirationState()->mIndexInGeneration = index;
+    generation.RemoveElementAt(last);
+    state->mGeneration = nsExpirationState::NOT_TRACKED;
+    // We do not check whether we need to stop the timer here. The timer
+    // will check that itself next time it fires. Checking here would not
+    // be efficient since we'd need to track all generations. Also we could
+    // thrash by incessantly creating and destroying timers if someone
+    // kept adding and removing an object from the tracker.
+  }
+
+  /**
+   * Notify that an object has been used.
+   * @return an error if we lost the object from the tracker...
+   */
+  nsresult MarkUsed(T* aObj)
+  {
+    nsExpirationState* state = aObj->GetExpirationState();
+    if (mNewestGeneration == state->mGeneration) {
       return NS_OK;
     }
+    RemoveObject(aObj);
+    return AddObject(aObj);
+  }
 
-    /**
-     * Remove an object from the tracker. It must currently be tracked.
-     */
-    void RemoveObject(T* aObj) {
-      nsExpirationState* state = aObj->GetExpirationState();
-      NS_ASSERTION(state->IsTracked(), "Tried to remove an object that's not tracked");
-      nsTArray<T*>& generation = mGenerations[state->mGeneration];
-      uint32_t index = state->mIndexInGeneration;
-      NS_ASSERTION(generation.Length() > index &&
-                   generation[index] == aObj, "Object is lying about its index");
-      // Move the last object to fill the hole created by removing aObj
-      uint32_t last = generation.Length() - 1;
-      T* lastObj = generation[last];
-      generation[index] = lastObj;
-      lastObj->GetExpirationState()->mIndexInGeneration = index;
-      generation.RemoveElementAt(last);
-      state->mGeneration = nsExpirationState::NOT_TRACKED;
-      // We do not check whether we need to stop the timer here. The timer
-      // will check that itself next time it fires. Checking here would not
-      // be efficient since we'd need to track all generations. Also we could
-      // thrash by incessantly creating and destroying timers if someone
-      // kept adding and removing an object from the tracker.
-    }
-
-    /**
-     * Notify that an object has been used.
-     * @return an error if we lost the object from the tracker...
-     */
-    nsresult MarkUsed(T* aObj) {
-      nsExpirationState* state = aObj->GetExpirationState();
-      if (mNewestGeneration == state->mGeneration)
-        return NS_OK;
-      RemoveObject(aObj);
-      return AddObject(aObj);
+  /**
+   * The timer calls this, but it can also be manually called if you want
+   * to age objects "artifically". This can result in calls to NotifyExpired.
+   */
+  void AgeOneGeneration()
+  {
+    if (mInAgeOneGeneration) {
+      NS_WARNING("Can't reenter AgeOneGeneration from NotifyExpired");
+      return;
     }
 
-    /**
-     * The timer calls this, but it can also be manually called if you want
-     * to age objects "artifically". This can result in calls to NotifyExpired.
-     */
-    void AgeOneGeneration() {
-      if (mInAgeOneGeneration) {
-        NS_WARNING("Can't reenter AgeOneGeneration from NotifyExpired");
-        return;
+    mInAgeOneGeneration = true;
+    uint32_t reapGeneration =
+      mNewestGeneration > 0 ? mNewestGeneration - 1 : K - 1;
+    nsTArray<T*>& generation = mGenerations[reapGeneration];
+    // The following is rather tricky. We have to cope with objects being
+    // removed from this generation either because of a call to RemoveObject
+    // (or indirectly via MarkUsed) inside NotifyExpired. Fortunately no
+    // objects can be added to this generation because it's not the newest
+    // generation. We depend on the fact that RemoveObject can only cause
+    // the indexes of objects in this generation to *decrease*, not increase.
+    // So if we start from the end and work our way backwards we are guaranteed
+    // to see each object at least once.
+    size_t index = generation.Length();
+    for (;;) {
+      // Objects could have been removed so index could be outside
+      // the array
+      index = XPCOM_MIN(index, generation.Length());
+      if (index == 0) {
+        break;
       }
-      
-      mInAgeOneGeneration = true;
-      uint32_t reapGeneration = 
-        mNewestGeneration > 0 ? mNewestGeneration - 1 : K - 1;
-      nsTArray<T*>& generation = mGenerations[reapGeneration];
-      // The following is rather tricky. We have to cope with objects being
-      // removed from this generation either because of a call to RemoveObject
-      // (or indirectly via MarkUsed) inside NotifyExpired. Fortunately no
-      // objects can be added to this generation because it's not the newest
-      // generation. We depend on the fact that RemoveObject can only cause
-      // the indexes of objects in this generation to *decrease*, not increase.
-      // So if we start from the end and work our way backwards we are guaranteed
-      // to see each object at least once.
-      size_t index = generation.Length();
-      for (;;) {
-        // Objects could have been removed so index could be outside
-        // the array
-        index = XPCOM_MIN(index, generation.Length());
-        if (index == 0)
-          break;
-        --index;
-        NotifyExpired(generation[index]);
-      }
-      // Any leftover objects from reapGeneration just end up in the new
-      // newest-generation. This is bad form, though, so warn if there are any.
-      if (!generation.IsEmpty()) {
-        NS_WARNING("Expired objects were not removed or marked used");
-      }
-      // Free excess memory used by the generation array, since we probably
-      // just removed most or all of its elements.
-      generation.Compact();
-      mNewestGeneration = reapGeneration;
-      mInAgeOneGeneration = false;
+      --index;
+      NotifyExpired(generation[index]);
+    }
+    // Any leftover objects from reapGeneration just end up in the new
+    // newest-generation. This is bad form, though, so warn if there are any.
+    if (!generation.IsEmpty()) {
+      NS_WARNING("Expired objects were not removed or marked used");
+    }
+    // Free excess memory used by the generation array, since we probably
+    // just removed most or all of its elements.
+    generation.Compact();
+    mNewestGeneration = reapGeneration;
+    mInAgeOneGeneration = false;
+  }
+
+  /**
+   * This just calls AgeOneGeneration K times. Under normal circumstances this
+   * will result in all objects getting NotifyExpired called on them, but
+   * if NotifyExpired itself marks some objects as used, then those objects
+   * might not expire. This would be a good thing to call if we get into
+   * a critically-low memory situation.
+   */
+  void AgeAllGenerations()
+  {
+    uint32_t i;
+    for (i = 0; i < K; ++i) {
+      AgeOneGeneration();
+    }
+  }
+
+  class Iterator
+  {
+  private:
+    nsExpirationTracker<T, K>* mTracker;
+    uint32_t mGeneration;
+    uint32_t mIndex;
+  public:
+    Iterator(nsExpirationTracker<T, K>* aTracker)
+      : mTracker(aTracker)
+      , mGeneration(0)
+      , mIndex(0)
+    {
     }
 
-    /**
-     * This just calls AgeOneGeneration K times. Under normal circumstances this
-     * will result in all objects getting NotifyExpired called on them, but
-     * if NotifyExpired itself marks some objects as used, then those objects
-     * might not expire. This would be a good thing to call if we get into
-     * a critically-low memory situation.
-     */
-    void AgeAllGenerations() {
-      uint32_t i;
-      for (i = 0; i < K; ++i) {
-        AgeOneGeneration();
+    T* Next()
+    {
+      while (mGeneration < K) {
+        nsTArray<T*>* generation = &mTracker->mGenerations[mGeneration];
+        if (mIndex < generation->Length()) {
+          ++mIndex;
+          return (*generation)[mIndex - 1];
+        }
+        ++mGeneration;
+        mIndex = 0;
+      }
+      return nullptr;
+    }
+  };
+
+  friend class Iterator;
+
+  bool IsEmpty()
+  {
+    for (uint32_t i = 0; i < K; ++i) {
+      if (!mGenerations[i].IsEmpty()) {
+        return false;
       }
     }
-    
-    class Iterator {
-    private:
-      nsExpirationTracker<T,K>* mTracker;
-      uint32_t                  mGeneration;
-      uint32_t                  mIndex;
-    public:
-      Iterator(nsExpirationTracker<T,K>* aTracker)
-        : mTracker(aTracker), mGeneration(0), mIndex(0) {}
-      T* Next() {
-        while (mGeneration < K) {
-          nsTArray<T*>* generation = &mTracker->mGenerations[mGeneration];
-          if (mIndex < generation->Length()) {
-            ++mIndex;
-            return (*generation)[mIndex - 1];
-          }
-          ++mGeneration;
-          mIndex = 0;
-        }
-        return nullptr;
-      }
-    };
-    
-    friend class Iterator;
-
-    bool IsEmpty() {
-      for (uint32_t i = 0; i < K; ++i) {
-        if (!mGenerations[i].IsEmpty())
-          return false;
-      }
-      return true;
-    }
+    return true;
+  }
 
-  protected:
-    /**
-     * This must be overridden to catch notifications. It is called whenever
-     * we detect that an object has not been used for at least (K-1)*mTimerPeriod
-     * milliseconds. If timer events are not delayed, it will be called within
-     * roughly K*mTimerPeriod milliseconds after the last use. (Unless AgeOneGeneration
-     * or AgeAllGenerations have been called to accelerate the aging process.)
-     * 
-     * NOTE: These bounds ignore delays in timer firings due to actual work being
-     * performed by the browser. We use a slack timer so there is always at least
-     * mTimerPeriod milliseconds between firings, which gives us (K-1)*mTimerPeriod
-     * as a pretty solid lower bound. The upper bound is rather loose, however.
-     * If the maximum amount by which any given timer firing is delayed is D, then
-     * the upper bound before NotifyExpired is called is K*(mTimerPeriod + D).
-     * 
-     * The NotifyExpired call is expected to remove the object from the tracker,
-     * but it need not. The object (or other objects) could be "resurrected"
-     * by calling MarkUsed() on them, or they might just not be removed.
-     * Any objects left over that have not been resurrected or removed
-     * are placed in the new newest-generation, but this is considered "bad form"
-     * and should be avoided (we'll issue a warning). (This recycling counts
-     * as "a use" for the purposes of the expiry guarantee above...)
-     * 
-     * For robustness and simplicity, we allow objects to be notified more than
-     * once here in the same timer tick.
-     */
-    virtual void NotifyExpired(T* aObj) = 0;
+protected:
+  /**
+   * This must be overridden to catch notifications. It is called whenever
+   * we detect that an object has not been used for at least (K-1)*mTimerPeriod
+   * milliseconds. If timer events are not delayed, it will be called within
+   * roughly K*mTimerPeriod milliseconds after the last use. (Unless AgeOneGeneration
+   * or AgeAllGenerations have been called to accelerate the aging process.)
+   *
+   * NOTE: These bounds ignore delays in timer firings due to actual work being
+   * performed by the browser. We use a slack timer so there is always at least
+   * mTimerPeriod milliseconds between firings, which gives us (K-1)*mTimerPeriod
+   * as a pretty solid lower bound. The upper bound is rather loose, however.
+   * If the maximum amount by which any given timer firing is delayed is D, then
+   * the upper bound before NotifyExpired is called is K*(mTimerPeriod + D).
+   *
+   * The NotifyExpired call is expected to remove the object from the tracker,
+   * but it need not. The object (or other objects) could be "resurrected"
+   * by calling MarkUsed() on them, or they might just not be removed.
+   * Any objects left over that have not been resurrected or removed
+   * are placed in the new newest-generation, but this is considered "bad form"
+   * and should be avoided (we'll issue a warning). (This recycling counts
+   * as "a use" for the purposes of the expiry guarantee above...)
+   *
+   * For robustness and simplicity, we allow objects to be notified more than
+   * once here in the same timer tick.
+   */
+  virtual void NotifyExpired(T* aObj) = 0;
 
-  private:
-    class ExpirationTrackerObserver;
-    nsRefPtr<ExpirationTrackerObserver> mObserver;
-    nsTArray<T*>       mGenerations[K];
-    nsCOMPtr<nsITimer> mTimer;
-    uint32_t           mTimerPeriod;
-    uint32_t           mNewestGeneration;
-    bool               mInAgeOneGeneration;
+private:
+  class ExpirationTrackerObserver;
+  nsRefPtr<ExpirationTrackerObserver> mObserver;
+  nsTArray<T*>       mGenerations[K];
+  nsCOMPtr<nsITimer> mTimer;
+  uint32_t           mTimerPeriod;
+  uint32_t           mNewestGeneration;
+  bool               mInAgeOneGeneration;
 
-    /**
-     * Whenever "memory-pressure" is observed, it calls AgeAllGenerations()
-     * to minimize memory usage.
-     */
-    class ExpirationTrackerObserver MOZ_FINAL : public nsIObserver {
-    public:
-      void Init(nsExpirationTracker<T,K> *obj) {
-        mOwner = obj;
-        nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-        if (obs) {
-          obs->AddObserver(this, "memory-pressure", false);
-        }
-      }
-      void Destroy() {
-        mOwner = nullptr;
-        nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
-        if (obs)
-          obs->RemoveObserver(this, "memory-pressure");
-      }
-      NS_DECL_ISUPPORTS
-      NS_DECL_NSIOBSERVER
-    private:
-      nsExpirationTracker<T,K> *mOwner;
-    };
-  
-    static void TimerCallback(nsITimer* aTimer, void* aThis) {
-      nsExpirationTracker* tracker = static_cast<nsExpirationTracker*>(aThis);
-      tracker->AgeOneGeneration();
-      // Cancel the timer if we have no objects to track
-      if (tracker->IsEmpty()) {
-        tracker->mTimer->Cancel();
-        tracker->mTimer = nullptr;
+  /**
+   * Whenever "memory-pressure" is observed, it calls AgeAllGenerations()
+   * to minimize memory usage.
+   */
+  class ExpirationTrackerObserver MOZ_FINAL : public nsIObserver
+  {
+  public:
+    void Init(nsExpirationTracker<T, K>* aObj)
+    {
+      mOwner = aObj;
+      nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
+      if (obs) {
+        obs->AddObserver(this, "memory-pressure", false);
       }
     }
+    void Destroy()
+    {
+      mOwner = nullptr;
+      nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
+      if (obs) {
+        obs->RemoveObserver(this, "memory-pressure");
+      }
+    }
+    NS_DECL_ISUPPORTS
+    NS_DECL_NSIOBSERVER
+  private:
+    nsExpirationTracker<T, K>* mOwner;
+  };
 
-    nsresult CheckStartTimer() {
-      if (mTimer || !mTimerPeriod)
-        return NS_OK;
-      mTimer = do_CreateInstance("@mozilla.org/timer;1");
-      if (!mTimer)
-        return NS_ERROR_OUT_OF_MEMORY;
-      mTimer->InitWithFuncCallback(TimerCallback, this, mTimerPeriod,
-                                   nsITimer::TYPE_REPEATING_SLACK);
+  static void TimerCallback(nsITimer* aTimer, void* aThis)
+  {
+    nsExpirationTracker* tracker = static_cast<nsExpirationTracker*>(aThis);
+    tracker->AgeOneGeneration();
+    // Cancel the timer if we have no objects to track
+    if (tracker->IsEmpty()) {
+      tracker->mTimer->Cancel();
+      tracker->mTimer = nullptr;
+    }
+  }
+
+  nsresult CheckStartTimer()
+  {
+    if (mTimer || !mTimerPeriod) {
       return NS_OK;
     }
+    mTimer = do_CreateInstance("@mozilla.org/timer;1");
+    if (!mTimer) {
+      return NS_ERROR_OUT_OF_MEMORY;
+    }
+    mTimer->InitWithFuncCallback(TimerCallback, this, mTimerPeriod,
+                                 nsITimer::TYPE_REPEATING_SLACK);
+    return NS_OK;
+  }
 };
 
 template<class T, uint32_t K>
 NS_IMETHODIMP
-nsExpirationTracker<T, K>::ExpirationTrackerObserver::Observe(nsISupports     *aSubject,
-                                                              const char      *aTopic,
-                                                              const char16_t *aData)
+nsExpirationTracker<T, K>::ExpirationTrackerObserver::Observe(
+    nsISupports* aSubject, const char* aTopic, const char16_t* aData)
 {
-  if (!strcmp(aTopic, "memory-pressure") && mOwner)
+  if (!strcmp(aTopic, "memory-pressure") && mOwner) {
     mOwner->AgeAllGenerations();
+  }
   return NS_OK;
 }
 
-template <class T, uint32_t K>
+template<class T, uint32_t K>
 NS_IMETHODIMP_(MozExternalRefCountType)
-nsExpirationTracker<T,K>::ExpirationTrackerObserver::AddRef(void)
+nsExpirationTracker<T, K>::ExpirationTrackerObserver::AddRef(void)
 {
   MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt");
   NS_ASSERT_OWNINGTHREAD(ExpirationTrackerObserver);
   ++mRefCnt;
   NS_LOG_ADDREF(this, mRefCnt, "ExpirationTrackerObserver", sizeof(*this));
   return mRefCnt;
 }
 
-template <class T, uint32_t K>
+template<class T, uint32_t K>
 NS_IMETHODIMP_(MozExternalRefCountType)
-nsExpirationTracker<T,K>::ExpirationTrackerObserver::Release(void)
+nsExpirationTracker<T, K>::ExpirationTrackerObserver::Release(void)
 {
   MOZ_ASSERT(int32_t(mRefCnt) > 0, "dup release");
   NS_ASSERT_OWNINGTHREAD(ExpirationTrackerObserver);
   --mRefCnt;
   NS_LOG_RELEASE(this, mRefCnt, "ExpirationTrackerObserver");
   if (mRefCnt == 0) {
     NS_ASSERT_OWNINGTHREAD(ExpirationTrackerObserver);
     mRefCnt = 1; /* stabilize */
     delete (this);
     return 0;
   }
   return mRefCnt;
 }
 
-template <class T, uint32_t K>
+template<class T, uint32_t K>
 NS_IMETHODIMP
-nsExpirationTracker<T,K>::ExpirationTrackerObserver::QueryInterface(REFNSIID aIID, 
-                                                                    void** aInstancePtr)
+nsExpirationTracker<T, K>::ExpirationTrackerObserver::QueryInterface(
+    REFNSIID aIID, void** aInstancePtr)
 {
   NS_ASSERTION(aInstancePtr,
-               "QueryInterface requires a non-NULL destination!");            
+               "QueryInterface requires a non-NULL destination!");
   nsresult rv = NS_ERROR_FAILURE;
   NS_INTERFACE_TABLE(ExpirationTrackerObserver, nsIObserver)
   return rv;
 }
 
 #endif /*NSEXPIRATIONTRACKER_H_*/
--- a/xpcom/ds/nsHashPropertyBag.cpp
+++ b/xpcom/ds/nsHashPropertyBag.cpp
@@ -8,21 +8,21 @@
 #include "nsArray.h"
 #include "nsArrayEnumerator.h"
 #include "nsIVariant.h"
 #include "nsIProperty.h"
 #include "nsVariant.h"
 #include "mozilla/Attributes.h"
 
 nsresult
-NS_NewHashPropertyBag(nsIWritablePropertyBag* *_retval)
+NS_NewHashPropertyBag(nsIWritablePropertyBag** aResult)
 {
-    nsRefPtr<nsHashPropertyBag> hpb = new nsHashPropertyBag();
-    hpb.forget(_retval);
-    return NS_OK;
+  nsRefPtr<nsHashPropertyBag> hpb = new nsHashPropertyBag();
+  hpb.forget(aResult);
+  return NS_OK;
 }
 
 /*
  * nsHashPropertyBag impl
  */
 
 NS_IMPL_ADDREF(nsHashPropertyBag)
 NS_IMPL_RELEASE(nsHashPropertyBag)
@@ -30,132 +30,136 @@ NS_INTERFACE_MAP_BEGIN(nsHashPropertyBag
   NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIPropertyBag, nsIWritablePropertyBag)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWritablePropertyBag)
   NS_INTERFACE_MAP_ENTRY(nsIPropertyBag2)
   NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag2)
 NS_INTERFACE_MAP_END
 
 NS_IMETHODIMP
-nsHashPropertyBag::HasKey(const nsAString& name, bool *aResult)
+nsHashPropertyBag::HasKey(const nsAString& aName, bool* aResult)
 {
-    *aResult = mPropertyHash.Get(name, nullptr);
-
-    return NS_OK;
+  *aResult = mPropertyHash.Get(aName, nullptr);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHashPropertyBag::Get(const nsAString& name, nsIVariant* *_retval)
+nsHashPropertyBag::Get(const nsAString& aName, nsIVariant** aResult)
 {
-    if (!mPropertyHash.Get(name, _retval))
-        *_retval = nullptr;
+  if (!mPropertyHash.Get(aName, aResult)) {
+    *aResult = nullptr;
+  }
 
-    return NS_OK;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHashPropertyBag::GetProperty(const nsAString& name, nsIVariant* *_retval)
+nsHashPropertyBag::GetProperty(const nsAString& aName, nsIVariant** aResult)
 {
-    bool isFound = mPropertyHash.Get(name, _retval);
-    if (!isFound)
-        return NS_ERROR_FAILURE;
+  bool isFound = mPropertyHash.Get(aName, aResult);
+  if (!isFound) {
+    return NS_ERROR_FAILURE;
+  }
 
-    return NS_OK;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHashPropertyBag::SetProperty(const nsAString& name, nsIVariant *value)
+nsHashPropertyBag::SetProperty(const nsAString& aName, nsIVariant* aValue)
 {
-    if (NS_WARN_IF(!value))
-        return NS_ERROR_INVALID_ARG;
+  if (NS_WARN_IF(!aValue)) {
+    return NS_ERROR_INVALID_ARG;
+  }
 
-    mPropertyHash.Put(name, value);
+  mPropertyHash.Put(aName, aValue);
 
-    return NS_OK;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
-nsHashPropertyBag::DeleteProperty(const nsAString& name)
+nsHashPropertyBag::DeleteProperty(const nsAString& aName)
 {
-    // is it too much to ask for ns*Hashtable to return
-    // a boolean indicating whether RemoveEntry succeeded
-    // or not?!?!
-    bool isFound = mPropertyHash.Get(name, nullptr);
-    if (!isFound)
-        return NS_ERROR_FAILURE;
+  // is it too much to ask for ns*Hashtable to return
+  // a boolean indicating whether RemoveEntry succeeded
+  // or not?!?!
+  bool isFound = mPropertyHash.Get(aName, nullptr);
+  if (!isFound) {
+    return NS_ERROR_FAILURE;
+  }
 
-    // then from the hash
-    mPropertyHash.Remove(name);
+  // then from the hash
+  mPropertyHash.Remove(aName);
 
-    return NS_OK;
+  return NS_OK;
 }
 
 
 //
 // nsSimpleProperty class and impl; used for GetEnumerator
 //
 
 class nsSimpleProperty MOZ_FINAL : public nsIProperty
 {
-    ~nsSimpleProperty() {}
+  ~nsSimpleProperty() {}
 
 public:
-    nsSimpleProperty(const nsAString& aName, nsIVariant* aValue)
-        : mName(aName), mValue(aValue)
-    {
-    }
+  nsSimpleProperty(const nsAString& aName, nsIVariant* aValue)
+    : mName(aName)
+    , mValue(aValue)
+  {
+  }
 
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIPROPERTY
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIPROPERTY
 protected:
-    nsString mName;
-    nsCOMPtr<nsIVariant> mValue;
+  nsString mName;
+  nsCOMPtr<nsIVariant> mValue;
 };
 
 NS_IMPL_ISUPPORTS(nsSimpleProperty, nsIProperty)
 
 NS_IMETHODIMP
 nsSimpleProperty::GetName(nsAString& aName)
 {
-    aName.Assign(mName);
-    return NS_OK;
+  aName.Assign(mName);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSimpleProperty::GetValue(nsIVariant* *aValue)
+nsSimpleProperty::GetValue(nsIVariant** aValue)
 {
-    NS_IF_ADDREF(*aValue = mValue);
-    return NS_OK;
+  NS_IF_ADDREF(*aValue = mValue);
+  return NS_OK;
 }
 
 // end nsSimpleProperty
 
 static PLDHashOperator
-PropertyHashToArrayFunc (const nsAString &aKey,
-                         nsIVariant* aData,
-                         void *userArg)
+PropertyHashToArrayFunc(const nsAString& aKey,
+                        nsIVariant* aData,
+                        void* aUserArg)
 {
-    nsIMutableArray *propertyArray =
-        static_cast<nsIMutableArray *>(userArg);
-    nsSimpleProperty *sprop = new nsSimpleProperty(aKey, aData);
-    propertyArray->AppendElement(sprop, false);
-    return PL_DHASH_NEXT;
+  nsIMutableArray* propertyArray = static_cast<nsIMutableArray*>(aUserArg);
+  nsSimpleProperty* sprop = new nsSimpleProperty(aKey, aData);
+  propertyArray->AppendElement(sprop, false);
+  return PL_DHASH_NEXT;
 }
 
 
 NS_IMETHODIMP
-nsHashPropertyBag::GetEnumerator(nsISimpleEnumerator* *_retval)
+nsHashPropertyBag::GetEnumerator(nsISimpleEnumerator** aResult)
 {
-    nsCOMPtr<nsIMutableArray> propertyArray = nsArray::Create();
-    if (!propertyArray)
-        return NS_ERROR_OUT_OF_MEMORY;
+  nsCOMPtr<nsIMutableArray> propertyArray = nsArray::Create();
+  if (!propertyArray) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
 
-    mPropertyHash.EnumerateRead(PropertyHashToArrayFunc, propertyArray.get());
+  mPropertyHash.EnumerateRead(PropertyHashToArrayFunc, propertyArray.get());
 
-    return NS_NewArrayEnumerator(_retval, propertyArray);
+  return NS_NewArrayEnumerator(aResult, propertyArray);
 }
 
 #define IMPL_GETSETPROPERTY_AS(Name, Type) \
 NS_IMETHODIMP \
 nsHashPropertyBag::GetPropertyAs ## Name (const nsAString & prop, Type *_retval) \
 { \
     nsIVariant* v = mPropertyHash.GetWeak(prop); \
     if (!v) \
@@ -175,86 +179,98 @@ IMPL_GETSETPROPERTY_AS(Int32, int32_t)
 IMPL_GETSETPROPERTY_AS(Uint32, uint32_t)
 IMPL_GETSETPROPERTY_AS(Int64, int64_t)
 IMPL_GETSETPROPERTY_AS(Uint64, uint64_t)
 IMPL_GETSETPROPERTY_AS(Double, double)
 IMPL_GETSETPROPERTY_AS(Bool, bool)
 
 
 NS_IMETHODIMP
-nsHashPropertyBag::GetPropertyAsAString(const nsAString & prop, nsAString & _retval)
+nsHashPropertyBag::GetPropertyAsAString(const nsAString& aProp,
+                                        nsAString& aResult)
 {
-    nsIVariant* v = mPropertyHash.GetWeak(prop);
-    if (!v)
-        return NS_ERROR_NOT_AVAILABLE;
-    return v->GetAsAString(_retval);
+  nsIVariant* v = mPropertyHash.GetWeak(aProp);
+  if (!v) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+  return v->GetAsAString(aResult);
 }
 
 NS_IMETHODIMP
-nsHashPropertyBag::GetPropertyAsACString(const nsAString & prop, nsACString & _retval)
+nsHashPropertyBag::GetPropertyAsACString(const nsAString& aProp,
+                                         nsACString& aResult)
 {
-    nsIVariant* v = mPropertyHash.GetWeak(prop);
-    if (!v)
-        return NS_ERROR_NOT_AVAILABLE;
-    return v->GetAsACString(_retval);
+  nsIVariant* v = mPropertyHash.GetWeak(aProp);
+  if (!v) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+  return v->GetAsACString(aResult);
 }
 
 NS_IMETHODIMP
-nsHashPropertyBag::GetPropertyAsAUTF8String(const nsAString & prop, nsACString & _retval)
+nsHashPropertyBag::GetPropertyAsAUTF8String(const nsAString& aProp,
+                                            nsACString& aResult)
 {
-    nsIVariant* v = mPropertyHash.GetWeak(prop);
-    if (!v)
-        return NS_ERROR_NOT_AVAILABLE;
-    return v->GetAsAUTF8String(_retval);
+  nsIVariant* v = mPropertyHash.GetWeak(aProp);
+  if (!v) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+  return v->GetAsAUTF8String(aResult);
 }
 
 NS_IMETHODIMP
-nsHashPropertyBag::GetPropertyAsInterface(const nsAString & prop,
-                                          const nsIID & aIID,
-                                          void** _retval)
+nsHashPropertyBag::GetPropertyAsInterface(const nsAString& aProp,
+                                          const nsIID& aIID,
+                                          void** aResult)
 {
-    nsIVariant* v = mPropertyHash.GetWeak(prop);
-    if (!v)
-        return NS_ERROR_NOT_AVAILABLE;
-    nsCOMPtr<nsISupports> val;
-    nsresult rv = v->GetAsISupports(getter_AddRefs(val));
-    if (NS_FAILED(rv))
-        return rv;
-    if (!val) {
-        // We have a value, but it's null
-        *_retval = nullptr;
-        return NS_OK;
-    }
-    return val->QueryInterface(aIID, _retval);
+  nsIVariant* v = mPropertyHash.GetWeak(aProp);
+  if (!v) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+  nsCOMPtr<nsISupports> val;
+  nsresult rv = v->GetAsISupports(getter_AddRefs(val));
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
+  if (!val) {
+    // We have a value, but it's null
+    *aResult = nullptr;
+    return NS_OK;
+  }
+  return val->QueryInterface(aIID, aResult);
 }
 
 NS_IMETHODIMP
-nsHashPropertyBag::SetPropertyAsAString(const nsAString & prop, const nsAString & value)
+nsHashPropertyBag::SetPropertyAsAString(const nsAString& aProp,
+                                        const nsAString& aValue)
 {
-    nsCOMPtr<nsIWritableVariant> var = new nsVariant();
-    var->SetAsAString(value);
-    return SetProperty(prop, var);
+  nsCOMPtr<nsIWritableVariant> var = new nsVariant();
+  var->SetAsAString(aValue);
+  return SetProperty(aProp, var);
 }
 
 NS_IMETHODIMP
-nsHashPropertyBag::SetPropertyAsACString(const nsAString & prop, const nsACString & value)
+nsHashPropertyBag::SetPropertyAsACString(const nsAString& aProp,
+                                         const nsACString& aValue)
 {
-    nsCOMPtr<nsIWritableVariant> var = new nsVariant();
-    var->SetAsACString(value);
-    return SetProperty(prop, var);
+  nsCOMPtr<nsIWritableVariant> var = new nsVariant();
+  var->SetAsACString(aValue);
+  return SetProperty(aProp, var);
 }
 
 NS_IMETHODIMP
-nsHashPropertyBag::SetPropertyAsAUTF8String(const nsAString & prop, const nsACString & value)
+nsHashPropertyBag::SetPropertyAsAUTF8String(const nsAString& aProp,
+                                            const nsACString& aValue)
 {
-    nsCOMPtr<nsIWritableVariant> var = new nsVariant();
-    var->SetAsAUTF8String(value);
-    return SetProperty(prop, var);
+  nsCOMPtr<nsIWritableVariant> var = new nsVariant();
+  var->SetAsAUTF8String(aValue);
+  return SetProperty(aProp, var);
 }
 
 NS_IMETHODIMP
-nsHashPropertyBag::SetPropertyAsInterface(const nsAString & prop, nsISupports* value)
+nsHashPropertyBag::SetPropertyAsInterface(const nsAString& aProp,
+                                          nsISupports* aValue)
 {
-    nsCOMPtr<nsIWritableVariant> var = new nsVariant();
-    var->SetAsISupports(value);
-    return SetProperty(prop, var);
+  nsCOMPtr<nsIWritableVariant> var = new nsVariant();
+  var->SetAsISupports(aValue);
+  return SetProperty(aProp, var);
 }
 
--- a/xpcom/ds/nsHashPropertyBag.h
+++ b/xpcom/ds/nsHashPropertyBag.h
@@ -6,37 +6,35 @@
 #ifndef nsHashPropertyBag_h___
 #define nsHashPropertyBag_h___
 
 #include "nsIVariant.h"
 #include "nsIWritablePropertyBag.h"
 #include "nsIWritablePropertyBag2.h"
 #include "nsInterfaceHashtable.h"
 
-class nsHashPropertyBag : public nsIWritablePropertyBag
-                               , public nsIWritablePropertyBag2
+class nsHashPropertyBag
+  : public nsIWritablePropertyBag
+  , public nsIWritablePropertyBag2
 {
 public:
-    nsHashPropertyBag() { }
+  nsHashPropertyBag() {}
 
-    NS_DECL_THREADSAFE_ISUPPORTS
-
-    NS_DECL_NSIPROPERTYBAG
+  NS_DECL_THREADSAFE_ISUPPORTS
 
-    NS_DECL_NSIPROPERTYBAG2
+  NS_DECL_NSIPROPERTYBAG
+  NS_DECL_NSIPROPERTYBAG2
 
-    NS_DECL_NSIWRITABLEPROPERTYBAG
-
-    NS_DECL_NSIWRITABLEPROPERTYBAG2
+  NS_DECL_NSIWRITABLEPROPERTYBAG
+  NS_DECL_NSIWRITABLEPROPERTYBAG2
 
 protected:
-    // a hash table of string -> nsIVariant
-    nsInterfaceHashtable<nsStringHashKey, nsIVariant> mPropertyHash;
+  // a hash table of string -> nsIVariant
+  nsInterfaceHashtable<nsStringHashKey, nsIVariant> mPropertyHash;
 
-    virtual ~nsHashPropertyBag() {}
+  virtual ~nsHashPropertyBag() {}
 };
 
 // Note: NS_NewHashPropertyBag returns a HPB that
 // uses a non-thread-safe internal hash
-extern "C" nsresult
-NS_NewHashPropertyBag(nsIWritablePropertyBag* *_retval);
+extern "C" nsresult NS_NewHashPropertyBag(nsIWritablePropertyBag** aResult);
 
 #endif /* nsHashPropertyBag_h___ */
--- a/xpcom/ds/nsINIParserImpl.cpp
+++ b/xpcom/ds/nsINIParserImpl.cpp
@@ -4,126 +4,131 @@
 
 #include "nsINIParserImpl.h"
 
 #include "nsINIParser.h"
 #include "nsStringEnumerator.h"
 #include "nsTArray.h"
 #include "mozilla/Attributes.h"
 
-class nsINIParserImpl MOZ_FINAL :
-  public nsIINIParser
+class nsINIParserImpl MOZ_FINAL
+  : public nsIINIParser
 {
   ~nsINIParserImpl() {}
 
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIINIPARSER
 
-  nsresult Init(nsIFile* aINIFile) {
-    return mParser.Init(aINIFile);
-  }
+  nsresult Init(nsIFile* aINIFile) { return mParser.Init(aINIFile); }
 
 private:
   nsINIParser mParser;
 };
 
 NS_IMPL_ISUPPORTS(nsINIParserFactory,
                   nsIINIParserFactory,
                   nsIFactory)
 
 NS_IMETHODIMP
 nsINIParserFactory::CreateINIParser(nsIFile* aINIFile,
-                                    nsIINIParser* *aResult)
+                                    nsIINIParser** aResult)
 {
   *aResult = nullptr;
 
   nsRefPtr<nsINIParserImpl> p(new nsINIParserImpl());
-  if (!p)
+  if (!p) {
     return NS_ERROR_OUT_OF_MEMORY;
+  }
 
   nsresult rv = p->Init(aINIFile);
 
-  if (NS_SUCCEEDED(rv))
+  if (NS_SUCCEEDED(rv)) {
     NS_ADDREF(*aResult = p);
+  }
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsINIParserFactory::CreateInstance(nsISupports* aOuter,
                                    REFNSIID aIID,
-                                   void **aResult)
+                                   void** aResult)
 {
-  if (NS_WARN_IF(aOuter))
+  if (NS_WARN_IF(aOuter)) {
     return NS_ERROR_NO_AGGREGATION;
+  }
 
   // We are our own singleton.
   return QueryInterface(aIID, aResult);
 }
 
 NS_IMETHODIMP
 nsINIParserFactory::LockFactory(bool aLock)
 {
   return NS_OK;
 }
 
 NS_IMPL_ISUPPORTS(nsINIParserImpl,
                   nsIINIParser)
 
 static bool
-SectionCB(const char* aSection, void *aClosure)
+SectionCB(const char* aSection, void* aClosure)
 {
-  nsTArray<nsCString> *strings = static_cast<nsTArray<nsCString>*>(aClosure);
-
+  nsTArray<nsCString>* strings = static_cast<nsTArray<nsCString>*>(aClosure);
   strings->AppendElement(nsDependentCString(aSection));
   return true;
 }
 
 NS_IMETHODIMP
-nsINIParserImpl::GetSections(nsIUTF8StringEnumerator* *aResult)
+nsINIParserImpl::GetSections(nsIUTF8StringEnumerator** aResult)
 {
-  nsTArray<nsCString> *strings = new nsTArray<nsCString>;
-  if (!strings)
+  nsTArray<nsCString>* strings = new nsTArray<nsCString>;
+  if (!strings) {
     return NS_ERROR_OUT_OF_MEMORY;
+  }
 
   nsresult rv = mParser.GetSections(SectionCB, strings);
-  if (NS_SUCCEEDED(rv))
+  if (NS_SUCCEEDED(rv)) {
     rv = NS_NewAdoptingUTF8StringEnumerator(aResult, strings);
+  }
 
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     delete strings;
+  }
 
   return rv;
 }
 
 static bool
-KeyCB(const char* aKey, const char *aValue, void *aClosure)
+KeyCB(const char* aKey, const char* aValue, void* aClosure)
 {
-  nsTArray<nsCString> *strings = static_cast<nsTArray<nsCString>*>(aClosure);
-
+  nsTArray<nsCString>* strings = static_cast<nsTArray<nsCString>*>(aClosure);
   strings->AppendElement(nsDependentCString(aKey));
   return true;
 }
 
 NS_IMETHODIMP
 nsINIParserImpl::GetKeys(const nsACString& aSection,
-                         nsIUTF8StringEnumerator* *aResult)
+                         nsIUTF8StringEnumerator** aResult)
 {
-  nsTArray<nsCString> *strings = new nsTArray<nsCString>;
-  if (!strings)
+  nsTArray<nsCString>* strings = new nsTArray<nsCString>;
+  if (!strings) {
     return NS_ERROR_OUT_OF_MEMORY;
+  }
 
   nsresult rv = mParser.GetStrings(PromiseFlatCString(aSection).get(),
                                    KeyCB, strings);
-  if (NS_SUCCEEDED(rv))
+  if (NS_SUCCEEDED(rv)) {
     rv = NS_NewAdoptingUTF8StringEnumerator(aResult, strings);
+  }
 
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     delete strings;
+  }
 
   return rv;
 
 }
 
 NS_IMETHODIMP
 nsINIParserImpl::GetString(const nsACString& aSection,
                            const nsACString& aKey,
--- a/xpcom/ds/nsINIParserImpl.h
+++ b/xpcom/ds/nsINIParserImpl.h
@@ -11,19 +11,19 @@
 
 #define NS_INIPARSERFACTORY_CID \
 { 0xdfac10a9, 0xdd24, 0x43cf, \
   { 0xa0, 0x95, 0x6f, 0xfa, 0x2e, 0x4b, 0x6a, 0x6c } }
 
 #define NS_INIPARSERFACTORY_CONTRACTID \
   "@mozilla.org/xpcom/ini-parser-factory;1"
 
-class nsINIParserFactory MOZ_FINAL :
-  public nsIINIParserFactory,
-  public nsIFactory
+class nsINIParserFactory MOZ_FINAL
+  : public nsIINIParserFactory
+  , public nsIFactory
 {
   ~nsINIParserFactory() {}
 
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIINIPARSERFACTORY
   NS_DECL_NSIFACTORY
 };
--- a/xpcom/ds/nsMathUtils.h
+++ b/xpcom/ds/nsMathUtils.h
@@ -14,108 +14,115 @@
 
 #ifdef SOLARIS
 #include <ieeefp.h>
 #endif
 
 /*
  * round
  */
-inline double NS_round(double x)
-{
-    return x >= 0.0 ? floor(x + 0.5) : ceil(x - 0.5);
-}
-inline float NS_roundf(float x)
+inline double
+NS_round(double aNum)
 {
-    return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f);
+  return aNum >= 0.0 ? floor(aNum + 0.5) : ceil(aNum - 0.5);
 }
-inline int32_t NS_lround(double x)
+inline float
+NS_roundf(float aNum)
 {
-    return x >= 0.0 ? int32_t(x + 0.5) : int32_t(x - 0.5);
+  return aNum >= 0.0f ? floorf(aNum + 0.5f) : ceilf(aNum - 0.5f);
+}
+inline int32_t
+NS_lround(double aNum)
+{
+  return aNum >= 0.0 ? int32_t(aNum + 0.5) : int32_t(aNum - 0.5);
 }
 
 /* NS_roundup30 rounds towards infinity for positive and       */
 /* negative numbers.                                           */
 
 #if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__) && !defined(__clang__)
 inline int32_t NS_lroundup30(float x)
 {
-    /* Code derived from Laurent de Soras' paper at             */
-    /* http://ldesoras.free.fr/doc/articles/rounding_en.pdf     */
+  /* Code derived from Laurent de Soras' paper at             */
+  /* http://ldesoras.free.fr/doc/articles/rounding_en.pdf     */
 
-    /* Rounding up on Windows is expensive using the float to   */
-    /* int conversion and the floor function. A faster          */
-    /* approach is to use f87 rounding while assuming the       */
-    /* default rounding mode of rounding to the nearest         */
-    /* integer. This rounding mode, however, actually rounds    */
-    /* to the nearest integer so we add the floating point      */
-    /* number to itself and add our rounding factor before      */
-    /* doing the conversion to an integer. We then do a right   */
-    /* shift of one bit on the integer to divide by two.        */
+  /* Rounding up on Windows is expensive using the float to   */
+  /* int conversion and the floor function. A faster          */
+  /* approach is to use f87 rounding while assuming the       */
+  /* default rounding mode of rounding to the nearest         */
+  /* integer. This rounding mode, however, actually rounds    */
+  /* to the nearest integer so we add the floating point      */
+  /* number to itself and add our rounding factor before      */
+  /* doing the conversion to an integer. We then do a right   */
+  /* shift of one bit on the integer to divide by two.        */
 
-    /* This routine doesn't handle numbers larger in magnitude  */
-    /* than 2^30 but this is fine for NSToCoordRound because    */
-    /* Coords are limited to 2^30 in magnitude.                 */
+  /* This routine doesn't handle numbers larger in magnitude  */
+  /* than 2^30 but this is fine for NSToCoordRound because    */
+  /* Coords are limited to 2^30 in magnitude.                 */
 
-    static const double round_to_nearest = 0.5f;
-    int i;
+  static const double round_to_nearest = 0.5f;
+  int i;
 
-    __asm {
-      fld     x                   ; load fp argument
-      fadd    st, st(0)           ; double it
-      fadd    round_to_nearest    ; add the rounding factor
-      fistp   dword ptr i         ; convert the result to int
-    }
-    return i >> 1;                /* divide by 2 */
+  __asm {
+    fld     x                   ; load fp argument
+    fadd    st, st(0)           ; double it
+    fadd    round_to_nearest    ; add the rounding factor
+    fistp   dword ptr i         ; convert the result to int
+  }
+  return i >> 1;                /* divide by 2 */
 }
 #endif /* XP_WIN32 && _M_IX86 && !__GNUC__ */
 
-inline int32_t NS_lroundf(float x)
+inline int32_t
+NS_lroundf(float aNum)
 {
-    return x >= 0.0f ? int32_t(x + 0.5f) : int32_t(x - 0.5f);
+  return aNum >= 0.0f ? int32_t(aNum + 0.5f) : int32_t(aNum - 0.5f);
 }
 
 /*
  * hypot.  We don't need a super accurate version of this, if a platform
  * turns up with none of the possibilities below it would be okay to fall
  * back to sqrt(x*x + y*y).
  */
-inline double NS_hypot(double x, double y)
+inline double
+NS_hypot(double aNum1, double aNum2)
 {
 #ifdef __GNUC__
-    return __builtin_hypot(x, y);
+  return __builtin_hypot(aNum1, aNum2);
 #elif defined _WIN32
-    return _hypot(x, y);
+  return _hypot(aNum1, aNum2);
 #else
-    return hypot(x, y);
+  return hypot(aNum1, aNum2);
 #endif
 }
 
 /**
  * Check whether a floating point number is finite (not +/-infinity and not a
  * NaN value).
  */
-inline bool NS_finite(double d)
+inline bool
+NS_finite(double aNum)
 {
 #ifdef WIN32
-    // NOTE: '!!' casts an int to bool without spamming MSVC warning C4800.
-    return !!_finite(d);
+  // NOTE: '!!' casts an int to bool without spamming MSVC warning C4800.
+  return !!_finite(aNum);
 #elif defined(XP_DARWIN)
-    // Darwin has deprecated |finite| and recommends |isfinite|. The former is
-    // not present in the iOS SDK.
-    return std::isfinite(d);
+  // Darwin has deprecated |finite| and recommends |isfinite|. The former is
+  // not present in the iOS SDK.
+  return std::isfinite(aNum);
 #else
-    return finite(d);
+  return finite(aNum);
 #endif
 }
 
 /**
  * Returns the result of the modulo of x by y using a floored division.
  * fmod(x, y) is using a truncated division.
  * The main difference is that the result of this method will have the sign of
  * y while the result of fmod(x, y) will have the sign of x.
  */
-inline double NS_floorModulo(double x, double y)
+inline double
+NS_floorModulo(double aNum1, double aNum2)
 {
-  return (x - y * floor(x / y));
+  return (aNum1 - aNum2 * floor(aNum1 / aNum2));
 }
 
 #endif
--- a/xpcom/ds/nsObserverList.cpp
+++ b/xpcom/ds/nsObserverList.cpp
@@ -8,129 +8,133 @@
 #include "nsAutoPtr.h"
 #include "nsCOMArray.h"
 #include "nsISimpleEnumerator.h"
 #include "xpcpublic.h"
 
 nsresult
 nsObserverList::AddObserver(nsIObserver* anObserver, bool ownsWeak)
 {
-    NS_ASSERTION(anObserver, "Null input");
+  NS_ASSERTION(anObserver, "Null input");
 
-    if (!ownsWeak) {
-        ObserverRef* o = mObservers.AppendElement(anObserver);
-        if (!o)
-            return NS_ERROR_OUT_OF_MEMORY;
-
-        return NS_OK;
+  if (!ownsWeak) {
+    ObserverRef* o = mObservers.AppendElement(anObserver);
+    if (!o) {
+      return NS_ERROR_OUT_OF_MEMORY;
     }
-        
-    nsCOMPtr<nsIWeakReference> weak = do_GetWeakReference(anObserver);
-    if (!weak)
-        return NS_NOINTERFACE;
-
-    ObserverRef *o = mObservers.AppendElement(weak);
-    if (!o)
-        return NS_ERROR_OUT_OF_MEMORY;
 
     return NS_OK;
+  }
+
+  nsCOMPtr<nsIWeakReference> weak = do_GetWeakReference(anObserver);
+  if (!weak) {
+    return NS_NOINTERFACE;
+  }
+
+  ObserverRef* o = mObservers.AppendElement(weak);
+  if (!o) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
+
+  return NS_OK;
 }
 
 nsresult
 nsObserverList::RemoveObserver(nsIObserver* anObserver)
 {
-    NS_ASSERTION(anObserver, "Null input");
+  NS_ASSERTION(anObserver, "Null input");
 
-    if (mObservers.RemoveElement(static_cast<nsISupports*>(anObserver)))
-        return NS_OK;
+  if (mObservers.RemoveElement(static_cast<nsISupports*>(anObserver))) {
+    return NS_OK;
+  }
 
-    nsCOMPtr<nsIWeakReference> observerRef = do_GetWeakReference(anObserver);
-    if (!observerRef)
-        return NS_ERROR_FAILURE;
+  nsCOMPtr<nsIWeakReference> observerRef = do_GetWeakReference(anObserver);
+  if (!observerRef) {
+    return NS_ERROR_FAILURE;
+  }
 
-    if (!mObservers.RemoveElement(observerRef))
-        return NS_ERROR_FAILURE;
+  if (!mObservers.RemoveElement(observerRef)) {
+    return NS_ERROR_FAILURE;
+  }
 
-    return NS_OK;
+  return NS_OK;
 }
 
 nsresult
 nsObserverList::GetObserverList(nsISimpleEnumerator** anEnumerator)
 {
-    nsRefPtr<nsObserverEnumerator> e(new nsObserverEnumerator(this));
-    e.forget(anEnumerator);
-    return NS_OK;
+  nsRefPtr<nsObserverEnumerator> e(new nsObserverEnumerator(this));
+  e.forget(anEnumerator);
+  return NS_OK;
 }
 
 void
-nsObserverList::FillObserverArray(nsCOMArray<nsIObserver> &aArray)
+nsObserverList::FillObserverArray(nsCOMArray<nsIObserver>& aArray)
 {
-    aArray.SetCapacity(mObservers.Length());
+  aArray.SetCapacity(mObservers.Length());
 
-    nsTArray<ObserverRef> observers(mObservers);
+  nsTArray<ObserverRef> observers(mObservers);
 
-    for (int32_t i = observers.Length() - 1; i >= 0; --i) {
-        if (observers[i].isWeakRef) {
-            nsCOMPtr<nsIObserver> o(do_QueryReferent(observers[i].asWeak()));
-            if (o) {
-                aArray.AppendObject(o);
-            }
-            else {
-                // the object has gone away, remove the weakref
-                mObservers.RemoveElement(observers[i].asWeak());
-            }
-        }
-        else {
-            aArray.AppendObject(observers[i].asObserver());
-        }
+  for (int32_t i = observers.Length() - 1; i >= 0; --i) {
+    if (observers[i].isWeakRef) {
+      nsCOMPtr<nsIObserver> o(do_QueryReferent(observers[i].asWeak()));
+      if (o) {
+        aArray.AppendObject(o);
+      } else {
+        // the object has gone away, remove the weakref
+        mObservers.RemoveElement(observers[i].asWeak());
+      }
+    } else {
+      aArray.AppendObject(observers[i].asObserver());
     }
+  }
 }
 
 void
-nsObserverList::NotifyObservers(nsISupports *aSubject,
-                                const char *aTopic,
-                                const char16_t *someData)
+nsObserverList::NotifyObservers(nsISupports* aSubject,
+                                const char* aTopic,
+                                const char16_t* someData)
 {
-    nsCOMArray<nsIObserver> observers;
-    FillObserverArray(observers);
+  nsCOMArray<nsIObserver> observers;
+  FillObserverArray(observers);
 
-    for (int32_t i = 0; i < observers.Count(); ++i) {
-        observers[i]->Observe(aSubject, aTopic, someData);
-    }
+  for (int32_t i = 0; i < observers.Count(); ++i) {
+    observers[i]->Observe(aSubject, aTopic, someData);
+  }
 }
 
 void
 nsObserverList::UnmarkGrayStrongObservers()
 {
-    for (uint32_t i = 0; i < mObservers.Length(); ++i) {
-        if (!mObservers[i].isWeakRef) {
-            xpc_TryUnmarkWrappedGrayObject(mObservers[i].asObserver());
-        }
+  for (uint32_t i = 0; i < mObservers.Length(); ++i) {
+    if (!mObservers[i].isWeakRef) {
+      xpc_TryUnmarkWrappedGrayObject(mObservers[i].asObserver());
     }
+  }
 }
 
 NS_IMPL_ISUPPORTS(nsObserverEnumerator, nsISimpleEnumerator)
 
 nsObserverEnumerator::nsObserverEnumerator(nsObserverList* aObserverList)
-    : mIndex(0)
+  : mIndex(0)
 {
-    aObserverList->FillObserverArray(mObservers);
+  aObserverList->FillObserverArray(mObservers);
 }
 
 NS_IMETHODIMP
-nsObserverEnumerator::HasMoreElements(bool *aResult)
+nsObserverEnumerator::HasMoreElements(bool* aResult)
 {
-    *aResult = (mIndex < mObservers.Count());
-    return NS_OK;
+  *aResult = (mIndex < mObservers.Count());
+  return NS_OK;
 }
 
 NS_IMETHODIMP
-nsObserverEnumerator::GetNext(nsISupports* *aResult)
+nsObserverEnumerator::GetNext(nsISupports** aResult)
 {
-    if (mIndex == mObservers.Count()) {
-        NS_ERROR("Enumerating after HasMoreElements returned false.");
-        return NS_ERROR_UNEXPECTED;
-    }
+  if (mIndex == mObservers.Count()) {
+    NS_ERROR("Enumerating after HasMoreElements returned false.");
+    return NS_ERROR_UNEXPECTED;
+  }
 
-    NS_ADDREF(*aResult = mObservers[mIndex]);
-    ++mIndex;
-    return NS_OK;
+  NS_ADDREF(*aResult = mObservers[mIndex]);
+  ++mIndex;
+  return NS_OK;
 }
--- a/xpcom/ds/nsObserverList.h
+++ b/xpcom/ds/nsObserverList.h
@@ -17,76 +17,81 @@
 #include "mozilla/Attributes.h"
 
 namespace mozilla {
 class ObserverServiceReporter;
 } // namespace mozilla
 
 struct ObserverRef
 {
-  ObserverRef(const ObserverRef& o) :
-    isWeakRef(o.isWeakRef), ref(o.ref) { }
-  
-  ObserverRef(nsIObserver* aObserver) : isWeakRef(false), ref(aObserver) { }
-  ObserverRef(nsIWeakReference* aWeak) : isWeakRef(true), ref(aWeak) { }
+  ObserverRef(const ObserverRef& aO) : isWeakRef(aO.isWeakRef), ref(aO.ref) {}
+  ObserverRef(nsIObserver* aObserver) : isWeakRef(false), ref(aObserver) {}
+  ObserverRef(nsIWeakReference* aWeak) : isWeakRef(true), ref(aWeak) {}
 
   bool isWeakRef;
   nsCOMPtr<nsISupports> ref;
 
-  nsIObserver* asObserver() {
+  nsIObserver* asObserver()
+  {
     NS_ASSERTION(!isWeakRef, "Isn't a strong ref.");
-    return static_cast<nsIObserver*>((nsISupports*) ref);
+    return static_cast<nsIObserver*>((nsISupports*)ref);
   }
 
-  nsIWeakReference* asWeak() {
+  nsIWeakReference* asWeak()
+  {
     NS_ASSERTION(isWeakRef, "Isn't a weak ref.");
-    return static_cast<nsIWeakReference*>((nsISupports*) ref);
+    return static_cast<nsIWeakReference*>((nsISupports*)ref);
   }
 
-  bool operator==(nsISupports* b) const { return ref == b; }
+  bool operator==(nsISupports* aRhs) const { return ref == aRhs; }
 };
 
 class nsObserverList : public nsCharPtrHashKey
 {
   friend class nsObserverService;
 
 public:
-  nsObserverList(const char *key) : nsCharPtrHashKey(key)
-  { MOZ_COUNT_CTOR(nsObserverList); }
-
-  ~nsObserverList() { MOZ_COUNT_DTOR(nsObserverList); }
+  nsObserverList(const char* aKey) : nsCharPtrHashKey(aKey)
+  {
+    MOZ_COUNT_CTOR(nsObserverList);
+  }
 
-  nsresult AddObserver(nsIObserver* anObserver, bool ownsWeak);
-  nsresult RemoveObserver(nsIObserver* anObserver);
+  ~nsObserverList()
+  {
+    MOZ_COUNT_DTOR(nsObserverList);
+  }
 
-  void NotifyObservers(nsISupports *aSubject,
-                       const char *aTopic,
-                       const char16_t *someData);
-  nsresult GetObserverList(nsISimpleEnumerator** anEnumerator);
+  nsresult AddObserver(nsIObserver* aObserver, bool aOwnsWeak);
+  nsresult RemoveObserver(nsIObserver* aObserver);
+
+  void NotifyObservers(nsISupports* aSubject,
+                       const char* aTopic,
+                       const char16_t* aSomeData);
+  nsresult GetObserverList(nsISimpleEnumerator** aEnumerator);
 
   // Fill an array with the observers of this category.
   // The array is filled in last-added-first order.
-  void FillObserverArray(nsCOMArray<nsIObserver> &aArray);
+  void FillObserverArray(nsCOMArray<nsIObserver>& aArray);
 
   // Unmark any strongly held observers implemented in JS so the cycle
   // collector will not traverse them.
   void UnmarkGrayStrongObservers();
 
 private:
   nsTArray<ObserverRef> mObservers;
 };
 
 class nsObserverEnumerator MOZ_FINAL : public nsISimpleEnumerator
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISIMPLEENUMERATOR
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISIMPLEENUMERATOR
 
-    nsObserverEnumerator(nsObserverList* aObserverList);
+  nsObserverEnumerator(nsObserverList* aObserverList);
 
 private:
-    ~nsObserverEnumerator() { }
+  ~nsObserverEnumerator() {}
 
-    int32_t mIndex; // Counts up from 0
-    nsCOMArray<nsIObserver> mObservers;
+  int32_t mIndex; // Counts up from 0
+  nsCOMArray<nsIObserver> mObservers;
 };
 
 #endif /* nsObserverList_h___ */
--- a/xpcom/ds/nsObserverService.cpp
+++ b/xpcom/ds/nsObserverService.cpp
@@ -24,309 +24,337 @@
 //    set NSPR_LOG_MODULES=ObserverService:5
 //    set NSPR_LOG_FILE=nspr.log
 //
 // this enables PR_LOG_DEBUG level information and places all output in
 // the file nspr.log
 static PRLogModuleInfo*
 GetObserverServiceLog()
 {
-    static PRLogModuleInfo *sLog;
-    if (!sLog)
-        sLog = PR_NewLogModule("ObserverService");
-    return sLog;
+  static PRLogModuleInfo* sLog;
+  if (!sLog) {
+    sLog = PR_NewLogModule("ObserverService");
+  }
+  return sLog;
 }
   #define LOG(x)  PR_LOG(GetObserverServiceLog(), PR_LOG_DEBUG, x)
 #else
   #define LOG(x)
 #endif /* PR_LOGGING */
 
 namespace mozilla {
 
-struct SuspectObserver {
-    SuspectObserver(const char* aTopic, size_t aReferentCount)
-        : topic(aTopic), referentCount(aReferentCount) {}
-    const char* topic;
-    size_t referentCount;
+struct SuspectObserver
+{
+  SuspectObserver(const char* aTopic, size_t aReferentCount)
+    : topic(aTopic)
+    , referentCount(aReferentCount)
+  {
+  }
+  const char* topic;
+  size_t referentCount;
 };
 
-struct ObserverServiceReferentCount {
-    ObserverServiceReferentCount()
-        : numStrong(0), numWeakAlive(0), numWeakDead(0) {}
-    size_t numStrong;
-    size_t numWeakAlive;
-    size_t numWeakDead;
-    nsTArray<SuspectObserver> suspectObservers;
+struct ObserverServiceReferentCount
+{
+  ObserverServiceReferentCount()
+    : numStrong(0)
+    , numWeakAlive(0)
+    , numWeakDead(0)
+  {
+  }
+  size_t numStrong;
+  size_t numWeakAlive;
+  size_t numWeakDead;
+  nsTArray<SuspectObserver> suspectObservers;
 };
 
 } // namespace mozilla
 
 using namespace mozilla;
 
 PLDHashOperator
 nsObserverService::CountReferents(nsObserverList* aObserverList,
                                   void* aClosure)
 {
-    if (!aObserverList) {
-        return PL_DHASH_NEXT;
-    }
+  if (!aObserverList) {
+    return PL_DHASH_NEXT;
+  }
 
-    ObserverServiceReferentCount* referentCount =
-        static_cast<ObserverServiceReferentCount*>(aClosure);
+  ObserverServiceReferentCount* referentCount =
+    static_cast<ObserverServiceReferentCount*>(aClosure);
 
-    size_t numStrong = 0;
-    size_t numWeakAlive = 0;
-    size_t numWeakDead = 0;
+  size_t numStrong = 0;
+  size_t numWeakAlive = 0;
+  size_t numWeakDead = 0;
 
-    nsTArray<ObserverRef>& observers = aObserverList->mObservers;
-    for (uint32_t i = 0; i < observers.Length(); i++) {
-        if (observers[i].isWeakRef) {
-            nsCOMPtr<nsIObserver> observerRef(
-                do_QueryReferent(observers[i].asWeak()));
-            if (observerRef) {
-                numWeakAlive++;
-            } else {
-                numWeakDead++;
-            }
-        } else {
-            numStrong++;
-        }
+  nsTArray<ObserverRef>& observers = aObserverList->mObservers;
+  for (uint32_t i = 0; i < observers.Length(); i++) {
+    if (observers[i].isWeakRef) {
+      nsCOMPtr<nsIObserver> observerRef(
+        do_QueryReferent(observers[i].asWeak()));
+      if (observerRef) {
+        numWeakAlive++;
+      } else {
+        numWeakDead++;
+      }
+    } else {
+      numStrong++;
     }
+  }
 
-    referentCount->numStrong += numStrong;
-    referentCount->numWeakAlive += numWeakAlive;
-    referentCount->numWeakDead += numWeakDead;
+  referentCount->numStrong += numStrong;
+  referentCount->numWeakAlive += numWeakAlive;
+  referentCount->numWeakDead += numWeakDead;
 
-    // Keep track of topics that have a suspiciously large number
-    // of referents (symptom of leaks).
-    size_t total = numStrong + numWeakAlive + numWeakDead;
-    if (total > kSuspectReferentCount) {
-        SuspectObserver suspect(aObserverList->GetKey(), total);
-        referentCount->suspectObservers.AppendElement(suspect);
-    }
+  // Keep track of topics that have a suspiciously large number
+  // of referents (symptom of leaks).
+  size_t total = numStrong + numWeakAlive + numWeakDead;
+  if (total > kSuspectReferentCount) {
+    SuspectObserver suspect(aObserverList->GetKey(), total);
+    referentCount->suspectObservers.AppendElement(suspect);
+  }
 
-    return PL_DHASH_NEXT;
+  return PL_DHASH_NEXT;
 }
 
 NS_IMETHODIMP
 nsObserverService::CollectReports(nsIHandleReportCallback* aHandleReport,
                                   nsISupports* aData, bool aAnonymize)
 {
-    ObserverServiceReferentCount referentCount;
-    mObserverTopicTable.EnumerateEntries(CountReferents, &referentCount);
+  ObserverServiceReferentCount referentCount;
+  mObserverTopicTable.EnumerateEntries(CountReferents, &referentCount);
 
-    // These aren't privacy-sensitive and so don't need anonymizing.
-    nsresult rv;
-    for (uint32_t i = 0; i < referentCount.suspectObservers.Length(); i++) {
-        SuspectObserver& suspect = referentCount.suspectObservers[i];
-        nsPrintfCString suspectPath("observer-service-suspect/"
-                                    "referent(topic=%s)",
-                                    suspect.topic);
-        rv = aHandleReport->Callback(/* process */ EmptyCString(),
-            suspectPath, KIND_OTHER, UNITS_COUNT, suspect.referentCount,
-            NS_LITERAL_CSTRING("A topic with a suspiciously large number of "
-                               "referents.  This may be symptomatic of a leak "
-                               "if the number of referents is high with "
-                               "respect to the number of windows."),
-            aData);
+  // These aren't privacy-sensitive and so don't need anonymizing.
+  nsresult rv;
+  for (uint32_t i = 0; i < referentCount.suspectObservers.Length(); i++) {
+    SuspectObserver& suspect = referentCount.suspectObservers[i];
+    nsPrintfCString suspectPath("observer-service-suspect/"
+                                "referent(topic=%s)",
+                                suspect.topic);
+    rv = aHandleReport->Callback(
+      /* process */ EmptyCString(),
+      suspectPath, KIND_OTHER, UNITS_COUNT, suspect.referentCount,
+      NS_LITERAL_CSTRING("A topic with a suspiciously large number of "
+                         "referents.  This may be symptomatic of a leak "
+                         "if the number of referents is high with "
+                         "respect to the number of windows."),
+      aData);
 
-      if (NS_WARN_IF(NS_FAILED(rv)))
-          return rv;
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
     }
+  }
 
-    rv = aHandleReport->Callback(/* process */ EmptyCString(),
-        NS_LITERAL_CSTRING("observer-service/referent/strong"),
-        KIND_OTHER, UNITS_COUNT, referentCount.numStrong,
-        NS_LITERAL_CSTRING("The number of strong references held by the "
-                           "observer service."),
-        aData);
+  rv = aHandleReport->Callback(
+         /* process */ EmptyCString(),
+         NS_LITERAL_CSTRING("observer-service/referent/strong"),
+         KIND_OTHER, UNITS_COUNT, referentCount.numStrong,
+         NS_LITERAL_CSTRING("The number of strong references held by the "
+                            "observer service."),
+         aData);
 
-    if (NS_WARN_IF(NS_FAILED(rv)))
-        return rv;
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return rv;
+  }
 
-    rv = aHandleReport->Callback(/* process */ EmptyCString(),
-        NS_LITERAL_CSTRING("observer-service/referent/weak/alive"),
-        KIND_OTHER, UNITS_COUNT, referentCount.numWeakAlive,
-        NS_LITERAL_CSTRING("The number of weak references held by the "
-                           "observer service that are still alive."),
-        aData);
+  rv = aHandleReport->Callback(
+         /* process */ EmptyCString(),
+         NS_LITERAL_CSTRING("observer-service/referent/weak/alive"),
+         KIND_OTHER, UNITS_COUNT, referentCount.numWeakAlive,
+         NS_LITERAL_CSTRING("The number of weak references held by the "
+                            "observer service that are still alive."),
+         aData);
 
-    if (NS_WARN_IF(NS_FAILED(rv)))
-        return rv;
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return rv;
+  }
 
-    rv = aHandleReport->Callback(/* process */ EmptyCString(),
-        NS_LITERAL_CSTRING("observer-service/referent/weak/dead"),
-        KIND_OTHER, UNITS_COUNT, referentCount.numWeakDead,
-        NS_LITERAL_CSTRING("The number of weak references held by the "
-                           "observer service that are dead."),
-        aData);
+  rv = aHandleReport->Callback(
+         /* process */ EmptyCString(),
+         NS_LITERAL_CSTRING("observer-service/referent/weak/dead"),
+         KIND_OTHER, UNITS_COUNT, referentCount.numWeakDead,
+         NS_LITERAL_CSTRING("The number of weak references held by the "
+                            "observer service that are dead."),
+         aData);
 
-    if (NS_WARN_IF(NS_FAILED(rv)))
-        return rv;
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return rv;
+  }
 
-    return NS_OK;
+  return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsObserverService Implementation
 
 
-NS_IMPL_ISUPPORTS(
-    nsObserverService,
-    nsIObserverService,
-    nsObserverService,
-    nsIMemoryReporter)
+NS_IMPL_ISUPPORTS(nsObserverService,
+                  nsIObserverService,
+                  nsObserverService,
+                  nsIMemoryReporter)
 
-nsObserverService::nsObserverService() :
-    mShuttingDown(false)
+nsObserverService::nsObserverService()
+  : mShuttingDown(false)
 {
 }
 
 nsObserverService::~nsObserverService(void)
 {
-    Shutdown();
+  Shutdown();
 }
 
 void
 nsObserverService::RegisterReporter()
 {
-    RegisterWeakMemoryReporter(this);
+  RegisterWeakMemoryReporter(this);
 }
 
 void
 nsObserverService::Shutdown()
 {
-    UnregisterWeakMemoryReporter(this);
+  UnregisterWeakMemoryReporter(this);
 
-    mShuttingDown = true;
+  mShuttingDown = true;
 
-    mObserverTopicTable.Clear();
+  mObserverTopicTable.Clear();
 }
 
 nsresult
-nsObserverService::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
+nsObserverService::Create(nsISupports* aOuter, const nsIID& aIID,
+                          void** aInstancePtr)
 {
-    LOG(("nsObserverService::Create()"));
+  LOG(("nsObserverService::Create()"));
 
-    nsRefPtr<nsObserverService> os = new nsObserverService();
-
-    if (!os)
-        return NS_ERROR_OUT_OF_MEMORY;
+  nsRefPtr<nsObserverService> os = new nsObserverService();
 
-    // The memory reporter can not be immediately registered here because
-    // the nsMemoryReporterManager may attempt to get the nsObserverService
-    // during initialization, causing a recursive GetService.
-    nsRefPtr<nsRunnableMethod<nsObserverService> > registerRunnable =
-        NS_NewRunnableMethod(os, &nsObserverService::RegisterReporter);
-    NS_DispatchToCurrentThread(registerRunnable);
+  if (!os) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
 
-    return os->QueryInterface(aIID, aInstancePtr);
+  // The memory reporter can not be immediately registered here because
+  // the nsMemoryReporterManager may attempt to get the nsObserverService
+  // during initialization, causing a recursive GetService.
+  nsRefPtr<nsRunnableMethod<nsObserverService>> registerRunnable =
+    NS_NewRunnableMethod(os, &nsObserverService::RegisterReporter);
+  NS_DispatchToCurrentThread(registerRunnable);
+
+  return os->QueryInterface(aIID, aInstancePtr);
 }
 
 #define NS_ENSURE_VALIDCALL \
     if (!NS_IsMainThread()) {                                     \
         MOZ_CRASH("Using observer service off the main thread!"); \
         return NS_ERROR_UNEXPECTED;                               \
     }                                                             \
     if (mShuttingDown) {                                          \
         NS_ERROR("Using observer service after XPCOM shutdown!"); \
         return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;                  \
     }
 
 NS_IMETHODIMP
-nsObserverService::AddObserver(nsIObserver* anObserver, const char* aTopic,
-                               bool ownsWeak)
+nsObserverService::AddObserver(nsIObserver* aObserver, const char* aTopic,
+                               bool aOwnsWeak)
 {
-    LOG(("nsObserverService::AddObserver(%p: %s)",
-         (void*) anObserver, aTopic));
+  LOG(("nsObserverService::AddObserver(%p: %s)",
+       (void*)aObserver, aTopic));
 
-    NS_ENSURE_VALIDCALL
-    if (NS_WARN_IF(!anObserver) || NS_WARN_IF(!aTopic))
-        return NS_ERROR_INVALID_ARG;
+  NS_ENSURE_VALIDCALL
+  if (NS_WARN_IF(!aObserver) || NS_WARN_IF(!aTopic)) {
+    return NS_ERROR_INVALID_ARG;
+  }
 
-    if (mozilla::net::IsNeckoChild() && !strncmp(aTopic, "http-on-", 8)) {
-      return NS_ERROR_NOT_IMPLEMENTED;
-    }
+  if (mozilla::net::IsNeckoChild() && !strncmp(aTopic, "http-on-", 8)) {
+    return NS_ERROR_NOT_IMPLEMENTED;
+  }
 
-    nsObserverList *observerList = mObserverTopicTable.PutEntry(aTopic);
-    if (!observerList)
-        return NS_ERROR_OUT_OF_MEMORY;
+  nsObserverList* observerList = mObserverTopicTable.PutEntry(aTopic);
+  if (!observerList) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
 
-    return observerList->AddObserver(anObserver, ownsWeak);
+  return observerList->AddObserver(aObserver, aOwnsWeak);
 }
 
 NS_IMETHODIMP
-nsObserverService::RemoveObserver(nsIObserver* anObserver, const char* aTopic)
+nsObserverService::RemoveObserver(nsIObserver* aObserver, const char* aTopic)
 {
-    LOG(("nsObserverService::RemoveObserver(%p: %s)",
-         (void*) anObserver, aTopic));
-    NS_ENSURE_VALIDCALL
-    if (NS_WARN_IF(!anObserver) || NS_WARN_IF(!aTopic))
-        return NS_ERROR_INVALID_ARG;
+  LOG(("nsObserverService::RemoveObserver(%p: %s)",
+       (void*)aObserver, aTopic));
+  NS_ENSURE_VALIDCALL
+  if (NS_WARN_IF(!aObserver) || NS_WARN_IF(!aTopic)) {
+    return NS_ERROR_INVALID_ARG;
+  }
 
-    nsObserverList *observerList = mObserverTopicTable.GetEntry(aTopic);
-    if (!observerList)
-        return NS_ERROR_FAILURE;
+  nsObserverList* observerList = mObserverTopicTable.GetEntry(aTopic);
+  if (!observerList) {
+    return NS_ERROR_FAILURE;
+  }
 
-    /* This death grip is to protect against stupid consumers who call
-       RemoveObserver from their Destructor, see bug 485834/bug 325392. */
-    nsCOMPtr<nsIObserver> kungFuDeathGrip(anObserver);
-    return observerList->RemoveObserver(anObserver);
+  /* This death grip is to protect against stupid consumers who call
+     RemoveObserver from their Destructor, see bug 485834/bug 325392. */
+  nsCOMPtr<nsIObserver> kungFuDeathGrip(aObserver);
+  return observerList->RemoveObserver(aObserver);
 }
 
 NS_IMETHODIMP
 nsObserverService::EnumerateObservers(const char* aTopic,
                                       nsISimpleEnumerator** anEnumerator)
 {
-    NS_ENSURE_VALIDCALL
-    if (NS_WARN_IF(!anEnumerator) || NS_WARN_IF(!aTopic))
-        return NS_ERROR_INVALID_ARG;
+  NS_ENSURE_VALIDCALL
+  if (NS_WARN_IF(!anEnumerator) || NS_WARN_IF(!aTopic)) {
+    return NS_ERROR_INVALID_ARG;
+  }
 
-    nsObserverList *observerList = mObserverTopicTable.GetEntry(aTopic);
-    if (!observerList)
-        return NS_NewEmptyEnumerator(anEnumerator);
+  nsObserverList* observerList = mObserverTopicTable.GetEntry(aTopic);
+  if (!observerList) {
+    return NS_NewEmptyEnumerator(anEnumerator);
+  }
 
-    return observerList->GetObserverList(anEnumerator);
+  return observerList->GetObserverList(anEnumerator);
 }
 
 // Enumerate observers of aTopic and call Observe on each.
-NS_IMETHODIMP nsObserverService::NotifyObservers(nsISupports *aSubject,
-                                                 const char *aTopic,
-                                                 const char16_t *someData)
+NS_IMETHODIMP nsObserverService::NotifyObservers(nsISupports* aSubject,
+                                                 const char* aTopic,
+                                                 const char16_t* aSomeData)
 {
-    LOG(("nsObserverService::NotifyObservers(%s)", aTopic));
+  LOG(("nsObserverService::NotifyObservers(%s)", aTopic));
 
-    NS_ENSURE_VALIDCALL
-    if (NS_WARN_IF(!aTopic))
-        return NS_ERROR_INVALID_ARG;
+  NS_ENSURE_VALIDCALL
+  if (NS_WARN_IF(!aTopic)) {
+    return NS_ERROR_INVALID_ARG;
+  }
 
-    nsObserverList *observerList = mObserverTopicTable.GetEntry(aTopic);
-    if (observerList)
-        observerList->NotifyObservers(aSubject, aTopic, someData);
+  nsObserverList* observerList = mObserverTopicTable.GetEntry(aTopic);
+  if (observerList) {
+    observerList->NotifyObservers(aSubject, aTopic, aSomeData);
+  }
 
 #ifdef NOTIFY_GLOBAL_OBSERVERS
-    observerList = mObserverTopicTable.GetEntry("*");
-    if (observerList)
-        observerList->NotifyObservers(aSubject, aTopic, someData);
+  observerList = mObserverTopicTable.GetEntry("*");
+  if (observerList) {
+    observerList->NotifyObservers(aSubject, aTopic, aSomeData);
+  }
 #endif
 
-    return NS_OK;
+  return NS_OK;
 }
 
 static PLDHashOperator
 UnmarkGrayObserverEntry(nsObserverList* aObserverList, void* aClosure)
 {
-    if (aObserverList) {
-        aObserverList->UnmarkGrayStrongObservers();
-    }
-    return PL_DHASH_NEXT;
+  if (aObserverList) {
+    aObserverList->UnmarkGrayStrongObservers();
+  }
+  return PL_DHASH_NEXT;
 }
 
 NS_IMETHODIMP
 nsObserverService::UnmarkGrayStrongObservers()
 {
-    NS_ENSURE_VALIDCALL
+  NS_ENSURE_VALIDCALL
 
-    mObserverTopicTable.EnumerateEntries(UnmarkGrayObserverEntry, nullptr);
+  mObserverTopicTable.EnumerateEntries(UnmarkGrayObserverEntry, nullptr);
 
-    return NS_OK;
+  return NS_OK;
 }
 
--- a/xpcom/ds/nsObserverService.h
+++ b/xpcom/ds/nsObserverService.h
@@ -28,18 +28,18 @@ public:
   nsObserverService();
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVERSERVICE
   NS_DECL_NSIMEMORYREPORTER
 
   void Shutdown();
 
-  static nsresult
-  Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
+  static nsresult Create(nsISupports* aOuter, const nsIID& aIID,
+                         void** aInstancePtr);
 
   // Unmark any strongly held observers implemented in JS so the cycle
   // collector will not traverse them.
   NS_IMETHOD UnmarkGrayStrongObservers();
 
 private:
   ~nsObserverService(void);
   void RegisterReporter();
--- a/xpcom/ds/nsPersistentProperties.cpp
+++ b/xpcom/ds/nsPersistentProperties.cpp
@@ -12,44 +12,45 @@
 
 #define PL_ARENA_CONST_ALIGN_MASK 3
 #include "nsPersistentProperties.h"
 #include "nsIProperties.h"
 
 struct PropertyTableEntry : public PLDHashEntryHdr
 {
   // both of these are arena-allocated
-  const char *mKey;
-  const char16_t *mValue;
+  const char* mKey;
+  const char16_t* mValue;
 };
 
 static char16_t*
 ArenaStrdup(const nsAFlatString& aString, PLArenaPool* aArena)
 {
-  void *mem;
+  void* mem;
   // add one to include the null terminator
-  int32_t len = (aString.Length()+1) * sizeof(char16_t);
+  int32_t len = (aString.Length() + 1) * sizeof(char16_t);
   PL_ARENA_ALLOCATE(mem, aArena, len);
   NS_ASSERTION(mem, "Couldn't allocate space!\n");
   if (mem) {
     memcpy(mem, aString.get(), len);
   }
   return static_cast<char16_t*>(mem);
 }
 
 static char*
 ArenaStrdup(const nsAFlatCString& aString, PLArenaPool* aArena)
 {
-  void *mem;
+  void* mem;
   // add one to include the null terminator
-  int32_t len = (aString.Length()+1) * sizeof(char);
+  int32_t len = (aString.Length() + 1) * sizeof(char);
   PL_ARENA_ALLOCATE(mem, aArena, len);
   NS_ASSERTION(mem, "Couldn't allocate space!\n");
-  if (mem)
+  if (mem) {
     memcpy(mem, aString.get(), len);
+  }
   return static_cast<char*>(mem);
 }
 
 static const struct PLDHashTableOps property_HashTableOps = {
   PL_DHashAllocTable,
   PL_DHashFreeTable,
   PL_DHashStringKey,
   PL_DHashMatchStringKey,
@@ -57,101 +58,112 @@ static const struct PLDHashTableOps prop
   PL_DHashClearEntryStub,
   PL_DHashFinalizeStub,
   nullptr,
 };
 
 //
 // parser stuff
 //
-enum EParserState {
+enum EParserState
+{
   eParserState_AwaitingKey,
   eParserState_Key,
   eParserState_AwaitingValue,
   eParserState_Value,
   eParserState_Comment
 };
 
-enum EParserSpecial {
+enum EParserSpecial
+{
   eParserSpecial_None,          // not parsing a special character
   eParserSpecial_Escaped,       // awaiting a special character
   eParserSpecial_Unicode        // parsing a \Uxxx value
 };
 
 class nsPropertiesParser
 {
 public:
-  nsPropertiesParser(nsIPersistentProperties* aProps) :
-    mHaveMultiLine(false), mState(eParserState_AwaitingKey),
-    mProps(aProps) {}
+  nsPropertiesParser(nsIPersistentProperties* aProps)
+    : mHaveMultiLine(false)
+    , mState(eParserState_AwaitingKey)
+    , mProps(aProps)
+  {
+  }
 
-  void FinishValueState(nsAString& aOldValue) {
+  void FinishValueState(nsAString& aOldValue)
+  {
     static const char trimThese[] = " \t";
     mKey.Trim(trimThese, false, true);
 
     // This is really ugly hack but it should be fast
     char16_t backup_char;
     uint32_t minLength = mMinLength;
-    if (minLength)
-    {
-      backup_char = mValue[minLength-1];
-      mValue.SetCharAt('x', minLength-1);
+    if (minLength) {
+      backup_char = mValue[minLength - 1];
+      mValue.SetCharAt('x', minLength - 1);
     }
     mValue.Trim(trimThese, false, true);
-    if (minLength)
-      mValue.SetCharAt(backup_char, minLength-1);
+    if (minLength) {
+      mValue.SetCharAt(backup_char, minLength - 1);
+    }
 
     mProps->SetStringProperty(NS_ConvertUTF16toUTF8(mKey), mValue, aOldValue);
     mSpecialState = eParserSpecial_None;
     WaitForKey();
   }
 
   EParserState GetState() { return mState; }
 
   static NS_METHOD SegmentWriter(nsIUnicharInputStream* aStream,
                                  void* aClosure,
-                                 const char16_t *aFromSegment,
+                                 const char16_t* aFromSegment,
                                  uint32_t aToOffset,
                                  uint32_t aCount,
-                                 uint32_t *aWriteCount);
+                                 uint32_t* aWriteCount);
 
   nsresult ParseBuffer(const char16_t* aBuffer, uint32_t aBufferLength);
 
 private:
   bool ParseValueCharacter(
-    char16_t c,                  // character that is just being parsed
-    const char16_t* cur,         // pointer to character c in the buffer
-    const char16_t* &tokenStart, // string copying is done in blocks as big as
-                                  // possible, tokenStart points to the beginning
+    char16_t aChar,               // character that is just being parsed
+    const char16_t* aCur,         // pointer to character aChar in the buffer
+    const char16_t*& aTokenStart, // string copying is done in blocks as big as
+                                  // possible, aTokenStart points to the beginning
                                   // of this block
-    nsAString& oldValue);         // when duplicate property is found, new value
+    nsAString& aOldValue);        // when duplicate property is found, new value
                                   // is stored into hashtable and the old one is
                                   // placed in this variable
 
-  void WaitForKey() {
+  void WaitForKey()
+  {
     mState = eParserState_AwaitingKey;
   }
 
-  void EnterKeyState() {
+  void EnterKeyState()
+  {
     mKey.Truncate();
     mState = eParserState_Key;
   }
 
-  void WaitForValue() {
+  void WaitForValue()
+  {
     mState = eParserState_AwaitingValue;
   }
 
-  void EnterValueState() {
+  void EnterValueState()
+  {
     mValue.Truncate();
     mMinLength = 0;
     mState = eParserState_Value;
     mSpecialState = eParserSpecial_None;
   }
 
-  void EnterCommentState() {
+  void EnterCommentState()
+  {
     mState = eParserState_Comment;
   }
 
   nsAutoString mKey;
   nsAutoString mValue;
 
   uint32_t  mUnicodeValuesRead; // should be 4!
   char16_t mUnicodeValue;      // currently parsed unicode value
@@ -166,195 +178,196 @@ private:
   uint32_t  mMinLength;         // limit right trimming at the end to not trim
                                 // escaped whitespaces
   EParserState mState;
   // if we see a '\' then we enter this special state
   EParserSpecial mSpecialState;
   nsIPersistentProperties* mProps;
 };
 
-inline bool IsWhiteSpace(char16_t aChar)
+inline bool
+IsWhiteSpace(char16_t aChar)
 {
   return (aChar == ' ') || (aChar == '\t') ||
          (aChar == '\r') || (aChar == '\n');
 }
 
-inline bool IsEOL(char16_t aChar)
+inline bool
+IsEOL(char16_t aChar)
 {
   return (aChar == '\r') || (aChar == '\n');
 }
 
 
-bool nsPropertiesParser::ParseValueCharacter(
-    char16_t c, const char16_t* cur, const char16_t* &tokenStart,
-    nsAString& oldValue)
+bool
+nsPropertiesParser::ParseValueCharacter(char16_t aChar, const char16_t* aCur,
+                                        const char16_t*& aTokenStart,
+                                        nsAString& aOldValue)
 {
   switch (mSpecialState) {
+    // the normal state - look for special characters
+    case eParserSpecial_None:
+      switch (aChar) {
+        case '\\':
+          if (mHaveMultiLine) {
+            // there is nothing to append to mValue yet
+            mHaveMultiLine = false;
+          } else {
+            mValue += Substring(aTokenStart, aCur);
+          }
 
-    // the normal state - look for special characters
-  case eParserSpecial_None:
-    switch (c) {
-    case '\\':
-      if (mHaveMultiLine)
-        // there is nothing to append to mValue yet
-        mHaveMultiLine = false;
-      else
-        mValue += Substring(tokenStart, cur);
-
-      mSpecialState = eParserSpecial_Escaped;
-      break;
+          mSpecialState = eParserSpecial_Escaped;
+          break;
 
-    case '\n':
-      // if we detected multiline and got only "\\\r" ignore next "\n" if any
-      if (mHaveMultiLine && mMultiLineCanSkipN) {
-        // but don't allow another '\n' to be skipped
-        mMultiLineCanSkipN = false;
-        // Now there is nothing to append to the mValue since we are skipping
-        // whitespaces at the beginning of the new line of the multiline
-        // property. Set tokenStart properly to ensure that nothing is appended
-        // if we find regular line-end or the end of the buffer.
-        tokenStart = cur+1;
-        break;
-      }
-      // no break
+        case '\n':
+          // if we detected multiline and got only "\\\r" ignore next "\n" if any
+          if (mHaveMultiLine && mMultiLineCanSkipN) {
+            // but don't allow another '\n' to be skipped
+            mMultiLineCanSkipN = false;
+            // Now there is nothing to append to the mValue since we are skipping
+            // whitespaces at the beginning of the new line of the multiline
+            // property. Set aTokenStart properly to ensure that nothing is appended
+            // if we find regular line-end or the end of the buffer.
+            aTokenStart = aCur + 1;
+            break;
+          }
+        // no break
 
-    case '\r':
-      // we're done! We have a key and value
-      mValue += Substring(tokenStart, cur);
-      FinishValueState(oldValue);
-      mHaveMultiLine = false;
-      break;
+        case '\r':
+          // we're done! We have a key and value
+          mValue += Substring(aTokenStart, aCur);
+          FinishValueState(aOldValue);
+          mHaveMultiLine = false;
+          break;
 
-    default:
-      // there is nothing to do with normal characters,
-      // but handle multilines correctly
-      if (mHaveMultiLine) {
-        if (c == ' ' || c == '\t') {
-          // don't allow another '\n' to be skipped
-          mMultiLineCanSkipN = false;
-          // Now there is nothing to append to the mValue since we are skipping
-          // whitespaces at the beginning of the new line of the multiline
-          // property. Set tokenStart properly to ensure that nothing is appended
-          // if we find regular line-end or the end of the buffer.
-          tokenStart = cur+1;
-          break;
-        }
-        mHaveMultiLine = false;
-        tokenStart = cur;
+        default:
+          // there is nothing to do with normal characters,
+          // but handle multilines correctly
+          if (mHaveMultiLine) {
+            if (aChar == ' ' || aChar == '\t') {
+              // don't allow another '\n' to be skipped
+              mMultiLineCanSkipN = false;
+              // Now there is nothing to append to the mValue since we are skipping
+              // whitespaces at the beginning of the new line of the multiline
+              // property. Set aTokenStart properly to ensure that nothing is appended
+              // if we find regular line-end or the end of the buffer.
+              aTokenStart = aCur + 1;
+              break;
+            }
+            mHaveMultiLine = false;
+            aTokenStart = aCur;
+          }
+          break; // from switch on (aChar)
       }
-      break; // from switch on (c)
-    }
-    break; // from switch on (mSpecialState)
+      break; // from switch on (mSpecialState)
 
     // saw a \ character, so parse the character after that
-  case eParserSpecial_Escaped:
-    // probably want to start parsing at the next token
-    // other characters, like 'u' might override this
-    tokenStart = cur+1;
-    mSpecialState = eParserSpecial_None;
-
-    switch (c) {
+    case eParserSpecial_Escaped:
+      // probably want to start parsing at the next token
+      // other characters, like 'u' might override this
+      aTokenStart = aCur + 1;
+      mSpecialState = eParserSpecial_None;
 
-      // the easy characters - \t, \n, and so forth
-    case 't':
-      mValue += char16_t('\t');
-      mMinLength = mValue.Length();
-      break;
-    case 'n':
-      mValue += char16_t('\n');
-      mMinLength = mValue.Length();
-      break;
-    case 'r':
-      mValue += char16_t('\r');
-      mMinLength = mValue.Length();
-      break;
-    case '\\':
-      mValue += char16_t('\\');
+      switch (aChar) {
+        // the easy characters - \t, \n, and so forth
+        case 't':
+          mValue += char16_t('\t');
+          mMinLength = mValue.Length();
+          break;
+        case 'n':
+          mValue += char16_t('\n');
+          mMinLength = mValue.Length();
+          break;
+        case 'r':
+          mValue += char16_t('\r');
+          mMinLength = mValue.Length();
+          break;
+        case '\\':
+          mValue += char16_t('\\');
+          break;
+
+        // switch to unicode mode!
+        case 'u':
+        case 'U':
+          mSpecialState = eParserSpecial_Unicode;
+          mUnicodeValuesRead = 0;
+          mUnicodeValue = 0;
+          break;
+
+        // a \ immediately followed by a newline means we're going multiline
+        case '\r':
+        case '\n':
+          mHaveMultiLine = true;
+          mMultiLineCanSkipN = (aChar == '\r');
+          mSpecialState = eParserSpecial_None;
+          break;
+
+        default:
+          // don't recognize the character, so just append it
+          mValue += aChar;
+          break;
+      }
       break;
 
-      // switch to unicode mode!
-    case 'u':
-    case 'U':
-      mSpecialState = eParserSpecial_Unicode;
-      mUnicodeValuesRead = 0;
-      mUnicodeValue = 0;
-      break;
-
-      // a \ immediately followed by a newline means we're going multiline
-    case '\r':
-    case '\n':
-      mHaveMultiLine = true;
-      mMultiLineCanSkipN = (c == '\r');
-      mSpecialState = eParserSpecial_None;
-      break;
-
-    default:
-      // don't recognize the character, so just append it
-      mValue += c;
-      break;
-    }
-    break;
-
     // we're in the middle of parsing a 4-character unicode value
     // like \u5f39
-  case eParserSpecial_Unicode:
+    case eParserSpecial_Unicode:
+      if ('0' <= aChar && aChar <= '9') {
+        mUnicodeValue =
+          (mUnicodeValue << 4) | (aChar - '0');
+      } else if ('a' <= aChar && aChar <= 'f') {
+        mUnicodeValue =
+          (mUnicodeValue << 4) | (aChar - 'a' + 0x0a);
+      } else if ('A' <= aChar && aChar <= 'F') {
+        mUnicodeValue =
+          (mUnicodeValue << 4) | (aChar - 'A' + 0x0a);
+      } else {
+        // non-hex character. Append what we have, and move on.
+        mValue += mUnicodeValue;
+        mMinLength = mValue.Length();
+        mSpecialState = eParserSpecial_None;
 
-    if(('0' <= c) && (c <= '9'))
-      mUnicodeValue =
-        (mUnicodeValue << 4) | (c - '0');
-    else if(('a' <= c) && (c <= 'f'))
-      mUnicodeValue =
-        (mUnicodeValue << 4) | (c - 'a' + 0x0a);
-    else if(('A' <= c) && (c <= 'F'))
-      mUnicodeValue =
-        (mUnicodeValue << 4) | (c - 'A' + 0x0a);
-    else {
-      // non-hex character. Append what we have, and move on.
-      mValue += mUnicodeValue;
-      mMinLength = mValue.Length();
-      mSpecialState = eParserSpecial_None;
+        // leave aTokenStart at this unknown character, so it gets appended
+        aTokenStart = aCur;
+
+        // ensure parsing this non-hex character again
+        return false;
+      }
 
-      // leave tokenStart at this unknown character, so it gets appended
-      tokenStart = cur;
-
-      // ensure parsing this non-hex character again
-      return false;
-    }
+      if (++mUnicodeValuesRead >= 4) {
+        aTokenStart = aCur + 1;
+        mSpecialState = eParserSpecial_None;
+        mValue += mUnicodeValue;
+        mMinLength = mValue.Length();
+      }
 
-    if (++mUnicodeValuesRead >= 4) {
-      tokenStart = cur+1;
-      mSpecialState = eParserSpecial_None;
-      mValue += mUnicodeValue;
-      mMinLength = mValue.Length();
-    }
-
-    break;
+      break;
   }
 
   return true;
 }
 
-NS_METHOD nsPropertiesParser::SegmentWriter(nsIUnicharInputStream* aStream,
-                                            void* aClosure,
-                                            const char16_t *aFromSegment,
-                                            uint32_t aToOffset,
-                                            uint32_t aCount,
-                                            uint32_t *aWriteCount)
+NS_METHOD
+nsPropertiesParser::SegmentWriter(nsIUnicharInputStream* aStream,
+                                  void* aClosure,
+                                  const char16_t* aFromSegment,
+                                  uint32_t aToOffset,
+                                  uint32_t aCount,
+                                  uint32_t* aWriteCount)
 {
-  nsPropertiesParser *parser =
-    static_cast<nsPropertiesParser *>(aClosure);
-
+  nsPropertiesParser* parser = static_cast<nsPropertiesParser*>(aClosure);
   parser->ParseBuffer(aFromSegment, aCount);
 
   *aWriteCount = aCount;
   return NS_OK;
 }
 
-nsresult nsPropertiesParser::ParseBuffer(const char16_t* aBuffer,
-                                         uint32_t aBufferLength)
+nsresult
+nsPropertiesParser::ParseBuffer(const char16_t* aBuffer,
+                                uint32_t aBufferLength)
 {
   const char16_t* cur = aBuffer;
   const char16_t* end = aBuffer + aBufferLength;
 
   // points to the start/end of the current key or value
   const char16_t* tokenStart = nullptr;
 
   // if we're in the middle of parsing a key or value, make sure
@@ -366,68 +379,72 @@ nsresult nsPropertiesParser::ParseBuffer
 
   nsAutoString oldValue;
 
   while (cur != end) {
 
     char16_t c = *cur;
 
     switch (mState) {
-    case eParserState_AwaitingKey:
-      if (c == '#' || c == '!')
-        EnterCommentState();
+      case eParserState_AwaitingKey:
+        if (c == '#' || c == '!') {
+          EnterCommentState();
+        }
 
-      else if (!IsWhiteSpace(c)) {
-        // not a comment, not whitespace, we must have found a key!
-        EnterKeyState();
-        tokenStart = cur;
-      }
-      break;
+        else if (!IsWhiteSpace(c)) {
+          // not a comment, not whitespace, we must have found a key!
+          EnterKeyState();
+          tokenStart = cur;
+        }
+        break;
 
-    case eParserState_Key:
-      if (c == '=' || c == ':') {
-        mKey += Substring(tokenStart, cur);
-        WaitForValue();
-      }
-      break;
+      case eParserState_Key:
+        if (c == '=' || c == ':') {
+          mKey += Substring(tokenStart, cur);
+          WaitForValue();
+        }
+        break;
 
-    case eParserState_AwaitingValue:
-      if (IsEOL(c)) {
-        // no value at all! mimic the normal value-ending
-        EnterValueState();
-        FinishValueState(oldValue);
-      }
+      case eParserState_AwaitingValue:
+        if (IsEOL(c)) {
+          // no value at all! mimic the normal value-ending
+          EnterValueState();
+          FinishValueState(oldValue);
+        }
 
-      // ignore white space leading up to the value
-      else if (!IsWhiteSpace(c)) {
-        tokenStart = cur;
-        EnterValueState();
+        // ignore white space leading up to the value
+        else if (!IsWhiteSpace(c)) {
+          tokenStart = cur;
+          EnterValueState();
 
-        // make sure to handle this first character
-        if (ParseValueCharacter(c, cur, tokenStart, oldValue))
+          // make sure to handle this first character
+          if (ParseValueCharacter(c, cur, tokenStart, oldValue)) {
+            cur++;
+          }
+          // If the character isn't consumed, don't do cur++ and parse
+          // the character again. This can happen f.e. for char 'X' in sequence
+          // "\u00X". This character can be control character and must be
+          // processed again.
+          continue;
+        }
+        break;
+
+      case eParserState_Value:
+        if (ParseValueCharacter(c, cur, tokenStart, oldValue)) {
           cur++;
-        // If the character isn't consumed, don't do cur++ and parse
-        // the character again. This can happen f.e. for char 'X' in sequence
-        // "\u00X". This character can be control character and must be
-        // processed again.
+        }
+        // See few lines above for reason of doing this
         continue;
-      }
-      break;
 
-    case eParserState_Value:
-      if (ParseValueCharacter(c, cur, tokenStart, oldValue))
-        cur++;
-      // See few lines above for reason of doing this
-      continue;
-
-    case eParserState_Comment:
-      // stay in this state till we hit EOL
-      if (c == '\r' || c== '\n')
-        WaitForKey();
-      break;
+      case eParserState_Comment:
+        // stay in this state till we hit EOL
+        if (c == '\r' || c == '\n') {
+          WaitForKey();
+        }
+        break;
     }
 
     // finally, advance to the next character
     cur++;
   }
 
   // if we're still parsing the value and are in eParserSpecial_None, then
   // append whatever we have..
@@ -439,65 +456,70 @@ nsresult nsPropertiesParser::ParseBuffer
   else if (mState == eParserState_Key && tokenStart) {
     mKey += Substring(tokenStart, cur);
   }
 
   return NS_OK;
 }
 
 nsPersistentProperties::nsPersistentProperties()
-: mIn(nullptr)
+  : mIn(nullptr)
 {
   mSubclass = static_cast<nsIPersistentProperties*>(this);
 
   PL_DHashTableInit(&mTable, &property_HashTableOps, nullptr,
                     sizeof(PropertyTableEntry), 20);
 
   PL_INIT_ARENA_POOL(&mArena, "PersistentPropertyArena", 2048);
 }
 
 nsPersistentProperties::~nsPersistentProperties()
 {
   PL_FinishArenaPool(&mArena);
-  if (mTable.ops)
+  if (mTable.ops) {
     PL_DHashTableFinish(&mTable);
+  }
 }
 
 nsresult
-nsPersistentProperties::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
+nsPersistentProperties::Create(nsISupports* aOuter, REFNSIID aIID,
+                               void** aResult)
 {
-  if (aOuter)
+  if (aOuter) {
     return NS_ERROR_NO_AGGREGATION;
+  }
   nsRefPtr<nsPersistentProperties> props = new nsPersistentProperties();
   return props->QueryInterface(aIID, aResult);
 }
 
 NS_IMPL_ISUPPORTS(nsPersistentProperties, nsIPersistentProperties, nsIProperties)
 
 NS_IMETHODIMP
-nsPersistentProperties::Load(nsIInputStream *aIn)
+nsPersistentProperties::Load(nsIInputStream* aIn)
 {
   nsresult rv = nsSimpleUnicharStreamFactory::GetInstance()->
     CreateInstanceFromUTF8Stream(aIn, getter_AddRefs(mIn));
 
   if (rv != NS_OK) {
     NS_WARNING("Error creating UnicharInputStream");
     return NS_ERROR_FAILURE;
   }
 
   nsPropertiesParser parser(mSubclass);
 
   uint32_t nProcessed;
   // If this 4096 is changed to some other value, make sure to adjust
   // the bug121341.properties test file accordingly.
-  while (NS_SUCCEEDED(rv = mIn->ReadSegments(nsPropertiesParser::SegmentWriter, &parser, 4096, &nProcessed)) &&
+  while (NS_SUCCEEDED(rv = mIn->ReadSegments(nsPropertiesParser::SegmentWriter,
+                                             &parser, 4096, &nProcessed)) &&
          nProcessed != 0);
   mIn = nullptr;
-  if (NS_FAILED(rv))
+  if (NS_FAILED(rv)) {
     return rv;
+  }
 
   // We may have an unprocessed value at this point
   // if the last line did not have a proper line ending.
   if (parser.GetState() == eParserState_Value) {
     nsAutoString oldValue;
     parser.FinishValueState(oldValue);
   }
 
@@ -505,26 +527,24 @@ nsPersistentProperties::Load(nsIInputStr
 }
 
 NS_IMETHODIMP
 nsPersistentProperties::SetStringProperty(const nsACString& aKey,
                                           const nsAString& aNewValue,
                                           nsAString& aOldValue)
 {
   const nsAFlatCString&  flatKey = PromiseFlatCString(aKey);
-  PropertyTableEntry *entry =
-    static_cast<PropertyTableEntry*>
-               (PL_DHashTableOperate(&mTable, flatKey.get(), PL_DHASH_ADD));
+  PropertyTableEntry* entry = static_cast<PropertyTableEntry*>(
+    PL_DHashTableOperate(&mTable, flatKey.get(), PL_DHASH_ADD));
 
   if (entry->mKey) {
     aOldValue = entry->mValue;
     NS_WARNING(nsPrintfCString("the property %s already exists\n",
                                flatKey.get()).get());
-  }
-  else {
+  } else {
     aOldValue.Truncate();
   }
 
   entry->mKey = ArenaStrdup(flatKey, &mArena);
   entry->mValue = ArenaStrdup(PromiseFlatString(aNewValue), &mArena);
 
   return NS_OK;
 }
@@ -546,37 +566,37 @@ nsPersistentProperties::Subclass(nsIPers
 }
 
 NS_IMETHODIMP
 nsPersistentProperties::GetStringProperty(const nsACString& aKey,
                                           nsAString& aValue)
 {
   const nsAFlatCString&  flatKey = PromiseFlatCString(aKey);
 
-  PropertyTableEntry *entry =
-    static_cast<PropertyTableEntry*>
-               (PL_DHashTableOperate(&mTable, flatKey.get(), PL_DHASH_LOOKUP));
+  PropertyTableEntry* entry = static_cast<PropertyTableEntry*>(
+    PL_DHashTableOperate(&mTable, flatKey.get(), PL_DHASH_LOOKUP));
 
-  if (PL_DHASH_ENTRY_IS_FREE(entry))
+  if (PL_DHASH_ENTRY_IS_FREE(entry)) {
     return NS_ERROR_FAILURE;
+  }
 
   aValue = entry->mValue;
   return NS_OK;
 }
 
 static PLDHashOperator
-AddElemToArray(PLDHashTable* table, PLDHashEntryHdr *hdr,
-               uint32_t i, void *arg)
+AddElemToArray(PLDHashTable* aTable, PLDHashEntryHdr* aHdr,
+               uint32_t aIndex, void* aArg)
 {
   nsCOMArray<nsIPropertyElement>* props =
-    static_cast<nsCOMArray<nsIPropertyElement>*>(arg);
+    static_cast<nsCOMArray<nsIPropertyElement>*>(aArg);
   PropertyTableEntry* entry =
-    static_cast<PropertyTableEntry*>(hdr);
+    static_cast<PropertyTableEntry*>(aHdr);
 
-  nsPropertyElement *element =
+  nsPropertyElement* element =
     new nsPropertyElement(nsDependentCString(entry->mKey),
                           nsDependentString(entry->mValue));
 
   props->AppendObject(element);
 
   return PL_DHASH_NEXT;
 }
 
@@ -585,72 +605,71 @@ NS_IMETHODIMP
 nsPersistentProperties::Enumerate(nsISimpleEnumerator** aResult)
 {
   nsCOMArray<nsIPropertyElement> props;
 
   // We know the necessary size; we can avoid growing it while adding elements
   props.SetCapacity(mTable.entryCount);
 
   // Step through hash entries populating a transient array
-  uint32_t n =
-    PL_DHashTableEnumerate(&mTable, AddElemToArray, (void *)&props);
-  if (n < mTable.entryCount)
+  uint32_t n = PL_DHashTableEnumerate(&mTable, AddElemToArray, (void*)&props);
+  if (n < mTable.entryCount) {
     return NS_ERROR_OUT_OF_MEMORY;
+  }
 
   return NS_NewArrayEnumerator(aResult, props);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XXX Some day we'll unify the nsIPersistentProperties interface with
 // nsIProperties, but until now...
 
 NS_IMETHODIMP
-nsPersistentProperties::Get(const char* prop, const nsIID & uuid, void* *result)
+nsPersistentProperties::Get(const char* aProp, const nsIID& aUUID,
+                            void** aResult)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsPersistentProperties::Set(const char* prop, nsISupports* value)
+nsPersistentProperties::Set(const char* aProp, nsISupports* value)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 NS_IMETHODIMP
-nsPersistentProperties::Undefine(const char* prop)
+nsPersistentProperties::Undefine(const char* aProp)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsPersistentProperties::Has(const char* prop, bool *result)
+nsPersistentProperties::Has(const char* aProp, bool* aResult)
 {
-  PropertyTableEntry *entry =
-    static_cast<PropertyTableEntry*>
-               (PL_DHashTableOperate(&mTable, prop, PL_DHASH_LOOKUP));
-
-  *result = (entry && PL_DHASH_ENTRY_IS_BUSY(entry));
-
+  PropertyTableEntry* entry = static_cast<PropertyTableEntry*>(
+    PL_DHashTableOperate(&mTable, aProp, PL_DHASH_LOOKUP));
+  *aResult = (entry && PL_DHASH_ENTRY_IS_BUSY(entry));
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsPersistentProperties::GetKeys(uint32_t *count, char ***keys)
+nsPersistentProperties::GetKeys(uint32_t* aCount, char*** aKeys)
 {
-    return NS_ERROR_NOT_IMPLEMENTED;
+  return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // PropertyElement
 ////////////////////////////////////////////////////////////////////////////////
 
 NS_METHOD
-nsPropertyElement::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
+nsPropertyElement::Create(nsISupports* aOuter, REFNSIID aIID, void** aResult)
 {
-  if (aOuter)
+  if (aOuter) {
     return NS_ERROR_NO_AGGREGATION;
+  }
   nsRefPtr<nsPropertyElement> propElem = new nsPropertyElement();
   return propElem->QueryInterface(aIID, aResult);
 }
 
 NS_IMPL_ISUPPORTS(nsPropertyElement, nsIPropertyElement)
 
 NS_IMETHODIMP
 nsPropertyElement::GetKey(nsACString& aReturnKey)
--- a/xpcom/ds/nsPersistentProperties.h
+++ b/xpcom/ds/nsPersistentProperties.h
@@ -19,18 +19,17 @@ class nsPersistentProperties MOZ_FINAL :
 {
 public:
   nsPersistentProperties();
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIPROPERTIES
   NS_DECL_NSIPERSISTENTPROPERTIES
 
-  static nsresult
-  Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
+  static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
 
 private:
   ~nsPersistentProperties();
 
 protected:
   nsCOMPtr<nsIUnicharInputStream> mIn;
 
   nsIPersistentProperties* mSubclass;
@@ -41,25 +40,25 @@ protected:
 class nsPropertyElement MOZ_FINAL : public nsIPropertyElement
 {
 public:
   nsPropertyElement()
   {
   }
 
   nsPropertyElement(const nsACString& aKey, const nsAString& aValue)
-    : mKey(aKey), mValue(aValue)
+    : mKey(aKey)
+    , mValue(aValue)
   {
   }
 
   NS_DECL_ISUPPORTS
   NS_DECL_NSIPROPERTYELEMENT
 
-  static NS_METHOD
-  Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
+  static NS_METHOD Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
 
 private:
   ~nsPropertyElement() {}
 
 protected:
   nsCString mKey;
   nsString mValue;
 };
--- a/xpcom/ds/nsProperties.cpp
+++ b/xpcom/ds/nsProperties.cpp
@@ -4,113 +4,118 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsProperties.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 
 NS_IMPL_AGGREGATED(nsProperties)
 NS_INTERFACE_MAP_BEGIN_AGGREGATED(nsProperties)
-    NS_INTERFACE_MAP_ENTRY(nsIProperties)
+  NS_INTERFACE_MAP_ENTRY(nsIProperties)
 NS_INTERFACE_MAP_END
 
 NS_IMETHODIMP
-nsProperties::Get(const char* prop, const nsIID & uuid, void* *result)
+nsProperties::Get(const char* prop, const nsIID& uuid, void** result)
 {
-    if (NS_WARN_IF(!prop))
-        return NS_ERROR_INVALID_ARG;
+  if (NS_WARN_IF(!prop)) {
+    return NS_ERROR_INVALID_ARG;
+  }
 
-    nsCOMPtr<nsISupports> value;
-    if (!nsProperties_HashBase::Get(prop, getter_AddRefs(value))) {
-        return NS_ERROR_FAILURE;
-    }
-    return (value) ? value->QueryInterface(uuid, result) : NS_ERROR_NO_INTERFACE;
+  nsCOMPtr<nsISupports> value;
+  if (!nsProperties_HashBase::Get(prop, getter_AddRefs(value))) {
+    return NS_ERROR_FAILURE;
+  }
+  return (value) ? value->QueryInterface(uuid, result) : NS_ERROR_NO_INTERFACE;
 }
 
 NS_IMETHODIMP
 nsProperties::Set(const char* prop, nsISupports* value)
 {
-    if (NS_WARN_IF(!prop))
-        return NS_ERROR_INVALID_ARG;
-    Put(prop, value);
-    return NS_OK;
+  if (NS_WARN_IF(!prop)) {
+    return NS_ERROR_INVALID_ARG;
+  }
+  Put(prop, value);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsProperties::Undefine(const char* prop)
 {
-    if (NS_WARN_IF(!prop))
-        return NS_ERROR_INVALID_ARG;
+  if (NS_WARN_IF(!prop)) {
+    return NS_ERROR_INVALID_ARG;
+  }
 
-    nsCOMPtr<nsISupports> value;
-    if (!nsProperties_HashBase::Get(prop, getter_AddRefs(value)))
-        return NS_ERROR_FAILURE;
+  nsCOMPtr<nsISupports> value;
+  if (!nsProperties_HashBase::Get(prop, getter_AddRefs(value))) {
+    return NS_ERROR_FAILURE;
+  }
 
-    Remove(prop);
-    return NS_OK;
+  Remove(prop);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
-nsProperties::Has(const char* prop, bool *result)
+nsProperties::Has(const char* prop, bool* result)
 {
-    if (NS_WARN_IF(!prop))
-        return NS_ERROR_INVALID_ARG;
+  if (NS_WARN_IF(!prop)) {
+    return NS_ERROR_INVALID_ARG;
+  }
 
-    nsCOMPtr<nsISupports> value;
-    *result = nsProperties_HashBase::Get(prop,
-                                         getter_AddRefs(value));
-    return NS_OK;
+  nsCOMPtr<nsISupports> value;
+  *result = nsProperties_HashBase::Get(prop, getter_AddRefs(value));
+  return NS_OK;
 }
 
 struct GetKeysEnumData
 {
-    char **keys;
-    uint32_t next;
-    nsresult res;
+  char** keys;
+  uint32_t next;
+  nsresult res;
 };
 
- PLDHashOperator
-GetKeysEnumerate(const char *key, nsISupports* data,
-                 void *arg)
+PLDHashOperator
+GetKeysEnumerate(const char* aKey, nsISupports* aData, void* aArg)
 {
-    GetKeysEnumData *gkedp = (GetKeysEnumData *)arg;
-    gkedp->keys[gkedp->next] = strdup(key);
+  GetKeysEnumData* gkedp = (GetKeysEnumData*)aArg;
+  gkedp->keys[gkedp->next] = strdup(aKey);
 
-    if (!gkedp->keys[gkedp->next]) {
-        gkedp->res = NS_ERROR_OUT_OF_MEMORY;
-        return PL_DHASH_STOP;
-    }
+  if (!gkedp->keys[gkedp->next]) {
+    gkedp->res = NS_ERROR_OUT_OF_MEMORY;
+    return PL_DHASH_STOP;
+  }
 
-    gkedp->next++;
-    return PL_DHASH_NEXT;
+  gkedp->next++;
+  return PL_DHASH_NEXT;
 }
 
-NS_IMETHODIMP 
-nsProperties::GetKeys(uint32_t *count, char ***keys)
+NS_IMETHODIMP
+nsProperties::GetKeys(uint32_t* aCount, char*** aKeys)
 {
-    if (NS_WARN_IF(!count) || NS_WARN_IF(!keys))
-        return NS_ERROR_INVALID_ARG;
+  if (NS_WARN_IF(!aCount) || NS_WARN_IF(!aKeys)) {
+    return NS_ERROR_INVALID_ARG;
+  }
 
-    uint32_t n = Count();
-    char ** k = (char **) nsMemory::Alloc(n * sizeof(char *));
+  uint32_t n = Count();
+  char** k = (char**)nsMemory::Alloc(n * sizeof(char*));
 
-    GetKeysEnumData gked;
-    gked.keys = k;
-    gked.next = 0;
-    gked.res = NS_OK;
+  GetKeysEnumData gked;
+  gked.keys = k;
+  gked.next = 0;
+  gked.res = NS_OK;
 
-    EnumerateRead(GetKeysEnumerate, &gked);
+  EnumerateRead(GetKeysEnumerate, &gked);
 
-    nsresult rv = gked.res;
-    if (NS_FAILED(rv)) {
-        // Free 'em all
-        for (uint32_t i = 0; i < gked.next; i++)
-            nsMemory::Free(k[i]);
-        nsMemory::Free(k);
-        return rv;
+  nsresult rv = gked.res;
+  if (NS_FAILED(rv)) {
+    // Free 'em all
+    for (uint32_t i = 0; i < gked.next; i++) {
+      nsMemory::Free(k[i]);
     }
+    nsMemory::Free(k);
+    return rv;
+  }
 
-    *count = n;
-    *keys = k;
-    return NS_OK;
+  *aCount = n;
+  *aKeys = k;
+  return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/xpcom/ds/nsProperties.h
+++ b/xpcom/ds/nsProperties.h
@@ -18,20 +18,21 @@
     0xb1bf,                                          \
     0x11d3,                                          \
     {0x93, 0xb6, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
 }
 
 typedef nsInterfaceHashtable<nsCharPtrHashKey, nsISupports>
         nsProperties_HashBase;
 
-class nsProperties MOZ_FINAL : public nsIProperties,
-                               public nsProperties_HashBase {
+class nsProperties MOZ_FINAL
+  : public nsIProperties
+  , public nsProperties_HashBase
+{
 public:
-
   NS_DECL_AGGREGATED
   NS_DECL_NSIPROPERTIES
 
   nsProperties(nsISupports *aOuter) { NS_INIT_AGGREGATED(aOuter); }
-  ~nsProperties() { }
+  ~nsProperties() {}
 };
 
 #endif /* nsProperties_h___ */
--- a/xpcom/ds/nsStaticAtom.h
+++ b/xpcom/ds/nsStaticAtom.h
@@ -15,33 +15,35 @@ typedef char16_t nsStaticAtomStringType;
 #define NS_STATIC_ATOM(buffer_name, atom_ptr)  { (nsStringBuffer*) &buffer_name, atom_ptr }
 #define NS_STATIC_ATOM_BUFFER(buffer_name, str_data) static nsFakeStringBuffer< sizeof(str_data) > buffer_name = { 1, sizeof(str_data) * sizeof(nsStaticAtomStringType), MOZ_UTF16(str_data) };
 
 /**
  * Holds data used to initialize large number of atoms during startup. Use
  * the above macros to initialize these structs. They should never be accessed
  * directly other than from AtomTable.cpp
  */
-struct nsStaticAtom {
-    nsStringBuffer* mStringBuffer;
-    nsIAtom ** mAtom;
+struct nsStaticAtom
+{
+  nsStringBuffer* mStringBuffer;
+  nsIAtom** mAtom;
 };
 
 /**
  * This is a struct with the same binary layout as a nsStringBuffer.
  */
-template <uint32_t size>
-struct nsFakeStringBuffer {
-    int32_t mRefCnt;
-    uint32_t mSize;
-    nsStaticAtomStringType mStringData[size];
+template<uint32_t size>
+struct nsFakeStringBuffer
+{
+  int32_t mRefCnt;
+  uint32_t mSize;
+  nsStaticAtomStringType mStringData[size];
 };
 
 // Register an array of static atoms with the atom table
 template<uint32_t N>
 nsresult
-NS_RegisterStaticAtoms(const nsStaticAtom (&atoms)[N])
+NS_RegisterStaticAtoms(const nsStaticAtom (&aAtoms)[N])
 {
-    extern nsresult RegisterStaticAtoms(const nsStaticAtom*, uint32_t aAtomCount);
-    return RegisterStaticAtoms(atoms, N);
+  extern nsresult RegisterStaticAtoms(const nsStaticAtom*, uint32_t aAtomCount);
+  return RegisterStaticAtoms(aAtoms, N);
 }
 
 #endif
--- a/xpcom/ds/nsStaticNameTable.cpp
+++ b/xpcom/ds/nsStaticNameTable.cpp
@@ -14,223 +14,225 @@
 
 #define PL_ARENA_CONST_ALIGN_MASK 3
 #include "nsStaticNameTable.h"
 
 using namespace mozilla;
 
 struct NameTableKey
 {
-    NameTableKey(const nsAFlatCString* aKeyStr)
-        : mIsUnichar(false)
-    {
-        mKeyStr.m1b = aKeyStr;
-    }
+  NameTableKey(const nsAFlatCString* aKeyStr)
+    : mIsUnichar(false)
+  {
+    mKeyStr.m1b = aKeyStr;
+  }
 
-    NameTableKey(const nsAFlatString* aKeyStr)
-        : mIsUnichar(true)
-    {
-        mKeyStr.m2b = aKeyStr;
-    }
+  NameTableKey(const nsAFlatString* aKeyStr)
+    : mIsUnichar(true)
+  {
+    mKeyStr.m2b = aKeyStr;
+  }
 
-    bool mIsUnichar;
-    union {
-        const nsAFlatCString* m1b;
-        const nsAFlatString* m2b;
-    } mKeyStr;
+  bool mIsUnichar;
+  union
+  {
+    const nsAFlatCString* m1b;
+    const nsAFlatString* m2b;
+  } mKeyStr;
 };
 
 struct NameTableEntry : public PLDHashEntryHdr
 {
-    // no ownership here!
-    const nsAFlatCString* mString;
-    int32_t mIndex;
+  // no ownership here!
+  const nsAFlatCString* mString;
+  int32_t mIndex;
 };
 
 static bool
 matchNameKeysCaseInsensitive(PLDHashTable*, const PLDHashEntryHdr* aHdr,
-                             const void* key)
+                             const void* aKey)
 {
-    const NameTableEntry* entry =
-        static_cast<const NameTableEntry *>(aHdr);
-    const NameTableKey *keyValue = static_cast<const NameTableKey*>(key);
-
-    const nsAFlatCString* entryKey = entry->mString;
+  const NameTableEntry* entry = static_cast<const NameTableEntry*>(aHdr);
+  const NameTableKey* keyValue = static_cast<const NameTableKey*>(aKey);
+  const nsAFlatCString* entryKey = entry->mString;
 
-    if (keyValue->mIsUnichar) {
-        return keyValue->mKeyStr.m2b->
-            LowerCaseEqualsASCII(entryKey->get(), entryKey->Length());
-    }
+  if (keyValue->mIsUnichar) {
+    return keyValue->mKeyStr.m2b->LowerCaseEqualsASCII(entryKey->get(),
+                                                       entryKey->Length());
+  }
 
-    return keyValue->mKeyStr.m1b->
-        LowerCaseEqualsASCII(entryKey->get(), entryKey->Length());
+  return keyValue->mKeyStr.m1b->LowerCaseEqualsASCII(entryKey->get(),
+                                                     entryKey->Length());
 }
 
 /*
  * caseInsensitiveHashKey is just like PL_DHashStringKey except it
  * uses (*s & ~0x20) instead of simply *s.  This means that "aFOO" and
  * "afoo" and "aFoo" will all hash to the same thing.  It also means
  * that some strings that aren't case-insensensitively equal will hash
  * to the same value, but it's just a hash function so it doesn't
  * matter.
  */
 static PLDHashNumber
-caseInsensitiveStringHashKey(PLDHashTable *table, const void *key)
+caseInsensitiveStringHashKey(PLDHashTable* aTable, const void* aKey)
 {
-    PLDHashNumber h = 0;
-    const NameTableKey* tableKey = static_cast<const NameTableKey*>(key);
-    if (tableKey->mIsUnichar) {
-        for (const char16_t* s = tableKey->mKeyStr.m2b->get();
-             *s != '\0';
-             s++)
-            h = AddToHash(h, *s & ~0x20);
-    } else {
-        for (const unsigned char* s =
-                 reinterpret_cast<const unsigned char*>
-                                 (tableKey->mKeyStr.m1b->get());
-             *s != '\0';
-             s++)
-            h = AddToHash(h, *s & ~0x20);
+  PLDHashNumber h = 0;
+  const NameTableKey* tableKey = static_cast<const NameTableKey*>(aKey);
+  if (tableKey->mIsUnichar) {
+    for (const char16_t* s = tableKey->mKeyStr.m2b->get();
+         *s != '\0';
+         s++) {
+      h = AddToHash(h, *s & ~0x20);
     }
-    return h;
+  } else {
+    for (const unsigned char* s = reinterpret_cast<const unsigned char*>(
+           tableKey->mKeyStr.m1b->get());
+         *s != '\0';
+         s++) {
+      h = AddToHash(h, *s & ~0x20);
+    }
+  }
+  return h;
 }
 
 static const struct PLDHashTableOps nametable_CaseInsensitiveHashTableOps = {
-    PL_DHashAllocTable,
-    PL_DHashFreeTable,
-    caseInsensitiveStringHashKey,
-    matchNameKeysCaseInsensitive,
-    PL_DHashMoveEntryStub,
-    PL_DHashClearEntryStub,
-    PL_DHashFinalizeStub,
-    nullptr,
+  PL_DHashAllocTable,
+  PL_DHashFreeTable,
+  caseInsensitiveStringHashKey,
+  matchNameKeysCaseInsensitive,
+  PL_DHashMoveEntryStub,
+  PL_DHashClearEntryStub,
+  PL_DHashFinalizeStub,
+  nullptr,
 };
 
 nsStaticCaseInsensitiveNameTable::nsStaticCaseInsensitiveNameTable()
-  : mNameArray(nullptr), mNullStr("")
+  : mNameArray(nullptr)
+  , mNullStr("")
 {
-    MOZ_COUNT_CTOR(nsStaticCaseInsensitiveNameTable);
-    mNameTable.ops = nullptr;
+  MOZ_COUNT_CTOR(nsStaticCaseInsensitiveNameTable);
+  mNameTable.ops = nullptr;
 }
 
 nsStaticCaseInsensitiveNameTable::~nsStaticCaseInsensitiveNameTable()
 {
-    if (mNameArray) {
-        // manually call the destructor on placement-new'ed objects
-        for (uint32_t index = 0; index < mNameTable.entryCount; index++) {
-            mNameArray[index].~nsDependentCString();
-        }
-        nsMemory::Free((void*)mNameArray);
+  if (mNameArray) {
+    // manually call the destructor on placement-new'ed objects
+    for (uint32_t index = 0; index < mNameTable.entryCount; index++) {
+      mNameArray[index].~nsDependentCString();
     }
-    if (mNameTable.ops)
-        PL_DHashTableFinish(&mNameTable);
-    MOZ_COUNT_DTOR(nsStaticCaseInsensitiveNameTable);
+    nsMemory::Free((void*)mNameArray);
+  }
+  if (mNameTable.ops) {
+    PL_DHashTableFinish(&mNameTable);
+  }
+  MOZ_COUNT_DTOR(nsStaticCaseInsensitiveNameTable);
 }
 
 bool
-nsStaticCaseInsensitiveNameTable::Init(const char* const aNames[], int32_t Count)
+nsStaticCaseInsensitiveNameTable::Init(const char* const aNames[],
+                                       int32_t aCount)
 {
-    NS_ASSERTION(!mNameArray, "double Init");
-    NS_ASSERTION(!mNameTable.ops, "double Init");
-    NS_ASSERTION(aNames, "null name table");
-    NS_ASSERTION(Count, "0 count");
+  NS_ASSERTION(!mNameArray, "double Init");
+  NS_ASSERTION(!mNameTable.ops, "double Init");
+  NS_ASSERTION(aNames, "null name table");
+  NS_ASSERTION(aCount, "0 count");
+
+  mNameArray = (nsDependentCString*)
+    nsMemory::Alloc(aCount * sizeof(nsDependentCString));
+  if (!mNameArray) {
+    return false;
+  }
+
+  if (!PL_DHashTableInit(&mNameTable, &nametable_CaseInsensitiveHashTableOps,
+                         nullptr, sizeof(NameTableEntry), aCount,
+                         fallible_t())) {
+    mNameTable.ops = nullptr;
+    return false;
+  }
 
-    mNameArray = (nsDependentCString*)
-                   nsMemory::Alloc(Count * sizeof(nsDependentCString));
-    if (!mNameArray)
-        return false;
+  for (int32_t index = 0; index < aCount; ++index) {
+    const char* raw = aNames[index];
+#ifdef DEBUG
+    {
+      // verify invariants of contents
+      nsAutoCString temp1(raw);
+      nsDependentCString temp2(raw);
+      ToLowerCase(temp1);
+      NS_ASSERTION(temp1.Equals(temp2), "upper case char in table");
+      NS_ASSERTION(nsCRT::IsAscii(raw),
+                   "non-ascii string in table -- "
+                   "case-insensitive matching won't work right");
+    }
+#endif
+    // use placement-new to initialize the string object
+    nsDependentCString* strPtr = &mNameArray[index];
+    new (strPtr) nsDependentCString(raw);
 
-    if (!PL_DHashTableInit(&mNameTable, &nametable_CaseInsensitiveHashTableOps,
-                           nullptr, sizeof(NameTableEntry), Count,
-                           fallible_t())) {
-        mNameTable.ops = nullptr;
-        return false;
+    NameTableKey key(strPtr);
+
+    NameTableEntry* entry =
+      static_cast<NameTableEntry*>(PL_DHashTableOperate(&mNameTable, &key,
+                                                        PL_DHASH_ADD));
+    if (!entry) {
+      continue;
     }
 
-    for (int32_t index = 0; index < Count; ++index) {
-        const char* raw = aNames[index];
-#ifdef DEBUG
-        {
-            // verify invariants of contents
-            nsAutoCString temp1(raw);
-            nsDependentCString temp2(raw);
-            ToLowerCase(temp1);
-            NS_ASSERTION(temp1.Equals(temp2), "upper case char in table");
-            NS_ASSERTION(nsCRT::IsAscii(raw),
-                         "non-ascii string in table -- "
-                         "case-insensitive matching won't work right");
-        }
-#endif
-        // use placement-new to initialize the string object
-        nsDependentCString* strPtr = &mNameArray[index];
-        new (strPtr) nsDependentCString(raw);
+    NS_ASSERTION(entry->mString == 0, "Entry already exists!");
 
-        NameTableKey key(strPtr);
-
-        NameTableEntry *entry =
-          static_cast<NameTableEntry*>
-                     (PL_DHashTableOperate(&mNameTable, &key,
-                                              PL_DHASH_ADD));
-
-        if (!entry) continue;
-
-        NS_ASSERTION(entry->mString == 0, "Entry already exists!");
-
-        entry->mString = strPtr;      // not owned!
-        entry->mIndex = index;
-    }
+    entry->mString = strPtr;      // not owned!
+    entry->mIndex = index;
+  }
 #ifdef DEBUG
-    PL_DHashMarkTableImmutable(&mNameTable);
+  PL_DHashMarkTableImmutable(&mNameTable);
 #endif
-    return true;
+  return true;
 }
 
 int32_t
 nsStaticCaseInsensitiveNameTable::Lookup(const nsACString& aName)
 {
-    NS_ASSERTION(mNameArray, "not inited");
-    NS_ASSERTION(mNameTable.ops, "not inited");
+  NS_ASSERTION(mNameArray, "not inited");
+  NS_ASSERTION(mNameTable.ops, "not inited");
 
-    const nsAFlatCString& str = PromiseFlatCString(aName);
+  const nsAFlatCString& str = PromiseFlatCString(aName);
 
-    NameTableKey key(&str);
-    NameTableEntry *entry =
-        static_cast<NameTableEntry*>
-                   (PL_DHashTableOperate(&mNameTable, &key,
-                                            PL_DHASH_LOOKUP));
+  NameTableKey key(&str);
+  NameTableEntry* entry =
+    static_cast<NameTableEntry*>(PL_DHashTableOperate(&mNameTable, &key,
+                                                      PL_DHASH_LOOKUP));
+  if (PL_DHASH_ENTRY_IS_FREE(entry)) {
+    return nsStaticCaseInsensitiveNameTable::NOT_FOUND;
+  }
 
-    if (PL_DHASH_ENTRY_IS_FREE(entry))
-        return nsStaticCaseInsensitiveNameTable::NOT_FOUND;
-
-    return entry->mIndex;
+  return entry->mIndex;
 }
 
 int32_t
 nsStaticCaseInsensitiveNameTable::Lookup(const nsAString& aName)
 {
-    NS_ASSERTION(mNameArray, "not inited");
-    NS_ASSERTION(mNameTable.ops, "not inited");
+  NS_ASSERTION(mNameArray, "not inited");
+  NS_ASSERTION(mNameTable.ops, "not inited");
 
-    const nsAFlatString& str = PromiseFlatString(aName);
+  const nsAFlatString& str = PromiseFlatString(aName);
 
-    NameTableKey key(&str);
-    NameTableEntry *entry =
-        static_cast<NameTableEntry*>
-                   (PL_DHashTableOperate(&mNameTable, &key,
-                                            PL_DHASH_LOOKUP));
+  NameTableKey key(&str);
+  NameTableEntry* entry =
+    static_cast<NameTableEntry*>(PL_DHashTableOperate(&mNameTable, &key,
+                                                      PL_DHASH_LOOKUP));
+  if (PL_DHASH_ENTRY_IS_FREE(entry)) {
+    return nsStaticCaseInsensitiveNameTable::NOT_FOUND;
+  }
 
-    if (PL_DHASH_ENTRY_IS_FREE(entry))
-        return nsStaticCaseInsensitiveNameTable::NOT_FOUND;
-
-    return entry->mIndex;
+  return entry->mIndex;
 }
 
-const nsAFlatCString& 
-nsStaticCaseInsensitiveNameTable::GetStringValue(int32_t index)
+const nsAFlatCString&
+nsStaticCaseInsensitiveNameTable::GetStringValue(int32_t aIndex)
 {
-    NS_ASSERTION(mNameArray, "not inited");
-    NS_ASSERTION(mNameTable.ops, "not inited");
+  NS_ASSERTION(mNameArray, "not inited");
+  NS_ASSERTION(mNameTable.ops, "not inited");
 
-    if ((NOT_FOUND < index) && ((uint32_t)index < mNameTable.entryCount)) {
-        return mNameArray[index];
-    }
-    return mNullStr;
+  if ((NOT_FOUND < aIndex) && ((uint32_t)aIndex < mNameTable.entryCount)) {
+    return mNameArray[aIndex];
+  }
+  return mNullStr;
 }
--- a/xpcom/ds/nsStaticNameTable.h
+++ b/xpcom/ds/nsStaticNameTable.h
@@ -28,20 +28,20 @@
  *    as long as this table object - typically a static string array.
  */
 
 class nsStaticCaseInsensitiveNameTable
 {
 public:
   enum { NOT_FOUND = -1 };
 
-  bool             Init(const char* const aNames[], int32_t Count);
+  bool             Init(const char* const aNames[], int32_t aCount);
   int32_t          Lookup(const nsACString& aName);
   int32_t          Lookup(const nsAString& aName);
-  const nsAFlatCString& GetStringValue(int32_t index);
+  const nsAFlatCString& GetStringValue(int32_t aIndex);
 
   nsStaticCaseInsensitiveNameTable();
   ~nsStaticCaseInsensitiveNameTable();
 
 private:
   nsDependentCString*   mNameArray;
   PLDHashTable mNameTable;
   nsDependentCString    mNullStr;
--- a/xpcom/ds/nsStringEnumerator.cpp
+++ b/xpcom/ds/nsStringEnumerator.cpp
@@ -9,219 +9,253 @@
 #include "nsSupportsPrimitives.h"
 #include "mozilla/Attributes.h"
 #include "nsTArray.h"
 
 //
 // nsStringEnumerator
 //
 
-class nsStringEnumerator MOZ_FINAL : public nsIStringEnumerator,
-                                     public nsIUTF8StringEnumerator,
-                                     public nsISimpleEnumerator
+class nsStringEnumerator MOZ_FINAL
+  : public nsIStringEnumerator
+  , public nsIUTF8StringEnumerator
+  , public nsISimpleEnumerator
 {
 public:
-    nsStringEnumerator(const nsTArray<nsString>* aArray, bool aOwnsArray) :
-        mArray(aArray), mIndex(0), mOwnsArray(aOwnsArray), mIsUnicode(true)
-    {}
-    
-    nsStringEnumerator(const nsTArray<nsCString>* aArray, bool aOwnsArray) :
-        mCArray(aArray), mIndex(0), mOwnsArray(aOwnsArray), mIsUnicode(false)
-    {}
+  nsStringEnumerator(const nsTArray<nsString>* aArray, bool aOwnsArray)
+    : mArray(aArray)
+    , mIndex(0)
+    , mOwnsArray(aOwnsArray)
+    , mIsUnicode(true)
+  {}
+
+  nsStringEnumerator(const nsTArray<nsCString>* aArray, bool aOwnsArray)
+    : mCArray(aArray)
+    , mIndex(0)
+    , mOwnsArray(aOwnsArray)
+    , mIsUnicode(false)
+  {}
 
-    nsStringEnumerator(const nsTArray<nsString>* aArray, nsISupports* aOwner) :
-        mArray(aArray), mIndex(0), mOwner(aOwner), mOwnsArray(false), mIsUnicode(true)
-    {}
-    
-    nsStringEnumerator(const nsTArray<nsCString>* aArray, nsISupports* aOwner) :
-        mCArray(aArray), mIndex(0), mOwner(aOwner), mOwnsArray(false), mIsUnicode(false)
-    {}
+  nsStringEnumerator(const nsTArray<nsString>* aArray, nsISupports* aOwner)
+    : mArray(aArray)
+    , mIndex(0)
+    , mOwner(aOwner)
+    , mOwnsArray(false)
+    , mIsUnicode(true)
+  {}
 
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSIUTF8STRINGENUMERATOR
+  nsStringEnumerator(const nsTArray<nsCString>* aArray, nsISupports* aOwner)
+    : mCArray(aArray)
+    , mIndex(0)
+    , mOwner(aOwner)
+    , mOwnsArray(false)
+    , mIsUnicode(false)
+  {}
 
-    // have to declare nsIStringEnumerator manually, because of
-    // overlapping method names
-    NS_IMETHOD GetNext(nsAString& aResult);
-    NS_DECL_NSISIMPLEENUMERATOR
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIUTF8STRINGENUMERATOR
+
+  // have to declare nsIStringEnumerator manually, because of
+  // overlapping method names
+  NS_IMETHOD GetNext(nsAString& aResult);
+  NS_DECL_NSISIMPLEENUMERATOR
 
 private:
-    ~nsStringEnumerator() {
-        if (mOwnsArray) {
-            // const-casting is safe here, because the NS_New*
-            // constructors make sure mOwnsArray is consistent with
-            // the constness of the objects
-            if (mIsUnicode)
-                delete const_cast<nsTArray<nsString>*>(mArray);
-            else
-                delete const_cast<nsTArray<nsCString>*>(mCArray);
-        }
+  ~nsStringEnumerator()
+  {
+    if (mOwnsArray) {
+      // const-casting is safe here, because the NS_New*
+      // constructors make sure mOwnsArray is consistent with
+      // the constness of the objects
+      if (mIsUnicode) {
+        delete const_cast<nsTArray<nsString>*>(mArray);
+      } else {
+        delete const_cast<nsTArray<nsCString>*>(mCArray);
+      }
     }
+  }
 
-    union {
-        const nsTArray<nsString>* mArray;
-        const nsTArray<nsCString>* mCArray;
-    };
+  union
+  {
+    const nsTArray<nsString>* mArray;
+    const nsTArray<nsCString>* mCArray;
+  };
 
-    inline uint32_t Count() {
-        return mIsUnicode ? mArray->Length() : mCArray->Length();
-    }
-    
-    uint32_t mIndex;
+  inline uint32_t Count()
+  {
+    return mIsUnicode ? mArray->Length() : mCArray->Length();
+  }
+
+  uint32_t mIndex;
 
-    // the owner allows us to hold a strong reference to the object
-    // that owns the array. Having a non-null value in mOwner implies
-    // that mOwnsArray is false, because we rely on the real owner
-    // to release the array
-    nsCOMPtr<nsISupports> mOwner;
-    bool mOwnsArray;
-    bool mIsUnicode;
+  // the owner allows us to hold a strong reference to the object
+  // that owns the array. Having a non-null value in mOwner implies
+  // that mOwnsArray is false, because we rely on the real owner
+  // to release the array
+  nsCOMPtr<nsISupports> mOwner;
+  bool mOwnsArray;
+  bool mIsUnicode;
 };
 
 NS_IMPL_ISUPPORTS(nsStringEnumerator,
                   nsIStringEnumerator,
                   nsIUTF8StringEnumerator,
                   nsISimpleEnumerator)
 
 NS_IMETHODIMP
 nsStringEnumerator::HasMore(bool* aResult)
 {
-    *aResult = mIndex < Count();
-    return NS_OK;
+  *aResult = mIndex < Count();
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsStringEnumerator::HasMoreElements(bool* aResult)
 {
-    return HasMore(aResult);
+  return HasMore(aResult);
 }
 
 NS_IMETHODIMP
 nsStringEnumerator::GetNext(nsISupports** aResult)
 {
-    if (mIsUnicode) {
-        nsSupportsStringImpl* stringImpl = new nsSupportsStringImpl();
-        if (!stringImpl) return NS_ERROR_OUT_OF_MEMORY;
-        
-        stringImpl->SetData(mArray->ElementAt(mIndex++));
-        *aResult = stringImpl;
+  if (mIsUnicode) {
+    nsSupportsStringImpl* stringImpl = new nsSupportsStringImpl();
+    if (!stringImpl) {
+      return NS_ERROR_OUT_OF_MEMORY;
     }
-    else {
-        nsSupportsCStringImpl* cstringImpl = new nsSupportsCStringImpl();
-        if (!cstringImpl) return NS_ERROR_OUT_OF_MEMORY;
 
-        cstringImpl->SetData(mCArray->ElementAt(mIndex++));
-        *aResult = cstringImpl;
+    stringImpl->SetData(mArray->ElementAt(mIndex++));
+    *aResult = stringImpl;
+  } else {
+    nsSupportsCStringImpl* cstringImpl = new nsSupportsCStringImpl();
+    if (!cstringImpl) {
+      return NS_ERROR_OUT_OF_MEMORY;
     }
-    NS_ADDREF(*aResult);
-    return NS_OK;
+
+    cstringImpl->SetData(mCArray->ElementAt(mIndex++));
+    *aResult = cstringImpl;
+  }
+  NS_ADDREF(*aResult);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsStringEnumerator::GetNext(nsAString& aResult)
 {
-    if (NS_WARN_IF(mIndex >= Count()))
-        return NS_ERROR_UNEXPECTED;
+  if (NS_WARN_IF(mIndex >= Count())) {
+    return NS_ERROR_UNEXPECTED;
+  }
 
-    if (mIsUnicode)
-        aResult = mArray->ElementAt(mIndex++);
-    else
-        CopyUTF8toUTF16(mCArray->ElementAt(mIndex++), aResult);
-    
-    return NS_OK;
+  if (mIsUnicode) {
+    aResult = mArray->ElementAt(mIndex++);
+  } else {
+    CopyUTF8toUTF16(mCArray->ElementAt(mIndex++), aResult);
+  }
+
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsStringEnumerator::GetNext(nsACString& aResult)
 {
-    if (NS_WARN_IF(mIndex >= Count()))
-        return NS_ERROR_UNEXPECTED;
-    
-    if (mIsUnicode)
-        CopyUTF16toUTF8(mArray->ElementAt(mIndex++), aResult);
-    else
-        aResult = mCArray->ElementAt(mIndex++);
-    
-    return NS_OK;
+  if (NS_WARN_IF(mIndex >= Count())) {
+    return NS_ERROR_UNEXPECTED;
+  }
+
+  if (mIsUnicode) {
+    CopyUTF16toUTF8(mArray->ElementAt(mIndex++), aResult);
+  } else {
+    aResult = mCArray->ElementAt(mIndex++);
+  }
+
+  return NS_OK;
 }
 
 template<class T>
 static inline nsresult
 StringEnumeratorTail(T** aResult)
 {
-    if (!*aResult)
-        return NS_ERROR_OUT_OF_MEMORY;
-    NS_ADDREF(*aResult);
-    return NS_OK;
+  if (!*aResult) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
+  NS_ADDREF(*aResult);
+  return NS_OK;
 }
 
 //
 // constructors
 //
 
 nsresult
 NS_NewStringEnumerator(nsIStringEnumerator** aResult,
                        const nsTArray<nsString>* aArray, nsISupports* aOwner)
 {
-    if (NS_WARN_IF(!aResult) || NS_WARN_IF(!aArray))
-        return NS_ERROR_INVALID_ARG;
-    
-    *aResult = new nsStringEnumerator(aArray, aOwner);
-    return StringEnumeratorTail(aResult);
+  if (NS_WARN_IF(!aResult) || NS_WARN_IF(!aArray)) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  *aResult = new nsStringEnumerator(aArray, aOwner);
+  return StringEnumeratorTail(aResult);
 }
 
 
 nsresult
 NS_NewUTF8StringEnumerator(nsIUTF8StringEnumerator** aResult,
-                           const nsTArray<nsCString>* aArray, nsISupports* aOwner)
+                           const nsTArray<nsCString>* aArray,
+                           nsISupports* aOwner)
 {
-    if (NS_WARN_IF(!aResult) || NS_WARN_IF(!aArray))
-        return NS_ERROR_INVALID_ARG;
-    
-    *aResult = new nsStringEnumerator(aArray, aOwner);
-    return StringEnumeratorTail(aResult);
+  if (NS_WARN_IF(!aResult) || NS_WARN_IF(!aArray)) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  *aResult = new nsStringEnumerator(aArray, aOwner);
+  return StringEnumeratorTail(aResult);
 }
 
 nsresult
 NS_NewAdoptingStringEnumerator(nsIStringEnumerator** aResult,
                                nsTArray<nsString>* aArray)
 {
-    if (NS_WARN_IF(!aResult) || NS_WARN_IF(!aArray))
-        return NS_ERROR_INVALID_ARG;
-    
-    *aResult = new nsStringEnumerator(aArray, true);
-    return StringEnumeratorTail(aResult);
+  if (NS_WARN_IF(!aResult) || NS_WARN_IF(!aArray)) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  *aResult = new nsStringEnumerator(aArray, true);
+  return StringEnumeratorTail(aResult);
 }
 
 nsresult
 NS_NewAdoptingUTF8StringEnumerator(nsIUTF8StringEnumerator** aResult,
                                    nsTArray<nsCString>* aArray)
 {
-    if (NS_WARN_IF(!aResult) || NS_WARN_IF(!aArray))
-        return NS_ERROR_INVALID_ARG;
-    
-    *aResult = new nsStringEnumerator(aArray, true);
-    return StringEnumeratorTail(aResult);
+  if (NS_WARN_IF(!aResult) || NS_WARN_IF(!aArray)) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  *aResult = new nsStringEnumerator(aArray, true);
+  return StringEnumeratorTail(aResult);
 }
 
 // const ones internally just forward to the non-const equivalents
 nsresult
 NS_NewStringEnumerator(nsIStringEnumerator** aResult,
                        const nsTArray<nsString>* aArray)
 {
-    if (NS_WARN_IF(!aResult) || NS_WARN_IF(!aArray))
-        return NS_ERROR_INVALID_ARG;
-    
-    *aResult = new nsStringEnumerator(aArray, false);
-    return StringEnumeratorTail(aResult);
+  if (NS_WARN_IF(!aResult) || NS_WARN_IF(!aArray)) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  *aResult = new nsStringEnumerator(aArray, false);
+  return StringEnumeratorTail(aResult);
 }
 
 nsresult
 NS_NewUTF8StringEnumerator(nsIUTF8StringEnumerator** aResult,
                            const nsTArray<nsCString>* aArray)
 {
-    if (NS_WARN_IF(!aResult) || NS_WARN_IF(!aArray))
-        return NS_ERROR_INVALID_ARG;
-    
-    *aResult = new nsStringEnumerator(aArray, false);
-    return StringEnumeratorTail(aResult);
+  if (NS_WARN_IF(!aResult) || NS_WARN_IF(!aArray)) {
+    return NS_ERROR_INVALID_ARG;
+  }
+
+  *aResult = new nsStringEnumerator(aArray, false);
+  return StringEnumeratorTail(aResult);
 }
 
--- a/xpcom/ds/nsSupportsArray.cpp
+++ b/xpcom/ds/nsSupportsArray.cpp
@@ -8,17 +8,18 @@
 #include "nsSupportsArray.h"
 #include "nsSupportsArrayEnumerator.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
 
 #if DEBUG_SUPPORTSARRAY
 #define MAXSUPPORTS 20
 
-class SupportsStats {
+class SupportsStats
+{
 public:
   SupportsStats();
   ~SupportsStats();
 
 };
 
 static int sizesUsed; // number of the elements of the arrays used
 static int sizesAlloced[MAXSUPPORTS]; // sizes of the allocations.  sorted
@@ -53,197 +54,213 @@ SupportsStats::SupportsStats()
 {
   sizesUsed = 1;
   sizesAlloced[0] = 0;
 }
 
 SupportsStats::~SupportsStats()
 {
   int i;
-  for (i = 0; i < sizesUsed; i++)
-  {
-    printf("Size %d:\n",sizesAlloced[i]);
-    printf("\tNumber of SupportsArrays this size (max):     %d\n",NumberOfSize[i]);
-    printf("\tNumber of allocations this size (total):  %d\n",AllocedOfSize[i]);
-    printf("\tNumber of GrowsInPlace this size (total): %d\n",GrowInPlace[i]);
+  for (i = 0; i < sizesUsed; ++i) {
+    printf("Size %d:\n", sizesAlloced[i]);
+    printf("\tNumber of SupportsArrays this size (max):     %d\n", NumberOfSize[i]);
+    printf("\tNumber of allocations this size (total):  %d\n", AllocedOfSize[i]);
+    printf("\tNumber of GrowsInPlace this size (total): %d\n", GrowInPlace[i]);
   }
   printf("Max Size of SupportsArray:\n");
-  for (i = 0; i < (int)(sizeof(MaxElements)/sizeof(MaxElements[0])); i++)
-  {
-    if (MaxElements[i])
-      printf("\t%d: %d\n",i,MaxElements[i]);
+  for (i = 0; i < (int)(sizeof(MaxElements) / sizeof(MaxElements[0])); ++i) {
+    if (MaxElements[i]) {
+      printf("\t%d: %d\n", i, MaxElements[i]);
+    }
   }
 }
 
 // Just so constructor/destructor get called
 SupportsStats gSupportsStats;
 #endif
 
 nsresult
-nsQueryElementAt::operator()( const nsIID& aIID, void** aResult ) const
-  {
-    nsresult status = mCollection
-                        ? mCollection->QueryElementAt(mIndex, aIID, aResult)
-                        : NS_ERROR_NULL_POINTER;
+nsQueryElementAt::operator()(const nsIID& aIID, void** aResult) const
+{
+  nsresult status =
+    mCollection ? mCollection->QueryElementAt(mIndex, aIID, aResult) :
+                  NS_ERROR_NULL_POINTER;
 
-    if ( mErrorPtr )
-      *mErrorPtr = status;
-
-    return status;
+  if (mErrorPtr) {
+    *mErrorPtr = status;
   }
 
+  return status;
+}
+
 static const int32_t kGrowArrayBy = 8;
-static const int32_t kLinearThreshold = 16 * sizeof(nsISupports *);
+static const int32_t kLinearThreshold = 16 * sizeof(nsISupports*);
 
 nsSupportsArray::nsSupportsArray()
 {
   mArray = mAutoArray;
   mArraySize = kAutoArraySize;
   mCount = 0;
 #if DEBUG_SUPPORTSARRAY
   mMaxCount = 0;
   mMaxSize = 0;
-  ADD_TO_STATS(NumberOfSize,kAutoArraySize*sizeof(mArray[0]));
+  ADD_TO_STATS(NumberOfSize, kAutoArraySize * sizeof(mArray[0]));
   MaxElements[0]++;
 #endif
 }
 
 nsSupportsArray::~nsSupportsArray()
 {
   DeleteArray();
 }
 
-void nsSupportsArray::GrowArrayBy(int32_t aGrowBy)
+void
+nsSupportsArray::GrowArrayBy(int32_t aGrowBy)
 {
   // We have to grow the array. Grow by kGrowArrayBy slots if we're smaller
   // than kLinearThreshold bytes, or a power of two if we're larger.
   // This is much more efficient with most memory allocators, especially
   // if it's very large, or of the allocator is binned.
-  if (aGrowBy < kGrowArrayBy)
+  if (aGrowBy < kGrowArrayBy) {
     aGrowBy = kGrowArrayBy;
+  }
 
   uint32_t newCount = mArraySize + aGrowBy;  // Minimum increase
   uint32_t newSize = sizeof(mArray[0]) * newCount;
 
-  if (newSize >= (uint32_t) kLinearThreshold)
-  {
+  if (newSize >= (uint32_t)kLinearThreshold) {
     // newCount includes enough space for at least kGrowArrayBy new slots.
     // Select the next power-of-two size in bytes above that if newSize is
     // not a power of two.
-    if (newSize & (newSize - 1))
+    if (newSize & (newSize - 1)) {
       newSize = 1u << mozilla::CeilingLog2(newSize);
+    }
 
     newCount = newSize / sizeof(mArray[0]);
   }
   // XXX This would be far more efficient in many allocators if we used
   // XXX PR_Realloc(), etc
   nsISupports** oldArray = mArray;
 
   mArray = new nsISupports*[newCount];
   mArraySize = newCount;
 
 #if DEBUG_SUPPORTSARRAY
-  if (oldArray == mArray) // can't happen without use of realloc
-    ADD_TO_STATS(GrowInPlace,mCount);
-  ADD_TO_STATS(AllocedOfSize,mArraySize*sizeof(mArray[0]));
-  if (mArraySize > mMaxSize)
-  {
-    ADD_TO_STATS(NumberOfSize,mArraySize*sizeof(mArray[0]));
-    if (oldArray != &(mAutoArray[0]))
-      SUB_FROM_STATS(NumberOfSize,mCount*sizeof(mArray[0]));
+  if (oldArray == mArray) { // can't happen without use of realloc
+    ADD_TO_STATS(GrowInPlace, mCount);
+  }
+  ADD_TO_STATS(AllocedOfSize, mArraySize * sizeof(mArray[0]));
+  if (mArraySize > mMaxSize) {
+    ADD_TO_STATS(NumberOfSize, mArraySize * sizeof(mArray[0]));
+    if (oldArray != &(mAutoArray[0])) {
+      SUB_FROM_STATS(NumberOfSize, mCount * sizeof(mArray[0]));
+    }
     mMaxSize = mArraySize;
   }
 #endif
   if (oldArray) {                   // need to move old data
     if (0 < mCount) {
       ::memcpy(mArray, oldArray, mCount * sizeof(nsISupports*));
     }
     if (oldArray != &(mAutoArray[0])) {
       delete[] oldArray;
     }
   }
 }
 
 nsresult
-nsSupportsArray::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
+nsSupportsArray::Create(nsISupports* aOuter, REFNSIID aIID, void** aResult)
 {
-  if (aOuter)
+  if (aOuter) {
     return NS_ERROR_NO_AGGREGATION;
+  }
 
   nsCOMPtr<nsISupportsArray> it = new nsSupportsArray();
 
   return it->QueryInterface(aIID, aResult);
 }
 
-NS_IMPL_ISUPPORTS(nsSupportsArray, nsISupportsArray, nsICollection, nsISerializable)
+NS_IMPL_ISUPPORTS(nsSupportsArray, nsISupportsArray, nsICollection,
+                  nsISerializable)
 
 NS_IMETHODIMP
-nsSupportsArray::Read(nsIObjectInputStream *aStream)
+nsSupportsArray::Read(nsIObjectInputStream* aStream)
 {
   nsresult rv;
 
   uint32_t newArraySize;
   rv = aStream->Read32(&newArraySize);
 
   if (newArraySize <= kAutoArraySize) {
     if (mArray != mAutoArray) {
       delete[] mArray;
       mArray = mAutoArray;
     }
     newArraySize = kAutoArraySize;
-  }
-  else {
+  } else {
     if (newArraySize <= mArraySize) {
       // Keep non-default-size mArray, it's more than big enough.
       newArraySize = mArraySize;
-    }
-    else {
+    } else {
       nsISupports** array = new nsISupports*[newArraySize];
-      if (mArray != mAutoArray)
+      if (mArray != mAutoArray) {
         delete[] mArray;
+      }
       mArray = array;
     }
   }
   mArraySize = newArraySize;
 
   rv = aStream->Read32(&mCount);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
   NS_ASSERTION(mCount <= mArraySize, "overlarge mCount!");
-  if (mCount > mArraySize)
+  if (mCount > mArraySize) {
     mCount = mArraySize;
+  }
 
   for (uint32_t i = 0; i < mCount; i++) {
     rv = aStream->ReadObject(true, &mArray[i]);
-    if (NS_FAILED(rv)) return rv;
+    if (NS_FAILED(rv)) {
+      return rv;
+    }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSupportsArray::Write(nsIObjectOutputStream *aStream)
+nsSupportsArray::Write(nsIObjectOutputStream* aStream)
 {
   nsresult rv;
 
   rv = aStream->Write32(mArraySize);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
   rv = aStream->Write32(mCount);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
 
   for (uint32_t i = 0; i < mCount; i++) {
     rv = aStream->WriteObject(mArray[i], true);
-    if (NS_FAILED(rv)) return rv;
+    if (NS_FAILED(rv)) {
+      return rv;
+    }
   }
 
   return NS_OK;
 }
 
-void nsSupportsArray::DeleteArray(void)
+void
+nsSupportsArray::DeleteArray(void)
 {
   Clear();
   if (mArray != &(mAutoArray[0])) {
     delete[] mArray;
     mArray = mAutoArray;
     mArraySize = kAutoArraySize;
   }
 }
@@ -251,36 +268,39 @@ void nsSupportsArray::DeleteArray(void)
 
 NS_IMETHODIMP_(bool)
 nsSupportsArray::Equals(const nsISupportsArray* aOther)
 {
   if (aOther) {
     uint32_t countOther;
     nsISupportsArray* other = const_cast<nsISupportsArray*>(aOther);
     nsresult rv = other->Count(&countOther);
-    if (NS_FAILED( rv ))
+    if (NS_FAILED(rv)) {
       return false;
+    }
 
     if (mCount == countOther) {
       uint32_t index = mCount;
       nsCOMPtr<nsISupports> otherElem;
       while (index--) {
-        if (NS_FAILED(other->GetElementAt(index, getter_AddRefs(otherElem))))
+        if (NS_FAILED(other->GetElementAt(index, getter_AddRefs(otherElem)))) {
           return false;
-        if (mArray[index] != otherElem)
+        }
+        if (mArray[index] != otherElem) {
           return false;
+        }
       }
       return true;
     }
   }
   return false;
 }
 
 NS_IMETHODIMP
-nsSupportsArray::GetElementAt(uint32_t aIndex, nsISupports **aOutPtr)
+nsSupportsArray::GetElementAt(uint32_t aIndex, nsISupports** aOutPtr)
 {
   *aOutPtr = nullptr;
   if (aIndex < mCount) {
     NS_IF_ADDREF(*aOutPtr = mArray[aIndex]);
   }
   return NS_OK;
 }
 
@@ -331,27 +351,27 @@ nsSupportsArray::InsertElementAt(nsISupp
       // need to grow the array
       GrowArrayBy(1);
     }
 
     // Could be slightly more efficient if GrowArrayBy knew about the
     // split, but the difference is trivial.
     uint32_t slide = (mCount - aIndex);
     if (0 < slide) {
-      ::memmove(mArray + aIndex + 1, mArray + aIndex, slide * sizeof(nsISupports*));
+      ::memmove(mArray + aIndex + 1, mArray + aIndex,
+                slide * sizeof(nsISupports*));
     }
 
     mArray[aIndex] = aElement;
     NS_IF_ADDREF(aElement);
     mCount++;
 
 #if DEBUG_SUPPORTSARRAY
     if (mCount > mMaxCount &&
-        mCount < (int32_t)(sizeof(MaxElements)/sizeof(MaxElements[0])))
-    {
+        mCount < (int32_t)(sizeof(MaxElements) / sizeof(MaxElements[0]))) {
       MaxElements[mCount]++;
       MaxElements[mMaxCount]--;
       mMaxCount = mCount;
     }
 #endif
     return true;
   }
   return false;
@@ -359,18 +379,19 @@ nsSupportsArray::InsertElementAt(nsISupp
 
 NS_IMETHODIMP_(bool)
 nsSupportsArray::InsertElementsAt(nsISupportsArray* aElements, uint32_t aIndex)
 {
   if (!aElements) {
     return false;
   }
   uint32_t countElements;
-  if (NS_FAILED( aElements->Count( &countElements ) ))
+  if (NS_FAILED(aElements->Count(&countElements))) {
     return false;
+  }
 
   if (aIndex <= mCount) {
     if (mArraySize < (mCount + countElements)) {
       // need to grow the array
       GrowArrayBy(countElements);
     }
 
     // Could be slightly more efficient if GrowArrayBy knew about the
@@ -378,24 +399,24 @@ nsSupportsArray::InsertElementsAt(nsISup
     uint32_t slide = (mCount - aIndex);
     if (0 < slide) {
       ::memmove(mArray + aIndex + countElements, mArray + aIndex,
                 slide * sizeof(nsISupports*));
     }
 
     for (uint32_t i = 0; i < countElements; ++i, ++mCount) {
       // use GetElementAt to copy and do AddRef for us
-      if (NS_FAILED( aElements->GetElementAt( i, mArray + aIndex + i) ))
+      if (NS_FAILED(aElements->GetElementAt(i, mArray + aIndex + i))) {
         return false;
+      }
     }
 
 #if DEBUG_SUPPORTSARRAY
     if (mCount > mMaxCount &&
-        mCount < (int32_t)(sizeof(MaxElements)/sizeof(MaxElements[0])))
-    {
+        mCount < (int32_t)(sizeof(MaxElements) / sizeof(MaxElements[0]))) {
       MaxElements[mCount]++;
       MaxElements[mMaxCount]--;
       mMaxCount = mCount;
     }
 #endif
     return true;
   }
   return false;
@@ -412,77 +433,77 @@ nsSupportsArray::ReplaceElementAt(nsISup
   }
   return false;
 }
 
 NS_IMETHODIMP_(bool)
 nsSupportsArray::RemoveElementsAt(uint32_t aIndex, uint32_t aCount)
 {
   if (aIndex + aCount <= mCount) {
-    for (uint32_t i = 0; i < aCount; i++)
-      NS_IF_RELEASE(mArray[aIndex+i]);
+    for (uint32_t i = 0; i < aCount; i++) {
+      NS_IF_RELEASE(mArray[aIndex + i]);
+    }
     mCount -= aCount;
     int32_t slide = (mCount - aIndex);
     if (0 < slide) {
       ::memmove(mArray + aIndex, mArray + aIndex + aCount,
                 slide * sizeof(nsISupports*));
     }
     return true;
   }
   return false;
 }
 
 NS_IMETHODIMP_(bool)
 nsSupportsArray::RemoveElement(const nsISupports* aElement, uint32_t aStartIndex)
 {
-  int32_t theIndex = IndexOfStartingAt(aElement,aStartIndex);
-  if (theIndex >= 0)
+  int32_t theIndex = IndexOfStartingAt(aElement, aStartIndex);
+  if (theIndex >= 0) {
     return RemoveElementAt(theIndex);
+  }
 
   return false;
 }
 
 NS_IMETHODIMP_(bool)
 nsSupportsArray::RemoveLastElement(const nsISupports* aElement)
 {
   int32_t theIndex = LastIndexOf(aElement);
-  if (theIndex >= 0)
+  if (theIndex >= 0) {
     return RemoveElementAt(theIndex);
+  }
 
   return false;
 }
 
 NS_IMETHODIMP_(bool)
 nsSupportsArray::MoveElement(int32_t aFrom, int32_t aTo)
 {
-  nsISupports *tempElement;
+  nsISupports* tempElement;
 
-  if (aTo == aFrom)
+  if (aTo == aFrom) {
     return true;
+  }
 
   if (aTo < 0 || aFrom < 0 ||
-      (uint32_t) aTo >= mCount || (uint32_t) aFrom >= mCount)
-  {
+      (uint32_t)aTo >= mCount || (uint32_t)aFrom >= mCount) {
     // can't extend the array when moving an element.  Also catches mImpl = null
     return false;
   }
   tempElement = mArray[aFrom];
 
-  if (aTo < aFrom)
-  {
+  if (aTo < aFrom) {
     // Moving one element closer to the head; the elements inbetween move down
     ::memmove(mArray + aTo + 1, mArray + aTo,
-              (aFrom-aTo) * sizeof(mArray[0]));
+              (aFrom - aTo) * sizeof(mArray[0]));
     mArray[aTo] = tempElement;
-  }
-  else // already handled aFrom == aTo
-  {
+  } else { // already handled aFrom == aTo
     // Moving one element closer to the tail; the elements inbetween move up
     ::memmove(mArray + aFrom, mArray + aFrom + 1,
-              (aTo-aFrom) * sizeof(mArray[0]));
+              (aTo - aFrom) * sizeof(mArray[0]));
     mArray[aTo] = tempElement;
   }
 
   return true;
 }
 
 NS_IMETHODIMP
 nsSupportsArray::Clear(void)
@@ -502,96 +523,102 @@ nsSupportsArray::Compact(void)
 #if DEBUG_SUPPORTSARRAY
   uint32_t oldArraySize = mArraySize;
 #endif
   if ((mArraySize != mCount) && (kAutoArraySize < mArraySize)) {
     nsISupports** oldArray = mArray;
     if (mCount <= kAutoArraySize) {
       mArray = mAutoArray;
       mArraySize = kAutoArraySize;
-    }
-    else {
+    } else {
       mArray = new nsISupports*[mCount];
       if (!mArray) {
         mArray = oldArray;
         return NS_OK;
       }
       mArraySize = mCount;
     }
 #if DEBUG_SUPPORTSARRAY
     if (oldArray == mArray &&
-        oldArray != &(mAutoArray[0])) // can't happen without use of realloc
-      ADD_TO_STATS(GrowInPlace,oldArraySize);
-    if (oldArray != &(mAutoArray[0]))
-      ADD_TO_STATS(AllocedOfSize,mArraySize*sizeof(mArray[0]));
+        oldArray != &(mAutoArray[0])) { // can't happen without use of realloc
+      ADD_TO_STATS(GrowInPlace, oldArraySize);
+    }
+    if (oldArray != &(mAutoArray[0])) {
+      ADD_TO_STATS(AllocedOfSize, mArraySize * sizeof(mArray[0]));
+    }
 #endif
     ::memcpy(mArray, oldArray, mCount * sizeof(nsISupports*));
     delete[] oldArray;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP_(bool)
 nsSupportsArray::SizeTo(int32_t aSize)
 {
 #if DEBUG_SUPPORTSARRAY
   uint32_t oldArraySize = mArraySize;
 #endif
   NS_ASSERTION(aSize >= 0, "negative aSize!");
 
   // XXX for aSize < mCount we could resize to mCount
-  if (mArraySize == (uint32_t) aSize || (uint32_t) aSize < mCount)
-    return true;     // nothing to do
+  if (mArraySize == (uint32_t)aSize || (uint32_t)aSize < mCount) {
+    return true;  // nothing to do
+  }
 
   // switch back to autoarray if possible
   nsISupports** oldArray = mArray;
-  if ((uint32_t) aSize <= kAutoArraySize) {
+  if ((uint32_t)aSize <= kAutoArraySize) {
     mArray = mAutoArray;
     mArraySize = kAutoArraySize;
-  }
-  else {
+  } else {
     mArray = new nsISupports*[aSize];
     if (!mArray) {
       mArray = oldArray;
       return false;
     }
     mArraySize = aSize;
   }
 #if DEBUG_SUPPORTSARRAY
   if (oldArray == mArray &&
-      oldArray != &(mAutoArray[0])) // can't happen without use of realloc
-    ADD_TO_STATS(GrowInPlace,oldArraySize);
-  if (oldArray != &(mAutoArray[0]))
-    ADD_TO_STATS(AllocedOfSize,mArraySize*sizeof(mArray[0]));
+      oldArray != &(mAutoArray[0])) { // can't happen without use of realloc
+    ADD_TO_STATS(GrowInPlace, oldArraySize);
+  }
+  if (oldArray != &(mAutoArray[0])) {
+    ADD_TO_STATS(AllocedOfSize, mArraySize * sizeof(mArray[0]));
+  }
 #endif
   ::memcpy(mArray, oldArray, mCount * sizeof(nsISupports*));
-  if (oldArray != mAutoArray)
+  if (oldArray != mAutoArray) {
     delete[] oldArray;
+  }
 
   return true;
 }
 
 NS_IMETHODIMP
-nsSupportsArray::Enumerate(nsIEnumerator* *result)
+nsSupportsArray::Enumerate(nsIEnumerator** aResult)
 {
   nsSupportsArrayEnumerator* e = new nsSupportsArrayEnumerator(this);
-  if (!e)
+  if (!e) {
     return NS_ERROR_OUT_OF_MEMORY;
-  *result = e;
+  }
+  *aResult = e;
   NS_ADDREF(e);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSupportsArray::Clone(nsISupportsArray** aResult)
 {
   nsCOMPtr<nsISupportsArray> newArray;
   nsresult rv = NS_NewISupportsArray(getter_AddRefs(newArray));
-  if (NS_WARN_IF(NS_FAILED(rv)))
+  if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
+  }
 
   uint32_t count = 0;
   Count(&count);
   for (uint32_t i = 0; i < count; i++) {
     if (!newArray->InsertElementAt(mArray[i], i)) {
       return NS_ERROR_OUT_OF_MEMORY;
     }
   }
--- a/xpcom/ds/nsSupportsArray.h
+++ b/xpcom/ds/nsSupportsArray.h
@@ -14,101 +14,118 @@
 static const uint32_t kAutoArraySize = 8;
 
 class nsSupportsArray MOZ_FINAL : public nsISupportsArray
 {
   ~nsSupportsArray(void); // nonvirtual since we're not subclassed
 
 public:
   nsSupportsArray(void);
-  static nsresult
-  Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
+  static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
 
   NS_DECL_THREADSAFE_ISUPPORTS
 
   NS_DECL_NSISERIALIZABLE
 
   // nsICollection methods:
-  NS_IMETHOD Count(uint32_t *result) { *result = mCount; return NS_OK; }
-  NS_IMETHOD GetElementAt(uint32_t aIndex, nsISupports* *result);
-  NS_IMETHOD QueryElementAt(uint32_t aIndex, const nsIID & aIID, void * *aResult) {
+  NS_IMETHOD Count(uint32_t* aResult)
+  {
+    *aResult = mCount;
+    return NS_OK;
+  }
+  NS_IMETHOD GetElementAt(uint32_t aIndex, nsISupports** aResult);
+  NS_IMETHOD QueryElementAt(uint32_t aIndex, const nsIID& aIID, void** aResult)
+  {
     if (aIndex < mCount) {
       nsISupports* element = mArray[aIndex];
-      if (nullptr != element)
+      if (element) {
         return element->QueryInterface(aIID, aResult);
+      }
     }
     return NS_ERROR_FAILURE;
   }
-  NS_IMETHOD SetElementAt(uint32_t aIndex, nsISupports* value) {
-    return ReplaceElementAt(value, aIndex) ? NS_OK : NS_ERROR_FAILURE;
+  NS_IMETHOD SetElementAt(uint32_t aIndex, nsISupports* aValue)
+  {
+    return ReplaceElementAt(aValue, aIndex) ? NS_OK : NS_ERROR_FAILURE;
   }
-  NS_IMETHOD AppendElement(nsISupports *aElement) {
+  NS_IMETHOD AppendElement(nsISupports* aElement)
+  {
     // XXX Invalid cast of bool to nsresult (bug 778110)
     return (nsresult)InsertElementAt(aElement, mCount)/* ? NS_OK : NS_ERROR_FAILURE*/;
   }
   // XXX this is badly named - should be RemoveFirstElement
-  NS_IMETHOD RemoveElement(nsISupports *aElement) {
+  NS_IMETHOD RemoveElement(nsISupports* aElement)
+  {
     // XXX Invalid cast of bool to nsresult (bug 778110)
     return (nsresult)RemoveElement(aElement, 0)/* ? NS_OK : NS_ERROR_FAILURE*/;
   }
   NS_IMETHOD_(bool) MoveElement(int32_t aFrom, int32_t aTo);
-  NS_IMETHOD Enumerate(nsIEnumerator* *result);
+  NS_IMETHOD Enumerate(nsIEnumerator** aResult);
   NS_IMETHOD Clear(void);
 
   // nsISupportsArray methods:
   NS_IMETHOD_(bool) Equals(const nsISupportsArray* aOther);
 
   NS_IMETHOD_(int32_t) IndexOf(const nsISupports* aPossibleElement);
   NS_IMETHOD_(int32_t) IndexOfStartingAt(const nsISupports* aPossibleElement,
                                          uint32_t aStartIndex = 0);
   NS_IMETHOD_(int32_t) LastIndexOf(const nsISupports* aPossibleElement);
 
-  NS_IMETHOD GetIndexOf(nsISupports *aPossibleElement, int32_t *_retval) {
-    *_retval = IndexOf(aPossibleElement);
+  NS_IMETHOD GetIndexOf(nsISupports* aPossibleElement, int32_t* aResult)
+  {
+    *aResult = IndexOf(aPossibleElement);
     return NS_OK;
   }
-  
-  NS_IMETHOD GetIndexOfStartingAt(nsISupports *aPossibleElement,
-                                  uint32_t aStartIndex, int32_t *_retval) {
-    *_retval = IndexOfStartingAt(aPossibleElement, aStartIndex);
+
+  NS_IMETHOD GetIndexOfStartingAt(nsISupports* aPossibleElement,
+                                  uint32_t aStartIndex, int32_t* aResult)
+  {
+    *aResult = IndexOfStartingAt(aPossibleElement, aStartIndex);
     return NS_OK;
   }
-  
-  NS_IMETHOD GetLastIndexOf(nsISupports *aPossibleElement, int32_t *_retval) {
-    *_retval = LastIndexOf(aPossibleElement);
+
+  NS_IMETHOD GetLastIndexOf(nsISupports* aPossibleElement, int32_t* aResult)
+  {
+    *aResult = LastIndexOf(aPossibleElement);
     return NS_OK;
   }
-  
+
   NS_IMETHOD_(bool) InsertElementAt(nsISupports* aElement, uint32_t aIndex);
 
   NS_IMETHOD_(bool) ReplaceElementAt(nsISupports* aElement, uint32_t aIndex);
 
-  NS_IMETHOD_(bool) RemoveElementAt(uint32_t aIndex) {
-    return RemoveElementsAt(aIndex,1);
+  NS_IMETHOD_(bool) RemoveElementAt(uint32_t aIndex)
+  {
+    return RemoveElementsAt(aIndex, 1);
   }
-  NS_IMETHOD_(bool) RemoveElement(const nsISupports* aElement, uint32_t aStartIndex = 0);
+  NS_IMETHOD_(bool) RemoveElement(const nsISupports* aElement,
+                                  uint32_t aStartIndex = 0);
   NS_IMETHOD_(bool) RemoveLastElement(const nsISupports* aElement);
 
-  NS_IMETHOD DeleteLastElement(nsISupports *aElement) {
+  NS_IMETHOD DeleteLastElement(nsISupports* aElement)
+  {
     return (RemoveLastElement(aElement) ? NS_OK : NS_ERROR_FAILURE);
   }
-  
-  NS_IMETHOD DeleteElementAt(uint32_t aIndex) {
+
+  NS_IMETHOD DeleteElementAt(uint32_t aIndex)
+  {
     return (RemoveElementAt(aIndex) ? NS_OK : NS_ERROR_FAILURE);
   }
-  
-  NS_IMETHOD_(bool) AppendElements(nsISupportsArray* aElements) {
-    return InsertElementsAt(aElements,mCount);
+
+  NS_IMETHOD_(bool) AppendElements(nsISupportsArray* aElements)
+  {
+    return InsertElementsAt(aElements, mCount);
   }
-  
+
   NS_IMETHOD Compact(void);
 
-  NS_IMETHOD Clone(nsISupportsArray **_retval);
+  NS_IMETHOD Clone(nsISupportsArray** aResult);
 
-  NS_IMETHOD_(bool) InsertElementsAt(nsISupportsArray *aOther, uint32_t aIndex);
+  NS_IMETHOD_(bool) InsertElementsAt(nsISupportsArray* aOther,
+                                     uint32_t aIndex);
 
   NS_IMETHOD_(bool) RemoveElementsAt(uint32_t aIndex, uint32_t aCount);
 
   NS_IMETHOD_(bool) SizeTo(int32_t aSize);
 protected:
   void DeleteArray(void);
 
   NS_IMETHOD_(void) GrowArrayBy(int32_t aGrowBy);
@@ -119,12 +136,12 @@ protected:
   nsISupports*  mAutoArray[kAutoArraySize];
 #if DEBUG_SUPPORTSARRAY
   uint32_t mMaxCount;
   uint32_t mMaxSize;
 #endif
 
 private:
   // Copy constructors are not allowed
-  nsSupportsArray(const nsISupportsArray& other);
+  nsSupportsArray(const nsISupportsArray& aOther);
 };
 
 #endif // nsSupportsArray_h__
--- a/xpcom/ds/nsSupportsArrayEnumerator.cpp
+++ b/xpcom/ds/nsSupportsArrayEnumerator.cpp
@@ -2,98 +2,115 @@
 /* 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 "nsSupportsArrayEnumerator.h"
 #include "nsISupportsArray.h"
 
 nsSupportsArrayEnumerator::nsSupportsArrayEnumerator(nsISupportsArray* array)
-  : mArray(array), mCursor(0)
+  : mArray(array)
+  , mCursor(0)
 {
   NS_ASSERTION(array, "null array");
   NS_ADDREF(mArray);
 }
 
 nsSupportsArrayEnumerator::~nsSupportsArrayEnumerator()
 {
   NS_RELEASE(mArray);
 }
 
-NS_IMPL_ISUPPORTS(nsSupportsArrayEnumerator, nsIBidirectionalEnumerator, nsIEnumerator)
+NS_IMPL_ISUPPORTS(nsSupportsArrayEnumerator, nsIBidirectionalEnumerator,
+                  nsIEnumerator)
 
 NS_IMETHODIMP
 nsSupportsArrayEnumerator::First()
 {
   mCursor = 0;
   uint32_t cnt;
   nsresult rv = mArray->Count(&cnt);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
   int32_t end = (int32_t)cnt;
-  if (mCursor < end)
+  if (mCursor < end) {
     return NS_OK;
-  else
+  } else {
     return NS_ERROR_FAILURE;
+  }
 }
 
 NS_IMETHODIMP
 nsSupportsArrayEnumerator::Next()
 {
   uint32_t cnt;
   nsresult rv = mArray->Count(&cnt);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
   int32_t end = (int32_t)cnt;
-  if (mCursor < end)   // don't count upward forever
+  if (mCursor < end) { // don't count upward forever
     mCursor++;
-  if (mCursor < end)
+  }
+  if (mCursor < end) {
     return NS_OK;
-  else
+  } else {
     return NS_ERROR_FAILURE;
+  }
 }
 
 NS_IMETHODIMP
-nsSupportsArrayEnumerator::CurrentItem(nsISupports **aItem)
+nsSupportsArrayEnumerator::CurrentItem(nsISupports** aItem)
 {
   NS_ASSERTION(aItem, "null out parameter");
   uint32_t cnt;
   nsresult rv = mArray->Count(&cnt);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
   if (mCursor >= 0 && mCursor < (int32_t)cnt) {
     return mArray->GetElementAt(mCursor, aItem);
   }
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsSupportsArrayEnumerator::IsDone()
 {
   uint32_t cnt;
   nsresult rv = mArray->Count(&cnt);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
   // XXX This is completely incompatible with the meaning of nsresult.
   // NS_ENUMERATOR_FALSE is defined to be 1.  (bug 778111)
   return (mCursor >= 0 && mCursor < (int32_t)cnt)
     ? (nsresult)NS_ENUMERATOR_FALSE : NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 
 NS_IMETHODIMP
 nsSupportsArrayEnumerator::Last()
 {
   uint32_t cnt;
   nsresult rv = mArray->Count(&cnt);
-  if (NS_FAILED(rv)) return rv;
+  if (NS_FAILED(rv)) {
+    return rv;
+  }
   mCursor = cnt - 1;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSupportsArrayEnumerator::Prev()
 {
-  if (mCursor >= 0)
+  if (mCursor >= 0) {
     --mCursor;
-  if (mCursor >= 0)
+  }
+  if (mCursor >= 0) {
     return NS_OK;
-  else
+  } else {
     return NS_ERROR_FAILURE;
+  }
 }
 
--- a/xpcom/ds/nsSupportsArrayEnumerator.h
+++ b/xpcom/ds/nsSupportsArrayEnumerator.h
@@ -6,21 +6,22 @@
 #ifndef nsSupportsArrayEnumerator_h___
 #define nsSupportsArrayEnumerator_h___
 
 #include "nsIEnumerator.h"
 #include "mozilla/Attributes.h"
 
 class nsISupportsArray;
 
-class nsSupportsArrayEnumerator MOZ_FINAL : public nsIBidirectionalEnumerator {
+class nsSupportsArrayEnumerator MOZ_FINAL : public nsIBidirectionalEnumerator
+{
 public:
   NS_DECL_ISUPPORTS
 
-  nsSupportsArrayEnumerator(nsISupportsArray* array);
+  nsSupportsArrayEnumerator(nsISupportsArray* aArray);
 
   // nsIEnumerator methods:
   NS_DECL_NSIENUMERATOR
 
   // nsIBidirectionalEnumerator methods:
   NS_DECL_NSIBIDIRECTIONALENUMERATOR
 
 private:
--- a/xpcom/ds/nsSupportsPrimitives.cpp
+++ b/xpcom/ds/nsSupportsPrimitives.cpp
@@ -9,842 +9,885 @@
 
 using mozilla::fallible_t;
 
 /***************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsIDImpl, nsISupportsID, nsISupportsPrimitive)
 
 nsSupportsIDImpl::nsSupportsIDImpl()
-    : mData(nullptr)
+  : mData(nullptr)
 {
 }
 
-NS_IMETHODIMP nsSupportsIDImpl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsIDImpl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_ID;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_ID;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsIDImpl::GetData(nsID **aData)
+NS_IMETHODIMP
+nsSupportsIDImpl::GetData(nsID** aData)
 {
-    NS_ASSERTION(aData, "Bad pointer");
-    if(mData)
-    {
-        *aData = (nsID*) nsMemory::Clone(mData, sizeof(nsID));
-        return *aData ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-    }
-    *aData = nullptr;
-    return NS_OK;
+  NS_ASSERTION(aData, "Bad pointer");
+  if (mData) {
+    *aData = (nsID*)nsMemory::Clone(mData, sizeof(nsID));
+    return *aData ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+  }
+  *aData = nullptr;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsIDImpl::SetData(const nsID *aData)
+NS_IMETHODIMP
+nsSupportsIDImpl::SetData(const nsID* aData)
 {
-    if(mData)
-      nsMemory::Free(mData);
-    if(aData)
-        mData = (nsID*) nsMemory::Clone(aData, sizeof(nsID));
-    else
-        mData = nullptr;
-    return NS_OK;
+  if (mData) {
+    nsMemory::Free(mData);
+  }
+  if (aData) {
+    mData = (nsID*)nsMemory::Clone(aData, sizeof(nsID));
+  } else {
+    mData = nullptr;
+  }
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsIDImpl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsIDImpl::ToString(char** aResult)
 {
-    char* result;
-    NS_ASSERTION(_retval, "Bad pointer");
-    if(mData)
-    {
-        result = mData->ToString();
-    }
-    else
-    {
-        static const char nullStr[] = "null";
-        result = (char*) nsMemory::Clone(nullStr, sizeof(nullStr));
-    }
+  char* result;
+  NS_ASSERTION(aResult, "Bad pointer");
+  if (mData) {
+    result = mData->ToString();
+  } else {
+    static const char nullStr[] = "null";
+    result = (char*)nsMemory::Clone(nullStr, sizeof(nullStr));
+  }
 
-    *_retval = result;
-    return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}  
+  *aResult = result;
+  return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /*****************************************************************************
  * nsSupportsCStringImpl
  *****************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsCStringImpl, nsISupportsCString,
                   nsISupportsPrimitive)
 
-NS_IMETHODIMP nsSupportsCStringImpl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsCStringImpl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
+  NS_ASSERTION(aType, "Bad pointer");
 
-    *aType = TYPE_CSTRING;
-    return NS_OK;
+  *aType = TYPE_CSTRING;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsCStringImpl::GetData(nsACString& aData)
+NS_IMETHODIMP
+nsSupportsCStringImpl::GetData(nsACString& aData)
 {
-    aData = mData;
-    return NS_OK;
+  aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsCStringImpl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsCStringImpl::ToString(char** aResult)
 {
-    *_retval = ToNewCString(mData);
+  *aResult = ToNewCString(mData);
 
-    if (!*_retval)
-        return NS_ERROR_OUT_OF_MEMORY;
-    
-    return NS_OK;
+  if (!*aResult) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
+
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsCStringImpl::SetData(const nsACString& aData)
+NS_IMETHODIMP
+nsSupportsCStringImpl::SetData(const nsACString& aData)
 {
-    bool ok = mData.Assign(aData, fallible_t());
-    if (!ok)
-        return NS_ERROR_OUT_OF_MEMORY;
-    return NS_OK;
+  bool ok = mData.Assign(aData, fallible_t());
+  if (!ok) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
+  return NS_OK;
 }
 
 /*****************************************************************************
  * nsSupportsStringImpl
  *****************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsStringImpl, nsISupportsString,
                   nsISupportsPrimitive)
 
-NS_IMETHODIMP nsSupportsStringImpl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsStringImpl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
+  NS_ASSERTION(aType, "Bad pointer");
 
-    *aType = TYPE_STRING;
-    return NS_OK;
+  *aType = TYPE_STRING;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsStringImpl::GetData(nsAString& aData)
+NS_IMETHODIMP
+nsSupportsStringImpl::GetData(nsAString& aData)
 {
-    aData = mData;
-    return NS_OK;
+  aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsStringImpl::ToString(char16_t **_retval)
+NS_IMETHODIMP
+nsSupportsStringImpl::ToString(char16_t** aResult)
 {
-    *_retval = ToNewUnicode(mData);
-    
-    if (!*_retval)
-        return NS_ERROR_OUT_OF_MEMORY;
-    
-    return NS_OK;
+  *aResult = ToNewUnicode(mData);
+
+  if (!*aResult) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
+
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsStringImpl::SetData(const nsAString& aData)
+NS_IMETHODIMP
+nsSupportsStringImpl::SetData(const nsAString& aData)
 {
-    bool ok = mData.Assign(aData, fallible_t());
-    if (!ok)
-        return NS_ERROR_OUT_OF_MEMORY;
-    return NS_OK;
+  bool ok = mData.Assign(aData, fallible_t());
+  if (!ok) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
+  return NS_OK;
 }
 
 /***************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsPRBoolImpl, nsISupportsPRBool,
                   nsISupportsPrimitive)
 
 nsSupportsPRBoolImpl::nsSupportsPRBoolImpl()
-    : mData(false)
+  : mData(false)
 {
 }
 
-NS_IMETHODIMP nsSupportsPRBoolImpl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsPRBoolImpl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_PRBOOL;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_PRBOOL;
 
-    return NS_OK;
-}
-
-NS_IMETHODIMP nsSupportsPRBoolImpl::GetData(bool *aData)
-{
-    NS_ASSERTION(aData, "Bad pointer");
-    *aData = mData;
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRBoolImpl::SetData(bool aData)
+NS_IMETHODIMP
+nsSupportsPRBoolImpl::GetData(bool* aData)
 {
-    mData = aData;
-    return NS_OK;
+  NS_ASSERTION(aData, "Bad pointer");
+  *aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRBoolImpl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsPRBoolImpl::SetData(bool aData)
 {
-    NS_ASSERTION(_retval, "Bad pointer");
-    const char * str = mData ? "true" : "false";
-    char* result = (char*) nsMemory::Clone(str,
-                                (strlen(str)+1)*sizeof(char));
-    *_retval = result;
-    return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}  
+  mData = aData;
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsSupportsPRBoolImpl::ToString(char** aResult)
+{
+  NS_ASSERTION(aResult, "Bad pointer");
+  const char* str = mData ? "true" : "false";
+  *aResult = (char*)nsMemory::Clone(str, (strlen(str) + 1) * sizeof(char));
+  return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /***************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsPRUint8Impl, nsISupportsPRUint8,
                   nsISupportsPrimitive)
 
 nsSupportsPRUint8Impl::nsSupportsPRUint8Impl()
-    : mData(0)
+  : mData(0)
 {
 }
 
-NS_IMETHODIMP nsSupportsPRUint8Impl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsPRUint8Impl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_PRUINT8;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_PRUINT8;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRUint8Impl::GetData(uint8_t *aData)
+NS_IMETHODIMP
+nsSupportsPRUint8Impl::GetData(uint8_t* aData)
 {
-    NS_ASSERTION(aData, "Bad pointer");
-    *aData = mData;
-    return NS_OK;
+  NS_ASSERTION(aData, "Bad pointer");
+  *aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRUint8Impl::SetData(uint8_t aData)
+NS_IMETHODIMP
+nsSupportsPRUint8Impl::SetData(uint8_t aData)
 {
-    mData = aData;
-    return NS_OK;
+  mData = aData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRUint8Impl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsPRUint8Impl::ToString(char** aResult)
 {
-    NS_ASSERTION(_retval, "Bad pointer");
-    static const int size = 8;
-    char buf[size];
+  NS_ASSERTION(aResult, "Bad pointer");
+  static const int size = 8;
+  char buf[size];
+  PR_snprintf(buf, size, "%u", (uint16_t)mData);
 
-    PR_snprintf(buf, size, "%u", (uint16_t) mData);
-
-    char* result = (char*) nsMemory::Clone(buf,
-                                (strlen(buf)+1)*sizeof(char));
-    *_retval = result;
-    return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}  
+  *aResult = (char*)nsMemory::Clone(buf, (strlen(buf) + 1) * sizeof(char));
+  return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /***************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsPRUint16Impl, nsISupportsPRUint16,
                   nsISupportsPrimitive)
 
 nsSupportsPRUint16Impl::nsSupportsPRUint16Impl()
-    : mData(0)
+  : mData(0)
 {
 }
 
-NS_IMETHODIMP nsSupportsPRUint16Impl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsPRUint16Impl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_PRUINT16;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_PRUINT16;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRUint16Impl::GetData(uint16_t *aData)
+NS_IMETHODIMP
+nsSupportsPRUint16Impl::GetData(uint16_t* aData)
 {
-    NS_ASSERTION(aData, "Bad pointer");
-    *aData = mData;
-    return NS_OK;
+  NS_ASSERTION(aData, "Bad pointer");
+  *aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRUint16Impl::SetData(uint16_t aData)
+NS_IMETHODIMP
+nsSupportsPRUint16Impl::SetData(uint16_t aData)
 {
-    mData = aData;
-    return NS_OK;
+  mData = aData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRUint16Impl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsPRUint16Impl::ToString(char** aResult)
 {
-    NS_ASSERTION(_retval, "Bad pointer");
-    static const int size = 8;
-    char buf[size];
+  NS_ASSERTION(aResult, "Bad pointer");
+  static const int size = 8;
+  char buf[size];
+  PR_snprintf(buf, size, "%u", (int)mData);
 
-    PR_snprintf(buf, size, "%u", (int) mData);
-
-    char* result = (char*) nsMemory::Clone(buf,
-                                (strlen(buf)+1)*sizeof(char));
-    *_retval = result;
-    return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}  
+  *aResult = (char*)nsMemory::Clone(buf, (strlen(buf) + 1) * sizeof(char));
+  return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /***************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsPRUint32Impl, nsISupportsPRUint32,
                   nsISupportsPrimitive)
 
 nsSupportsPRUint32Impl::nsSupportsPRUint32Impl()
-    : mData(0)
+  : mData(0)
 {
 }
 
-NS_IMETHODIMP nsSupportsPRUint32Impl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsPRUint32Impl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_PRUINT32;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_PRUINT32;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRUint32Impl::GetData(uint32_t *aData)
+NS_IMETHODIMP
+nsSupportsPRUint32Impl::GetData(uint32_t* aData)
 {
-    NS_ASSERTION(aData, "Bad pointer");
-    *aData = mData;
-    return NS_OK;
+  NS_ASSERTION(aData, "Bad pointer");
+  *aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRUint32Impl::SetData(uint32_t aData)
+NS_IMETHODIMP
+nsSupportsPRUint32Impl::SetData(uint32_t aData)
 {
-    mData = aData;
-    return NS_OK;
+  mData = aData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRUint32Impl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsPRUint32Impl::ToString(char** aResult)
 {
-    NS_ASSERTION(_retval, "Bad pointer");
-    static const int size = 16;
-    char buf[size];
+  NS_ASSERTION(aResult, "Bad pointer");
+  static const int size = 16;
+  char buf[size];
+  PR_snprintf(buf, size, "%lu", mData);
 
-    PR_snprintf(buf, size, "%lu", mData);
-
-    char* result = (char*) nsMemory::Clone(buf,
-                                (strlen(buf)+1)*sizeof(char));
-    *_retval = result;
-    return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}  
+  *aResult = (char*)nsMemory::Clone(buf, (strlen(buf) + 1) * sizeof(char));
+  return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /***************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsPRUint64Impl, nsISupportsPRUint64,
                   nsISupportsPrimitive)
 
 nsSupportsPRUint64Impl::nsSupportsPRUint64Impl()
-    : mData(0)
+  : mData(0)
 {
 }
 
-NS_IMETHODIMP nsSupportsPRUint64Impl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsPRUint64Impl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_PRUINT64;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_PRUINT64;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRUint64Impl::GetData(uint64_t *aData)
+NS_IMETHODIMP
+nsSupportsPRUint64Impl::GetData(uint64_t* aData)
 {
-    NS_ASSERTION(aData, "Bad pointer");
-    *aData = mData;
-    return NS_OK;
+  NS_ASSERTION(aData, "Bad pointer");
+  *aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRUint64Impl::SetData(uint64_t aData)
+NS_IMETHODIMP
+nsSupportsPRUint64Impl::SetData(uint64_t aData)
 {
-    mData = aData;
-    return NS_OK;
+  mData = aData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRUint64Impl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsPRUint64Impl::ToString(char** aResult)
 {
-    NS_ASSERTION(_retval, "Bad pointer");
-    static const int size = 32;
-    char buf[size];
+  NS_ASSERTION(aResult, "Bad pointer");
+  static const int size = 32;
+  char buf[size];
+  PR_snprintf(buf, size, "%llu", mData);
 
-    PR_snprintf(buf, size, "%llu", mData);
-
-    char* result = (char*) nsMemory::Clone(buf,
-                                (strlen(buf)+1)*sizeof(char));
-    *_retval = result;
-    return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}  
+  *aResult = (char*)nsMemory::Clone(buf, (strlen(buf) + 1) * sizeof(char));
+  return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /***************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsPRTimeImpl, nsISupportsPRTime,
                   nsISupportsPrimitive)
 
 nsSupportsPRTimeImpl::nsSupportsPRTimeImpl()
-    : mData(0)
+  : mData(0)
 {
 }
 
-NS_IMETHODIMP nsSupportsPRTimeImpl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsPRTimeImpl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_PRTIME;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_PRTIME;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRTimeImpl::GetData(PRTime *aData)
+NS_IMETHODIMP
+nsSupportsPRTimeImpl::GetData(PRTime* aData)
 {
-    NS_ASSERTION(aData, "Bad pointer");
-    *aData = mData;
-    return NS_OK;
+  NS_ASSERTION(aData, "Bad pointer");
+  *aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRTimeImpl::SetData(PRTime aData)
+NS_IMETHODIMP
+nsSupportsPRTimeImpl::SetData(PRTime aData)
 {
-    mData = aData;
-    return NS_OK;
+  mData = aData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRTimeImpl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsPRTimeImpl::ToString(char** aResult)
 {
-    NS_ASSERTION(_retval, "Bad pointer");
-    static const int size = 32;
-    char buf[size];
+  NS_ASSERTION(aResult, "Bad pointer");
+  static const int size = 32;
+  char buf[size];
+  PR_snprintf(buf, size, "%llu", mData);
 
-    PR_snprintf(buf, size, "%llu", mData);
-
-    char* result = (char*) nsMemory::Clone(buf,
-                                (strlen(buf)+1)*sizeof(char));
-    *_retval = result;
-    return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}  
+  *aResult = (char*)nsMemory::Clone(buf, (strlen(buf) + 1) * sizeof(char));
+  return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /***************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsCharImpl, nsISupportsChar,
                   nsISupportsPrimitive)
 
 nsSupportsCharImpl::nsSupportsCharImpl()
-    : mData(0)
+  : mData(0)
 {
 }
 
-NS_IMETHODIMP nsSupportsCharImpl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsCharImpl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_CHAR;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_CHAR;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsCharImpl::GetData(char *aData)
+NS_IMETHODIMP
+nsSupportsCharImpl::GetData(char* aData)
 {
-    NS_ASSERTION(aData, "Bad pointer");
-    *aData = mData;
-    return NS_OK;
+  NS_ASSERTION(aData, "Bad pointer");
+  *aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsCharImpl::SetData(char aData)
+NS_IMETHODIMP
+nsSupportsCharImpl::SetData(char aData)
 {
-    mData = aData;
-    return NS_OK;
+  mData = aData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsCharImpl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsCharImpl::ToString(char** aResult)
 {
-    char* result;
-    NS_ASSERTION(_retval, "Bad pointer");
+  NS_ASSERTION(aResult, "Bad pointer");
 
-    if(nullptr != (result = (char*) nsMemory::Alloc(2*sizeof(char))))
-    {
-        result[0] = mData;
-        result[1] = '\0';
-    }
-    *_retval = result;
-    return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}  
+  char* result = (char*)nsMemory::Alloc(2 * sizeof(char));
+  if (result) {
+    result[0] = mData;
+    result[1] = '\0';
+  }
+  *aResult = result;
+  return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /***************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsPRInt16Impl, nsISupportsPRInt16,
                   nsISupportsPrimitive)
 
 nsSupportsPRInt16Impl::nsSupportsPRInt16Impl()
-    : mData(0)
+  : mData(0)
 {
 }
 
-NS_IMETHODIMP nsSupportsPRInt16Impl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsPRInt16Impl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_PRINT16;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_PRINT16;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRInt16Impl::GetData(int16_t *aData)
+NS_IMETHODIMP
+nsSupportsPRInt16Impl::GetData(int16_t* aData)
 {
-    NS_ASSERTION(aData, "Bad pointer");
-    *aData = mData;
-    return NS_OK;
+  NS_ASSERTION(aData, "Bad pointer");
+  *aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRInt16Impl::SetData(int16_t aData)
+NS_IMETHODIMP
+nsSupportsPRInt16Impl::SetData(int16_t aData)
 {
-    mData = aData;
-    return NS_OK;
+  mData = aData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRInt16Impl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsPRInt16Impl::ToString(char** aResult)
 {
-    NS_ASSERTION(_retval, "Bad pointer");
-    static const int size = 8;
-    char buf[size];
+  NS_ASSERTION(aResult, "Bad pointer");
+  static const int size = 8;
+  char buf[size];
+  PR_snprintf(buf, size, "%d", mData);
 
-    PR_snprintf(buf, size, "%d", mData);
-
-    char* result = (char*) nsMemory::Clone(buf,
-                                (strlen(buf)+1)*sizeof(char));
-    *_retval = result;
-    return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}  
+  *aResult = (char*)nsMemory::Clone(buf, (strlen(buf) + 1) * sizeof(char));
+  return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /***************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsPRInt32Impl, nsISupportsPRInt32,
                   nsISupportsPrimitive)
 
 nsSupportsPRInt32Impl::nsSupportsPRInt32Impl()
-    : mData(0)
+  : mData(0)
 {
 }
 
-NS_IMETHODIMP nsSupportsPRInt32Impl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsPRInt32Impl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_PRINT32;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_PRINT32;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRInt32Impl::GetData(int32_t *aData)
+NS_IMETHODIMP
+nsSupportsPRInt32Impl::GetData(int32_t* aData)
 {
-    NS_ASSERTION(aData, "Bad pointer");
-    *aData = mData;
-    return NS_OK;
+  NS_ASSERTION(aData, "Bad pointer");
+  *aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRInt32Impl::SetData(int32_t aData)
+NS_IMETHODIMP
+nsSupportsPRInt32Impl::SetData(int32_t aData)
 {
-    mData = aData;
-    return NS_OK;
+  mData = aData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRInt32Impl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsPRInt32Impl::ToString(char** aResult)
 {
-    NS_ASSERTION(_retval, "Bad pointer");
-    static const int size = 16;
-    char buf[size];
+  NS_ASSERTION(aResult, "Bad pointer");
+  static const int size = 16;
+  char buf[size];
+  PR_snprintf(buf, size, "%ld", mData);
 
-    PR_snprintf(buf, size, "%ld", mData);
-
-    char* result = (char*) nsMemory::Clone(buf,
-                                (strlen(buf)+1)*sizeof(char));
-    *_retval = result;
-    return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}  
+  *aResult = (char*)nsMemory::Clone(buf, (strlen(buf) + 1) * sizeof(char));
+  return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /***************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsPRInt64Impl, nsISupportsPRInt64,
                   nsISupportsPrimitive)
 
 nsSupportsPRInt64Impl::nsSupportsPRInt64Impl()
-    : mData(0)
+  : mData(0)
 {
 }
 
-NS_IMETHODIMP nsSupportsPRInt64Impl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsPRInt64Impl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_PRINT64;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_PRINT64;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRInt64Impl::GetData(int64_t *aData)
+NS_IMETHODIMP
+nsSupportsPRInt64Impl::GetData(int64_t* aData)
 {
-    NS_ASSERTION(aData, "Bad pointer");
-    *aData = mData;
-    return NS_OK;
+  NS_ASSERTION(aData, "Bad pointer");
+  *aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRInt64Impl::SetData(int64_t aData)
+NS_IMETHODIMP
+nsSupportsPRInt64Impl::SetData(int64_t aData)
 {
-    mData = aData;
-    return NS_OK;
+  mData = aData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsPRInt64Impl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsPRInt64Impl::ToString(char** aResult)
 {
-    NS_ASSERTION(_retval, "Bad pointer");
-    static const int size = 32;
-    char buf[size];
+  NS_ASSERTION(aResult, "Bad pointer");
+  static const int size = 32;
+  char buf[size];
+  PR_snprintf(buf, size, "%lld", mData);
 
-    PR_snprintf(buf, size, "%lld", mData);
-
-    char* result = (char*) nsMemory::Clone(buf,
-                                (strlen(buf)+1)*sizeof(char));
-    *_retval = result;
-    return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}  
+  *aResult = (char*)nsMemory::Clone(buf, (strlen(buf) + 1) * sizeof(char));
+  return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /***************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsFloatImpl, nsISupportsFloat,
                   nsISupportsPrimitive)
 
 nsSupportsFloatImpl::nsSupportsFloatImpl()
-    : mData(float(0.0))
+  : mData(float(0.0))
 {
 }
 
-NS_IMETHODIMP nsSupportsFloatImpl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsFloatImpl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_FLOAT;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_FLOAT;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsFloatImpl::GetData(float *aData)
+NS_IMETHODIMP
+nsSupportsFloatImpl::GetData(float* aData)
 {
-    NS_ASSERTION(aData, "Bad pointer");
-    *aData = mData;
-    return NS_OK;
+  NS_ASSERTION(aData, "Bad pointer");
+  *aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsFloatImpl::SetData(float aData)
+NS_IMETHODIMP
+nsSupportsFloatImpl::SetData(float aData)
 {
-    mData = aData;
-    return NS_OK;
+  mData = aData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsFloatImpl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsFloatImpl::ToString(char** aResult)
 {
-    NS_ASSERTION(_retval, "Bad pointer");
-    static const int size = 32;
-    char buf[size];
+  NS_ASSERTION(aResult, "Bad pointer");
+  static const int size = 32;
+  char buf[size];
+  PR_snprintf(buf, size, "%f", (double)mData);
 
-    PR_snprintf(buf, size, "%f", (double) mData);
-
-    char* result = (char*) nsMemory::Clone(buf,
-                                (strlen(buf)+1)*sizeof(char));
-    *_retval = result;
-    return result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}  
+  *aResult = (char*)nsMemory::Clone(buf, (strlen(buf) + 1) * sizeof(char));
+  return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /***************************************************************************/
 
 NS_IMPL_ISUPPORTS(nsSupportsDoubleImpl, nsISupportsDouble,
                   nsISupportsPrimitive)
 
 nsSupportsDoubleImpl::nsSupportsDoubleImpl()
-    : mData(double(0.0))
+  : mData(double(0.0))
 {
 }
 
-NS_IMETHODIMP nsSupportsDoubleImpl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsDoubleImpl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_DOUBLE;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_DOUBLE;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsDoubleImpl::GetData(double *aData)
+NS_IMETHODIMP
+nsSupportsDoubleImpl::GetData(double* aData)
 {
-    NS_ASSERTION(aData, "Bad pointer");
-    *aData = mData;
-    return NS_OK;
+  NS_ASSERTION(aData, "Bad pointer");
+  *aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsDoubleImpl::SetData(double aData)
+NS_IMETHODIMP
+nsSupportsDoubleImpl::SetData(double aData)
 {
-    mData = aData;
-    return NS_OK;
+  mData = aData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsDoubleImpl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsDoubleImpl::ToString(char** aResult)
 {
-    NS_ASSERTION(_retval, "Bad pointer");
-    static const int size = 32;
-    char buf[size];
+  NS_ASSERTION(aResult, "Bad pointer");
+  static const int size = 32;
+  char buf[size];
+  PR_snprintf(buf, size, "%f", mData);
 
-    PR_snprintf(buf, size, "%f", mData);
-
-    char* result = (char*) nsMemory::Clone(buf,
-                                (strlen(buf)+1)*sizeof(char));
-    *_retval = result;
-    return  result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}  
+  *aResult = (char*)nsMemory::Clone(buf, (strlen(buf) + 1) * sizeof(char));
+  return  *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /***************************************************************************/
 
 
 NS_IMPL_ISUPPORTS(nsSupportsVoidImpl, nsISupportsVoid,
                   nsISupportsPrimitive)
 
 nsSupportsVoidImpl::nsSupportsVoidImpl()
-    : mData(nullptr)
+  : mData(nullptr)
 {
 }
 
-NS_IMETHODIMP nsSupportsVoidImpl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsVoidImpl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_VOID;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_VOID;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsVoidImpl::GetData(void * *aData)
+NS_IMETHODIMP
+nsSupportsVoidImpl::GetData(void** aData)
 {
-    NS_ASSERTION(aData, "Bad pointer");
-    *aData = mData;
-    return NS_OK;
+  NS_ASSERTION(aData, "Bad pointer");
+  *aData = mData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsVoidImpl::SetData(void * aData)
+NS_IMETHODIMP
+nsSupportsVoidImpl::SetData(void* aData)
 {
-    mData = aData;
-    return NS_OK;
+  mData = aData;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsVoidImpl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsVoidImpl::ToString(char** aResult)
 {
-    NS_ASSERTION(_retval, "Bad pointer");
+  NS_ASSERTION(aResult, "Bad pointer");
 
-    static const char str[] = "[raw data]";
-    char* result = (char*) nsMemory::Clone(str, sizeof(str));
-    *_retval = result;
-    return  result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}  
+  static const char str[] = "[raw data]";
+  char* result = (char*)nsMemory::Clone(str, sizeof(str));
+  *aResult = result;
+  return  result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+}
 
 /***************************************************************************/
 
 
 NS_IMPL_ISUPPORTS(nsSupportsInterfacePointerImpl,
                   nsISupportsInterfacePointer,
                   nsISupportsPrimitive)
 
 nsSupportsInterfacePointerImpl::nsSupportsInterfacePointerImpl()
-    : mIID(nullptr)
+  : mIID(nullptr)
 {
 }
 
 nsSupportsInterfacePointerImpl::~nsSupportsInterfacePointerImpl()
 {
-    if (mIID) {
-        nsMemory::Free(mIID);
-    }
+  if (mIID) {
+    nsMemory::Free(mIID);
+  }
 }
 
-NS_IMETHODIMP nsSupportsInterfacePointerImpl::GetType(uint16_t *aType)
+NS_IMETHODIMP
+nsSupportsInterfacePointerImpl::GetType(uint16_t* aType)
 {
-    NS_ASSERTION(aType, "Bad pointer");
-    *aType = TYPE_INTERFACE_POINTER;
+  NS_ASSERTION(aType, "Bad pointer");
+  *aType = TYPE_INTERFACE_POINTER;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsInterfacePointerImpl::GetData(nsISupports **aData)
+NS_IMETHODIMP
+nsSupportsInterfacePointerImpl::GetData(nsISupports** aData)
 {
-    NS_ASSERTION(aData,"Bad pointer");
+  NS_ASSERTION(aData, "Bad pointer");
 
-    *aData = mData;
-    NS_IF_ADDREF(*aData);
+  *aData = mData;
+  NS_IF_ADDREF(*aData);
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsInterfacePointerImpl::SetData(nsISupports * aData)
+NS_IMETHODIMP
+nsSupportsInterfacePointerImpl::SetData(nsISupports* aData)
 {
-    mData = aData;
+  mData = aData;
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsInterfacePointerImpl::GetDataIID(nsID **aIID)
+NS_IMETHODIMP
+nsSupportsInterfacePointerImpl::GetDataIID(nsID** aIID)
 {
-    NS_ASSERTION(aIID,"Bad pointer");
+  NS_ASSERTION(aIID, "Bad pointer");
 
-    if(mIID)
-    {
-        *aIID = (nsID*) nsMemory::Clone(mIID, sizeof(nsID));
-        return *aIID ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-    }
-    *aIID = nullptr;
-    return NS_OK;
+  if (mIID) {
+    *aIID = (nsID*)nsMemory::Clone(mIID, sizeof(nsID));
+    return *aIID ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+  }
+  *aIID = nullptr;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsInterfacePointerImpl::SetDataIID(const nsID *aIID)
+NS_IMETHODIMP
+nsSupportsInterfacePointerImpl::SetDataIID(const nsID* aIID)
 {
-    if(mIID)
-        nsMemory::Free(mIID);
-    if(aIID)
-        mIID = (nsID*) nsMemory::Clone(aIID, sizeof(nsID));
-    else
-        mIID = nullptr;
+  if (mIID) {
+    nsMemory::Free(mIID);
+  }
+  if (aIID) {
+    mIID = (nsID*)nsMemory::Clone(aIID, sizeof(nsID));
+  } else {
+    mIID = nullptr;
+  }
 
-    return NS_OK;
+  return NS_OK;
 }
 
-NS_IMETHODIMP nsSupportsInterfacePointerImpl::ToString(char **_retval)
+NS_IMETHODIMP
+nsSupportsInterfacePointerImpl::ToString(char** aResult)
 {
-    NS_ASSERTION(_retval, "Bad pointer");
-
-    static const char str[] = "[interface pointer]";
+  NS_ASSERTION(aResult, "Bad pointer");
 
-    // jband sez: think about asking nsIInterfaceInfoManager whether
-    // the interface has a known human-readable name
-    char* result = (char*) nsMemory::Clone(str, sizeof(str));
-    *_retval = result;
-    return  result ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+  static const char str[] = "[interface pointer]";
+
+  // jband sez: think about asking nsIInterfaceInfoManager whether
+  // the interface has a known human-readable name
+  *aResult = (char*)nsMemory::Clone(str, sizeof(str));
+  return  *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
 }
 
 /***************************************************************************/
 
-NS_IMPL_ISUPPORTS(nsSupportsDependentCString,nsISupportsCString,nsISupportsPrimitive)
+NS_IMPL_ISUPPORTS(nsSupportsDependentCString, nsISupportsCString,
+                  nsISupportsPrimitive)
 
 nsSupportsDependentCString::nsSupportsDependentCString(const char* aStr)
-    : mData(aStr)
+  : mData(aStr)
 { }
 
 NS_IMETHODIMP
-nsSupportsDependentCString::GetType(uint16_t *aType)
+nsSupportsDependentCString::GetType(uint16_t* aType)
 {
-    if (NS_WARN_IF(!aType))
-        return NS_ERROR_INVALID_ARG;
+  if (NS_WARN_IF(!aType)) {
+    return NS_ERROR_INVALID_ARG;
+  }
 
-    *aType = TYPE_CSTRING;
-    return NS_OK;
+  *aType = TYPE_CSTRING;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSupportsDependentCString::GetData(nsACString& aData)
 {
-    aData = mData;
-    return NS_OK;
+  aData = mData;
+  return NS_OK;
 }
 
 NS_IMETHODIMP
-nsSupportsDependentCString::ToString(char **_retval)
+nsSupportsDependentCString::ToString(char** aResult)
 {
-    if (NS_WARN_IF(!_retval))
-        return NS_ERROR_INVALID_ARG;
+  if (NS_WARN_IF(!aResult)) {
+    return NS_ERROR_INVALID_ARG;
+  }
 
-    *_retval = ToNewCString(mData);
-    if (!*_retval)
-        return NS_ERROR_OUT_OF_MEMORY;
-    
-    return NS_OK;
+  *aResult = ToNewCString(mData);
+  if (!*aResult) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
+
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsSupportsDependentCString::SetData(const nsACString& aData)
 {
-    return NS_ERROR_NOT_IMPLEMENTED;
+  return NS_ERROR_NOT_IMPLEMENTED;
 }
--- a/xpcom/ds/nsSupportsPrimitives.h
+++ b/xpcom/ds/nsSupportsPrimitives.h
@@ -10,299 +10,299 @@
 
 #include "nsISupportsPrimitives.h"
 #include "nsCOMPtr.h"
 #include "nsString.h"
 
 class nsSupportsIDImpl MOZ_FINAL : public nsISupportsID
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSID
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSID
 
-    nsSupportsIDImpl();
+  nsSupportsIDImpl();
 
 private:
-    ~nsSupportsIDImpl() { }
+  ~nsSupportsIDImpl() {}
 
-    nsID *mData;
+  nsID* mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsCStringImpl MOZ_FINAL : public nsISupportsCString
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSCSTRING
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSCSTRING
 
-    nsSupportsCStringImpl() {}
+  nsSupportsCStringImpl() {}
 
 private:
-    ~nsSupportsCStringImpl() {}
-    
-    nsCString mData;
+  ~nsSupportsCStringImpl() {}
+
+  nsCString mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsStringImpl MOZ_FINAL : public nsISupportsString
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSSTRING
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSSTRING
 
-    nsSupportsStringImpl() {}
+  nsSupportsStringImpl() {}
 
 private:
-    ~nsSupportsStringImpl() {}
-    
-    nsString mData;
+  ~nsSupportsStringImpl() {}
+
+  nsString mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsPRBoolImpl MOZ_FINAL : public nsISupportsPRBool
 {
 public:
-    NS_DECL_THREADSAFE_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSPRBOOL
+  NS_DECL_THREADSAFE_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSPRBOOL
 
-    nsSupportsPRBoolImpl();
+  nsSupportsPRBoolImpl();
 
 private:
-    ~nsSupportsPRBoolImpl() {}
+  ~nsSupportsPRBoolImpl() {}
 
-    bool mData;
+  bool mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsPRUint8Impl MOZ_FINAL : public nsISupportsPRUint8
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSPRUINT8
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSPRUINT8
 
-    nsSupportsPRUint8Impl();
+  nsSupportsPRUint8Impl();
 
 private:
-    ~nsSupportsPRUint8Impl() {}
+  ~nsSupportsPRUint8Impl() {}
 
-    uint8_t mData;
+  uint8_t mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsPRUint16Impl MOZ_FINAL : public nsISupportsPRUint16
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSPRUINT16
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSPRUINT16
 
-    nsSupportsPRUint16Impl();
+  nsSupportsPRUint16Impl();
 
 private:
-    ~nsSupportsPRUint16Impl() {}
+  ~nsSupportsPRUint16Impl() {}
 
-    uint16_t mData;
+  uint16_t mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsPRUint32Impl MOZ_FINAL : public nsISupportsPRUint32
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSPRUINT32
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSPRUINT32
 
-    nsSupportsPRUint32Impl();
+  nsSupportsPRUint32Impl();
 
 private:
-    ~nsSupportsPRUint32Impl() {}
+  ~nsSupportsPRUint32Impl() {}
 
-    uint32_t mData;
+  uint32_t mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsPRUint64Impl MOZ_FINAL : public nsISupportsPRUint64
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSPRUINT64
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSPRUINT64
 
-    nsSupportsPRUint64Impl();
+  nsSupportsPRUint64Impl();
 
 private:
-    ~nsSupportsPRUint64Impl() {}
+  ~nsSupportsPRUint64Impl() {}
 
-    uint64_t mData;
+  uint64_t mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsPRTimeImpl MOZ_FINAL : public nsISupportsPRTime
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSPRTIME
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSPRTIME
 
-    nsSupportsPRTimeImpl();
+  nsSupportsPRTimeImpl();
 
 private:
-    ~nsSupportsPRTimeImpl() {}
+  ~nsSupportsPRTimeImpl() {}
 
-    PRTime mData;
+  PRTime mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsCharImpl MOZ_FINAL : public nsISupportsChar
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSCHAR
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSCHAR
 
-    nsSupportsCharImpl();
+  nsSupportsCharImpl();
 
 private:
-    ~nsSupportsCharImpl() {}
+  ~nsSupportsCharImpl() {}
 
-    char mData;
+  char mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsPRInt16Impl MOZ_FINAL : public nsISupportsPRInt16
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSPRINT16
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSPRINT16
 
-    nsSupportsPRInt16Impl();
+  nsSupportsPRInt16Impl();
 
 private:
-    ~nsSupportsPRInt16Impl() {}
+  ~nsSupportsPRInt16Impl() {}
 
-    int16_t mData;
+  int16_t mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsPRInt32Impl MOZ_FINAL : public nsISupportsPRInt32
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSPRINT32
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSPRINT32
 
-    nsSupportsPRInt32Impl();
+  nsSupportsPRInt32Impl();
 
 private:
-    ~nsSupportsPRInt32Impl() {}
+  ~nsSupportsPRInt32Impl() {}
 
-    int32_t mData;
+  int32_t mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsPRInt64Impl MOZ_FINAL : public nsISupportsPRInt64
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSPRINT64
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSPRINT64
 
-    nsSupportsPRInt64Impl();
+  nsSupportsPRInt64Impl();
 
 private:
-    ~nsSupportsPRInt64Impl() {}
+  ~nsSupportsPRInt64Impl() {}
 
-    int64_t mData;
+  int64_t mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsFloatImpl MOZ_FINAL : public nsISupportsFloat
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSFLOAT
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSFLOAT
 
-    nsSupportsFloatImpl();
+  nsSupportsFloatImpl();
 
 private:
-    ~nsSupportsFloatImpl() {}
+  ~nsSupportsFloatImpl() {}
 
-    float mData;
+  float mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsDoubleImpl MOZ_FINAL : public nsISupportsDouble
 {
 public:
-    NS_DECL_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSDOUBLE
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSDOUBLE
 
-    nsSupportsDoubleImpl();
+  nsSupportsDoubleImpl();
 
 private:
-    ~nsSupportsDoubleImpl() {}
+  ~nsSupportsDoubleImpl() {}
 
-    double mData;
+  double mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsVoidImpl MOZ_FINAL : public nsISupportsVoid
 {
 public:
-    NS_DECL_THREADSAFE_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSVOID
+  NS_DECL_THREADSAFE_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSVOID
 
-    nsSupportsVoidImpl();
+  nsSupportsVoidImpl();
 
 private:
-    ~nsSupportsVoidImpl() {}
+  ~nsSupportsVoidImpl() {}
 
-    void* mData;
+  void* mData;
 };
 
 /***************************************************************************/
 
 class nsSupportsInterfacePointerImpl MOZ_FINAL : public nsISupportsInterfacePointer
 {
 public:
-    NS_DECL_THREADSAFE_ISUPPORTS
-    NS_DECL_NSISUPPORTSPRIMITIVE
-    NS_DECL_NSISUPPORTSINTERFACEPOINTER
+  NS_DECL_THREADSAFE_ISUPPORTS
+  NS_DECL_NSISUPPORTSPRIMITIVE
+  NS_DECL_NSISUPPORTSINTERFACEPOINTER
 
-    nsSupportsInterfacePointerImpl();
+  nsSupportsInterfacePointerImpl();
 
 private:
-    ~nsSupportsInterfacePointerImpl();
+  ~nsSupportsInterfacePointerImpl();
 
-    nsCOMPtr<nsISupports> mData;
-    nsID *mIID;
+  nsCOMPtr<nsISupports> mData;
+  nsID* mIID;
 };
 
 /***************************************************************************/
 
 /**
  * Wraps a static const char* buffer for use with nsISupportsCString
  *
  * Only use this class with static buffers, or arena-allocated buffers of
--- a/xpcom/ds/nsVariant.cpp
+++ b/xpcom/ds/nsVariant.cpp
@@ -15,450 +15,452 @@
 #include "nsReadableUtils.h"
 #include "nsMemory.h"
 #include "nsString.h"
 #include "nsCRTGlue.h"
 
 /***************************************************************************/
 // Helpers for static convert functions...
 
-static nsresult String2Double(const char* aString, double* retval)
+static nsresult
+String2Double(const char* aString, double* aResult)
 {
-    char* next;
-    double value = PR_strtod(aString, &next);
-    if(next == aString)
-        return NS_ERROR_CANNOT_CONVERT_DATA;
-    *retval = value;
-    return NS_OK;
+  char* next;
+  double value = PR_strtod(aString, &next);
+  if (next == aString) {
+    return NS_ERROR_CANNOT_CONVERT_DATA;
+  }
+  *aResult = value;
+  return NS_OK;
 }
 
-static nsresult AString2Double(const nsAString& aString, double* retval)
+static nsresult
+AString2Double(const nsAString& aString, double* aResult)
 {
-    char* pChars = ToNewCString(aString);
-    if(!pChars)
-        return NS_ERROR_OUT_OF_MEMORY;
-    nsresult rv = String2Double(pChars, retval);
-    nsMemory::Free(pChars);
-    return rv;
+  char* pChars = ToNewCString(aString);
+  if (!pChars) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
+  nsresult rv = String2Double(pChars, aResult);
+  nsMemory::Free(pChars);
+  return rv;
 }
 
-static nsresult AUTF8String2Double(const nsAUTF8String& aString, double* retval)
+static nsresult
+AUTF8String2Double(const nsAUTF8String& aString, double* aResult)
 {
-    return String2Double(PromiseFlatUTF8String(aString).get(), retval);
+  return String2Double(PromiseFlatUTF8String(aString).get(), aResult);
 }
 
-static nsresult ACString2Double(const nsACString& aString, double* retval)
+static nsresult
+ACString2Double(const nsACString& aString, double* aResult)
 {
-    return String2Double(PromiseFlatCString(aString).get(), retval);
+  return String2Double(PromiseFlatCString(aString).get(), aResult);
 }
 
 // Fills outVariant with double, uint32_t, or int32_t.
 // Returns NS_OK, an error code, or a non-NS_OK success code
-static nsresult ToManageableNumber(const nsDiscriminatedUnion& inData,
-                                   nsDiscriminatedUnion* outData)
+static nsresult
+ToManageableNumber(const nsDiscriminatedUnion& aInData,
+                   nsDiscriminatedUnion* aOutData)
 {
-    nsresult rv;
+  nsresult rv;
 
-    switch(inData.mType)
-    {
+  switch (aInData.mType) {
     // This group results in a int32_t...
 
 #define CASE__NUMBER_INT32(type_, member_)                                    \
     case nsIDataType :: type_ :                                               \
-        outData->u.mInt32Value = inData.u. member_ ;                          \
-        outData->mType = nsIDataType::VTYPE_INT32;                            \
+        aOutData->u.mInt32Value = aInData.u. member_ ;                        \
+        aOutData->mType = nsIDataType::VTYPE_INT32;                           \
         return NS_OK;
 
     CASE__NUMBER_INT32(VTYPE_INT8,   mInt8Value)
     CASE__NUMBER_INT32(VTYPE_INT16,  mInt16Value)
     CASE__NUMBER_INT32(VTYPE_INT32,  mInt32Value)
     CASE__NUMBER_INT32(VTYPE_UINT8,  mUint8Value)
     CASE__NUMBER_INT32(VTYPE_UINT16, mUint16Value)
     CASE__NUMBER_INT32(VTYPE_BOOL,   mBoolValue)
     CASE__NUMBER_INT32(VTYPE_CHAR,   mCharValue)
     CASE__NUMBER_INT32(VTYPE_WCHAR,  mWCharValue)
 
 #undef CASE__NUMBER_INT32
 
     // This group results in a uint32_t...
 
     case nsIDataType::VTYPE_UINT32:
-        outData->u.mInt32Value = inData.u.mUint32Value;
-        outData->mType = nsIDataType::VTYPE_INT32;
-        return NS_OK;
+      aOutData->u.mInt32Value = aInData.u.mUint32Value;
+      aOutData->mType = nsIDataType::VTYPE_INT32;
+      return NS_OK;
 
     // This group results in a double...
 
     case nsIDataType::VTYPE_INT64:
     case nsIDataType::VTYPE_UINT64:
-        // XXX Need boundary checking here.
-        // We may need to return NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA
-        outData->u.mDoubleValue = double(inData.u.mInt64Value);
-        outData->mType = nsIDataType::VTYPE_DOUBLE;
-        return NS_OK;
+      // XXX Need boundary checking here.
+      // We may need to return NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA
+      aOutData->u.mDoubleValue = double(aInData.u.mInt64Value);
+      aOutData->mType = nsIDataType::VTYPE_DOUBLE;
+      return NS_OK;
     case nsIDataType::VTYPE_FLOAT:
-        outData->u.mDoubleValue = inData.u.mFloatValue;
-        outData->mType = nsIDataType::VTYPE_DOUBLE;
-        return NS_OK;
+      aOutData->u.mDoubleValue = aInData.u.mFloatValue;
+      aOutData->mType = nsIDataType::VTYPE_DOUBLE;
+      return NS_OK;
     case nsIDataType::VTYPE_DOUBLE:
-        outData->u.mDoubleValue = inData.u.mDoubleValue;
-        outData->mType = nsIDataType::VTYPE_DOUBLE;
-        return NS_OK;
+      aOutData->u.mDoubleValue = aInData.u.mDoubleValue;
+      aOutData->mType = nsIDataType::VTYPE_DOUBLE;
+      return NS_OK;
     case nsIDataType::VTYPE_CHAR_STR:
     case nsIDataType::VTYPE_STRING_SIZE_IS:
-        rv = String2Double(inData.u.str.mStringValue, &outData->u.mDoubleValue);
-        if(NS_FAILED(rv))
-            return rv;
-        outData->mType = nsIDataType::VTYPE_DOUBLE;
-        return NS_OK;
+      rv = String2Double(aInData.u.str.mStringValue, &aOutData->u.mDoubleValue);
+      if (NS_FAILED(rv)) {
+        return rv;
+      }
+      aOutData->mType = nsIDataType::VTYPE_DOUBLE;
+      return NS_OK;
     case nsIDataType::VTYPE_DOMSTRING:
     case nsIDataType::VTYPE_ASTRING:
-        rv = AString2Double(*inData.u.mAStringValue, &outData->u.mDoubleValue);
-        if(NS_FAILED(rv))
-            return rv;
-        outData->mType = nsIDataType::VTYPE_DOUBLE;
-        return NS_OK;
+      rv = AString2Double(*aInData.u.mAStringValue, &aOutData->u.mDoubleValue);
+      if (NS_FAILED(rv)) {
+        return rv;
+      }
+      aOutData->mType = nsIDataType::VTYPE_DOUBLE;
+      return NS_OK;
     case nsIDataType::VTYPE_UTF8STRING:
-        rv = AUTF8String2Double(*inData.u.mUTF8StringValue,
-                                &outData->u.mDoubleValue);
-        if(NS_FAILED(rv))
-            return rv;
-        outData->mType = nsIDataType::VTYPE_DOUBLE;
-        return NS_OK;
+      rv = AUTF8String2Double(*aInData.u.mUTF8StringValue,
+                              &aOutData->u.mDoubleValue);
+      if (NS_FAILED(rv)) {
+        return rv;
+      }
+      aOutData->mType = nsIDataType::VTYPE_DOUBLE;
+      return NS_OK;
     case nsIDataType::VTYPE_CSTRING:
-        rv = ACString2Double(*inData.u.mCStringValue,
-                             &outData->u.mDoubleValue);
-        if(NS_FAILED(rv))
-            return rv;
-        outData->mType = nsIDataType::VTYPE_DOUBLE;
-        return NS_OK;
+      rv = ACString2Double(*aInData.u.mCStringValue,
+                           &aOutData->u.mDoubleValue);
+      if (NS_FAILED(rv)) {
+        return rv;
+      }
+      aOutData->mType = nsIDataType::VTYPE_DOUBLE;
+      return NS_OK;
     case nsIDataType::VTYPE_WCHAR_STR:
     case nsIDataType::VTYPE_WSTRING_SIZE_IS:
-        rv = AString2Double(nsDependentString(inData.u.wstr.mWStringValue),
-                            &outData->u.mDoubleValue);
-        if(NS_FAILED(rv))
-            return rv;
-        outData->mType = nsIDataType::VTYPE_DOUBLE;
-        return NS_OK;
+      rv = AString2Double(nsDependentString(aInData.u.wstr.mWStringValue),
+                          &aOutData->u.mDoubleValue);
+      if (NS_FAILED(rv)) {
+        return rv;
+      }
+      aOutData->mType = nsIDataType::VTYPE_DOUBLE;
+      return NS_OK;
 
     // This group fails...
 
     case nsIDataType::VTYPE_VOID:
     case nsIDataType::VTYPE_ID:
     case nsIDataType::VTYPE_INTERFACE:
     case nsIDataType::VTYPE_INTERFACE_IS:
     case nsIDataType::VTYPE_ARRAY:
     case nsIDataType::VTYPE_EMPTY_ARRAY:
     case nsIDataType::VTYPE_EMPTY:
     default:
-        return NS_ERROR_CANNOT_CONVERT_DATA;
-    }
+      return NS_ERROR_CANNOT_CONVERT_DATA;
+  }
 }
 
 /***************************************************************************/
 // Array helpers...
 
-static void FreeArray(nsDiscriminatedUnion* data)
+static void
+FreeArray(nsDiscriminatedUnion* aData)
 {
-    NS_ASSERTION(data->mType == nsIDataType::VTYPE_ARRAY, "bad FreeArray call");
-    NS_ASSERTION(data->u.array.mArrayValue, "bad array");
-    NS_ASSERTION(data->u.array.mArrayCount, "bad array count");
+  NS_ASSERTION(aData->mType == nsIDataType::VTYPE_ARRAY, "bad FreeArray call");
+  NS_ASSERTION(aData->u.array.mArrayValue, "bad array");
+  NS_ASSERTION(aData->u.array.mArrayCount, "bad array count");
 
 #define CASE__FREE_ARRAY_PTR(type_, ctype_)                                   \
         case nsIDataType:: type_ :                                            \
         {                                                                     \
-            ctype_ ** p = (ctype_ **) data->u.array.mArrayValue;              \
-            for(uint32_t i = data->u.array.mArrayCount; i > 0; p++, i--)      \
+            ctype_ ** p = (ctype_ **) aData->u.array.mArrayValue;             \
+            for(uint32_t i = aData->u.array.mArrayCount; i > 0; p++, i--)     \
                 if(*p)                                                        \
                     nsMemory::Free((char*)*p);                                \
             break;                                                            \
         }
 
 #define CASE__FREE_ARRAY_IFACE(type_, ctype_)                                 \
         case nsIDataType:: type_ :                                            \
         {                                                                     \
-            ctype_ ** p = (ctype_ **) data->u.array.mArrayValue;              \
-            for(uint32_t i = data->u.array.mArrayCount; i > 0; p++, i--)      \
+            ctype_ ** p = (ctype_ **) aData->u.array.mArrayValue;             \
+            for(uint32_t i = aData->u.array.mArrayCount; i > 0; p++, i--)     \
                 if(*p)                                                        \
                     (*p)->Release();                                          \
             break;                                                            \
         }
 
-    switch(data->u.array.mArrayType)
-    {
-        case nsIDataType::VTYPE_INT8:
-        case nsIDataType::VTYPE_INT16:
-        case nsIDataType::VTYPE_INT32:
-        case nsIDataType::VTYPE_INT64:
-        case nsIDataType::VTYPE_UINT8:
-        case nsIDataType::VTYPE_UINT16:
-        case nsIDataType::VTYPE_UINT32:
-        case nsIDataType::VTYPE_UINT64:
-        case nsIDataType::VTYPE_FLOAT:
-        case nsIDataType::VTYPE_DOUBLE:
-        case nsIDataType::VTYPE_BOOL:
-        case nsIDataType::VTYPE_CHAR:
-        case nsIDataType::VTYPE_WCHAR:
-            break;
+  switch (aData->u.array.mArrayType) {
+    case nsIDataType::VTYPE_INT8:
+    case nsIDataType::VTYPE_INT16:
+    case nsIDataType::VTYPE_INT32:
+    case nsIDataType::VTYPE_INT64:
+    case nsIDataType::VTYPE_UINT8:
+    case nsIDataType::VTYPE_UINT16:
+    case nsIDataType::VTYPE_UINT32:
+    case nsIDataType::VTYPE_UINT64:
+    case nsIDataType::VTYPE_FLOAT:
+    case nsIDataType::VTYPE_DOUBLE:
+    case nsIDataType::VTYPE_BOOL:
+    case nsIDataType::VTYPE_CHAR:
+    case nsIDataType::VTYPE_WCHAR:
+      break;
 
-        // XXX We ASSUME that "array of nsID" means "array of pointers to nsID".
-        CASE__FREE_ARRAY_PTR(VTYPE_ID, nsID)
-        CASE__FREE_ARRAY_PTR(VTYPE_CHAR_STR, char)
-        CASE__FREE_ARRAY_PTR(VTYPE_WCHAR_STR, char16_t)
-        CASE__FREE_ARRAY_IFACE(VTYPE_INTERFACE, nsISupports)
-        CASE__FREE_ARRAY_IFACE(VTYPE_INTERFACE_IS, nsISupports)
+    // XXX We ASSUME that "array of nsID" means "array of pointers to nsID".
+    CASE__FREE_ARRAY_PTR(VTYPE_ID, nsID)
+    CASE__FREE_ARRAY_PTR(VTYPE_CHAR_STR, char)
+    CASE__FREE_ARRAY_PTR(VTYPE_WCHAR_STR, char16_t)
+    CASE__FREE_ARRAY_IFACE(VTYPE_INTERFACE, nsISupports)
+    CASE__FREE_ARRAY_IFACE(VTYPE_INTERFACE_IS, nsISupports)
 
-        // The rest are illegal.
-        case nsIDataType::VTYPE_VOID:
-        case nsIDataType::VTYPE_ASTRING:
-        case nsIDataType::VTYPE_DOMSTRING:
-        case nsIDataType::VTYPE_UTF8STRING:
-        case nsIDataType::VTYPE_CSTRING:
-        case nsIDataType::VTYPE_WSTRING_SIZE_IS:
-        case nsIDataType::VTYPE_STRING_SIZE_IS:
-        case nsIDataType::VTYPE_ARRAY:
-        case nsIDataType::VTYPE_EMPTY_ARRAY:
-        case nsIDataType::VTYPE_EMPTY:
-        default:
-            NS_ERROR("bad type in array!");
-            break;
-    }
+    // The rest are illegal.
+    case nsIDataType::VTYPE_VOID:
+    case nsIDataType::VTYPE_ASTRING:
+    case nsIDataType::VTYPE_DOMSTRING:
+    case nsIDataType::VTYPE_UTF8STRING:
+    case nsIDataType::VTYPE_CSTRING:
+    case nsIDataType::VTYPE_WSTRING_SIZE_IS:
+    case nsIDataType::VTYPE_STRING_SIZE_IS:
+    case nsIDataType::VTYPE_ARRAY:
+    case nsIDataType::VTYPE_EMPTY_ARRAY:
+    case nsIDataType::VTYPE_EMPTY:
+    default:
+      NS_ERROR("bad type in array!");
+      break;
+  }
 
-    // Free the array memory.
-    nsMemory::Free((char*)data->u.array.mArrayValue);
+  // Free the array memory.
+  nsMemory::Free((char*)aData->u.array.mArrayValue);
 
 #undef CASE__FREE_ARRAY_PTR
 #undef CASE__FREE_ARRAY_IFACE
 }
 
-static nsresult CloneArray(uint16_t inType, const nsIID* inIID,
-                           uint32_t inCount, void* inValue,
-                           uint16_t* outType,
-                           nsIID* outIID,
-                           uint32_t* outCount,
-                           void** outValue)
+static nsresult
+CloneArray(uint16_t aInType, const nsIID* aInIID,
+           uint32_t aInCount, void* aInValue,
+           uint16_t* aOutType, nsIID* aOutIID,
+           uint32_t* aOutCount, void** aOutValue)
 {
-    NS_ASSERTION(inCount, "bad param");
-    NS_ASSERTION(inValue, "bad param");
-    NS_ASSERTION(outType, "bad param");
-    NS_ASSERTION(outCount, "bad param");
-    NS_ASSERTION(outValue, "bad param");
+  NS_ASSERTION(aInCount, "bad param");
+  NS_ASSERTION(aInValue, "bad param");
+  NS_ASSERTION(aOutType, "bad param");
+  NS_ASSERTION(aOutCount, "bad param");
+  NS_ASSERTION(aOutValue, "bad param");
 
-    uint32_t allocatedValueCount = 0;
-    nsresult rv = NS_OK;
-    uint32_t i;
+  uint32_t allocatedValueCount = 0;
+  nsresult rv = NS_OK;
+  uint32_t i;
 
-    // First we figure out the size of the elements for the new u.array.
+  // First we figure out the size of the elements for the new u.array.
 
-    size_t elementSize;
-    size_t allocSize;
+  size_t elementSize;
+  size_t allocSize;
 
-    switch(inType)
-    {
-        case nsIDataType::VTYPE_INT8:
-            elementSize = sizeof(int8_t);
-            break;
-        case nsIDataType::VTYPE_INT16:
-            elementSize = sizeof(int16_t);
-            break;
-        case nsIDataType::VTYPE_INT32:
-            elementSize = sizeof(int32_t);
-            break;
-        case nsIDataType::VTYPE_INT64:
-            elementSize = sizeof(int64_t);
-            break;
-        case nsIDataType::VTYPE_UINT8:
-            elementSize = sizeof(uint8_t);
-            break;
-        case nsIDataType::VTYPE_UINT16:
-            elementSize = sizeof(uint16_t);
-            break;
-        case nsIDataType::VTYPE_UINT32:
-            elementSize = sizeof(uint32_t);
-            break;
-        case nsIDataType::VTYPE_UINT64:
-            elementSize = sizeof(uint64_t);
-            break;
-        case nsIDataType::VTYPE_FLOAT:
-            elementSize = sizeof(float);
-            break;
-        case nsIDataType::VTYPE_DOUBLE:
-            elementSize = sizeof(double);
-            break;
-        case nsIDataType::VTYPE_BOOL:
-            elementSize = sizeof(bool);
-            break;
-        case nsIDataType::VTYPE_CHAR:
-            elementSize = sizeof(char);
-            break;
-        case nsIDataType::VTYPE_WCHAR:
-            elementSize = sizeof(char16_t);
-            break;
+  switch (aInType) {
+    case nsIDataType::VTYPE_INT8:
+      elementSize = sizeof(int8_t);
+      break;
+    case nsIDataType::VTYPE_INT16:
+      elementSize = sizeof(int16_t);
+      break;
+    case nsIDataType::VTYPE_INT32:
+      elementSize = sizeof(int32_t);
+      break;
+    case nsIDataType::VTYPE_INT64:
+      elementSize = sizeof(int64_t);
+      break;
+    case nsIDataType::VTYPE_UINT8:
+      elementSize = sizeof(uint8_t);
+      break;
+    case nsIDataType::VTYPE_UINT16:
+      elementSize = sizeof(uint16_t);
+      break;
+    case nsIDataType::VTYPE_UINT32:
+      elementSize = sizeof(uint32_t);
+      break;
+    case nsIDataType::VTYPE_UINT64:
+      elementSize = sizeof(uint64_t);
+      break;
+    case nsIDataType::VTYPE_FLOAT:
+      elementSize = sizeof(float);
+      break;
+    case nsIDataType::VTYPE_DOUBLE:
+      elementSize = sizeof(double);
+      break;
+    case nsIDataType::VTYPE_BOOL:
+      elementSize = sizeof(bool);
+      break;
+    case nsIDataType::VTYPE_CHAR:
+      elementSize = sizeof(char);
+      break;
+    case nsIDataType::VTYPE_WCHAR:
+      elementSize = sizeof(char16_t);
+      break;
 
-        // XXX We ASSUME that "array of nsID" means "array of pointers to nsID".
-        case nsIDataType::VTYPE_ID:
-        case nsIDataType::VTYPE_CHAR_STR:
-        case nsIDataType::VTYPE_WCHAR_STR:
-        case nsIDataType::VTYPE_INTERFACE:
-        case nsIDataType::VTYPE_INTERFACE_IS:
-            elementSize = sizeof(void*);
-            break;
+    // XXX We ASSUME that "array of nsID" means "array of pointers to nsID".
+    case nsIDataType::VTYPE_ID:
+    case nsIDataType::VTYPE_CHAR_STR:
+    case nsIDataType::VTYPE_WCHAR_STR:
+    case nsIDataType::VTYPE_INTERFACE:
+    case nsIDataType::VTYPE_INTERFACE_IS:
+      elementSize = sizeof(void*);
+      break;
 
-        // The rest are illegal.
-        case nsIDataType::VTYPE_ASTRING:
-        case nsIDataType::VTYPE_DOMSTRING:
-        case nsIDataType::VTYPE_UTF8STRING:
-        case nsIDataType::VTYPE_CSTRING:
-        case nsIDataType::VTYPE_STRING_SIZE_IS:
-        case nsIDataType::VTYPE_WSTRING_SIZE_IS:
-        case nsIDataType::VTYPE_VOID:
-        case nsIDataType::VTYPE_ARRAY:
-        case nsIDataType::VTYPE_EMPTY_ARRAY:
-        case nsIDataType::VTYPE_EMPTY:
-        default:
-            NS_ERROR("bad type in array!");
-            return NS_ERROR_CANNOT_CONVERT_DATA;
-    }
+    // The rest are illegal.
+    case nsIDataType::VTYPE_ASTRING:
+    case nsIDataType::VTYPE_DOMSTRING:
+    case nsIDataType::VTYPE_UTF8STRING:
+    case nsIDataType::VTYPE_CSTRING:
+    case nsIDataType::VTYPE_STRING_SIZE_IS:
+    case nsIDataType::VTYPE_WSTRING_SIZE_IS:
+    case nsIDataType::VTYPE_VOID:
+    case nsIDataType::VTYPE_ARRAY:
+    case nsIDataType::VTYPE_EMPTY_ARRAY:
+    case nsIDataType::VTYPE_EMPTY:
+    default:
+      NS_ERROR("bad type in array!");
+      return NS_ERROR_CANNOT_CONVERT_DATA;
+  }
 
 
-    // Alloc the u.array.
+  // Alloc the u.array.
 
-    allocSize = inCount * elementSize;
-    *outValue = nsMemory::Alloc(allocSize);
-    if(!*outValue)
-        return NS_ERROR_OUT_OF_MEMORY;
+  allocSize = aInCount * elementSize;
+  *aOutValue = nsMemory::Alloc(allocSize);
+  if (!*aOutValue) {
+    return NS_ERROR_OUT_OF_MEMORY;
+  }
 
-    // Clone the elements.
+  // Clone the elements.
 
-    switch(inType)
-    {
-        case nsIDataType::VTYPE_INT8:
-        case nsIDataType::VTYPE_INT16:
-        case nsIDataType::VTYPE_INT32:
-        case nsIDataType::VTYPE_INT64:
-        case nsIDataType::VTYPE_UINT8:
-        case nsIDataType::VTYPE_UINT16:
-        case nsIDataType::VTYPE_UINT32:
-        case nsIDataType::VTYPE_UINT64:
-        case nsIDataType::VTYPE_FLOAT:
-        case nsIDataType::VTYPE_DOUBLE:
-        case nsIDataType::VTYPE_BOOL:
-        case nsIDataType::VTYPE_CHAR:
-        case nsIDataType::VTYPE_WCHAR:
-            memcpy(*outValue, inValue, allocSize);
-            break;
-
-        case nsIDataType::VTYPE_INTERFACE_IS:
-            if(outIID)
-                *outIID = *inIID;
-            // fall through...
-        case nsIDataType::VTYPE_INTERFACE:
-        {
-            memcpy(*outValue, inValue, allocSize);
-
-            nsISupports** p = (nsISupports**) *outValue;
-            for(i = inCount; i > 0; p++, i--)
-                if(*p)
-                    (*p)->AddRef();
-            break;
-        }
+  switch (aInType) {
+    case nsIDataType::VTYPE_INT8:
+    case nsIDataType::VTYPE_INT16:
+    case nsIDataType::VTYPE_INT32:
+    case nsIDataType::VTYPE_INT64:
+    case nsIDataType::VTYPE_UINT8:
+    case nsIDataType::VTYPE_UINT16:
+    case nsIDataType::VTYPE_UINT32:
+    case nsIDataType::VTYPE_UINT64:
+    case nsIDataType::VTYPE_FLOAT:
+    case nsIDataType::VTYPE_DOUBLE:
+    case nsIDataType::VTYPE_BOOL:
+    case nsIDataType::VTYPE_CHAR:
+    case nsIDataType::VTYPE_WCHAR:
+      memcpy(*aOutValue, aInValue, allocSize);
+      break;
 
-        // XXX We ASSUME that "array of nsID" means "array of pointers to nsID".
-        case nsIDataType::VTYPE_ID:
-        {
-            nsID** inp  = (nsID**) inValue;
-            nsID** outp = (nsID**) *outValue;
-            for(i = inCount; i > 0; i--)
-            {
-                nsID* idp = *(inp++);
-                if(idp)
-                {
-                    if(nullptr == (*(outp++) = (nsID*)
-                       nsMemory::Clone((char*)idp, sizeof(nsID))))
-                        goto bad;
-                }
-                else
-                    *(outp++) = nullptr;
-                allocatedValueCount++;
-            }
-            break;
+    case nsIDataType::VTYPE_INTERFACE_IS:
+      if (aOutIID) {
+        *aOutIID = *aInIID;
+      }
+    // fall through...
+    case nsIDataType::VTYPE_INTERFACE: {
+      memcpy(*aOutValue, aInValue, allocSize);
+
+      nsISupports** p = (nsISupports**)*aOutValue;
+      for (i = aInCount; i > 0; ++p, --i)
+        if (*p) {
+          (*p)->AddRef();
         }
+      break;
+    }
 
-        case nsIDataType::VTYPE_CHAR_STR:
-        {
-            char** inp  = (char**) inValue;
-            char** outp = (char**) *outValue;
-            for(i = inCount; i > 0; i--)
-            {
-                char* str = *(inp++);
-                if(str)
-                {
-                    if(nullptr == (*(outp++) = (char*)
-                       nsMemory::Clone(str, (strlen(str)+1)*sizeof(char))))
-                        goto bad;
-                }
-                else
-                    *(outp++) = nullptr;
-                allocatedValueCount++;
-            }
-            break;
+    // XXX We ASSUME that "array of nsID" means "array of pointers to nsID".
+    case nsIDataType::VTYPE_ID: {
+      nsID** inp  = (nsID**)aInValue;
+      nsID** outp = (nsID**)*aOutValue;
+      for (i = aInCount; i > 0; --i) {
+        nsID* idp = *(inp++);
+        if (idp) {
+          if (!(*(outp++) = (nsID*)nsMemory::Clone((char*)idp, sizeof(nsID)))) {
+            goto bad;
+          }
+        } else {
+          *(outp++) = nullptr;
         }
-
-        case nsIDataType::VTYPE_WCHAR_STR:
-        {
-            char16_t** inp  = (char16_t**) inValue;
-            char16_t** outp = (char16_t**) *outValue;
-            for(i = inCount; i > 0; i--)
-            {
-                char16_t* str = *(inp++);
-                if(str)
-                {
-                    if(nullptr == (*(outp++) = (char16_t*)
-                       nsMemory::Clone(str,
-                        (NS_strlen(str) + 1) * sizeof(char16_t))))
-                        goto bad;
-                }
-                else
-                    *(outp++) = nullptr;
-                allocatedValueCount++;
-            }
-            break;
-        }
-
-        // The rest are illegal.
-        case nsIDataType::VTYPE_VOID:
-        case nsIDataType::VTYPE_ARRAY:
-        case nsIDataType::VTYPE_EMPTY_ARRAY:
-        case nsIDataType::VTYPE_EMPTY:
-        case nsIDataType::VTYPE_ASTRING:
-        case nsIDataType::VTYPE_DOMSTRING:
-        case nsIDataType::VTYPE_UTF8STRING:
-        case nsIDataType::VTYPE_CSTRING:
-        case nsIDataType::VTYPE_STRING_SIZE_IS:
-        case nsIDataType::VTYPE_WSTRING_SIZE_IS:
-        default:
-            NS_ERROR("bad type in array!");
-            return NS_ERROR_CANNOT_CONVERT_DATA;
+        allocatedValueCount++;
+      }
+      break;
     }
 
-    *outType = inType;
-    *outCount = inCount;
-    return NS_OK;
+    case nsIDataType::VTYPE_CHAR_STR: {
+      char** inp  = (char**)aInValue;
+      char** outp = (char**)*aOutValue;
+      for (i = aInCount; i > 0; i--) {
+        char* str = *(inp++);
+        if (str) {
+          if (!(*(outp++) = (char*)nsMemory::Clone(
+                              str, (strlen(str) + 1) * sizeof(char)))) {
+            goto bad;
+          }
+        } else {
+          *(outp++) = nullptr;
+        }
+        allocatedValueCount++;
+      }
+      break;
+    }
+
+    case nsIDataType::VTYPE_WCHAR_STR: {
+      char16_t** inp  = (char16_t**)aInValue;
+      char16_t** outp = (char16_t**)*aOutValue;
+      for (i = aInCount; i > 0; i--) {
+        char16_t* str = *(inp++);
+        if (str) {
+          if (!(*(outp++) = (char16_t*)nsMemory::Clone(
+                              str, (NS_strlen(str) + 1) * sizeof(char16_t)))) {
+            goto bad;
+          }
+        } else {
+          *(outp++) = nullptr;
+        }
+        allocatedValueCount++;
+      }
+      break;
+    }
+
+    // The rest are illegal.
+    case nsIDataType::VTYPE_VOID:
+    case nsIDataType::VTYPE_ARRAY:
+    case nsIDataType::VTYPE_EMPTY_ARRAY:
+    case nsIDataType::VTYPE_EMPTY:
+    case nsIDataType::VTYPE_ASTRING:
+    case nsIDataType::VTYPE_DOMSTRING:
+    case nsIDataType::VTYPE_UTF8STRING:
+    case nsIDataType::VTYPE_CSTRING:
+    case nsIDataType::VTYPE_STRING_SIZE_IS:
+    case nsIDataType::VTYPE_WSTRING_SIZE_IS:
+    default:
+      NS_ERROR("bad type in array!");
+      return NS_ERROR_CANNOT_CONVERT_DATA;
+  }
+
+  *aOutType = aInType;
+  *aOutCount = aInCount;
+  return NS_OK;
 
 bad:
-    if(*outValue)
-    {
-        char** p = (char**) *outValue;
-        for(i = allocatedValueCount; i > 0; p++, i--)
-            if(*p)
-                nsMemory::Free(*p);
-        nsMemory::Free((char*)*outValue);
-        *outValue = nullptr;
-    }
-    return rv;
+  if (*aOutValue) {
+    char** p = (char**)*aOutValue;
+    for (i = allocatedValueCount; i > 0; ++p, --i)
+      if (*p) {
+        nsMemory::Free(*p);
+      }
+    nsMemory::Free((char*)*aOutValue);
+    *aOutValue = nullptr;
+  }
+  return rv;
 }
 
 /***************************************************************************/
 
 #define TRIVIAL_DATA_CONVERTER(type_, data_, member_, retval_)                \
     if(data_.mType == nsIDataType :: type_) {                                 \
         *retval_ = data_.u.member_;                                           \
         return NS_OK;                                                         \
@@ -554,59 +556,59 @@ nsVariant::ConvertTo##name_ (const nsDis
 #define NUMERIC_CONVERSION_METHOD_NORMAL(type_, Ctype_, name_, min_, max_)    \
     NUMERIC_CONVERSION_METHOD_BEGIN(type_, Ctype_, name_)                     \
         CASES__NUMERIC_CONVERSION_NORMAL(Ctype_, min_, max_)                  \
     NUMERIC_CONVERSION_METHOD_END
 
 /***************************************************************************/
 // These expand into full public methods...
 
-NUMERIC_CONVERSION_METHOD_NORMAL(VTYPE_INT8, uint8_t, Int8, (-127-1), 127)
-NUMERIC_CONVERSION_METHOD_NORMAL(VTYPE_INT16, int16_t, Int16, (-32767-1), 32767)
+NUMERIC_CONVERSION_METHOD_NORMAL(VTYPE_INT8, uint8_t, Int8, (-127 - 1), 127)
+NUMERIC_CONVERSION_METHOD_NORMAL(VTYPE_INT16, int16_t, Int16, (-32767 - 1), 32767)
 
 NUMERIC_CONVERSION_METHOD_BEGIN(VTYPE_INT32, int32_t, Int32)
-    CASE__NUMERIC_CONVERSION_INT32_JUST_CAST(int32_t)
-    CASE__NUMERIC_CONVERSION_UINT32_MAX(int32_t, 2147483647)
-    CASE__NUMERIC_CONVERSION_DOUBLE_MIN_MAX_INT(int32_t, (-2147483647-1), 2147483647)
+  CASE__NUMERIC_CONVERSION_INT32_JUST_CAST(int32_t)
+  CASE__NUMERIC_CONVERSION_UINT32_MAX(int32_t, 2147483647)
+  CASE__NUMERIC_CONVERSION_DOUBLE_MIN_MAX_INT(int32_t, (-2147483647 - 1), 2147483647)
 NUMERIC_CONVERSION_METHOD_END
 
 NUMERIC_CONVERSION_METHOD_NORMAL(VTYPE_UINT8, uint8_t, Uint8, 0, 255)
 NUMERIC_CONVERSION_METHOD_NORMAL(VTYPE_UINT16, uint16_t, Uint16, 0, 65535)
 
 NUMERIC_CONVERSION_METHOD_BEGIN(VTYPE_UINT32, uint32_t, Uint32)
-    CASE__NUMERIC_CONVERSION_INT32_MIN_MAX(uint32_t, 0, 2147483647)
-    CASE__NUMERIC_CONVERSION_UINT32_JUST_CAST(uint32_t)
-    CASE__NUMERIC_CONVERSION_DOUBLE_MIN_MAX_INT(uint32_t, 0, 4294967295U)
+  CASE__NUMERIC_CONVERSION_INT32_MIN_MAX(uint32_t, 0, 2147483647)
+  CASE__NUMERIC_CONVERSION_UINT32_JUST_CAST(uint32_t)
+  CASE__NUMERIC_CONVERSION_DOUBLE_MIN_MAX_INT(uint32_t, 0, 4294967295U)
 NUMERIC_CONVERSION_METHOD_END
 
 // XXX toFloat convertions need to be fixed!
 NUMERIC_CONVERSION_METHOD_BEGIN(VTYPE_FLOAT, float, Float)
-    CASE__NUMERIC_CONVERSION_INT32_JUST_CAST(float)
-    CASE__NUMERIC_CONVERSION_UINT32_JUST_CAST(float)
-    CASE__NUMERIC_CONVERSION_DOUBLE_JUST_CAST(float)
+  CASE__NUMERIC_CONVERSION_INT32_JUST_CAST(float)
+  CASE__NUMERIC_CONVERSION_UINT32_JUST_CAST(float)
+  CASE__NUMERIC_CONVERSION_DOUBLE_JUST_CAST(float)
 NUMERIC_CONVERSION_METHOD_END
 
 NUMERIC_CONVERSION_METHOD_BEGIN(VTYPE_DOUBLE, double, Double)
-    CASE__NUMERIC_CONVERSION_INT32_JUST_CAST(double)
-    CASE__NUMERIC_CONVERSION_UINT32_JUST_CAST(double)
-    CASE__NUMERIC_CONVERSION_DOUBLE_JUST_CAST(double)
+  CASE__NUMERIC_CONVERSION_INT32_JUST_CAST(double)
+  CASE__NUMERIC_CONVERSION_UINT32_JUST_CAST(double)
+  CASE__NUMERIC_CONVERSION_DOUBLE_JUST_CAST(double)
 NUMERIC_CONVERSION_METHOD_END
 
 // XXX toChar convertions need to be fixed!
 NUMERIC_CONVERSION_METHOD_BEGIN(VTYPE_CHAR, char, Char)
-    CASE__NUMERIC_CONVERSION_INT32_JUST_CAST(char)
-    CASE__NUMERIC_CONVERSION_UINT32_JUST_CAST(char)
-    CASE__NUMERIC_CONVERSION_DOUBLE_JUST_CAST(char)
+  CASE__NUMERIC_CONVERSION_INT32_JUST_CAST(char)
+  CASE__NUMERIC_CONVERSION_UINT32_JUST_CAST(char)
+  CASE__NUMERIC_CONVERSION_DOUBLE_JUST_CAST(char)
 NUMERIC_CONVERSION_METHOD_END
 
 // XXX toWChar convertions need to be fixed!
 NUMERIC_CONVERSION_METHOD_BEGIN(VTYPE_WCHAR, char16_t, WChar)
-    CASE__NUMERIC_CONVERSION_INT32_JUST_CAST(char16_t)
-    CASE__NUMERIC_CONVERSION_UINT32_JUST_CAST(char16_t)
-    CASE__NUMERIC_CONVERSION_DOUBLE_JUST_CAST(char16_t)
+  CASE__NUMERIC_CONVERSION_INT32_JUST_CAST(char16_t)
+  CASE__NUMERIC_CONVERSION_UINT32_JUST_CAST(char16_t)
+  CASE__NUMERIC_CONVERSION_DOUBLE_JUST_CAST(char16_t)
 NUMERIC_CONVERSION_METHOD_END
 
 #undef NUMERIC_CONVERSION_METHOD_BEGIN
 #undef CASE__NUMERIC_CONVERSION_INT32_JUST_CAST
 #undef CASE__NUMERIC_CONVERSION_INT32_MIN_MAX
 #undef CASE__NUMERIC_CONVERSION_UINT32_JUST_CAST
 #undef CASE__NUMERIC_CONVERSION_UINT32_MIN_MAX
 #undef CASE__NUMERIC_CONVERSION_DOUBLE_JUST_CAST
@@ -617,203 +619,206 @@ NUMERIC_CONVERSION_METHOD_END
 #undef NUMERIC_CONVERSION_METHOD_NORMAL
 
 /***************************************************************************/
 
 // Just leverage a numeric converter for bool (but restrict the values).
 // XXX Is this really what we want to do?
 
 /* static */ nsresult
-nsVariant::ConvertToBool(const nsDiscriminatedUnion& data, bool *_retval)
+nsVariant::ConvertToBool(const nsDiscriminatedUnion& aData, bool* aResult)
 {
-    TRIVIAL_DATA_CONVERTER(VTYPE_BOOL, data, mBoolValue, _retval)
+  TRIVIAL_DATA_CONVERTER(VTYPE_BOOL, aData, mBoolValue, aResult)
 
-    double val;
-    nsresult rv = nsVariant::ConvertToDouble(data, &val);
-    if(NS_FAILED(rv))
-        return rv;
-    *_retval = 0.0 != val;
+  double val;
+  nsresult rv = nsVariant::ConvertToDouble(aData, &val);
+  if (NS_FAILED(rv)) {
     return rv;
+  }
+  *aResult = 0.0 != val;
+  return rv;
 }
 
 /***************************************************************************/
 
 /* static */ nsresult
-nsVariant::ConvertToInt64(const nsDiscriminatedUnion& data, int64_t *_retval)
+nsVari