Pier Angelo Vendrame pushed to branch base-browser-115.11.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits: 97a6b927 by Pier Angelo Vendrame at 2024-06-03T10:27:20+02:00 fixup! Bug 42397: Change RFP-spoofed TZ to Atlantic/Reykjavik.
Revert "Bug 42397: Change RFP-spoofed TZ to Atlantic/Reykjavik."
This reverts commit 6d9095b1fcfd0a89f9871301e1d9f0f561ff50be.
- - - - - 3d8c9a22 by hackademix at 2024-06-03T10:27:21+02:00 Bug 1835987 - Change RFP-spoofed TZ to Atlantic/Reykjavik. r=tjr
Atlantic/Reykjavik stays on UTC during all the year, but it is less likely to be blocked than plan UTC.
Differential Revision: https://phabricator.services.mozilla.com/D212131
- - - - - c774f31b by Pier Angelo Vendrame at 2024-06-03T10:27:21+02:00 fixup! Bug 41966: Allow removing locales from the locale alternatives list.
Revert "Bug 41966: Allow removing locales from the locale alternatives list."
This reverts commit bba294a4b4a78c8b2fa2cb31e4cb4aa0c86d058e.
- - - - - 81861e0c by Henry Wilkes at 2024-06-03T10:27:22+02:00 Bug 1851618 - Allow removing packaged locales from requestedLocales. r=settings-reviewers,eemeli,Gijs
We open up the UI to allow the user to remove locales from their requestedLocales list, except for the default locale.
Differential Revision: https://phabricator.services.mozilla.com/D209930 - - - - -
4 changed files:
- browser/components/preferences/dialogs/browserLanguages.js - browser/components/preferences/tests/browser_browser_languages_subdialog.js - browser/components/resistfingerprinting/test/browser/browser_timezone.js - js/src/vm/DateTime.cpp
Changes:
===================================== browser/components/preferences/dialogs/browserLanguages.js ===================================== @@ -327,8 +327,7 @@ class SortedItemSelectList { * @prop {string} id - A unique ID. * @prop {string} label - The localized display name. * @prop {string} value - The BCP 47 locale identifier or the word "search". - * @prop {boolean} canRemove - Locales that are part of the packaged locales cannot be - * removed. + * @prop {boolean} canRemove - The default locale cannot be removed. * @prop {boolean} installed - Whether or not the locale is installed. */
@@ -338,7 +337,6 @@ class SortedItemSelectList { */ async function getLocaleDisplayInfo(localeCodes) { let availableLocales = new Set(await LangPackMatcher.getAvailableLocales()); - let packagedLocales = new Set(Services.locale.packagedLocales); let localeNames = Services.intl.getLocaleDisplayNames( undefined, localeCodes, @@ -349,7 +347,7 @@ async function getLocaleDisplayInfo(localeCodes) { id: "locale-" + code, label: localeNames[i], value: code, - canRemove: code !== Services.locale.defaultLocale, + canRemove: code != Services.locale.defaultLocale, installed: availableLocales.has(code), }; });
===================================== browser/components/preferences/tests/browser_browser_languages_subdialog.js ===================================== @@ -142,18 +142,23 @@ async function createDictionaryBrowseResults() { return dir; }
-function assertLocaleOrder(list, locales) { +function assertLocaleOrder(list, locales, selectedLocale) { is( list.itemCount, locales.split(",").length, - "The right number of locales are selected" + "The right number of locales are in the list" ); is( Array.from(list.children) .map(child => child.value) .join(","), locales, - "The selected locales are in order" + "The listed locales are in order" + ); + is( + list.selectedItem.value, + selectedLocale, + "The selected item locale matches" ); }
@@ -219,6 +224,11 @@ async function selectLocale(localeCode, available, selected, dialogDoc) { await added; }
+// Select a locale from the list of already added locales. +function selectAddedLocale(localeCode, selected) { + selected.selectedItem = selected.querySelector(`[value="${localeCode}"]`); +} + async function openDialog(doc, search = false) { let dialogLoaded = promiseLoadSubDialog(BROWSER_LANGUAGES_URL); if (search) { @@ -283,7 +293,7 @@ add_task(async function testDisabledBrowserLanguages() { // pl is not selected since it's disabled. is(pl.userDisabled, true, "pl is disabled"); is(pl.version, "1.0", "pl is the old 1.0 version"); - assertLocaleOrder(selected, "en-US,he"); + assertLocaleOrder(selected, "en-US,he", "en-US");
// Wait for the children menu to be populated. await BrowserTestUtils.waitForCondition( @@ -313,7 +323,7 @@ add_task(async function testDisabledBrowserLanguages() {
// Add pl. await selectLocale("pl", available, selected, dialogDoc); - assertLocaleOrder(selected, "pl,en-US,he"); + assertLocaleOrder(selected, "pl,en-US,he", "pl");
// Find pl again since it's been upgraded. pl = await AddonManager.getAddonByID(langpackId("pl")); @@ -371,12 +381,12 @@ add_task(async function testReorderingBrowserLanguages() { let firstDialogId = getDialogId(dialogDoc);
// The initial order is set by the pref, filtered by available. - assertLocaleOrder(selected, "en-US,pl,he"); + assertLocaleOrder(selected, "en-US,pl,he", "en-US");
// Moving pl down changes the order. - selected.selectedItem = selected.querySelector("[value='pl']"); + selectAddedLocale("pl", selected); dialogDoc.getElementById("down").doCommand(); - assertLocaleOrder(selected, "en-US,he,pl"); + assertLocaleOrder(selected, "en-US,he,pl", "pl");
// Accepting the change shows the confirm message bar. let dialogClosed = BrowserTestUtils.waitForEvent(dialog, "dialogclosing"); @@ -404,13 +414,13 @@ add_task(async function testReorderingBrowserLanguages() { selected = newDialog.selected;
// The initial order comes from the previous settings. - assertLocaleOrder(selected, "en-US,he,pl"); + assertLocaleOrder(selected, "en-US,he,pl", "en-US");
// Select pl in the list. - selected.selectedItem = selected.querySelector("[value='pl']"); + selectAddedLocale("pl", selected); // Move pl back up. dialogDoc.getElementById("up").doCommand(); - assertLocaleOrder(selected, "en-US,pl,he"); + assertLocaleOrder(selected, "en-US,pl,he", "pl");
// Accepting the change hides the confirm message bar. dialogClosed = BrowserTestUtils.waitForEvent(dialog, "dialogclosing"); @@ -485,25 +495,42 @@ add_task(async function testAddAndRemoveSelectedLanguages() { } ); // The initial order is set by the pref. - assertLocaleOrder(selected, "en-US"); + assertLocaleOrder(selected, "en-US", "en-US"); assertAvailableLocales(available, ["fr", "pl", "he"]);
+ let removeButton = dialogDoc.getElementById("remove"); + // Cannot remove the default locale. + is(removeButton.disabled, true, "Remove en-US should be disabled"); + // Add pl and fr to selected. await selectLocale("pl", available, selected, dialogDoc); await selectLocale("fr", available, selected, dialogDoc);
- assertLocaleOrder(selected, "fr,pl,en-US"); + assertLocaleOrder(selected, "fr,pl,en-US", "fr"); assertAvailableLocales(available, ["he"]);
+ // Can remove the added locale again. + is(removeButton.disabled, false, "Remove fr should be not be disabled"); + + selectAddedLocale("en-US", selected); + // Cannot remove the default locale, even after adding more. + is(removeButton.disabled, true, "Remove en-us should still be disabled"); + // Remove pl and fr from selected. - dialogDoc.getElementById("remove").doCommand(); - dialogDoc.getElementById("remove").doCommand(); - assertLocaleOrder(selected, "en-US"); + selectAddedLocale("fr", selected); + is(removeButton.disabled, false, "Remove fr should be not be disabled"); + removeButton.doCommand(); + // Selection moves to pl. + assertLocaleOrder(selected, "pl,en-US", "pl"); + is(removeButton.disabled, false, "Remove pl should be not be disabled"); + removeButton.doCommand(); + assertLocaleOrder(selected, "en-US", "en-US"); assertAvailableLocales(available, ["fr", "pl", "he"]); + is(removeButton.disabled, true, "Remove en-us should be disabled at end");
// Add he to selected. await selectLocale("he", available, selected, dialogDoc); - assertLocaleOrder(selected, "he,en-US"); + assertLocaleOrder(selected, "he,en-US", "he"); assertAvailableLocales(available, ["pl", "fr"]);
// Accepting the change shows the confirm message bar. @@ -603,7 +630,7 @@ add_task(async function testInstallFromAMO() { }
// The initial order is set by the pref. - assertLocaleOrder(selected, "en-US"); + assertLocaleOrder(selected, "en-US", "en-US"); assertAvailableLocales(available, ["fr", "he", "pl"]); is( Services.locale.availableLocales.join(","), @@ -633,7 +660,7 @@ add_task(async function testInstallFromAMO() { );
// Verify the list is correct. - assertLocaleOrder(selected, "pl,en-US"); + assertLocaleOrder(selected, "pl,en-US", "pl"); assertAvailableLocales(available, ["fr", "he"]); is( Services.locale.availableLocales.sort().join(","), @@ -658,7 +685,7 @@ add_task(async function testInstallFromAMO() {
// Move pl down the list, which prevents an error since it isn't valid. dialogDoc.getElementById("down").doCommand(); - assertLocaleOrder(selected, "en-US,pl"); + assertLocaleOrder(selected, "en-US,pl", "pl");
// Test that disabling the langpack removes it from the list. let dialogClosed = BrowserTestUtils.waitForEvent(dialog, "dialogclosing"); @@ -683,7 +710,7 @@ add_task(async function testInstallFromAMO() { target => available.itemCount > 1 ); } - assertLocaleOrder(selected, "en-US"); + assertLocaleOrder(selected, "en-US", "en-US"); assertAvailableLocales(available, ["fr", "he", "pl"]);
// Uninstall the langpack and dictionary.
===================================== browser/components/resistfingerprinting/test/browser/browser_timezone.js ===================================== @@ -18,13 +18,13 @@ async function verifySpoofed() { function test() { let date = new Date(); const TZ_NAME = "Atlantic/Reykjavik"; - const TZ_SUFFIX = "(Greenwich Mean Time)"; + const TZ_SUFFIX = "Greenwich Mean Time"; ok( - date.toString().endsWith(TZ_SUFFIX), + date.toString().endsWith(`(${TZ_SUFFIX})`), `The date toString() is in ${TZ_NAME} timezone.` ); ok( - date.toTimeString().endsWith(TZ_SUFFIX), + date.toTimeString().endsWith(`(${TZ_SUFFIX})`), `The date toTimeString() is in ${TZ_NAME} timezone.` ); let dateTimeFormat = Intl.DateTimeFormat("en-US", {
===================================== js/src/vm/DateTime.cpp ===================================== @@ -484,11 +484,12 @@ bool js::DateTimeInfo::internalTimeZoneDisplayName(char16_t* buf, size_t buflen,
mozilla::intl::TimeZone* js::DateTimeInfo::timeZone() { if (!timeZone_) { - // For resist finger printing mode we always use the Atlantic/Reykjavik time zone - // as a "real world" UTC equivalent. + // For resist finger printing mode we always use the Atlantic/Reykjavik time + // zone as a "real world" UTC equivalent. mozilla::Maybe<mozilla::Span<const char16_t>> timeZoneOverride; if (shouldResistFingerprinting_) { - timeZoneOverride = mozilla::Some(mozilla::MakeStringSpan(u"Atlantic/Reykjavik")); + timeZoneOverride = + mozilla::Some(mozilla::MakeStringSpan(u"Atlantic/Reykjavik")); }
auto timeZone = mozilla::intl::TimeZone::TryCreate(timeZoneOverride);
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/9054cfc...