Bug 1620244 - Retention telemetry for HTTPS Only Mode. r=ckerschb,jcj

Differential Revision: https://phabricator.services.mozilla.com/D69547

--HG--
extra : moz-landing-system : lando
This commit is contained in:
JulianWels 2020-04-16 00:33:10 +00:00
parent a6b80b0e24
commit 26f9d5efce
3 changed files with 44 additions and 0 deletions

View File

@ -1970,6 +1970,26 @@ BrowserGlue.prototype = {
});
},
_monitorHTTPSOnlyPref() {
const PREF_ENABLED = "dom.security.https_only_mode";
const PREF_WAS_ENABLED = "dom.security.https_only_mode_ever_enabled";
const _checkHTTPSOnlyPref = async () => {
const enabled = Services.prefs.getBoolPref(PREF_ENABLED, false);
const was_enabled = Services.prefs.getBoolPref(PREF_WAS_ENABLED, false);
let value = 0;
if (enabled) {
value = 1;
Services.prefs.setBoolPref(PREF_WAS_ENABLED, true);
} else if (was_enabled) {
value = 2;
}
Services.telemetry.scalarSet("security.https_only_mode_enabled", value);
};
Services.prefs.addObserver(PREF_ENABLED, _checkHTTPSOnlyPref);
_checkHTTPSOnlyPref();
},
_showNewInstallModal() {
// Allow other observers of the same topic to run while we open the dialog.
Services.tm.dispatchToMainThread(() => {
@ -2057,6 +2077,7 @@ BrowserGlue.prototype = {
this._monitorScreenshotsPref();
this._monitorWebcompatReporterPref();
this._monitorHTTPSOnlyPref();
let pService = Cc["@mozilla.org/toolkit/profile-service;1"].getService(
Ci.nsIToolkitProfileService

View File

@ -2454,6 +2454,14 @@
value: false
mirror: always
# WARNING: Don't ever update that pref manually! It is only used
# for telemetry purposes and allows to reason about retention of
# the pref dom.security.https_only_mode from above.
- name: dom.security.https_only_mode_ever_enabled
type: RelaxedAtomicBool
value: false
mirror: always
# Is support for selection event APIs enabled?
- name: dom.select_events.enabled
type: bool

View File

@ -758,6 +758,21 @@ security:
- 'geckoview'
record_in_processes:
- main
https_only_mode_enabled:
bug_numbers:
- 1620244
description: >
Measures user retention of the HTTPS-Only Mode.
0 = never enabled, 1 = enabled, 2 = disabled (but was enabled)
expires: never
kind: uint
notification_emails:
- julianwels@mozilla.com
- seceng-telemetry@mozilla.com
products:
- 'firefox'
record_in_processes:
- 'main'
pwmgr:
potentially_breached_passwords: