Bug 1402666 - Part 1: Replace Replace("") with ReplaceLiteral(""). r=erahm

MozReview-Commit-ID: s2hrTSkBiJ

--HG--
extra : rebase_source : d3b3551ed7ed1d5c8f70fc98d72510a13868ada1
extra : source : 1c45e10702e7884cd536a25b1d39c3de90fd2914
This commit is contained in:
Chris Peterson 2017-09-15 19:22:58 -07:00
Родитель ec6e052af1
Коммит 14c40f3dac
7 изменённых файлов: 15 добавлений и 14 удалений

Просмотреть файл

@ -258,32 +258,32 @@ nsDefaultURIFixup::GetFixupURIInfo(const nsACString& aStringURI,
// 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;
}

Просмотреть файл

@ -10983,7 +10983,7 @@ IsConsideredSameOriginForUIR(nsIPrincipal* aTriggeringPrincipal,
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);

Просмотреть файл

@ -297,7 +297,7 @@ CollectWindowReports(nsGlobalWindow *aWindow,
// 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);

Просмотреть файл

@ -113,7 +113,7 @@ nsHyphenationManager::GetHyphenator(nsIAtom *aLocale)
}
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 {

Просмотреть файл

@ -11,7 +11,7 @@ static nsAutoCString nt(nsAutoCString 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");
@ -21,10 +21,11 @@ static nsAutoCString nt(nsAutoCString aDatetime)
// 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;
}

Просмотреть файл

@ -1384,7 +1384,7 @@ nsStandardURL::GetSensitiveInfoHiddenSpec(nsACString &result)
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;

Просмотреть файл

@ -60,7 +60,7 @@ SetTime(PRTime offsetTime,nsAutoCString& serverString,nsAutoCString& cookieStrin
// 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);
}