Bug 1518326 - Sanity check US region against timezone. r=adw

Differential Revision: https://phabricator.services.mozilla.com/D16073

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michael Kaply 2019-01-15 22:16:52 +00:00
parent 70607728d5
commit 8e0dcc0e08
2 changed files with 14 additions and 7 deletions

View File

@ -2192,7 +2192,7 @@ BrowserGlue.prototype = {
_migrateUI: function BG__migrateUI() {
// Use an increasing number to keep track of the current migration state.
// Completely unrelated to the current Firefox release number.
const UI_VERSION = 77;
const UI_VERSION = 78;
const BROWSER_DOCURL = AppConstants.BROWSER_CHROME_URL;
let currentUIVersion;
@ -2531,10 +2531,6 @@ BrowserGlue.prototype = {
}
}
if (currentUIVersion < 74) {
Services.prefs.clearUserPref("browser.search.region");
}
if (currentUIVersion < 75) {
// Ensure we try to migrate any live bookmarks the user might have, trying up to
// 5 times. We set this early, and here, to avoid running the migration on
@ -2561,6 +2557,10 @@ BrowserGlue.prototype = {
}
}
if (currentUIVersion < 78) {
Services.prefs.clearUserPref("browser.search.region");
}
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},

View File

@ -440,13 +440,20 @@ var ensureKnownRegion = async function(ss) {
// Store the result of the geoip request as well as any other values and
// telemetry which depend on it.
function storeRegion(region) {
Services.prefs.setCharPref("browser.search.region", region);
// and telemetry...
let isTimezoneUS = isUSTimezone();
// If it's a US region, but not a US timezone, we don't store the value.
// This works because no region defaults to ZZ (unknown) in nsURLFormatter
if (region != "US" || isTimezoneUS) {
Services.prefs.setCharPref("browser.search.region", region);
}
// and telemetry...
if (region == "US" && !isTimezoneUS) {
LOG("storeRegion mismatch - US Region, non-US timezone");
Services.telemetry.getHistogramById("SEARCH_SERVICE_US_COUNTRY_MISMATCHED_TIMEZONE").add(1);
}
if (region != "US" && isTimezoneUS) {
LOG("storeRegion mismatch - non-US Region, US timezone");
Services.telemetry.getHistogramById("SEARCH_SERVICE_US_TIMEZONE_MISMATCHED_COUNTRY").add(1);
}
// telemetry to compare our geoip response with platform-specific country data.