зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1234493 - Remove FHR's PasswordsMetricsProvider. r=rnewman
This commit is contained in:
Родитель
24691fcfc3
Коммит
686cba646a
|
@ -27,105 +27,7 @@ XPCOMUtils.defineLazyGetter(this, "log", () => {
|
|||
return logger.log.bind(logger);
|
||||
});
|
||||
|
||||
this.EXPORTED_SYMBOLS = [ "LoginManagerParent", "PasswordsMetricsProvider" ];
|
||||
|
||||
#ifndef ANDROID
|
||||
#ifdef MOZ_SERVICES_HEALTHREPORT
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Metrics",
|
||||
"resource://gre/modules/Metrics.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
"resource://gre/modules/Task.jsm");
|
||||
|
||||
function recordFHRDailyCounter(aField) {
|
||||
let reporter = Cc["@mozilla.org/datareporting/service;1"]
|
||||
.getService()
|
||||
.wrappedJSObject
|
||||
.healthReporter;
|
||||
// This can happen if the FHR component of the data reporting service is
|
||||
// disabled. This is controlled by a pref that most will never use.
|
||||
if (!reporter) {
|
||||
return;
|
||||
}
|
||||
reporter.onInit().then(() => reporter.getProvider("org.mozilla.passwordmgr")
|
||||
.recordDailyCounter(aField));
|
||||
}
|
||||
|
||||
this.PasswordsMetricsProvider = function() {
|
||||
Metrics.Provider.call(this);
|
||||
};
|
||||
|
||||
PasswordsMetricsProvider.prototype = Object.freeze({
|
||||
__proto__: Metrics.Provider.prototype,
|
||||
|
||||
name: "org.mozilla.passwordmgr",
|
||||
|
||||
measurementTypes: [
|
||||
PasswordsMeasurement1,
|
||||
PasswordsMeasurement2,
|
||||
],
|
||||
|
||||
collectDailyData: function () {
|
||||
return this.storage.enqueueTransaction(this._recordDailyPasswordData.bind(this));
|
||||
},
|
||||
|
||||
_recordDailyPasswordData: function *() {
|
||||
let m = this.getMeasurement(PasswordsMeasurement2.prototype.name,
|
||||
PasswordsMeasurement2.prototype.version);
|
||||
let enabled = Services.prefs.getBoolPref("signon.rememberSignons");
|
||||
yield m.setDailyLastNumeric("enabled", enabled ? 1 : 0);
|
||||
|
||||
let loginsCount = Services.logins.countLogins("", "", "");
|
||||
yield m.setDailyLastNumeric("numSavedPasswords", loginsCount);
|
||||
|
||||
},
|
||||
|
||||
recordDailyCounter: function(aField) {
|
||||
let m = this.getMeasurement(PasswordsMeasurement2.prototype.name,
|
||||
PasswordsMeasurement2.prototype.version);
|
||||
if (this.storage.hasFieldFromMeasurement(m.id, aField,
|
||||
Metrics.Storage.FIELD_DAILY_COUNTER)) {
|
||||
let fieldID = this.storage.fieldIDFromMeasurement(m.id, aField, Metrics.Storage.FIELD_DAILY_COUNTER);
|
||||
return this.enqueueStorageOperation(() => m.incrementDailyCounter(aField));
|
||||
}
|
||||
|
||||
// Otherwise, we first need to create the field.
|
||||
return this.enqueueStorageOperation (() => this.storage.registerField(m.id, aField,
|
||||
Metrics.Storage.FIELD_DAILY_COUNTER).then(() => m.incrementDailyCounter(aField)));
|
||||
},
|
||||
});
|
||||
|
||||
function PasswordsMeasurement1() {
|
||||
Metrics.Measurement.call(this);
|
||||
}
|
||||
|
||||
PasswordsMeasurement1.prototype = Object.freeze({
|
||||
__proto__: Metrics.Measurement.prototype,
|
||||
name: "passwordmgr",
|
||||
version: 1,
|
||||
fields: {
|
||||
enabled: {type: Metrics.Storage.FIELD_DAILY_LAST_NUMERIC},
|
||||
numSavedPasswords: {type: Metrics.Storage.FIELD_DAILY_LAST_NUMERIC},
|
||||
},
|
||||
});
|
||||
|
||||
function PasswordsMeasurement2() {
|
||||
Metrics.Measurement.call(this);
|
||||
}
|
||||
PasswordsMeasurement2.prototype = Object.freeze({
|
||||
__proto__: Metrics.Measurement.prototype,
|
||||
name: "passwordmgr",
|
||||
version: 2,
|
||||
fields: {
|
||||
enabled: {type: Metrics.Storage.FIELD_DAILY_LAST_NUMERIC},
|
||||
numSavedPasswords: {type: Metrics.Storage.FIELD_DAILY_LAST_NUMERIC},
|
||||
numSuccessfulFills: {type: Metrics.Storage.FIELD_DAILY_COUNTER},
|
||||
numNewSavedPasswordsInSession: {type: Metrics.Storage.FIELD_DAILY_COUNTER},
|
||||
numTotalLoginsEncountered: {type: Metrics.Storage.FIELD_DAILY_COUNTER},
|
||||
},
|
||||
});
|
||||
|
||||
#endif
|
||||
#endif
|
||||
this.EXPORTED_SYMBOLS = [ "LoginManagerParent" ];
|
||||
|
||||
var LoginManagerParent = {
|
||||
/**
|
||||
|
@ -146,9 +48,6 @@ var LoginManagerParent = {
|
|||
mm.addMessageListener("RemoteLogins:onFormSubmit", this);
|
||||
mm.addMessageListener("RemoteLogins:autoCompleteLogins", this);
|
||||
mm.addMessageListener("RemoteLogins:updateLoginFormPresence", this);
|
||||
mm.addMessageListener("LoginStats:LoginEncountered", this);
|
||||
mm.addMessageListener("LoginStats:LoginFillSuccessful", this);
|
||||
Services.obs.addObserver(this, "LoginStats:NewSavedPassword", false);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "recipeParentPromise", () => {
|
||||
const { LoginRecipesParent } = Cu.import("resource://gre/modules/LoginRecipes.jsm", {});
|
||||
|
@ -160,17 +59,6 @@ var LoginManagerParent = {
|
|||
|
||||
},
|
||||
|
||||
observe: function (aSubject, aTopic, aData) {
|
||||
#ifndef ANDROID
|
||||
#ifdef MOZ_SERVICES_HEALTHREPORT
|
||||
if (aTopic == "LoginStats:NewSavedPassword") {
|
||||
recordFHRDailyCounter("numNewSavedPasswordsInSession");
|
||||
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
},
|
||||
|
||||
receiveMessage: function (msg) {
|
||||
let data = msg.data;
|
||||
switch (msg.name) {
|
||||
|
@ -210,24 +98,6 @@ var LoginManagerParent = {
|
|||
this.doAutocompleteSearch(data, msg.target);
|
||||
break;
|
||||
}
|
||||
|
||||
case "LoginStats:LoginFillSuccessful": {
|
||||
#ifndef ANDROID
|
||||
#ifdef MOZ_SERVICES_HEALTHREPORT
|
||||
recordFHRDailyCounter("numSuccessfulFills");
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
case "LoginStats:LoginEncountered": {
|
||||
#ifndef ANDROID
|
||||
#ifdef MOZ_SERVICES_HEALTHREPORT
|
||||
recordFHRDailyCounter("numTotalLoginsEncountered");
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -38,14 +38,11 @@ EXTRA_PP_COMPONENTS += [
|
|||
'passwordmgr.manifest',
|
||||
]
|
||||
|
||||
EXTRA_PP_JS_MODULES += [
|
||||
'LoginManagerParent.jsm',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
'InsecurePasswordUtils.jsm',
|
||||
'LoginHelper.jsm',
|
||||
'LoginManagerContent.jsm',
|
||||
'LoginManagerParent.jsm',
|
||||
'LoginRecipes.jsm',
|
||||
'OSCrypto.jsm',
|
||||
]
|
||||
|
|
|
@ -14,5 +14,4 @@ component {c00c432d-a0c9-46d7-bef6-9c45b4d07341} storage-json.js
|
|||
contract @mozilla.org/login-manager/storage/json;1 {c00c432d-a0c9-46d7-bef6-9c45b4d07341}
|
||||
#endif
|
||||
component {dc6c2976-0f73-4f1f-b9ff-3d72b4e28309} crypto-SDR.js
|
||||
contract @mozilla.org/login-manager/crypto/SDR;1 {dc6c2976-0f73-4f1f-b9ff-3d72b4e28309}
|
||||
category healthreport-js-provider-default PasswordsMetricsProvider resource://gre/modules/LoginManagerParent.jsm
|
||||
contract @mozilla.org/login-manager/crypto/SDR;1 {dc6c2976-0f73-4f1f-b9ff-3d72b4e28309}
|
Загрузка…
Ссылка в новой задаче