mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1005270 - Trigger experiments initialization on opening the addon manager UI. r=bsmedberg
This commit is contained in:
parent
ca1ac35d24
commit
cf1158db3c
@ -379,6 +379,10 @@ Experiments.Experiments = function (policy=new Experiments.Policy()) {
|
||||
|
||||
this._shutdown = false;
|
||||
|
||||
// We need to tell when we first evaluated the experiments to fire an
|
||||
// experiments-changed notification when we only loaded completed experiments.
|
||||
this._firstEvaluate = true;
|
||||
|
||||
this.init();
|
||||
};
|
||||
|
||||
@ -1171,8 +1175,9 @@ Experiments.Experiments.prototype = {
|
||||
|
||||
gPrefs.set(PREF_ACTIVE_EXPERIMENT, activeExperiment != null);
|
||||
|
||||
if (activeChanged) {
|
||||
if (activeChanged || this._firstEvaluate) {
|
||||
Services.obs.notifyObservers(null, EXPERIMENTS_CHANGED_TOPIC, null);
|
||||
this._firstEvaluate = false;
|
||||
}
|
||||
|
||||
if ("@mozilla.org/toolkit/crash-reporter;1" in Cc && activeExperiment) {
|
||||
|
@ -72,6 +72,7 @@ ExperimentsService.prototype = {
|
||||
if (gExperimentsEnabled) {
|
||||
Services.obs.addObserver(this, "quit-application", false);
|
||||
Services.obs.addObserver(this, "sessionstore-state-finalized", false);
|
||||
Services.obs.addObserver(this, "EM-loaded", false);
|
||||
|
||||
if (gActiveExperiment) {
|
||||
this._initialized = true;
|
||||
@ -84,9 +85,20 @@ ExperimentsService.prototype = {
|
||||
CommonUtils.namedTimer(this._delayedInit, DELAY_INIT_MS, this, "_delayedInitTimer");
|
||||
}
|
||||
break;
|
||||
case "EM-loaded":
|
||||
if (!this._initialized) {
|
||||
Experiments.instance(); // for side effects
|
||||
this._initialized = true;
|
||||
|
||||
if (this._delayedInitTimer) {
|
||||
this._delayedInitTimer.clear();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "quit-application":
|
||||
Services.obs.removeObserver(this, "quit-application");
|
||||
Services.obs.removeObserver(this, "sessionstore-state-finalized");
|
||||
Services.obs.removeObserver(this, "EM-loaded");
|
||||
if (this._delayedInitTimer) {
|
||||
this._delayedInitTimer.clear();
|
||||
}
|
||||
|
@ -161,8 +161,8 @@ add_task(function* test_getExperiments() {
|
||||
defineNow(gPolicy, now);
|
||||
|
||||
yield experiments.updateManifest();
|
||||
Assert.equal(observerFireCount, 0,
|
||||
"Experiments observer should not have been called yet.");
|
||||
Assert.equal(observerFireCount, ++expectedObserverFireCount,
|
||||
"Experiments observer should have been called.");
|
||||
Assert.equal(experiments.getActiveExperimentID(), null,
|
||||
"getActiveExperimentID should return null");
|
||||
|
||||
@ -377,8 +377,8 @@ add_task(function* test_addonAlreadyInstalled() {
|
||||
let now = baseDate;
|
||||
defineNow(gPolicy, now);
|
||||
yield experiments.updateManifest();
|
||||
Assert.equal(observerFireCount, 0,
|
||||
"Experiments observer should not have been called yet.");
|
||||
Assert.equal(observerFireCount, ++expectedObserverFireCount,
|
||||
"Experiments observer should have been called.");
|
||||
let list = yield experiments.getExperiments();
|
||||
Assert.equal(list.length, 0, "Experiment list should be empty.");
|
||||
|
||||
@ -681,8 +681,8 @@ add_task(function* test_installFailure() {
|
||||
let now = baseDate;
|
||||
defineNow(gPolicy, now);
|
||||
yield experiments.updateManifest();
|
||||
Assert.equal(observerFireCount, 0,
|
||||
"Experiments observer should not have been called yet.");
|
||||
Assert.equal(observerFireCount, ++expectedObserverFireCount,
|
||||
"Experiments observer should have been called.");
|
||||
let list = yield experiments.getExperiments();
|
||||
Assert.equal(list.length, 0, "Experiment list should be empty.");
|
||||
|
||||
@ -787,8 +787,8 @@ add_task(function* test_userDisabledAndUpdated() {
|
||||
let now = baseDate;
|
||||
defineNow(gPolicy, now);
|
||||
yield experiments.updateManifest();
|
||||
Assert.equal(observerFireCount, 0,
|
||||
"Experiments observer should not have been called yet.");
|
||||
Assert.equal(observerFireCount, ++expectedObserverFireCount,
|
||||
"Experiments observer should have been called.");
|
||||
let list = yield experiments.getExperiments();
|
||||
Assert.equal(list.length, 0, "Experiment list should be empty.");
|
||||
|
||||
@ -886,8 +886,8 @@ add_task(function* test_updateActiveExperiment() {
|
||||
let now = baseDate;
|
||||
defineNow(gPolicy, now);
|
||||
yield experiments.updateManifest();
|
||||
Assert.equal(observerFireCount, 0,
|
||||
"Experiments observer should not have been called yet.");
|
||||
Assert.equal(observerFireCount, ++expectedObserverFireCount,
|
||||
"Experiments observer should have been called.");
|
||||
let list = yield experiments.getExperiments();
|
||||
Assert.equal(list.length, 0, "Experiment list should be empty.");
|
||||
|
||||
@ -977,8 +977,8 @@ add_task(function* test_disableActiveExperiment() {
|
||||
let now = baseDate;
|
||||
defineNow(gPolicy, now);
|
||||
yield experiments.updateManifest();
|
||||
Assert.equal(observerFireCount, 0,
|
||||
"Experiments observer should not have been called yet.");
|
||||
Assert.equal(observerFireCount, ++expectedObserverFireCount,
|
||||
"Experiments observer should have been called.");
|
||||
let list = yield experiments.getExperiments();
|
||||
Assert.equal(list.length, 0, "Experiment list should be empty.");
|
||||
|
||||
@ -1070,8 +1070,8 @@ add_task(function* test_freezePendingExperiment() {
|
||||
let now = baseDate;
|
||||
defineNow(gPolicy, now);
|
||||
yield experiments.updateManifest();
|
||||
Assert.equal(observerFireCount, 0,
|
||||
"Experiments observer should not have been called yet.");
|
||||
Assert.equal(observerFireCount, ++expectedObserverFireCount,
|
||||
"Experiments observer should have been called.");
|
||||
let list = yield experiments.getExperiments();
|
||||
Assert.equal(list.length, 0, "Experiment list should be empty.");
|
||||
|
||||
@ -1081,8 +1081,8 @@ add_task(function* test_freezePendingExperiment() {
|
||||
defineNow(gPolicy, now);
|
||||
gManifestObject.experiments[0].frozen = true;
|
||||
yield experiments.updateManifest();
|
||||
Assert.equal(observerFireCount, 0,
|
||||
"Experiments observer should not have been called.");
|
||||
Assert.equal(observerFireCount, expectedObserverFireCount,
|
||||
"Experiments observer should have not been called.");
|
||||
|
||||
list = yield experiments.getExperiments();
|
||||
Assert.equal(list.length, 0, "Experiment list should have no entries yet.");
|
||||
@ -1148,8 +1148,8 @@ add_task(function* test_freezeActiveExperiment() {
|
||||
let now = baseDate;
|
||||
defineNow(gPolicy, now);
|
||||
yield experiments.updateManifest();
|
||||
Assert.equal(observerFireCount, 0,
|
||||
"Experiments observer should not have been called yet.");
|
||||
Assert.equal(observerFireCount, ++expectedObserverFireCount,
|
||||
"Experiments observer should have been called.");
|
||||
let list = yield experiments.getExperiments();
|
||||
Assert.equal(list.length, 0, "Experiment list should be empty.");
|
||||
|
||||
@ -1240,8 +1240,8 @@ add_task(function* test_removeActiveExperiment() {
|
||||
let now = baseDate;
|
||||
defineNow(gPolicy, now);
|
||||
yield experiments.updateManifest();
|
||||
Assert.equal(observerFireCount, 0,
|
||||
"Experiments observer should not have been called yet.");
|
||||
Assert.equal(observerFireCount, ++expectedObserverFireCount,
|
||||
"Experiments observer should have been called.");
|
||||
let list = yield experiments.getExperiments();
|
||||
Assert.equal(list.length, 0, "Experiment list should be empty.");
|
||||
|
||||
@ -1321,8 +1321,8 @@ add_task(function* test_invalidUrl() {
|
||||
gTimerScheduleOffset = null;
|
||||
|
||||
yield experiments.updateManifest();
|
||||
Assert.equal(observerFireCount, expectedObserverFireCount,
|
||||
"Experiments observer should not have been called.");
|
||||
Assert.equal(observerFireCount, ++expectedObserverFireCount,
|
||||
"Experiments observer should have been called.");
|
||||
Assert.equal(gTimerScheduleOffset, null, "No new timer should have been scheduled.");
|
||||
|
||||
let list = yield experiments.getExperiments();
|
||||
@ -1375,8 +1375,8 @@ add_task(function* test_unexpectedUninstall() {
|
||||
let now = baseDate;
|
||||
defineNow(gPolicy, now);
|
||||
yield experiments.updateManifest();
|
||||
Assert.equal(observerFireCount, 0,
|
||||
"Experiments observer should not have been called yet.");
|
||||
Assert.equal(observerFireCount, ++expectedObserverFireCount,
|
||||
"Experiments observer should have been called.");
|
||||
let list = yield experiments.getExperiments();
|
||||
Assert.equal(list.length, 0, "Experiment list should be empty.");
|
||||
|
||||
|
@ -122,8 +122,8 @@ add_task(function* test_disableExperiments() {
|
||||
defineNow(gPolicy, now);
|
||||
|
||||
yield experiments.updateManifest();
|
||||
Assert.equal(observerFireCount, 0,
|
||||
"Experiments observer should not have been called yet.");
|
||||
Assert.equal(observerFireCount, ++expectedObserverFireCount,
|
||||
"Experiments observer should have been called.");
|
||||
let list = yield experiments.getExperiments();
|
||||
Assert.equal(list.length, 0, "Experiment list should be empty.");
|
||||
let addons = yield getExperimentAddons();
|
||||
|
Loading…
Reference in New Issue
Block a user