mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 993084 - Don't load experiments module if the feature is preffed off. r=bsmedberg
This commit is contained in:
parent
30d47b9922
commit
87b9f492e1
@ -8,8 +8,27 @@ const {interfaces: Ci, utils: Cu} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource:///modules/experiments/Experiments.jsm");
|
||||
Cu.import("resource://gre/modules/osfile.jsm")
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Experiments",
|
||||
"resource:///modules/experiments/Experiments.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "OS",
|
||||
"resource://gre/modules/osfile.jsm");
|
||||
|
||||
const PREF_EXPERIMENTS_ENABLED = "experiments.enabled";
|
||||
const PREF_HEALTHREPORT_ENABLED = "datareporting.healthreport.service.enabled";
|
||||
const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
|
||||
|
||||
XPCOMUtils.defineLazyGetter(
|
||||
this, "gExperimentsEnabled", () => {
|
||||
try {
|
||||
let prefs = Services.prefs;
|
||||
return prefs.getBoolPref(PREF_EXPERIMENTS_ENABLED) &&
|
||||
prefs.getBoolPref(PREF_TELEMETRY_ENABLED) &&
|
||||
prefs.getBoolPref(PREF_HEALTHREPORT_ENABLED);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
function ExperimentsService() {
|
||||
}
|
||||
@ -19,6 +38,9 @@ ExperimentsService.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback, Ci.nsIObserver]),
|
||||
|
||||
notify: function (timer) {
|
||||
if (!gExperimentsEnabled) {
|
||||
return;
|
||||
}
|
||||
if (OS.Constants.Path.profileDir === undefined) {
|
||||
throw Error("Update timer fired before profile was initialized?");
|
||||
}
|
||||
@ -28,7 +50,9 @@ ExperimentsService.prototype = {
|
||||
observe: function (subject, topic, data) {
|
||||
switch (topic) {
|
||||
case "profile-after-change":
|
||||
Experiments.instance(); // for side effects
|
||||
if (gExperimentsEnabled) {
|
||||
Experiments.instance(); // for side effects
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user