Bug 1455464 - Use Normandy's cleanup manager for Preference Rollouts r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D81617
This commit is contained in:
Michael Cooper 2020-06-30 13:45:09 +00:00
Родитель c6f4a0a285
Коммит eb934eeccf
3 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -169,7 +169,6 @@ var Normandy = {
// topic must have already been removed or never added
}
}
await PreferenceRollouts.uninit();
},
/**

Просмотреть файл

@ -248,7 +248,7 @@ var PreferenceExperiments = {
* default preference branch.
*/
async init() {
CleanupManager.addCleanupHandler(this.saveStartupPrefs.bind(this));
CleanupManager.addCleanupHandler(() => this.saveStartupPrefs());
for (const experiment of await this.getAllActive()) {
// Check that the current value of the preference is still what we set it to

Просмотреть файл

@ -22,6 +22,11 @@ ChromeUtils.defineModuleGetter(
"TelemetryEnvironment",
"resource://gre/modules/TelemetryEnvironment.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"CleanupManager",
"resource://normandy/lib/CleanupManager.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"PrefUtils",
@ -170,6 +175,8 @@ var PreferenceRollouts = {
},
async init() {
CleanupManager.addCleanupHandler(() => this.saveStartupPrefs());
for (const rollout of await this.getAllActive()) {
TelemetryEnvironment.setExperimentActive(rollout.slug, rollout.state, {
type: "normandy-prefrollout",
@ -179,10 +186,6 @@ var PreferenceRollouts = {
}
},
async uninit() {
await this.saveStartupPrefs();
},
/** When Telemetry is disabled, clear all identifiers from the stored rollouts. */
async onTelemetryDisabled() {
const rollouts = await this.getAll();