Bug 1402666 - Part 1: Replace Replace("") with ReplaceLiteral(""). r=erahm
authorChris Peterson <cpeterson@mozilla.com>
Fri, 15 Sep 2017 19:22:58 -0700
changeset 383277 07ba2828b1b07ccb74923734767905dc352fafe0
parent 383276 8ba719124ab62b79ca77510c0a979604830f9c5e
child 383278 f6ec34a9d13aca6643ac33f4172291f7f464ab49
push id32588
push userkwierso@gmail.com
push dateWed, 27 Sep 2017 23:52:56 +0000
treeherdermozilla-central@5ebe2e8980c6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1402666
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1402666 - Part 1: Replace Replace("") with ReplaceLiteral(""). r=erahm MozReview-Commit-ID: s2hrTSkBiJ
docshell/base/nsDefaultURIFixup.cpp
docshell/base/nsDocShell.cpp
dom/base/nsWindowMemoryReporter.cpp
intl/hyphenation/glue/nsHyphenationManager.cpp
intl/locale/tests/gtest/TestDateTimeFormat.cpp
netwerk/base/nsStandardURL.cpp
netwerk/test/TestCookie.cpp
--- a/docshell/base/nsDefaultURIFixup.cpp
+++ b/docshell/base/nsDefaultURIFixup.cpp
@@ -253,42 +253,42 @@ nsDefaultURIFixup::GetFixupURIInfo(const
     if (scheme.IsEmpty() ||
         scheme.LowerCaseEqualsLiteral("http") ||
         scheme.LowerCaseEqualsLiteral("https") ||
         scheme.LowerCaseEqualsLiteral("ftp") ||
         scheme.LowerCaseEqualsLiteral("file")) {
       // Do nothing.
     } else if (scheme.LowerCaseEqualsLiteral("ttp")) {
       // ttp -> http.
-      uriString.Replace(0, 3, "http");
+      uriString.ReplaceLiteral(0, 3, "http");
       scheme.AssignLiteral("http");
       info->mFixupChangedProtocol = true;
     } else if (scheme.LowerCaseEqualsLiteral("ttps")) {
       // ttps -> https.
-      uriString.Replace(0, 4, "https");
+      uriString.ReplaceLiteral(0, 4, "https");
       scheme.AssignLiteral("https");
       info->mFixupChangedProtocol = true;
     } else if (scheme.LowerCaseEqualsLiteral("tps")) {
       // tps -> https.
-      uriString.Replace(0, 3, "https");
+      uriString.ReplaceLiteral(0, 3, "https");
       scheme.AssignLiteral("https");
       info->mFixupChangedProtocol = true;
     } else if (scheme.LowerCaseEqualsLiteral("ps")) {
       // ps -> https.
-      uriString.Replace(0, 2, "https");
+      uriString.ReplaceLiteral(0, 2, "https");
       scheme.AssignLiteral("https");
       info->mFixupChangedProtocol = true;
     } else if (scheme.LowerCaseEqualsLiteral("ile")) {
       // ile -> file.
-      uriString.Replace(0, 3, "file");
+      uriString.ReplaceLiteral(0, 3, "file");
       scheme.AssignLiteral("file");
       info->mFixupChangedProtocol = true;
     } else if (scheme.LowerCaseEqualsLiteral("le")) {
       // le -> file.
-      uriString.Replace(0, 2, "file");
+      uriString.ReplaceLiteral(0, 2, "file");
       scheme.AssignLiteral("file");
       info->mFixupChangedProtocol = true;
     }
   }
 
   // Now we need to check whether "scheme" is something we don't
   // really know about.
   nsCOMPtr<nsIProtocolHandler> ourHandler, extHandler;
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -10978,17 +10978,17 @@ IsConsideredSameOriginForUIR(nsIPrincipa
   if (!resultScheme.EqualsLiteral("http")) {
     return false;
   }
 
   nsAutoCString tmpResultSpec;
   rv = resultURI->GetSpec(tmpResultSpec);
   NS_ENSURE_SUCCESS(rv, false);
   // replace http with https
-  tmpResultSpec.Replace(0, 4, "https");
+  tmpResultSpec.ReplaceLiteral(0, 4, "https");
 
   nsCOMPtr<nsIURI> tmpResultURI;
   rv = NS_NewURI(getter_AddRefs(tmpResultURI), tmpResultSpec);
   NS_ENSURE_SUCCESS(rv, false);
 
   mozilla::OriginAttributes tmpOA =
     BasePrincipal::Cast(aResultPrincipal)->OriginAttributesRef();
 
--- a/dom/base/nsWindowMemoryReporter.cpp
+++ b/dom/base/nsWindowMemoryReporter.cpp
@@ -292,17 +292,17 @@ CollectWindowReports(nsGlobalWindow *aWi
   }
 
   windowPath += NS_LITERAL_CSTRING("window(");
   AppendWindowURI(aWindow, windowPath, aAnonymize);
   windowPath += NS_LITERAL_CSTRING(")");
 
   // Use |windowPath|, but replace "explicit/" with "event-counts/".
   nsCString censusWindowPath(windowPath);
-  censusWindowPath.Replace(0, strlen("explicit"), "event-counts");
+  censusWindowPath.ReplaceLiteral(0, strlen("explicit"), "event-counts");
 
   // Remember the path for later.
   aWindowPaths->Put(aWindow->WindowID(), windowPath);
 
 // Report the size from windowSizes and add to the appropriate total in
 // aWindowTotalSizes.
 #define REPORT_SIZE(_pathTail, _field, _desc) \
   ReportSize(windowPath, _pathTail, windowSizes._field, \
--- a/intl/hyphenation/glue/nsHyphenationManager.cpp
+++ b/intl/hyphenation/glue/nsHyphenationManager.cpp
@@ -108,17 +108,17 @@ nsHyphenationManager::GetHyphenator(nsIA
       // successive trailing subtags with "-*" to find fallback patterns,
       // so "de-DE-1996" -> "de-DE-*" (and then recursively -> "de-*")
       nsAtomCString localeStr(aLocale);
       if (StringEndsWith(localeStr, NS_LITERAL_CSTRING("-*"))) {
         localeStr.Truncate(localeStr.Length() - 2);
       }
       int32_t i = localeStr.RFindChar('-');
       if (i > 1) {
-        localeStr.Replace(i, localeStr.Length() - i, "-*");
+        localeStr.ReplaceLiteral(i, localeStr.Length() - i, "-*");
         nsCOMPtr<nsIAtom> fuzzyLocale = NS_Atomize(localeStr);
         return GetHyphenator(fuzzyLocale);
       } else {
         return nullptr;
       }
     }
   }
   hyph = new nsHyphenator(uri);
--- a/intl/locale/tests/gtest/TestDateTimeFormat.cpp
+++ b/intl/locale/tests/gtest/TestDateTimeFormat.cpp
@@ -6,30 +6,31 @@ namespace mozilla {
 // Normalise time.
 static nsAutoCString nt(nsAutoCString aDatetime)
 {
   nsAutoCString datetime = aDatetime;
 
   // Replace "January 01" with "January 1" (found on Windows).
   int32_t ind = datetime.Find("January 01");
   if (ind != kNotFound)
-    datetime.Replace(ind, 10, "January 1");
+    datetime.ReplaceLiteral(ind, 10, "January 1");
 
   // Strip trailing " GMT" (found on Mac/Linux).
   ind = datetime.Find(" GMT");
   if (ind != kNotFound)
     datetime.Truncate(ind);
 
   // Strip leading "Thursday, " or "Wednesday, " (found on Windows).
   ind = datetime.Find("Thursday, ");
   if (ind == 0)
-    datetime.Replace(0, 10, "");
+    datetime.ReplaceLiteral(0, 10, "");
+
   ind = datetime.Find("Wednesday, ");
   if (ind == 0)
-    datetime.Replace(0, 11, "");
+    datetime.ReplaceLiteral(0, 11, "");
 
   return datetime;
 }
 
 TEST(DateTimeFormat, FormatPRExplodedTime) {
   PRTime prTime = 0;
   PRExplodedTime prExplodedTime;
   PR_ExplodeTime(prTime, PR_GMTParameters, &prExplodedTime);
--- a/netwerk/base/nsStandardURL.cpp
+++ b/netwerk/base/nsStandardURL.cpp
@@ -1379,17 +1379,17 @@ nsStandardURL::GetSpec(nsACString &resul
 NS_IMETHODIMP
 nsStandardURL::GetSensitiveInfoHiddenSpec(nsACString &result)
 {
     nsresult rv = GetSpec(result);
     if (NS_FAILED(rv)) {
         return rv;
     }
     if (mPassword.mLen >= 0) {
-      result.Replace(mPassword.mPos, mPassword.mLen, "****");
+      result.ReplaceLiteral(mPassword.mPos, mPassword.mLen, "****");
     }
     CALL_RUST_GETTER_STR(result, GetSensitiveInfoHiddenSpec, result);
     return NS_OK;
 }
 
 // result may contain unescaped UTF-8 characters
 NS_IMETHODIMP
 nsStandardURL::GetSpecIgnoringRef(nsACString &result)
--- a/netwerk/test/TestCookie.cpp
+++ b/netwerk/test/TestCookie.cpp
@@ -55,17 +55,17 @@ SetTime(PRTime offsetTime,nsAutoCString&
     PRExplodedTime explodedTime;
     PR_ExplodeTime(SetCookieTime , PR_GMTParameters, &explodedTime);
     PR_FormatTimeUSEnglish(timeStringPreset, 40, "%c GMT", &explodedTime);
     serverString.Assign(timeStringPreset);
 
     // Set cookie string
     PR_ExplodeTime(SetExpiryTime , PR_GMTParameters, &explodedTime);
     PR_FormatTimeUSEnglish(timeStringPreset, 40, "%c GMT", &explodedTime);
-    cookieString.Replace(0, strlen("test=expiry; expires=") + strlen(timeStringPreset) + 1, "test=expiry; expires=");
+    cookieString.ReplaceLiteral(0, strlen("test=expiry; expires=") + strlen(timeStringPreset) + 1, "test=expiry; expires=");
     cookieString.Append(timeStringPreset);
 }
 
 void
 SetACookie(nsICookieService *aCookieService, const char *aSpec1, const char *aSpec2, const char* aCookieString, const char *aServerTime)
 {
     nsCOMPtr<nsIURI> uri1, uri2;
     NS_NewURI(getter_AddRefs(uri1), aSpec1);