From 92399a3f06eb649015135d08bfe28c4f46c5a1e7 Mon Sep 17 00:00:00 2001 From: Chenxia Liu Date: Mon, 2 Feb 2015 12:51:48 -0800 Subject: [PATCH] Bug 1124392 - Telemetry: Record the number of passwords per hostname. r=MattN --HG-- extra : rebase_source : 16de4b58ca570ed7ad328ddc5806eba0a509d9e7 --- toolkit/components/passwordmgr/nsLoginManager.js | 9 +++++++++ toolkit/components/telemetry/Histograms.json | 7 +++++++ 2 files changed, 16 insertions(+) diff --git a/toolkit/components/passwordmgr/nsLoginManager.js b/toolkit/components/passwordmgr/nsLoginManager.js index 3b59e401398d..e6ab0ca2fb55 100644 --- a/toolkit/components/passwordmgr/nsLoginManager.js +++ b/toolkit/components/passwordmgr/nsLoginManager.js @@ -253,9 +253,13 @@ LoginManager.prototype = { let usernamePresentHistogram = clearAndGetHistogram("PWMGR_USERNAME_PRESENT"); let loginLastUsedDaysHistogram = clearAndGetHistogram("PWMGR_LOGIN_LAST_USED_DAYS"); + let hostnameCount = new Map(); for (let login of logins) { usernamePresentHistogram.add(!!login.username); + let hostname = login.hostname; + hostnameCount.set(hostname, (hostnameCount.get(hostname) || 0 ) + 1); + login.QueryInterface(Ci.nsILoginMetaInfo); let timeLastUsedAgeMs = referenceTimeMs - login.timeLastUsed; if (timeLastUsedAgeMs > 0) { @@ -264,6 +268,11 @@ LoginManager.prototype = { ); } } + + let passwordsCountHistogram = clearAndGetHistogram("PWMGR_NUM_PASSWORDS_PER_HOSTNAME"); + for (let count of hostnameCount.values()) { + passwordsCountHistogram.add(count); + } }, diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index dd33f8f7fc6f..b45d70a432d6 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -7288,6 +7288,13 @@ "extended_statistics_ok": true, "description": "The number of sites for which the user has explicitly rejected saving logins" }, + "PWMGR_NUM_PASSWORDS_PER_HOSTNAME": { + "expires_in_version": "never", + "kind": "linear", + "high": 21, + "n_buckets" : 20, + "description": "The number of passwords per hostname" + }, "PWMGR_NUM_SAVED_PASSWORDS": { "expires_in_version": "never", "kind": "exponential",