diff --git a/intl/locale/LocaleService.cpp b/intl/locale/LocaleService.cpp index 2bce3e948068..765a44b2b18c 100644 --- a/intl/locale/LocaleService.cpp +++ b/intl/locale/LocaleService.cpp @@ -169,7 +169,7 @@ void LocaleService::AssignAppLocales(const nsTArray& aAppLocales) { MOZ_ASSERT(!mIsServer, "This should only be called for LocaleService in client mode."); - mAppLocales = aAppLocales; + mAppLocales = aAppLocales.Clone(); nsCOMPtr 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 obs = mozilla::services::GetObserverService(); if (obs) { obs->NotifyObservers(nullptr, "intl:requested-locales-changed", nullptr); @@ -416,7 +416,7 @@ LocaleService::GetAppLocalesAsBCP47(nsTArray& aRetVal) { if (mAppLocales.IsEmpty()) { NegotiateAppLocales(mAppLocales); } - aRetVal = mAppLocales; + aRetVal = mAppLocales.Clone(); return NS_OK; } @@ -474,7 +474,7 @@ LocaleService::GetRegionalPrefsLocales(nsTArray& aRetVal) { } if (LocaleService::LanguagesMatch(appLocale, regionalPrefsLocales[0])) { - aRetVal = regionalPrefsLocales; + aRetVal = regionalPrefsLocales.Clone(); return NS_OK; } @@ -491,7 +491,7 @@ LocaleService::GetWebExposedLocales(nsTArray& aRetVal) { } if (!mWebExposedLocales.IsEmpty()) { - aRetVal = mWebExposedLocales; + aRetVal = mWebExposedLocales.Clone(); return NS_OK; } @@ -542,7 +542,7 @@ LocaleService::GetRequestedLocales(nsTArray& aRetVal) { ReadRequestedLocales(mRequestedLocales); } - aRetVal = mRequestedLocales; + aRetVal = mRequestedLocales.Clone(); return NS_OK; } @@ -599,7 +599,7 @@ LocaleService::GetAvailableLocales(nsTArray& aRetVal) { GetPackagedLocales(mAvailableLocales); } - aRetVal = mAvailableLocales; + aRetVal = mAvailableLocales.Clone(); return NS_OK; } @@ -640,6 +640,6 @@ LocaleService::GetPackagedLocales(nsTArray& aRetVal) { if (mPackagedLocales.IsEmpty()) { InitPackagedLocales(); } - aRetVal = mPackagedLocales; + aRetVal = mPackagedLocales.Clone(); return NS_OK; } diff --git a/intl/locale/OSPreferences.cpp b/intl/locale/OSPreferences.cpp index f816ca57abfe..e4f289755afd 100644 --- a/intl/locale/OSPreferences.cpp +++ b/intl/locale/OSPreferences.cpp @@ -237,12 +237,12 @@ bool OSPreferences::GetDateTimeConnectorPattern(const nsACString& aLocale, NS_IMETHODIMP OSPreferences::GetSystemLocales(nsTArray& 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& aRetVal) { if (!mRegionalPrefsLocales.IsEmpty()) { - aRetVal = mRegionalPrefsLocales; + aRetVal = mRegionalPrefsLocales.Clone(); return NS_OK; } if (ReadRegionalPrefsLocales(aRetVal)) { - mRegionalPrefsLocales = aRetVal; + mRegionalPrefsLocales = aRetVal.Clone(); return NS_OK; }