Bug 995730 - Change xpcom/string/ to use 2 space indentation
authorBirunthan Mohanathas <birunthan@mohanathas.com>
Mon, 05 May 2014 20:30:46 +0300
changeset 181566 81587bb1f916648367d7f208d2be0137f28f36e9
parent 181565 7db230827e21908f2911fd02f894a2f3508c0a10
child 181567 a4e798884d048a5a4031462c0c449f636d231615
push idunknown
push userunknown
push dateunknown
bugs995730
milestone32.0a1
Bug 995730 - Change xpcom/string/ to use 2 space indentation This also removes trailing whitespace in reindented files.
xpcom/string/public/nsAString.h
xpcom/string/public/nsAlgorithm.h
xpcom/string/public/nsCharTraits.h
xpcom/string/public/nsDependentString.h
xpcom/string/public/nsDependentSubstring.h
xpcom/string/public/nsLiteralString.h
xpcom/string/public/nsPrintfCString.h
xpcom/string/public/nsPromiseFlatString.h
xpcom/string/public/nsReadableUtils.h
xpcom/string/public/nsString.h
xpcom/string/public/nsStringBuffer.h
xpcom/string/public/nsStringFwd.h
xpcom/string/public/nsStringIterator.h
xpcom/string/public/nsSubstringTuple.h
xpcom/string/public/nsTDependentString.h
xpcom/string/public/nsTDependentSubstring.h
xpcom/string/public/nsTLiteralString.h
xpcom/string/public/nsTPromiseFlatString.h
xpcom/string/public/nsTString.h
xpcom/string/public/nsTSubstring.h
xpcom/string/public/nsTSubstringTuple.h
xpcom/string/public/nsUTF8Utils.h
xpcom/string/public/nsXPCOMStrings.h
xpcom/string/src/nsDependentString.cpp
xpcom/string/src/nsDependentSubstring.cpp
xpcom/string/src/nsPromiseFlatString.cpp
xpcom/string/src/nsReadableUtils.cpp
xpcom/string/src/nsString.cpp
xpcom/string/src/nsStringComparator.cpp
xpcom/string/src/nsStringObsolete.cpp
xpcom/string/src/nsSubstring.cpp
xpcom/string/src/nsSubstringTuple.cpp
xpcom/string/src/nsTDependentString.cpp
xpcom/string/src/nsTDependentSubstring.cpp
xpcom/string/src/nsTPromiseFlatString.cpp
xpcom/string/src/nsTString.cpp
xpcom/string/src/nsTStringComparator.cpp
xpcom/string/src/nsTStringObsolete.cpp
xpcom/string/src/nsTSubstring.cpp
xpcom/string/src/nsTSubstringTuple.cpp
--- a/xpcom/string/public/nsAString.h
+++ b/xpcom/string/public/nsAString.h
@@ -1,10 +1,10 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 // IWYU pragma: private, include "nsString.h"
 
 #ifndef nsAString_h___
 #define nsAString_h___
 
@@ -13,48 +13,48 @@
 
 #include <string.h>
 #include <stdarg.h>
 
 #include "mozilla/fallible.h"
 
 #define kNotFound -1
 
-  // declare nsAString
+// declare nsAString
 #include "string-template-def-unichar.h"
 #include "nsTSubstring.h"
 #include "string-template-undef.h"
 
-  // declare nsACString
+// declare nsACString
 #include "string-template-def-char.h"
 #include "nsTSubstring.h"
 #include "string-template-undef.h"
 
 
-  /**
-   * ASCII case-insensitive comparator.  (for Unicode case-insensitive
-   * comparision, see nsUnicharUtils.h)
-   */
+/**
+ * ASCII case-insensitive comparator.  (for Unicode case-insensitive
+ * comparision, see nsUnicharUtils.h)
+ */
 class nsCaseInsensitiveCStringComparator
-    : public nsCStringComparator
-  {
-    public:
-      nsCaseInsensitiveCStringComparator() {}
-      typedef char char_type;
+  : public nsCStringComparator
+{
+public:
+  nsCaseInsensitiveCStringComparator() {}
+  typedef char char_type;
 
-      virtual int operator()( const char_type*, const char_type*, uint32_t, uint32_t ) const;
-  };
+  virtual int operator()( const char_type*, const char_type*, uint32_t, uint32_t ) const;
+};
 
 class nsCaseInsensitiveCStringArrayComparator
-  {
-    public:
-      template<class A, class B>
-      bool Equals(const A& a, const B& b) const {
-        return a.Equals(b, nsCaseInsensitiveCStringComparator());
-      }
-  };
+{
+public:
+  template<class A, class B>
+  bool Equals(const A& a, const B& b) const {
+    return a.Equals(b, nsCaseInsensitiveCStringComparator());
+  }
+};
 
-  // included here for backwards compatibility
+// included here for backwards compatibility
 #ifndef nsSubstringTuple_h___
 #include "nsSubstringTuple.h"
 #endif
 
 #endif // !defined(nsAString_h___)
--- a/xpcom/string/public/nsAlgorithm.h
+++ b/xpcom/string/public/nsAlgorithm.h
@@ -1,76 +1,77 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef nsAlgorithm_h___
 #define nsAlgorithm_h___
 
 #include "nsCharTraits.h"  // for |nsCharSourceTraits|, |nsCharSinkTraits|
 
 template <class T>
 inline
 T
 NS_ROUNDUP( const T& a, const T& b )
-  {
-    return ((a + (b - 1)) / b) * b;
-  }
+{
+  return ((a + (b - 1)) / b) * b;
+}
 
 // We use these instead of std::min/max because we can't include the algorithm
 // header in all of XPCOM because the stl wrappers will error out when included
 // in parts of XPCOM. These functions should never be used outside of XPCOM.
 template <class T>
 inline
 const T&
 XPCOM_MIN( const T& a, const T& b )
-  {
-    return b < a ? b : a;
-  }
+{
+  return b < a ? b : a;
+}
 
 // Must return b when a == b in case a is -0
 template <class T>
 inline
 const T&
 XPCOM_MAX( const T& a, const T& b )
-  {
-    return a > b ? a : b;
-  }
+{
+  return a > b ? a : b;
+}
 
 namespace mozilla {
 
 template <class T>
 inline
 const T&
 clamped( const T& a, const T& min, const T& max )
-  {
-    NS_ABORT_IF_FALSE(max >= min, "clamped(): max must be greater than or equal to min");
-    return XPCOM_MIN(XPCOM_MAX(a, min), max);
-  }
+{
+  NS_ABORT_IF_FALSE(max >= min, "clamped(): max must be greater than or equal to min");
+  return XPCOM_MIN(XPCOM_MAX(a, min), max);
+}
 
 }
 
 template <class InputIterator, class T>
 inline
 uint32_t
 NS_COUNT( InputIterator& first, const InputIterator& last, const T& value )
-  {
-    uint32_t result = 0;
-    for ( ; first != last; ++first )
-      if ( *first == value )
-        ++result;
-    return result;
-  }
+{
+  uint32_t result = 0;
+  for ( ; first != last; ++first )
+    if ( *first == value )
+      ++result;
+  return result;
+}
 
 template <class InputIterator, class OutputIterator>
 inline
 OutputIterator&
 copy_string( const InputIterator& first, const InputIterator& last, OutputIterator& result )
-  {
-    typedef nsCharSourceTraits<InputIterator> source_traits;
-    typedef nsCharSinkTraits<OutputIterator>  sink_traits;
+{
+  typedef nsCharSourceTraits<InputIterator> source_traits;
+  typedef nsCharSinkTraits<OutputIterator>  sink_traits;
 
-    sink_traits::write(result, source_traits::read(first), source_traits::readable_distance(first, last));
-    return result;
-  }
+  sink_traits::write(result, source_traits::read(first), source_traits::readable_distance(first, last));
+  return result;
+}
 
 #endif // !defined(nsAlgorithm_h___)
--- a/xpcom/string/public/nsCharTraits.h
+++ b/xpcom/string/public/nsCharTraits.h
@@ -1,9 +1,10 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef nsCharTraits_h___
 #define nsCharTraits_h___
 
 #include <ctype.h> // for |EOF|, |WEOF|
@@ -56,547 +57,547 @@
 // N = (H - 0xD800) * 0x400 + 0x10000 + (L - 0xDC00)
 // I wonder whether we could somehow assert that H is a high surrogate
 // and L is a low surrogate
 #define SURROGATE_TO_UCS4(h, l) (((uint32_t(h) & 0x03FF) << 10) + \
                                  (uint32_t(l) & 0x03FF) + PLANE1_BASE)
 
 // Extract surrogates from a UCS4 char
 // Reference: the Unicode standard 4.0, section 3.9
-// Since (c - 0x10000) >> 10 == (c >> 10) - 0x0080 and 
+// Since (c - 0x10000) >> 10 == (c >> 10) - 0x0080 and
 // 0xD7C0 == 0xD800 - 0x0080,
 // ((c - 0x10000) >> 10) + 0xD800 can be simplified to
 #define H_SURROGATE(c) char16_t(char16_t(uint32_t(c) >> 10) + \
-                                 char16_t(0xD7C0)) 
+                                char16_t(0xD7C0))
 // where it's to be noted that 0xD7C0 is not bitwise-OR'd
 // but added.
 
-// Since 0x10000 & 0x03FF == 0, 
+// Since 0x10000 & 0x03FF == 0,
 // (c - 0x10000) & 0x03FF == c & 0x03FF so that
 // ((c - 0x10000) & 0x03FF) | 0xDC00 is equivalent to
 #define L_SURROGATE(c) char16_t(char16_t(uint32_t(c) & uint32_t(0x03FF)) | \
                                  char16_t(0xDC00))
 
 #define IS_IN_BMP(ucs) (uint32_t(ucs) < PLANE1_BASE)
 #define UCS2_REPLACEMENT_CHAR char16_t(0xFFFD)
 
 #define UCS_END uint32_t(0x00110000)
 #define IS_VALID_CHAR(c) ((uint32_t(c) < UCS_END) && !IS_SURROGATE(c))
 #define ENSURE_VALID_CHAR(c) (IS_VALID_CHAR(c) ? (c) : UCS2_REPLACEMENT_CHAR)
 
 template <class CharT> struct nsCharTraits {};
 
 template <>
 struct nsCharTraits<char16_t>
-  {
-    typedef char16_t char_type;
-    typedef uint16_t  unsigned_char_type;
-    typedef char      incompatible_char_type;
+{
+  typedef char16_t char_type;
+  typedef uint16_t  unsigned_char_type;
+  typedef char      incompatible_char_type;
 
-    static char_type* const sEmptyBuffer;
+  static char_type* const sEmptyBuffer;
 
-    static
-    void
-    assign( char_type& lhs, char_type rhs )
-      {
-        lhs = rhs;
-      }
+  static
+  void
+  assign( char_type& lhs, char_type rhs )
+  {
+    lhs = rhs;
+  }
 
 
-      // integer representation of characters:
-    typedef int int_type;
+  // integer representation of characters:
+  typedef int int_type;
 
-    static
-    char_type
-    to_char_type( int_type c )
-      {
-        return char_type(c);
-      }
+  static
+  char_type
+  to_char_type( int_type c )
+  {
+    return char_type(c);
+  }
 
-    static
-    int_type
-    to_int_type( char_type c )
-      {
-        return int_type( static_cast<unsigned_char_type>(c) );
-      }
+  static
+  int_type
+  to_int_type( char_type c )
+  {
+    return int_type( static_cast<unsigned_char_type>(c) );
+  }
 
-    static
-    bool
-    eq_int_type( int_type lhs, int_type rhs )
-      {
-        return lhs == rhs;
-      }
+  static
+  bool
+  eq_int_type( int_type lhs, int_type rhs )
+  {
+    return lhs == rhs;
+  }
 
 
-      // |char_type| comparisons:
+  // |char_type| comparisons:
 
-    static
-    bool
-    eq( char_type lhs, char_type rhs )
-      {
-        return lhs == rhs;
-      }
+  static
+  bool
+  eq( char_type lhs, char_type rhs )
+  {
+    return lhs == rhs;
+  }
 
-    static
-    bool
-    lt( char_type lhs, char_type rhs )
-      {
-        return lhs < rhs;
-      }
+  static
+  bool
+  lt( char_type lhs, char_type rhs )
+  {
+    return lhs < rhs;
+  }
 
 
-      // operations on s[n] arrays:
+  // operations on s[n] arrays:
 
-    static
-    char_type*
-    move( char_type* s1, const char_type* s2, size_t n )
-      {
-        return static_cast<char_type*>(memmove(s1, s2, n * sizeof(char_type)));
-      }
+  static
+  char_type*
+  move( char_type* s1, const char_type* s2, size_t n )
+  {
+    return static_cast<char_type*>(memmove(s1, s2, n * sizeof(char_type)));
+  }
 
-    static
-    char_type*
-    copy( char_type* s1, const char_type* s2, size_t n )
-      {
-        return static_cast<char_type*>(memcpy(s1, s2, n * sizeof(char_type)));
-      }
+  static
+  char_type*
+  copy( char_type* s1, const char_type* s2, size_t n )
+  {
+    return static_cast<char_type*>(memcpy(s1, s2, n * sizeof(char_type)));
+  }
 
-    static
-    char_type*
-    copyASCII( char_type* s1, const char* s2, size_t n )
-      {
-        for (char_type* s = s1; n--; ++s, ++s2) {
-          NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-          *s = *s2;
-        }
-        return s1;
-      }
+  static
+  char_type*
+  copyASCII( char_type* s1, const char* s2, size_t n )
+  {
+    for (char_type* s = s1; n--; ++s, ++s2) {
+      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
+      *s = *s2;
+    }
+    return s1;
+  }
 
-    static
-    char_type*
-    assign( char_type* s, size_t n, char_type c )
-      {
-        char_type* result = s;
-        while ( n-- )
-          assign(*s++, c);
-        return result;
-      }
+  static
+  char_type*
+  assign( char_type* s, size_t n, char_type c )
+  {
+    char_type* result = s;
+    while ( n-- )
+      assign(*s++, c);
+    return result;
+  }
 
-    static
-    int
-    compare( const char_type* s1, const char_type* s2, size_t n )
-      {
-        for ( ; n--; ++s1, ++s2 )
-          {
-            if ( !eq(*s1, *s2) )
-              return to_int_type(*s1) - to_int_type(*s2);
-          }
+  static
+  int
+  compare( const char_type* s1, const char_type* s2, size_t n )
+  {
+    for ( ; n--; ++s1, ++s2 )
+    {
+      if ( !eq(*s1, *s2) )
+        return to_int_type(*s1) - to_int_type(*s2);
+    }
 
-        return 0;
-      }
+    return 0;
+  }
 
-    static
-    int
-    compareASCII( const char_type* s1, const char* s2, size_t n )
-      {
-        for ( ; n--; ++s1, ++s2 )
-          {
-            NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-            if ( !eq_int_type(to_int_type(*s1), to_int_type(*s2)) )
-              return to_int_type(*s1) - to_int_type(*s2);
-          }
+  static
+  int
+  compareASCII( const char_type* s1, const char* s2, size_t n )
+  {
+    for ( ; n--; ++s1, ++s2 )
+    {
+      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
+      if ( !eq_int_type(to_int_type(*s1), to_int_type(*s2)) )
+        return to_int_type(*s1) - to_int_type(*s2);
+    }
 
-        return 0;
-      }
+    return 0;
+  }
 
-    // this version assumes that s2 is null-terminated and s1 has length n.
-    // if s1 is shorter than s2 then we return -1; if s1 is longer than s2,
-    // we return 1.
-    static
-    int
-    compareASCIINullTerminated( const char_type* s1, size_t n, const char* s2 )
-      {
-        for ( ; n--; ++s1, ++s2 )
-          {
-            if ( !*s2 )
-              return 1;
-            NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-            if ( !eq_int_type(to_int_type(*s1), to_int_type(*s2)) )
-              return to_int_type(*s1) - to_int_type(*s2);
-          }
+  // this version assumes that s2 is null-terminated and s1 has length n.
+  // if s1 is shorter than s2 then we return -1; if s1 is longer than s2,
+  // we return 1.
+  static
+  int
+  compareASCIINullTerminated( const char_type* s1, size_t n, const char* s2 )
+  {
+    for ( ; n--; ++s1, ++s2 )
+    {
+      if ( !*s2 )
+        return 1;
+      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
+      if ( !eq_int_type(to_int_type(*s1), to_int_type(*s2)) )
+        return to_int_type(*s1) - to_int_type(*s2);
+    }
 
-        if ( *s2 )
-          return -1;
+    if ( *s2 )
+      return -1;
 
-        return 0;
-      }
+    return 0;
+  }
 
-    /**
-     * Convert c to its lower-case form, but only if c is in the ASCII
-     * range. Otherwise leave it alone.
-     */
-    static
-    char_type
-    ASCIIToLower( char_type c )
-      {
-        if (c >= 'A' && c <= 'Z')
-          return char_type(c + ('a' - 'A'));
-          
-        return c;
-      }
+  /**
+   * Convert c to its lower-case form, but only if c is in the ASCII
+   * range. Otherwise leave it alone.
+   */
+  static
+  char_type
+  ASCIIToLower( char_type c )
+  {
+    if (c >= 'A' && c <= 'Z')
+      return char_type(c + ('a' - 'A'));
+
+    return c;
+  }
 
-    static
-    int
-    compareLowerCaseToASCII( const char_type* s1, const char* s2, size_t n )
-      {
-        for ( ; n--; ++s1, ++s2 )
-          {
-            NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-            NS_ASSERTION(!(*s2 >= 'A' && *s2 <= 'Z'),
-                         "Unexpected uppercase character");
-            char_type lower_s1 = ASCIIToLower(*s1);
-            if ( lower_s1 != to_char_type(*s2) )
-              return to_int_type(lower_s1) - to_int_type(*s2);
-          }
+  static
+  int
+  compareLowerCaseToASCII( const char_type* s1, const char* s2, size_t n )
+  {
+    for ( ; n--; ++s1, ++s2 )
+    {
+      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
+      NS_ASSERTION(!(*s2 >= 'A' && *s2 <= 'Z'),
+                   "Unexpected uppercase character");
+      char_type lower_s1 = ASCIIToLower(*s1);
+      if ( lower_s1 != to_char_type(*s2) )
+        return to_int_type(lower_s1) - to_int_type(*s2);
+    }
 
-        return 0;
-      }
+    return 0;
+  }
 
-    // this version assumes that s2 is null-terminated and s1 has length n.
-    // if s1 is shorter than s2 then we return -1; if s1 is longer than s2,
-    // we return 1.
-    static
-    int
-    compareLowerCaseToASCIINullTerminated( const char_type* s1, size_t n, const char* s2 )
-      {
-        for ( ; n--; ++s1, ++s2 )
-          {
-            if ( !*s2 )
-              return 1;
-            NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-            NS_ASSERTION(!(*s2 >= 'A' && *s2 <= 'Z'),
-                         "Unexpected uppercase character");
-            char_type lower_s1 = ASCIIToLower(*s1);
-            if ( lower_s1 != to_char_type(*s2) )
-              return to_int_type(lower_s1) - to_int_type(*s2);
-          }
+  // this version assumes that s2 is null-terminated and s1 has length n.
+  // if s1 is shorter than s2 then we return -1; if s1 is longer than s2,
+  // we return 1.
+  static
+  int
+  compareLowerCaseToASCIINullTerminated( const char_type* s1, size_t n, const char* s2 )
+  {
+    for ( ; n--; ++s1, ++s2 )
+    {
+      if ( !*s2 )
+        return 1;
+      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
+      NS_ASSERTION(!(*s2 >= 'A' && *s2 <= 'Z'),
+                   "Unexpected uppercase character");
+      char_type lower_s1 = ASCIIToLower(*s1);
+      if ( lower_s1 != to_char_type(*s2) )
+        return to_int_type(lower_s1) - to_int_type(*s2);
+    }
 
-        if ( *s2 )
-          return -1;
+    if ( *s2 )
+      return -1;
 
-        return 0;
-      }
+    return 0;
+  }
 
-    static
-    size_t
-    length( const char_type* s )
-      {
-        size_t result = 0;
-        while ( !eq(*s++, char_type(0)) )
-          ++result;
-        return result;
-      }
+  static
+  size_t
+  length( const char_type* s )
+  {
+    size_t result = 0;
+    while ( !eq(*s++, char_type(0)) )
+      ++result;
+    return result;
+  }
 
-    static
-    const char_type*
-    find( const char_type* s, size_t n, char_type c )
-      {
-        while ( n-- )
-          {
-            if ( eq(*s, c) )
-              return s;
-            ++s;
-          }
+  static
+  const char_type*
+  find( const char_type* s, size_t n, char_type c )
+  {
+    while ( n-- )
+    {
+      if ( eq(*s, c) )
+        return s;
+      ++s;
+    }
 
-        return 0;
-      }
-  };
+    return 0;
+  }
+};
 
 template <>
 struct nsCharTraits<char>
-  {
-    typedef char           char_type;
-    typedef unsigned char  unsigned_char_type;
-    typedef char16_t      incompatible_char_type;
+{
+  typedef char           char_type;
+  typedef unsigned char  unsigned_char_type;
+  typedef char16_t      incompatible_char_type;
 
-    static char_type* const sEmptyBuffer;
+  static char_type* const sEmptyBuffer;
 
-    static
-    void
-    assign( char_type& lhs, char_type rhs )
-      {
-        lhs = rhs;
-      }
+  static
+  void
+  assign( char_type& lhs, char_type rhs )
+  {
+    lhs = rhs;
+  }
 
 
-      // integer representation of characters:
+  // integer representation of characters:
 
-    typedef int int_type;
+  typedef int int_type;
 
-    static
-    char_type
-    to_char_type( int_type c )
-      {
-        return char_type(c);
-      }
+  static
+  char_type
+  to_char_type( int_type c )
+  {
+    return char_type(c);
+  }
 
-    static
-    int_type
-    to_int_type( char_type c )
-      {
-        return int_type( static_cast<unsigned_char_type>(c) );
-      }
+  static
+  int_type
+  to_int_type( char_type c )
+  {
+    return int_type( static_cast<unsigned_char_type>(c) );
+  }
 
-    static
-    bool
-    eq_int_type( int_type lhs, int_type rhs )
-      {
-        return lhs == rhs;
-      }
+  static
+  bool
+  eq_int_type( int_type lhs, int_type rhs )
+  {
+    return lhs == rhs;
+  }
 
 
-      // |char_type| comparisons:
+  // |char_type| comparisons:
 
-    static
-    bool
-    eq( char_type lhs, char_type rhs )
-      {
-        return lhs == rhs;
-      }
+  static
+  bool
+  eq( char_type lhs, char_type rhs )
+  {
+    return lhs == rhs;
+  }
 
-    static
-    bool
-    lt( char_type lhs, char_type rhs )
-      {
-        return lhs < rhs;
-      }
+  static
+  bool
+  lt( char_type lhs, char_type rhs )
+  {
+    return lhs < rhs;
+  }
 
 
-      // operations on s[n] arrays:
+  // operations on s[n] arrays:
 
-    static
-    char_type*
-    move( char_type* s1, const char_type* s2, size_t n )
-      {
-        return static_cast<char_type*>(memmove(s1, s2, n * sizeof(char_type)));
-      }
+  static
+  char_type*
+  move( char_type* s1, const char_type* s2, size_t n )
+  {
+    return static_cast<char_type*>(memmove(s1, s2, n * sizeof(char_type)));
+  }
 
-    static
-    char_type*
-    copy( char_type* s1, const char_type* s2, size_t n )
-      {
-        return static_cast<char_type*>(memcpy(s1, s2, n * sizeof(char_type)));
-      }
+  static
+  char_type*
+  copy( char_type* s1, const char_type* s2, size_t n )
+  {
+    return static_cast<char_type*>(memcpy(s1, s2, n * sizeof(char_type)));
+  }
 
-    static
-    char_type*
-    copyASCII( char_type* s1, const char* s2, size_t n )
-      {
-        return copy(s1, s2, n);
-      }
+  static
+  char_type*
+  copyASCII( char_type* s1, const char* s2, size_t n )
+  {
+    return copy(s1, s2, n);
+  }
 
-    static
-    char_type*
-    assign( char_type* s, size_t n, char_type c )
-      {
-        return static_cast<char_type*>(memset(s, to_int_type(c), n));
-      }
+  static
+  char_type*
+  assign( char_type* s, size_t n, char_type c )
+  {
+    return static_cast<char_type*>(memset(s, to_int_type(c), n));
+  }
 
-    static
-    int
-    compare( const char_type* s1, const char_type* s2, size_t n )
-      {
-        return memcmp(s1, s2, n);
-      }
+  static
+  int
+  compare( const char_type* s1, const char_type* s2, size_t n )
+  {
+    return memcmp(s1, s2, n);
+  }
 
-    static
-    int
-    compareASCII( const char_type* s1, const char* s2, size_t n )
-      {
+  static
+  int
+  compareASCII( const char_type* s1, const char* s2, size_t n )
+  {
 #ifdef DEBUG
-        for (size_t i = 0; i < n; ++i)
-          {
-            NS_ASSERTION(!(s2[i] & ~0x7F), "Unexpected non-ASCII character");
-          }
+    for (size_t i = 0; i < n; ++i)
+    {
+      NS_ASSERTION(!(s2[i] & ~0x7F), "Unexpected non-ASCII character");
+    }
 #endif
-        return compare(s1, s2, n);
-      }
+    return compare(s1, s2, n);
+  }
 
-    // this version assumes that s2 is null-terminated and s1 has length n.
-    // if s1 is shorter than s2 then we return -1; if s1 is longer than s2,
-    // we return 1.
-    static
-    int
-    compareASCIINullTerminated( const char_type* s1, size_t n, const char* s2 )
-      {
-        // can't use strcmp here because we don't want to stop when s1
-        // contains a null
-        for ( ; n--; ++s1, ++s2 )
-          {
-            if ( !*s2 )
-              return 1;
-            NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-            if ( *s1 != *s2 )
-              return to_int_type(*s1) - to_int_type(*s2);
-          }
+  // this version assumes that s2 is null-terminated and s1 has length n.
+  // if s1 is shorter than s2 then we return -1; if s1 is longer than s2,
+  // we return 1.
+  static
+  int
+  compareASCIINullTerminated( const char_type* s1, size_t n, const char* s2 )
+  {
+    // can't use strcmp here because we don't want to stop when s1
+    // contains a null
+    for ( ; n--; ++s1, ++s2 )
+    {
+      if ( !*s2 )
+        return 1;
+      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
+      if ( *s1 != *s2 )
+        return to_int_type(*s1) - to_int_type(*s2);
+    }
 
-        if ( *s2 )
-          return -1;
+    if ( *s2 )
+      return -1;
 
-        return 0;
-      }
+    return 0;
+  }
 
-    /**
-     * Convert c to its lower-case form, but only if c is ASCII.
-     */
-    static
-    char_type
-    ASCIIToLower( char_type c )
-      {
-        if (c >= 'A' && c <= 'Z')
-          return char_type(c + ('a' - 'A'));
+  /**
+   * Convert c to its lower-case form, but only if c is ASCII.
+   */
+  static
+  char_type
+  ASCIIToLower( char_type c )
+  {
+    if (c >= 'A' && c <= 'Z')
+      return char_type(c + ('a' - 'A'));
 
-        return c;
-      }
+    return c;
+  }
 
-    static
-    int
-    compareLowerCaseToASCII( const char_type* s1, const char* s2, size_t n )
-      {
-        for ( ; n--; ++s1, ++s2 )
-          {
-            NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-            NS_ASSERTION(!(*s2 >= 'A' && *s2 <= 'Z'),
-                         "Unexpected uppercase character");
-            char_type lower_s1 = ASCIIToLower(*s1);
-            if ( lower_s1 != *s2 )
-              return to_int_type(lower_s1) - to_int_type(*s2);
-          }
-        return 0;
-      }
+  static
+  int
+  compareLowerCaseToASCII( const char_type* s1, const char* s2, size_t n )
+  {
+    for ( ; n--; ++s1, ++s2 )
+    {
+      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
+      NS_ASSERTION(!(*s2 >= 'A' && *s2 <= 'Z'),
+                   "Unexpected uppercase character");
+      char_type lower_s1 = ASCIIToLower(*s1);
+      if ( lower_s1 != *s2 )
+        return to_int_type(lower_s1) - to_int_type(*s2);
+    }
+    return 0;
+  }
 
-    // this version assumes that s2 is null-terminated and s1 has length n.
-    // if s1 is shorter than s2 then we return -1; if s1 is longer than s2,
-    // we return 1.
-    static
-    int
-    compareLowerCaseToASCIINullTerminated( const char_type* s1, size_t n, const char* s2 )
-      {
-        for ( ; n--; ++s1, ++s2 )
-          {
-            if ( !*s2 )
-              return 1;
-            NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
-            NS_ASSERTION(!(*s2 >= 'A' && *s2 <= 'Z'),
-                         "Unexpected uppercase character");
-            char_type lower_s1 = ASCIIToLower(*s1);
-            if ( lower_s1 != *s2 )
-              return to_int_type(lower_s1) - to_int_type(*s2);
-          }
+  // this version assumes that s2 is null-terminated and s1 has length n.
+  // if s1 is shorter than s2 then we return -1; if s1 is longer than s2,
+  // we return 1.
+  static
+  int
+  compareLowerCaseToASCIINullTerminated( const char_type* s1, size_t n, const char* s2 )
+  {
+    for ( ; n--; ++s1, ++s2 )
+    {
+      if ( !*s2 )
+        return 1;
+      NS_ASSERTION(!(*s2 & ~0x7F), "Unexpected non-ASCII character");
+      NS_ASSERTION(!(*s2 >= 'A' && *s2 <= 'Z'),
+                   "Unexpected uppercase character");
+      char_type lower_s1 = ASCIIToLower(*s1);
+      if ( lower_s1 != *s2 )
+        return to_int_type(lower_s1) - to_int_type(*s2);
+    }
 
-        if ( *s2 )
-          return -1;
+    if ( *s2 )
+      return -1;
 
-        return 0;
-      }
+    return 0;
+  }
 
-    static
-    size_t
-    length( const char_type* s )
-      {
-        return strlen(s);
-      }
+  static
+  size_t
+  length( const char_type* s )
+  {
+    return strlen(s);
+  }
 
-    static
-    const char_type*
-    find( const char_type* s, size_t n, char_type c )
-      {
-        return reinterpret_cast<const char_type*>(memchr(s, to_int_type(c), n));
-      }
-  };
+  static
+  const char_type*
+  find( const char_type* s, size_t n, char_type c )
+  {
+    return reinterpret_cast<const char_type*>(memchr(s, to_int_type(c), n));
+  }
+};
 
 template <class InputIterator>
 struct nsCharSourceTraits
-  {
-    typedef typename InputIterator::difference_type difference_type;
+{
+  typedef typename InputIterator::difference_type difference_type;
 
-    static
-    uint32_t
-    readable_distance( const InputIterator& first, const InputIterator& last )
-      {
-        // assumes single fragment
-        return uint32_t(last.get() - first.get());
-      }
+  static
+  uint32_t
+  readable_distance( const InputIterator& first, const InputIterator& last )
+  {
+    // assumes single fragment
+    return uint32_t(last.get() - first.get());
+  }
 
-    static
-    const typename InputIterator::value_type*
-    read( const InputIterator& iter )
-      {
-        return iter.get();
-      }
+  static
+  const typename InputIterator::value_type*
+  read( const InputIterator& iter )
+  {
+    return iter.get();
+  }
 
-    static
-    void
-    advance( InputIterator& s, difference_type n )
-      {
-        s.advance(n);
-      }
-  };
+  static
+  void
+  advance( InputIterator& s, difference_type n )
+  {
+    s.advance(n);
+  }
+};
 
 template <class CharT>
 struct nsCharSourceTraits<CharT*>
-  {
-    typedef ptrdiff_t difference_type;
+{
+  typedef ptrdiff_t difference_type;
 
-    static
-    uint32_t
-    readable_distance( CharT* s )
-      {
-        return uint32_t(nsCharTraits<CharT>::length(s));
-//      return numeric_limits<uint32_t>::max();
-      }
+  static
+  uint32_t
+  readable_distance( CharT* s )
+  {
+    return uint32_t(nsCharTraits<CharT>::length(s));
+    // return numeric_limits<uint32_t>::max();
+  }
 
-    static
-    uint32_t
-    readable_distance( CharT* first, CharT* last )
-      {
-        return uint32_t(last-first);
-      }
+  static
+  uint32_t
+  readable_distance( CharT* first, CharT* last )
+  {
+    return uint32_t(last-first);
+  }
 
-    static
-    const CharT*
-    read( CharT* s )
-      {
-        return s;
-      }
+  static
+  const CharT*
+  read( CharT* s )
+  {
+    return s;
+  }
 
-    static
-    void
-    advance( CharT*& s, difference_type n )
-      {
-        s += n;
-      }
-  };
+  static
+  void
+  advance( CharT*& s, difference_type n )
+  {
+    s += n;
+  }
+};
 
 template <class OutputIterator>
 struct nsCharSinkTraits
+{
+  static
+  void
+  write( OutputIterator& iter, const typename OutputIterator::value_type* s, uint32_t n )
   {
-    static
-    void
-    write( OutputIterator& iter, const typename OutputIterator::value_type* s, uint32_t n )
-      {
-        iter.write(s, n);
-      }
-  };
+    iter.write(s, n);
+  }
+};
 
 template <class CharT>
 struct nsCharSinkTraits<CharT*>
+{
+  static
+  void
+  write( CharT*& iter, const CharT* s, uint32_t n )
   {
-    static
-    void
-    write( CharT*& iter, const CharT* s, uint32_t n )
-      {
-        nsCharTraits<CharT>::move(iter, s, n);
-        iter += n;
-      }
-  };
+    nsCharTraits<CharT>::move(iter, s, n);
+    iter += n;
+  }
+};
 
 #endif // !defined(nsCharTraits_h___)
--- a/xpcom/string/public/nsDependentString.h
+++ b/xpcom/string/public/nsDependentString.h
@@ -1,23 +1,23 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef nsDependentString_h___
 #define nsDependentString_h___
 
 #include "nsString.h"
 #include "nsDebug.h"
 
-  // declare nsDependentString
+// declare nsDependentString
 #include "string-template-def-unichar.h"
 #include "nsTDependentString.h"
 #include "string-template-undef.h"
 
-  // declare nsDependentCString
+// declare nsDependentCString
 #include "string-template-def-char.h"
 #include "nsTDependentString.h"
 #include "string-template-undef.h"
 
 #endif /* !defined(nsDependentString_h___) */
--- a/xpcom/string/public/nsDependentSubstring.h
+++ b/xpcom/string/public/nsDependentSubstring.h
@@ -1,22 +1,22 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef nsDependentSubstring_h___
 #define nsDependentSubstring_h___
 
 #include "nsSubstring.h"
 
-  // declare nsDependentSubstring
+// declare nsDependentSubstring
 #include "string-template-def-unichar.h"
 #include "nsTDependentSubstring.h"
 #include "string-template-undef.h"
 
-  // declare nsDependentCSubstring
+// declare nsDependentCSubstring
 #include "string-template-def-char.h"
 #include "nsTDependentSubstring.h"
 #include "string-template-undef.h"
 
 #endif /* !defined(nsDependentSubstring_h___) */
--- a/xpcom/string/public/nsLiteralString.h
+++ b/xpcom/string/public/nsLiteralString.h
@@ -1,25 +1,26 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef nsLiteralString_h___
 #define nsLiteralString_h___
 
 #include "nscore.h"
 #include "nsString.h"
 
-  // declare nsLiteralString
+// declare nsLiteralString
 #include "string-template-def-unichar.h"
 #include "nsTLiteralString.h"
 #include "string-template-undef.h"
 
-  // declare nsLiteralCString
+// declare nsLiteralCString
 #include "string-template-def-char.h"
 #include "nsTLiteralString.h"
 #include "string-template-undef.h"
 
 #include "mozilla/Char16.h"
 
 #define NS_MULTILINE_LITERAL_STRING(s)            static_cast<const nsLiteralString&>(nsLiteralString(s))
 #define NS_MULTILINE_LITERAL_STRING_INIT(n,s)     n(s)
--- a/xpcom/string/public/nsPrintfCString.h
+++ b/xpcom/string/public/nsPrintfCString.h
@@ -1,16 +1,17 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef nsPrintfCString_h___
 #define nsPrintfCString_h___
- 
+
 #include "nsString.h"
 
 /**
  * nsPrintfCString lets you create a nsCString using a printf-style format
  * string.  For example:
  *
  *   NS_WARNING(nsPrintfCString("Unexpected value: %f", 13.917).get());
  *
--- a/xpcom/string/public/nsPromiseFlatString.h
+++ b/xpcom/string/public/nsPromiseFlatString.h
@@ -1,22 +1,22 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef nsPromiseFlatString_h___
 #define nsPromiseFlatString_h___
 
 #include "nsString.h"
 
-  // declare nsPromiseFlatString
+// declare nsPromiseFlatString
 #include "string-template-def-unichar.h"
 #include "nsTPromiseFlatString.h"
 #include "string-template-undef.h"
 
-  // declare nsPromiseFlatCString
+// declare nsPromiseFlatCString
 #include "string-template-def-char.h"
 #include "nsTPromiseFlatString.h"
 #include "string-template-undef.h"
 
 #endif /* !defined(nsPromiseFlatString_h___) */
--- a/xpcom/string/public/nsReadableUtils.h
+++ b/xpcom/string/public/nsReadableUtils.h
@@ -1,34 +1,35 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 // IWYU pragma: private, include "nsString.h"
 
 #ifndef nsReadableUtils_h___
 #define nsReadableUtils_h___
 
-  /**
-   * I guess all the routines in this file are all mis-named.
-   * According to our conventions, they should be |NS_xxx|.
-   */
+/**
+ * I guess all the routines in this file are all mis-named.
+ * According to our conventions, they should be |NS_xxx|.
+ */
 
 #include "nsAString.h"
 
 #include "nsTArrayForwardDeclare.h"
 
 inline size_t Distance( const nsReadingIterator<char16_t>& start, const nsReadingIterator<char16_t>& end )
-  {
-    return end.get() - start.get();
-  }
+{
+  return end.get() - start.get();
+}
 inline size_t Distance( const nsReadingIterator<char>& start, const nsReadingIterator<char>& end )
-  {
-    return end.get() - start.get();
-  }
+{
+  return end.get() - start.get();
+}
 
 void LossyCopyUTF16toASCII( const nsAString& aSource, nsACString& aDest );
 void CopyASCIItoUTF16( const nsACString& aSource, nsAString& aDest );
 
 void LossyCopyUTF16toASCII( const char16_t* aSource, nsACString& aDest );
 void CopyASCIItoUTF16( const char* aSource, nsAString& aDest );
 
 void CopyUTF16toUTF8( const nsAString& aSource, nsACString& aDest );
@@ -52,265 +53,265 @@ void AppendUTF8toUTF16( const nsACString
 bool AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest,
                         const mozilla::fallible_t& ) NS_WARN_UNUSED_RESULT;
 
 void AppendUTF16toUTF8( const char16_t* aSource, nsACString& aDest );
 void AppendUTF8toUTF16( const char* aSource, nsAString& aDest );
 
 #ifdef MOZ_USE_CHAR16_WRAPPER
 inline void AppendUTF16toUTF8( char16ptr_t aSource, nsACString& aDest )
-  {
-    return AppendUTF16toUTF8(static_cast<const char16_t*>(aSource), aDest);
-  }
+{
+  return AppendUTF16toUTF8(static_cast<const char16_t*>(aSource), aDest);
+}
 #endif
 
-  /**
-   * Returns a new |char| buffer containing a zero-terminated copy of |aSource|.
-   *
-   * Allocates and returns a new |char| buffer which you must free with |nsMemory::Free|.
-   * Performs a lossy encoding conversion by chopping 16-bit wide characters down to 8-bits wide while copying |aSource| to your new buffer.
-   * This conversion is not well defined; but it reproduces legacy string behavior.
-   * The new buffer is zero-terminated, but that may not help you if |aSource| contains embedded nulls.
-   *
-   * @param aSource a 16-bit wide string
-   * @return a new |char| buffer you must free with |nsMemory::Free|.
-   */
+/**
+ * Returns a new |char| buffer containing a zero-terminated copy of |aSource|.
+ *
+ * Allocates and returns a new |char| buffer which you must free with |nsMemory::Free|.
+ * Performs a lossy encoding conversion by chopping 16-bit wide characters down to 8-bits wide while copying |aSource| to your new buffer.
+ * This conversion is not well defined; but it reproduces legacy string behavior.
+ * The new buffer is zero-terminated, but that may not help you if |aSource| contains embedded nulls.
+ *
+ * @param aSource a 16-bit wide string
+ * @return a new |char| buffer you must free with |nsMemory::Free|.
+ */
 char* ToNewCString( const nsAString& aSource );
 
 
-  /**
-   * Returns a new |char| buffer containing a zero-terminated copy of |aSource|.
-   *
-   * Allocates and returns a new |char| buffer which you must free with |nsMemory::Free|.
-   * The new buffer is zero-terminated, but that may not help you if |aSource| contains embedded nulls.
-   *
-   * @param aSource an 8-bit wide string
-   * @return a new |char| buffer you must free with |nsMemory::Free|.
-   */
+/**
+ * Returns a new |char| buffer containing a zero-terminated copy of |aSource|.
+ *
+ * Allocates and returns a new |char| buffer which you must free with |nsMemory::Free|.
+ * The new buffer is zero-terminated, but that may not help you if |aSource| contains embedded nulls.
+ *
+ * @param aSource an 8-bit wide string
+ * @return a new |char| buffer you must free with |nsMemory::Free|.
+ */
 char* ToNewCString( const nsACString& aSource );
 
-  /**
-   * Returns a new |char| buffer containing a zero-terminated copy of |aSource|.
-   *
-   * Allocates and returns a new |char| buffer which you must free with 
-   * |nsMemory::Free|.
-   * Performs an encoding conversion from a UTF-16 string to a UTF-8 string
-   * copying |aSource| to your new buffer.
-   * The new buffer is zero-terminated, but that may not help you if |aSource| 
-   * contains embedded nulls.
-   *
-   * @param aSource a UTF-16 string (made of char16_t's)
-   * @param aUTF8Count the number of 8-bit units that was returned
-   * @return a new |char| buffer you must free with |nsMemory::Free|.
-   */
+/**
+ * Returns a new |char| buffer containing a zero-terminated copy of |aSource|.
+ *
+ * Allocates and returns a new |char| buffer which you must free with
+ * |nsMemory::Free|.
+ * Performs an encoding conversion from a UTF-16 string to a UTF-8 string
+ * copying |aSource| to your new buffer.
+ * The new buffer is zero-terminated, but that may not help you if |aSource|
+ * contains embedded nulls.
+ *
+ * @param aSource a UTF-16 string (made of char16_t's)
+ * @param aUTF8Count the number of 8-bit units that was returned
+ * @return a new |char| buffer you must free with |nsMemory::Free|.
+ */
 
 char* ToNewUTF8String( const nsAString& aSource, uint32_t *aUTF8Count = nullptr );
 
 
-  /**
-   * Returns a new |char16_t| buffer containing a zero-terminated copy of 
-   * |aSource|.
-   *
-   * Allocates and returns a new |char16_t| buffer which you must free with 
-   * |nsMemory::Free|.
-   * The new buffer is zero-terminated, but that may not help you if |aSource| 
-   * contains embedded nulls.
-   *
-   * @param aSource a UTF-16 string
-   * @return a new |char16_t| buffer you must free with |nsMemory::Free|.
-   */
+/**
+ * Returns a new |char16_t| buffer containing a zero-terminated copy of
+ * |aSource|.
+ *
+ * Allocates and returns a new |char16_t| buffer which you must free with
+ * |nsMemory::Free|.
+ * The new buffer is zero-terminated, but that may not help you if |aSource|
+ * contains embedded nulls.
+ *
+ * @param aSource a UTF-16 string
+ * @return a new |char16_t| buffer you must free with |nsMemory::Free|.
+ */
 char16_t* ToNewUnicode( const nsAString& aSource );
 
 
-  /**
-   * Returns a new |char16_t| buffer containing a zero-terminated copy of |aSource|.
-   *
-   * Allocates and returns a new |char16_t| buffer which you must free with |nsMemory::Free|.
-   * Performs an encoding conversion by 0-padding 8-bit wide characters up to 16-bits wide while copying |aSource| to your new buffer.
-   * This conversion is not well defined; but it reproduces legacy string behavior.
-   * The new buffer is zero-terminated, but that may not help you if |aSource| contains embedded nulls.
-   *
-   * @param aSource an 8-bit wide string (a C-string, NOT UTF-8)
-   * @return a new |char16_t| buffer you must free with |nsMemory::Free|.
-   */
+/**
+ * Returns a new |char16_t| buffer containing a zero-terminated copy of |aSource|.
+ *
+ * Allocates and returns a new |char16_t| buffer which you must free with |nsMemory::Free|.
+ * Performs an encoding conversion by 0-padding 8-bit wide characters up to 16-bits wide while copying |aSource| to your new buffer.
+ * This conversion is not well defined; but it reproduces legacy string behavior.
+ * The new buffer is zero-terminated, but that may not help you if |aSource| contains embedded nulls.
+ *
+ * @param aSource an 8-bit wide string (a C-string, NOT UTF-8)
+ * @return a new |char16_t| buffer you must free with |nsMemory::Free|.
+ */
 char16_t* ToNewUnicode( const nsACString& aSource );
 
-  /**
-   * Returns the required length for a char16_t buffer holding
-   * a copy of aSource, using UTF-8 to UTF-16 conversion.
-   * The length does NOT include any space for zero-termination.
-   *
-   * @param aSource an 8-bit wide string, UTF-8 encoded
-   * @return length of UTF-16 encoded string copy, not zero-terminated
-   */
+/**
+ * Returns the required length for a char16_t buffer holding
+ * a copy of aSource, using UTF-8 to UTF-16 conversion.
+ * The length does NOT include any space for zero-termination.
+ *
+ * @param aSource an 8-bit wide string, UTF-8 encoded
+ * @return length of UTF-16 encoded string copy, not zero-terminated
+ */
 uint32_t CalcUTF8ToUnicodeLength( const nsACString& aSource );
 
-  /**
-   * Copies the source string into the specified buffer, converting UTF-8 to
-   * UTF-16 in the process. The conversion is well defined for valid UTF-8
-   * strings.
-   * The copied string will be zero-terminated! Any embedded nulls will be
-   * copied nonetheless. It is the caller's responsiblity to ensure the buffer
-   * is large enough to hold the string copy plus one char16_t for
-   * zero-termination!
-   *
-   * @see CalcUTF8ToUnicodeLength( const nsACString& )
-   * @see UTF8ToNewUnicode( const nsACString&, uint32_t* )
-   *
-   * @param aSource an 8-bit wide string, UTF-8 encoded
-   * @param aBuffer the buffer holding the converted string copy
-   * @param aUTF16Count receiving optionally the number of 16-bit units that
-   *                    were copied
-   * @return aBuffer pointer, for convenience 
-   */
+/**
+ * Copies the source string into the specified buffer, converting UTF-8 to
+ * UTF-16 in the process. The conversion is well defined for valid UTF-8
+ * strings.
+ * The copied string will be zero-terminated! Any embedded nulls will be
+ * copied nonetheless. It is the caller's responsiblity to ensure the buffer
+ * is large enough to hold the string copy plus one char16_t for
+ * zero-termination!
+ *
+ * @see CalcUTF8ToUnicodeLength( const nsACString& )
+ * @see UTF8ToNewUnicode( const nsACString&, uint32_t* )
+ *
+ * @param aSource an 8-bit wide string, UTF-8 encoded
+ * @param aBuffer the buffer holding the converted string copy
+ * @param aUTF16Count receiving optionally the number of 16-bit units that
+ *                    were copied
+ * @return aBuffer pointer, for convenience
+ */
 char16_t* UTF8ToUnicodeBuffer( const nsACString& aSource,
-                                char16_t *aBuffer,
-                                uint32_t *aUTF16Count = nullptr );
+                               char16_t *aBuffer,
+                               uint32_t *aUTF16Count = nullptr );
 
-  /**
-   * Returns a new |char16_t| buffer containing a zero-terminated copy
-   * of |aSource|.
-   *
-   * Allocates and returns a new |char| buffer which you must free with
-   * |nsMemory::Free|.  Performs an encoding conversion from UTF-8 to UTF-16 
-   * while copying |aSource| to your new buffer.  This conversion is well defined
-   * for a valid UTF-8 string.  The new buffer is zero-terminated, but that 
-   * may not help you if |aSource| contains embedded nulls.
-   *
-   * @param aSource an 8-bit wide string, UTF-8 encoded
-   * @param aUTF16Count the number of 16-bit units that was returned
-   * @return a new |char16_t| buffer you must free with |nsMemory::Free|.
-   *         (UTF-16 encoded)
-   */
+/**
+ * Returns a new |char16_t| buffer containing a zero-terminated copy
+ * of |aSource|.
+ *
+ * Allocates and returns a new |char| buffer which you must free with
+ * |nsMemory::Free|.  Performs an encoding conversion from UTF-8 to UTF-16
+ * while copying |aSource| to your new buffer.  This conversion is well defined
+ * for a valid UTF-8 string.  The new buffer is zero-terminated, but that
+ * may not help you if |aSource| contains embedded nulls.
+ *
+ * @param aSource an 8-bit wide string, UTF-8 encoded
+ * @param aUTF16Count the number of 16-bit units that was returned
+ * @return a new |char16_t| buffer you must free with |nsMemory::Free|.
+ *         (UTF-16 encoded)
+ */
 char16_t* UTF8ToNewUnicode( const nsACString& aSource, uint32_t *aUTF16Count = nullptr );
 
-  /**
-   * Copies |aLength| 16-bit code units from the start of |aSource| to the
-   * |char16_t| buffer |aDest|.
-   *
-   * After this operation |aDest| is not null terminated.
-   *
-   * @param aSource a UTF-16 string
-   * @param aSrcOffset start offset in the source string
-   * @param aDest a |char16_t| buffer
-   * @param aLength the number of 16-bit code units to copy
-   * @return pointer to destination buffer - identical to |aDest|
-   */
+/**
+ * Copies |aLength| 16-bit code units from the start of |aSource| to the
+ * |char16_t| buffer |aDest|.
+ *
+ * After this operation |aDest| is not null terminated.
+ *
+ * @param aSource a UTF-16 string
+ * @param aSrcOffset start offset in the source string
+ * @param aDest a |char16_t| buffer
+ * @param aLength the number of 16-bit code units to copy
+ * @return pointer to destination buffer - identical to |aDest|
+ */
 char16_t* CopyUnicodeTo( const nsAString& aSource,
-                                 uint32_t aSrcOffset,
-                                 char16_t* aDest,
-                                 uint32_t aLength );
+                         uint32_t aSrcOffset,
+                         char16_t* aDest,
+                         uint32_t aLength );
 
 
-  /**
-   * Copies 16-bit characters between iterators |aSrcStart| and
-   * |aSrcEnd| to the writable string |aDest|. Similar to the
-   * |nsString::Mid| method.
-   *
-   * After this operation |aDest| is not null terminated.
-   *
-   * @param aSrcStart start source iterator
-   * @param aSrcEnd end source iterator
-   * @param aDest destination for the copy
-   */
+/**
+ * Copies 16-bit characters between iterators |aSrcStart| and
+ * |aSrcEnd| to the writable string |aDest|. Similar to the
+ * |nsString::Mid| method.
+ *
+ * After this operation |aDest| is not null terminated.
+ *
+ * @param aSrcStart start source iterator
+ * @param aSrcEnd end source iterator
+ * @param aDest destination for the copy
+ */
 void CopyUnicodeTo( const nsAString::const_iterator& aSrcStart,
-                           const nsAString::const_iterator& aSrcEnd,
-                           nsAString& aDest );
+                    const nsAString::const_iterator& aSrcEnd,
+                    nsAString& aDest );
 
-  /**
-   * Appends 16-bit characters between iterators |aSrcStart| and
-   * |aSrcEnd| to the writable string |aDest|. 
-   *
-   * After this operation |aDest| is not null terminated.
-   *
-   * @param aSrcStart start source iterator
-   * @param aSrcEnd end source iterator
-   * @param aDest destination for the copy
-   */
+/**
+ * Appends 16-bit characters between iterators |aSrcStart| and
+ * |aSrcEnd| to the writable string |aDest|.
+ *
+ * After this operation |aDest| is not null terminated.
+ *
+ * @param aSrcStart start source iterator
+ * @param aSrcEnd end source iterator
+ * @param aDest destination for the copy
+ */
 void AppendUnicodeTo( const nsAString::const_iterator& aSrcStart,
-                             const nsAString::const_iterator& aSrcEnd,
-                             nsAString& aDest );
+                      const nsAString::const_iterator& aSrcEnd,
+                      nsAString& aDest );
 
-  /**
-   * Returns |true| if |aString| contains only ASCII characters, that is, characters in the range (0x00, 0x7F).
-   *
-   * @param aString a 16-bit wide string to scan
-   */
+/**
+ * Returns |true| if |aString| contains only ASCII characters, that is, characters in the range (0x00, 0x7F).
+ *
+ * @param aString a 16-bit wide string to scan
+ */
 bool IsASCII( const nsAString& aString );
 
-  /**
-   * Returns |true| if |aString| contains only ASCII characters, that is, characters in the range (0x00, 0x7F).
-   *
-   * @param aString a 8-bit wide string to scan
-   */
+/**
+ * Returns |true| if |aString| contains only ASCII characters, that is, characters in the range (0x00, 0x7F).
+ *
+ * @param aString a 8-bit wide string to scan
+ */
 bool IsASCII( const nsACString& aString );
 
-  /**
-   * Returns |true| if |aString| is a valid UTF-8 string.
-   * XXX This is not bullet-proof and nor an all-purpose UTF-8 validator. 
-   * It is mainly written to replace and roughly equivalent to
-   *
-   *    str.Equals(NS_ConvertUTF16toUTF8(NS_ConvertUTF8toUTF16(str)))
-   *
-   * (see bug 191541)
-   * As such,  it does not check for non-UTF-8 7bit encodings such as 
-   * ISO-2022-JP and HZ. 
-   *
-   * It rejects sequences with the following errors:
-   *
-   * byte sequences that cannot be decoded into characters according to
-   *   UTF-8's rules (including cases where the input is part of a valid
-   *   UTF-8 sequence but starts or ends mid-character)
-   * overlong sequences (i.e., cases where a character was encoded
-   *   non-canonically by using more bytes than necessary)
-   * surrogate codepoints (i.e., the codepoints reserved for
-       representing astral characters in UTF-16)
-   * codepoints above the unicode range (i.e., outside the first 17
-   *   planes; higher than U+10FFFF), in accordance with
-   *   http://tools.ietf.org/html/rfc3629
-   * when aRejectNonChar is true (the default), any codepoint whose low
-   *   16 bits are 0xFFFE or 0xFFFF
+/**
+ * Returns |true| if |aString| is a valid UTF-8 string.
+ * XXX This is not bullet-proof and nor an all-purpose UTF-8 validator.
+ * It is mainly written to replace and roughly equivalent to
+ *
+ *    str.Equals(NS_ConvertUTF16toUTF8(NS_ConvertUTF8toUTF16(str)))
+ *
+ * (see bug 191541)
+ * As such,  it does not check for non-UTF-8 7bit encodings such as
+ * ISO-2022-JP and HZ.
+ *
+ * It rejects sequences with the following errors:
+ *
+ * byte sequences that cannot be decoded into characters according to
+ *   UTF-8's rules (including cases where the input is part of a valid
+ *   UTF-8 sequence but starts or ends mid-character)
+ * overlong sequences (i.e., cases where a character was encoded
+ *   non-canonically by using more bytes than necessary)
+ * surrogate codepoints (i.e., the codepoints reserved for
+     representing astral characters in UTF-16)
+ * codepoints above the unicode range (i.e., outside the first 17
+ *   planes; higher than U+10FFFF), in accordance with
+ *   http://tools.ietf.org/html/rfc3629
+ * when aRejectNonChar is true (the default), any codepoint whose low
+ *   16 bits are 0xFFFE or 0xFFFF
 
-   *
-   * @param aString an 8-bit wide string to scan
-   * @param aRejectNonChar a boolean to control the rejection of utf-8
-   *        non characters
-   */
+ *
+ * @param aString an 8-bit wide string to scan
+ * @param aRejectNonChar a boolean to control the rejection of utf-8
+ *        non characters
+ */
 bool IsUTF8( const nsACString& aString, bool aRejectNonChar = true );
 
-bool ParseString(const nsACString& aAstring, char aDelimiter, 
-                          nsTArray<nsCString>& aArray);
+bool ParseString(const nsACString& aAstring, char aDelimiter,
+                 nsTArray<nsCString>& aArray);
 
-  /**
-   * Converts case in place in the argument string.
-   */
+/**
+ * Converts case in place in the argument string.
+ */
 void ToUpperCase( nsACString& );
 
 void ToLowerCase( nsACString& );
 
 void ToUpperCase( nsCSubstring& );
 
 void ToLowerCase( nsCSubstring& );
 
-  /**
-   * Converts case from string aSource to aDest.
-   */
+/**
+ * Converts case from string aSource to aDest.
+ */
 void ToUpperCase( const nsACString& aSource, nsACString& aDest );
 
 void ToLowerCase( const nsACString& aSource, nsACString& aDest );
 
-  /**
-   * Finds the leftmost occurrence of |aPattern|, if any in the range |aSearchStart|..|aSearchEnd|.
-   *
-   * Returns |true| if a match was found, and adjusts |aSearchStart| and |aSearchEnd| to
-   * point to the match.  If no match was found, returns |false| and makes |aSearchStart == aSearchEnd|.
-   *
-   * Currently, this is equivalent to the O(m*n) implementation previously on |ns[C]String|.
-   * If we need something faster, then we can implement that later.
-   */
+/**
+ * Finds the leftmost occurrence of |aPattern|, if any in the range |aSearchStart|..|aSearchEnd|.
+ *
+ * Returns |true| if a match was found, and adjusts |aSearchStart| and |aSearchEnd| to
+ * point to the match.  If no match was found, returns |false| and makes |aSearchStart == aSearchEnd|.
+ *
+ * Currently, this is equivalent to the O(m*n) implementation previously on |ns[C]String|.
+ * If we need something faster, then we can implement that later.
+ */
 
 bool FindInReadable( const nsAString& aPattern, nsAString::const_iterator&, nsAString::const_iterator&, const nsStringComparator& = nsDefaultStringComparator() );
 bool FindInReadable( const nsACString& aPattern, nsACString::const_iterator&, nsACString::const_iterator&, const nsCStringComparator& = nsDefaultCStringComparator() );
 
 /* sometimes we don't care about where the string was, just that we
  * found it or not */
 inline bool FindInReadable( const nsAString& aPattern, const nsAString& aSource, const nsStringComparator& compare = nsDefaultStringComparator() )
 {
@@ -326,82 +327,82 @@ inline bool FindInReadable( const nsACSt
   aSource.BeginReading(start);
   aSource.EndReading(end);
   return FindInReadable(aPattern, start, end, compare);
 }
 
 
 bool CaseInsensitiveFindInReadable( const nsACString& aPattern, nsACString::const_iterator&, nsACString::const_iterator& );
 
-  /**
-   * Finds the rightmost occurrence of |aPattern| 
-   * Returns |true| if a match was found, and adjusts |aSearchStart| and |aSearchEnd| to
-   * point to the match.  If no match was found, returns |false| and makes |aSearchStart == aSearchEnd|.
-   *
-   */
+/**
+ * Finds the rightmost occurrence of |aPattern|
+ * Returns |true| if a match was found, and adjusts |aSearchStart| and |aSearchEnd| to
+ * point to the match.  If no match was found, returns |false| and makes |aSearchStart == aSearchEnd|.
+ *
+ */
 bool RFindInReadable( const nsAString& aPattern, nsAString::const_iterator&, nsAString::const_iterator&, const nsStringComparator& = nsDefaultStringComparator() );
 bool RFindInReadable( const nsACString& aPattern, nsACString::const_iterator&, nsACString::const_iterator&, const nsCStringComparator& = nsDefaultCStringComparator() );
 
-   /**
-   * Finds the leftmost occurrence of |aChar|, if any in the range 
-   * |aSearchStart|..|aSearchEnd|.
-   *
-   * Returns |true| if a match was found, and adjusts |aSearchStart| to
-   * point to the match.  If no match was found, returns |false| and 
-   * makes |aSearchStart == aSearchEnd|.
-   */
+/**
+* Finds the leftmost occurrence of |aChar|, if any in the range
+* |aSearchStart|..|aSearchEnd|.
+*
+* Returns |true| if a match was found, and adjusts |aSearchStart| to
+* point to the match.  If no match was found, returns |false| and
+* makes |aSearchStart == aSearchEnd|.
+*/
 bool FindCharInReadable( char16_t aChar, nsAString::const_iterator& aSearchStart, const nsAString::const_iterator& aSearchEnd );
 bool FindCharInReadable( char aChar, nsACString::const_iterator& aSearchStart, const nsACString::const_iterator& aSearchEnd );
 
-    /**
-    * Finds the number of occurences of |aChar| in the string |aStr|
-    */
+/**
+* Finds the number of occurences of |aChar| in the string |aStr|
+*/
 uint32_t CountCharInReadable( const nsAString& aStr,
-                                     char16_t aChar );
+                              char16_t aChar );
 uint32_t CountCharInReadable( const nsACString& aStr,
-                                     char aChar );
+                              char aChar );
 
 bool
 StringBeginsWith( const nsAString& aSource, const nsAString& aSubstring,
                   const nsStringComparator& aComparator =
-                                              nsDefaultStringComparator() );
+                    nsDefaultStringComparator() );
 bool
 StringBeginsWith( const nsACString& aSource, const nsACString& aSubstring,
                   const nsCStringComparator& aComparator =
-                                               nsDefaultCStringComparator() );
+                    nsDefaultCStringComparator() );
 bool
 StringEndsWith( const nsAString& aSource, const nsAString& aSubstring,
                 const nsStringComparator& aComparator =
-                                            nsDefaultStringComparator() );
+                  nsDefaultStringComparator() );
 bool
 StringEndsWith( const nsACString& aSource, const nsACString& aSubstring,
                 const nsCStringComparator& aComparator =
-                                             nsDefaultCStringComparator() );
+                  nsDefaultCStringComparator() );
 
 const nsAFlatString& EmptyString();
 const nsAFlatCString& EmptyCString();
 
 const nsAFlatString& NullString();
 const nsAFlatCString& NullCString();
 
-   /**
-   * Compare a UTF-8 string to an UTF-16 string.
-   *
-   * Returns 0 if the strings are equal, -1 if aUTF8String is less
-   * than aUTF16Count, and 1 in the reverse case.  In case of fatal
-   * error (eg the strings are not valid UTF8 and UTF16 respectively),
-   * this method will return INT32_MIN.
-   */
+/**
+* Compare a UTF-8 string to an UTF-16 string.
+*
+* Returns 0 if the strings are equal, -1 if aUTF8String is less
+* than aUTF16Count, and 1 in the reverse case.  In case of fatal
+* error (eg the strings are not valid UTF8 and UTF16 respectively),
+* this method will return INT32_MIN.
+*/
 int32_t
 CompareUTF8toUTF16(const nsASingleFragmentCString& aUTF8String,
                    const nsASingleFragmentString& aUTF16String);
 
 void
 AppendUCS4ToUTF16(const uint32_t aSource, nsAString& aDest);
 
 template<class T>
 inline bool EnsureStringLength(T& aStr, uint32_t aLen)
 {
-    aStr.SetLength(aLen);
-    return (aStr.Length() == aLen);
+  aStr.SetLength(aLen);
+  return (aStr.Length() == aLen);
 }
 
 #endif // !defined(nsReadableUtils_h___)
--- a/xpcom/string/public/nsString.h
+++ b/xpcom/string/public/nsString.h
@@ -1,205 +1,205 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef nsString_h___
 #define nsString_h___
 
 #include "mozilla/Attributes.h"
 
 #include "nsSubstring.h"
 #include "nsDependentSubstring.h"
 #include "nsReadableUtils.h"
 
 #include <new>
 
-  // enable support for the obsolete string API if not explicitly disabled
+// enable support for the obsolete string API if not explicitly disabled
 #ifndef MOZ_STRING_WITH_OBSOLETE_API
 #define MOZ_STRING_WITH_OBSOLETE_API 1
 #endif
 
 #if MOZ_STRING_WITH_OBSOLETE_API
-  // radix values for ToInteger/AppendInt
+// radix values for ToInteger/AppendInt
 #define kRadix10        (10)
 #define kRadix16        (16)
 #define kAutoDetect     (100)
 #define kRadixUnknown   (kAutoDetect+1)
 #define IGNORE_CASE     (true)
 #endif
 
 
-  // declare nsString, et. al.
+// declare nsString, et. al.
 #include "string-template-def-unichar.h"
 #include "nsTString.h"
 #include "string-template-undef.h"
 
-  // declare nsCString, et. al.
+// declare nsCString, et. al.
 #include "string-template-def-char.h"
 #include "nsTString.h"
 #include "string-template-undef.h"
 
 static_assert(sizeof(char16_t) == 2, "size of char16_t must be 2");
 static_assert(sizeof(nsString::char_type) == 2,
               "size of nsString::char_type must be 2");
 static_assert(nsString::char_type(-1) > nsString::char_type(0),
               "nsString::char_type must be unsigned");
 static_assert(sizeof(nsCString::char_type) == 1,
               "size of nsCString::char_type must be 1");
 
 
-  /**
-   * A helper class that converts a UTF-16 string to ASCII in a lossy manner
-   */
+/**
+ * A helper class that converts a UTF-16 string to ASCII in a lossy manner
+ */
 class NS_LossyConvertUTF16toASCII : public nsAutoCString
+{
+public:
+  explicit
+  NS_LossyConvertUTF16toASCII( const char16_t* aString )
   {
-    public:
-      explicit
-      NS_LossyConvertUTF16toASCII( const char16_t* aString )
-        {
-          LossyAppendUTF16toASCII(aString, *this);
-        }
+    LossyAppendUTF16toASCII(aString, *this);
+  }
 
-      NS_LossyConvertUTF16toASCII( const char16_t* aString, uint32_t aLength )
-        {
-          LossyAppendUTF16toASCII(Substring(aString, aLength), *this);
-        }
+  NS_LossyConvertUTF16toASCII( const char16_t* aString, uint32_t aLength )
+  {
+    LossyAppendUTF16toASCII(Substring(aString, aLength), *this);
+  }
 
 #ifdef MOZ_USE_CHAR16_WRAPPER
-      explicit
-      NS_LossyConvertUTF16toASCII( char16ptr_t aString )
-        : NS_LossyConvertUTF16toASCII(static_cast<const char16_t*>(aString)) {}
+  explicit
+  NS_LossyConvertUTF16toASCII( char16ptr_t aString )
+    : NS_LossyConvertUTF16toASCII(static_cast<const char16_t*>(aString)) {}
 
-      NS_LossyConvertUTF16toASCII( char16ptr_t aString, uint32_t aLength )
-        : NS_LossyConvertUTF16toASCII(static_cast<const char16_t*>(aString), aLength) {}
+  NS_LossyConvertUTF16toASCII( char16ptr_t aString, uint32_t aLength )
+    : NS_LossyConvertUTF16toASCII(static_cast<const char16_t*>(aString), aLength) {}
 #endif
 
-      explicit
-      NS_LossyConvertUTF16toASCII( const nsAString& aString )
-        {
-          LossyAppendUTF16toASCII(aString, *this);
-        }
+  explicit
+  NS_LossyConvertUTF16toASCII( const nsAString& aString )
+  {
+    LossyAppendUTF16toASCII(aString, *this);
+  }
 
-    private:
-        // NOT TO BE IMPLEMENTED
-      NS_LossyConvertUTF16toASCII( char );
-  };
+private:
+  // NOT TO BE IMPLEMENTED
+  NS_LossyConvertUTF16toASCII( char );
+};
 
 
 class NS_ConvertASCIItoUTF16 : public nsAutoString
+{
+public:
+  explicit
+  NS_ConvertASCIItoUTF16( const char* aCString )
   {
-    public:
-      explicit
-      NS_ConvertASCIItoUTF16( const char* aCString )
-        {
-          AppendASCIItoUTF16(aCString, *this);
-        }
+    AppendASCIItoUTF16(aCString, *this);
+  }
 
-      NS_ConvertASCIItoUTF16( const char* aCString, uint32_t aLength )
-        {
-          AppendASCIItoUTF16(Substring(aCString, aLength), *this);
-        }
+  NS_ConvertASCIItoUTF16( const char* aCString, uint32_t aLength )
+  {
+    AppendASCIItoUTF16(Substring(aCString, aLength), *this);
+  }
 
-      explicit
-      NS_ConvertASCIItoUTF16( const nsACString& aCString )
-        {
-          AppendASCIItoUTF16(aCString, *this);
-        }
+  explicit
+  NS_ConvertASCIItoUTF16( const nsACString& aCString )
+  {
+    AppendASCIItoUTF16(aCString, *this);
+  }
 
-    private:
-        // NOT TO BE IMPLEMENTED
-      NS_ConvertASCIItoUTF16( char16_t );
-  };
+private:
+  // NOT TO BE IMPLEMENTED
+  NS_ConvertASCIItoUTF16( char16_t );
+};
 
 
-  /**
-   * A helper class that converts a UTF-16 string to UTF-8
-   */
+/**
+ * A helper class that converts a UTF-16 string to UTF-8
+ */
 class NS_ConvertUTF16toUTF8 : public nsAutoCString
+{
+public:
+  explicit
+  NS_ConvertUTF16toUTF8( const char16_t* aString )
   {
-    public:
-      explicit
-      NS_ConvertUTF16toUTF8( const char16_t* aString )
-        {
-          AppendUTF16toUTF8(aString, *this);
-        }
+    AppendUTF16toUTF8(aString, *this);
+  }
 
-      NS_ConvertUTF16toUTF8( const char16_t* aString, uint32_t aLength )
-        {
-          AppendUTF16toUTF8(Substring(aString, aLength), *this);
-        }
+  NS_ConvertUTF16toUTF8( const char16_t* aString, uint32_t aLength )
+  {
+    AppendUTF16toUTF8(Substring(aString, aLength), *this);
+  }
 
 #ifdef MOZ_USE_CHAR16_WRAPPER
-      NS_ConvertUTF16toUTF8( char16ptr_t aString ) : NS_ConvertUTF16toUTF8(static_cast<const char16_t*>(aString)) {}
+  NS_ConvertUTF16toUTF8( char16ptr_t aString ) : NS_ConvertUTF16toUTF8(static_cast<const char16_t*>(aString)) {}
 
-      NS_ConvertUTF16toUTF8( char16ptr_t aString, uint32_t aLength )
-        : NS_ConvertUTF16toUTF8(static_cast<const char16_t*>(aString), aLength) {}
+  NS_ConvertUTF16toUTF8( char16ptr_t aString, uint32_t aLength )
+    : NS_ConvertUTF16toUTF8(static_cast<const char16_t*>(aString), aLength) {}
 #endif
 
-      explicit
-      NS_ConvertUTF16toUTF8( const nsAString& aString )
-        {
-          AppendUTF16toUTF8(aString, *this);
-        }
+  explicit
+  NS_ConvertUTF16toUTF8( const nsAString& aString )
+  {
+    AppendUTF16toUTF8(aString, *this);
+  }
 
-    private:
-        // NOT TO BE IMPLEMENTED
-      NS_ConvertUTF16toUTF8( char );
-  };
+private:
+  // NOT TO BE IMPLEMENTED
+  NS_ConvertUTF16toUTF8( char );
+};
 
 
 class NS_ConvertUTF8toUTF16 : public nsAutoString
+{
+public:
+  explicit
+  NS_ConvertUTF8toUTF16( const char* aCString )
   {
-    public:
-      explicit
-      NS_ConvertUTF8toUTF16( const char* aCString )
-        {
-          AppendUTF8toUTF16(aCString, *this);
-        }
+    AppendUTF8toUTF16(aCString, *this);
+  }
 
-      NS_ConvertUTF8toUTF16( const char* aCString, uint32_t aLength )
-        {
-          AppendUTF8toUTF16(Substring(aCString, aLength), *this);
-        }
+  NS_ConvertUTF8toUTF16( const char* aCString, uint32_t aLength )
+  {
+    AppendUTF8toUTF16(Substring(aCString, aLength), *this);
+  }
 
-      explicit
-      NS_ConvertUTF8toUTF16( const nsACString& aCString )
-        {
-          AppendUTF8toUTF16(aCString, *this);
-        }
+  explicit
+  NS_ConvertUTF8toUTF16( const nsACString& aCString )
+  {
+    AppendUTF8toUTF16(aCString, *this);
+  }
 
-    private:
-        // NOT TO BE IMPLEMENTED
-      NS_ConvertUTF8toUTF16( char16_t );
-  };
+private:
+  // NOT TO BE IMPLEMENTED
+  NS_ConvertUTF8toUTF16( char16_t );
+};
 
 
 #ifdef MOZ_USE_CHAR16_WRAPPER
 
 inline char16_t*
 wwc(wchar_t *str)
 {
-    return reinterpret_cast<char16_t*>(str);
+  return reinterpret_cast<char16_t*>(str);
 }
 
 inline wchar_t*
 wwc(char16_t *str)
 {
-    return reinterpret_cast<wchar_t*>(str);
+  return reinterpret_cast<wchar_t*>(str);
 }
 
 #else
 
 inline char16_t*
 wwc(char16_t *str)
 {
-    return str;
+  return str;
 }
 
 #endif
 
 // the following are included/declared for backwards compatibility
 typedef nsAutoString nsVoidableString;
 
 #include "nsDependentString.h"
--- a/xpcom/string/public/nsStringBuffer.h
+++ b/xpcom/string/public/nsStringBuffer.h
@@ -1,10 +1,10 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef nsStringBuffer_h__
 #define nsStringBuffer_h__
 
 #include "mozilla/Atomics.h"
@@ -17,152 +17,152 @@ template<class T> struct already_AddRefe
  * case that nsTAString::mData does not point to one of these special
  * buffers.  The mFlags member variable distinguishes the buffer type.
  *
  * When this header is in use, it enables reference counting, and capacity
  * tracking.  NOTE: A string buffer can be modified only if its reference
  * count is 1.
  */
 class nsStringBuffer
-  {
-    private:
-      friend class CheckStaticAtomSizes;
+{
+private:
+  friend class CheckStaticAtomSizes;
 
-      mozilla::Atomic<int32_t> mRefCount;
-      uint32_t mStorageSize;
+  mozilla::Atomic<int32_t> mRefCount;
+  uint32_t mStorageSize;
+
+public:
 
-    public:
-      
-      /**
-       * Allocates a new string buffer, with given size in bytes and a
-       * reference count of one.  When the string buffer is no longer needed,
-       * it should be released via Release.
-       *
-       * It is up to the caller to set the bytes corresponding to the string
-       * buffer by calling the Data method to fetch the raw data pointer.  Care
-       * must be taken to properly null terminate the character array.  The
-       * storage size can be greater than the length of the actual string
-       * (i.e., it is not required that the null terminator appear in the last
-       * storage unit of the string buffer's data).
-       *
-       * @return new string buffer or null if out of memory.
-       */
-      static already_AddRefed<nsStringBuffer> Alloc(size_t storageSize);
+  /**
+   * Allocates a new string buffer, with given size in bytes and a
+   * reference count of one.  When the string buffer is no longer needed,
+   * it should be released via Release.
+   *
+   * It is up to the caller to set the bytes corresponding to the string
+   * buffer by calling the Data method to fetch the raw data pointer.  Care
+   * must be taken to properly null terminate the character array.  The
+   * storage size can be greater than the length of the actual string
+   * (i.e., it is not required that the null terminator appear in the last
+   * storage unit of the string buffer's data).
+   *
+   * @return new string buffer or null if out of memory.
+   */
+  static already_AddRefed<nsStringBuffer> Alloc(size_t storageSize);
 
-      /**
-       * Resizes the given string buffer to the specified storage size.  This
-       * method must not be called on a readonly string buffer.  Use this API
-       * carefully!!
-       *
-       * This method behaves like the ANSI-C realloc function.  (i.e., If the
-       * allocation fails, null will be returned and the given string buffer
-       * will remain unmodified.)
-       *
-       * @see IsReadonly
-       */
-      static nsStringBuffer* Realloc(nsStringBuffer* buf, size_t storageSize);
+  /**
+   * Resizes the given string buffer to the specified storage size.  This
+   * method must not be called on a readonly string buffer.  Use this API
+   * carefully!!
+   *
+   * This method behaves like the ANSI-C realloc function.  (i.e., If the
+   * allocation fails, null will be returned and the given string buffer
+   * will remain unmodified.)
+   *
+   * @see IsReadonly
+   */
+  static nsStringBuffer* Realloc(nsStringBuffer* buf, size_t storageSize);
 
-      /**
-       * Increment the reference count on this string buffer.
-       */
-      void NS_FASTCALL AddRef();
+  /**
+   * Increment the reference count on this string buffer.
+   */
+  void NS_FASTCALL AddRef();
 
-      /**
-       * Decrement the reference count on this string buffer.  The string
-       * buffer will be destroyed when its reference count reaches zero.
-       */
-      void NS_FASTCALL Release();
+  /**
+   * Decrement the reference count on this string buffer.  The string
+   * buffer will be destroyed when its reference count reaches zero.
+   */
+  void NS_FASTCALL Release();
 
-      /**
-       * This method returns the string buffer corresponding to the given data
-       * pointer.  The data pointer must have been returned previously by a
-       * call to the nsStringBuffer::Data method.
-       */
-      static nsStringBuffer* FromData(void* data)
-        {
-          return reinterpret_cast<nsStringBuffer*> (data) - 1;
-        }
+  /**
+   * This method returns the string buffer corresponding to the given data
+   * pointer.  The data pointer must have been returned previously by a
+   * call to the nsStringBuffer::Data method.
+   */
+  static nsStringBuffer* FromData(void* data)
+  {
+    return reinterpret_cast<nsStringBuffer*> (data) - 1;
+  }
 
-      /**
-       * This method returns the data pointer for this string buffer.
-       */
-      void* Data() const
-        {
-          return const_cast<char*> (reinterpret_cast<const char*> (this + 1));
-        }
+  /**
+   * This method returns the data pointer for this string buffer.
+   */
+  void* Data() const
+  {
+    return const_cast<char*> (reinterpret_cast<const char*> (this + 1));
+  }
 
-      /**
-       * This function returns the storage size of a string buffer in bytes.
-       * This value is the same value that was originally passed to Alloc (or
-       * Realloc).
-       */
-      uint32_t StorageSize() const
-        {
-          return mStorageSize;
-        }
+  /**
+   * This function returns the storage size of a string buffer in bytes.
+   * This value is the same value that was originally passed to Alloc (or
+   * Realloc).
+   */
+  uint32_t StorageSize() const
+  {
+    return mStorageSize;
+  }
 
-      /**
-       * If this method returns false, then the caller can be sure that their
-       * reference to the string buffer is the only reference to the string
-       * buffer, and therefore it has exclusive access to the string buffer and
-       * associated data.  However, if this function returns true, then other
-       * consumers may rely on the data in this buffer being immutable and
-       * other threads may access this buffer simultaneously.
-       */
-      bool IsReadonly() const
-        {
-          return mRefCount > 1;
-        }
+  /**
+   * If this method returns false, then the caller can be sure that their
+   * reference to the string buffer is the only reference to the string
+   * buffer, and therefore it has exclusive access to the string buffer and
+   * associated data.  However, if this function returns true, then other
+   * consumers may rely on the data in this buffer being immutable and
+   * other threads may access this buffer simultaneously.
+   */
+  bool IsReadonly() const
+  {
+    return mRefCount > 1;
+  }
 
-      /**
-       * The FromString methods return a string buffer for the given string 
-       * object or null if the string object does not have a string buffer.
-       * The reference count of the string buffer is NOT incremented by these
-       * methods.  If the caller wishes to hold onto the returned value, then
-       * the returned string buffer must have its reference count incremented
-       * via a call to the AddRef method.
-       */
-      static nsStringBuffer* FromString(const nsAString &str);
-      static nsStringBuffer* FromString(const nsACString &str);
+  /**
+   * The FromString methods return a string buffer for the given string
+   * object or null if the string object does not have a string buffer.
+   * The reference count of the string buffer is NOT incremented by these
+   * methods.  If the caller wishes to hold onto the returned value, then
+   * the returned string buffer must have its reference count incremented
+   * via a call to the AddRef method.
+   */
+  static nsStringBuffer* FromString(const nsAString &str);
+  static nsStringBuffer* FromString(const nsACString &str);
 
-      /**
-       * The ToString methods assign this string buffer to a given string
-       * object.  If the string object does not support sharable string
-       * buffers, then its value will be set to a copy of the given string
-       * buffer.  Otherwise, these methods increment the reference count of the
-       * given string buffer.  It is important to specify the length (in
-       * storage units) of the string contained in the string buffer since the
-       * length of the string may be less than its storage size.  The string
-       * must have a null terminator at the offset specified by |len|.
-       *
-       * NOTE: storage size is measured in bytes even for wide strings;
-       *       however, string length is always measured in storage units
-       *       (2-byte units for wide strings).
-       */
-      void ToString(uint32_t len, nsAString &str,
-                           bool aMoveOwnership = false);
-      void ToString(uint32_t len, nsACString &str,
-                           bool aMoveOwnership = false);
+  /**
+   * The ToString methods assign this string buffer to a given string
+   * object.  If the string object does not support sharable string
+   * buffers, then its value will be set to a copy of the given string
+   * buffer.  Otherwise, these methods increment the reference count of the
+   * given string buffer.  It is important to specify the length (in
+   * storage units) of the string contained in the string buffer since the
+   * length of the string may be less than its storage size.  The string
+   * must have a null terminator at the offset specified by |len|.
+   *
+   * NOTE: storage size is measured in bytes even for wide strings;
+   *       however, string length is always measured in storage units
+   *       (2-byte units for wide strings).
+   */
+  void ToString(uint32_t len, nsAString &str,
+                bool aMoveOwnership = false);
+  void ToString(uint32_t len, nsACString &str,
+                bool aMoveOwnership = false);
 
-      /**
-       * This measures the size.  It should only be used if the StringBuffer is
-       * unshared.  This is checked.
-       */
-      size_t SizeOfIncludingThisMustBeUnshared(mozilla::MallocSizeOf aMallocSizeOf) const;
+  /**
+   * This measures the size.  It should only be used if the StringBuffer is
+   * unshared.  This is checked.
+   */
+  size_t SizeOfIncludingThisMustBeUnshared(mozilla::MallocSizeOf aMallocSizeOf) const;
 
-      /**
-       * This measures the size only if the StringBuffer is unshared.
-       */
-      size_t SizeOfIncludingThisIfUnshared(mozilla::MallocSizeOf aMallocSizeOf) const;
+  /**
+   * This measures the size only if the StringBuffer is unshared.
+   */
+  size_t SizeOfIncludingThisIfUnshared(mozilla::MallocSizeOf aMallocSizeOf) const;
 
-      /**
-       * This measures the size regardless of whether the StringBuffer is
-       * unshared.
-       *
-       * WARNING: Only use this if you really know what you are doing, because
-       * it can easily lead to double-counting strings.  If you do use them,
-       * please explain clearly in a comment why it's safe and won't lead to
-       * double-counting.
-       */
-      size_t SizeOfIncludingThisEvenIfShared(mozilla::MallocSizeOf aMallocSizeOf) const;
-  };
+  /**
+   * This measures the size regardless of whether the StringBuffer is
+   * unshared.
+   *
+   * WARNING: Only use this if you really know what you are doing, because
+   * it can easily lead to double-counting strings.  If you do use them,
+   * please explain clearly in a comment why it's safe and won't lead to
+   * double-counting.
+   */
+  size_t SizeOfIncludingThisEvenIfShared(mozilla::MallocSizeOf aMallocSizeOf) const;
+};
 
 #endif /* !defined(nsStringBuffer_h__ */
--- a/xpcom/string/public/nsStringFwd.h
+++ b/xpcom/string/public/nsStringFwd.h
@@ -1,63 +1,64 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 /* nsStringFwd.h --- forward declarations for string classes */
 
 #ifndef nsStringFwd_h___
 #define nsStringFwd_h___
 
 #include "nscore.h"
 
 #ifndef MOZILLA_INTERNAL_API
 #error Internal string headers are not available from external-linkage code.
 #endif
 
-  /**
-   * double-byte (char16_t) string types
-   */
+/**
+ * double-byte (char16_t) string types
+ */
 
 class nsAString;
 class nsSubstringTuple;
 class nsString;
 class nsAutoString;
 class nsDependentString;
 class nsDependentSubstring;
 class nsPromiseFlatString;
 class nsStringComparator;
 class nsDefaultStringComparator;
 class nsXPIDLString;
 
 
-  /**
-   * single-byte (char) string types
-   */
+/**
+ * single-byte (char) string types
+ */
 
 class nsACString;
 class nsCSubstringTuple;
 class nsCString;
 class nsAutoCString;
 class nsDependentCString;
 class nsDependentCSubstring;
 class nsPromiseFlatCString;
 class nsCStringComparator;
 class nsDefaultCStringComparator;
 class nsXPIDLCString;
 
 
-  /**
-   * typedefs for backwards compatibility
-   */
+/**
+ * typedefs for backwards compatibility
+ */
 
 typedef nsAString             nsSubstring;
 typedef nsACString            nsCSubstring;
 
 typedef nsString              nsAFlatString;
 typedef nsSubstring           nsASingleFragmentString;
 
 typedef nsCString             nsAFlatCString;
 typedef nsCSubstring          nsASingleFragmentCString;
 
-  
+
 #endif /* !defined(nsStringFwd_h___) */
--- a/xpcom/string/public/nsStringIterator.h
+++ b/xpcom/string/public/nsStringIterator.h
@@ -1,327 +1,328 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef nsStringIterator_h___
 #define nsStringIterator_h___
 
 #include "nsCharTraits.h"
 #include "nsAlgorithm.h"
 #include "nsDebug.h"
 
-  /**
-   * @see nsTAString
-   */
+/**
+ * @see nsTAString
+ */
 
 template <class CharT>
 class nsReadingIterator
-  {
-    public:
-      typedef nsReadingIterator<CharT>    self_type;
-      typedef ptrdiff_t                   difference_type;
-      typedef CharT                       value_type;
-      typedef const CharT*                pointer;
-      typedef const CharT&                reference;
+{
+public:
+  typedef nsReadingIterator<CharT>    self_type;
+  typedef ptrdiff_t                   difference_type;
+  typedef CharT                       value_type;
+  typedef const CharT*                pointer;
+  typedef const CharT&                reference;
 
-    private:
-      friend class nsAString;
-      friend class nsACString;
+private:
+  friend class nsAString;
+  friend class nsACString;
 
-        // unfortunately, the API for nsReadingIterator requires that the
-        // iterator know its start and end positions.  this was needed when
-        // we supported multi-fragment strings, but now it is really just
-        // extra baggage.  we should remove mStart and mEnd at some point.
+  // unfortunately, the API for nsReadingIterator requires that the
+  // iterator know its start and end positions.  this was needed when
+  // we supported multi-fragment strings, but now it is really just
+  // extra baggage.  we should remove mStart and mEnd at some point.
 
-      const CharT* mStart;
-      const CharT* mEnd;
-      const CharT* mPosition;
+  const CharT* mStart;
+  const CharT* mEnd;
+  const CharT* mPosition;
 
-    public:
-      nsReadingIterator() { }
-      // nsReadingIterator( const nsReadingIterator<CharT>& );                    // auto-generated copy-constructor OK
-      // nsReadingIterator<CharT>& operator=( const nsReadingIterator<CharT>& );  // auto-generated copy-assignment operator OK
+public:
+  nsReadingIterator() { }
+  // nsReadingIterator( const nsReadingIterator<CharT>& );                    // auto-generated copy-constructor OK
+  // nsReadingIterator<CharT>& operator=( const nsReadingIterator<CharT>& );  // auto-generated copy-assignment operator OK
 
-      inline void normalize_forward() {}
-      inline void normalize_backward() {}
+  inline void normalize_forward() {}
+  inline void normalize_backward() {}
 
-      pointer
-      start() const
-        {
-          return mStart;
-        }
+  pointer
+  start() const
+  {
+    return mStart;
+  }
 
-      pointer
-      end() const
-        {
-          return mEnd;
-        }
+  pointer
+  end() const
+  {
+    return mEnd;
+  }
 
-      pointer
-      get() const
-        {
-          return mPosition;
-        }
-      
-      CharT
-      operator*() const
-        {
-          return *get();
-        }
+  pointer
+  get() const
+  {
+    return mPosition;
+  }
+
+  CharT
+  operator*() const
+  {
+    return *get();
+  }
 
 #if 0
-        // An iterator really deserves this, but some compilers (notably IBM VisualAge for OS/2)
-        //  don't like this when |CharT| is a type without members.
-      pointer
-      operator->() const
-        {
-          return get();
-        }
+  // An iterator really deserves this, but some compilers (notably IBM VisualAge for OS/2)
+  //  don't like this when |CharT| is a type without members.
+  pointer
+  operator->() const
+  {
+    return get();
+  }
 #endif
 
-      self_type&
-      operator++()
-        {
-          ++mPosition;
-          return *this;
-        }
+  self_type&
+  operator++()
+  {
+    ++mPosition;
+    return *this;
+  }
 
-      self_type
-      operator++( int )
-        {
-          self_type result(*this);
-          ++mPosition;
-          return result;
-        }
+  self_type
+  operator++( int )
+  {
+    self_type result(*this);
+    ++mPosition;
+    return result;
+  }
 
-      self_type&
-      operator--()
-        {
-          --mPosition;
-          return *this;
-        }
+  self_type&
+  operator--()
+  {
+    --mPosition;
+    return *this;
+  }
 
-      self_type
-      operator--( int )
-        {
-          self_type result(*this);
-          --mPosition;
-          return result;
-        }
+  self_type
+  operator--( int )
+  {
+    self_type result(*this);
+    --mPosition;
+    return result;
+  }
 
-      difference_type
-      size_forward() const
-        {
-          return mEnd - mPosition;
-        }
+  difference_type
+  size_forward() const
+  {
+    return mEnd - mPosition;
+  }
 
-      difference_type
-      size_backward() const
-        {
-          return mPosition - mStart;
-        }
+  difference_type
+  size_backward() const
+  {
+    return mPosition - mStart;
+  }
 
-      self_type&
-      advance( difference_type n )
-        {
-          if (n > 0)
-            {
-              difference_type step = XPCOM_MIN(n, size_forward());
+  self_type&
+  advance( difference_type n )
+  {
+    if (n > 0)
+    {
+      difference_type step = XPCOM_MIN(n, size_forward());
 
-              NS_ASSERTION(step>0, "can't advance a reading iterator beyond the end of a string");
+      NS_ASSERTION(step>0, "can't advance a reading iterator beyond the end of a string");
 
-              mPosition += step;
-            }
-          else if (n < 0)
-            {
-              difference_type step = XPCOM_MAX(n, -size_backward());
+      mPosition += step;
+    }
+    else if (n < 0)
+    {
+      difference_type step = XPCOM_MAX(n, -size_backward());
 
-              NS_ASSERTION(step<0, "can't advance (backward) a reading iterator beyond the end of a string");
+      NS_ASSERTION(step<0, "can't advance (backward) a reading iterator beyond the end of a string");
 
-              mPosition += step;
-            }
-          return *this;
-        }
-  };
+      mPosition += step;
+    }
+    return *this;
+  }
+};
 
-  /**
-   * @see nsTAString
-   */
+/**
+ * @see nsTAString
+ */
 
 template <class CharT>
 class nsWritingIterator
-  {
-    public:
-      typedef nsWritingIterator<CharT>   self_type;
-      typedef ptrdiff_t                  difference_type;
-      typedef CharT                      value_type;
-      typedef CharT*                     pointer;
-      typedef CharT&                     reference;
+{
+public:
+  typedef nsWritingIterator<CharT>   self_type;
+  typedef ptrdiff_t                  difference_type;
+  typedef CharT                      value_type;
+  typedef CharT*                     pointer;
+  typedef CharT&                     reference;
 
-    private:
-      friend class nsAString;
-      friend class nsACString;
+private:
+  friend class nsAString;
+  friend class nsACString;
 
-        // unfortunately, the API for nsWritingIterator requires that the
-        // iterator know its start and end positions.  this was needed when
-        // we supported multi-fragment strings, but now it is really just
-        // extra baggage.  we should remove mStart and mEnd at some point.
+  // unfortunately, the API for nsWritingIterator requires that the
+  // iterator know its start and end positions.  this was needed when
+  // we supported multi-fragment strings, but now it is really just
+  // extra baggage.  we should remove mStart and mEnd at some point.
 
-      CharT* mStart;
-      CharT* mEnd;
-      CharT* mPosition;
+  CharT* mStart;
+  CharT* mEnd;
+  CharT* mPosition;
 
-    public:
-      nsWritingIterator() { }
-      // nsWritingIterator( const nsWritingIterator<CharT>& );                    // auto-generated copy-constructor OK
-      // nsWritingIterator<CharT>& operator=( const nsWritingIterator<CharT>& );  // auto-generated copy-assignment operator OK
+public:
+  nsWritingIterator() { }
+  // nsWritingIterator( const nsWritingIterator<CharT>& );                    // auto-generated copy-constructor OK
+  // nsWritingIterator<CharT>& operator=( const nsWritingIterator<CharT>& );  // auto-generated copy-assignment operator OK
 
-      inline void normalize_forward() {}
-      inline void normalize_backward() {}
+  inline void normalize_forward() {}
+  inline void normalize_backward() {}
 
-      pointer
-      start() const
-        {
-          return mStart;
-        }
+  pointer
+  start() const
+  {
+    return mStart;
+  }
 
-      pointer
-      end() const
-        {
-          return mEnd;
-        }
+  pointer
+  end() const
+  {
+    return mEnd;
+  }
 
-      pointer
-      get() const
-        {
-          return mPosition;
-        }
-      
-      reference
-      operator*() const
-        {
-          return *get();
-        }
+  pointer
+  get() const
+  {
+    return mPosition;
+  }
+
+  reference
+  operator*() const
+  {
+    return *get();
+  }
 
 #if 0
-        // An iterator really deserves this, but some compilers (notably IBM VisualAge for OS/2)
-        //  don't like this when |CharT| is a type without members.
-      pointer
-      operator->() const
-        {
-          return get();
-        }
+  // An iterator really deserves this, but some compilers (notably IBM VisualAge for OS/2)
+  //  don't like this when |CharT| is a type without members.
+  pointer
+  operator->() const
+  {
+    return get();
+  }
 #endif
 
-      self_type&
-      operator++()
-        {
-          ++mPosition;
-          return *this;
-        }
+  self_type&
+  operator++()
+  {
+    ++mPosition;
+    return *this;
+  }
 
-      self_type
-      operator++( int )
-        {
-          self_type result(*this);
-          ++mPosition;
-          return result;
-        }
+  self_type
+  operator++( int )
+  {
+    self_type result(*this);
+    ++mPosition;
+    return result;
+  }
 
-      self_type&
-      operator--()
-        {
-          --mPosition;
-          return *this;
-        }
+  self_type&
+  operator--()
+  {
+    --mPosition;
+    return *this;
+  }
 
-      self_type
-      operator--( int )
-        {
-          self_type result(*this);
-          --mPosition;
-          return result;
-        }
+  self_type
+  operator--( int )
+  {
+    self_type result(*this);
+    --mPosition;
+    return result;
+  }
 
-      difference_type
-      size_forward() const
-        {
-          return mEnd - mPosition;
-        }
+  difference_type
+  size_forward() const
+  {
+    return mEnd - mPosition;
+  }
 
-      difference_type
-      size_backward() const
-        {
-          return mPosition - mStart;
-        }
+  difference_type
+  size_backward() const
+  {
+    return mPosition - mStart;
+  }
 
-      self_type&
-      advance( difference_type n )
-        {
-          if (n > 0)
-            {
-              difference_type step = XPCOM_MIN(n, size_forward());
+  self_type&
+  advance( difference_type n )
+  {
+    if (n > 0)
+    {
+      difference_type step = XPCOM_MIN(n, size_forward());
 
-              NS_ASSERTION(step>0, "can't advance a writing iterator beyond the end of a string");
+      NS_ASSERTION(step>0, "can't advance a writing iterator beyond the end of a string");
 
-              mPosition += step;
-            }
-          else if (n < 0)
-            {
-              difference_type step = XPCOM_MAX(n, -size_backward());
+      mPosition += step;
+    }
+    else if (n < 0)
+    {
+      difference_type step = XPCOM_MAX(n, -size_backward());
 
-              NS_ASSERTION(step<0, "can't advance (backward) a writing iterator beyond the end of a string");
+      NS_ASSERTION(step<0, "can't advance (backward) a writing iterator beyond the end of a string");
 
-              mPosition += step;
-            }
-          return *this;
-        }
+      mPosition += step;
+    }
+    return *this;
+  }
 
-      void
-      write( const value_type* s, uint32_t n )
-        {
-          NS_ASSERTION(size_forward() > 0, "You can't |write| into an |nsWritingIterator| with no space!");
+  void
+  write( const value_type* s, uint32_t n )
+  {
+    NS_ASSERTION(size_forward() > 0, "You can't |write| into an |nsWritingIterator| with no space!");
 
-          nsCharTraits<value_type>::move(mPosition, s, n);
-          advance( difference_type(n) );
-        }
-  };
+    nsCharTraits<value_type>::move(mPosition, s, n);
+    advance( difference_type(n) );
+  }
+};
 
 template <class CharT>
 inline
 bool
 operator==( const nsReadingIterator<CharT>& lhs, const nsReadingIterator<CharT>& rhs )
-  {
-    return lhs.get() == rhs.get();
-  }
+{
+  return lhs.get() == rhs.get();
+}
 
 template <class CharT>
 inline
 bool
 operator!=( const nsReadingIterator<CharT>& lhs, const nsReadingIterator<CharT>& rhs )
-  {
-    return lhs.get() != rhs.get();
-  }
+{
+  return lhs.get() != rhs.get();
+}
 
 
-  //
-  // |nsWritingIterator|s
-  //
+//
+// |nsWritingIterator|s
+//
 
 template <class CharT>
 inline
 bool
 operator==( const nsWritingIterator<CharT>& lhs, const nsWritingIterator<CharT>& rhs )
-  {
-    return lhs.get() == rhs.get();
-  }
+{
+  return lhs.get() == rhs.get();
+}
 
 template <class CharT>
 inline
 bool
 operator!=( const nsWritingIterator<CharT>& lhs, const nsWritingIterator<CharT>& rhs )
-  {
-    return lhs.get() != rhs.get();
-  }
+{
+  return lhs.get() != rhs.get();
+}
 
 #endif /* !defined(nsStringIterator_h___) */
--- a/xpcom/string/public/nsSubstringTuple.h
+++ b/xpcom/string/public/nsSubstringTuple.h
@@ -1,22 +1,22 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef nsSubstringTuple_h___
 #define nsSubstringTuple_h___
 
 #include "nsSubstring.h"
 
-  // declare nsSubstringTuple
+// declare nsSubstringTuple
 #include "string-template-def-unichar.h"
 #include "nsTSubstringTuple.h"
 #include "string-template-undef.h"
 
-  // declare nsCSubstringTuple
+// declare nsCSubstringTuple
 #include "string-template-def-char.h"
 #include "nsTSubstringTuple.h"
 #include "string-template-undef.h"
 
 #endif // !defined(nsSubstringTuple_h___)
--- a/xpcom/string/public/nsTDependentString.h
+++ b/xpcom/string/public/nsTDependentString.h
@@ -1,98 +1,98 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 
-  /**
-   * nsTDependentString_CharT
-   *
-   * Stores a null-terminated, immutable sequence of characters.
-   *
-   * Subclass of nsTString that restricts string value to an immutable
-   * character sequence.  This class does not own its data, so the creator
-   * of objects of this type must take care to ensure that a
-   * nsTDependentString continues to reference valid memory for the
-   * duration of its use.
-   */
+/**
+ * nsTDependentString_CharT
+ *
+ * Stores a null-terminated, immutable sequence of characters.
+ *
+ * Subclass of nsTString that restricts string value to an immutable
+ * character sequence.  This class does not own its data, so the creator
+ * of objects of this type must take care to ensure that a
+ * nsTDependentString continues to reference valid memory for the
+ * duration of its use.
+ */
 class nsTDependentString_CharT : public nsTString_CharT
-  {
-    public:
+{
+public:
 
-      typedef nsTDependentString_CharT    self_type;
+  typedef nsTDependentString_CharT    self_type;
 
-    public:
+public:
 
-        /**
-         * constructors
-         */
+  /**
+   * constructors
+   */
 
-      nsTDependentString_CharT( const char_type* start, const char_type* end )
-        : string_type(const_cast<char_type*>(start), uint32_t(end - start), F_TERMINATED)
-        {
-          AssertValidDepedentString();
-        }
+  nsTDependentString_CharT( const char_type* start, const char_type* end )
+    : string_type(const_cast<char_type*>(start), uint32_t(end - start), F_TERMINATED)
+  {
+    AssertValidDepedentString();
+  }
 
-      nsTDependentString_CharT( const char_type* data, uint32_t length )
-        : string_type(const_cast<char_type*>(data), length, F_TERMINATED)
-        {
-          AssertValidDepedentString();
-        }
+  nsTDependentString_CharT( const char_type* data, uint32_t length )
+    : string_type(const_cast<char_type*>(data), length, F_TERMINATED)
+  {
+    AssertValidDepedentString();
+  }
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      nsTDependentString_CharT( char16ptr_t data, uint32_t length )
-        : nsTDependentString_CharT(static_cast<const char16_t*>(data), length) {}
+  nsTDependentString_CharT( char16ptr_t data, uint32_t length )
+    : nsTDependentString_CharT(static_cast<const char16_t*>(data), length) {}
 #endif
 
-      explicit
-      nsTDependentString_CharT( const char_type* data )
-        : string_type(const_cast<char_type*>(data), uint32_t(char_traits::length(data)), F_TERMINATED)
-        {
-          AssertValidDepedentString();
-        }
+  explicit
+  nsTDependentString_CharT( const char_type* data )
+    : string_type(const_cast<char_type*>(data), uint32_t(char_traits::length(data)), F_TERMINATED)
+  {
+    AssertValidDepedentString();
+  }
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      explicit
-      nsTDependentString_CharT( char16ptr_t data )
-        : nsTDependentString_CharT( static_cast<const char16_t*>(data)) {}
+  explicit
+  nsTDependentString_CharT( char16ptr_t data )
+    : nsTDependentString_CharT( static_cast<const char16_t*>(data)) {}
 #endif
 
-      nsTDependentString_CharT( const string_type& str, uint32_t startPos )
-        : string_type()
-        {
-          Rebind(str, startPos);
-        }
+  nsTDependentString_CharT( const string_type& str, uint32_t startPos )
+    : string_type()
+  {
+    Rebind(str, startPos);
+  }
 
-      // Create a nsTDependentSubstring to be bound later
-      nsTDependentString_CharT()
-        : string_type() {}
+  // Create a nsTDependentSubstring to be bound later
+  nsTDependentString_CharT()
+    : string_type() {}
 
-      // XXX are you sure??
-      // auto-generated copy-constructor OK
-      // auto-generated copy-assignment operator OK
-      // auto-generated destructor OK
+  // XXX are you sure??
+  // auto-generated copy-constructor OK
+  // auto-generated copy-assignment operator OK
+  // auto-generated destructor OK
 
 
-        /**
-         * allow this class to be bound to a different string...
-         */
+  /**
+   * allow this class to be bound to a different string...
+   */
 
-      using nsTString_CharT::Rebind;
-      void Rebind( const char_type* data )
-        {
-          Rebind(data, uint32_t(char_traits::length(data)));
-        }
+  using nsTString_CharT::Rebind;
+  void Rebind( const char_type* data )
+  {
+    Rebind(data, uint32_t(char_traits::length(data)));
+  }
 
-      void Rebind( const char_type* start, const char_type* end )
-        {
-          Rebind(start, uint32_t(end - start));
-        }
+  void Rebind( const char_type* start, const char_type* end )
+  {
+    Rebind(start, uint32_t(end - start));
+  }
 
-      void Rebind( const string_type&, uint32_t startPos );
+  void Rebind( const string_type&, uint32_t startPos );
+
+private:
 
-    private:
-      
-      // NOT USED
-      nsTDependentString_CharT( const substring_tuple_type& );
-  };
+  // NOT USED
+  nsTDependentString_CharT( const substring_tuple_type& );
+};
--- a/xpcom/string/public/nsTDependentSubstring.h
+++ b/xpcom/string/public/nsTDependentSubstring.h
@@ -1,110 +1,110 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 // IWYU pragma: private, include "nsString.h"
 
-  /**
-   * nsTDependentSubstring_CharT
-   *
-   * A string class which wraps an external array of string characters. It
-   * is the client code's responsibility to ensure that the external buffer
-   * remains valid for a long as the string is alive.
-   *
-   * NAMES:
-   *   nsDependentSubstring for wide characters
-   *   nsDependentCSubstring for narrow characters
-   */
+/**
+ * nsTDependentSubstring_CharT
+ *
+ * A string class which wraps an external array of string characters. It
+ * is the client code's responsibility to ensure that the external buffer
+ * remains valid for a long as the string is alive.
+ *
+ * NAMES:
+ *   nsDependentSubstring for wide characters
+ *   nsDependentCSubstring for narrow characters
+ */
 class nsTDependentSubstring_CharT : public nsTSubstring_CharT
-  {
-    public:
+{
+public:
 
-      typedef nsTDependentSubstring_CharT    self_type;
+  typedef nsTDependentSubstring_CharT    self_type;
 
-    public:
+public:
 
-      void Rebind( const substring_type&, uint32_t startPos, uint32_t length = size_type(-1) );
+  void Rebind( const substring_type&, uint32_t startPos, uint32_t length = size_type(-1) );
 
-      void Rebind( const char_type* data, size_type length );
+  void Rebind( const char_type* data, size_type length );
 
-      void Rebind( const char_type* start, const char_type* end )
-        {
-          Rebind(start, size_type(end - start));
-        }
+  void Rebind( const char_type* start, const char_type* end )
+  {
+    Rebind(start, size_type(end - start));
+  }
 
-      nsTDependentSubstring_CharT( const substring_type& str, uint32_t startPos, uint32_t length = size_type(-1) )
-        : substring_type()
-        {
-          Rebind(str, startPos, length);
-        }
+  nsTDependentSubstring_CharT( const substring_type& str, uint32_t startPos, uint32_t length = size_type(-1) )
+    : substring_type()
+  {
+    Rebind(str, startPos, length);
+  }
 
-      nsTDependentSubstring_CharT( const char_type* data, size_type length )
-        : substring_type(const_cast<char_type*>(data), length, F_NONE) {}
+  nsTDependentSubstring_CharT( const char_type* data, size_type length )
+    : substring_type(const_cast<char_type*>(data), length, F_NONE) {}
 
-      nsTDependentSubstring_CharT( const char_type* start, const char_type* end )
-        : substring_type(const_cast<char_type*>(start), uint32_t(end - start), F_NONE) {}
+  nsTDependentSubstring_CharT( const char_type* start, const char_type* end )
+    : substring_type(const_cast<char_type*>(start), uint32_t(end - start), F_NONE) {}
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      nsTDependentSubstring_CharT( char16ptr_t data, size_type length )
-        : nsTDependentSubstring_CharT(static_cast<const char16_t*>(data), length) {}
+  nsTDependentSubstring_CharT( char16ptr_t data, size_type length )
+    : nsTDependentSubstring_CharT(static_cast<const char16_t*>(data), length) {}
 
-      nsTDependentSubstring_CharT( char16ptr_t start, char16ptr_t end )
-        : nsTDependentSubstring_CharT(static_cast<const char16_t*>(start), static_cast<const char16_t*>(end)) {}
+  nsTDependentSubstring_CharT( char16ptr_t start, char16ptr_t end )
+    : nsTDependentSubstring_CharT(static_cast<const char16_t*>(start), static_cast<const char16_t*>(end)) {}
 #endif
 
-      nsTDependentSubstring_CharT( const const_iterator& start, const const_iterator& end )
-        : substring_type(const_cast<char_type*>(start.get()), uint32_t(end.get() - start.get()), F_NONE) {}
+  nsTDependentSubstring_CharT( const const_iterator& start, const const_iterator& end )
+    : substring_type(const_cast<char_type*>(start.get()), uint32_t(end.get() - start.get()), F_NONE) {}
 
-      // Create a nsTDependentSubstring to be bound later
-      nsTDependentSubstring_CharT()
-        : substring_type() {}
+  // Create a nsTDependentSubstring to be bound later
+  nsTDependentSubstring_CharT()
+    : substring_type() {}
 
-      // auto-generated copy-constructor OK (XXX really?? what about base class copy-ctor?)
+  // auto-generated copy-constructor OK (XXX really?? what about base class copy-ctor?)
 
-    private:
-        // NOT USED
-      void operator=( const self_type& );        // we're immutable, you can't assign into a substring
-  };
+private:
+  // NOT USED
+  void operator=( const self_type& );        // we're immutable, you can't assign into a substring
+};
 
 inline
 const nsTDependentSubstring_CharT
 Substring( const nsTSubstring_CharT& str, uint32_t startPos, uint32_t length = uint32_t(-1) )
-  {
-    return nsTDependentSubstring_CharT(str, startPos, length);
-  }
+{
+  return nsTDependentSubstring_CharT(str, startPos, length);
+}
 
 inline
 const nsTDependentSubstring_CharT
 Substring( const nsReadingIterator<CharT>& start, const nsReadingIterator<CharT>& end )
-  {
-    return nsTDependentSubstring_CharT(start.get(), end.get());
-  }
+{
+  return nsTDependentSubstring_CharT(start.get(), end.get());
+}
 
 inline
 const nsTDependentSubstring_CharT
 Substring( const CharT* data, uint32_t length )
-  {
-    return nsTDependentSubstring_CharT(data, length);
-  }
+{
+  return nsTDependentSubstring_CharT(data, length);
+}
 
 inline
 const nsTDependentSubstring_CharT
 Substring( const CharT* start, const CharT* end )
-  {
-    return nsTDependentSubstring_CharT(start, end);
-  }
+{
+  return nsTDependentSubstring_CharT(start, end);
+}
 
 inline
 const nsTDependentSubstring_CharT
 StringHead( const nsTSubstring_CharT& str, uint32_t count )
-  {
-    return nsTDependentSubstring_CharT(str, 0, count);
-  }
+{
+  return nsTDependentSubstring_CharT(str, 0, count);
+}
 
 inline
 const nsTDependentSubstring_CharT
 StringTail( const nsTSubstring_CharT& str, uint32_t count )
-  {
-    return nsTDependentSubstring_CharT(str, str.Length() - count, count);
-  }
+{
+  return nsTDependentSubstring_CharT(str, str.Length() - count, count);
+}
--- a/xpcom/string/public/nsTLiteralString.h
+++ b/xpcom/string/public/nsTLiteralString.h
@@ -1,41 +1,41 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 
-  /**
-   * nsTLiteralString_CharT
-   *
-   * Stores a null-terminated, immutable sequence of characters.
-   *
-   * Subclass of nsTString that restricts string value to a literal
-   * character sequence.  This class does not own its data. The data is
-   * assumed to be permanent. In practice this is true because this code
-   * is only usable by and for libxul.
-   */
+/**
+ * nsTLiteralString_CharT
+ *
+ * Stores a null-terminated, immutable sequence of characters.
+ *
+ * Subclass of nsTString that restricts string value to a literal
+ * character sequence.  This class does not own its data. The data is
+ * assumed to be permanent. In practice this is true because this code
+ * is only usable by and for libxul.
+ */
 class nsTLiteralString_CharT : public nsTString_CharT
-  {
-    public:
+{
+public:
 
-      typedef nsTLiteralString_CharT    self_type;
+  typedef nsTLiteralString_CharT    self_type;
 
-    public:
+public:
 
-        /**
-         * constructor
-         */
+  /**
+   * constructor
+   */
 
-      template<size_type N>
-      nsTLiteralString_CharT( const char_type (&str)[N] )
-        : string_type(const_cast<char_type*>(str), N - 1, F_TERMINATED | F_LITERAL)
-        {
-        }
+  template<size_type N>
+  nsTLiteralString_CharT( const char_type (&str)[N] )
+    : string_type(const_cast<char_type*>(str), N - 1, F_TERMINATED | F_LITERAL)
+  {
+  }
 
-    private:
+private:
 
-        // NOT TO BE IMPLEMENTED
-      template<size_type N>
-      nsTLiteralString_CharT( char_type (&str)[N] ) MOZ_DELETE;
-  };
+  // NOT TO BE IMPLEMENTED
+  template<size_type N>
+  nsTLiteralString_CharT( char_type (&str)[N] ) MOZ_DELETE;
+};
--- a/xpcom/string/public/nsTPromiseFlatString.h
+++ b/xpcom/string/public/nsTPromiseFlatString.h
@@ -1,106 +1,106 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 
-  /**
-   * NOTE:
-   *
-   * Try to avoid flat strings.  |PromiseFlat[C]String| will help you as a last
-   * resort, and this may be necessary when dealing with legacy or OS calls,
-   * but in general, requiring a null-terminated array of characters kills many
-   * of the performance wins the string classes offer.  Write your own code to
-   * use |nsA[C]String&|s for parameters.  Write your string proccessing
-   * algorithms to exploit iterators.  If you do this, you will benefit from
-   * being able to chain operations without copying or allocating and your code
-   * will be significantly more efficient.  Remember, a function that takes an
-   * |const nsA[C]String&| can always be passed a raw character pointer by
-   * wrapping it (for free) in a |nsDependent[C]String|.  But a function that
-   * takes a character pointer always has the potential to force allocation and
-   * copying.
-   *
-   *
-   * How to use it:
-   *
-   * A |nsPromiseFlat[C]String| doesn't necessarily own the characters it
-   * promises.  You must never use it to promise characters out of a string
-   * with a shorter lifespan.  The typical use will be something like this:
-   *
-   *   SomeOSFunction( PromiseFlatCString(aCSubstring).get() ); // GOOD
-   *
-   * Here's a BAD use:
-   *
-   *  const char* buffer = PromiseFlatCString(aCSubstring).get();
-   *  SomeOSFunction(buffer); // BAD!! |buffer| is a dangling pointer
-   *
-   * The only way to make one is with the function |PromiseFlat[C]String|,
-   * which produce a |const| instance.  ``What if I need to keep a promise
-   * around for a little while?'' you might ask.  In that case, you can keep a
-   * reference, like so
-   *
-   *   const nsCString& flat = PromiseFlatString(aCSubstring);
-   *     // this reference holds the anonymous temporary alive, but remember,
-   *     // it must _still_ have a lifetime shorter than that of |aCSubstring|
-   *
-   *  SomeOSFunction(flat.get());
-   *  SomeOtherOSFunction(flat.get());
-   *
-   *
-   * How does it work?
-   *
-   * A |nsPromiseFlat[C]String| is just a wrapper for another string.  If you
-   * apply it to a string that happens to be flat, your promise is just a
-   * dependent reference to the string's data.  If you apply it to a non-flat
-   * string, then a temporary flat string is created for you, by allocating and
-   * copying.  In the event that you end up assigning the result into a sharing
-   * string (e.g., |nsTString|), the right thing happens.
-   */
+/**
+ * NOTE:
+ *
+ * Try to avoid flat strings.  |PromiseFlat[C]String| will help you as a last
+ * resort, and this may be necessary when dealing with legacy or OS calls,
+ * but in general, requiring a null-terminated array of characters kills many
+ * of the performance wins the string classes offer.  Write your own code to
+ * use |nsA[C]String&|s for parameters.  Write your string proccessing
+ * algorithms to exploit iterators.  If you do this, you will benefit from
+ * being able to chain operations without copying or allocating and your code
+ * will be significantly more efficient.  Remember, a function that takes an
+ * |const nsA[C]String&| can always be passed a raw character pointer by
+ * wrapping it (for free) in a |nsDependent[C]String|.  But a function that
+ * takes a character pointer always has the potential to force allocation and
+ * copying.
+ *
+ *
+ * How to use it:
+ *
+ * A |nsPromiseFlat[C]String| doesn't necessarily own the characters it
+ * promises.  You must never use it to promise characters out of a string
+ * with a shorter lifespan.  The typical use will be something like this:
+ *
+ *   SomeOSFunction( PromiseFlatCString(aCSubstring).get() ); // GOOD
+ *
+ * Here's a BAD use:
+ *
+ *  const char* buffer = PromiseFlatCString(aCSubstring).get();
+ *  SomeOSFunction(buffer); // BAD!! |buffer| is a dangling pointer
+ *
+ * The only way to make one is with the function |PromiseFlat[C]String|,
+ * which produce a |const| instance.  ``What if I need to keep a promise
+ * around for a little while?'' you might ask.  In that case, you can keep a
+ * reference, like so
+ *
+ *   const nsCString& flat = PromiseFlatString(aCSubstring);
+ *     // this reference holds the anonymous temporary alive, but remember,
+ *     // it must _still_ have a lifetime shorter than that of |aCSubstring|
+ *
+ *  SomeOSFunction(flat.get());
+ *  SomeOtherOSFunction(flat.get());
+ *
+ *
+ * How does it work?
+ *
+ * A |nsPromiseFlat[C]String| is just a wrapper for another string.  If you
+ * apply it to a string that happens to be flat, your promise is just a
+ * dependent reference to the string's data.  If you apply it to a non-flat
+ * string, then a temporary flat string is created for you, by allocating and
+ * copying.  In the event that you end up assigning the result into a sharing
+ * string (e.g., |nsTString|), the right thing happens.
+ */
 
 class nsTPromiseFlatString_CharT : public nsTString_CharT
-  {
-    public:
+{
+public:
 
-      typedef nsTPromiseFlatString_CharT    self_type;
+  typedef nsTPromiseFlatString_CharT    self_type;
 
-    private:
+private:
 
-      void Init( const substring_type& );
+  void Init( const substring_type& );
 
-        // NOT TO BE IMPLEMENTED
-      void operator=( const self_type& ) MOZ_DELETE;
+  // NOT TO BE IMPLEMENTED
+  void operator=( const self_type& ) MOZ_DELETE;
 
-        // NOT TO BE IMPLEMENTED
-      nsTPromiseFlatString_CharT() MOZ_DELETE;
+  // NOT TO BE IMPLEMENTED
+  nsTPromiseFlatString_CharT() MOZ_DELETE;
 
-        // NOT TO BE IMPLEMENTED
-      nsTPromiseFlatString_CharT( const string_type& str ) MOZ_DELETE;
+  // NOT TO BE IMPLEMENTED
+  nsTPromiseFlatString_CharT( const string_type& str ) MOZ_DELETE;
 
-    public:
+public:
 
-      explicit
-      nsTPromiseFlatString_CharT( const substring_type& str )
-        : string_type()
-        {
-          Init(str);
-        }
+  explicit
+  nsTPromiseFlatString_CharT( const substring_type& str )
+    : string_type()
+  {
+    Init(str);
+  }
 
-      explicit
-      nsTPromiseFlatString_CharT( const substring_tuple_type& tuple )
-        : string_type()
-        {
-          // nothing else to do here except assign the value of the tuple
-          // into ourselves.
-          Assign(tuple);
-        }
-  };
+  explicit
+  nsTPromiseFlatString_CharT( const substring_tuple_type& tuple )
+    : string_type()
+  {
+    // nothing else to do here except assign the value of the tuple
+    // into ourselves.
+    Assign(tuple);
+  }
+};
 
 // We template this so that the constructor is chosen based on the type of the
 // parameter. This allows us to reject attempts to promise a flat flat string.
 template<class T>
 const nsTPromiseFlatString_CharT
 TPromiseFlatString_CharT( const T& string )
-  {
-    return nsTPromiseFlatString_CharT(string);
-  }
+{
+  return nsTPromiseFlatString_CharT(string);
+}
--- a/xpcom/string/public/nsTString.h
+++ b/xpcom/string/public/nsTString.h
@@ -1,728 +1,728 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 // IWYU pragma: private, include "nsString.h"
 
-  /**
-   * This is the canonical null-terminated string class.  All subclasses
-   * promise null-terminated storage.  Instances of this class allocate
-   * strings on the heap.
-   *
-   * NAMES:
-   *   nsString for wide characters
-   *   nsCString for narrow characters
-   * 
-   * This class is also known as nsAFlat[C]String, where "flat" is used
-   * to denote a null-terminated string.
-   */
+/**
+ * This is the canonical null-terminated string class.  All subclasses
+ * promise null-terminated storage.  Instances of this class allocate
+ * strings on the heap.
+ *
+ * NAMES:
+ *   nsString for wide characters
+ *   nsCString for narrow characters
+ *
+ * This class is also known as nsAFlat[C]String, where "flat" is used
+ * to denote a null-terminated string.
+ */
 class nsTString_CharT : public nsTSubstring_CharT
-  {
-    public:
+{
+public:
 
-      typedef nsTString_CharT    self_type;
+  typedef nsTString_CharT    self_type;
 
-    public:
+public:
 
-        /**
-         * constructors
-         */
+  /**
+   * constructors
+   */
 
-      nsTString_CharT()
-        : substring_type() {}
+  nsTString_CharT()
+    : substring_type() {}
 
-      explicit
-      nsTString_CharT( const char_type* data, size_type length = size_type(-1) )
-        : substring_type()
-        {
-          Assign(data, length);
-        }
+  explicit
+  nsTString_CharT( const char_type* data, size_type length = size_type(-1) )
+    : substring_type()
+  {
+    Assign(data, length);
+  }
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      explicit
-      nsTString_CharT( char16ptr_t data, size_type length = size_type(-1) )
-        : substring_type()
-        {
-          Assign(static_cast<const char16_t*>(data), length);
-        }
+  explicit
+  nsTString_CharT( char16ptr_t data, size_type length = size_type(-1) )
+    : substring_type()
+  {
+    Assign(static_cast<const char16_t*>(data), length);
+  }
 #endif
 
-      nsTString_CharT( const self_type& str )
-        : substring_type()
-        {
-          Assign(str);
-        }
+  nsTString_CharT( const self_type& str )
+    : substring_type()
+  {
+    Assign(str);
+  }
 
-      nsTString_CharT( const substring_tuple_type& tuple )
-        : substring_type()
-        {
-          Assign(tuple);
-        }
+  nsTString_CharT( const substring_tuple_type& tuple )
+    : substring_type()
+  {
+    Assign(tuple);
+  }
 
-      explicit
-      nsTString_CharT( const substring_type& readable )
-        : substring_type()
-        {
-          Assign(readable);
-        }
+  explicit
+  nsTString_CharT( const substring_type& readable )
+    : substring_type()
+  {
+    Assign(readable);
+  }
 
 
-        // |operator=| does not inherit, so we must define our own
-      self_type& operator=( char_type c )                                                       { Assign(c);        return *this; }
-      self_type& operator=( const char_type* data )                                             { Assign(data);     return *this; }
-      self_type& operator=( const self_type& str )                                              { Assign(str);      return *this; }
+  // |operator=| does not inherit, so we must define our own
+  self_type& operator=( char_type c )                       { Assign(c);     return *this; }
+  self_type& operator=( const char_type* data )             { Assign(data);  return *this; }
+  self_type& operator=( const self_type& str )              { Assign(str);   return *this; }
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      self_type& operator=( const char16ptr_t data )                                            { Assign(static_cast<const char16_t*>(data));     return *this; }
+  self_type& operator=( const char16ptr_t data )            { Assign(static_cast<const char16_t*>(data)); return *this; }
 #endif
-      self_type& operator=( const substring_type& str )                                         { Assign(str);      return *this; }
-      self_type& operator=( const substring_tuple_type& tuple )                                 { Assign(tuple);    return *this; }
+  self_type& operator=( const substring_type& str )         { Assign(str);   return *this; }
+  self_type& operator=( const substring_tuple_type& tuple ) { Assign(tuple); return *this; }
 
-        /**
-         * returns the null-terminated string
-         */
+  /**
+   * returns the null-terminated string
+   */
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      char16ptr_t get() const
+  char16ptr_t get() const
 #else
-      const char_type* get() const
+  const char_type* get() const
 #endif
-        {
-          return mData;
-        }
+  {
+    return mData;
+  }
 
 
-        /**
-         * returns character at specified index.
-         *         
-         * NOTE: unlike nsTSubstring::CharAt, this function allows you to index
-         *       the null terminator character.
-         */
+  /**
+   * returns character at specified index.
+   *
+   * NOTE: unlike nsTSubstring::CharAt, this function allows you to index
+   *       the null terminator character.
+   */
 
-      char_type CharAt( index_type i ) const
-        {
-          NS_ASSERTION(i <= mLength, "index exceeds allowable range");
-          return mData[i];
-        }
+  char_type CharAt( index_type i ) const
+  {
+    NS_ASSERTION(i <= mLength, "index exceeds allowable range");
+    return mData[i];
+  }
 
-      char_type operator[]( index_type i ) const
-        {
-          return CharAt(i);
-        }
+  char_type operator[]( index_type i ) const
+  {
+    return CharAt(i);
+  }
 
 
 #if MOZ_STRING_WITH_OBSOLETE_API
 
 
-        /**
-         *  Search for the given substring within this string.
-         *  
-         *  @param   aString is substring to be sought in this
-         *  @param   aIgnoreCase selects case sensitivity
-         *  @param   aOffset tells us where in this string to start searching
-         *  @param   aCount tells us how far from the offset we are to search. Use
-         *           -1 to search the whole string.
-         *  @return  offset in string, or kNotFound
-         */
+  /**
+   *  Search for the given substring within this string.
+   *
+   *  @param   aString is substring to be sought in this
+   *  @param   aIgnoreCase selects case sensitivity
+   *  @param   aOffset tells us where in this string to start searching
+   *  @param   aCount tells us how far from the offset we are to search. Use
+   *           -1 to search the whole string.
+   *  @return  offset in string, or kNotFound
+   */
 
-      int32_t Find( const nsCString& aString, bool aIgnoreCase=false, int32_t aOffset=0, int32_t aCount=-1 ) const;
-      int32_t Find( const char* aString, bool aIgnoreCase=false, int32_t aOffset=0, int32_t aCount=-1 ) const;
+  int32_t Find( const nsCString& aString, bool aIgnoreCase=false, int32_t aOffset=0, int32_t aCount=-1 ) const;
+  int32_t Find( const char* aString, bool aIgnoreCase=false, int32_t aOffset=0, int32_t aCount=-1 ) const;
 
 #ifdef CharT_is_PRUnichar
-      int32_t Find( const nsAFlatString& aString, int32_t aOffset=0, int32_t aCount=-1 ) const;
-      int32_t Find( const char16_t* aString, int32_t aOffset=0, int32_t aCount=-1 ) const;
+  int32_t Find( const nsAFlatString& aString, int32_t aOffset=0, int32_t aCount=-1 ) const;
+  int32_t Find( const char16_t* aString, int32_t aOffset=0, int32_t aCount=-1 ) const;
 #ifdef MOZ_USE_CHAR16_WRAPPER
-      int32_t Find( char16ptr_t aString, int32_t aOffset=0, int32_t aCount=-1 ) const
-        {
-          return Find(static_cast<const char16_t*>(aString), aOffset, aCount);
-        }
+  int32_t Find( char16ptr_t aString, int32_t aOffset=0, int32_t aCount=-1 ) const
+  {
+    return Find(static_cast<const char16_t*>(aString), aOffset, aCount);
+  }
 #endif
 #endif
 
-        
-        /**
-         * This methods scans the string backwards, looking for the given string
-         *
-         * @param   aString is substring to be sought in this
-         * @param   aIgnoreCase tells us whether or not to do caseless compare
-         * @param   aOffset tells us where in this string to start searching.
-         *          Use -1 to search from the end of the string.
-         * @param   aCount tells us how many iterations to make starting at the
-         *          given offset.
-         * @return  offset in string, or kNotFound
-         */
 
-      int32_t RFind( const nsCString& aString, bool aIgnoreCase=false, int32_t aOffset=-1, int32_t aCount=-1 ) const;
-      int32_t RFind( const char* aCString, bool aIgnoreCase=false, int32_t aOffset=-1, int32_t aCount=-1 ) const;
+  /**
+   * This methods scans the string backwards, looking for the given string
+   *
+   * @param   aString is substring to be sought in this
+   * @param   aIgnoreCase tells us whether or not to do caseless compare
+   * @param   aOffset tells us where in this string to start searching.
+   *          Use -1 to search from the end of the string.
+   * @param   aCount tells us how many iterations to make starting at the
+   *          given offset.
+   * @return  offset in string, or kNotFound
+   */
+
+  int32_t RFind( const nsCString& aString, bool aIgnoreCase=false, int32_t aOffset=-1, int32_t aCount=-1 ) const;
+  int32_t RFind( const char* aCString, bool aIgnoreCase=false, int32_t aOffset=-1, int32_t aCount=-1 ) const;
 
 #ifdef CharT_is_PRUnichar
-      int32_t RFind( const nsAFlatString& aString, int32_t aOffset=-1, int32_t aCount=-1 ) const;
-      int32_t RFind( const char16_t* aString, int32_t aOffset=-1, int32_t aCount=-1 ) const;
+  int32_t RFind( const nsAFlatString& aString, int32_t aOffset=-1, int32_t aCount=-1 ) const;
+  int32_t RFind( const char16_t* aString, int32_t aOffset=-1, int32_t aCount=-1 ) const;
 #endif
 
 
-        /**
-         *  Search for given char within this string
-         *  
-         *  @param   aChar is the character to search for
-         *  @param   aOffset tells us where in this string to start searching
-         *  @param   aCount tells us how far from the offset we are to search.
-         *           Use -1 to search the whole string.
-         *  @return  offset in string, or kNotFound
-         */
+  /**
+   *  Search for given char within this string
+   *
+   *  @param   aChar is the character to search for
+   *  @param   aOffset tells us where in this string to start searching
+   *  @param   aCount tells us how far from the offset we are to search.
+   *           Use -1 to search the whole string.
+   *  @return  offset in string, or kNotFound
+   */
 
-      // int32_t FindChar( char16_t aChar, int32_t aOffset=0, int32_t aCount=-1 ) const;
-      int32_t RFindChar( char16_t aChar, int32_t aOffset=-1, int32_t aCount=-1 ) const;
+  // int32_t FindChar( char16_t aChar, int32_t aOffset=0, int32_t aCount=-1 ) const;
+  int32_t RFindChar( char16_t aChar, int32_t aOffset=-1, int32_t aCount=-1 ) const;
 
 
-        /**
-         * This method searches this string for the first character found in
-         * the given string.
-         *
-         * @param aString contains set of chars to be found
-         * @param aOffset tells us where in this string to start searching
-         *        (counting from left)
-         * @return offset in string, or kNotFound
-         */
+  /**
+   * This method searches this string for the first character found in
+   * the given string.
+   *
+   * @param aString contains set of chars to be found
+   * @param aOffset tells us where in this string to start searching
+   *        (counting from left)
+   * @return offset in string, or kNotFound
+   */
 
-      int32_t FindCharInSet( const char* aString, int32_t aOffset=0 ) const;
-      int32_t FindCharInSet( const self_type& aString, int32_t aOffset=0 ) const
-        {
-          return FindCharInSet(aString.get(), aOffset);
-        }
+  int32_t FindCharInSet( const char* aString, int32_t aOffset=0 ) const;
+  int32_t FindCharInSet( const self_type& aString, int32_t aOffset=0 ) const
+  {
+    return FindCharInSet(aString.get(), aOffset);
+  }
 
 #ifdef CharT_is_PRUnichar
-      int32_t FindCharInSet( const char16_t* aString, int32_t aOffset=0 ) const;
+  int32_t FindCharInSet( const char16_t* aString, int32_t aOffset=0 ) const;
 #endif
 
 
-        /**
-         * This method searches this string for the last character found in
-         * the given string.
-         *
-         * @param aString contains set of chars to be found
-         * @param aOffset tells us where in this string to start searching
-         *        (counting from left)
-         * @return offset in string, or kNotFound
-         */
+  /**
+   * This method searches this string for the last character found in
+   * the given string.
+   *
+   * @param aString contains set of chars to be found
+   * @param aOffset tells us where in this string to start searching
+   *        (counting from left)
+   * @return offset in string, or kNotFound
+   */
 
-      int32_t RFindCharInSet( const char_type* aString, int32_t aOffset=-1 ) const;
-      int32_t RFindCharInSet( const self_type& aString, int32_t aOffset=-1 ) const
-        {
-          return RFindCharInSet(aString.get(), aOffset);
-        }
+  int32_t RFindCharInSet( const char_type* aString, int32_t aOffset=-1 ) const;
+  int32_t RFindCharInSet( const self_type& aString, int32_t aOffset=-1 ) const
+  {
+    return RFindCharInSet(aString.get(), aOffset);
+  }
 
 
-        /**
-         * Compares a given string to this string. 
-         *
-         * @param   aString is the string to be compared
-         * @param   aIgnoreCase tells us how to treat case
-         * @param   aCount tells us how many chars to compare
-         * @return  -1,0,1
-         */
+  /**
+   * Compares a given string to this string.
+   *
+   * @param   aString is the string to be compared
+   * @param   aIgnoreCase tells us how to treat case
+   * @param   aCount tells us how many chars to compare
+   * @return  -1,0,1
+   */
 
 #ifdef CharT_is_char
-      int32_t Compare( const char* aString, bool aIgnoreCase=false, int32_t aCount=-1 ) const;
+  int32_t Compare( const char* aString, bool aIgnoreCase=false, int32_t aCount=-1 ) const;
 #endif
 
 
-        /**
-         * Equality check between given string and this string.
-         *
-         * @param   aString is the string to check
-         * @param   aIgnoreCase tells us how to treat case
-         * @param   aCount tells us how many chars to compare
-         * @return  boolean
-         */
+  /**
+   * Equality check between given string and this string.
+   *
+   * @param   aString is the string to check
+   * @param   aIgnoreCase tells us how to treat case
+   * @param   aCount tells us how many chars to compare
+   * @return  boolean
+   */
 #ifdef CharT_is_char
-      bool EqualsIgnoreCase( const char* aString, int32_t aCount=-1 ) const {
-        return Compare(aString, true, aCount) == 0;
-      }
+  bool EqualsIgnoreCase( const char* aString, int32_t aCount=-1 ) const {
+    return Compare(aString, true, aCount) == 0;
+  }
 #else
-      bool EqualsIgnoreCase( const char* aString, int32_t aCount=-1 ) const;
+  bool EqualsIgnoreCase( const char* aString, int32_t aCount=-1 ) const;
 
 
 #endif // !CharT_is_PRUnichar
 
-        /**
-         * Perform string to double-precision float conversion.
-         *
-         * @param   aErrorCode will contain error if one occurs
-         * @return  double-precision float rep of string value
-         */
-      double ToDouble( nsresult* aErrorCode ) const;
+  /**
+   * Perform string to double-precision float conversion.
+   *
+   * @param   aErrorCode will contain error if one occurs
+   * @return  double-precision float rep of string value
+   */
+  double ToDouble( nsresult* aErrorCode ) const;
 
-        /**
-         * Perform string to single-precision float conversion.
-         *
-         * @param   aErrorCode will contain error if one occurs
-         * @return  single-precision float rep of string value
-         */
-      float ToFloat( nsresult* aErrorCode ) const {
-        return (float)ToDouble(aErrorCode);
-      }
+  /**
+   * Perform string to single-precision float conversion.
+   *
+   * @param   aErrorCode will contain error if one occurs
+   * @return  single-precision float rep of string value
+   */
+  float ToFloat( nsresult* aErrorCode ) const {
+    return (float)ToDouble(aErrorCode);
+  }
 
 
-        /**
-         * Perform string to int conversion.
-         * @param   aErrorCode will contain error if one occurs
-         * @param   aRadix tells us which radix to assume; kAutoDetect tells us to determine the radix for you.
-         * @return  int rep of string value, and possible (out) error code
-         */
-      int32_t ToInteger( nsresult* aErrorCode, uint32_t aRadix=kRadix10 ) const;
+  /**
+   * Perform string to int conversion.
+   * @param   aErrorCode will contain error if one occurs
+   * @param   aRadix tells us which radix to assume; kAutoDetect tells us to determine the radix for you.
+   * @return  int rep of string value, and possible (out) error code
+   */
+  int32_t ToInteger( nsresult* aErrorCode, uint32_t aRadix=kRadix10 ) const;
 
-        /**
-         * Perform string to 64-bit int conversion.
-         * @param   aErrorCode will contain error if one occurs
-         * @param   aRadix tells us which radix to assume; kAutoDetect tells us to determine the radix for you.
-         * @return  64-bit int rep of string value, and possible (out) error code
-         */
-      int64_t ToInteger64( nsresult* aErrorCode, uint32_t aRadix=kRadix10 ) const;
+  /**
+   * Perform string to 64-bit int conversion.
+   * @param   aErrorCode will contain error if one occurs
+   * @param   aRadix tells us which radix to assume; kAutoDetect tells us to determine the radix for you.
+   * @return  64-bit int rep of string value, and possible (out) error code
+   */
+  int64_t ToInteger64( nsresult* aErrorCode, uint32_t aRadix=kRadix10 ) const;
 
 
-        /**
-         * |Left|, |Mid|, and |Right| are annoying signatures that seem better almost
-         * any _other_ way than they are now.  Consider these alternatives
-         * 
-         * aWritable = aReadable.Left(17);   // ...a member function that returns a |Substring|
-         * aWritable = Left(aReadable, 17);  // ...a global function that returns a |Substring|
-         * Left(aReadable, 17, aWritable);   // ...a global function that does the assignment
-         * 
-         * as opposed to the current signature
-         * 
-         * aReadable.Left(aWritable, 17);    // ...a member function that does the assignment
-         * 
-         * or maybe just stamping them out in favor of |Substring|, they are just duplicate functionality
-         *         
-         * aWritable = Substring(aReadable, 0, 17);
-         */
+  /**
+   * |Left|, |Mid|, and |Right| are annoying signatures that seem better almost
+   * any _other_ way than they are now.  Consider these alternatives
+   *
+   * aWritable = aReadable.Left(17);   // ...a member function that returns a |Substring|
+   * aWritable = Left(aReadable, 17);  // ...a global function that returns a |Substring|
+   * Left(aReadable, 17, aWritable);   // ...a global function that does the assignment
+   *
+   * as opposed to the current signature
+   *
+   * aReadable.Left(aWritable, 17);    // ...a member function that does the assignment
+   *
+   * or maybe just stamping them out in favor of |Substring|, they are just duplicate functionality
+   *
+   * aWritable = Substring(aReadable, 0, 17);
+   */
 
-      size_type Mid( self_type& aResult, uint32_t aStartPos, uint32_t aCount ) const;
+  size_type Mid( self_type& aResult, uint32_t aStartPos, uint32_t aCount ) const;
 
-      size_type Left( self_type& aResult, size_type aCount ) const
-        {
-          return Mid(aResult, 0, aCount);
-        }
+  size_type Left( self_type& aResult, size_type aCount ) const
+  {
+    return Mid(aResult, 0, aCount);
+  }
 
-      size_type Right( self_type& aResult, size_type aCount ) const
-        {
-          aCount = XPCOM_MIN(mLength, aCount);
-          return Mid(aResult, mLength - aCount, aCount);
-        }
+  size_type Right( self_type& aResult, size_type aCount ) const
+  {
+    aCount = XPCOM_MIN(mLength, aCount);
+    return Mid(aResult, mLength - aCount, aCount);
+  }
 
 
-        /**
-         * Set a char inside this string at given index
-         *
-         * @param aChar is the char you want to write into this string
-         * @param anIndex is the ofs where you want to write the given char
-         * @return TRUE if successful
-         */
+  /**
+   * Set a char inside this string at given index
+   *
+   * @param aChar is the char you want to write into this string
+   * @param anIndex is the ofs where you want to write the given char
+   * @return TRUE if successful
+   */
 
-      bool SetCharAt( char16_t aChar, uint32_t aIndex );
+  bool SetCharAt( char16_t aChar, uint32_t aIndex );
 
 
-        /**
-         *  These methods are used to remove all occurrences of the
-         *  characters found in aSet from this string.
-         *  
-         *  @param  aSet -- characters to be cut from this
-         */
-      void StripChars( const char* aSet );
+  /**
+   *  These methods are used to remove all occurrences of the
+   *  characters found in aSet from this string.
+   *
+   *  @param  aSet -- characters to be cut from this
+   */
+  void StripChars( const char* aSet );
 
 
-        /**
-         *  This method strips whitespace throughout the string.
-         */
-      void StripWhitespace();
+  /**
+   *  This method strips whitespace throughout the string.
+   */
+  void StripWhitespace();
 
 
-        /**
-         *  swaps occurence of 1 string for another
-         */
+  /**
+   *  swaps occurence of 1 string for another
+   */
 
-      void ReplaceChar( char_type aOldChar, char_type aNewChar );
-      void ReplaceChar( const char* aSet, char_type aNewChar );
+  void ReplaceChar( char_type aOldChar, char_type aNewChar );
+  void ReplaceChar( const char* aSet, char_type aNewChar );
 #ifdef CharT_is_PRUnichar
-      void ReplaceChar( const char16_t* aSet, char16_t aNewChar );
+  void ReplaceChar( const char16_t* aSet, char16_t aNewChar );
 #endif
-      void ReplaceSubstring( const self_type& aTarget, const self_type& aNewValue);
-      void ReplaceSubstring( const char_type* aTarget, const char_type* aNewValue);
+  void ReplaceSubstring( const self_type& aTarget, const self_type& aNewValue);
+  void ReplaceSubstring( const char_type* aTarget, const char_type* aNewValue);
 
 
-        /**
-         *  This method trims characters found in aTrimSet from
-         *  either end of the underlying string.
-         *  
-         *  @param   aSet -- contains chars to be trimmed from both ends
-         *  @param   aEliminateLeading
-         *  @param   aEliminateTrailing
-         *  @param   aIgnoreQuotes -- if true, causes surrounding quotes to be ignored
-         *  @return  this
-         */
-      void Trim( const char* aSet, bool aEliminateLeading=true, bool aEliminateTrailing=true, bool aIgnoreQuotes=false );
+  /**
+   *  This method trims characters found in aTrimSet from
+   *  either end of the underlying string.
+   *
+   *  @param   aSet -- contains chars to be trimmed from both ends
+   *  @param   aEliminateLeading
+   *  @param   aEliminateTrailing
+   *  @param   aIgnoreQuotes -- if true, causes surrounding quotes to be ignored
+   *  @return  this
+   */
+  void Trim( const char* aSet, bool aEliminateLeading=true, bool aEliminateTrailing=true, bool aIgnoreQuotes=false );
 
-        /**
-         *  This method strips whitespace from string.
-         *  You can control whether whitespace is yanked from start and end of
-         *  string as well.
-         *  
-         *  @param   aEliminateLeading controls stripping of leading ws
-         *  @param   aEliminateTrailing controls stripping of trailing ws
-         */
-      void CompressWhitespace( bool aEliminateLeading=true, bool aEliminateTrailing=true );
+  /**
+   *  This method strips whitespace from string.
+   *  You can control whether whitespace is yanked from start and end of
+   *  string as well.
+   *
+   *  @param   aEliminateLeading controls stripping of leading ws
+   *  @param   aEliminateTrailing controls stripping of trailing ws
+   */
+  void CompressWhitespace( bool aEliminateLeading=true, bool aEliminateTrailing=true );
 
 
-        /**
-         * assign/append/insert with _LOSSY_ conversion
-         */
+  /**
+   * assign/append/insert with _LOSSY_ conversion
+   */
 
-      void AssignWithConversion( const nsTAString_IncompatibleCharT& aString );
-      void AssignWithConversion( const incompatible_char_type* aData, int32_t aLength=-1 );
+  void AssignWithConversion( const nsTAString_IncompatibleCharT& aString );
+  void AssignWithConversion( const incompatible_char_type* aData, int32_t aLength=-1 );
 
 #endif // !MOZ_STRING_WITH_OBSOLETE_API
 
-        /**
-         * Allow this string to be bound to a character buffer
-         * until the string is rebound or mutated; the caller
-         * must ensure that the buffer outlives the string.
-         */
-      void Rebind( const char_type* data, size_type length );
+  /**
+   * Allow this string to be bound to a character buffer
+   * until the string is rebound or mutated; the caller
+   * must ensure that the buffer outlives the string.
+   */
+  void Rebind( const char_type* data, size_type length );
 
-        /**
-         * verify restrictions for dependent strings
-         */
-      void AssertValidDepedentString()
-        {
-          NS_ASSERTION(mData, "nsTDependentString must wrap a non-NULL buffer");
-          NS_ASSERTION(mLength != size_type(-1), "nsTDependentString has bogus length");
-          NS_ASSERTION(mData[mLength] == 0, "nsTDependentString must wrap only null-terminated strings. You are probably looking for nsTDependentSubstring.");
-        }
+  /**
+   * verify restrictions for dependent strings
+   */
+  void AssertValidDepedentString()
+  {
+    NS_ASSERTION(mData, "nsTDependentString must wrap a non-NULL buffer");
+    NS_ASSERTION(mLength != size_type(-1), "nsTDependentString has bogus length");
+    NS_ASSERTION(mData[mLength] == 0, "nsTDependentString must wrap only null-terminated strings. You are probably looking for nsTDependentSubstring.");
+  }
 
 
-    protected:
+protected:
 
-      explicit
-      nsTString_CharT( uint32_t flags )
-        : substring_type(flags) {}
+  explicit
+  nsTString_CharT( uint32_t flags )
+    : substring_type(flags) {}
 
-        // allow subclasses to initialize fields directly
-      nsTString_CharT( char_type* data, size_type length, uint32_t flags )
-        : substring_type(data, length, flags) {}
+  // allow subclasses to initialize fields directly
+  nsTString_CharT( char_type* data, size_type length, uint32_t flags )
+    : substring_type(data, length, flags) {}
 };
 
 
 class nsTFixedString_CharT : public nsTString_CharT
-  {
-    public:
+{
+public:
 
-      typedef nsTFixedString_CharT    self_type;
-      typedef nsTFixedString_CharT    fixed_string_type;
+  typedef nsTFixedString_CharT    self_type;
+  typedef nsTFixedString_CharT    fixed_string_type;
 
-    public:
+public:
 
-        /**
-         * @param data
-         *        fixed-size buffer to be used by the string (the contents of
-         *        this buffer may be modified by the string)
-         * @param storageSize
-         *        the size of the fixed buffer
-         * @param length (optional)
-         *        the length of the string already contained in the buffer
-         */
+  /**
+   * @param data
+   *        fixed-size buffer to be used by the string (the contents of
+   *        this buffer may be modified by the string)
+   * @param storageSize
+   *        the size of the fixed buffer
+   * @param length (optional)
+   *        the length of the string already contained in the buffer
+   */
 
-      nsTFixedString_CharT( char_type* data, size_type storageSize )
-        : string_type(data, uint32_t(char_traits::length(data)), F_TERMINATED | F_FIXED | F_CLASS_FIXED)
-        , mFixedCapacity(storageSize - 1)
-        , mFixedBuf(data)
-        {}
+  nsTFixedString_CharT( char_type* data, size_type storageSize )
+    : string_type(data, uint32_t(char_traits::length(data)), F_TERMINATED | F_FIXED | F_CLASS_FIXED)
+    , mFixedCapacity(storageSize - 1)
+    , mFixedBuf(data)
+  {}
 
-      nsTFixedString_CharT( char_type* data, size_type storageSize, size_type length )
-        : string_type(data, length, F_TERMINATED | F_FIXED | F_CLASS_FIXED)
-        , mFixedCapacity(storageSize - 1)
-        , mFixedBuf(data)
-        {
-          // null-terminate
-          mFixedBuf[length] = char_type(0);
-        }
+  nsTFixedString_CharT( char_type* data, size_type storageSize, size_type length )
+    : string_type(data, length, F_TERMINATED | F_FIXED | F_CLASS_FIXED)
+    , mFixedCapacity(storageSize - 1)
+    , mFixedBuf(data)
+  {
+    // null-terminate
+    mFixedBuf[length] = char_type(0);
+  }
 
-        // |operator=| does not inherit, so we must define our own
-      self_type& operator=( char_type c )                                                       { Assign(c);        return *this; }
-      self_type& operator=( const char_type* data )                                             { Assign(data);     return *this; }
-      self_type& operator=( const substring_type& str )                                         { Assign(str);      return *this; }
-      self_type& operator=( const substring_tuple_type& tuple )                                 { Assign(tuple);    return *this; }
+  // |operator=| does not inherit, so we must define our own
+  self_type& operator=( char_type c )                       { Assign(c);     return *this; }
+  self_type& operator=( const char_type* data )             { Assign(data);  return *this; }
+  self_type& operator=( const substring_type& str )         { Assign(str);   return *this; }
+  self_type& operator=( const substring_tuple_type& tuple ) { Assign(tuple); return *this; }
 
-    protected:
+protected:
 
-      friend class nsTSubstring_CharT;
+  friend class nsTSubstring_CharT;
 
-      size_type  mFixedCapacity;
-      char_type *mFixedBuf;
-  };
+  size_type  mFixedCapacity;
+  char_type *mFixedBuf;
+};
 
 
-  /**
-   * nsTAutoString_CharT
-   *
-   * Subclass of nsTString_CharT that adds support for stack-based string
-   * allocation.  It is normally not a good idea to use this class on the
-   * heap, because it will allocate space which may be wasted if the string
-   * it contains is significantly smaller or any larger than 64 characters.
-   *
-   * NAMES:
-   *   nsAutoString for wide characters
-   *   nsAutoCString for narrow characters
-   */
+/**
+ * nsTAutoString_CharT
+ *
+ * Subclass of nsTString_CharT that adds support for stack-based string
+ * allocation.  It is normally not a good idea to use this class on the
+ * heap, because it will allocate space which may be wasted if the string
+ * it contains is significantly smaller or any larger than 64 characters.
+ *
+ * NAMES:
+ *   nsAutoString for wide characters
+ *   nsAutoCString for narrow characters
+ */
 class nsTAutoString_CharT : public nsTFixedString_CharT
-  {
-    public:
+{
+public:
 
-      typedef nsTAutoString_CharT    self_type;
+  typedef nsTAutoString_CharT    self_type;
 
-    public:
+public:
 
-        /**
-         * constructors
-         */
+  /**
+   * constructors
+   */
 
-      nsTAutoString_CharT()
-        : fixed_string_type(mStorage, kDefaultStorageSize, 0)
-        {}
+  nsTAutoString_CharT()
+    : fixed_string_type(mStorage, kDefaultStorageSize, 0)
+  {}
 
-      explicit
-      nsTAutoString_CharT( char_type c )
-        : fixed_string_type(mStorage, kDefaultStorageSize, 0)
-        {
-          Assign(c);
-        }
+  explicit
+  nsTAutoString_CharT( char_type c )
+    : fixed_string_type(mStorage, kDefaultStorageSize, 0)
+  {
+    Assign(c);
+  }
 
-      explicit
-      nsTAutoString_CharT( const char_type* data, size_type length = size_type(-1) )
-        : fixed_string_type(mStorage, kDefaultStorageSize, 0)
-        {
-          Assign(data, length);
-        }
+  explicit
+  nsTAutoString_CharT( const char_type* data, size_type length = size_type(-1) )
+    : fixed_string_type(mStorage, kDefaultStorageSize, 0)
+  {
+    Assign(data, length);
+  }
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      explicit
-      nsTAutoString_CharT( char16ptr_t data, size_type length = size_type(-1) )
-        : nsTAutoString_CharT(static_cast<const char16_t*>(data), length)
-        {}
+  explicit
+  nsTAutoString_CharT( char16ptr_t data, size_type length = size_type(-1) )
+    : nsTAutoString_CharT(static_cast<const char16_t*>(data), length)
+  {}
 #endif
 
-      nsTAutoString_CharT( const self_type& str )
-        : fixed_string_type(mStorage, kDefaultStorageSize, 0)
-        {
-          Assign(str);
-        }
+  nsTAutoString_CharT( const self_type& str )
+    : fixed_string_type(mStorage, kDefaultStorageSize, 0)
+  {
+    Assign(str);
+  }
 
-      explicit
-      nsTAutoString_CharT( const substring_type& str )
-        : fixed_string_type(mStorage, kDefaultStorageSize, 0)
-        {
-          Assign(str);
-        }
+  explicit
+  nsTAutoString_CharT( const substring_type& str )
+    : fixed_string_type(mStorage, kDefaultStorageSize, 0)
+  {
+    Assign(str);
+  }
 
-      nsTAutoString_CharT( const substring_tuple_type& tuple )
-        : fixed_string_type(mStorage, kDefaultStorageSize, 0)
-        {
-          Assign(tuple);
-        }
+  nsTAutoString_CharT( const substring_tuple_type& tuple )
+    : fixed_string_type(mStorage, kDefaultStorageSize, 0)
+  {
+    Assign(tuple);
+  }
 
-        // |operator=| does not inherit, so we must define our own
-      self_type& operator=( char_type c )                                                       { Assign(c);        return *this; }
-      self_type& operator=( const char_type* data )                                             { Assign(data);     return *this; }
+  // |operator=| does not inherit, so we must define our own
+  self_type& operator=( char_type c )                       { Assign(c);     return *this; }
+  self_type& operator=( const char_type* data )             { Assign(data);  return *this; }
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      self_type& operator=( char16ptr_t data )                                                  { Assign(data);     return *this; }
+  self_type& operator=( char16ptr_t data )                  { Assign(data);  return *this; }
 #endif
-      self_type& operator=( const self_type& str )                                              { Assign(str);      return *this; }
-      self_type& operator=( const substring_type& str )                                         { Assign(str);      return *this; }
-      self_type& operator=( const substring_tuple_type& tuple )                                 { Assign(tuple);    return *this; }
+  self_type& operator=( const self_type& str )              { Assign(str);   return *this; }
+  self_type& operator=( const substring_type& str )         { Assign(str);   return *this; }
+  self_type& operator=( const substring_tuple_type& tuple ) { Assign(tuple); return *this; }
 
-      enum { kDefaultStorageSize = 64 };
+  enum { kDefaultStorageSize = 64 };
 
-    private:
+private:
 
-      char_type mStorage[kDefaultStorageSize];
-  };
+  char_type mStorage[kDefaultStorageSize];
+};
 
 
-  //
-  // nsAutoString stores pointers into itself which are invalidated when an
-  // nsTArray is resized, so nsTArray must not be instantiated with nsAutoString
-  // elements!
-  //
-  template<class E> class nsTArrayElementTraits;
-  template<>
-  class nsTArrayElementTraits<nsTAutoString_CharT> {
-    public:
-      template<class A> struct Dont_Instantiate_nsTArray_of;
-      template<class A> struct Instead_Use_nsTArray_of;
+//
+// nsAutoString stores pointers into itself which are invalidated when an
+// nsTArray is resized, so nsTArray must not be instantiated with nsAutoString
+// elements!
+//
+template<class E> class nsTArrayElementTraits;
+template<>
+class nsTArrayElementTraits<nsTAutoString_CharT> {
+public:
+  template<class A> struct Dont_Instantiate_nsTArray_of;
+  template<class A> struct Instead_Use_nsTArray_of;
 
-      static Dont_Instantiate_nsTArray_of<nsTAutoString_CharT> *
-      Construct(Instead_Use_nsTArray_of<nsTString_CharT> *e) {
-        return 0;
-      }
-      template<class A>
-      static Dont_Instantiate_nsTArray_of<nsTAutoString_CharT> *
-      Construct(Instead_Use_nsTArray_of<nsTString_CharT> *e,
-                const A &arg) {
-        return 0;
-      }
-      static Dont_Instantiate_nsTArray_of<nsTAutoString_CharT> *
-      Destruct(Instead_Use_nsTArray_of<nsTString_CharT> *e) {
-        return 0;
-      }
-  };
+  static Dont_Instantiate_nsTArray_of<nsTAutoString_CharT> *
+  Construct(Instead_Use_nsTArray_of<nsTString_CharT> *e) {
+    return 0;
+  }
+  template<class A>
+  static Dont_Instantiate_nsTArray_of<nsTAutoString_CharT> *
+  Construct(Instead_Use_nsTArray_of<nsTString_CharT> *e,
+            const A &arg) {
+    return 0;
+  }
+  static Dont_Instantiate_nsTArray_of<nsTAutoString_CharT> *
+  Destruct(Instead_Use_nsTArray_of<nsTString_CharT> *e) {
+    return 0;
+  }
+};
 
-  /**
-   * nsTXPIDLString extends nsTString such that:
-   *
-   *   (1) mData can be null
-   *   (2) objects of this type can be automatically cast to |const CharT*|
-   *   (3) getter_Copies method is supported to adopt data allocated with
-   *       NS_Alloc, such as "out string" parameters in XPIDL.
-   *
-   * NAMES:
-   *   nsXPIDLString for wide characters
-   *   nsXPIDLCString for narrow characters
-   */
+/**
+ * nsTXPIDLString extends nsTString such that:
+ *
+ *   (1) mData can be null
+ *   (2) objects of this type can be automatically cast to |const CharT*|
+ *   (3) getter_Copies method is supported to adopt data allocated with
+ *       NS_Alloc, such as "out string" parameters in XPIDL.
+ *
+ * NAMES:
+ *   nsXPIDLString for wide characters
+ *   nsXPIDLCString for narrow characters
+ */
 class nsTXPIDLString_CharT : public nsTString_CharT
-  {
-    public:
+{
+public:
 
-      typedef nsTXPIDLString_CharT    self_type;
+  typedef nsTXPIDLString_CharT    self_type;
 
-    public:
+public:
 
-      nsTXPIDLString_CharT()
-        : string_type(char_traits::sEmptyBuffer, 0, F_TERMINATED | F_VOIDED) {}
+  nsTXPIDLString_CharT()
+    : string_type(char_traits::sEmptyBuffer, 0, F_TERMINATED | F_VOIDED) {}
 
-        // copy-constructor required to avoid default
-      nsTXPIDLString_CharT( const self_type& str )
-        : string_type(char_traits::sEmptyBuffer, 0, F_TERMINATED | F_VOIDED)
-        {
-          Assign(str);
-        }
+  // copy-constructor required to avoid default
+  nsTXPIDLString_CharT( const self_type& str )
+    : string_type(char_traits::sEmptyBuffer, 0, F_TERMINATED | F_VOIDED)
+  {
+    Assign(str);
+  }
 
-        // return nullptr if we are voided
+  // return nullptr if we are voided
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      char16ptr_t get() const
+  char16ptr_t get() const
 #else
-      const char_type* get() const
+  const char_type* get() const
 #endif
-        {
-          return (mFlags & F_VOIDED) ? nullptr : mData;
-        }
+  {
+    return (mFlags & F_VOIDED) ? nullptr : mData;
+  }
 
-        // this case operator is the reason why this class cannot just be a
-        // typedef for nsTString
-      operator const char_type*() const
-        {
-          return get();
-        }
+  // this case operator is the reason why this class cannot just be a
+  // typedef for nsTString
+  operator const char_type*() const
+  {
+    return get();
+  }
 
-        // need this to diambiguous operator[int]
-      char_type operator[]( int32_t i ) const
-        {
-          return CharAt(index_type(i));
-        }
+  // need this to diambiguous operator[int]
+  char_type operator[]( int32_t i ) const
+  {
+    return CharAt(index_type(i));
+  }
 
-        // |operator=| does not inherit, so we must define our own
-      self_type& operator=( char_type c )                                                       { Assign(c);        return *this; }
-      self_type& operator=( const char_type* data )                                             { Assign(data);     return *this; }
-      self_type& operator=( const self_type& str )                                              { Assign(str);      return *this; }
-      self_type& operator=( const substring_type& str )                                         { Assign(str);      return *this; }
-      self_type& operator=( const substring_tuple_type& tuple )                                 { Assign(tuple);    return *this; }
-  };
+  // |operator=| does not inherit, so we must define our own
+  self_type& operator=( char_type c )                       { Assign(c);     return *this; }
+  self_type& operator=( const char_type* data )             { Assign(data);  return *this; }
+  self_type& operator=( const self_type& str )              { Assign(str);   return *this; }
+  self_type& operator=( const substring_type& str )         { Assign(str);   return *this; }
+  self_type& operator=( const substring_tuple_type& tuple ) { Assign(tuple); return *this; }
+};
 
 
-  /**
-   * getter_Copies support for use with raw string out params:
-   *
-   *    NS_IMETHOD GetBlah(char**);
-   *    
-   *    void some_function()
-   *    {
-   *      nsXPIDLCString blah;
-   *      GetBlah(getter_Copies(blah));
-   *      // ...
-   *    }
-   */
+/**
+ * getter_Copies support for use with raw string out params:
+ *
+ *    NS_IMETHOD GetBlah(char**);
+ *
+ *    void some_function()
+ *    {
+ *      nsXPIDLCString blah;
+ *      GetBlah(getter_Copies(blah));
+ *      // ...
+ *    }
+ */
 class MOZ_STACK_CLASS nsTGetterCopies_CharT
-  {
-    public:
-      typedef CharT char_type;
+{
+public:
+  typedef CharT char_type;
 
-      nsTGetterCopies_CharT(nsTSubstring_CharT& str)
-        : mString(str), mData(nullptr) {}
+  nsTGetterCopies_CharT(nsTSubstring_CharT& str)
+    : mString(str), mData(nullptr) {}
 
-      ~nsTGetterCopies_CharT()
-        {
-          mString.Adopt(mData); // OK if mData is null
-        }
+  ~nsTGetterCopies_CharT()
+  {
+    mString.Adopt(mData); // OK if mData is null
+  }
 
-      operator char_type**()
-        {
-          return &mData;
-        }
+  operator char_type**()
+  {
+    return &mData;
+  }
 
-    private:
-      nsTSubstring_CharT&      mString;
-      char_type*            mData;
-  };
+private:
+  nsTSubstring_CharT&      mString;
+  char_type*            mData;
+};
 
 inline
 nsTGetterCopies_CharT
 getter_Copies( nsTSubstring_CharT& aString )
-  {
-    return nsTGetterCopies_CharT(aString);
-  }
+{
+  return nsTGetterCopies_CharT(aString);
+}
 
 
-  /**
-   * nsTAdoptingString extends nsTXPIDLString such that:
-   *
-   * (1) Adopt given string on construction or assignment, i.e. take
-   * the value of what's given, and make what's given forget its
-   * value. Note that this class violates constness in a few
-   * places. Be careful!
-   */
+/**
+ * nsTAdoptingString extends nsTXPIDLString such that:
+ *
+ * (1) Adopt given string on construction or assignment, i.e. take
+ * the value of what's given, and make what's given forget its
+ * value. Note that this class violates constness in a few
+ * places. Be careful!
+ */
 class nsTAdoptingString_CharT : public nsTXPIDLString_CharT
+{
+public:
+
+  typedef nsTAdoptingString_CharT    self_type;
+
+public:
+
+  explicit nsTAdoptingString_CharT() {}
+  explicit nsTAdoptingString_CharT(char_type* str, size_type length = size_type(-1))
   {
-    public:
-
-      typedef nsTAdoptingString_CharT    self_type;
-
-    public:
-
-      explicit nsTAdoptingString_CharT() {}
-      explicit nsTAdoptingString_CharT(char_type* str, size_type length = size_type(-1))
-        {
-          Adopt(str, length);
-        }
+    Adopt(str, length);
+  }
 
-        // copy-constructor required to adopt on copy. Note that this
-        // will violate the constness of |str| in the operator=()
-        // call. |str| will be truncated as a side-effect of this
-        // constructor.
-      nsTAdoptingString_CharT( const self_type& str )
-        {
-          *this = str;
-        }
+  // copy-constructor required to adopt on copy. Note that this
+  // will violate the constness of |str| in the operator=()
+  // call. |str| will be truncated as a side-effect of this
+  // constructor.
+  nsTAdoptingString_CharT( const self_type& str )
+  {
+    *this = str;
+  }
 
-        // |operator=| does not inherit, so we must define our own
-      self_type& operator=( const substring_type& str )                                         { Assign(str);      return *this; }
-      self_type& operator=( const substring_tuple_type& tuple )                                 { Assign(tuple);    return *this; }
+  // |operator=| does not inherit, so we must define our own
+  self_type& operator=( const substring_type& str )         { Assign(str);   return *this; }
+  self_type& operator=( const substring_tuple_type& tuple ) { Assign(tuple); return *this; }
 
-        // Adopt(), if possible, when assigning to a self_type&. Note
-        // that this violates the constness of str, str is always
-        // truncated when this operator is called.
-      self_type& operator=( const self_type& str );
+  // Adopt(), if possible, when assigning to a self_type&. Note
+  // that this violates the constness of str, str is always
+  // truncated when this operator is called.
+  self_type& operator=( const self_type& str );
 
-    private:
-      self_type& operator=( const char_type* data ) MOZ_DELETE;
-      self_type& operator=( char_type* data ) MOZ_DELETE;
-  };
+private:
+  self_type& operator=( const char_type* data ) MOZ_DELETE;
+  self_type& operator=( char_type* data ) MOZ_DELETE;
+};
 
--- a/xpcom/string/public/nsTSubstring.h
+++ b/xpcom/string/public/nsTSubstring.h
@@ -1,956 +1,956 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 // IWYU pragma: private, include "nsString.h"
 
 #include "mozilla/Casting.h"
 #include "mozilla/MemoryReporting.h"
 
 #ifndef MOZILLA_INTERNAL_API
 #error Cannot use internal string classes without MOZILLA_INTERNAL_API defined. Use the frozen header nsStringAPI.h instead.
 #endif
 
+/**
+ * The base for string comparators
+ */
+class nsTStringComparator_CharT
+{
+public:
+  typedef CharT char_type;
+
+  nsTStringComparator_CharT() {}
+
+  virtual int operator()( const char_type*, const char_type*, uint32_t, uint32_t ) const = 0;
+};
+
+
+/**
+ * The default string comparator (case-sensitive comparision)
+ */
+class nsTDefaultStringComparator_CharT
+  : public nsTStringComparator_CharT
+{
+public:
+  typedef CharT char_type;
+
+  nsTDefaultStringComparator_CharT() {}
+
+  virtual int operator()( const char_type*, const char_type*, uint32_t, uint32_t ) const;
+};
+
+/**
+ * nsTSubstring is the most abstract class in the string hierarchy. It
+ * represents a single contiguous array of characters, which may or may not
+ * be null-terminated. This type is not instantiated directly.  A sub-class
+ * is instantiated instead.  For example, see nsTString.
+ *
+ * NAMES:
+ *   nsAString for wide characters
+ *   nsACString for narrow characters
+ *
+ * Many of the accessors on nsTSubstring are inlined as an optimization.
+ */
+class nsTSubstring_CharT
+{
+public:
+  typedef mozilla::fallible_t                 fallible_t;
+
+  typedef CharT                               char_type;
+
+  typedef nsCharTraits<char_type>             char_traits;
+  typedef char_traits::incompatible_char_type incompatible_char_type;
+
+  typedef nsTSubstring_CharT                  self_type;
+  typedef self_type                           abstract_string_type;
+  typedef self_type                           base_string_type;
+
+  typedef self_type                           substring_type;
+  typedef nsTSubstringTuple_CharT             substring_tuple_type;
+  typedef nsTString_CharT                     string_type;
+
+  typedef nsReadingIterator<char_type>        const_iterator;
+  typedef nsWritingIterator<char_type>        iterator;
+
+  typedef nsTStringComparator_CharT           comparator_type;
+
+  typedef char_type*                          char_iterator;
+  typedef const char_type*                    const_char_iterator;
+
+  typedef uint32_t                            size_type;
+  typedef uint32_t                            index_type;
+
+public:
+
+  // this acts like a virtual destructor
+  ~nsTSubstring_CharT() { Finalize(); }
+
   /**
-   * The base for string comparators
+   * reading iterators
+   */
+
+  const_char_iterator BeginReading() const { return mData; }
+  const_char_iterator EndReading() const { return mData + mLength; }
+
+  /**
+   * deprecated reading iterators
+   */
+
+  const_iterator& BeginReading( const_iterator& iter ) const
+  {
+    iter.mStart = mData;
+    iter.mEnd = mData + mLength;
+    iter.mPosition = iter.mStart;
+    return iter;
+  }
+
+  const_iterator& EndReading( const_iterator& iter ) const
+  {
+    iter.mStart = mData;
+    iter.mEnd = mData + mLength;
+    iter.mPosition = iter.mEnd;
+    return iter;
+  }
+
+  const_char_iterator& BeginReading( const_char_iterator& iter ) const
+  {
+    return iter = mData;
+  }
+
+  const_char_iterator& EndReading( const_char_iterator& iter ) const
+  {
+    return iter = mData + mLength;
+  }
+
+
+  /**
+   * writing iterators
    */
-class nsTStringComparator_CharT
+
+  char_iterator BeginWriting()
+  {
+    if (!EnsureMutable())
+      NS_ABORT_OOM(mLength);
+
+    return mData;
+  }
+
+  char_iterator BeginWriting( const fallible_t& )
+  {
+    return EnsureMutable() ? mData : char_iterator(0);
+  }
+
+  char_iterator EndWriting()
+  {
+    if (!EnsureMutable())
+      NS_ABORT_OOM(mLength);
+
+    return mData + mLength;
+  }
+
+  char_iterator EndWriting( const fallible_t& )
+  {
+    return EnsureMutable() ? (mData + mLength) : char_iterator(0);
+  }
+
+  char_iterator& BeginWriting( char_iterator& iter )
+  {
+    return iter = BeginWriting();
+  }
+
+  char_iterator& BeginWriting( char_iterator& iter, const fallible_t& )
+  {
+    return iter = BeginWriting(fallible_t());
+  }
+
+  char_iterator& EndWriting( char_iterator& iter )
+  {
+    return iter = EndWriting();
+  }
+
+  char_iterator& EndWriting( char_iterator& iter, const fallible_t& )
+  {
+    return iter = EndWriting(fallible_t());
+  }
+
+  /**
+   * deprecated writing iterators
+   */
+
+  iterator& BeginWriting( iterator& iter )
+  {
+    char_type *data = BeginWriting();
+    iter.mStart = data;
+    iter.mEnd = data + mLength;
+    iter.mPosition = iter.mStart;
+    return iter;
+  }
+
+  iterator& EndWriting( iterator& iter )
+  {
+    char_type *data = BeginWriting();
+    iter.mStart = data;
+    iter.mEnd = data + mLength;
+    iter.mPosition = iter.mEnd;
+    return iter;
+  }
+
+  /**
+   * accessors
+   */
+
+  // returns pointer to string data (not necessarily null-terminated)
+#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
+  char16ptr_t Data() const
+#else
+  const char_type *Data() const
+#endif
   {
-    public:
-      typedef CharT char_type;
+    return mData;
+  }
+
+  size_type Length() const
+  {
+    return mLength;
+  }
+
+  uint32_t Flags() const
+  {
+    return mFlags;
+  }
+
+  bool IsEmpty() const
+  {
+    return mLength == 0;
+  }
+
+  bool IsLiteral() const
+  {
+    return (mFlags & F_LITERAL) != 0;
+  }
+
+  bool IsVoid() const
+  {
+    return (mFlags & F_VOIDED) != 0;
+  }
+
+  bool IsTerminated() const
+  {
+    return (mFlags & F_TERMINATED) != 0;
+  }
+
+  char_type CharAt( index_type i ) const
+  {
+    NS_ASSERTION(i < mLength, "index exceeds allowable range");
+    return mData[i];
+  }
+
+  char_type operator[]( index_type i ) const
+  {
+    return CharAt(i);
+  }
+
+  char_type First() const
+  {
+    NS_ASSERTION(mLength > 0, "|First()| called on an empty string");
+    return mData[0];
+  }
+
+  inline
+  char_type Last() const
+  {
+    NS_ASSERTION(mLength > 0, "|Last()| called on an empty string");
+    return mData[mLength - 1];
+  }
+
+  size_type NS_FASTCALL CountChar( char_type ) const;
+  int32_t NS_FASTCALL FindChar( char_type, index_type offset = 0 ) const;
+
+
+  /**
+   * equality
+   */
+
+  bool NS_FASTCALL Equals( const self_type& ) const;
+  bool NS_FASTCALL Equals( const self_type&, const comparator_type& ) const;
+
+  bool NS_FASTCALL Equals( const char_type* data ) const;
+  bool NS_FASTCALL Equals( const char_type* data, const comparator_type& comp ) const;
+
+#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
+  bool NS_FASTCALL Equals( char16ptr_t data ) const
+  {
+    return Equals(static_cast<const char16_t*>(data));
+  }
+  bool NS_FASTCALL Equals( char16ptr_t data, const comparator_type& comp ) const
+  {
+    return Equals(static_cast<const char16_t*>(data), comp);
+  }
+#endif
+
+  /**
+   * An efficient comparison with ASCII that can be used even
+   * for wide strings. Call this version when you know the
+   * length of 'data'.
+   */
+  bool NS_FASTCALL EqualsASCII( const char* data, size_type len ) const;
+  /**
+   * An efficient comparison with ASCII that can be used even
+   * for wide strings. Call this version when 'data' is
+   * null-terminated.
+   */
+  bool NS_FASTCALL EqualsASCII( const char* data ) const;
 
-      nsTStringComparator_CharT() {}
+  // EqualsLiteral must ONLY be applied to an actual literal string, or
+  // a char array *constant* declared without an explicit size.
+  // Do not attempt to use it with a regular char* pointer, or with a
+  // non-constant char array variable. Use EqualsASCII for them.
+  // The template trick to acquire the array length at compile time without
+  // using a macro is due to Corey Kosak, with much thanks.
+  template<int N>
+  inline bool EqualsLiteral( const char (&str)[N] ) const
+  {
+    return EqualsASCII(str, N-1);
+  }
+
+  // The LowerCaseEquals methods compare the ASCII-lowercase version of
+  // this string (lowercasing only ASCII uppercase characters) to some
+  // ASCII/Literal string. The ASCII string is *not* lowercased for
+  // you. If you compare to an ASCII or literal string that contains an
+  // uppercase character, it is guaranteed to return false. We will
+  // throw assertions too.
+  bool NS_FASTCALL LowerCaseEqualsASCII( const char* data, size_type len ) const;
+  bool NS_FASTCALL LowerCaseEqualsASCII( const char* data ) const;
+
+  // LowerCaseEqualsLiteral must ONLY be applied to an actual
+  // literal string, or a char array *constant* declared without an
+  // explicit size.  Do not attempt to use it with a regular char*
+  // pointer, or with a non-constant char array variable. Use
+  // LowerCaseEqualsASCII for them.
+  template<int N>
+  inline bool LowerCaseEqualsLiteral( const char (&str)[N] ) const
+  {
+    return LowerCaseEqualsASCII(str, N-1);
+  }
+
+  /**
+   * assignment
+   */
+
+  void NS_FASTCALL Assign( char_type c );
+  bool NS_FASTCALL Assign( char_type c, const fallible_t& ) NS_WARN_UNUSED_RESULT;
+
+  void NS_FASTCALL Assign( const char_type* data );
+  void NS_FASTCALL Assign( const char_type* data, size_type length );
+  bool NS_FASTCALL Assign( const char_type* data, size_type length, const fallible_t& ) NS_WARN_UNUSED_RESULT;
+
+  void NS_FASTCALL Assign( const self_type& );
+  bool NS_FASTCALL Assign( const self_type&, const fallible_t& ) NS_WARN_UNUSED_RESULT;
+
+  void NS_FASTCALL Assign( const substring_tuple_type& );
+  bool NS_FASTCALL Assign( const substring_tuple_type&, const fallible_t& ) NS_WARN_UNUSED_RESULT;
 
-      virtual int operator()( const char_type*, const char_type*, uint32_t, uint32_t ) const = 0;
-  };
+#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
+  void Assign (char16ptr_t data)
+  {
+    Assign(static_cast<const char16_t*>(data));
+  }
+
+  bool Assign(char16ptr_t data, const fallible_t&) NS_WARN_UNUSED_RESULT
+  {
+    return Assign(static_cast<const char16_t*>(data), fallible_t());
+  }
+
+  void Assign (char16ptr_t data, size_type length)
+  {
+    Assign(static_cast<const char16_t*>(data), length);
+  }
+
+  bool Assign(char16ptr_t data, size_type length, const fallible_t&) NS_WARN_UNUSED_RESULT
+  {
+    return Assign(static_cast<const char16_t*>(data), length, fallible_t());
+  }
+#endif
+
+  void NS_FASTCALL AssignASCII( const char* data, size_type length );
+  bool NS_FASTCALL AssignASCII( const char* data, size_type length, const fallible_t& ) NS_WARN_UNUSED_RESULT;
+
+  void NS_FASTCALL AssignASCII( const char* data )
+  {
+    AssignASCII(data, mozilla::SafeCast<size_type, size_t>(strlen(data)));
+  }
+  bool NS_FASTCALL AssignASCII( const char* data, const fallible_t& ) NS_WARN_UNUSED_RESULT
+  {
+    return AssignASCII(data, mozilla::SafeCast<size_type, size_t>(strlen(data)), fallible_t());
+  }
+
+  // AssignLiteral must ONLY be applied to an actual literal string, or
+  // a char array *constant* declared without an explicit size.
+  // Do not attempt to use it with a regular char* pointer, or with a
+  // non-constant char array variable. Use AssignASCII for those.
+  // There are not fallible version of these methods because they only really
+  // apply to small allocations that we wouldn't want to check anyway.
+  template<int N>
+  void AssignLiteral( const char_type (&str)[N] )
+  { AssignLiteral(str, N - 1); }
+#ifdef CharT_is_PRUnichar
+  template<int N>
+  void AssignLiteral( const char (&str)[N] )
+  { AssignASCII(str, N-1); }
+#endif
+
+  self_type& operator=( char_type c )                                                       { Assign(c);        return *this; }
+  self_type& operator=( const char_type* data )                                             { Assign(data);     return *this; }
+#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
+  self_type& operator=( char16ptr_t data )                                                  { Assign(data);     return *this; }
+#endif
+  self_type& operator=( const self_type& str )                                              { Assign(str);      return *this; }
+  self_type& operator=( const substring_tuple_type& tuple )                                 { Assign(tuple);    return *this; }
+
+  void NS_FASTCALL Adopt( char_type* data, size_type length = size_type(-1) );
 
 
   /**
-   * The default string comparator (case-sensitive comparision)
+   * buffer manipulation
    */
-class nsTDefaultStringComparator_CharT
-    : public nsTStringComparator_CharT
-  {
-    public:
-      typedef CharT char_type;
+
+  void NS_FASTCALL Replace( index_type cutStart, size_type cutLength, char_type c );
+  bool NS_FASTCALL Replace( index_type cutStart, size_type cutLength, char_type c, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT;
+  void NS_FASTCALL Replace( index_type cutStart, size_type cutLength, const char_type* data, size_type length = size_type(-1) );
+  bool NS_FASTCALL Replace( index_type cutStart, size_type cutLength, const char_type* data, size_type length, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT;
+  void Replace( index_type cutStart, size_type cutLength, const self_type& str )      { Replace(cutStart, cutLength, str.Data(), str.Length()); }
+  bool Replace( index_type cutStart, size_type cutLength, const self_type& str, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT
+  { return Replace(cutStart, cutLength, str.Data(), str.Length(), mozilla::fallible_t()); }
+  void NS_FASTCALL Replace( index_type cutStart, size_type cutLength, const substring_tuple_type& tuple );
+
+  void NS_FASTCALL ReplaceASCII( index_type cutStart, size_type cutLength, const char* data, size_type length = size_type(-1) );
 
-      nsTDefaultStringComparator_CharT() {}
+  // ReplaceLiteral must ONLY be applied to an actual literal string.
+  // Do not attempt to use it with a regular char* pointer, or with a char
+  // array variable. Use Replace or ReplaceASCII for those.
+  template<int N>
+  void ReplaceLiteral( index_type cutStart, size_type cutLength, const char_type (&str)[N] ) { ReplaceLiteral(cutStart, cutLength, str, N - 1); }
 
-      virtual int operator()( const char_type*, const char_type*, uint32_t, uint32_t ) const;
-  };
+  void Append( char_type c )                                                                 { Replace(mLength, 0, c); }
+  bool Append( char_type c, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT                { return Replace(mLength, 0, c, mozilla::fallible_t()); }
+  void Append( const char_type* data, size_type length = size_type(-1) )                     { Replace(mLength, 0, data, length); }
+  bool Append( const char_type* data, size_type length, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT
+  { return Replace(mLength, 0, data, length, mozilla::fallible_t()); }
+
+#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
+  void Append( char16ptr_t data, size_type length = size_type(-1) )                            { Append(static_cast<const char16_t*>(data), length); }
+#endif
+
+  void Append( const self_type& str )                                                        { Replace(mLength, 0, str); }
+  void Append( const substring_tuple_type& tuple )                                           { Replace(mLength, 0, tuple); }
+
+  void AppendASCII( const char* data, size_type length = size_type(-1) )                     { ReplaceASCII(mLength, 0, data, length); }
 
   /**
-   * nsTSubstring is the most abstract class in the string hierarchy. It
-   * represents a single contiguous array of characters, which may or may not
-   * be null-terminated. This type is not instantiated directly.  A sub-class
-   * is instantiated instead.  For example, see nsTString.
-   *
-   * NAMES:
-   *   nsAString for wide characters
-   *   nsACString for narrow characters
-   *
-   * Many of the accessors on nsTSubstring are inlined as an optimization.
+   * Append a formatted string to the current string. Uses the format
+   * codes documented in prprf.h
    */
-class nsTSubstring_CharT
+  void AppendPrintf( const char* format, ... );
+  void AppendPrintf( const char* format, va_list ap );
+  void AppendInt( int32_t aInteger )
+  { AppendPrintf( "%d", aInteger ); }
+  void AppendInt( int32_t aInteger, int aRadix )
+  {
+    const char *fmt = aRadix == 10 ? "%d" : aRadix == 8 ? "%o" : "%x";
+    AppendPrintf( fmt, aInteger );
+  }
+  void AppendInt( uint32_t aInteger )
+  { AppendPrintf( "%u", aInteger ); }
+  void AppendInt( uint32_t aInteger, int aRadix )
   {
-    public:
-      typedef mozilla::fallible_t                 fallible_t;
-
-      typedef CharT                               char_type;
-
-      typedef nsCharTraits<char_type>             char_traits;
-      typedef char_traits::incompatible_char_type incompatible_char_type;
-
-      typedef nsTSubstring_CharT                  self_type;
-      typedef self_type                           abstract_string_type;
-      typedef self_type                           base_string_type;
-
-      typedef self_type                           substring_type;
-      typedef nsTSubstringTuple_CharT             substring_tuple_type;
-      typedef nsTString_CharT                     string_type;
-
-      typedef nsReadingIterator<char_type>        const_iterator;
-      typedef nsWritingIterator<char_type>        iterator;
-
-      typedef nsTStringComparator_CharT           comparator_type;
-
-      typedef char_type*                          char_iterator;
-      typedef const char_type*                    const_char_iterator;
-
-      typedef uint32_t                            size_type;
-      typedef uint32_t                            index_type;
-
-    public:
-
-        // this acts like a virtual destructor
-      ~nsTSubstring_CharT() { Finalize(); }
-
-        /**
-         * reading iterators
-         */
-
-      const_char_iterator BeginReading() const { return mData; }
-      const_char_iterator EndReading() const { return mData + mLength; }
-
-        /**
-         * deprecated reading iterators
-         */
-
-      const_iterator& BeginReading( const_iterator& iter ) const
-        {
-          iter.mStart = mData;
-          iter.mEnd = mData + mLength;
-          iter.mPosition = iter.mStart;
-          return iter;
-        }
-
-      const_iterator& EndReading( const_iterator& iter ) const
-        {
-          iter.mStart = mData;
-          iter.mEnd = mData + mLength;
-          iter.mPosition = iter.mEnd;
-          return iter;
-        }
-
-      const_char_iterator& BeginReading( const_char_iterator& iter ) const
-        {
-          return iter = mData;
-        }
-
-      const_char_iterator& EndReading( const_char_iterator& iter ) const
-        {
-          return iter = mData + mLength;
-        }
-
-
-        /**
-         * writing iterators
-         */
-      
-      char_iterator BeginWriting()
-        {
-          if (!EnsureMutable())
-            NS_ABORT_OOM(mLength);
-
-          return mData;
-        }
-
-      char_iterator BeginWriting( const fallible_t& )
-        {
-          return EnsureMutable() ? mData : char_iterator(0);
-        }
-
-      char_iterator EndWriting()
-        {
-          if (!EnsureMutable())
-            NS_ABORT_OOM(mLength);
-
-          return mData + mLength;
-        }
-
-      char_iterator EndWriting( const fallible_t& )
-        {
-          return EnsureMutable() ? (mData + mLength) : char_iterator(0);
-        }
-
-      char_iterator& BeginWriting( char_iterator& iter )
-        {
-          return iter = BeginWriting();
-        }
-
-      char_iterator& BeginWriting( char_iterator& iter, const fallible_t& )
-        {
-          return iter = BeginWriting(fallible_t());
-        }
+    const char *fmt = aRadix == 10 ? "%u" : aRadix == 8 ? "%o" : "%x";
+    AppendPrintf( fmt, aInteger );
+  }
+  void AppendInt( int64_t aInteger )
+  { AppendPrintf( "%lld", aInteger ); }
+  void AppendInt( int64_t aInteger, int aRadix )
+  {
+    const char *fmt = aRadix == 10 ? "%lld" : aRadix == 8 ? "%llo" : "%llx";
+    AppendPrintf( fmt, aInteger );
+  }
+  void AppendInt( uint64_t aInteger )
+  { AppendPrintf( "%llu", aInteger ); }
+  void AppendInt( uint64_t aInteger, int aRadix )
+  {
+    const char *fmt = aRadix == 10 ? "%llu" : aRadix == 8 ? "%llo" : "%llx";
+    AppendPrintf( fmt, aInteger );
+  }
 
-      char_iterator& EndWriting( char_iterator& iter )
-        {
-          return iter = EndWriting();
-        }
-
-      char_iterator& EndWriting( char_iterator& iter, const fallible_t& )
-        {
-          return iter = EndWriting(fallible_t());
-        }
-
-        /**
-         * deprecated writing iterators
-         */
-      
-      iterator& BeginWriting( iterator& iter )
-        {
-          char_type *data = BeginWriting();
-          iter.mStart = data;
-          iter.mEnd = data + mLength;
-          iter.mPosition = iter.mStart;
-          return iter;
-        }
-
-      iterator& EndWriting( iterator& iter )
-        {
-          char_type *data = BeginWriting();
-          iter.mStart = data;
-          iter.mEnd = data + mLength;
-          iter.mPosition = iter.mEnd;
-          return iter;
-        }
-
-        /**
-         * accessors
-         */
-
-        // returns pointer to string data (not necessarily null-terminated)
-#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      char16ptr_t Data() const
-#else
-      const char_type *Data() const
-#endif
-        {
-          return mData;
-        }
-
-      size_type Length() const
-        {
-          return mLength;
-        }
-
-      uint32_t Flags() const
-        {
-          return mFlags;
-        }
-
-      bool IsEmpty() const
-        {
-          return mLength == 0;
-        }
+  /**
+   * Append the given float to this string
+   */
+  void NS_FASTCALL AppendFloat( float aFloat );
+  void NS_FASTCALL AppendFloat( double aFloat );
+public:
 
-      bool IsLiteral() const
-        {
-          return (mFlags & F_LITERAL) != 0;
-        }
-
-      bool IsVoid() const
-        {
-          return (mFlags & F_VOIDED) != 0;
-        }
-
-      bool IsTerminated() const
-        {
-          return (mFlags & F_TERMINATED) != 0;
-        }
-
-      char_type CharAt( index_type i ) const
-        {
-          NS_ASSERTION(i < mLength, "index exceeds allowable range");
-          return mData[i];
-        }
-
-      char_type operator[]( index_type i ) const
-        {
-          return CharAt(i);
-        }
-
-      char_type First() const
-        {
-          NS_ASSERTION(mLength > 0, "|First()| called on an empty string");
-          return mData[0];
-        }
-
-      inline
-      char_type Last() const
-        {
-          NS_ASSERTION(mLength > 0, "|Last()| called on an empty string");
-          return mData[mLength - 1];
-        }
-
-      size_type NS_FASTCALL CountChar( char_type ) const;
-      int32_t NS_FASTCALL FindChar( char_type, index_type offset = 0 ) const;
-
-
-        /**
-         * equality
-         */
-
-      bool NS_FASTCALL Equals( const self_type& ) const;
-      bool NS_FASTCALL Equals( const self_type&, const comparator_type& ) const;
-
-      bool NS_FASTCALL Equals( const char_type* data ) const;
-      bool NS_FASTCALL Equals( const char_type* data, const comparator_type& comp ) const;
-
-#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      bool NS_FASTCALL Equals( char16ptr_t data ) const
-        {
-          return Equals(static_cast<const char16_t*>(data));
-        }
-      bool NS_FASTCALL Equals( char16ptr_t data, const comparator_type& comp ) const
-        {
-          return Equals(static_cast<const char16_t*>(data), comp);
-        }
+  // AppendLiteral must ONLY be applied to an actual literal string.
+  // Do not attempt to use it with a regular char* pointer, or with a char
+  // array variable. Use Append or AppendASCII for those.
+  template<int N>
+  void AppendLiteral( const char_type (&str)[N] )                                             { ReplaceLiteral(mLength, 0, str, N - 1); }
+#ifdef CharT_is_PRUnichar
+  template<int N>
+  void AppendLiteral( const char (&str)[N] )
+  { AppendASCII(str, N-1); }
 #endif
 
-        /**
-         * An efficient comparison with ASCII that can be used even
-         * for wide strings. Call this version when you know the
-         * length of 'data'.
-         */
-      bool NS_FASTCALL EqualsASCII( const char* data, size_type len ) const;
-        /**
-         * An efficient comparison with ASCII that can be used even
-         * for wide strings. Call this version when 'data' is
-         * null-terminated.
-         */
-      bool NS_FASTCALL EqualsASCII( const char* data ) const;
-
-    // EqualsLiteral must ONLY be applied to an actual literal string, or
-    // a char array *constant* declared without an explicit size.
-    // Do not attempt to use it with a regular char* pointer, or with a
-    // non-constant char array variable. Use EqualsASCII for them.
-    // The template trick to acquire the array length at compile time without
-    // using a macro is due to Corey Kosak, with much thanks.
-      template<int N>
-      inline bool EqualsLiteral( const char (&str)[N] ) const
-        {
-          return EqualsASCII(str, N-1);
-        }
-
-    // The LowerCaseEquals methods compare the ASCII-lowercase version of
-    // this string (lowercasing only ASCII uppercase characters) to some
-    // ASCII/Literal string. The ASCII string is *not* lowercased for
-    // you. If you compare to an ASCII or literal string that contains an
-    // uppercase character, it is guaranteed to return false. We will
-    // throw assertions too.
-      bool NS_FASTCALL LowerCaseEqualsASCII( const char* data, size_type len ) const;
-      bool NS_FASTCALL LowerCaseEqualsASCII( const char* data ) const;
-
-    // LowerCaseEqualsLiteral must ONLY be applied to an actual
-    // literal string, or a char array *constant* declared without an 
-    // explicit size.  Do not attempt to use it with a regular char*
-    // pointer, or with a non-constant char array variable. Use
-    // LowerCaseEqualsASCII for them.
-      template<int N>
-      inline bool LowerCaseEqualsLiteral( const char (&str)[N] ) const
-        {
-          return LowerCaseEqualsASCII(str, N-1);
-        }
-
-        /**
-         * assignment
-         */
-
-      void NS_FASTCALL Assign( char_type c );
-      bool NS_FASTCALL Assign( char_type c, const fallible_t& ) NS_WARN_UNUSED_RESULT;
-
-      void NS_FASTCALL Assign( const char_type* data );
-      void NS_FASTCALL Assign( const char_type* data, size_type length );
-      bool NS_FASTCALL Assign( const char_type* data, size_type length, const fallible_t& ) NS_WARN_UNUSED_RESULT;
-
-      void NS_FASTCALL Assign( const self_type& );
-      bool NS_FASTCALL Assign( const self_type&, const fallible_t& ) NS_WARN_UNUSED_RESULT;
+  self_type& operator+=( char_type c )                                                       { Append(c);        return *this; }
+  self_type& operator+=( const char_type* data )                                             { Append(data);     return *this; }
+#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
+  self_type& operator+=( char16ptr_t data )                                                  { Append(data);     return *this; }
+#endif
+  self_type& operator+=( const self_type& str )                                              { Append(str);      return *this; }
+  self_type& operator+=( const substring_tuple_type& tuple )                                 { Append(tuple);    return *this; }
 
-      void NS_FASTCALL Assign( const substring_tuple_type& );
-      bool NS_FASTCALL Assign( const substring_tuple_type&, const fallible_t& ) NS_WARN_UNUSED_RESULT;
-
+  void Insert( char_type c, index_type pos )                                                 { Replace(pos, 0, c); }
+  void Insert( const char_type* data, index_type pos, size_type length = size_type(-1) )     { Replace(pos, 0, data, length); }
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      void Assign (char16ptr_t data)
-        {
-          Assign(static_cast<const char16_t*>(data));
-        }
-
-      bool Assign(char16ptr_t data, const fallible_t&) NS_WARN_UNUSED_RESULT
-        {
-          return Assign(static_cast<const char16_t*>(data), fallible_t());
-        }
-
-      void Assign (char16ptr_t data, size_type length)
-        {
-          Assign(static_cast<const char16_t*>(data), length);
-        }
-
-      bool Assign(char16ptr_t data, size_type length, const fallible_t&) NS_WARN_UNUSED_RESULT
-        {
-          return Assign(static_cast<const char16_t*>(data), length, fallible_t());
-        }
+  void Insert( char16ptr_t data, index_type pos, size_type length = size_type(-1) )
+  { Insert(static_cast<const char16_t*>(data), pos, length); }
 #endif
-
-      void NS_FASTCALL AssignASCII( const char* data, size_type length );
-      bool NS_FASTCALL AssignASCII( const char* data, size_type length, const fallible_t& ) NS_WARN_UNUSED_RESULT;
+  void Insert( const self_type& str, index_type pos )                                        { Replace(pos, 0, str); }
+  void Insert( const substring_tuple_type& tuple, index_type pos )                           { Replace(pos, 0, tuple); }
 
-      void NS_FASTCALL AssignASCII( const char* data )
-        {
-          AssignASCII(data, mozilla::SafeCast<size_type, size_t>(strlen(data)));
-        }
-      bool NS_FASTCALL AssignASCII( const char* data, const fallible_t& ) NS_WARN_UNUSED_RESULT
-        {
-          return AssignASCII(data, mozilla::SafeCast<size_type, size_t>(strlen(data)), fallible_t());
-        }
+  // InsertLiteral must ONLY be applied to an actual literal string.
+  // Do not attempt to use it with a regular char* pointer, or with a char
+  // array variable. Use Insert for those.
+  template<int N>
+  void InsertLiteral( const char_type (&str)[N], index_type pos )                            { ReplaceLiteral(pos, 0, str, N - 1); }
 
-    // AssignLiteral must ONLY be applied to an actual literal string, or
-    // a char array *constant* declared without an explicit size.
-    // Do not attempt to use it with a regular char* pointer, or with a 
-    // non-constant char array variable. Use AssignASCII for those.
-    // There are not fallible version of these methods because they only really
-    // apply to small allocations that we wouldn't want to check anyway.
-      template<int N>
-      void AssignLiteral( const char_type (&str)[N] )
-                  { AssignLiteral(str, N - 1); }
-#ifdef CharT_is_PRUnichar
-      template<int N>
-      void AssignLiteral( const char (&str)[N] )
-                  { AssignASCII(str, N-1); }
-#endif
-
-      self_type& operator=( char_type c )                                                       { Assign(c);        return *this; }
-      self_type& operator=( const char_type* data )                                             { Assign(data);     return *this; }
-#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      self_type& operator=( char16ptr_t data )                                                  { Assign(data);     return *this; }
-#endif
-      self_type& operator=( const self_type& str )                                              { Assign(str);      return *this; }
-      self_type& operator=( const substring_tuple_type& tuple )                                 { Assign(tuple);    return *this; }
-
-      void NS_FASTCALL Adopt( char_type* data, size_type length = size_type(-1) );
+  void Cut( index_type cutStart, size_type cutLength )                                       { Replace(cutStart, cutLength, char_traits::sEmptyBuffer, 0); }
 
 
-        /**
-         * buffer manipulation
-         */
+  /**
+   * buffer sizing
+   */
+
+  /**
+   * Attempts to set the capacity to the given size in number of
+   * characters, without affecting the length of the string.
+   * There is no need to include room for the null terminator: it is
+   * the job of the string class.
+   * Also ensures that the buffer is mutable.
+   */
+  void NS_FASTCALL SetCapacity( size_type newCapacity );
+  bool NS_FASTCALL SetCapacity( size_type newCapacity, const fallible_t& ) NS_WARN_UNUSED_RESULT;
 
-      void NS_FASTCALL Replace( index_type cutStart, size_type cutLength, char_type c );
-      bool NS_FASTCALL Replace( index_type cutStart, size_type cutLength, char_type c, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT;
-      void NS_FASTCALL Replace( index_type cutStart, size_type cutLength, const char_type* data, size_type length = size_type(-1) );
-      bool NS_FASTCALL Replace( index_type cutStart, size_type cutLength, const char_type* data, size_type length, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT;
-      void Replace( index_type cutStart, size_type cutLength, const self_type& str )      { Replace(cutStart, cutLength, str.Data(), str.Length()); }
-      bool Replace( index_type cutStart, size_type cutLength, const self_type& str, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT
-                 { return Replace(cutStart, cutLength, str.Data(), str.Length(), mozilla::fallible_t()); }
-      void NS_FASTCALL Replace( index_type cutStart, size_type cutLength, const substring_tuple_type& tuple );
+  void NS_FASTCALL SetLength( size_type newLength );
+  bool NS_FASTCALL SetLength( size_type newLength, const fallible_t& ) NS_WARN_UNUSED_RESULT;
+
+  void Truncate( size_type newLength = 0 )
+  {
+    NS_ASSERTION(newLength <= mLength, "Truncate cannot make string longer");
+    SetLength(newLength);
+  }
+
+
+  /**
+   * buffer access
+   */
+
 
-      void NS_FASTCALL ReplaceASCII( index_type cutStart, size_type cutLength, const char* data, size_type length = size_type(-1) );
+  /**
+   * Get a const pointer to the string's internal buffer.  The caller
+   * MUST NOT modify the characters at the returned address.
+   *
+   * @returns The length of the buffer in characters.
+   */
+  inline size_type GetData( const char_type** data ) const
+  {
+    *data = mData;
+    return mLength;
+  }
 
-    // ReplaceLiteral must ONLY be applied to an actual literal string.
-    // Do not attempt to use it with a regular char* pointer, or with a char
-    // array variable. Use Replace or ReplaceASCII for those.
-      template<int N>
-      void ReplaceLiteral( index_type cutStart, size_type cutLength, const char_type (&str)[N] ) { ReplaceLiteral(cutStart, cutLength, str, N - 1); }
+  /**
+   * Get a pointer to the string's internal buffer, optionally resizing
+   * the buffer first.  If size_type(-1) is passed for newLen, then the
+   * current length of the string is used.  The caller MAY modify the
+   * characters at the returned address (up to but not exceeding the
+   * length of the string).
+   *
+   * @returns The length of the buffer in characters or 0 if unable to
+   * satisfy the request due to low-memory conditions.
+   */
+  size_type GetMutableData( char_type** data, size_type newLen = size_type(-1) )
+  {
+    if (!EnsureMutable(newLen))
+      NS_ABORT_OOM(newLen == size_type(-1) ? mLength : newLen);
 
-      void Append( char_type c )                                                                 { Replace(mLength, 0, c); }
-      bool Append( char_type c, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT                { return Replace(mLength, 0, c, mozilla::fallible_t()); }
-      void Append( const char_type* data, size_type length = size_type(-1) )                     { Replace(mLength, 0, data, length); }
-      bool Append( const char_type* data, size_type length, const mozilla::fallible_t&) NS_WARN_UNUSED_RESULT
-                 { return Replace(mLength, 0, data, length, mozilla::fallible_t()); }
+    *data = mData;
+    return mLength;
+  }
+
+  size_type GetMutableData( char_type** data, size_type newLen, const fallible_t& )
+  {
+    if (!EnsureMutable(newLen))
+    {
+      *data = nullptr;
+      return 0;
+    }
+
+    *data = mData;
+    return mLength;
+  }
 
 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-    void Append( char16ptr_t data, size_type length = size_type(-1) )                            { Append(static_cast<const char16_t*>(data), length); }
-#endif
-
-      void Append( const self_type& str )                                                        { Replace(mLength, 0, str); }
-      void Append( const substring_tuple_type& tuple )                                           { Replace(mLength, 0, tuple); }
-
-      void AppendASCII( const char* data, size_type length = size_type(-1) )                     { ReplaceASCII(mLength, 0, data, length); }
-
-      /**
-       * Append a formatted string to the current string. Uses the format
-       * codes documented in prprf.h
-       */
-      void AppendPrintf( const char* format, ... );
-      void AppendPrintf( const char* format, va_list ap );
-      void AppendInt( int32_t aInteger )
-                 { AppendPrintf( "%d", aInteger ); }
-      void AppendInt( int32_t aInteger, int aRadix )
-        {
-          const char *fmt = aRadix == 10 ? "%d" : aRadix == 8 ? "%o" : "%x";
-          AppendPrintf( fmt, aInteger );
-        }
-      void AppendInt( uint32_t aInteger )
-                 { AppendPrintf( "%u", aInteger ); }
-      void AppendInt( uint32_t aInteger, int aRadix )
-        {
-          const char *fmt = aRadix == 10 ? "%u" : aRadix == 8 ? "%o" : "%x";
-          AppendPrintf( fmt, aInteger );
-        }
-      void AppendInt( int64_t aInteger )
-                 { AppendPrintf( "%lld", aInteger ); }
-      void AppendInt( int64_t aInteger, int aRadix )
-        {
-          const char *fmt = aRadix == 10 ? "%lld" : aRadix == 8 ? "%llo" : "%llx";
-          AppendPrintf( fmt, aInteger );
-        }
-      void AppendInt( uint64_t aInteger )
-                 { AppendPrintf( "%llu", aInteger ); }
-      void AppendInt( uint64_t aInteger, int aRadix )
-        {
-          const char *fmt = aRadix == 10 ? "%llu" : aRadix == 8 ? "%llo" : "%llx";
-          AppendPrintf( fmt, aInteger );
-        }
-
-      /**
-       * Append the given float to this string 
-       */
-      void NS_FASTCALL AppendFloat( float aFloat );
-      void NS_FASTCALL AppendFloat( double aFloat );
-  public:
-
-    // AppendLiteral must ONLY be applied to an actual literal string.
-    // Do not attempt to use it with a regular char* pointer, or with a char
-    // array variable. Use Append or AppendASCII for those.
-      template<int N>
-      void AppendLiteral( const char_type (&str)[N] )                                             { ReplaceLiteral(mLength, 0, str, N - 1); }
-#ifdef CharT_is_PRUnichar
-      template<int N>
-      void AppendLiteral( const char (&str)[N] )
-                  { AppendASCII(str, N-1); }
-#endif
-
-      self_type& operator+=( char_type c )                                                       { Append(c);        return *this; }
-      self_type& operator+=( const char_type* data )                                             { Append(data);     return *this; }
-#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      self_type& operator+=( char16ptr_t data )                                                  { Append(data);     return *this; }
-#endif
-      self_type& operator+=( const self_type& str )                                              { Append(str);      return *this; }
-      self_type& operator+=( const substring_tuple_type& tuple )                                 { Append(tuple);    return *this; }
-
-      void Insert( char_type c, index_type pos )                                                 { Replace(pos, 0, c); }
-      void Insert( const char_type* data, index_type pos, size_type length = size_type(-1) )     { Replace(pos, 0, data, length); }
-#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      void Insert( char16ptr_t data, index_type pos, size_type length = size_type(-1) )
-        { Insert(static_cast<const char16_t*>(data), pos, length); }
-#endif
-      void Insert( const self_type& str, index_type pos )                                        { Replace(pos, 0, str); }
-      void Insert( const substring_tuple_type& tuple, index_type pos )                           { Replace(pos, 0, tuple); }
-
-    // InsertLiteral must ONLY be applied to an actual literal string.
-    // Do not attempt to use it with a regular char* pointer, or with a char
-    // array variable. Use Insert for those.
-      template<int N>
-      void InsertLiteral( const char_type (&str)[N], index_type pos )                            { ReplaceLiteral(pos, 0, str, N - 1); }
+  size_type GetMutableData( wchar_t** data, size_type newLen = size_type(-1) )
+  {
+    return GetMutableData(reinterpret_cast<char16_t**>(data), newLen);
+  }
 
-      void Cut( index_type cutStart, size_type cutLength )                                       { Replace(cutStart, cutLength, char_traits::sEmptyBuffer, 0); }
-
-
-        /**
-         * buffer sizing
-         */
-
-        /**
-         * Attempts to set the capacity to the given size in number of 
-         * characters, without affecting the length of the string.
-         * There is no need to include room for the null terminator: it is
-         * the job of the string class.
-         * Also ensures that the buffer is mutable.
-         */
-      void NS_FASTCALL SetCapacity( size_type newCapacity );
-      bool NS_FASTCALL SetCapacity( size_type newCapacity, const fallible_t& ) NS_WARN_UNUSED_RESULT;
-
-      void NS_FASTCALL SetLength( size_type newLength );
-      bool NS_FASTCALL SetLength( size_type newLength, const fallible_t& ) NS_WARN_UNUSED_RESULT;
-
-      void Truncate( size_type newLength = 0 )
-        {
-          NS_ASSERTION(newLength <= mLength, "Truncate cannot make string longer");
-          SetLength(newLength);
-        }
-
-
-        /**
-         * buffer access
-         */
-
-
-        /**
-         * Get a const pointer to the string's internal buffer.  The caller
-         * MUST NOT modify the characters at the returned address.
-         *
-         * @returns The length of the buffer in characters.
-         */
-      inline size_type GetData( const char_type** data ) const
-        {
-          *data = mData;
-          return mLength;
-        }
-
-        /**
-         * Get a pointer to the string's internal buffer, optionally resizing
-         * the buffer first.  If size_type(-1) is passed for newLen, then the
-         * current length of the string is used.  The caller MAY modify the
-         * characters at the returned address (up to but not exceeding the
-         * length of the string).
-         *
-         * @returns The length of the buffer in characters or 0 if unable to
-         * satisfy the request due to low-memory conditions.
-         */
-      size_type GetMutableData( char_type** data, size_type newLen = size_type(-1) )
-        {
-          if (!EnsureMutable(newLen))
-            NS_ABORT_OOM(newLen == size_type(-1) ? mLength : newLen);
-
-          *data = mData;
-          return mLength;
-        }
-
-      size_type GetMutableData( char_type** data, size_type newLen, const fallible_t& )
-        {
-          if (!EnsureMutable(newLen))
-            {
-              *data = nullptr;
-              return 0;
-            }
-
-          *data = mData;
-          return mLength;
-        }
-
-#if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
-      size_type GetMutableData( wchar_t** data, size_type newLen = size_type(-1) )
-        {
-          return GetMutableData(reinterpret_cast<char16_t**>(data), newLen);
-        }
-
-      size_type GetMutableData( wchar_t** data, size_type newLen, const fallible_t& )
-        {
+  size_type GetMutableData( wchar_t** data, size_type newLen, const fallible_t& )
+  {
     return GetMutableData(reinterpret_cast<char16_t**>(data), newLen, fallible_t());
-        }
+  }
 #endif
 
 
-        /**
-         * string data is never null, but can be marked void.  if true, the
-         * string will be truncated.  @see nsTSubstring::IsVoid
-         */
+  /**
+   * string data is never null, but can be marked void.  if true, the
+   * string will be truncated.  @see nsTSubstring::IsVoid
+   */
 
-      void NS_FASTCALL SetIsVoid( bool );
+  void NS_FASTCALL SetIsVoid( bool );
 
-        /**
-         *  This method is used to remove all occurrences of aChar from this
-         * string.
-         *  
-         *  @param  aChar -- char to be stripped
-         *  @param  aOffset -- where in this string to start stripping chars
-         */
-         
-      void StripChar( char_type aChar, int32_t aOffset=0 );
+  /**
+   *  This method is used to remove all occurrences of aChar from this
+   * string.
+   *
+   *  @param  aChar -- char to be stripped
+   *  @param  aOffset -- where in this string to start stripping chars
+   */
+
+  void StripChar( char_type aChar, int32_t aOffset=0 );
 
-        /**
-         *  This method is used to remove all occurrences of aChars from this
-         * string.
-         *
-         *  @param  aChars -- chars to be stripped
-         *  @param  aOffset -- where in this string to start stripping chars
-         */
+  /**
+   *  This method is used to remove all occurrences of aChars from this
+   * string.
+   *
+   *  @param  aChars -- chars to be stripped
+   *  @param  aOffset -- where in this string to start stripping chars
+   */
 
-      void StripChars( const char_type* aChars, uint32_t aOffset=0 );
+  void StripChars( const char_type* aChars, uint32_t aOffset=0 );
 
-        /**
-         * If the string uses a shared buffer, this method
-         * clears the pointer without releasing the buffer.
-         */
-      void ForgetSharedBuffer()
-      {
-        if (mFlags & nsSubstring::F_SHARED)
-          {
-            mData = char_traits::sEmptyBuffer;
-            mLength = 0;
-            mFlags = F_TERMINATED;
-          }
-      }
+  /**
+   * If the string uses a shared buffer, this method
+   * clears the pointer without releasing the buffer.
+   */
+  void ForgetSharedBuffer()
+  {
+    if (mFlags & nsSubstring::F_SHARED)
+    {
+      mData = char_traits::sEmptyBuffer;
+      mLength = 0;
+      mFlags = F_TERMINATED;
+    }
+  }
 
-    public:
+public:
 
-        /**
-         * this is public to support automatic conversion of tuple to string
-         * base type, which helps avoid converting to nsTAString.
-         */
-      nsTSubstring_CharT(const substring_tuple_type& tuple)
-        : mData(nullptr),
-          mLength(0),
-          mFlags(F_NONE)
-        {
-          Assign(tuple);
-        }
+  /**
+   * this is public to support automatic conversion of tuple to string
+   * base type, which helps avoid converting to nsTAString.
+   */
+  nsTSubstring_CharT(const substring_tuple_type& tuple)
+    : mData(nullptr),
+      mLength(0),
+      mFlags(F_NONE)
+  {
+    Assign(tuple);
+  }
 
-        /**
-         * allows for direct initialization of a nsTSubstring object. 
-         *
-         * NOTE: this constructor is declared public _only_ for convenience
-         * inside the string implementation.
-         */
-        // XXXbz or can I just include nscore.h and use NS_BUILD_REFCNT_LOGGING?
+  /**
+   * allows for direct initialization of a nsTSubstring object.
+   *
+   * NOTE: this constructor is declared public _only_ for convenience
+   * inside the string implementation.
+   */
+  // XXXbz or can I just include nscore.h and use NS_BUILD_REFCNT_LOGGING?
 #if defined(DEBUG) || defined(FORCE_BUILD_REFCNT_LOGGING)
 #define XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE
-      nsTSubstring_CharT( char_type *data, size_type length, uint32_t flags );
+  nsTSubstring_CharT( char_type *data, size_type length, uint32_t flags );
 #else
 #undef XPCOM_STRING_CONSTRUCTOR_OUT_OF_LINE
-      nsTSubstring_CharT( char_type *data, size_type length, uint32_t flags )
-        : mData(data),
-          mLength(length),
-          mFlags(flags) {}
+  nsTSubstring_CharT( char_type *data, size_type length, uint32_t flags )
+    : mData(data),
+      mLength(length),
+      mFlags(flags) {}
 #endif /* DEBUG || FORCE_BUILD_REFCNT_LOGGING */
 
-      size_t SizeOfExcludingThisMustBeUnshared(mozilla::MallocSizeOf mallocSizeOf)
-        const;
-      size_t SizeOfIncludingThisMustBeUnshared(mozilla::MallocSizeOf mallocSizeOf)
-        const;
+  size_t SizeOfExcludingThisMustBeUnshared(mozilla::MallocSizeOf mallocSizeOf)
+  const;
+  size_t SizeOfIncludingThisMustBeUnshared(mozilla::MallocSizeOf mallocSizeOf)
+  const;
 
-      size_t SizeOfExcludingThisIfUnshared(mozilla::MallocSizeOf mallocSizeOf)
-        const;
-      size_t SizeOfIncludingThisIfUnshared(mozilla::MallocSizeOf mallocSizeOf)
-        const;
+  size_t SizeOfExcludingThisIfUnshared(mozilla::MallocSizeOf mallocSizeOf)
+  const;
+  size_t SizeOfIncludingThisIfUnshared(mozilla::MallocSizeOf mallocSizeOf)
+  const;
 
-        /**
-         * WARNING: Only use these functions if you really know what you are
-         * doing, because they can easily lead to double-counting strings.  If
-         * you do use them, please explain clearly in a comment why it's safe
-         * and won't lead to double-counting.
-         */
-      size_t SizeOfExcludingThisEvenIfShared(mozilla::MallocSizeOf mallocSizeOf)
-        const;
-      size_t SizeOfIncludingThisEvenIfShared(mozilla::MallocSizeOf mallocSizeOf)
-        const;
+  /**
+   * WARNING: Only use these functions if you really know what you are
+   * doing, because they can easily lead to double-counting strings.  If
+   * you do use them, please explain clearly in a comment why it's safe
+   * and won't lead to double-counting.
+   */
+  size_t SizeOfExcludingThisEvenIfShared(mozilla::MallocSizeOf mallocSizeOf)
+  const;
+  size_t SizeOfIncludingThisEvenIfShared(mozilla::MallocSizeOf mallocSizeOf)
+  const;
 
-    protected:
+protected:
 
-      friend class nsTObsoleteAStringThunk_CharT;
-      friend class nsTSubstringTuple_CharT;
+  friend class nsTObsoleteAStringThunk_CharT;
+  friend class nsTSubstringTuple_CharT;
 
-      // XXX GCC 3.4 needs this :-(
-      friend class nsTPromiseFlatString_CharT;
+  // XXX GCC 3.4 needs this :-(
+  friend class nsTPromiseFlatString_CharT;
 
-      char_type*  mData;
-      size_type   mLength;
-      uint32_t    mFlags;
+  char_type*  mData;
+  size_type   mLength;
+  uint32_t    mFlags;
 
-        // default initialization 
-      nsTSubstring_CharT()
-        : mData(char_traits::sEmptyBuffer),
-          mLength(0),
-          mFlags(F_TERMINATED) {}
+  // default initialization
+  nsTSubstring_CharT()
+    : mData(char_traits::sEmptyBuffer),
+      mLength(0),
+      mFlags(F_TERMINATED) {}
 
-        // version of constructor that leaves mData and mLength uninitialized
-      explicit
-      nsTSubstring_CharT( uint32_t flags )
-        : mFlags(flags) {}
+  // version of constructor that leaves mData and mLength uninitialized
+  explicit
+  nsTSubstring_CharT( uint32_t flags )
+    : mFlags(flags) {}
 
-        // copy-constructor, constructs as dependent on given object
-        // (NOTE: this is for internal use only)
-      nsTSubstring_CharT( const self_type& str )
-        : mData(str.mData),
-          mLength(str.mLength),
-          mFlags(str.mFlags & (F_TERMINATED | F_VOIDED)) {}
+  // copy-constructor, constructs as dependent on given object
+  // (NOTE: this is for internal use only)
+  nsTSubstring_CharT( const self_type& str )
+    : mData(str.mData),
+      mLength(str.mLength),
+      mFlags(str.mFlags & (F_TERMINATED | F_VOIDED)) {}
 
-        /**
-         * this function releases mData and does not change the value of
-         * any of its member variables.  in other words, this function acts
-         * like a destructor.
-         */
-      void NS_FASTCALL Finalize();
+  /**
+   * this function releases mData and does not change the value of
+   * any of its member variables.  in other words, this function acts
+   * like a destructor.
+   */
+  void NS_FASTCALL Finalize();
 
-        /**
-         * this function prepares mData to be mutated.
-         *
-         * @param capacity     specifies the required capacity of mData  
-         * @param old_data     returns null or the old value of mData
-         * @param old_flags    returns 0 or the old value of mFlags
-         *
-         * if mData is already mutable and of sufficient capacity, then this
-         * function will return immediately.  otherwise, it will either resize
-         * mData or allocate a new shared buffer.  if it needs to allocate a
-         * new buffer, then it will return the old buffer and the corresponding
-         * flags.  this allows the caller to decide when to free the old data.
-         *
-         * this function returns false if is unable to allocate sufficient
-         * memory.
-         *
-         * XXX we should expose a way for subclasses to free old_data.
-         */
-      bool NS_FASTCALL MutatePrep( size_type capacity, char_type** old_data, uint32_t* old_flags );
+  /**
+   * this function prepares mData to be mutated.
+   *
+   * @param capacity     specifies the required capacity of mData
+   * @param old_data     returns null or the old value of mData
+   * @param old_flags    returns 0 or the old value of mFlags
+   *
+   * if mData is already mutable and of sufficient capacity, then this
+   * function will return immediately.  otherwise, it will either resize
+   * mData or allocate a new shared buffer.  if it needs to allocate a
+   * new buffer, then it will return the old buffer and the corresponding
+   * flags.  this allows the caller to decide when to free the old data.
+   *
+   * this function returns false if is unable to allocate sufficient
+   * memory.
+   *
+   * XXX we should expose a way for subclasses to free old_data.
+   */
+  bool NS_FASTCALL MutatePrep( size_type capacity, char_type** old_data, uint32_t* old_flags );
 
-        /**
-         * this function prepares a section of mData to be modified.  if
-         * necessary, this function will reallocate mData and possibly move
-         * existing data to open up the specified section.
-         *
-         * @param cutStart     specifies the starting offset of the section
-         * @param cutLength    specifies the length of the section to be replaced
-         * @param newLength    specifies the length of the new section
-         *
-         * for example, suppose mData contains the string "abcdef" then
-         * 
-         *   ReplacePrep(2, 3, 4);
-         *
-         * would cause mData to look like "ab____f" where the characters
-         * indicated by '_' have an unspecified value and can be freely
-         * modified.  this function will null-terminate mData upon return.
-         * 
-         * this function returns false if is unable to allocate sufficient
-         * memory.
-         */
-      bool ReplacePrep(index_type cutStart, size_type cutLength,
-                       size_type newLength) NS_WARN_UNUSED_RESULT
-      {
-        cutLength = XPCOM_MIN(cutLength, mLength - cutStart);
-        uint32_t newTotalLen = mLength - cutLength + newLength;
-        if (cutStart == mLength && Capacity() > newTotalLen) {
-          mFlags &= ~F_VOIDED;
-          mData[newTotalLen] = char_type(0);
-          mLength = newTotalLen;
-          return true;
-        }
-        return ReplacePrepInternal(cutStart, cutLength, newLength, newTotalLen);
-      }
+  /**
+   * this function prepares a section of mData to be modified.  if
+   * necessary, this function will reallocate mData and possibly move
+   * existing data to open up the specified section.
+   *
+   * @param cutStart     specifies the starting offset of the section
+   * @param cutLength    specifies the length of the section to be replaced
+   * @param newLength    specifies the length of the new section
+   *
+   * for example, suppose mData contains the string "abcdef" then
+   *
+   *   ReplacePrep(2, 3, 4);
+   *
+   * would cause mData to look like "ab____f" where the characters
+   * indicated by '_' have an unspecified value and can be freely
+   * modified.  this function will null-terminate mData upon return.
+   *
+   * this function returns false if is unable to allocate sufficient
+   * memory.
+   */
+  bool ReplacePrep(index_type cutStart, size_type cutLength,
+                   size_type newLength) NS_WARN_UNUSED_RESULT
+  {
+    cutLength = XPCOM_MIN(cutLength, mLength - cutStart);
+    uint32_t newTotalLen = mLength - cutLength + newLength;
+    if (cutStart == mLength && Capacity() > newTotalLen) {
+      mFlags &= ~F_VOIDED;
+      mData[newTotalLen] = char_type(0);
+      mLength = newTotalLen;
+      return true;
+    }
+    return ReplacePrepInternal(cutStart, cutLength, newLength, newTotalLen);
+  }
 
-      bool NS_FASTCALL ReplacePrepInternal(index_type cutStart,
-                                           size_type cutLength,
-                                           size_type newFragLength,
-                                           size_type newTotalLength)
-        NS_WARN_UNUSED_RESULT;
+  bool NS_FASTCALL ReplacePrepInternal(index_type cutStart,
+                                       size_type cutLength,
+                                       size_type newFragLength,
+                                       size_type newTotalLength)
+  NS_WARN_UNUSED_RESULT;
 
-        /**
-         * returns the number of writable storage units starting at mData.
-         * the value does not include space for the null-terminator character.
-         *
-         * NOTE: this function returns 0 if mData is immutable (or the buffer
-         *       is 0-sized).
-         */
-      size_type NS_FASTCALL Capacity() const;
+  /**
+   * returns the number of writable storage units starting at mData.
+   * the value does not include space for the null-terminator character.
+   *
+   * NOTE: this function returns 0 if mData is immutable (or the buffer
+   *       is 0-sized).
+   */
+  size_type NS_FASTCALL Capacity() const;
 
-        /**
-         * this helper function can be called prior to directly manipulating
-         * the contents of mData.  see, for example, BeginWriting.
-         */
-      bool NS_FASTCALL EnsureMutable( size_type newLen = size_type(-1) ) NS_WARN_UNUSED_RESULT;
+  /**
+   * this helper function can be called prior to directly manipulating
+   * the contents of mData.  see, for example, BeginWriting.
+   */
+  bool NS_FASTCALL EnsureMutable( size_type newLen = size_type(-1) ) NS_WARN_UNUSED_RESULT;
 
-        /**
-         * returns true if this string overlaps with the given string fragment.
-         */
-      bool IsDependentOn( const char_type *start, const char_type *end ) const
-        {
-          /**
-           * if it _isn't_ the case that one fragment starts after the other ends,
-           * or ends before the other starts, then, they conflict:
-           * 
-           *   !(f2.begin >= f1.end || f2.end <= f1.begin)
-           * 
-           * Simplified, that gives us:
-           */
-          return ( start < (mData + mLength) && end > mData );
-        }
+  /**
+   * returns true if this string overlaps with the given string fragment.
+   */
+  bool IsDependentOn( const char_type *start, const char_type *end ) const
+  {
+    /**
+     * if it _isn't_ the case that one fragment starts after the other ends,
+     * or ends before the other starts, then, they conflict:
+     *
+     *   !(f2.begin >= f1.end || f2.end <= f1.begin)
+     *
+     * Simplified, that gives us:
+     */
+    return ( start < (mData + mLength) && end > mData );
+  }
 
-        /**
-         * this helper function stores the specified dataFlags in mFlags
-         */
-      void SetDataFlags(uint32_t dataFlags)
-        {
-          NS_ASSERTION((dataFlags & 0xFFFF0000) == 0, "bad flags");
-          mFlags = dataFlags | (mFlags & 0xFFFF0000);
-        }
+  /**
+   * this helper function stores the specified dataFlags in mFlags
+   */
+  void SetDataFlags(uint32_t dataFlags)
+  {
+    NS_ASSERTION((dataFlags & 0xFFFF0000) == 0, "bad flags");
+    mFlags = dataFlags | (mFlags & 0xFFFF0000);
+  }
 
-      void NS_FASTCALL ReplaceLiteral( index_type cutStart, size_type cutLength, const char_type* data, size_type length );
+  void NS_FASTCALL ReplaceLiteral( index_type cutStart, size_type cutLength, const char_type* data, size_type length );
 
-      static int AppendFunc( void* arg, const char* s, uint32_t len);
+  static int AppendFunc( void* arg, const char* s, uint32_t len);
 
-    public:
+public:
 
-      // NOTE: this method is declared public _only_ for convenience for
-      // callers who don't have access to the original nsLiteralString_CharT.
-      void NS_FASTCALL AssignLiteral( const char_type* data, size_type length );
+  // NOTE: this method is declared public _only_ for convenience for
+  // callers who don't have access to the original nsLiteralString_CharT.
+  void NS_FASTCALL AssignLiteral( const char_type* data, size_type length );
 
-      // mFlags is a bitwise combination of the following flags.  the meaning
-      // and interpretation of these flags is an implementation detail.
-      // 
-      // NOTE: these flags are declared public _only_ for convenience inside
-      // the string implementation.
-      
-      enum
-        {
-          F_NONE         = 0,       // no flags
+  // mFlags is a bitwise combination of the following flags.  the meaning
+  // and interpretation of these flags is an implementation detail.
+  //
+  // NOTE: these flags are declared public _only_ for convenience inside
+  // the string implementation.
+
+  enum
+  {
+    F_NONE         = 0,       // no flags
 
-          // data flags are in the lower 16-bits
-          F_TERMINATED   = 1 << 0,  // IsTerminated returns true
-          F_VOIDED       = 1 << 1,  // IsVoid returns true
-          F_SHARED       = 1 << 2,  // mData points to a heap-allocated, shared buffer
-          F_OWNED        = 1 << 3,  // mData points to a heap-allocated, raw buffer
-          F_FIXED        = 1 << 4,  // mData points to a fixed-size writable, dependent buffer
-          F_LITERAL      = 1 << 5,  // mData points to a string literal; F_TERMINATED will also be set
+    // data flags are in the lower 16-bits
+    F_TERMINATED   = 1 << 0,  // IsTerminated returns true
+    F_VOIDED       = 1 << 1,  // IsVoid returns true
+    F_SHARED       = 1 << 2,  // mData points to a heap-allocated, shared buffer
+    F_OWNED        = 1 << 3,  // mData points to a heap-allocated, raw buffer
+    F_FIXED        = 1 << 4,  // mData points to a fixed-size writable, dependent buffer
+    F_LITERAL      = 1 << 5,  // mData points to a string literal; F_TERMINATED will also be set
 
-          // class flags are in the upper 16-bits
-          F_CLASS_FIXED  = 1 << 16   // indicates that |this| is of type nsTFixedString
-        };
+    // class flags are in the upper 16-bits
+    F_CLASS_FIXED  = 1 << 16   // indicates that |this| is of type nsTFixedString
+  };
 
-      //
-      // Some terminology:
-      //
-      //   "dependent buffer"    A dependent buffer is one that the string class
-      //                         does not own.  The string class relies on some
-      //                         external code to ensure the lifetime of the
-      //                         dependent buffer.
-      //
-      //   "shared buffer"       A shared buffer is one that the string class
-      //                         allocates.  When it allocates a shared string
-      //                         buffer, it allocates some additional space at
-      //                         the beginning of the buffer for additional 
-      //                         fields, including a reference count and a 
-      //                         buffer length.  See nsStringHeader.
-      //                         
-      //   "adopted buffer"      An adopted buffer is a raw string buffer
-      //                         allocated on the heap (using nsMemory::Alloc)
-      //                         of which the string class subsumes ownership.
-      //
-      // Some comments about the string flags:
-      //
-      //   F_SHARED, F_OWNED, and F_FIXED are all mutually exlusive.  They
-      //   indicate the allocation type of mData.  If none of these flags
-      //   are set, then the string buffer is dependent.
-      //
-      //   F_SHARED, F_OWNED, or F_FIXED imply F_TERMINATED.  This is because
-      //   the string classes always allocate null-terminated buffers, and
-      //   non-terminated substrings are always dependent.
-      //
-      //   F_VOIDED implies F_TERMINATED, and moreover it implies that mData
-      //   points to char_traits::sEmptyBuffer.  Therefore, F_VOIDED is
-      //   mutually exclusive with F_SHARED, F_OWNED, and F_FIXED.
-      //
-  };
+  //
+  // Some terminology:
+  //
+  //   "dependent buffer"    A dependent buffer is one that the string class
+  //                         does not own.  The string class relies on some
+  //                         external code to ensure the lifetime of the
+  //                         dependent buffer.
+  //
+  //   "shared buffer"       A shared buffer is one that the string class
+  //                         allocates.  When it allocates a shared string
+  //                         buffer, it allocates some additional space at
+  //                         the beginning of the buffer for additional
+  //                         fields, including a reference count and a
+  //                         buffer length.  See nsStringHeader.
+  //
+  //   "adopted buffer"      An adopted buffer is a raw string buffer
+  //                         allocated on the heap (using nsMemory::Alloc)
+  //                         of which the string class subsumes ownership.
+  //
+  // Some comments about the string flags:
+  //
+  //   F_SHARED, F_OWNED, and F_FIXED are all mutually exlusive.  They
+  //   indicate the allocation type of mData.  If none of these flags
+  //   are set, then the string buffer is dependent.
+  //
+  //   F_SHARED, F_OWNED, or F_FIXED imply F_TERMINATED.  This is because
+  //   the string classes always allocate null-terminated buffers, and
+  //   non-terminated substrings are always dependent.
+  //
+  //   F_VOIDED implies F_TERMINATED, and moreover it implies that mData
+  //   points to char_traits::sEmptyBuffer.  Therefore, F_VOIDED is
+  //   mutually exclusive with F_SHARED, F_OWNED, and F_FIXED.
+  //
+};
 
 int NS_FASTCALL Compare( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs, const nsTStringComparator_CharT& = nsTDefaultStringComparator_CharT() );
 
 
 inline
 bool operator!=( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs )
-  {
-    return !lhs.Equals(rhs);
-  }
+{
+  return !lhs.Equals(rhs);
+}
 
 inline
 bool operator< ( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs )
-  {
-    return Compare(lhs, rhs)< 0;
-  }
+{
+  return Compare(lhs, rhs)< 0;
+}
 
 inline
 bool operator<=( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs )
-  {
-    return Compare(lhs, rhs)<=0;
-  }
+{
+  return Compare(lhs, rhs)<=0;
+}
 
 inline
 bool operator==( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs )
-  {
-    return lhs.Equals(rhs);
-  }
+{
+  return lhs.Equals(rhs);
+}
 
 inline
 bool operator==( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::char_type* rhs )
-  {
-    return lhs.Equals(rhs);
-  }
+{
+  return lhs.Equals(rhs);
+}
 
 
 inline
 bool operator>=( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs )
-  {
-    return Compare(lhs, rhs)>=0;
-  }
+{
+  return Compare(lhs, rhs)>=0;
+}
 
 inline
 bool operator> ( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs )
-  {
-    return Compare(lhs, rhs)> 0;
-  }
+{
+  return Compare(lhs, rhs)> 0;
+}
--- a/xpcom/string/public/nsTSubstringTuple.h
+++ b/xpcom/string/public/nsTSubstringTuple.h
@@ -1,78 +1,78 @@
-//* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 // IWYU pragma: private, include "nsString.h"
 
-  /**
-   * nsTSubstringTuple_CharT
-   *
-   * Represents a tuple of string fragments.  Built as a recursive binary tree.
-   * It is used to implement the concatenation of two or more string objects.
-   *
-   * NOTE: This class is a private implementation detail and should never be 
-   * referenced outside the string code.
-   */
+/**
+ * nsTSubstringTuple_CharT
+ *
+ * Represents a tuple of string fragments.  Built as a recursive binary tree.
+ * It is used to implement the concatenation of two or more string objects.
+ *
+ * NOTE: This class is a private implementation detail and should never be
+ * referenced outside the string code.
+ */
 class nsTSubstringTuple_CharT
-  {
-    public:
+{
+public:
 
-      typedef CharT                      char_type;
-      typedef nsCharTraits<char_type>    char_traits;
+  typedef CharT                      char_type;
+  typedef nsCharTraits<char_type>    char_traits;
 
-      typedef nsTSubstringTuple_CharT    self_type;
-      typedef nsTSubstring_CharT         substring_type;
-      typedef nsTSubstring_CharT         base_string_type;
-      typedef uint32_t                   size_type;
+  typedef nsTSubstringTuple_CharT    self_type;
+  typedef nsTSubstring_CharT         substring_type;
+  typedef nsTSubstring_CharT         base_string_type;
+  typedef uint32_t                   size_type;
 
-    public:
+public:
 
-      nsTSubstringTuple_CharT(const base_string_type* a, const base_string_type* b)
-        : mHead(nullptr)
-        , mFragA(a)
-        , mFragB(b) {}
+  nsTSubstringTuple_CharT(const base_string_type* a, const base_string_type* b)
+    : mHead(nullptr)
+    , mFragA(a)
+    , mFragB(b) {}
 
-      nsTSubstringTuple_CharT(const self_type& head, const base_string_type* b)
-        : mHead(&head)
-        , mFragA(nullptr) // this fragment is ignored when head != nullptr
-        , mFragB(b) {}
+  nsTSubstringTuple_CharT(const self_type& head, const base_string_type* b)
+    : mHead(&head)
+    , mFragA(nullptr) // this fragment is ignored when head != nullptr
+    , mFragB(b) {}
 
-        /**
-         * computes the aggregate string length
-         */
-      size_type Length() const;
+  /**
+   * computes the aggregate string length
+   */
+  size_type Length() const;
 
-        /**
-         * writes the aggregate string to the given buffer.  bufLen is assumed
-         * to be equal to or greater than the value returned by the Length()
-         * method.  the string written to |buf| is not null-terminated.
-         */
-      void WriteTo(char_type *buf, uint32_t bufLen) const;
+  /**
+   * writes the aggregate string to the given buffer.  bufLen is assumed
+   * to be equal to or greater than the value returned by the Length()
+   * method.  the string written to |buf| is not null-terminated.
+   */
+  void WriteTo(char_type *buf, uint32_t bufLen) const;
 
-        /**
-         * returns true if this tuple is dependent on (i.e., overlapping with)
-         * the given char sequence.
-         */
-      bool IsDependentOn(const char_type *start, const char_type *end) const;
+  /**
+   * returns true if this tuple is dependent on (i.e., overlapping with)
+   * the given char sequence.
+   */
+  bool IsDependentOn(const char_type *start, const char_type *end) const;
 
-    private:
+private:
 
-      const self_type*        mHead;
-      const base_string_type* mFragA;
-      const base_string_type* mFragB;
-  };
+  const self_type*        mHead;
+  const base_string_type* mFragA;
+  const base_string_type* mFragB;
+};
 
 inline
 const nsTSubstringTuple_CharT
 operator+(const nsTSubstringTuple_CharT::base_string_type& a, const nsTSubstringTuple_CharT::base_string_type& b)
-  {
-    return nsTSubstringTuple_CharT(&a, &b);
-  }
+{
+  return nsTSubstringTuple_CharT(&a, &b);
+}
 
 inline
 const nsTSubstringTuple_CharT
 operator+(const nsTSubstringTuple_CharT& head, const nsTSubstringTuple_CharT::base_string_type& b)
-  {
-    return nsTSubstringTuple_CharT(head, &b);
-  }
+{
+  return nsTSubstringTuple_CharT(head, &b);
+}
--- a/xpcom/string/public/nsUTF8Utils.h
+++ b/xpcom/string/public/nsUTF8Utils.h
@@ -1,35 +1,36 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 #ifndef nsUTF8Utils_h_
 #define nsUTF8Utils_h_
 
 // This file may be used in two ways: if MOZILLA_INTERNAL_API is defined, this
 // file will provide signatures for the Mozilla abstract string types. It will
 // use XPCOM assertion/debugging macros, etc.
 
 #include "nscore.h"
 #include "mozilla/SSE.h"
 
 #include "nsCharTraits.h"
 
 class UTF8traits
-  {
-    public:
-      static bool isASCII(char c) { return (c & 0x80) == 0x00; }
-      static bool isInSeq(char c) { return (c & 0xC0) == 0x80; }
-      static bool is2byte(char c) { return (c & 0xE0) == 0xC0; }
-      static bool is3byte(char c) { return (c & 0xF0) == 0xE0; }
-      static bool is4byte(char c) { return (c & 0xF8) == 0xF0; }
-      static bool is5byte(char c) { return (c & 0xFC) == 0xF8; }
-      static bool is6byte(char c) { return (c & 0xFE) == 0xFC; }
-  };
+{
+public:
+  static bool isASCII(char c) { return (c & 0x80) == 0x00; }
+  static bool isInSeq(char c) { return (c & 0xC0) == 0x80; }
+  static bool is2byte(char c) { return (c & 0xE0) == 0xC0; }
+  static bool is3byte(char c) { return (c & 0xF0) == 0xE0; }
+  static bool is4byte(char c) { return (c & 0xF8) == 0xF0; }
+  static bool is5byte(char c) { return (c & 0xFC) == 0xF8; }
+  static bool is6byte(char c) { return (c & 0xFE) == 0xFC; }
+};
 
 /**
  * Extract the next UCS-4 character from the buffer and return it.  The
  * pointer passed in is advanced to the start of the next character in the
  * buffer.  If non-null, the parameters err and overlong are filled in to
  * indicate that the character was represented by an overlong sequence, or
  * that an error occurred.
  */
@@ -41,126 +42,126 @@ public:
                            bool *err)
   {
     NS_ASSERTION(buffer && *buffer, "null buffer!");
 
     const char *p = *buffer;
     *err = false;
 
     if (p >= end)
-      {
-        *err = true;
+    {
+      *err = true;
 
-        return 0;
-      }
+      return 0;
+    }
 
     char c = *p++;
 
     if ( UTF8traits::isASCII(c) )
-      {
-        *buffer = p;
-        return c;
-      }
+    {
+      *buffer = p;
+      return c;
+    }
 
     uint32_t ucs4;
     uint32_t minUcs4;
     int32_t state = 0;
 
     if (!CalcState(c, ucs4, minUcs4, state)) {
-        NS_ERROR("Not a UTF-8 string. This code should only be used for converting from known UTF-8 strings.");
-        *err = true;
+      NS_ERROR("Not a UTF-8 string. This code should only be used for converting from known UTF-8 strings.");
+      *err = true;
 
-        return 0;
+      return 0;
     }
 
     while ( state-- )
+    {
+      if (p == end)
       {
-        if (p == end)
-          {
-            *err = true;
-
-            return 0;
-          }
+        *err = true;
 
-        c = *p++;
-
-        if (!AddByte(c, state, ucs4))
-          {
-            *err = true;
-
-            return 0;
-          }
+        return 0;
       }
 
-      if ( ucs4 < minUcs4 )
-        {
-          // Overlong sequence
-          ucs4 = UCS2_REPLACEMENT_CHAR;
-        }
-      else if ( ucs4 >= 0xD800 &&
-                (ucs4 <= 0xDFFF || ucs4 >= UCS_END))
-        {
-          // Surrogates and code points outside the Unicode range.
-          ucs4 = UCS2_REPLACEMENT_CHAR;
-        }
+      c = *p++;
+
+      if (!AddByte(c, state, ucs4))
+      {
+        *err = true;
+
+        return 0;
+      }
+    }
+
+    if ( ucs4 < minUcs4 )
+    {
+      // Overlong sequence
+      ucs4 = UCS2_REPLACEMENT_CHAR;
+    }
+    else if ( ucs4 >= 0xD800 &&
+              (ucs4 <= 0xDFFF || ucs4 >= UCS_END))
+    {
+      // Surrogates and code points outside the Unicode range.
+      ucs4 = UCS2_REPLACEMENT_CHAR;
+    }
 
     *buffer = p;
     return ucs4;
   }
 
 private:
   static bool CalcState(char c, uint32_t& ucs4, uint32_t& minUcs4,
-                          int32_t& state)
+                        int32_t& state)
   {
     if ( UTF8traits::is2byte(c) )
-      {
-        ucs4 = (uint32_t(c) << 6) & 0x000007C0L;
-        state = 1;
-        minUcs4 = 0x00000080;
-      }
+    {
+      ucs4 = (uint32_t(c) << 6) & 0x000007C0L;
+      state = 1;
+      minUcs4 = 0x00000080;
+    }
     else if ( UTF8traits::is3byte(c) )
-      {
-        ucs4 = (uint32_t(c) << 12) & 0x0000F000L;
-        state = 2;
-        minUcs4 = 0x00000800;
-      }
+    {
+      ucs4 = (uint32_t(c) << 12) & 0x0000F000L;
+      state = 2;
+      minUcs4 = 0x00000800;
+    }
     else if ( UTF8traits::is4byte(c) )
-      {
-        ucs4 = (uint32_t(c) << 18) & 0x001F0000L;
-        state = 3;
-        minUcs4 = 0x00010000;
-      }
+    {
+      ucs4 = (uint32_t(c) << 18) & 0x001F0000L;
+      state = 3;
+      minUcs4 = 0x00010000;
+    }
     else if ( UTF8traits::is5byte(c) )
-      {
-        ucs4 = (uint32_t(c) << 24) & 0x03000000L;
-        state = 4;
-        minUcs4 = 0x00200000;
-      }
+    {
+      ucs4 = (uint32_t(c) << 24) & 0x03000000L;
+      state = 4;
+      minUcs4 = 0x00200000;
+    }
     else if ( UTF8traits::is6byte(c) )
-      {
-        ucs4 = (uint32_t(c) << 30) & 0x40000000L;
-        state = 5;
-        minUcs4 = 0x04000000;
-      }
+    {
+      ucs4 = (uint32_t(c) << 30) & 0x40000000L;
+      state = 5;
+      minUcs4 = 0x04000000;
+    }
     else
-      {
-        return false;
-      }
+    {
+      return false;
+    }
 
     return true;
   }
 
   static bool AddByte(char c, int32_t state, uint32_t& ucs4)
   {
     if ( UTF8traits::isInSeq(c) )
-      {
-        int32_t shift = state * 6;
-        ucs4 |= (uint32_t(c) & 0x3F) << shift;
-        return true;
-      }
+    {
+      int32_t shift = state * 6;
+      ucs4 |= (uint32_t(c) & 0x3F) << shift;
+      return true;
+    }
 
     return false;
   }
 };
 
 
 /**
  * Extract the next UCS-4 character from the buffer and return it.  The
@@ -175,547 +176,547 @@ public:
   static uint32_t NextChar(const char16_t **buffer, const char16_t *end,
                            bool *err = nullptr)
   {
     NS_ASSERTION(buffer && *buffer, "null buffer!");
 
     const char16_t *p = *buffer;
 
     if (p >= end)
-      {
-        NS_ERROR("No input to work with");
-        if (err)
-          *err = true;
+    {
+      NS_ERROR("No input to work with");
+      if (err)
+        *err = true;
 
-        return 0;
-      }
+      return 0;
+    }
 
     char16_t c = *p++;
 
     if (!IS_SURROGATE(c)) // U+0000 - U+D7FF,U+E000 - U+FFFF
-      {
-        if (err)
-          *err = false;
-        *buffer = p;
-        return c;
-      }
+    {
+      if (err)
+        *err = false;
+      *buffer = p;
+      return c;
+    }
     else if (NS_IS_HIGH_SURROGATE(c)) // U+D800 - U+DBFF
+    {
+      if (p == end)
       {
-        if (p == end)
-          {
-            // Found a high surrogate the end of the buffer. Flag this
-            // as an error and return the Unicode replacement
-            // character 0xFFFD.
-
-            NS_WARNING("Unexpected end of buffer after high surrogate");
-
-            if (err)
-              *err = true;
-            *buffer = p;
-            return 0xFFFD;
-          }
-
-        // D800- DBFF - High Surrogate
-        char16_t h = c;
-
-        c = *p++;
-
-        if (NS_IS_LOW_SURROGATE(c))
-          {
-            // DC00- DFFF - Low Surrogate
-            // N = (H - D800) *400 + 10000 + (L - DC00)
-            uint32_t ucs4 = SURROGATE_TO_UCS4(h, c);
-            if (err)
-              *err = false;
-            *buffer = p;
-            return ucs4;
-          }
-        else
-          {
-            // Found a high surrogate followed by something other than
-            // a low surrogate. Flag this as an error and return the
-            // Unicode replacement character 0xFFFD.  Note that the
-            // pointer to the next character points to the second 16-bit
-            // value, not beyond it, as per Unicode 5.0.0 Chapter 3 C10,
-            // only the first code unit of an illegal sequence must be
-            // treated as an illegally terminated code unit sequence
-            // (also Chapter 3 D91, "isolated [not paired and ill-formed]
-            // UTF-16 code units in the range D800..DFFF are ill-formed").
-            NS_WARNING("got a High Surrogate but no low surrogate");
-
-            if (err)
-              *err = true;
-            *buffer = p - 1;
-            return 0xFFFD;
-          }
-      }
-    else // U+DC00 - U+DFFF
-      {
-        // DC00- DFFF - Low Surrogate
-
-        // Found a low surrogate w/o a preceding high surrogate. Flag
-        // this as an error and return the Unicode replacement
+        // Found a high surrogate the end of the buffer. Flag this
+        // as an error and return the Unicode replacement
         // character 0xFFFD.
 
-        NS_WARNING("got a low Surrogate but no high surrogate");
+        NS_WARNING("Unexpected end of buffer after high surrogate");
+
         if (err)
           *err = true;
         *buffer = p;
         return 0xFFFD;
       }
 
+      // D800- DBFF - High Surrogate
+      char16_t h = c;
+
+      c = *p++;
+
+      if (NS_IS_LOW_SURROGATE(c))
+      {
+        // DC00- DFFF - Low Surrogate
+        // N = (H - D800) *400 + 10000 + (L - DC00)
+        uint32_t ucs4 = SURROGATE_TO_UCS4(h, c);
+        if (err)
+          *err = false;
+        *buffer = p;
+        return ucs4;
+      }
+      else
+      {
+        // Found a high surrogate followed by something other than
+        // a low surrogate. Flag this as an error and return the
+        // Unicode replacement character 0xFFFD.  Note that the
+        // pointer to the next character points to the second 16-bit
+        // value, not beyond it, as per Unicode 5.0.0 Chapter 3 C10,
+        // only the first code unit of an illegal sequence must be
+        // treated as an illegally terminated code unit sequence
+        // (also Chapter 3 D91, "isolated [not paired and ill-formed]
+        // UTF-16 code units in the range D800..DFFF are ill-formed").
+        NS_WARNING("got a High Surrogate but no low surrogate");
+
+        if (err)
+          *err = true;
+        *buffer = p - 1;
+        return 0xFFFD;
+      }
+    }
+    else // U+DC00 - U+DFFF
+    {
+      // DC00- DFFF - Low Surrogate
+
+      // Found a low surrogate w/o a preceding high surrogate. Flag
+      // this as an error and return the Unicode replacement
+      // character 0xFFFD.
+
+      NS_WARNING("got a low Surrogate but no high surrogate");
+      if (err)
+        *err = true;
+      *buffer = p;
+      return 0xFFFD;
+    }
+
     if (err)
       *err = true;
     return 0;
   }
 };
 
 
 /**
  * A character sink (see |copy_string| in nsAlgorithm.h) for converting
  * UTF-8 to UTF-16
  */
 class ConvertUTF8toUTF16
-  {
-    public:
-      typedef char      value_type;
-      typedef char16_t buffer_type;
-
-    ConvertUTF8toUTF16( buffer_type* aBuffer )
-        : mStart(aBuffer), mBuffer(aBuffer), mErrorEncountered(false) {}
+{
+public:
+  typedef char value_type;
+  typedef char16_t buffer_type;
 
-    size_t Length() const { return mBuffer - mStart; }
-
-    bool ErrorEncountered() const { return mErrorEncountered; }
+  ConvertUTF8toUTF16( buffer_type* aBuffer )
+    : mStart(aBuffer), mBuffer(aBuffer), mErrorEncountered(false) {}
 
-    void write( const value_type* start, uint32_t N )
-      {
-        if ( mErrorEncountered )
-          return;
+  size_t Length() const { return mBuffer - mStart; }
+
+  bool ErrorEncountered() const { return mErrorEncountered; }
 
-        // algorithm assumes utf8 units won't
-        // be spread across fragments
-        const value_type* p = start;
-        const value_type* end = start + N;
-        buffer_type* out = mBuffer;
-        for ( ; p != end /* && *p */; )
-          {
-            bool err;
-            uint32_t ucs4 = UTF8CharEnumerator::NextChar(&p, end, &err);
+  void write( const value_type* start, uint32_t N )
+  {
+    if ( mErrorEncountered )
+      return;
 
-            if ( err )
-              {
-                mErrorEncountered = true;
-                mBuffer = out;
-                return;
-              }
+    // algorithm assumes utf8 units won't
+    // be spread across fragments
+    const value_type* p = start;
+    const value_type* end = start + N;
+    buffer_type* out = mBuffer;
+    for ( ; p != end /* && *p */; )
+    {
+      bool err;
+      uint32_t ucs4 = UTF8CharEnumerator::NextChar(&p, end, &err);
 
-            if ( ucs4 >= PLANE1_BASE )
-              {
-                *out++ = (buffer_type)H_SURROGATE(ucs4);
-                *out++ = (buffer_type)L_SURROGATE(ucs4);
-              }
-            else
-              {
-                *out++ = ucs4;
-              }
-          }
+      if ( err )
+      {
+        mErrorEncountered = true;
         mBuffer = out;
+        return;
       }
 
-    void write_terminator()
+      if ( ucs4 >= PLANE1_BASE )
       {
-        *mBuffer = buffer_type(0);
+        *out++ = (buffer_type)H_SURROGATE(ucs4);
+        *out++ = (buffer_type)L_SURROGATE(ucs4);
       }
+      else
+      {
+        *out++ = ucs4;
+      }
+    }
+    mBuffer = out;
+  }
 
-    private:
-      buffer_type* const mStart;
-      buffer_type* mBuffer;
-      bool mErrorEncountered;
-  };
+  void write_terminator()
+  {
+    *mBuffer = buffer_type(0);
+  }
+
+private:
+  buffer_type* const mStart;
+  buffer_type* mBuffer;
+  bool mErrorEncountered;
+};
 
 /**
  * A character sink (see |copy_string| in nsAlgorithm.h) for computing
  * the length of the UTF-16 string equivalent to a UTF-8 string.
  */
 class CalculateUTF8Length
-  {
-    public:
-      typedef char value_type;
+{
+public:
+  typedef char value_type;
 
-    CalculateUTF8Length() : mLength(0), mErrorEncountered(false) { }
+  CalculateUTF8Length() : mLength(0), mErrorEncountered(false) { }
 
-    size_t Length() const { return mLength; }
+  size_t Length() const { return mLength; }
 
-    void write( const value_type* start, uint32_t N )
-      {
-          // ignore any further requests
-        if ( mErrorEncountered )
-            return;
+  void write( const value_type* start, uint32_t N )
+  {
+    // ignore any further requests
+    if ( mErrorEncountered )
+      return;
 
-        // algorithm assumes utf8 units won't
-        // be spread across fragments
-        const value_type* p = start;
-        const value_type* end = start + N;
-        for ( ; p < end /* && *p */; ++mLength )
-          {
-            if ( UTF8traits::isASCII(*p) )
-                p += 1;
-            else if ( UTF8traits::is2byte(*p) )
-                p += 2;
-            else if ( UTF8traits::is3byte(*p) )
-                p += 3;
-            else if ( UTF8traits::is4byte(*p) ) {
-                // Because a UTF-8 sequence of 4 bytes represents a codepoint
-                // greater than 0xFFFF, it will become a surrogate pair in the
-                // UTF-16 string, so add 1 more to mLength.
-                // This doesn't happen with is5byte and is6byte because they
-                // are illegal UTF-8 sequences (greater than 0x10FFFF) so get
-                // converted to a single replacement character.
+    // algorithm assumes utf8 units won't
+    // be spread across fragments
+    const value_type* p = start;
+    const value_type* end = start + N;
+    for ( ; p < end /* && *p */; ++mLength )
+    {
+      if ( UTF8traits::isASCII(*p) )
+        p += 1;
+      else if ( UTF8traits::is2byte(*p) )
+        p += 2;
+      else if ( UTF8traits::is3byte(*p) )
+        p += 3;
+      else if ( UTF8traits::is4byte(*p) ) {
+        // Because a UTF-8 sequence of 4 bytes represents a codepoint
+        // greater than 0xFFFF, it will become a surrogate pair in the
+        // UTF-16 string, so add 1 more to mLength.
+        // This doesn't happen with is5byte and is6byte because they
+        // are illegal UTF-8 sequences (greater than 0x10FFFF) so get
+        // converted to a single replacement character.
 
-                // However, there is one case when a 4 byte UTF-8 sequence will
-                // only generate 2 UTF-16 bytes. If we have a properly encoded
-                // sequence, but with an invalid value (too small or too big),
-                // that will result in a replacement character being written
-                // This replacement character is encoded as just 1 single
-                // UTF-16 character, which is 2 bytes.
+        // However, there is one case when a 4 byte UTF-8 sequence will
+        // only generate 2 UTF-16 bytes. If we have a properly encoded
+        // sequence, but with an invalid value (too small or too big),
+        // that will result in a replacement character being written
+        // This replacement character is encoded as just 1 single
+        // UTF-16 character, which is 2 bytes.
 
-                // The below code therefore only adds 1 to mLength if the UTF8
-                // data will produce a decoded character which is greater than
-                // or equal to 0x010000 and less than 0x0110000.
+        // The below code therefore only adds 1 to mLength if the UTF8
+        // data will produce a decoded character which is greater than
+        // or equal to 0x010000 and less than 0x0110000.
 
-                // A 4byte UTF8 character is encoded as
-                // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
-                // Bit 1-3 on the first byte, and bit 5-6 on the second byte,
-                // map to bit 17-21 in the final result. If these bits are
-                // between 0x01 and 0x11, that means that the final result is
-                // between 0x010000 and 0x110000. The below code reads these
-                // bits out and assigns them to c, but shifted up 4 bits to
-                // avoid having to shift twice.
+        // A 4byte UTF8 character is encoded as
+        // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+        // Bit 1-3 on the first byte, and bit 5-6 on the second byte,
+        // map to bit 17-21 in the final result. If these bits are
+        // between 0x01 and 0x11, that means that the final result is
+        // between 0x010000 and 0x110000. The below code reads these
+        // bits out and assigns them to c, but shifted up 4 bits to
+        // avoid having to shift twice.
 
-                // It doesn't matter what to do in the case where p + 4 > end
-                // since no UTF16 characters will be written in that case by
-                // ConvertUTF8toUTF16. Likewise it doesn't matter what we do if
-                // any of the surrogate bits are wrong since no UTF16
-                // characters will be written in that case either.
+        // It doesn't matter what to do in the case where p + 4 > end
+        // since no UTF16 characters will be written in that case by
+        // ConvertUTF8toUTF16. Likewise it doesn't matter what we do if
+        // any of the surrogate bits are wrong since no UTF16
+        // characters will be written in that case either.
 
-                if (p + 4 <= end) {
-                  uint32_t c = ((uint32_t)(p[0] & 0x07)) << 6 |
-                               ((uint32_t)(p[1] & 0x30));
-                  if (c >= 0x010 && c < 0x110)
-                    ++mLength;
-                }
+        if (p + 4 <= end) {
+          uint32_t c = ((uint32_t)(p[0] & 0x07)) << 6 |
+                       ((uint32_t)(p[1] & 0x30));
+          if (c >= 0x010 && c < 0x110)
+            ++mLength;
+        }
 
-                p += 4;
-            }
-            else if ( UTF8traits::is5byte(*p) )
-                p += 5;
-            else if ( UTF8traits::is6byte(*p) )
-                p += 6;
-            else // error
-              {
-                ++mLength; // to account for the decrement below
-                break;
-              }
-          }
-        if ( p != end )
-          {
-            NS_ERROR("Not a UTF-8 string. This code should only be used for converting from known UTF-8 strings.");
-            --mLength; // The last multi-byte char wasn't complete, discard it.
-            mErrorEncountered = true;
-          }
+        p += 4;
+      }
+      else if ( UTF8traits::is5byte(*p) )
+        p += 5;
+      else if ( UTF8traits::is6byte(*p) )
+        p += 6;
+      else // error
+      {
+        ++mLength; // to account for the decrement below
+        break;
       }
+    }
+    if ( p != end )
+    {
+      NS_ERROR("Not a UTF-8 string. This code should only be used for converting from known UTF-8 strings.");
+      --mLength; // The last multi-byte char wasn't complete, discard it.
+      mErrorEncountered = true;
+    }
+  }
 
-    private:
-      size_t mLength;
-      bool mErrorEncountered;
-  };
+private:
+  size_t mLength;
+  bool mErrorEncountered;
+};
 
 /**
  * A character sink (see |copy_string| in nsAlgorithm.h) for
  * converting UTF-16 to UTF-8. Treats invalid UTF-16 data as 0xFFFD
  * (0xEFBFBD in UTF-8).
  */
 class ConvertUTF16toUTF8
-  {
-    public:
-      typedef char16_t value_type;
-      typedef char      buffer_type;
+{
+public:
+  typedef char16_t value_type;
+  typedef char buffer_type;
 
-    // The error handling here is more lenient than that in
-    // |ConvertUTF8toUTF16|, but it's that way for backwards
-    // compatibility.
+  // The error handling here is more lenient than that in
+  // |ConvertUTF8toUTF16|, but it's that way for backwards
+  // compatibility.
 
-    ConvertUTF16toUTF8( buffer_type* aBuffer )
-        : mStart(aBuffer), mBuffer(aBuffer) {}
+  ConvertUTF16toUTF8( buffer_type* aBuffer )
+    : mStart(aBuffer), mBuffer(aBuffer) {}
 
-    size_t Size() const { return mBuffer - mStart; }
+  size_t Size() const { return mBuffer - mStart; }
 
-    void write( const value_type* start, uint32_t N )
-      {
-        buffer_type *out = mBuffer; // gcc isn't smart enough to do this!
+  void write( const value_type* start, uint32_t N )
+  {
+    buffer_type *out = mBuffer; // gcc isn't smart enough to do this!
 
-        for (const value_type *p = start, *end = start + N; p < end; ++p )
-          {
-            value_type c = *p;
-            if (! (c & 0xFF80)) // U+0000 - U+007F
-              {
-                *out++ = (char)c;
-              }
-            else if (! (c & 0xF800)) // U+0100 - U+07FF
-              {
-                *out++ = 0xC0 | (char)(c >> 6);
-                *out++ = 0x80 | (char)(0x003F & c);
-              }
-            else if (!IS_SURROGATE(c)) // U+0800 - U+D7FF,U+E000 - U+FFFF
-              {
-                *out++ = 0xE0 | (char)(c >> 12);
-                *out++ = 0x80 | (char)(0x003F & (c >> 6));
-                *out++ = 0x80 | (char)(0x003F & c );
-              }
-            else if (NS_IS_HIGH_SURROGATE(c)) // U+D800 - U+DBFF
-              {
-                // D800- DBFF - High Surrogate
-                value_type h = c;
+    for (const value_type *p = start, *end = start + N; p < end; ++p )
+    {
+      value_type c = *p;
+      if (! (c & 0xFF80)) // U+0000 - U+007F
+      {
+        *out++ = (char)c;
+      }
+      else if (! (c & 0xF800)) // U+0100 - U+07FF
+      {
+        *out++ = 0xC0 | (char)(c >> 6);
+        *out++ = 0x80 | (char)(0x003F & c);
+      }
+      else if (!IS_SURROGATE(c)) // U+0800 - U+D7FF,U+E000 - U+FFFF
+      {
+        *out++ = 0xE0 | (char)(c >> 12);
+        *out++ = 0x80 | (char)(0x003F & (c >> 6));
+        *out++ = 0x80 | (char)(0x003F & c );
+      }
+      else if (NS_IS_HIGH_SURROGATE(c)) // U+D800 - U+DBFF
+      {
+        // D800- DBFF - High Surrogate
+        value_type h = c;
 
-                ++p;
-                if (p == end)
-                  {
-                    // Treat broken characters as the Unicode
-                    // replacement character 0xFFFD (0xEFBFBD in
-                    // UTF-8)
-                    *out++ = '\xEF';
-                    *out++ = '\xBF';
-                    *out++ = '\xBD';
+        ++p;
+        if (p == end)
+        {
+          // Treat broken characters as the Unicode
+          // replacement character 0xFFFD (0xEFBFBD in
+          // UTF-8)
+          *out++ = '\xEF';
+          *out++ = '\xBF';
+          *out++ = '\xBD';
 
-                    NS_WARNING("String ending in half a surrogate pair!");
+          NS_WARNING("String ending in half a surrogate pair!");
 
-                    break;
-                  }
-                c = *p;
+          break;
+        }
+        c = *p;
 
-                if (NS_IS_LOW_SURROGATE(c))
-                  {
-                    // DC00- DFFF - Low Surrogate
-                    // N = (H - D800) *400 + 10000 + ( L - DC00 )
-                    uint32_t ucs4 = SURROGATE_TO_UCS4(h, c);
+        if (NS_IS_LOW_SURROGATE(c))
+        {
+          // DC00- DFFF - Low Surrogate
+          // N = (H - D800) *400 + 10000 + ( L - DC00 )
+          uint32_t ucs4 = SURROGATE_TO_UCS4(h, c);
 
-                    // 0001 0000-001F FFFF
-                    *out++ = 0xF0 | (char)(ucs4 >> 18);
-                    *out++ = 0x80 | (char)(0x003F & (ucs4 >> 12));
-                    *out++ = 0x80 | (char)(0x003F & (ucs4 >> 6));
-                    *out++ = 0x80 | (char)(0x003F & ucs4);
-                  }
-                else
-                  {
-                    // Treat broken characters as the Unicode
-                    // replacement character 0xFFFD (0xEFBFBD in
-                    // UTF-8)
-                    *out++ = '\xEF';
-                    *out++ = '\xBF';
-                    *out++ = '\xBD';
+          // 0001 0000-001F FFFF
+          *out++ = 0xF0 | (char)(ucs4 >> 18);
+          *out++ = 0x80 | (char)(0x003F & (ucs4 >> 12));
+          *out++ = 0x80 | (char)(0x003F & (ucs4 >> 6));
+          *out++ = 0x80 | (char)(0x003F & ucs4);
+        }
+        else
+        {
+          // Treat broken characters as the Unicode
+          // replacement character 0xFFFD (0xEFBFBD in
+          // UTF-8)
+          *out++ = '\xEF';
+          *out++ = '\xBF';
+          *out++ = '\xBD';
 
-                    // The pointer to the next character points to the second
-                    // 16-bit value, not beyond it, as per Unicode 5.0.0
-                    // Chapter 3 C10, only the first code unit of an illegal
-                    // sequence must be treated as an illegally terminated
-                    // code unit sequence (also Chapter 3 D91, "isolated [not
-                    // paired and ill-formed] UTF-16 code units in the range
-                    // D800..DFFF are ill-formed").
-                    p--;
+          // The pointer to the next character points to the second
+          // 16-bit value, not beyond it, as per Unicode 5.0.0
+          // Chapter 3 C10, only the first code unit of an illegal
+          // sequence must be treated as an illegally terminated
+          // code unit sequence (also Chapter 3 D91, "isolated [not
+          // paired and ill-formed] UTF-16 code units in the range
+          // D800..DFFF are ill-formed").
+          p--;
 
-                    NS_WARNING("got a High Surrogate but no low surrogate");
-                  }
-              }
-            else // U+DC00 - U+DFFF
-              {
-                // Treat broken characters as the Unicode replacement
-                // character 0xFFFD (0xEFBFBD in UTF-8)
-                *out++ = '\xEF';
-                *out++ = '\xBF';
-                *out++ = '\xBD';
+          NS_WARNING("got a High Surrogate but no low surrogate");
+        }
+      }
+      else // U+DC00 - U+DFFF
+      {
+        // Treat broken characters as the Unicode replacement
+        // character 0xFFFD (0xEFBFBD in UTF-8)
+        *out++ = '\xEF';
+        *out++ = '\xBF';
+        *out++ = '\xBD';
 
-                // DC00- DFFF - Low Surrogate
-                NS_WARNING("got a low Surrogate but no high surrogate");
-              }
-          }
+        // DC00- DFFF - Low Surrogate
+        NS_WARNING("got a low Surrogate but no high surrogate");
+      }
+    }
 
-        mBuffer = out;
-      }
+    mBuffer = out;
+  }
 
-    void write_terminator()
-      {
-        *mBuffer = buffer_type(0);
-      }
+  void write_terminator()
+  {
+    *mBuffer = buffer_type(0);
+  }
 
-    private:
-      buffer_type* const mStart;
-      buffer_type* mBuffer;
-  };
+private:
+  buffer_type* const mStart;
+  buffer_type* mBuffer;
+};
 
 /**
  * A character sink (see |copy_string| in nsAlgorithm.h) for computing
  * the number of bytes a UTF-16 would occupy in UTF-8. Treats invalid
  * UTF-16 data as 0xFFFD (0xEFBFBD in UTF-8).
  */
 class CalculateUTF8Size
-  {
-    public:
-      typedef char16_t value_type;
+{
+public:
+  typedef char16_t value_type;
+
+  CalculateUTF8Size()
+    : mSize(0) { }
+
+  size_t Size() const { return mSize; }
 
-    CalculateUTF8Size()
-      : mSize(0) { }
-
-    size_t Size() const { return mSize; }
-
-    void write( const value_type* start, uint32_t N )
+  void write( const value_type* start, uint32_t N )
+  {
+    // Assume UCS2 surrogate pairs won't be spread across fragments.
+    for (const value_type *p = start, *end = start + N; p < end; ++p )
+    {
+      value_type c = *p;
+      if (! (c & 0xFF80)) // U+0000 - U+007F
+        mSize += 1;
+      else if (! (c & 0xF800)) // U+0100 - U+07FF
+        mSize += 2;
+      else if (0xD800 != (0xF800 & c)) // U+0800 - U+D7FF,U+E000 - U+FFFF
+        mSize += 3;
+      else if (0xD800 == (0xFC00 & c)) // U+D800 - U+DBFF
       {
-        // Assume UCS2 surrogate pairs won't be spread across fragments.
-        for (const value_type *p = start, *end = start + N; p < end; ++p )
-          {
-            value_type c = *p;
-            if (! (c & 0xFF80)) // U+0000 - U+007F
-              mSize += 1;
-            else if (! (c & 0xF800)) // U+0100 - U+07FF
-              mSize += 2;
-            else if (0xD800 != (0xF800 & c)) // U+0800 - U+D7FF,U+E000 - U+FFFF
-              mSize += 3;
-            else if (0xD800 == (0xFC00 & c)) // U+D800 - U+DBFF
-              {
-                ++p;
-                if (p == end)
-                  {
-                    // Treat broken characters as the Unicode
-                    // replacement character 0xFFFD (0xEFBFBD in
-                    // UTF-8)
-                    mSize += 3;
+        ++p;
+        if (p == end)
+        {
+          // Treat broken characters as the Unicode
+          // replacement character 0xFFFD (0xEFBFBD in
+          // UTF-8)
+          mSize += 3;
 
-                    NS_WARNING("String ending in half a surrogate pair!");
+          NS_WARNING("String ending in half a surrogate pair!");
 
-                    break;
-                  }
-                c = *p;
+          break;
+        }
+        c = *p;
 
-                if (0xDC00 == (0xFC00 & c))
-                  mSize += 4;
-                else
-                  {
-                    // Treat broken characters as the Unicode
-                    // replacement character 0xFFFD (0xEFBFBD in
-                    // UTF-8)
-                    mSize += 3;
+        if (0xDC00 == (0xFC00 & c))
+          mSize += 4;
+        else
+        {
+          // Treat broken characters as the Unicode
+          // replacement character 0xFFFD (0xEFBFBD in
+          // UTF-8)
+          mSize += 3;
 
-                    // The next code unit is the second 16-bit value, not
-                    // the one beyond it, as per Unicode 5.0.0 Chapter 3 C10,
-                    // only the first code unit of an illegal sequence must
-                    // be treated as an illegally terminated code unit
-                    // sequence (also Chapter 3 D91, "isolated [not paired and
-                    // ill-formed] UTF-16 code units in the range D800..DFFF
-                    // are ill-formed").
-                    p--;
+          // The next code unit is the second 16-bit value, not
+          // the one beyond it, as per Unicode 5.0.0 Chapter 3 C10,
+          // only the first code unit of an illegal sequence must
+          // be treated as an illegally terminated code unit
+          // sequence (also Chapter 3 D91, "isolated [not paired and
+          // ill-formed] UTF-16 code units in the range D800..DFFF
+          // are ill-formed").
+          p--;
 
-                    NS_WARNING("got a high Surrogate but no low surrogate");
-                  }
-              }
-            else // U+DC00 - U+DFFF
-              {
-                // Treat broken characters as the Unicode replacement
-                // character 0xFFFD (0xEFBFBD in UTF-8)
-                mSize += 3;
+          NS_WARNING("got a high Surrogate but no low surrogate");
+        }
+      }
+      else // U+DC00 - U+DFFF
+      {
+        // Treat broken characters as the Unicode replacement
+        // character 0xFFFD (0xEFBFBD in UTF-8)
+        mSize += 3;
 
-                NS_WARNING("got a low Surrogate but no high surrogate");
-              }
-          }
+        NS_WARNING("got a low Surrogate but no high surrogate");
       }
+    }
+  }
 
-    private:
-      size_t mSize;
-  };
+private:
+  size_t mSize;
+};
 
 #ifdef MOZILLA_INTERNAL_API
 /**
  * A character sink that performs a |reinterpret_cast|-style conversion
  * from char to char16_t.
  */
 class LossyConvertEncoding8to16
-  {
-    public:
-      typedef char      value_type;
-      typedef char      input_type;
-      typedef char16_t output_type;
+{
+public:
+  typedef char value_type;
+  typedef char input_type;
+  typedef char16_t output_type;
 
-    public:
-      LossyConvertEncoding8to16( char16_t* aDestination ) :
-        mDestination(aDestination) { }
+public:
+  LossyConvertEncoding8to16( char16_t* aDestination ) :
+    mDestination(aDestination) { }
 
-      void
-      write( const char* aSource, uint32_t aSourceLength )
-        {
+  void
+  write( const char* aSource, uint32_t aSourceLength )
+  {
 #ifdef MOZILLA_MAY_SUPPORT_SSE2
-          if (mozilla::supports_sse2())
-            {
-              write_sse2(aSource, aSourceLength);
-              return;
-            }
+    if (mozilla::supports_sse2())
+    {
+      write_sse2(aSource, aSourceLength);
+      return;
+    }
 #endif
-          const char* done_writing = aSource + aSourceLength;
-          while ( aSource < done_writing )
-            *mDestination++ = (char16_t)(unsigned char)(*aSource++);
-        }
+    const char* done_writing = aSource + aSourceLength;
+    while ( aSource < done_writing )
+      *mDestination++ = (char16_t)(unsigned char)(*aSource++);
+  }
 
-      void
-      write_sse2( const char* aSource, uint32_t aSourceLength );
+  void
+  write_sse2( const char* aSource, uint32_t aSourceLength );
 
-      void
-      write_terminator()
-        {
-          *mDestination = (char16_t)(0);
-        }
+  void
+  write_terminator()
+  {
+    *mDestination = (char16_t)(0);
+  }
 
-    private:
-      char16_t* mDestination;
-  };
+private:
+  char16_t* mDestination;
+};
 
 /**
  * A character sink that performs a |reinterpret_cast|-style conversion
  * from char16_t to char.
  */
 class LossyConvertEncoding16to8
-  {
-    public:
-      typedef char16_t value_type;
-      typedef char16_t input_type;
-      typedef char      output_type;
+{
+public:
+  typedef char16_t value_type;
+  typedef char16_t input_type;
+  typedef char output_type;
 
-      LossyConvertEncoding16to8( char* aDestination ) : mDestination(aDestination) { }
+  LossyConvertEncoding16to8( char* aDestination ) : mDestination(aDestination) { }
 
-      void
-      write( const char16_t* aSource, uint32_t aSourceLength)
-        {
+  void
+  write( const char16_t* aSource, uint32_t aSourceLength)
+  {
 #ifdef MOZILLA_MAY_SUPPORT_SSE2
-          if (mozilla::supports_sse2())
-            {
-              write_sse2(aSource, aSourceLength);
-              return;
-            }
+    if (mozilla::supports_sse2())
+    {
+      write_sse2(aSource, aSourceLength);
+      return;
+    }
 #endif
-            const char16_t* done_writing = aSource + aSourceLength;
-            while ( aSource < done_writing )
-              *mDestination++ = (char)(*aSource++);
-        }
+    const char16_t* done_writing = aSource + aSourceLength;
+    while ( aSource < done_writing )
+      *mDestination++ = (char)(*aSource++);
+  }
 
 #ifdef MOZILLA_MAY_SUPPORT_SSE2
-      void
-      write_sse2( const char16_t* aSource, uint32_t aSourceLength );
+  void
+  write_sse2( const char16_t* aSource, uint32_t aSourceLength );
 #endif
 
-      void
-      write_terminator()
-        {
-          *mDestination = '\0';
-        }
+  void
+  write_terminator()
+  {
+    *mDestination = '\0';
+  }
 
-    private:
-      char *mDestination;
-  };
+private:
+  char *mDestination;
+};
 #endif // MOZILLA_INTERNAL_API
 
 #endif /* !defined(nsUTF8Utils_h_) */
--- a/xpcom/string/public/nsXPCOMStrings.h
+++ b/xpcom/string/public/nsXPCOMStrings.h
@@ -1,9 +1,10 @@
-/* vim:set ts=2 sw=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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/. */
 
 #ifndef nsXPCOMStrings_h__
 #define nsXPCOMStrings_h__
 
 #include <string.h>
@@ -635,17 +636,17 @@ NS_CStringCopy
  *
  * This function does not necessarily null-terminate aStr upon completion.
  * The behavior depends on the implementation of the abstract string, aStr.
  * If aStr is a reference to a nsStringContainer, then its data will be null-
  * terminated by this function.
  */
 inline NS_HIDDEN_(nsresult)
 NS_CStringAppendData(nsACString &aStr, const char *aData,
-                    uint32_t aDataLength = UINT32_MAX)
+                     uint32_t aDataLength = UINT32_MAX)
 {
   return NS_CStringSetDataRange(aStr, UINT32_MAX, 0, aData, aDataLength);
 }
 
 /**
  * NS_CStringInsertData
  *
  * This function inserts data into the existing value of aStr at the specified
@@ -660,17 +661,17 @@ NS_CStringAppendData(nsACString &aStr, c
  *
  * This function does not necessarily null-terminate aStr upon completion.
  * The behavior depends on the implementation of the abstract string, aStr.
  * If aStr is a reference to a nsStringContainer, then its data will be null-
  * terminated by this function.
  */
 inline NS_HIDDEN_(nsresult)
 NS_CStringInsertData(nsACString &aStr, uint32_t aOffset, const char *aData,
-                    uint32_t aDataLength = UINT32_MAX)
+                     uint32_t aDataLength = UINT32_MAX)
 {
   return NS_CStringSetDataRange(aStr, aOffset, 0, aData, aDataLength);
 }
 
 /**
  * NS_CStringCutData
  *
  * This function shortens the existing value of aStr, by removing characters
--- a/xpcom/string/src/nsDependentString.cpp
+++ b/xpcom/string/src/nsDependentString.cpp
@@ -1,18 +1,18 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsDependentString.h"
 #include "nsAlgorithm.h"
 
-  // define nsDependentString
+// define nsDependentString
 #include "string-template-def-unichar.h"
 #include "nsTDependentString.cpp"
 #include "string-template-undef.h"
 
-  // define nsDependentCString
+// define nsDependentCString
 #include "string-template-def-char.h"
 #include "nsTDependentString.cpp"
 #include "string-template-undef.h"
--- a/xpcom/string/src/nsDependentSubstring.cpp
+++ b/xpcom/string/src/nsDependentSubstring.cpp
@@ -1,18 +1,18 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsDependentSubstring.h"
 #include "nsAlgorithm.h"
 
-  // define nsDependentSubstring
+// define nsDependentSubstring
 #include "string-template-def-unichar.h"
 #include "nsTDependentSubstring.cpp"
 #include "string-template-undef.h"
 
-  // define nsDependentCSubstring
+// define nsDependentCSubstring
 #include "string-template-def-char.h"
 #include "nsTDependentSubstring.cpp"
 #include "string-template-undef.h"
--- a/xpcom/string/src/nsPromiseFlatString.cpp
+++ b/xpcom/string/src/nsPromiseFlatString.cpp
@@ -1,17 +1,17 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsPromiseFlatString.h"
 
-  // define nsPromiseFlatString
+// define nsPromiseFlatString
 #include "string-template-def-unichar.h"
 #include "nsTPromiseFlatString.cpp"
 #include "string-template-undef.h"
 
-  // define nsPromiseFlatCString
+// define nsPromiseFlatCString
 #include "string-template-def-char.h"
 #include "nsTPromiseFlatString.cpp"
 #include "string-template-undef.h"
--- a/xpcom/string/src/nsReadableUtils.cpp
+++ b/xpcom/string/src/nsReadableUtils.cpp
@@ -1,1150 +1,1151 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsReadableUtils.h"
 
 #include "nsMemory.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "nsUTF8Utils.h"
 
 void
 LossyCopyUTF16toASCII( const nsAString& aSource, nsACString& aDest )
-  {
-    aDest.Truncate();
-    LossyAppendUTF16toASCII(aSource, aDest);
-  }
+{
+  aDest.Truncate();
+  LossyAppendUTF16toASCII(aSource, aDest);
+}
 
 void
 CopyASCIItoUTF16( const nsACString& aSource, nsAString& aDest )
-  {
-    aDest.Truncate();
-    AppendASCIItoUTF16(aSource, aDest);
-  }
+{
+  aDest.Truncate();
+  AppendASCIItoUTF16(aSource, aDest);
+}
 
 void
 LossyCopyUTF16toASCII( const char16_t* aSource, nsACString& aDest )
-  {
-    aDest.Truncate();
-    if (aSource) {
-      LossyAppendUTF16toASCII(nsDependentString(aSource), aDest);
-    }
+{
+  aDest.Truncate();
+  if (aSource) {
+    LossyAppendUTF16toASCII(nsDependentString(aSource), aDest);
   }
+}
 
 void
 CopyASCIItoUTF16( const char* aSource, nsAString& aDest )
-  {
-    aDest.Truncate();
-    if (aSource) {
-      AppendASCIItoUTF16(nsDependentCString(aSource), aDest);
-    }
+{
+  aDest.Truncate();
+  if (aSource) {
+    AppendASCIItoUTF16(nsDependentCString(aSource), aDest);
   }
+}
 
 void
 CopyUTF16toUTF8( const nsAString& aSource, nsACString& aDest )
-  {
-    aDest.Truncate();
-    AppendUTF16toUTF8(aSource, aDest);
-  }
+{
+  aDest.Truncate();
+  AppendUTF16toUTF8(aSource, aDest);
+}
 
 void
 CopyUTF8toUTF16( const nsACString& aSource, nsAString& aDest )
-  {
-    aDest.Truncate();
-    AppendUTF8toUTF16(aSource, aDest);
-  }
+{
+  aDest.Truncate();
+  AppendUTF8toUTF16(aSource, aDest);
+}
 
 void
 CopyUTF16toUTF8( const char16_t* aSource, nsACString& aDest )
-  {
-    aDest.Truncate();
-    AppendUTF16toUTF8(aSource, aDest);
-  }
+{
+  aDest.Truncate();
+  AppendUTF16toUTF8(aSource, aDest);
+}
 
 void
 CopyUTF8toUTF16( const char* aSource, nsAString& aDest )
-  {
-    aDest.Truncate();
-    AppendUTF8toUTF16(aSource, aDest);
-  }
+{
+  aDest.Truncate();
+  AppendUTF8toUTF16(aSource, aDest);
+}
 
 void
 LossyAppendUTF16toASCII( const nsAString& aSource, nsACString& aDest )
-  {
-    uint32_t old_dest_length = aDest.Length();
-    aDest.SetLength(old_dest_length + aSource.Length());
+{
+  uint32_t old_dest_length = aDest.Length();
+  aDest.SetLength(old_dest_length + aSource.Length());
 
-    nsAString::const_iterator fromBegin, fromEnd;
+  nsAString::const_iterator fromBegin, fromEnd;
 
-    nsACString::iterator dest;
-    aDest.BeginWriting(dest);
+  nsACString::iterator dest;
+  aDest.BeginWriting(dest);
 
-    dest.advance(old_dest_length);
+  dest.advance(old_dest_length);
 
-    // right now, this won't work on multi-fragment destinations
-    LossyConvertEncoding16to8 converter(dest.get());
+  // right now, this won't work on multi-fragment destinations
+  LossyConvertEncoding16to8 converter(dest.get());
 
-    copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
-  }
+  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
+}
 
 void
 AppendASCIItoUTF16( const nsACString& aSource, nsAString& aDest )
-  {
-    if (!AppendASCIItoUTF16(aSource, aDest, mozilla::fallible_t())) {
-      NS_ABORT_OOM(aDest.Length() + aSource.Length());
-    }
+{
+  if (!AppendASCIItoUTF16(aSource, aDest, mozilla::fallible_t())) {
+    NS_ABORT_OOM(aDest.Length() + aSource.Length());
   }
+}
 
 bool
 AppendASCIItoUTF16( const nsACString& aSource, nsAString& aDest,
                     const mozilla::fallible_t& )
-  {
-    uint32_t old_dest_length = aDest.Length();
-    if (!aDest.SetLength(old_dest_length + aSource.Length(), mozilla::fallible_t())) {
-      return false;
-    }
+{
+  uint32_t old_dest_length = aDest.Length();
+  if (!aDest.SetLength(old_dest_length + aSource.Length(), mozilla::fallible_t())) {
+    return false;
+  }
 
-    nsACString::const_iterator fromBegin, fromEnd;
+  nsACString::const_iterator fromBegin, fromEnd;
 
-    nsAString::iterator dest;
-    aDest.BeginWriting(dest);
+  nsAString::iterator dest;
+  aDest.BeginWriting(dest);
 
-    dest.advance(old_dest_length);
+  dest.advance(old_dest_length);
 
-      // right now, this won't work on multi-fragment destinations
-    LossyConvertEncoding8to16 converter(dest.get());
+  // right now, this won't work on multi-fragment destinations
+  LossyConvertEncoding8to16 converter(dest.get());
 
-    copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
-    return true;
-  }
+  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
+  return true;
+}
 
 void
 LossyAppendUTF16toASCII( const char16_t* aSource, nsACString& aDest )
-  {
-    if (aSource) {
-      LossyAppendUTF16toASCII(nsDependentString(aSource), aDest);
-    }
+{
+  if (aSource) {
+    LossyAppendUTF16toASCII(nsDependentString(aSource), aDest);
   }
+}
 
 void
 AppendASCIItoUTF16( const char* aSource, nsAString& aDest )
-  {
-    if (aSource) {
-      AppendASCIItoUTF16(nsDependentCString(aSource), aDest);
-    }
+{
+  if (aSource) {
+    AppendASCIItoUTF16(nsDependentCString(aSource), aDest);
   }
+}
 
 void
 AppendUTF16toUTF8( const nsAString& aSource, nsACString& aDest )
 {
   if (!AppendUTF16toUTF8(aSource, aDest, mozilla::fallible_t())) {
     NS_ABORT_OOM(aDest.Length() + aSource.Length());
   }
 }
 
 bool
 AppendUTF16toUTF8( const nsAString& aSource, nsACString& aDest,
                    const mozilla::fallible_t& )
-  {
-    nsAString::const_iterator source_start, source_end;
-    CalculateUTF8Size calculator;
-    copy_string(aSource.BeginReading(source_start),
-                aSource.EndReading(source_end), calculator);
+{
+  nsAString::const_iterator source_start, source_end;
+  CalculateUTF8Size calculator;
+  copy_string(aSource.BeginReading(source_start),
+              aSource.EndReading(source_end), calculator);
 
-    uint32_t count = calculator.Size();
+  uint32_t count = calculator.Size();
 
-    if (count)
-      {
-        uint32_t old_dest_length = aDest.Length();
+  if (count)
+  {
+    uint32_t old_dest_length = aDest.Length();
 
-        // Grow the buffer if we need to.
-        if (!aDest.SetLength(old_dest_length + count, mozilla::fallible_t())) {
-          return false;
-        }
+    // Grow the buffer if we need to.
+    if (!aDest.SetLength(old_dest_length + count, mozilla::fallible_t())) {
+      return false;
+    }
 
-        // All ready? Time to convert
+    // All ready? Time to convert
 
-        ConvertUTF16toUTF8 converter(aDest.BeginWriting() + old_dest_length);
-        copy_string(aSource.BeginReading(source_start),
-                    aSource.EndReading(source_end), converter);
+    ConvertUTF16toUTF8 converter(aDest.BeginWriting() + old_dest_length);
+    copy_string(aSource.BeginReading(source_start),
+                aSource.EndReading(source_end), converter);
 
-        NS_ASSERTION(converter.Size() == count,
-                     "Unexpected disparity between CalculateUTF8Size and "
-                     "ConvertUTF16toUTF8");
-      }
+    NS_ASSERTION(converter.Size() == count,
+                 "Unexpected disparity between CalculateUTF8Size and "
+                 "ConvertUTF16toUTF8");
+  }
 
-    return true;
-  }
+  return true;
+}
 
 void
 AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest )
 {
   if (!AppendUTF8toUTF16(aSource, aDest, mozilla::fallible_t())) {
     NS_ABORT_OOM(aDest.Length() + aSource.Length());
   }
 }
 
 bool
 AppendUTF8toUTF16( const nsACString& aSource, nsAString& aDest,
                    const mozilla::fallible_t& )
-  {
-    nsACString::const_iterator source_start, source_end;
-    CalculateUTF8Length calculator;
-    copy_string(aSource.BeginReading(source_start),
-                aSource.EndReading(source_end), calculator);
+{
+  nsACString::const_iterator source_start, source_end;
+  CalculateUTF8Length calculator;
+  copy_string(aSource.BeginReading(source_start),
+              aSource.EndReading(source_end), calculator);
 
-    uint32_t count = calculator.Length();
+  uint32_t count = calculator.Length();
 
-    // Avoid making the string mutable if we're appending an empty string
-    if (count)
-      {
-        uint32_t old_dest_length = aDest.Length();
+  // Avoid making the string mutable if we're appending an empty string
+  if (count)
+  {
+    uint32_t old_dest_length = aDest.Length();
 
-        // Grow the buffer if we need to.
-        if (!aDest.SetLength(old_dest_length + count, mozilla::fallible_t())) {
-          return false;
-        }
+    // Grow the buffer if we need to.
+    if (!aDest.SetLength(old_dest_length + count, mozilla::fallible_t())) {
+      return false;
+    }
 
-        // All ready? Time to convert
+    // All ready? Time to convert
 
-        ConvertUTF8toUTF16 converter(aDest.BeginWriting() + old_dest_length);
-        copy_string(aSource.BeginReading(source_start),
-                    aSource.EndReading(source_end), converter);
+    ConvertUTF8toUTF16 converter(aDest.BeginWriting() + old_dest_length);
+    copy_string(aSource.BeginReading(source_start),
+                aSource.EndReading(source_end), converter);
 
-        NS_ASSERTION(converter.ErrorEncountered() ||
-                     converter.Length() == count,
-                     "CalculateUTF8Length produced the wrong length");
+    NS_ASSERTION(converter.ErrorEncountered() ||
+                 converter.Length() == count,
+                 "CalculateUTF8Length produced the wrong length");
 
-        if (converter.ErrorEncountered())
-          {
-            NS_ERROR("Input wasn't UTF8 or incorrect length was calculated");
-            aDest.SetLength(old_dest_length);
-          }
-      }
+    if (converter.ErrorEncountered())
+    {
+      NS_ERROR("Input wasn't UTF8 or incorrect length was calculated");
+      aDest.SetLength(old_dest_length);
+    }
+  }
 
-    return true;
-  }
+  return true;
+}
 
 void
 AppendUTF16toUTF8( const char16_t* aSource, nsACString& aDest )
-  {
-    if (aSource) {
-      AppendUTF16toUTF8(nsDependentString(aSource), aDest);
-    }
+{
+  if (aSource) {
+    AppendUTF16toUTF8(nsDependentString(aSource), aDest);
   }
+}
 
 void
 AppendUTF8toUTF16( const char* aSource, nsAString& aDest )
-  {
-    if (aSource) {
-      AppendUTF8toUTF16(nsDependentCString(aSource), aDest);
-    }
+{
+  if (aSource) {
+    AppendUTF8toUTF16(nsDependentCString(aSource), aDest);
   }
+}
 
 
-  /**
-   * A helper function that allocates a buffer of the desired character type big enough to hold a copy of the supplied string (plus a zero terminator).
-   *
-   * @param aSource an string you will eventually be making a copy of
-   * @return a new buffer (of the type specified by the second parameter) which you must free with |nsMemory::Free|.
-   *
-   */
+/**
+ * A helper function that allocates a buffer of the desired character type big enough to hold a copy of the supplied string (plus a zero terminator).
+ *
+ * @param aSource an string you will eventually be making a copy of
+ * @return a new buffer (of the type specified by the second parameter) which you must free with |nsMemory::Free|.
+ *
+ */
 template <class FromStringT, class ToCharT>
 inline
 ToCharT*
 AllocateStringCopy( const FromStringT& aSource, ToCharT* )
-  {
-    return static_cast<ToCharT*>(nsMemory::Alloc((aSource.Length()+1) * sizeof(ToCharT)));
-  }
+{
+  return static_cast<ToCharT*>(nsMemory::Alloc((aSource.Length()+1) * sizeof(ToCharT)));
+}
 
 
 char*
 ToNewCString( const nsAString& aSource )
-  {
-    char* result = AllocateStringCopy(aSource, (char*)0);
-    if (!result)
-      return nullptr;
+{
+  char* result = AllocateStringCopy(aSource, (char*)0);
+  if (!result)
+    return nullptr;
 
-    nsAString::const_iterator fromBegin, fromEnd;
-    LossyConvertEncoding16to8 converter(result);
-    copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter).write_terminator();
-    return result;
-  }
+  nsAString::const_iterator fromBegin, fromEnd;
+  LossyConvertEncoding16to8 converter(result);
+  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter).write_terminator();
+  return result;
+}
 
 char*
 ToNewUTF8String( const nsAString& aSource, uint32_t *aUTF8Count )
-  {
-    nsAString::const_iterator start, end;
-    CalculateUTF8Size calculator;
-    copy_string(aSource.BeginReading(start), aSource.EndReading(end),
-                calculator);
+{
+  nsAString::const_iterator start, end;
+  CalculateUTF8Size calculator;
+  copy_string(aSource.BeginReading(start), aSource.EndReading(end),
+              calculator);
 
-    if (aUTF8Count)
-      *aUTF8Count = calculator.Size();
+  if (aUTF8Count)
+    *aUTF8Count = calculator.Size();
 
-    char *result = static_cast<char*>
-                              (nsMemory::Alloc(calculator.Size() + 1));
-    if (!result)
-      return nullptr;
+  char *result = static_cast<char*>
+                 (nsMemory::Alloc(calculator.Size() + 1));
+  if (!result)
+    return nullptr;
 
-    ConvertUTF16toUTF8 converter(result);
-    copy_string(aSource.BeginReading(start), aSource.EndReading(end),
-                converter).write_terminator();
-    NS_ASSERTION(calculator.Size() == converter.Size(), "length mismatch");
+  ConvertUTF16toUTF8 converter(result);
+  copy_string(aSource.BeginReading(start), aSource.EndReading(end),
+              converter).write_terminator();
+  NS_ASSERTION(calculator.Size() == converter.Size(), "length mismatch");
 
-    return result;
-  }
+  return result;
+}
 
 char*
 ToNewCString( const nsACString& aSource )
-  {
-    // no conversion needed, just allocate a buffer of the correct length and copy into it
+{
+  // no conversion needed, just allocate a buffer of the correct length and copy into it
 
-    char* result = AllocateStringCopy(aSource, (char*)0);
-    if (!result)
-      return nullptr;
+  char* result = AllocateStringCopy(aSource, (char*)0);
+  if (!result)
+    return nullptr;
 
-    nsACString::const_iterator fromBegin, fromEnd;
-    char* toBegin = result;
-    *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), toBegin) = char(0);
-    return result;
-  }
+  nsACString::const_iterator fromBegin, fromEnd;
+  char* toBegin = result;
+  *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), toBegin) = char(0);
+  return result;
+}
 
 char16_t*
 ToNewUnicode( const nsAString& aSource )
-  {
-    // no conversion needed, just allocate a buffer of the correct length and copy into it
+{
+  // no conversion needed, just allocate a buffer of the correct length and copy into it
 
-    char16_t* result = AllocateStringCopy(aSource, (char16_t*)0);
-    if (!result)
-      return nullptr;
+  char16_t* result = AllocateStringCopy(aSource, (char16_t*)0);
+  if (!result)
+    return nullptr;
 
-    nsAString::const_iterator fromBegin, fromEnd;
-    char16_t* toBegin = result;
-    *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), toBegin) = char16_t(0);
-    return result;
-  }
+  nsAString::const_iterator fromBegin, fromEnd;
+  char16_t* toBegin = result;
+  *copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), toBegin) = char16_t(0);
+  return result;
+}
 
 char16_t*
 ToNewUnicode( const nsACString& aSource )
-  {
-    char16_t* result = AllocateStringCopy(aSource, (char16_t*)0);
-    if (!result)
-      return nullptr;
+{
+  char16_t* result = AllocateStringCopy(aSource, (char16_t*)0);
+  if (!result)
+    return nullptr;
 
-    nsACString::const_iterator fromBegin, fromEnd;
-    LossyConvertEncoding8to16 converter(result);
-    copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter).write_terminator();
-    return result;
-  }
+  nsACString::const_iterator fromBegin, fromEnd;
+  LossyConvertEncoding8to16 converter(result);
+  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter).write_terminator();
+  return result;
+}
 
 uint32_t
 CalcUTF8ToUnicodeLength( const nsACString& aSource)
-  {
-    nsACString::const_iterator start, end;
-    CalculateUTF8Length calculator;
-    copy_string(aSource.BeginReading(start), aSource.EndReading(end),
-                calculator);
-    return calculator.Length();
-  }
+{
+  nsACString::const_iterator start, end;
+  CalculateUTF8Length calculator;
+  copy_string(aSource.BeginReading(start), aSource.EndReading(end),
+              calculator);
+  return calculator.Length();
+}
 
 char16_t*
 UTF8ToUnicodeBuffer( const nsACString& aSource, char16_t* aBuffer, uint32_t *aUTF16Count )
-  {
-    nsACString::const_iterator start, end;
-    ConvertUTF8toUTF16 converter(aBuffer);
-    copy_string(aSource.BeginReading(start),
-                aSource.EndReading(end),
-                converter).write_terminator();
-    if (aUTF16Count)
-      *aUTF16Count = converter.Length();
-    return aBuffer;
-  }
+{
+  nsACString::const_iterator start, end;
+  ConvertUTF8toUTF16 converter(aBuffer);
+  copy_string(aSource.BeginReading(start),
+              aSource.EndReading(end),
+              converter).write_terminator();
+  if (aUTF16Count)
+    *aUTF16Count = converter.Length();
+  return aBuffer;
+}
 
 char16_t*
 UTF8ToNewUnicode( const nsACString& aSource, uint32_t *aUTF16Count )
-  {
-    const uint32_t length = CalcUTF8ToUnicodeLength(aSource);
-    const size_t buffer_size = (length + 1) * sizeof(char16_t);
-    char16_t *buffer = static_cast<char16_t*>(nsMemory::Alloc(buffer_size));
-    if (!buffer)
-      return nullptr;
+{
+  const uint32_t length = CalcUTF8ToUnicodeLength(aSource);
+  const size_t buffer_size = (length + 1) * sizeof(char16_t);
+  char16_t *buffer = static_cast<char16_t*>(nsMemory::Alloc(buffer_size));
+  if (!buffer)
+    return nullptr;
 
-    uint32_t copied;
-    UTF8ToUnicodeBuffer(aSource, buffer, &copied);
-    NS_ASSERTION(length == copied, "length mismatch");
+  uint32_t copied;
+  UTF8ToUnicodeBuffer(aSource, buffer, &copied);
+  NS_ASSERTION(length == copied, "length mismatch");
 
-    if (aUTF16Count)
-      *aUTF16Count = copied;
-    return buffer;
-  }
+  if (aUTF16Count)
+    *aUTF16Count = copied;
+  return buffer;
+}
 
 char16_t*
 CopyUnicodeTo( const nsAString& aSource, uint32_t aSrcOffset, char16_t* aDest, uint32_t aLength )
-  {
-    nsAString::const_iterator fromBegin, fromEnd;
-    char16_t* toBegin = aDest;    
-    copy_string(aSource.BeginReading(fromBegin).advance( int32_t(aSrcOffset) ), aSource.BeginReading(fromEnd).advance( int32_t(aSrcOffset+aLength) ), toBegin);
-    return aDest;
-  }
+{
+  nsAString::const_iterator fromBegin, fromEnd;
+  char16_t* toBegin = aDest;
+  copy_string(aSource.BeginReading(fromBegin).advance( int32_t(aSrcOffset) ), aSource.BeginReading(fromEnd).advance( int32_t(aSrcOffset+aLength) ), toBegin);
+  return aDest;
+}
 
 void
 CopyUnicodeTo( const nsAString::const_iterator& aSrcStart,
                const nsAString::const_iterator& aSrcEnd,
                nsAString& aDest )
-  {
-    nsAString::iterator writer;
-    aDest.SetLength(Distance(aSrcStart, aSrcEnd));
+{
+  nsAString::iterator writer;
+  aDest.SetLength(Distance(aSrcStart, aSrcEnd));
 
-    aDest.BeginWriting(writer);
-    nsAString::const_iterator fromBegin(aSrcStart);
-    
-    copy_string(fromBegin, aSrcEnd, writer);
-  }
+  aDest.BeginWriting(writer);
+  nsAString::const_iterator fromBegin(aSrcStart);
+
+  copy_string(fromBegin, aSrcEnd, writer);
+}
 
 void
 AppendUnicodeTo( const nsAString::const_iterator& aSrcStart,
                  const nsAString::const_iterator& aSrcEnd,
                  nsAString& aDest )
-  {
-    nsAString::iterator writer;
-    uint32_t oldLength = aDest.Length();
-    aDest.SetLength(oldLength + Distance(aSrcStart, aSrcEnd));
+{
+  nsAString::iterator writer;
+  uint32_t oldLength = aDest.Length();
+  aDest.SetLength(oldLength + Distance(aSrcStart, aSrcEnd));
 
-    aDest.BeginWriting(writer).advance(oldLength);
-    nsAString::const_iterator fromBegin(aSrcStart);
-    
-    copy_string(fromBegin, aSrcEnd, writer);
-  }
+  aDest.BeginWriting(writer).advance(oldLength);
+  nsAString::const_iterator fromBegin(aSrcStart);
+
+  copy_string(fromBegin, aSrcEnd, writer);
+}
 
 bool
 IsASCII( const nsAString& aString )
-  {
-    static const char16_t NOT_ASCII = char16_t(~0x007F);
+{
+  static const char16_t NOT_ASCII = char16_t(~0x007F);
 
 
-    // Don't want to use |copy_string| for this task, since we can stop at the first non-ASCII character
+  // Don't want to use |copy_string| for this task, since we can stop at the first non-ASCII character
 
-    nsAString::const_iterator iter, done_reading;
-    aString.BeginReading(iter);
-    aString.EndReading(done_reading);
+  nsAString::const_iterator iter, done_reading;
+  aString.BeginReading(iter);
+  aString.EndReading(done_reading);
+
+  const char16_t* c = iter.get();
+  const char16_t* end = done_reading.get();
 
-    const char16_t* c = iter.get();
-    const char16_t* end = done_reading.get();
-    
-    while ( c < end )
-      {
-        if ( *c++ & NOT_ASCII )
-          return false;
-      }
+  while ( c < end )
+  {
+    if ( *c++ & NOT_ASCII )
+      return false;
+  }
 
-    return true;
-  }
+  return true;
+}
 
 bool
 IsASCII( const nsACString& aString )
-  {
-    static const char NOT_ASCII = char(~0x7F);
+{
+  static const char NOT_ASCII = char(~0x7F);
 
 
-    // Don't want to use |copy_string| for this task, since we can stop at the first non-ASCII character
+  // Don't want to use |copy_string| for this task, since we can stop at the first non-ASCII character
 
-    nsACString::const_iterator iter, done_reading;
-    aString.BeginReading(iter);
-    aString.EndReading(done_reading);
+  nsACString::const_iterator iter, done_reading;
+  aString.BeginReading(iter);
+  aString.EndReading(done_reading);
+
+  const char* c = iter.get();
+  const char* end = done_reading.get();
 
-    const char* c = iter.get();
-    const char* end = done_reading.get();
-    
-    while ( c < end )
-      {
-        if ( *c++ & NOT_ASCII )
-          return false;
-      }
+  while ( c < end )
+  {
+    if ( *c++ & NOT_ASCII )
+      return false;
+  }
 
-    return true;
-  }
+  return true;
+}
 
 bool
 IsUTF8( const nsACString& aString, bool aRejectNonChar )
-  {
-    nsReadingIterator<char> done_reading;
-    aString.EndReading(done_reading);
+{
+  nsReadingIterator<char> done_reading;
+  aString.EndReading(done_reading);
 
-    int32_t state = 0;
-    bool overlong = false;
-    bool surrogate = false;
-    bool nonchar = false;
-    uint16_t olupper = 0; // overlong byte upper bound.
-    uint16_t slower = 0;  // surrogate byte lower bound.
+  int32_t state = 0;
+  bool overlong = false;
+  bool surrogate = false;
+  bool nonchar = false;
+  uint16_t olupper = 0; // overlong byte upper bound.
+  uint16_t slower = 0;  // surrogate byte lower bound.
 
-    nsReadingIterator<char> iter;
-    aString.BeginReading(iter);
+  nsReadingIterator<char> iter;
+  aString.BeginReading(iter);
 
-    const char* ptr = iter.get();
-    const char* end = done_reading.get();
-    while ( ptr < end )
-      {
-        uint8_t c;
-        
-        if (0 == state)
-          {
-            c = *ptr++;
+  const char* ptr = iter.get();
+  const char* end = done_reading.get();
+  while ( ptr < end )
+  {
+    uint8_t c;
 
-            if ( UTF8traits::isASCII(c) ) 
-              continue;
+    if (0 == state)
+    {
+      c = *ptr++;
+
+      if ( UTF8traits::isASCII(c) )
+        continue;
 
-            if ( c <= 0xC1 ) // [80-BF] where not expected, [C0-C1] for overlong.
-              return false;
-            else if ( UTF8traits::is2byte(c) ) 
-                state = 1;
-            else if ( UTF8traits::is3byte(c) ) 
-              {
-                state = 2;
-                if ( c == 0xE0 ) // to exclude E0[80-9F][80-BF] 
-                  {
-                    overlong = true;
-                    olupper = 0x9F;
-                  }
-                else if ( c == 0xED ) // ED[A0-BF][80-BF] : surrogate codepoint
-                  {
-                    surrogate = true;
-                    slower = 0xA0;
-                  }
-                else if ( c == 0xEF ) // EF BF [BE-BF] : non-character
-                  nonchar = true;
-              }
-            else if ( c <= 0xF4 ) // XXX replace /w UTF8traits::is4byte when it's updated to exclude [F5-F7].(bug 199090)
-              {
-                state = 3;
-                nonchar = true;
-                if ( c == 0xF0 ) // to exclude F0[80-8F][80-BF]{2}
-                  {
-                    overlong = true;
-                    olupper = 0x8F;
-                  }
-                else if ( c == 0xF4 ) // to exclude F4[90-BF][80-BF] 
-                  {
-                    // actually not surrogates but codepoints beyond 0x10FFFF
-                    surrogate = true;
-                    slower = 0x90;
-                  }
-              }
-            else
-              return false; // Not UTF-8 string
-          }
-          
-        if (nonchar && !aRejectNonChar)
-          nonchar = false;
+      if ( c <= 0xC1 ) // [80-BF] where not expected, [C0-C1] for overlong.
+        return false;
+      else if ( UTF8traits::is2byte(c) )
+        state = 1;
+      else if ( UTF8traits::is3byte(c) )
+      {
+        state = 2;
+        if ( c == 0xE0 ) // to exclude E0[80-9F][80-BF]
+        {
+          overlong = true;
+          olupper = 0x9F;
+        }
+        else if ( c == 0xED ) // ED[A0-BF][80-BF] : surrogate codepoint
+        {
+          surrogate = true;
+          slower = 0xA0;
+        }
+        else if ( c == 0xEF ) // EF BF [BE-BF] : non-character
+          nonchar = true;
+      }
+      else if ( c <= 0xF4 ) // XXX replace /w UTF8traits::is4byte when it's updated to exclude [F5-F7].(bug 199090)
+      {
+        state = 3;
+        nonchar = true;
+        if ( c == 0xF0 ) // to exclude F0[80-8F][80-BF]{2}
+        {
+          overlong = true;
+          olupper = 0x8F;
+        }
+        else if ( c == 0xF4 ) // to exclude F4[90-BF][80-BF]
+        {
+          // actually not surrogates but codepoints beyond 0x10FFFF
+          surrogate = true;
+          slower = 0x90;
+        }
+      }
+      else
+        return false; // Not UTF-8 string
+    }
+
+    if (nonchar && !aRejectNonChar)
+      nonchar = false;
 
-        while ( ptr < end && state )
-          {
-            c = *ptr++;
-            --state;
+    while ( ptr < end && state )
+    {
+      c = *ptr++;
+      --state;
 
-            // non-character : EF BF [BE-BF] or F[0-7] [89AB]F BF [BE-BF]
-            if ( nonchar &&  
-                 ( ( !state && c < 0xBE ) ||
-                   ( state == 1 && c != 0xBF )  ||
-                   ( state == 2 && 0x0F != (0x0F & c) )))
-              nonchar = false;
+      // non-character : EF BF [BE-BF] or F[0-7] [89AB]F BF [BE-BF]
+      if ( nonchar &&
+           ( ( !state && c < 0xBE ) ||
+             ( state == 1 && c != 0xBF )  ||
+             ( state == 2 && 0x0F != (0x0F & c) )))
+        nonchar = false;
 
-            if ( !UTF8traits::isInSeq(c) || ( overlong && c <= olupper ) || 
-                 ( surrogate && slower <= c ) || ( nonchar && !state ))
-              return false; // Not UTF-8 string
+      if ( !UTF8traits::isInSeq(c) || ( overlong && c <= olupper ) ||
+           ( surrogate && slower <= c ) || ( nonchar && !state ))
+        return false; // Not UTF-8 string
 
-            overlong = surrogate = false;
-          }
-        }
-    return !state; // state != 0 at the end indicates an invalid UTF-8 seq. 
+      overlong = surrogate = false;
+    }
   }
+  return !state; // state != 0 at the end indicates an invalid UTF-8 seq.
+}
 
-  /**
-   * A character sink for in-place case conversion.
-   */
+/**
+ * A character sink for in-place case conversion.
+ */
 class ConvertToUpperCase
-  {
-    public:
-      typedef char value_type;
+{
+public:
+  typedef char value_type;
 
-      uint32_t
-      write( const char* aSource, uint32_t aSourceLength )
-        {
-          char* cp = const_cast<char*>(aSource);
-          const char* end = aSource + aSourceLength;
-          while (cp != end) {
-            char ch = *cp;
-            if ((ch >= 'a') && (ch <= 'z'))
-              *cp = ch - ('a' - 'A');
-            ++cp;
-          }
-          return aSourceLength;
-        }
-  };
+  uint32_t
+  write( const char* aSource, uint32_t aSourceLength )
+  {
+    char* cp = const_cast<char*>(aSource);
+    const char* end = aSource + aSourceLength;
+    while (cp != end) {
+      char ch = *cp;
+      if ((ch >= 'a') && (ch <= 'z'))
+        *cp = ch - ('a' - 'A');
+      ++cp;
+    }
+    return aSourceLength;
+  }
+};
 
 void
 ToUpperCase( nsCSubstring& aCString )
+{
+  ConvertToUpperCase converter;
+  char* start;
+  converter.write(aCString.BeginWriting(start), aCString.Length());
+}
+
+/**
+ * A character sink for copying with case conversion.
+ */
+class CopyToUpperCase
+{
+public:
+  typedef char value_type;
+
+  CopyToUpperCase( nsACString::iterator& aDestIter )
+    : mIter(aDestIter)
   {
-    ConvertToUpperCase converter;
-    char* start;
-    converter.write(aCString.BeginWriting(start), aCString.Length());
   }
 
-  /**
-   * A character sink for copying with case conversion.
-   */
-class CopyToUpperCase
+  uint32_t
+  write( const char* aSource, uint32_t aSourceLength )
   {
-    public:
-      typedef char value_type;
-
-      CopyToUpperCase( nsACString::iterator& aDestIter )
-        : mIter(aDestIter)
-        {
-        }
+    uint32_t len = XPCOM_MIN(uint32_t(mIter.size_forward()), aSourceLength);
+    char* cp = mIter.get();
+    const char* end = aSource + len;
+    while (aSource != end) {
+      char ch = *aSource;
+      if ((ch >= 'a') && (ch <= 'z'))
+        *cp = ch - ('a' - 'A');
+      else
+        *cp = ch;
+      ++aSource;
+      ++cp;
+    }
+    mIter.advance(len);
+    return len;
+  }
 
-      uint32_t
-      write( const char* aSource, uint32_t aSourceLength )
-        {
-          uint32_t len = XPCOM_MIN(uint32_t(mIter.size_forward()), aSourceLength);
-          char* cp = mIter.get();
-          const char* end = aSource + len;
-          while (aSource != end) {
-            char ch = *aSource;
-            if ((ch >= 'a') && (ch <= 'z'))
-              *cp = ch - ('a' - 'A');
-            else
-              *cp = ch;
-            ++aSource;
-            ++cp;
-          }
-          mIter.advance(len);
-          return len;
-        }
-
-    protected:
-      nsACString::iterator& mIter;
-  };
+protected:
+  nsACString::iterator& mIter;
+};
 
 void
 ToUpperCase( const nsACString& aSource, nsACString& aDest )
-  {
-    nsACString::const_iterator fromBegin, fromEnd;
-    nsACString::iterator toBegin;
-    aDest.SetLength(aSource.Length());
+{
+  nsACString::const_iterator fromBegin, fromEnd;
+  nsACString::iterator toBegin;
+  aDest.SetLength(aSource.Length());
+
+  CopyToUpperCase converter(aDest.BeginWriting(toBegin));
+  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
+}
 
-    CopyToUpperCase converter(aDest.BeginWriting(toBegin));
-    copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
-  }
+/**
+ * A character sink for case conversion.
+ */
+class ConvertToLowerCase
+{
+public:
+  typedef char value_type;
 
-  /**
-   * A character sink for case conversion.
-   */
-class ConvertToLowerCase
+  uint32_t
+  write( const char* aSource, uint32_t aSourceLength )
   {
-    public:
-      typedef char value_type;
-
-      uint32_t
-      write( const char* aSource, uint32_t aSourceLength )
-        {
-          char* cp = const_cast<char*>(aSource);
-          const char* end = aSource + aSourceLength;
-          while (cp != end) {
-            char ch = *cp;
-            if ((ch >= 'A') && (ch <= 'Z'))
-              *cp = ch + ('a' - 'A');
-            ++cp;
-          }
-          return aSourceLength;
-        }
-  };
+    char* cp = const_cast<char*>(aSource);
+    const char* end = aSource + aSourceLength;
+    while (cp != end) {
+      char ch = *cp;
+      if ((ch >= 'A') && (ch <= 'Z'))
+        *cp = ch + ('a' - 'A');
+      ++cp;
+    }
+    return aSourceLength;
+  }
+};
 
 void
 ToLowerCase( nsCSubstring& aCString )
+{
+  ConvertToLowerCase converter;
+  char* start;
+  converter.write(aCString.BeginWriting(start), aCString.Length());
+}
+
+/**
+ * A character sink for copying with case conversion.
+ */
+class CopyToLowerCase
+{
+public:
+  typedef char value_type;
+
+  CopyToLowerCase( nsACString::iterator& aDestIter )
+    : mIter(aDestIter)
   {
-    ConvertToLowerCase converter;
-    char* start;
-    converter.write(aCString.BeginWriting(start), aCString.Length());
   }
 
-  /**
-   * A character sink for copying with case conversion.
-   */
-class CopyToLowerCase
+  uint32_t
+  write( const char* aSource, uint32_t aSourceLength )
   {
-    public:
-      typedef char value_type;
-
-      CopyToLowerCase( nsACString::iterator& aDestIter )
-        : mIter(aDestIter)
-        {
-        }
+    uint32_t len = XPCOM_MIN(uint32_t(mIter.size_forward()), aSourceLength);
+    char* cp = mIter.get();
+    const char* end = aSource + len;
+    while (aSource != end) {
+      char ch = *aSource;
+      if ((ch >= 'A') && (ch <= 'Z'))
+        *cp = ch + ('a' - 'A');
+      else
+        *cp = ch;
+      ++aSource;
+      ++cp;
+    }
+    mIter.advance(len);
+    return len;
+  }
 
-      uint32_t
-      write( const char* aSource, uint32_t aSourceLength )
-        {
-          uint32_t len = XPCOM_MIN(uint32_t(mIter.size_forward()), aSourceLength);
-          char* cp = mIter.get();
-          const char* end = aSource + len;
-          while (aSource != end) {
-            char ch = *aSource;
-            if ((ch >= 'A') && (ch <= 'Z'))
-              *cp = ch + ('a' - 'A');
-            else
-              *cp = ch;
-            ++aSource;
-            ++cp;
-          }
-          mIter.advance(len);
-          return len;
-        }
-
-    protected:
-      nsACString::iterator& mIter;
-  };
+protected:
+  nsACString::iterator& mIter;
+};
 
 void
 ToLowerCase( const nsACString& aSource, nsACString& aDest )
-  {
-    nsACString::const_iterator fromBegin, fromEnd;
-    nsACString::iterator toBegin;
-    aDest.SetLength(aSource.Length());
+{
+  nsACString::const_iterator fromBegin, fromEnd;
+  nsACString::iterator toBegin;
+  aDest.SetLength(aSource.Length());
 
-    CopyToLowerCase converter(aDest.BeginWriting(toBegin));
-    copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
-  }
+  CopyToLowerCase converter(aDest.BeginWriting(toBegin));
+  copy_string(aSource.BeginReading(fromBegin), aSource.EndReading(fromEnd), converter);
+}
 
 bool
-ParseString(const nsACString& aSource, char aDelimiter, 
+ParseString(const nsACString& aSource, char aDelimiter,
             nsTArray<nsCString>& aArray)
-  {
-    nsACString::const_iterator start, end;
-    aSource.BeginReading(start);
-    aSource.EndReading(end);
+{
+  nsACString::const_iterator start, end;
+  aSource.BeginReading(start);
+  aSource.EndReading(end);
 
-    uint32_t oldLength = aArray.Length();
+  uint32_t oldLength = aArray.Length();
 
-    for (;;)
-      {
-        nsACString::const_iterator delimiter = start;
-        FindCharInReadable(aDelimiter, delimiter, end);
+  for (;;)
+  {
+    nsACString::const_iterator delimiter = start;
+    FindCharInReadable(aDelimiter, delimiter, end);
 
-        if (delimiter != start)
-          {
-            if (!aArray.AppendElement(Substring(start, delimiter)))
-              {
-                aArray.RemoveElementsAt(oldLength, aArray.Length() - oldLength);
-                return false;
-              }
-          }
+    if (delimiter != start)
+    {
+      if (!aArray.AppendElement(Substring(start, delimiter)))
+      {
+        aArray.RemoveElementsAt(oldLength, aArray.Length() - oldLength);
+        return false;
+      }
+    }
 
-        if (delimiter == end)
-          break;
-        start = ++delimiter;
-        if (start == end)
-          break;
-      }
+    if (delimiter == end)
+      break;
+    start = ++delimiter;
+    if (start == end)
+      break;
+  }
 
-    return true;
-  }
+  return true;
+}
 
 template <class StringT, class IteratorT, class Comparator>
 bool
 FindInReadable_Impl( const StringT& aPattern, IteratorT& aSearchStart, IteratorT& aSearchEnd, const Comparator& compare )
-  {
-    bool found_it = false;
+{
+  bool found_it = false;
 
-      // only bother searching at all if we're given a non-empty range to search
-    if ( aSearchStart != aSearchEnd )
-      {
-        IteratorT aPatternStart, aPatternEnd;
-        aPattern.BeginReading(aPatternStart);
-        aPattern.EndReading(aPatternEnd);
+  // only bother searching at all if we're given a non-empty range to search
+  if ( aSearchStart != aSearchEnd )
+  {
+    IteratorT aPatternStart, aPatternEnd;
+    aPattern.BeginReading(aPatternStart);
+    aPattern.EndReading(aPatternEnd);
 
-          // outer loop keeps searching till we find it or run out of string to search
-        while ( !found_it )
-          {
-              // fast inner loop (that's what it's called, not what it is) looks for a potential match
-            while ( aSearchStart != aSearchEnd &&
-                    compare(aPatternStart.get(), aSearchStart.get(), 1, 1) )
-              ++aSearchStart;
+    // outer loop keeps searching till we find it or run out of string to search
+    while ( !found_it )
+    {
+      // fast inner loop (that's what it's called, not what it is) looks for a potential match
+      while ( aSearchStart != aSearchEnd &&
+              compare(aPatternStart.get(), aSearchStart.get(), 1, 1) )
+        ++aSearchStart;
 
-              // if we broke out of the `fast' loop because we're out of string ... we're done: no match
-            if ( aSearchStart == aSearchEnd )
-              break;
+      // if we broke out of the `fast' loop because we're out of string ... we're done: no match
+      if ( aSearchStart == aSearchEnd )
+        break;
 
-              // otherwise, we're at a potential match, let's see if we really hit one
-            IteratorT testPattern(aPatternStart);
-            IteratorT testSearch(aSearchStart);
+      // otherwise, we're at a potential match, let's see if we really hit one
+      IteratorT testPattern(aPatternStart);
+      IteratorT testSearch(aSearchStart);
 
-              // slow inner loop verifies the potential match (found by the `fast' loop) at the current position
-            for(;;)
-              {
-                  // we already compared the first character in the outer loop,
-                  //  so we'll advance before the next comparison
-                ++testPattern;
-                ++testSearch;
+      // slow inner loop verifies the potential match (found by the `fast' loop) at the current position
+      for(;;)
+      {
+        // we already compared the first character in the outer loop,
+        //  so we'll advance before the next comparison
+        ++testPattern;
+        ++testSearch;
 
-                  // if we verified all the way to the end of the pattern, then we found it!
-                if ( testPattern == aPatternEnd )
-                  {
-                    found_it = true;
-                    aSearchEnd = testSearch; // return the exact found range through the parameters
-                    break;
-                  }
+        // if we verified all the way to the end of the pattern, then we found it!
+        if ( testPattern == aPatternEnd )
+        {
+          found_it = true;
+          aSearchEnd = testSearch; // return the exact found range through the parameters
+          break;
+        }
 
-                  // if we got to end of the string we're searching before we hit the end of the
-                  //  pattern, we'll never find what we're looking for
-                if ( testSearch == aSearchEnd )
-                  {
-                    aSearchStart = aSearchEnd;
-                    break;
-                  }
+        // if we got to end of the string we're searching before we hit the end of the
+        //  pattern, we'll never find what we're looking for
+        if ( testSearch == aSearchEnd )
+        {
+          aSearchStart = aSearchEnd;
+          break;
+        }
 
-                  // else if we mismatched ... it's time to advance to the next search position
-                  //  and get back into the `fast' loop
-                if ( compare(testPattern.get(), testSearch.get(), 1, 1) )
-                  {
-                    ++aSearchStart;
-                    break;
-                  }
-              }
-          }
+        // else if we mismatched ... it's time to advance to the next search position
+        //  and get back into the `fast' loop
+        if ( compare(testPattern.get(), testSearch.get(), 1, 1) )
+        {
+          ++aSearchStart;
+          break;
+        }
       }
-
-    return found_it;
+    }
   }
 
-  /**
-   * This searches the entire string from right to left, and returns the first match found, if any.
-   */
+  return found_it;
+}
+
+/**
+ * This searches the entire string from right to left, and returns the first match found, if any.
+ */
 template <class StringT, class IteratorT, class Comparator>
 bool
 RFindInReadable_Impl( const StringT& aPattern, IteratorT& aSearchStart, IteratorT& aSearchEnd, const Comparator& compare )
-  {
-    IteratorT patternStart, patternEnd, searchEnd = aSearchEnd;
-    aPattern.BeginReading(patternStart);
-    aPattern.EndReading(patternEnd);
+{
+  IteratorT patternStart, patternEnd, searchEnd = aSearchEnd;
+  aPattern.BeginReading(patternStart);
+  aPattern.EndReading(patternEnd);
 
-      // Point to the last character in the pattern
-    --patternEnd;
-      // outer loop keeps searching till we run out of string to search
-    while ( aSearchStart != searchEnd )
-      {
-          // Point to the end position of the next possible match
-        --searchEnd;
-    
-          // Check last character, if a match, explore further from here
-        if ( compare(patternEnd.get(), searchEnd.get(), 1, 1) == 0 )
-          {  
-              // We're at a potential match, let's see if we really hit one
-            IteratorT testPattern(patternEnd);
-            IteratorT testSearch(searchEnd);
+  // Point to the last character in the pattern
+  --patternEnd;
+  // outer loop keeps searching till we run out of string to search
+  while ( aSearchStart != searchEnd )
+  {
+    // Point to the end position of the next possible match
+    --searchEnd;
+
+    // Check last character, if a match, explore further from here
+    if ( compare(patternEnd.get(), searchEnd.get(), 1, 1) == 0 )
+    {
+      // We're at a potential match, let's see if we really hit one
+      IteratorT testPattern(patternEnd);
+      IteratorT testSearch(searchEnd);
 
-              // inner loop verifies the potential match at the current position
-            do
-              {
-                  // if we verified all the way to the end of the pattern, then we found it!
-                if ( testPattern == patternStart )
-                  {
-                    aSearchStart = testSearch;  // point to start of match
-                    aSearchEnd = ++searchEnd;   // point to end of match
-                    return true;
-                  }
-    
-                  // if we got to end of the string we're searching before we hit the end of the
-                  //  pattern, we'll never find what we're looking for
-                if ( testSearch == aSearchStart )
-                  {
-                    aSearchStart = aSearchEnd;
-                    return false;
-                  }
-    
-                  // test previous character for a match
-                --testPattern;
-                --testSearch;
-              }
-            while ( compare(testPattern.get(), testSearch.get(), 1, 1) == 0 );
-          }
+      // inner loop verifies the potential match at the current position
+      do
+      {
+        // if we verified all the way to the end of the pattern, then we found it!
+        if ( testPattern == patternStart )
+        {
+          aSearchStart = testSearch;  // point to start of match
+          aSearchEnd = ++searchEnd;   // point to end of match
+          return true;
+        }
+
+        // if we got to end of the string we're searching before we hit the end of the
+        //  pattern, we'll never find what we're looking for
+        if ( testSearch == aSearchStart )
+        {
+          aSearchStart = aSearchEnd;
+          return false;
+        }
+
+        // test previous character for a match
+        --testPattern;
+        --testSearch;
       }
+      while ( compare(testPattern.get(), testSearch.get(), 1, 1) == 0 );
+    }
+  }
 
-    aSearchStart = aSearchEnd;
-    return false;
-  }
+  aSearchStart = aSearchEnd;
+  return false;
+}
 
 bool
 FindInReadable( const nsAString& aPattern, nsAString::const_iterator& aSearchStart, nsAString::const_iterator& aSearchEnd, const nsStringComparator& aComparator )
-  {
-    return FindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, aComparator);
-  }
+{
+  return FindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, aComparator);
+}
 
 bool
 FindInReadable( const nsACString& aPattern, nsACString::const_iterator& aSearchStart, nsACString::const_iterator& aSearchEnd, const nsCStringComparator& aComparator)
-  {
-    return FindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, aComparator);
-  }
+{
+  return FindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, aComparator);
+}
 
 bool
 CaseInsensitiveFindInReadable( const nsACString& aPattern, nsACString::const_iterator& aSearchStart, nsACString::const_iterator& aSearchEnd )
-  {
-    return FindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, nsCaseInsensitiveCStringComparator());
-  }
+{
+  return FindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, nsCaseInsensitiveCStringComparator());
+}
 
 bool
 RFindInReadable( const nsAString& aPattern, nsAString::const_iterator& aSearchStart, nsAString::const_iterator& aSearchEnd, const nsStringComparator& aComparator)
-  {
-    return RFindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, aComparator);
-  }
+{
+  return RFindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, aComparator);
+}
 
 bool
 RFindInReadable( const nsACString& aPattern, nsACString::const_iterator& aSearchStart, nsACString::const_iterator& aSearchEnd, const nsCStringComparator& aComparator)
-  {
-    return RFindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, aComparator);
-  }
+{
+  return RFindInReadable_Impl(aPattern, aSearchStart, aSearchEnd, aComparator);
+}
 
 bool
 FindCharInReadable( char16_t aChar, nsAString::const_iterator& aSearchStart, const nsAString::const_iterator& aSearchEnd )
-  {
-    int32_t fragmentLength = aSearchEnd.get() - aSearchStart.get();
+{
+  int32_t fragmentLength = aSearchEnd.get() - aSearchStart.get();
 
-    const char16_t* charFoundAt = nsCharTraits<char16_t>::find(aSearchStart.get(), fragmentLength, aChar);
-    if ( charFoundAt ) {
-      aSearchStart.advance( charFoundAt - aSearchStart.get() );
-      return true;
-    }
+  const char16_t* charFoundAt = nsCharTraits<char16_t>::find(aSearchStart.get(), fragmentLength, aChar);
+  if ( charFoundAt ) {
+    aSearchStart.advance( charFoundAt - aSearchStart.get() );
+    return true;
+  }
 
-    aSearchStart.advance(fragmentLength);
-    return false;
-  }
+  aSearchStart.advance(fragmentLength);
+  return false;
+}
 
 bool
 FindCharInReadable( char aChar, nsACString::const_iterator& aSearchStart, const nsACString::const_iterator& aSearchEnd )
-  {
-    int32_t fragmentLength = aSearchEnd.get() - aSearchStart.get();
+{
+  int32_t fragmentLength = aSearchEnd.get() - aSearchStart.get();
 
-    const char* charFoundAt = nsCharTraits<char>::find(aSearchStart.get(), fragmentLength, aChar);
-    if ( charFoundAt ) {
-      aSearchStart.advance( charFoundAt - aSearchStart.get() );
-      return true;
-    }
+  const char* charFoundAt = nsCharTraits<char>::find(aSearchStart.get(), fragmentLength, aChar);
+  if ( charFoundAt ) {
+    aSearchStart.advance( charFoundAt - aSearchStart.get() );
+    return true;
+  }
 
-    aSearchStart.advance(fragmentLength);
-    return false;
-  }
+  aSearchStart.advance(fragmentLength);
+  return false;
+}
 
 uint32_t
 CountCharInReadable( const nsAString& aStr,