Bug 1875313 - Use en-US as a fallback when spoof English is enabled in ICUUtils. r=timhuang,tjr

Differential Revision: https://phabricator.services.mozilla.com/D198967
This commit is contained in:
Pier Angelo Vendrame 2024-01-31 21:52:30 +00:00
parent dc0461473d
commit 69ffaa7b95

View File

@ -41,7 +41,10 @@ already_AddRefed<nsAtom> ICUUtils::LanguageTagIterForContent::GetNext() {
if (mCurrentFallbackIndex < 2) { if (mCurrentFallbackIndex < 2) {
mCurrentFallbackIndex = 2; mCurrentFallbackIndex = 2;
// Else take the app's locale: // Else take the app's locale (or en-US, if spoof English applies):
if (mContent->OwnerDoc()->ShouldResistFingerprinting(RFPTarget::JSLocale)) {
return NS_Atomize("en-US");
}
nsAutoCString appLocale; nsAutoCString appLocale;
LocaleService::GetInstance()->GetAppLocaleAsBCP47(appLocale); LocaleService::GetInstance()->GetAppLocaleAsBCP47(appLocale);
return NS_Atomize(appLocale); return NS_Atomize(appLocale);