зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1344723 - Use the prefs defined in TelemetryUtils.jsm in TelemetryController.jsm. r=dexter
This commit is contained in:
Родитель
a4c77b8ab9
Коммит
d0e7a5b995
|
@ -26,20 +26,11 @@ const Utils = TelemetryUtils;
|
||||||
const LOGGER_NAME = "Toolkit.Telemetry";
|
const LOGGER_NAME = "Toolkit.Telemetry";
|
||||||
const LOGGER_PREFIX = "TelemetryController::";
|
const LOGGER_PREFIX = "TelemetryController::";
|
||||||
|
|
||||||
const PREF_BRANCH = "toolkit.telemetry.";
|
const PREF_BRANCH_LOG = "toolkit.telemetry.log.";
|
||||||
const PREF_BRANCH_LOG = PREF_BRANCH + "log.";
|
|
||||||
const PREF_SERVER = PREF_BRANCH + "server";
|
|
||||||
const PREF_LOG_LEVEL = PREF_BRANCH_LOG + "level";
|
|
||||||
const PREF_LOG_DUMP = PREF_BRANCH_LOG + "dump";
|
|
||||||
const PREF_CACHED_CLIENTID = PREF_BRANCH + "cachedClientID";
|
|
||||||
const PREF_FHR_UPLOAD_ENABLED = "datareporting.healthreport.uploadEnabled";
|
|
||||||
const PREF_UNIFIED = PREF_BRANCH + "unified";
|
|
||||||
const PREF_NEWPROFILE_PING_ENABLED = PREF_BRANCH + "newProfilePing.enabled";
|
|
||||||
const PREF_NEWPROFILE_PING_DELAY = PREF_BRANCH + "newProfilePing.delay";
|
|
||||||
|
|
||||||
// Whether the FHR/Telemetry unification features are enabled.
|
// Whether the FHR/Telemetry unification features are enabled.
|
||||||
// Changing this pref requires a restart.
|
// Changing this pref requires a restart.
|
||||||
const IS_UNIFIED_TELEMETRY = Preferences.get(PREF_UNIFIED, false);
|
const IS_UNIFIED_TELEMETRY = Preferences.get(TelemetryUtils.Preferences.Unified, false);
|
||||||
|
|
||||||
const PING_FORMAT_VERSION = 4;
|
const PING_FORMAT_VERSION = 4;
|
||||||
|
|
||||||
|
@ -104,10 +95,10 @@ function configureLogging() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the logger keeps up with the logging level preference.
|
// Make sure the logger keeps up with the logging level preference.
|
||||||
gLogger.level = Log.Level[Preferences.get(PREF_LOG_LEVEL, "Warn")];
|
gLogger.level = Log.Level[Preferences.get(TelemetryUtils.Preferences.LogLevel, "Warn")];
|
||||||
|
|
||||||
// If enabled in the preferences, add a dump appender.
|
// If enabled in the preferences, add a dump appender.
|
||||||
let logDumping = Preferences.get(PREF_LOG_DUMP, false);
|
let logDumping = Preferences.get(TelemetryUtils.Preferences.LogDump, false);
|
||||||
if (logDumping != !!gLogAppenderDump) {
|
if (logDumping != !!gLogAppenderDump) {
|
||||||
if (logDumping) {
|
if (logDumping) {
|
||||||
gLogAppenderDump = new Log.DumpAppender(new Log.BasicFormatter());
|
gLogAppenderDump = new Log.DumpAppender(new Log.BasicFormatter());
|
||||||
|
@ -131,12 +122,6 @@ var Policy = {
|
||||||
this.EXPORTED_SYMBOLS = ["TelemetryController"];
|
this.EXPORTED_SYMBOLS = ["TelemetryController"];
|
||||||
|
|
||||||
this.TelemetryController = Object.freeze({
|
this.TelemetryController = Object.freeze({
|
||||||
Constants: Object.freeze({
|
|
||||||
PREF_LOG_LEVEL,
|
|
||||||
PREF_LOG_DUMP,
|
|
||||||
PREF_SERVER,
|
|
||||||
}),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used only for testing purposes.
|
* Used only for testing purposes.
|
||||||
*/
|
*/
|
||||||
|
@ -728,7 +713,7 @@ var Impl = {
|
||||||
// Perform TelemetrySession delayed init.
|
// Perform TelemetrySession delayed init.
|
||||||
await TelemetrySession.delayedInit();
|
await TelemetrySession.delayedInit();
|
||||||
|
|
||||||
if (Preferences.get(PREF_NEWPROFILE_PING_ENABLED, false) &&
|
if (Preferences.get(TelemetryUtils.Preferences.NewProfilePingEnabled, false) &&
|
||||||
!TelemetrySession.newProfilePingSent) {
|
!TelemetrySession.newProfilePingSent) {
|
||||||
// Kick off the scheduling of the new-profile ping.
|
// Kick off the scheduling of the new-profile ping.
|
||||||
this.scheduleNewProfilePing();
|
this.scheduleNewProfilePing();
|
||||||
|
@ -892,7 +877,7 @@ var Impl = {
|
||||||
* the preferences panel), this triggers sending the deletion ping.
|
* the preferences panel), this triggers sending the deletion ping.
|
||||||
*/
|
*/
|
||||||
_onUploadPrefChange() {
|
_onUploadPrefChange() {
|
||||||
const uploadEnabled = Preferences.get(PREF_FHR_UPLOAD_ENABLED, false);
|
const uploadEnabled = Preferences.get(TelemetryUtils.Preferences.FhrUploadEnabled, false);
|
||||||
if (uploadEnabled) {
|
if (uploadEnabled) {
|
||||||
// There's nothing we should do if we are enabling upload.
|
// There's nothing we should do if we are enabling upload.
|
||||||
return;
|
return;
|
||||||
|
@ -921,7 +906,7 @@ var Impl = {
|
||||||
_attachObservers() {
|
_attachObservers() {
|
||||||
if (IS_UNIFIED_TELEMETRY) {
|
if (IS_UNIFIED_TELEMETRY) {
|
||||||
// Watch the FHR upload setting to trigger deletion pings.
|
// Watch the FHR upload setting to trigger deletion pings.
|
||||||
Preferences.observe(PREF_FHR_UPLOAD_ENABLED, this._onUploadPrefChange, this);
|
Preferences.observe(TelemetryUtils.Preferences.FhrUploadEnabled, this._onUploadPrefChange, this);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -930,7 +915,7 @@ var Impl = {
|
||||||
*/
|
*/
|
||||||
_detachObservers() {
|
_detachObservers() {
|
||||||
if (IS_UNIFIED_TELEMETRY) {
|
if (IS_UNIFIED_TELEMETRY) {
|
||||||
Preferences.ignore(PREF_FHR_UPLOAD_ENABLED, this._onUploadPrefChange, this);
|
Preferences.ignore(TelemetryUtils.Preferences.FhrUploadEnabled, this._onUploadPrefChange, this);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -992,7 +977,7 @@ var Impl = {
|
||||||
this._log.trace("scheduleNewProfilePing");
|
this._log.trace("scheduleNewProfilePing");
|
||||||
|
|
||||||
const sendDelay =
|
const sendDelay =
|
||||||
Preferences.get(PREF_NEWPROFILE_PING_DELAY, NEWPROFILE_PING_DEFAULT_DELAY);
|
Preferences.get(TelemetryUtils.Preferences.NewProfilePingDelay, NEWPROFILE_PING_DEFAULT_DELAY);
|
||||||
|
|
||||||
this._delayedNewPingTask = new DeferredTask(async () => {
|
this._delayedNewPingTask = new DeferredTask(async () => {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -34,6 +34,12 @@ this.TelemetryUtils = {
|
||||||
ShutdownPingSender: "toolkit.telemetry.shutdownPingSender.enabled",
|
ShutdownPingSender: "toolkit.telemetry.shutdownPingSender.enabled",
|
||||||
TelemetryEnabled: "toolkit.telemetry.enabled",
|
TelemetryEnabled: "toolkit.telemetry.enabled",
|
||||||
Unified: "toolkit.telemetry.unified",
|
Unified: "toolkit.telemetry.unified",
|
||||||
|
NewProfilePingEnabled: "toolkit.telemetry.newProfilePing.enabled",
|
||||||
|
NewProfilePingDelay: "toolkit.telemetry.newProfilePing.delay",
|
||||||
|
|
||||||
|
// Log Preferences
|
||||||
|
LogLevel: "toolkit.telemetry.log.level",
|
||||||
|
LogDump: "toolkit.telemetry.log.dump",
|
||||||
|
|
||||||
// Data reporting Preferences
|
// Data reporting Preferences
|
||||||
AcceptedPolicyDate: "datareporting.policy.dataSubmissionPolicyNotifiedTime",
|
AcceptedPolicyDate: "datareporting.policy.dataSubmissionPolicyNotifiedTime",
|
||||||
|
|
Загрузка…
Ссылка в новой задаче