diff --git a/toolkit/components/telemetry/app/TelemetryEnvironment.jsm b/toolkit/components/telemetry/app/TelemetryEnvironment.jsm index 7c6eac92e96f..eaa87c673f6a 100644 --- a/toolkit/components/telemetry/app/TelemetryEnvironment.jsm +++ b/toolkit/components/telemetry/app/TelemetryEnvironment.jsm @@ -48,21 +48,6 @@ const MAX_EXPERIMENT_TYPE_LENGTH = 20; // eslint-disable-next-line no-unused-vars var Policy = { now: () => new Date(), - _intlLoaded: false, - _browserDelayedStartup() { - if (Policy._intlLoaded) { - return Promise.resolve(); - } - return new Promise(resolve => { - let startupTopic = "browser-delayed-startup-finished"; - Services.obs.addObserver(function observer(subject, topic) { - if (topic == startupTopic) { - Services.obs.removeObserver(observer, startupTopic); - resolve(); - } - }, startupTopic); - }); - }, }; // This is used to buffer calls to setExperimentActive and friends, so that we @@ -335,22 +320,6 @@ function getSystemLocale() { } } -function getIntlSettings() { - let osprefs = Cc["@mozilla.org/intl/ospreferences;1"].getService(Ci.mozIOSPreferences); - return { - requestedLocales: Services.locale.requestedLocales, - availableLocales: Services.locale.availableLocales, - appLocales: Services.locale.appLocalesAsBCP47, - systemLocales: osprefs.systemLocales, - regionalPrefsLocales: osprefs.regionalPrefsLocales, - acceptLanguages: - Services.prefs.getComplexValue("intl.accept_languages", Ci.nsIPrefLocalizedString) - .data - .split(",") - .map(str => str.trim()), - }; -} - /** * Safely get a sysinfo property and return its value. If the property is not * available, return aDefault. @@ -935,7 +904,6 @@ function EnvironmentCache() { p.push(this._loadAttributionAsync()); } p.push(this._loadAutoUpdateAsync()); - p.push(this._loadIntlData()); for (const [id, {branch, options}] of gActiveExperimentStartupBuffer.entries()) { this.setExperimentActive(id, branch, options); @@ -1448,9 +1416,6 @@ EnvironmentCache.prototype = { e10sMultiProcesses: Services.appinfo.maxWebProcessCount, telemetryEnabled: Utils.isTelemetryEnabled, locale: getBrowserLocale(), - // We need to wait for browser-delayed-startup-finished to ensure that the locales - // have settled, once that's happened we can get the intl data directly. - intl: Policy._intlLoaded ? getIntlSettings() : {}, update: { channel: updateChannel, enabled: !Services.policies || Services.policies.isAllowed("appUpdate"), @@ -1566,17 +1531,6 @@ EnvironmentCache.prototype = { this._currentEnvironment.settings.update.autoDownload = this._updateAutoDownloadCache; }, - /** - * Get i18n data about the system. - * @return A promise of completion. - */ - async _loadIntlData() { - // Wait for the startup topic. - await Policy._browserDelayedStartup(); - this._currentEnvironment.settings.intl = getIntlSettings(); - Policy._intlLoaded = true; - }, - /** * Get the partner data in object form. * @return Object containing the partner data. diff --git a/toolkit/components/telemetry/docs/data/environment.rst b/toolkit/components/telemetry/docs/data/environment.rst index b00768ae459d..4c53c5d1fd47 100644 --- a/toolkit/components/telemetry/docs/data/environment.rst +++ b/toolkit/components/telemetry/docs/data/environment.rst @@ -48,14 +48,6 @@ Structure: e10sEnabled: , // whether e10s is on, i.e. browser tabs open by default in a different process telemetryEnabled: , // false on failure locale: , // e.g. "it", null on failure - intl: { - requestedLocales: [ , ... ], // The locales that are being requested. - availableLocales: [ , ... ], // The locales that are available for use. - appLocales: [ , ... ], // The negotiated locales that are being used. - systemLocales: [ , ... ], // The locales for the OS. - regionalPrefsLocales: [ , ... ], // The regional preferences for the OS. - acceptLanguages: [ , ... ], // The languages for the Accept-Languages header. - }, update: { channel: , // e.g. "release", null on failure enabled: , // true on failure @@ -468,4 +460,3 @@ Version History - Firefox 61: - Removed empty ``addons.activeExperiment`` (`bug 1452935 `_). - diff --git a/toolkit/components/telemetry/tests/unit/head.js b/toolkit/components/telemetry/tests/unit/head.js index caff10d9ac2b..001ad047cb55 100644 --- a/toolkit/components/telemetry/tests/unit/head.js +++ b/toolkit/components/telemetry/tests/unit/head.js @@ -294,13 +294,6 @@ function fakePrioEncode() { m.Policy.prioEncode = (batchID, prioParams) => prioParams; } -function fakeIntlReady() { - const m = ChromeUtils.import("resource://gre/modules/TelemetryEnvironment.jsm", {}); - m.Policy._intlLoaded = true; - // Dispatch the observer event in case the promise has been registered already. - Services.obs.notifyObservers(null, "browser-delayed-startup-finished"); -} - // Return a date that is |offset| ms in the future from |date|. function futureDate(date, offset) { return new Date(date.getTime() + offset); diff --git a/toolkit/components/telemetry/tests/unit/test_ChildEvents.js b/toolkit/components/telemetry/tests/unit/test_ChildEvents.js index 3c4bf4224a80..3044d7e5fd0b 100644 --- a/toolkit/components/telemetry/tests/unit/test_ChildEvents.js +++ b/toolkit/components/telemetry/tests/unit/test_ChildEvents.js @@ -75,7 +75,6 @@ add_task(async function() { do_get_profile(true); loadAddonManager(APP_ID, APP_NAME, APP_VERSION, PLATFORM_VERSION); finishAddonManagerStartup(); - fakeIntlReady(); await TelemetryController.testSetup(); // Make sure we don't generate unexpected pings due to pref changes. await setEmptyPrefWatchlist(); diff --git a/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js b/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js index 02226ac22fec..d5caef0a1130 100644 --- a/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js +++ b/toolkit/components/telemetry/tests/unit/test_ChildHistograms.js @@ -90,7 +90,6 @@ add_task(async function() { do_get_profile(true); loadAddonManager(APP_ID, APP_NAME, APP_VERSION, PLATFORM_VERSION); finishAddonManagerStartup(); - fakeIntlReady(); await TelemetryController.testSetup(); if (runningInParent) { // Make sure we don't generate unexpected pings due to pref changes. diff --git a/toolkit/components/telemetry/tests/unit/test_ChildScalars.js b/toolkit/components/telemetry/tests/unit/test_ChildScalars.js index 4ff06d8c3431..30622ddd1416 100644 --- a/toolkit/components/telemetry/tests/unit/test_ChildScalars.js +++ b/toolkit/components/telemetry/tests/unit/test_ChildScalars.js @@ -140,7 +140,6 @@ add_task(async function() { do_get_profile(true); loadAddonManager(APP_ID, APP_NAME, APP_VERSION, PLATFORM_VERSION); finishAddonManagerStartup(); - fakeIntlReady(); await TelemetryController.testSetup(); if (runningInParent) { setParentScalars(); diff --git a/toolkit/components/telemetry/tests/unit/test_SubsessionChaining.js b/toolkit/components/telemetry/tests/unit/test_SubsessionChaining.js index cfaaa23fc152..0a59c449c39b 100644 --- a/toolkit/components/telemetry/tests/unit/test_SubsessionChaining.js +++ b/toolkit/components/telemetry/tests/unit/test_SubsessionChaining.js @@ -88,7 +88,6 @@ add_task(async function test_setup() { do_get_profile(); loadAddonManager("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); finishAddonManagerStartup(); - fakeIntlReady(); // Make sure we don't generate unexpected pings due to pref changes. await setEmptyPrefWatchlist(); }); diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryChildEvents_buildFaster.js b/toolkit/components/telemetry/tests/unit/test_TelemetryChildEvents_buildFaster.js index c74e2073951f..9786393f9de9 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryChildEvents_buildFaster.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryChildEvents_buildFaster.js @@ -45,7 +45,6 @@ add_task(async function test_setup() { do_get_profile(true); loadAddonManager(APP_ID, APP_NAME, APP_VERSION, PLATFORM_VERSION); finishAddonManagerStartup(); - fakeIntlReady(); await TelemetryController.testSetup(); // Make sure we don't generate unexpected pings due to pref changes. await setEmptyPrefWatchlist(); diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryController.js b/toolkit/components/telemetry/tests/unit/test_TelemetryController.js index 3a5a88ca8083..4a36ee3c491a 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryController.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryController.js @@ -94,7 +94,6 @@ add_task(async function test_setup() { do_get_profile(); loadAddonManager("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); finishAddonManagerStartup(); - fakeIntlReady(); // Make sure we don't generate unexpected pings due to pref changes. await setEmptyPrefWatchlist(); diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryControllerShutdown.js b/toolkit/components/telemetry/tests/unit/test_TelemetryControllerShutdown.js index 61509d67fa62..a01f6fd757dc 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryControllerShutdown.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryControllerShutdown.js @@ -27,7 +27,6 @@ add_task(async function test_setup() { do_get_profile(); loadAddonManager("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); finishAddonManagerStartup(); - fakeIntlReady(); // Make sure we don't generate unexpected pings due to pref changes. await setEmptyPrefWatchlist(); diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js b/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js index 892339a2ff5e..c25bb7c06c68 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js @@ -407,9 +407,8 @@ function checkSettingsSection(data) { const EXPECTED_FIELDS_TYPES = { blocklistEnabled: "boolean", e10sEnabled: "boolean", - intl: "object", - locale: "string", telemetryEnabled: "boolean", + locale: "string", update: "object", userPrefs: "object", }; @@ -450,23 +449,6 @@ function checkSettingsSection(data) { Assert.equal(typeof data.settings.attribution, "object"); Assert.equal(data.settings.attribution.source, "google.com"); } - - checkIntlSettings(data.settings); -} - -function checkIntlSettings({intl}) { - let fields = [ - "requestedLocales", - "availableLocales", - "appLocales", - "systemLocales", - "regionalPrefsLocales", - "acceptLanguages", - ]; - - for (let field of fields) { - Assert.ok(Array.isArray(intl[field]), `${field} is an array`); - } } function checkProfileSection(data) { @@ -927,20 +909,11 @@ add_task(async function test_checkEnvironment() { Assert.equal(AddonManagerPrivate.isDBLoaded(), false, "addons database is not loaded"); - let data = TelemetryEnvironment.currentEnvironment; - checkAddonsSection(data, false, true); - - // Check that settings.intl is lazily loaded. - Assert.equal(typeof data.settings.intl, "object", "intl is initially an object"); - Assert.equal(Object.keys(data.settings.intl).length, 0, "intl is initially empty"); + checkAddonsSection(TelemetryEnvironment.currentEnvironment, false, true); // Now continue with startup. let initPromise = TelemetryEnvironment.onInitialized(); finishAddonManagerStartup(); - - // Fake the delayed startup event for intl data to load. - fakeIntlReady(); - let environmentData = await initPromise; checkEnvironmentData(environmentData, {isInitial: true}); diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js b/toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js index 434a91c0fc6a..2a2d3b859d32 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js @@ -53,7 +53,6 @@ add_task(async function test_setup() { do_get_profile(true); loadAddonManager("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); finishAddonManagerStartup(); - fakeIntlReady(); // Make sure we don't generate unexpected pings due to pref changes. await setEmptyPrefWatchlist(); diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetrySendOldPings.js b/toolkit/components/telemetry/tests/unit/test_TelemetrySendOldPings.js index e087d1a8df30..34c7b9b5c456 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetrySendOldPings.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySendOldPings.js @@ -136,7 +136,6 @@ add_task(async function test_setup() { do_get_profile(); loadAddonManager("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2"); finishAddonManagerStartup(); - fakeIntlReady(); // Make sure we don't generate unexpected pings due to pref changes. await setEmptyPrefWatchlist(); diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js index c3ba7e6ed383..a58ef31051ba 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js @@ -442,7 +442,6 @@ add_task(async function test_setup() { do_get_profile(); loadAddonManager(APP_ID, APP_NAME, APP_VERSION, PLATFORM_VERSION); finishAddonManagerStartup(); - fakeIntlReady(); // Make sure we don't generate unexpected pings due to pref changes. await setEmptyPrefWatchlist(); diff --git a/toolkit/components/telemetry/tests/unit/test_TelemetryTimestamps.js b/toolkit/components/telemetry/tests/unit/test_TelemetryTimestamps.js index 6cc46f29052e..0c9ff8545fd4 100644 --- a/toolkit/components/telemetry/tests/unit/test_TelemetryTimestamps.js +++ b/toolkit/components/telemetry/tests/unit/test_TelemetryTimestamps.js @@ -22,7 +22,6 @@ add_task(async function test_setup() { // Telemetry needs the AddonManager. loadAddonManager(); finishAddonManagerStartup(); - fakeIntlReady(); // Make profile available for |TelemetryController.testShutdown()|. do_get_profile();