Bug 1626570 - Improve handling of copying arrays in intl/. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D72350
This commit is contained in:
Simon Giesecke 2020-05-05 09:46:19 +00:00
Родитель f13b476ee4
Коммит ce0c1f66e6
2 изменённых файлов: 12 добавлений и 12 удалений

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

@ -169,7 +169,7 @@ void LocaleService::AssignAppLocales(const nsTArray<nsCString>& aAppLocales) {
MOZ_ASSERT(!mIsServer,
"This should only be called for LocaleService in client mode.");
mAppLocales = aAppLocales;
mAppLocales = aAppLocales.Clone();
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->NotifyObservers(nullptr, "intl:app-locales-changed", nullptr);
@ -181,7 +181,7 @@ void LocaleService::AssignRequestedLocales(
MOZ_ASSERT(!mIsServer,
"This should only be called for LocaleService in client mode.");
mRequestedLocales = aRequestedLocales;
mRequestedLocales = aRequestedLocales.Clone();
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->NotifyObservers(nullptr, "intl:requested-locales-changed", nullptr);
@ -416,7 +416,7 @@ LocaleService::GetAppLocalesAsBCP47(nsTArray<nsCString>& aRetVal) {
if (mAppLocales.IsEmpty()) {
NegotiateAppLocales(mAppLocales);
}
aRetVal = mAppLocales;
aRetVal = mAppLocales.Clone();
return NS_OK;
}
@ -474,7 +474,7 @@ LocaleService::GetRegionalPrefsLocales(nsTArray<nsCString>& aRetVal) {
}
if (LocaleService::LanguagesMatch(appLocale, regionalPrefsLocales[0])) {
aRetVal = regionalPrefsLocales;
aRetVal = regionalPrefsLocales.Clone();
return NS_OK;
}
@ -491,7 +491,7 @@ LocaleService::GetWebExposedLocales(nsTArray<nsCString>& aRetVal) {
}
if (!mWebExposedLocales.IsEmpty()) {
aRetVal = mWebExposedLocales;
aRetVal = mWebExposedLocales.Clone();
return NS_OK;
}
@ -542,7 +542,7 @@ LocaleService::GetRequestedLocales(nsTArray<nsCString>& aRetVal) {
ReadRequestedLocales(mRequestedLocales);
}
aRetVal = mRequestedLocales;
aRetVal = mRequestedLocales.Clone();
return NS_OK;
}
@ -599,7 +599,7 @@ LocaleService::GetAvailableLocales(nsTArray<nsCString>& aRetVal) {
GetPackagedLocales(mAvailableLocales);
}
aRetVal = mAvailableLocales;
aRetVal = mAvailableLocales.Clone();
return NS_OK;
}
@ -640,6 +640,6 @@ LocaleService::GetPackagedLocales(nsTArray<nsCString>& aRetVal) {
if (mPackagedLocales.IsEmpty()) {
InitPackagedLocales();
}
aRetVal = mPackagedLocales;
aRetVal = mPackagedLocales.Clone();
return NS_OK;
}

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

@ -237,12 +237,12 @@ bool OSPreferences::GetDateTimeConnectorPattern(const nsACString& aLocale,
NS_IMETHODIMP
OSPreferences::GetSystemLocales(nsTArray<nsCString>& aRetVal) {
if (!mSystemLocales.IsEmpty()) {
aRetVal = mSystemLocales;
aRetVal = mSystemLocales.Clone();
return NS_OK;
}
if (ReadSystemLocales(aRetVal)) {
mSystemLocales = aRetVal;
mSystemLocales = aRetVal.Clone();
return NS_OK;
}
@ -270,12 +270,12 @@ OSPreferences::GetSystemLocale(nsACString& aRetVal) {
NS_IMETHODIMP
OSPreferences::GetRegionalPrefsLocales(nsTArray<nsCString>& aRetVal) {
if (!mRegionalPrefsLocales.IsEmpty()) {
aRetVal = mRegionalPrefsLocales;
aRetVal = mRegionalPrefsLocales.Clone();
return NS_OK;
}
if (ReadRegionalPrefsLocales(aRetVal)) {
mRegionalPrefsLocales = aRetVal;
mRegionalPrefsLocales = aRetVal.Clone();
return NS_OK;
}