Bug 1429153 - Add policy for disabling telemetry. r=Felipe

MozReview-Commit-ID: 6fGGuJzZUhU

--HG--
extra : rebase_source : bdbcd6837879231a85b9e87ef694032a3bf89c2a
This commit is contained in:
Michael Kaply 2018-03-29 10:44:12 -05:00
Родитель 057d540744
Коммит fd746e9933
4 изменённых файлов: 37 добавлений и 0 удалений

Просмотреть файл

@ -233,6 +233,15 @@ var Policies = {
}
},
"DisableTelemetry": {
onBeforeAddons(manager, param) {
if (param) {
setAndLockPref("datareporting.healthreport.uploadEnabled", false);
setAndLockPref("datareporting.policy.dataSubmissionEnabled", false);
}
}
},
"DisplayBookmarksToolbar": {
onBeforeUIStartup(manager, param) {
let value = (!param).toString();

Просмотреть файл

@ -185,6 +185,14 @@
"type": "boolean"
},
"DisableTelemetry": {
"description": "Turns off telemetry.",
"first_available": "60.0",
"enterprise_only": true,
"type": "boolean"
},
"DisplayBookmarksToolbar": {
"description": "Causes the bookmarks toolbar to be displayed by default.",
"first_available": "60.0",

Просмотреть файл

@ -34,6 +34,7 @@ support-files =
[browser_policy_disable_privatebrowsing.js]
[browser_policy_disable_safemode.js]
[browser_policy_disable_shield.js]
[browser_policy_disable_telemetry.js]
[browser_policy_display_bookmarks.js]
[browser_policy_display_menu.js]
[browser_policy_extensions.js]

Просмотреть файл

@ -0,0 +1,19 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
add_task(async function test_policy_disable_telemetry() {
const { TelemetryReportingPolicy } = ChromeUtils.import("resource://gre/modules/TelemetryReportingPolicy.jsm", {});
ok(TelemetryReportingPolicy, "TelemetryReportingPolicy exists");
is(TelemetryReportingPolicy.canUpload(), true, "Telemetry is enabled");
await setupPolicyEngineWithJson({
"policies": {
"DisableTelemetry": true
}
});
is(TelemetryReportingPolicy.canUpload(), false, "Telemetry is disabled");
});