Backed out 4 changesets (bug 1358297) for hazard build failures a=backout
authorWes Kocher <wkocher@mozilla.com>
Fri, 05 May 2017 12:45:46 -0700
changeset 404967 b820c22816054fb93270d66375862913054bee7c
parent 404966 832a7bbcea613eff31d8afa8930034af48e34793
child 404968 d330e31dcb2345bdf49352249fe533721215cd15
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1358297
milestone55.0a1
backs out95211a49619145612d3e55e95b9f596bd649f0cb
3c1b426a5cce74b34841fc608842518c8746f8f3
9201d345a1d5cef6b5ffb91ed27983403cc43865
c926817dea602dd5ec1e836607c13effc24d90b4
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 4 changesets (bug 1358297) for hazard build failures a=backout Backed out changeset 95211a496191 (bug 1358297) Backed out changeset 3c1b426a5cce (bug 1358297) Backed out changeset 9201d345a1d5 (bug 1358297) Backed out changeset c926817dea60 (bug 1358297) MozReview-Commit-ID: 874DF43K7Dp
docshell/base/nsDefaultURIFixup.cpp
docshell/base/nsDocShell.cpp
dom/base/nsContentUtils.cpp
dom/base/nsFrameMessageManager.cpp
dom/html/HTMLInputElement.cpp
editor/libeditor/TextEditRules.cpp
netwerk/base/nsURLHelper.cpp
netwerk/mime/nsMIMEHeaderParamImpl.cpp
xpcom/string/moz.build
xpcom/string/nsASCIIMask.cpp
xpcom/string/nsASCIIMask.h
xpcom/string/nsStringObsolete.cpp
xpcom/string/nsTStringObsolete.cpp
xpcom/string/nsTSubstring.cpp
xpcom/string/nsTSubstring.h
xpcom/tests/gtest/TestStrings.cpp
xpfe/appshell/nsXULWindow.cpp
--- a/docshell/base/nsDefaultURIFixup.cpp
+++ b/docshell/base/nsDefaultURIFixup.cpp
@@ -162,17 +162,17 @@ nsDefaultURIFixup::GetFixupURIInfo(const
 {
   NS_ENSURE_ARG(!aStringURI.IsEmpty());
 
   nsresult rv;
 
   nsAutoCString uriString(aStringURI);
 
   // Eliminate embedded newlines, which single-line text fields now allow:
-  uriString.StripCRLF();
+  uriString.StripChars("\r\n");
   // Cleanup the empty spaces that might be on each end:
   uriString.Trim(" ");
 
   NS_ENSURE_TRUE(!uriString.IsEmpty(), NS_ERROR_FAILURE);
 
   RefPtr<nsDefaultURIFixupInfo> info = new nsDefaultURIFixupInfo(uriString);
   NS_ADDREF(*aInfo = info);
 
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -4775,17 +4775,17 @@ nsDocShell::LoadURIWithOptions(const cha
   // Create a URI from our string; if that succeeds, we want to
   // change aLoadFlags to not include the ALLOW_THIRD_PARTY_FIXUP
   // flag.
 
   NS_ConvertUTF16toUTF8 uriString(aURI);
   // Cleanup the empty spaces that might be on each end.
   uriString.Trim(" ");
   // Eliminate embedded newlines, which single-line text fields now allow:
-  uriString.StripCRLF();
+  uriString.StripChars("\r\n");
   NS_ENSURE_TRUE(!uriString.IsEmpty(), NS_ERROR_FAILURE);
 
   rv = NS_NewURI(getter_AddRefs(uri), uriString);
   if (uri) {
     aLoadFlags &= ~LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
   }
 
   nsCOMPtr<nsIURIFixupInfo> fixupInfo;
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -6679,17 +6679,19 @@ nsContentUtils::FlushLayoutForTree(nsPID
         FlushLayoutForTree(win);
       }
     }
   }
 }
 
 void nsContentUtils::RemoveNewlines(nsString &aString)
 {
-  aString.StripCRLF();
+  // strip CR/LF and null
+  static const char badChars[] = {'\r', '\n', 0};
+  aString.StripChars(badChars);
 }
 
 void
 nsContentUtils::PlatformToDOMLineBreaks(nsString &aString)
 {
   if (!PlatformToDOMLineBreaks(aString, fallible)) {
     aString.AllocFailed(aString.Length());
   }
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -4,17 +4,16 @@
  * 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 "base/basictypes.h"
 
 #include "nsFrameMessageManager.h"
 
 #include "ContentChild.h"
-#include "nsASCIIMask.h"
 #include "nsContentUtils.h"
 #include "nsDOMClassInfoID.h"
 #include "nsError.h"
 #include "nsIXPConnect.h"
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "nsJSUtils.h"
 #include "nsJSPrincipals.h"
@@ -587,17 +586,17 @@ AllowMessage(size_t aDataLength, const n
 {
   static const size_t kMinTelemetryMessageSize = 8192;
 
   if (aDataLength < kMinTelemetryMessageSize) {
     return true;
   }
 
   NS_ConvertUTF16toUTF8 messageName(aMessageName);
-  messageName.StripTaggedASCII(ASCIIMask::Mask0to9());
+  messageName.StripChars("0123456789");
 
   Telemetry::Accumulate(Telemetry::MESSAGE_MANAGER_MESSAGE_SIZE2, messageName,
                         aDataLength);
 
   // A message includes more than structured clone data, so subtract
   // 20KB to make it more likely that a message within this bound won't
   // result in an overly large IPC message.
   static const size_t kMaxMessageSize = IPC::Channel::kMaximumMessageSize - 20 * 1024;
@@ -673,17 +672,17 @@ nsFrameMessageManager::SendMessage(const
   }
 
   uint32_t latencyMs = round((TimeStamp::Now() - start).ToMilliseconds());
   if (latencyMs >= kMinTelemetrySyncMessageManagerLatencyMs) {
     NS_ConvertUTF16toUTF8 messageName(aMessageName);
     // NOTE: We need to strip digit characters from the message name in order to
     // avoid a large number of buckets due to generated names from addons (such
     // as "ublock:sb:{N}"). See bug 1348113 comment 10.
-    messageName.StripTaggedASCII(ASCIIMask::Mask0to9());
+    messageName.StripChars("0123456789");
     Telemetry::Accumulate(Telemetry::IPC_SYNC_MESSAGE_MANAGER_LATENCY_MS,
                           messageName, latencyMs);
   }
 
   if (!ok) {
     return NS_OK;
   }
 
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -5340,23 +5340,25 @@ HTMLInputElement::SanitizeValue(nsAStrin
   NS_ASSERTION(mDoneCreating, "The element creation should be finished!");
 
   switch (mType) {
     case NS_FORM_INPUT_TEXT:
     case NS_FORM_INPUT_SEARCH:
     case NS_FORM_INPUT_TEL:
     case NS_FORM_INPUT_PASSWORD:
       {
-        aValue.StripCRLF();
+        char16_t crlf[] = { char16_t('\r'), char16_t('\n'), 0 };
+        aValue.StripChars(crlf);
       }
       break;
     case NS_FORM_INPUT_EMAIL:
     case NS_FORM_INPUT_URL:
       {
-        aValue.StripCRLF();
+        char16_t crlf[] = { char16_t('\r'), char16_t('\n'), 0 };
+        aValue.StripChars(crlf);
 
         aValue = nsContentUtils::TrimWhitespace<nsContentUtils::IsHTMLWhitespace>(aValue);
       }
       break;
     case NS_FORM_INPUT_NUMBER:
       {
         Decimal value;
         bool ok = ConvertStringToNumber(aValue, value);
--- a/editor/libeditor/TextEditRules.cpp
+++ b/editor/libeditor/TextEditRules.cpp
@@ -528,17 +528,17 @@ TextEditRules::HandleNewLines(nsString& 
 
   switch(aNewlineHandling) {
     case nsIPlaintextEditor::eNewlinesReplaceWithSpaces:
       // Strip trailing newlines first so we don't wind up with trailing spaces
       aString.Trim(CRLF, false, true);
       aString.ReplaceChar(CRLF, ' ');
       break;
     case nsIPlaintextEditor::eNewlinesStrip:
-      aString.StripCRLF();
+      aString.StripChars(CRLF);
       break;
     case nsIPlaintextEditor::eNewlinesPasteToFirst:
     default: {
       int32_t firstCRLF = aString.FindCharInSet(CRLF);
 
       // we get first *non-empty* line.
       int32_t offset = 0;
       while (firstCRLF == offset) {
--- a/netwerk/base/nsURLHelper.cpp
+++ b/netwerk/base/nsURLHelper.cpp
@@ -4,17 +4,16 @@
  * 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 "mozilla/RangedPtr.h"
 
 #include <algorithm>
 #include <iterator>
 
-#include "nsASCIIMask.h"
 #include "nsURLHelper.h"
 #include "nsIFile.h"
 #include "nsIURLParser.h"
 #include "nsCOMPtr.h"
 #include "nsCRT.h"
 #include "nsNetCID.h"
 #include "mozilla/Preferences.h"
 #include "prnetdb.h"
@@ -518,17 +517,17 @@ net_ExtractURLScheme(const nsACString &i
         // Skip valid scheme characters or \r\n\t
     }
 
     if (!p.CheckChar(':')) {
         return NS_ERROR_MALFORMED_URI;
     }
 
     p.Claim(scheme);
-    scheme.StripTaggedASCII(ASCIIMask::MaskCRLFTab());
+    scheme.StripChars("\r\n\t");
     return NS_OK;
 }
 
 bool
 net_IsValidScheme(const char *scheme, uint32_t schemeLen)
 {
     // first char must be alpha
     if (!nsCRT::IsAsciiAlpha(*scheme))
@@ -587,49 +586,46 @@ net_IsAbsoluteURL(const nsACString& uri)
         return true;
     }
     return false;
 }
 
 void
 net_FilterURIString(const nsACString& input, nsACString& result)
 {
+    const char kCharsToStrip[] = "\r\n\t";
+
     result.Truncate();
 
     auto start = input.BeginReading();
     auto end = input.EndReading();
 
     // Trim off leading and trailing invalid chars.
     auto charFilter = [](char c) { return static_cast<uint8_t>(c) > 0x20; };
     auto newStart = std::find_if(start, end, charFilter);
     auto newEnd = std::find_if(
         std::reverse_iterator<decltype(end)>(end),
         std::reverse_iterator<decltype(newStart)>(newStart),
         charFilter).base();
 
     // Check if chars need to be stripped.
-    bool needsStrip = false;
-    const ASCIIMaskArray& mask = ASCIIMask::MaskCRLFTab();
-    for (auto itr = start; itr != end; ++itr) {
-        if (ASCIIMask::IsMasked(mask, *itr)) {
-            needsStrip = true;
-            break;
-        }
-    }
+    auto itr = std::find_first_of(
+        newStart, newEnd, std::begin(kCharsToStrip), std::end(kCharsToStrip));
+    const bool needsStrip = itr != newEnd;
 
     // Just use the passed in string rather than creating new copies if no
     // changes are necessary.
     if (newStart == start && newEnd == end && !needsStrip) {
         result = input;
         return;
     }
 
     result.Assign(Substring(newStart, newEnd));
     if (needsStrip) {
-        result.StripTaggedASCII(mask);
+        result.StripChars(kCharsToStrip);
     }
 }
 
 
 #if defined(XP_WIN)
 bool
 net_NormalizeFileURL(const nsACString &aURL, nsCString &aResultBuf)
 {
--- a/netwerk/mime/nsMIMEHeaderParamImpl.cpp
+++ b/netwerk/mime/nsMIMEHeaderParamImpl.cpp
@@ -513,17 +513,17 @@ nsMIMEHeaderParamImpl::DoParameterIntern
       if (caseAResult) {
         // we already have one caseA result, ignore subsequent ones
         goto increment_str;
       }
 
       // if the parameter spans across multiple lines we have to strip out the
       //     line continuation -- jht 4/29/98 
       nsAutoCString tempStr(valueStart, valueEnd - valueStart);
-      tempStr.StripCRLF();
+      tempStr.StripChars("\r\n");
       char *res = ToNewCString(tempStr);
       NS_ENSURE_TRUE(res, NS_ERROR_OUT_OF_MEMORY);
       
       if (isQuotedString)
         RemoveQuotedStringEscapes(res);
 
       caseAResult = res;
       // keep going, we may find a RFC 2231/5987 encoded alternative
@@ -756,17 +756,17 @@ internalDecodeRFC2047Header(const char* 
     aEatContinuations = false;
     aResult = aHeaderVal;
   }
 
   if (aEatContinuations) {
     nsAutoCString temp(aResult);
     temp.ReplaceSubstring("\n\t", " ");
     temp.ReplaceSubstring("\r\t", " ");
-    temp.StripCRLF();
+    temp.StripChars("\r\n");
     aResult = temp;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMIMEHeaderParamImpl::DecodeRFC2047Header(const char* aHeaderVal, 
--- a/xpcom/string/moz.build
+++ b/xpcom/string/moz.build
@@ -3,17 +3,16 @@
 # 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/.
 
 with Files('**'):
     BUG_COMPONENT = ('Core', 'String')
 
 EXPORTS += [
-    'nsASCIIMask.h',
     'nsAString.h',
     'nsCharTraits.h',
     'nsDependentString.h',
     'nsDependentSubstring.h',
     'nsLiteralString.h',
     'nsPrintfCString.h',
     'nsPromiseFlatString.h',
     'nsReadableUtils.h',
@@ -34,17 +33,16 @@ EXPORTS += [
     'nsUTF8Utils.h',
     'nsXPIDLString.h',
     'string-template-def-char.h',
     'string-template-def-unichar.h',
     'string-template-undef.h',
 ]
 
 UNIFIED_SOURCES += [
-    'nsASCIIMask.cpp',
     'nsDependentString.cpp',
     'nsDependentSubstring.cpp',
     'nsPromiseFlatString.cpp',
     'nsReadableUtils.cpp',
     'nsString.cpp',
     'nsStringComparator.cpp',
     'nsStringObsolete.cpp',
     'nsSubstring.cpp',
deleted file mode 100644
--- a/xpcom/string/nsASCIIMask.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsASCIIMask.h"
-
-namespace mozilla {
-
-constexpr bool TestWhitespace(char c)
-{
-  return c == '\f' || c == '\t' || c == '\r' || c == '\n' || c == ' ';
-}
-constexpr ASCIIMaskArray sWhitespaceMask = CreateASCIIMask(TestWhitespace);
-
-constexpr bool TestCRLF(char c)
-{
-  return c == '\r' || c == '\n';
-}
-constexpr ASCIIMaskArray sCRLFMask = CreateASCIIMask(TestCRLF);
-
-constexpr bool TestCRLFTab(char c)
-{
-  return c == '\r' || c == '\n' || c == '\t';
-}
-constexpr ASCIIMaskArray sCRLFTabMask = CreateASCIIMask(TestCRLFTab);
-
-constexpr bool TestZeroToNine(char c)
-{
-  return c == '0' || c == '1' || c == '2' || c == '3' || c == '4' ||
-         c == '5' || c == '6' || c == '7' || c == '8' || c == '9';
-}
-constexpr ASCIIMaskArray sZeroToNineMask = CreateASCIIMask(TestZeroToNine);
-
-const ASCIIMaskArray& ASCIIMask::MaskWhitespace()
-{
-  return sWhitespaceMask;
-}
-
-const ASCIIMaskArray& ASCIIMask::MaskCRLF()
-{
-  return sCRLFMask;
-}
-
-const ASCIIMaskArray& ASCIIMask::MaskCRLFTab()
-{
-  return sCRLFTabMask;
-}
-
-const ASCIIMaskArray& ASCIIMask::Mask0to9()
-{
-  return sZeroToNineMask;
-}
-
-} // namespace mozilla
deleted file mode 100644
--- a/xpcom/string/nsASCIIMask.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsASCIIMask_h_
-#define nsASCIIMask_h_
-
-#include <array>
-#include "mozilla/IndexSequence.h"
-
-typedef std::array<bool, 128> ASCIIMaskArray;
-
-namespace mozilla {
-
-// Boolean arrays, fixed size and filled in at compile time, meant to
-// record something about each of the (standard) ASCII characters.
-// No extended ASCII for now, there has been no use case.
-// If you have loops that go through a string character by character
-// and test for equality to a certain set of characters before deciding
-// on a course of action, chances are building up one of these arrays
-// and using it is going to be faster, especially if the set of
-// characters is more than one long, and known at compile time.
-class ASCIIMask
-{
-public:
-  // Preset masks for some common character groups
-  // When testing, you must check if the index is < 128 or use IsMasked()
-  //
-  // if (someChar < 128 && MaskCRLF()[someChar]) this is \r or \n
-
-  static const ASCIIMaskArray& MaskCRLF();
-  static const ASCIIMaskArray& Mask0to9();
-  static const ASCIIMaskArray& MaskCRLFTab();
-  static const ASCIIMaskArray& MaskWhitespace();
-
-  static MOZ_ALWAYS_INLINE bool IsMasked(const ASCIIMaskArray& aMask, uint32_t aChar)
-  {
-    return aChar < 128 && aMask[aChar];
-  }
-};
-
-// Outside of the preset ones, use these templates to create more masks.
-//
-// The example creation will look like this:
-//
-// constexpr bool TestABC(char c) { return c == 'A' || c == 'B' || c == 'C'; }
-// constexpr std::array<bool, 128> sABCMask = CreateASCIIMask(TestABC);
-// ...
-// if (someChar < 128 && sABCMask[someChar]) this is A or B or C
-
-
-namespace details
-{
-template<typename F, size_t... Indices>
-constexpr std::array<bool, 128> CreateASCIIMask(F fun, mozilla::IndexSequence<Indices...>)
-{
-  return {{ fun(Indices)... }};
-}
-} // namespace details
-
-template<typename F>
-constexpr std::array<bool, 128> CreateASCIIMask(F fun)
-{
-  return details::CreateASCIIMask(fun, mozilla::MakeIndexSequence<128>::Type{});
-}
-
-} // namespace mozilla
-
-#endif // nsASCIIMask_h_
--- a/xpcom/string/nsStringObsolete.cpp
+++ b/xpcom/string/nsStringObsolete.cpp
@@ -535,16 +535,18 @@ StripChars2(char16_t* aString,uint32_t a
     }
     *to = 0;
   }
   return to - (char16_t*)aString;
 }
 
 /* ***** END RICKG BLOCK ***** */
 
+static const char* kWhitespace="\f\t\r\n ";
+
 // This function is used to implement FindCharInSet and friends
 template <class CharT>
 #ifndef __SUNPRO_CC
 static
 #endif /* !__SUNPRO_CC */
 CharT
 GetFindInSetFilter( const CharT* set)
 {
--- a/xpcom/string/nsTStringObsolete.cpp
+++ b/xpcom/string/nsTStringObsolete.cpp
@@ -1,16 +1,15 @@
 /* -*- 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 "nsTArray.h"
-#include "nsASCIIMask.h"
 #include "mozilla/CheckedInt.h"
 
 /**
  * nsTString::Find
  *
  * aOffset specifies starting index
  * aCount specifies number of string compares (iterations)
  */
@@ -397,49 +396,43 @@ nsTString_CharT::SetCharAt( char16_t aCh
 
 /**
  * nsTString::StripChars,StripChar,StripWhitespace
  */
 
 void
 nsTString_CharT::StripChars( const char* aSet )
 {
-  if (!StripChars(aSet, mozilla::fallible)) {
+  if (!EnsureMutable())
     AllocFailed(mLength);
-  }
+
+  mLength = nsBufferRoutines<CharT>::strip_chars(mData, mLength, aSet);
 }
 
 bool
 nsTString_CharT::StripChars( const char* aSet, const fallible_t& )
 {
   if (!EnsureMutable()) {
     return false;
   }
 
   mLength = nsBufferRoutines<CharT>::strip_chars(mData, mLength, aSet);
   return true;
 }
 
 void
 nsTString_CharT::StripWhitespace()
 {
-  if (!StripWhitespace(mozilla::fallible)) {
-    AllocFailed(mLength);
-  }
+  StripChars(kWhitespace);
 }
 
 bool
-nsTString_CharT::StripWhitespace( const fallible_t& )
+nsTString_CharT::StripWhitespace(const fallible_t& aFallible)
 {
-  if (!EnsureMutable()) {
-    return false;
-  }
-
-  StripTaggedASCII(mozilla::ASCIIMask::MaskWhitespace());
-  return true;
+  return StripChars(kWhitespace, aFallible);
 }
 
 /**
  * nsTString::ReplaceChar,ReplaceSubstring
  */
 
 void
 nsTString_CharT::ReplaceChar( char_type aOldChar, char_type aNewChar )
@@ -668,60 +661,29 @@ nsTString_CharT::Trim( const char* aSet,
 
     if (cutLength)
       Cut(cutEnd - cutLength, cutLength);
   }
 }
 
 
 /**
- * nsTString::CompressWhitespace.
+ * nsTString::CompressWhitespace
  */
 
 void
 nsTString_CharT::CompressWhitespace( bool aTrimLeading, bool aTrimTrailing )
 {
-  // Quick exit
-  if (mLength == 0) {
-    return;
-  }
-
-  if (!EnsureMutable())
-    AllocFailed(mLength);
-
-  const ASCIIMaskArray& mask = mozilla::ASCIIMask::MaskWhitespace();
-
-  char_type* to   = mData;
-  char_type* from = mData;
-  char_type* end  = mData + mLength;
+  const char* set = kWhitespace;
 
-  // Compresses runs of whitespace down to a normal space ' ' and convert
-  // any whitespace to a normal space.  This assumes that whitespace is
-  // all standard 7-bit ASCII.
-  bool skipWS = aTrimLeading;
-  while (from < end) {
-    uint32_t theChar = *from++;
-    if (mozilla::ASCIIMask::IsMasked(mask, theChar)) {
-      if (!skipWS) {
-        *to++ = ' ';
-        skipWS = true;
-      }
-    } else {
-      *to++ = theChar;
-      skipWS = false;
-    }
-  }
+  ReplaceChar(set, ' ');
+  Trim(set, aTrimLeading, aTrimTrailing);
 
-  // If we need to trim the trailing whitespace, back up one character.
-  if (aTrimTrailing && skipWS && to > mData) {
-    to--;
-  }
-
-  *to = char_type(0); // add the null
-  mLength = to - mData;
+  // this one does some questionable fu... just copying the old code!
+  mLength = nsBufferRoutines<char_type>::compress_chars(mData, mLength, set);
 }
 
 
 /**
  * nsTString::AssignWithConversion
  */
 
 void
--- a/xpcom/string/nsTSubstring.cpp
+++ b/xpcom/string/nsTSubstring.cpp
@@ -1,15 +1,14 @@
 /* -*- 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 "nsASCIIMask.h"
 #include "mozilla/CheckedInt.h"
 #include "mozilla/double-conversion.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Printf.h"
 
 using double_conversion::DoubleToStringConverter;
 
 const nsTSubstring_CharT::size_type nsTSubstring_CharT::kMaxCapacity =
@@ -877,18 +876,17 @@ nsTStringRepr_CharT::FindChar(char_type 
 }
 
 } // namespace detail
 } // namespace mozilla
 
 void
 nsTSubstring_CharT::StripChar(char_type aChar, int32_t aOffset)
 {
-  // Note that this implicitly guarantees mLength > 0
-  if (aOffset >= int32_t(mLength)) {
+  if (mLength == 0 || aOffset >= int32_t(mLength)) {
     return;
   }
 
   if (!EnsureMutable()) { // XXX do this lazily?
     AllocFailed(mLength);
   }
 
   // XXX(darin): this code should defer writing until necessary.
@@ -905,17 +903,16 @@ nsTSubstring_CharT::StripChar(char_type 
   }
   *to = char_type(0); // add the null
   mLength = to - mData;
 }
 
 void
 nsTSubstring_CharT::StripChars(const char_type* aChars, uint32_t aOffset)
 {
-  // Note that this implicitly guarantees mLength > 0
   if (aOffset >= uint32_t(mLength)) {
     return;
   }
 
   if (!EnsureMutable()) { // XXX do this lazily?
     AllocFailed(mLength);
   }
 
@@ -935,55 +932,16 @@ nsTSubstring_CharT::StripChars(const cha
       // Not stripped, copy this char.
       *to++ = theChar;
     }
   }
   *to = char_type(0); // add the null
   mLength = to - mData;
 }
 
-void
-nsTSubstring_CharT::StripTaggedASCII(const ASCIIMaskArray& aToStrip,
-                                     uint32_t aOffset)
-{
-  // Note that this implicitly guarantees mLength > 0
-  if (aOffset >= uint32_t(mLength)) {
-    return;
-  }
-
-  if (!EnsureMutable()) {
-    AllocFailed(mLength);
-  }
-
-  char_type* to   = mData + aOffset;
-  char_type* from = mData + aOffset;
-  char_type* end  = mData + mLength;
-
-  while (from < end) {
-    uint32_t theChar = (uint32_t)*from++;
-    // Replacing this with a call to ASCIIMask::IsMasked
-    // regresses performance somewhat, so leaving it inlined.
-    if (!mozilla::ASCIIMask::IsMasked(aToStrip, theChar)) {
-      // Not stripped, copy this char.
-      *to++ = (char_type)theChar;
-    }
-  }
-  *to = char_type(0); // add the null
-  mLength = to - mData;
-}
-
-void
-nsTSubstring_CharT::StripCRLF(uint32_t aOffset)
-{
-  // Expanding this call to copy the code from StripTaggedASCII
-  // instead of just calling it does somewhat help with performance
-  // but it is not worth it given the duplicated code.
-  StripTaggedASCII(mozilla::ASCIIMask::MaskCRLF(), aOffset);
-}
-
 struct MOZ_STACK_CLASS PrintfAppend_CharT : public mozilla::PrintfTarget
 {
   explicit PrintfAppend_CharT(nsTSubstring_CharT* aString)
     : mString(aString)
   {
   }
 
   bool append(const char* aStr, size_t aLen) override {
--- a/xpcom/string/nsTSubstring.h
+++ b/xpcom/string/nsTSubstring.h
@@ -1010,41 +1010,16 @@ public:
    *
    *  @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);
 
   /**
-   * This method is used to remove all occurrences of some characters this
-   * from this string.  The characters removed have the corresponding
-   * entries in the bool array set to true; we retain all characters
-   * with code beyond 127.
-   * THE CALLER IS RESPONSIBLE for making sure the complete boolean
-   * array, 128 entries, is properly initialized.
-   *
-   * See also: ASCIIMask class.
-   *
-   *  @param  aToStrip -- Array where each entry is true if the
-   *          corresponding ASCII character is to be stripped.  All
-   *          characters beyond code 127 are retained.  Note that this
-   *          parameter is of ASCIIMaskArray type, but we expand the typedef
-   *          to avoid having to include nsASCIIMask.h in this include file
-   *          as it brings other includes.
-   *  @param  aOffset -- where in this string to start stripping chars
-   */
-  void StripTaggedASCII(const std::array<bool, 128>& aToStrip, uint32_t aOffset = 0);
-
-  /**
-   * A shortcut to strip \r and \n.
-   */
-  void StripCRLF(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;
--- a/xpcom/tests/gtest/TestStrings.cpp
+++ b/xpcom/tests/gtest/TestStrings.cpp
@@ -1,26 +1,24 @@
 /* -*- 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 <stdio.h>
 #include <stdlib.h>
-#include "nsASCIIMask.h"
 #include "nsString.h"
 #include "nsStringBuffer.h"
 #include "nsReadableUtils.h"
 #include "nsCRTGlue.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/Unused.h"
 #include "nsTArray.h"
 #include "gtest/gtest.h"
-#include "gtest/MozGTestBench.h" // For MOZ_GTEST_BENCH
 
 namespace TestStrings {
 
 using mozilla::fallible;
 
 void test_assign_helper(const nsACString& in, nsACString &_retval)
 {
   _retval = in;
@@ -273,51 +271,35 @@ TEST(Strings, length)
 TEST(Strings, trim)
 {
   const char text[] = " a\t    $   ";
   const char set[] = " \t$";
 
   nsCString s(text);
   s.Trim(set);
   EXPECT_STREQ(s.get(), "a");
-
-  s.AssignLiteral("\t  \t\t  \t");
-  s.Trim(set);
-  EXPECT_STREQ(s.get(), "");
-
-  s.AssignLiteral(" ");
-  s.Trim(set);
-  EXPECT_STREQ(s.get(), "");
-
-  s.AssignLiteral(" ");
-  s.Trim(set, false, true);
-  EXPECT_STREQ(s.get(), "");
-
-  s.AssignLiteral(" ");
-  s.Trim(set, true, false);
-  EXPECT_STREQ(s.get(), "");
 }
 
 TEST(Strings, replace_substr)
 {
   const char text[] = "abc-ppp-qqq-ppp-xyz";
   nsCString s(text);
   s.ReplaceSubstring("ppp", "www");
   EXPECT_STREQ(s.get(), "abc-www-qqq-www-xyz");
 
-  s.AssignLiteral("foobar");
+  s.Assign("foobar");
   s.ReplaceSubstring("foo", "bar");
   s.ReplaceSubstring("bar", "");
   EXPECT_STREQ(s.get(), "");
 
-  s.AssignLiteral("foofoofoo");
+  s.Assign("foofoofoo");
   s.ReplaceSubstring("foo", "foo");
   EXPECT_STREQ(s.get(), "foofoofoo");
 
-  s.AssignLiteral("foofoofoo");
+  s.Assign("foofoofoo");
   s.ReplaceSubstring("of", "fo");
   EXPECT_STREQ(s.get(), "fofoofooo");
 }
 
 TEST(Strings, replace_substr_2)
 {
   const char *oldName = nullptr;
   const char *newName = "user";
@@ -333,96 +315,87 @@ TEST(Strings, replace_substr_2)
 
   // we expect that newAcctName will be unchanged.
   EXPECT_TRUE(newAcctName.Equals(acctName));
 }
 
 TEST(Strings, replace_substr_3)
 {
   nsCString s;
-  s.AssignLiteral("abcabcabc");
+  s.Assign("abcabcabc");
   s.ReplaceSubstring("ca", "X");
   EXPECT_STREQ(s.get(), "abXbXbc");
 
-  s.AssignLiteral("abcabcabc");
+  s.Assign("abcabcabc");
   s.ReplaceSubstring("ca", "XYZ");
   EXPECT_STREQ(s.get(), "abXYZbXYZbc");
 
-  s.AssignLiteral("abcabcabc");
+  s.Assign("abcabcabc");
   s.ReplaceSubstring("ca", "XY");
   EXPECT_STREQ(s.get(), "abXYbXYbc");
 
-  s.AssignLiteral("abcabcabc");
+  s.Assign("abcabcabc");
   s.ReplaceSubstring("ca", "XYZ!");
   EXPECT_STREQ(s.get(), "abXYZ!bXYZ!bc");
 
-  s.AssignLiteral("abcdabcdabcd");
+  s.Assign("abcdabcdabcd");
   s.ReplaceSubstring("bcd", "X");
   EXPECT_STREQ(s.get(), "aXaXaX");
 
-  s.AssignLiteral("abcdabcdabcd");
+  s.Assign("abcdabcdabcd");
   s.ReplaceSubstring("bcd", "XYZ!");
   EXPECT_STREQ(s.get(), "aXYZ!aXYZ!aXYZ!");
 
-  s.AssignLiteral("abcdabcdabcd");
+  s.Assign("abcdabcdabcd");
   s.ReplaceSubstring("bcd", "XY");
   EXPECT_STREQ(s.get(), "aXYaXYaXY");
 
-  s.AssignLiteral("abcdabcdabcd");
+  s.Assign("abcdabcdabcd");
   s.ReplaceSubstring("bcd", "XYZABC");
   EXPECT_STREQ(s.get(), "aXYZABCaXYZABCaXYZABC");
 
-  s.AssignLiteral("abcdabcdabcd");
+  s.Assign("abcdabcdabcd");
   s.ReplaceSubstring("bcd", "XYZ");
   EXPECT_STREQ(s.get(), "aXYZaXYZaXYZ");
 
-  s.AssignLiteral("abcdabcdabcd");
+  s.Assign("abcdabcdabcd");
   s.ReplaceSubstring("bcd", "XYZ!");
   EXPECT_STREQ(s.get(), "aXYZ!aXYZ!aXYZ!");
 
-  s.AssignLiteral("abcdabcdabcd");
+  s.Assign("abcdabcdabcd");
   s.ReplaceSubstring("ab", "X");
   EXPECT_STREQ(s.get(), "XcdXcdXcd");
 
-  s.AssignLiteral("abcdabcdabcd");
+  s.Assign("abcdabcdabcd");
   s.ReplaceSubstring("ab", "XYZABC");
   EXPECT_STREQ(s.get(), "XYZABCcdXYZABCcdXYZABCcd");
 
-  s.AssignLiteral("abcdabcdabcd");
+  s.Assign("abcdabcdabcd");
   s.ReplaceSubstring("ab", "XY");
   EXPECT_STREQ(s.get(), "XYcdXYcdXYcd");
 
-  s.AssignLiteral("abcdabcdabcd");
+  s.Assign("abcdabcdabcd");
   s.ReplaceSubstring("ab", "XYZ!");
   EXPECT_STREQ(s.get(), "XYZ!cdXYZ!cdXYZ!cd");
 
-  s.AssignLiteral("abcdabcdabcd");
+  s.Assign("abcdabcdabcd");
   s.ReplaceSubstring("notfound", "X");
   EXPECT_STREQ(s.get(), "abcdabcdabcd");
 
-  s.AssignLiteral("abcdabcdabcd");
+  s.Assign("abcdabcdabcd");
   s.ReplaceSubstring("notfound", "longlongstring");
   EXPECT_STREQ(s.get(), "abcdabcdabcd");
 }
 
 TEST(Strings, strip_ws)
 {
-  const char* texts[] = {"",
-                         " a    $   ",
-                         "Some\fother\t thing\r\n",
-                         "And   \f\t\r\n even\nmore\r \f"};
-  const char* results[] = {"",
-                           "a$",
-                           "Someotherthing",
-                           "Andevenmore"};
-  for (size_t i=0; i<sizeof(texts)/sizeof(texts[0]); i++) {
-    nsCString s(texts[i]);
-    s.StripWhitespace();
-    EXPECT_STREQ(s.get(), results[i]);
-  }
+  const char text[] = " a    $   ";
+  nsCString s(text);
+  s.StripWhitespace();
+  EXPECT_STREQ(s.get(), "a$");
 }
 
 TEST(Strings, equals_ic)
 {
   nsCString s;
   EXPECT_FALSE(s.LowerCaseEqualsLiteral("view-source"));
 }
 
@@ -667,17 +640,17 @@ TEST(Strings, rfindcharinset)
   EXPECT_EQ(index, 0);
 
   index = buf.RFindCharInSet("z?", 6);
   EXPECT_EQ(index, kNotFound);
 
   index = buf.RFindCharInSet("l", 5);
   EXPECT_EQ(index, 3);
 
-  buf.AssignLiteral("abcdefghijkabc");
+  buf.Assign("abcdefghijkabc");
 
   index = buf.RFindCharInSet("ab");
   EXPECT_EQ(index, 12);
 
   index = buf.RFindCharInSet("ab", 11);
   EXPECT_EQ(index, 11);
 
   index = buf.RFindCharInSet("ab", 10);
@@ -1084,295 +1057,9 @@ TEST(Strings, Split)
     } else if (counter == 1) {
       EXPECT_TRUE(token.Equals(NS_LITERAL_STRING("world")));
     }
     counter++;
   }
   EXPECT_EQ(counter, (size_t)2);
 }
 
-constexpr bool TestSomeChars(char c)
-{
-  return c == 'a' || c == 'c' || c == 'e' || c == '7' ||
-         c == 'G' || c == 'Z' || c == '\b' || c == '?';
-}
-TEST(Strings,ASCIIMask)
-{
-  const ASCIIMaskArray& maskCRLF = mozilla::ASCIIMask::MaskCRLF();
-  EXPECT_TRUE(maskCRLF['\n'] && mozilla::ASCIIMask::IsMasked(maskCRLF, '\n'));
-  EXPECT_TRUE(maskCRLF['\r'] && mozilla::ASCIIMask::IsMasked(maskCRLF, '\r'));
-  EXPECT_FALSE(maskCRLF['g'] || mozilla::ASCIIMask::IsMasked(maskCRLF, 'g'));
-  EXPECT_FALSE(maskCRLF[' '] || mozilla::ASCIIMask::IsMasked(maskCRLF, ' '));
-  EXPECT_FALSE(maskCRLF['\0'] || mozilla::ASCIIMask::IsMasked(maskCRLF, '\0'));
-  EXPECT_FALSE(mozilla::ASCIIMask::IsMasked(maskCRLF, 14324));
-
-  const ASCIIMaskArray& mask0to9 = mozilla::ASCIIMask::Mask0to9();
-  EXPECT_TRUE(mask0to9['9'] && mozilla::ASCIIMask::IsMasked(mask0to9, '9'));
-  EXPECT_TRUE(mask0to9['0'] && mozilla::ASCIIMask::IsMasked(mask0to9, '0'));
-  EXPECT_TRUE(mask0to9['4'] && mozilla::ASCIIMask::IsMasked(mask0to9, '4'));
-  EXPECT_FALSE(mask0to9['g'] || mozilla::ASCIIMask::IsMasked(mask0to9, 'g'));
-  EXPECT_FALSE(mask0to9[' '] || mozilla::ASCIIMask::IsMasked(mask0to9, ' '));
-  EXPECT_FALSE(mask0to9['\n'] || mozilla::ASCIIMask::IsMasked(mask0to9, '\n'));
-  EXPECT_FALSE(mask0to9['\0'] || mozilla::ASCIIMask::IsMasked(mask0to9, '\0'));
-  EXPECT_FALSE(mozilla::ASCIIMask::IsMasked(maskCRLF, 14324));
-
-  const ASCIIMaskArray& maskWS = mozilla::ASCIIMask::MaskWhitespace();
-  EXPECT_TRUE(maskWS[' '] && mozilla::ASCIIMask::IsMasked(maskWS, ' '));
-  EXPECT_TRUE(maskWS['\t'] && mozilla::ASCIIMask::IsMasked(maskWS, '\t'));
-  EXPECT_FALSE(maskWS['8'] || mozilla::ASCIIMask::IsMasked(maskWS, '8'));
-  EXPECT_FALSE(maskWS['\0'] || mozilla::ASCIIMask::IsMasked(maskWS, '\0'));
-  EXPECT_FALSE(mozilla::ASCIIMask::IsMasked(maskCRLF, 14324));
-
-  constexpr ASCIIMaskArray maskSome = mozilla::CreateASCIIMask(TestSomeChars);
-  EXPECT_TRUE(maskSome['a'] && mozilla::ASCIIMask::IsMasked(maskSome, 'a'));
-  EXPECT_TRUE(maskSome['c'] && mozilla::ASCIIMask::IsMasked(maskSome, 'c'));
-  EXPECT_TRUE(maskSome['e'] && mozilla::ASCIIMask::IsMasked(maskSome, 'e'));
-  EXPECT_TRUE(maskSome['7'] && mozilla::ASCIIMask::IsMasked(maskSome, '7'));
-  EXPECT_TRUE(maskSome['G'] && mozilla::ASCIIMask::IsMasked(maskSome, 'G'));
-  EXPECT_TRUE(maskSome['Z'] && mozilla::ASCIIMask::IsMasked(maskSome, 'Z'));
-  EXPECT_TRUE(maskSome['\b'] && mozilla::ASCIIMask::IsMasked(maskSome, '\b'));
-  EXPECT_TRUE(maskSome['?'] && mozilla::ASCIIMask::IsMasked(maskSome, '?'));
-  EXPECT_FALSE(maskSome['8'] || mozilla::ASCIIMask::IsMasked(maskSome, '8'));
-  EXPECT_FALSE(maskSome['\0'] || mozilla::ASCIIMask::IsMasked(maskSome, '\0'));
-  EXPECT_FALSE(mozilla::ASCIIMask::IsMasked(maskCRLF, 14324));
-}
-
-template <typename T> void
-CompressWhitespaceHelper()
-{
-  T s;
-  s.AssignLiteral("abcabcabc");
-  s.CompressWhitespace(true, true);
-  EXPECT_TRUE(s.EqualsLiteral("abcabcabc"));
-
-  s.AssignLiteral("   \n\rabcabcabc\r\n");
-  s.CompressWhitespace(true, true);
-  EXPECT_TRUE(s.EqualsLiteral("abcabcabc"));
-
-  s.AssignLiteral("   \n\rabc   abc   abc\r\n");
-  s.CompressWhitespace(true, true);
-  EXPECT_TRUE(s.EqualsLiteral("abc abc abc"));
-
-  s.AssignLiteral("   \n\rabc\r   abc\n   abc\r\n");
-  s.CompressWhitespace(true, true);
-  EXPECT_TRUE(s.EqualsLiteral("abc abc abc"));
-
-  s.AssignLiteral("   \n\rabc\r  \nabc\n   \rabc\r\n");
-  s.CompressWhitespace(true, true);
-  EXPECT_TRUE(s.EqualsLiteral("abc abc abc"));
-
-  s.AssignLiteral("   \n\rabc\r   abc\n   abc\r\n");
-  s.CompressWhitespace(false, true);
-  EXPECT_TRUE(s.EqualsLiteral(" abc abc abc"));
-
-  s.AssignLiteral("   \n\rabc\r   abc\n   abc\r\n");
-  s.CompressWhitespace(true, false);
-  EXPECT_TRUE(s.EqualsLiteral("abc abc abc "));
-
-  s.AssignLiteral("   \n\rabc\r   abc\n   abc\r\n");
-  s.CompressWhitespace(false, false);
-  EXPECT_TRUE(s.EqualsLiteral(" abc abc abc "));
-
-  s.AssignLiteral("  \r\n  ");
-  s.CompressWhitespace(true, true);
-  EXPECT_TRUE(s.EqualsLiteral(""));
-
-  s.AssignLiteral("  \r\n  \t");
-  s.CompressWhitespace(true, true);
-  EXPECT_TRUE(s.EqualsLiteral(""));
-
-  s.AssignLiteral("\n  \r\n  \t");
-  s.CompressWhitespace(false, false);
-  EXPECT_TRUE(s.EqualsLiteral(" "));
-
-  s.AssignLiteral("\n  \r\n  \t");
-  s.CompressWhitespace(false, true);
-  EXPECT_TRUE(s.EqualsLiteral(""));
-
-  s.AssignLiteral("\n  \r\n  \t");
-  s.CompressWhitespace(true, false);
-  EXPECT_TRUE(s.EqualsLiteral(""));
-
-  s.AssignLiteral("");
-  s.CompressWhitespace(false, false);
-  EXPECT_TRUE(s.EqualsLiteral(""));
-
-  s.AssignLiteral("");
-  s.CompressWhitespace(false, true);
-  EXPECT_TRUE(s.EqualsLiteral(""));
-
-  s.AssignLiteral("");
-  s.CompressWhitespace(true, false);
-  EXPECT_TRUE(s.EqualsLiteral(""));
-
-  s.AssignLiteral("");
-  s.CompressWhitespace(true, true);
-  EXPECT_TRUE(s.EqualsLiteral(""));
-}
-
-TEST(Strings, CompressWhitespace)
-{
-  CompressWhitespaceHelper<nsCString>();
-}
-
-TEST(Strings, CompressWhitespaceW)
-{
-  CompressWhitespaceHelper<nsString>();
-
-  nsString str, result;
-  str.AssignLiteral(u"\u263A    is\r\n   ;-)");
-  result.AssignLiteral(u"\u263A is ;-)");
-  str.CompressWhitespace(true, true);
-  EXPECT_TRUE(str == result);
-}
-
-template <typename T> void
-StripCRLFHelper()
-{
-  T s;
-  s.AssignLiteral("abcabcabc");
-  s.StripCRLF();
-  EXPECT_TRUE(s.EqualsLiteral("abcabcabc"));
-
-  s.AssignLiteral("   \n\rabcabcabc\r\n");
-  s.StripCRLF();
-  EXPECT_TRUE(s.EqualsLiteral("   abcabcabc"));
-
-  s.AssignLiteral("   \n\rabc   abc   abc\r\n");
-  s.StripCRLF();
-  EXPECT_TRUE(s.EqualsLiteral("   abc   abc   abc"));
-
-  s.AssignLiteral("   \n\rabc\r   abc\n   abc\r\n");
-  s.StripCRLF();
-  EXPECT_TRUE(s.EqualsLiteral("   abc   abc   abc"));
-
-  s.AssignLiteral("   \n\rabc\r  \nabc\n   \rabc\r\n");
-  s.StripCRLF();
-  EXPECT_TRUE(s.EqualsLiteral("   abc  abc   abc"));
-
-  s.AssignLiteral("   \n\rabc\r   abc\n   abc\r\n");
-  s.StripCRLF();
-  EXPECT_TRUE(s.EqualsLiteral("   abc   abc   abc"));
-
-  s.AssignLiteral("  \r\n  ");
-  s.StripCRLF();
-  EXPECT_TRUE(s.EqualsLiteral("    "));
-
-  s.AssignLiteral("  \r\n  \t");
-  s.StripCRLF();
-  EXPECT_TRUE(s.EqualsLiteral("    \t"));
-
-  s.AssignLiteral("\n  \r\n  \t");
-  s.StripCRLF();
-  EXPECT_TRUE(s.EqualsLiteral("    \t"));
-
-  s.AssignLiteral("");
-  s.StripCRLF();
-  EXPECT_TRUE(s.EqualsLiteral(""));
-}
-
-TEST(Strings, StripCRLF)
-{
-  StripCRLFHelper<nsCString>();
-}
-
-TEST(Strings, StripCRLFW)
-{
-  StripCRLFHelper<nsString>();
-
-  nsString str, result;
-  str.AssignLiteral(u"\u263A    is\r\n   ;-)");
-  result.AssignLiteral(u"\u263A    is   ;-)");
-  str.StripCRLF();
-  EXPECT_TRUE(str == result);
-}
-
-#define TestExample1 "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium,\n totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi\r architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur\n aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui\r\n\r dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"
-
-#define TestExample2 "At vero eos et accusamus et iusto odio dignissimos ducimus\n\n qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt\r\r  \n mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda       est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat."
-
-#define TestExample3 " Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis ac tellus eget velit viverra viverra id sit amet neque. Sed id consectetur mi, vestibulum aliquet arcu. Curabitur sagittis accumsan convallis. Sed eu condimentum ipsum, a laoreet tortor. Orci varius natoque penatibus et magnis dis    \r\r\n\n parturient montes, nascetur ridiculus mus. Sed non tellus nec ante sodales placerat a nec risus. Cras vel bibendum sapien, nec ullamcorper felis. Pellentesque congue eget nisi sit amet vehicula. Morbi pulvinar turpis justo, in commodo dolor vulputate id. Curabitur in dui urna. Vestibulum placerat dui in sem congue, ut faucibus nibh rutrum. Duis mattis turpis facilisis ullamcorper tincidunt. Vestibulum pharetra tortor at enim sagittis, dapibus consectetur ex blandit. Curabitur ac fringilla quam. In ornare lectus ut ipsum mattis venenatis. Etiam in mollis lectus, sed luctus risus.\nCras dapibus\f\t  \n finibus justo sit amet dictum. Aliquam non elit diam. Fusce magna nulla, bibendum in massa a, commodo finibus lectus. Sed rutrum a augue id imperdiet. Aliquam sagittis sodales felis, a tristique ligula. Aliquam erat volutpat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis volutpat interdum lorem et congue. Phasellus porttitor posuere justo eget euismod. Nam a condimentum turpis, sit amet gravida lacus. Vestibulum dolor diam, lobortis ac metus et, convallis dapibus tellus. Ut nec metus in velit malesuada tincidunt et eget justo. Curabitur ut libero bibendum, porttitor diam vitae, aliquet justo. "
-
-#define TestExample4 " Donec feugiat volutpat massa. Cras ornare lacinia porta. Fusce in feugiat nunc. Praesent non felis varius diam feugiat ultrices ultricies a risus. Donec maximus nisi nisl, non consectetur nulla eleifend in. Nulla in massa interdum, eleifend orci a, vestibulum est. Mauris aliquet, massa et convallis mollis, felis augue vestibulum augue, in lobortis metus eros a quam. Nam              ac diam ornare, vestibulum elit sit amet, consectetur ante. Praesent massa mauris, pulvinar sit amet sapien vel, tempus gravida neque. Praesent id quam sit amet est maximus molestie eget at turpis. Nunc sit amet orci id arcu dapibus fermentum non eu erat.\f\tSuspendisse commodo nunc sem, eu congue eros condimentum vel. Nullam sit amet posuere arcu. Nulla facilisi. Mauris dapibus iaculis massa sed gravida. Nullam vitae urna at tortor feugiat auctor ut sit amet dolor. Proin rutrum at nunc et faucibus. Quisque suscipit id nibh a aliquet. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aliquam a dapibus erat, id imperdiet mauris. Nulla blandit libero non magna dapibus tristique. Integer hendrerit imperdiet lorem, quis facilisis lacus semper ut. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae Nullam dignissim elit in congue ultricies. Quisque erat odio, maximus mollis laoreet id, iaculis at turpis. "
-
-#define TestExample5 "Donec id risus urna. Nunc consequat lacinia urna id bibendum. Nulla faucibus faucibus enim. Cras ex risus, ultrices id semper vitae, luctus ut nulla. Sed vehicula tellus sed purus imperdiet efficitur. Suspendisse feugiat\n\n\n     imperdiet odio, sed porta lorem feugiat nec. Curabitur laoreet massa venenatis\r\n risus ornare\r\n, vitae feugiat tortor accumsan. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas id scelerisque mauris, eget facilisis erat. Ut nec pulvinar risus, sed iaculis ante. Mauris tincidunt, risus et pretium elementum, leo nisi consectetur ligula, tincidunt suscipit erat velit eget libero. Sed ac est tempus, consequat dolor mattis, mattis mi. "
-
-// Note the five calls in the loop, so divide by 100k
-MOZ_GTEST_BENCH(Strings, PerfStripWhitespace, [] {
-    nsCString test1(TestExample1);
-    nsCString test2(TestExample2);
-    nsCString test3(TestExample3);
-    nsCString test4(TestExample4);
-    nsCString test5(TestExample5);
-    for (int i = 0; i < 20000; i++) {
-      test1.StripWhitespace();
-      test2.StripWhitespace();
-      test3.StripWhitespace();
-      test4.StripWhitespace();
-      test5.StripWhitespace();
-    }
-});
-
-MOZ_GTEST_BENCH(Strings, PerfStripCharsWhitespace, [] {
-    // This is the unoptimized (original) version of
-    // StripWhitespace using StripChars.
-    nsCString test1(TestExample1);
-    nsCString test2(TestExample2);
-    nsCString test3(TestExample3);
-    nsCString test4(TestExample4);
-    nsCString test5(TestExample5);
-    for (int i = 0; i < 20000; i++) {
-      test1.StripChars("\f\t\r\n ");
-      test2.StripChars("\f\t\r\n ");
-      test3.StripChars("\f\t\r\n ");
-      test4.StripChars("\f\t\r\n ");
-      test5.StripChars("\f\t\r\n ");
-    }
-});
-
-MOZ_GTEST_BENCH(Strings, PerfCompressWhitespace, [] {
-    nsCString test1(TestExample1);
-    nsCString test2(TestExample2);
-    nsCString test3(TestExample3);
-    nsCString test4(TestExample4);
-    nsCString test5(TestExample5);
-    for (int i = 0; i < 20000; i++) {
-      test1.CompressWhitespace();
-      test2.CompressWhitespace();
-      test3.CompressWhitespace();
-      test4.CompressWhitespace();
-      test5.CompressWhitespace();
-    }
-});
-
-MOZ_GTEST_BENCH(Strings, PerfStripCRLF, [] {
-    nsCString test1(TestExample1);
-    nsCString test2(TestExample2);
-    nsCString test3(TestExample3);
-    nsCString test4(TestExample4);
-    nsCString test5(TestExample5);
-    for (int i = 0; i < 20000; i++) {
-      test1.StripCRLF();
-      test2.StripCRLF();
-      test3.StripCRLF();
-      test4.StripCRLF();
-      test5.StripCRLF();
-    }
-});
-
-MOZ_GTEST_BENCH(Strings, PerfStripCharsCRLF, [] {
-    // This is the unoptimized (original) version of
-    // stripping \r\n using StripChars.
-    nsCString test1(TestExample1);
-    nsCString test2(TestExample2);
-    nsCString test3(TestExample3);
-    nsCString test4(TestExample4);
-    nsCString test5(TestExample5);
-    for (int i = 0; i < 20000; i++) {
-      test1.StripChars("\r\n");
-      test2.StripChars("\r\n");
-      test3.StripChars("\r\n");
-      test4.StripChars("\r\n");
-      test5.StripChars("\r\n");
-    }
-});
-
 } // namespace TestStrings
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -910,17 +910,17 @@ NS_IMETHODIMP nsXULWindow::GetTitle(char
     return NS_ERROR_OUT_OF_MEMORY;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsXULWindow::SetTitle(const char16_t* aTitle)
 {
   NS_ENSURE_STATE(mWindow);
   mTitle.Assign(aTitle);
-  mTitle.StripCRLF();
+  mTitle.StripChars("\n\r");
   NS_ENSURE_SUCCESS(mWindow->SetTitle(mTitle), NS_ERROR_FAILURE);
 
   // Tell the window mediator that a title has changed
   nsCOMPtr<nsIWindowMediator> windowMediator(do_GetService(NS_WINDOWMEDIATOR_CONTRACTID));
   if (!windowMediator)
     return NS_OK;
 
   windowMediator->UpdateWindowTitle(static_cast<nsIXULWindow*>(this), aTitle);