Bug 1954128 - Implement enterprise and kiosk policy support for accepting Terms of Service r=mkaply,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D242171
This commit is contained in:
@@ -2650,6 +2650,18 @@ export var Policies = {
|
||||
param.Locked
|
||||
);
|
||||
}
|
||||
if (param.SkipTermsOfUse) {
|
||||
PoliciesUtils.setDefaultPref(
|
||||
"datareporting.policy.dataSubmissionPolicyAcceptedVersion",
|
||||
999,
|
||||
param.Locked
|
||||
);
|
||||
PoliciesUtils.setDefaultPref(
|
||||
"datareporting.policy.dataSubmissionPolicyNotifiedTime",
|
||||
Date.now().toString(),
|
||||
param.Locked
|
||||
);
|
||||
}
|
||||
if ("MoreFromMozilla" in param) {
|
||||
PoliciesUtils.setDefaultPref(
|
||||
"browser.preferences.moreFromMozilla",
|
||||
|
||||
@@ -1538,6 +1538,9 @@
|
||||
"SkipOnboarding": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"SkipTermsOfUse": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"MoreFromMozilla": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
||||
@@ -24,3 +24,34 @@ add_task(async function test_usermessaging() {
|
||||
ok(firefoxLabsCategory.hidden, "The labs category is hidden");
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_skip_terms_of_use_timestamp_set() {
|
||||
const startTime = Date.now();
|
||||
await setupPolicyEngineWithJson({
|
||||
policies: {
|
||||
UserMessaging: {
|
||||
SkipTermsOfUse: true,
|
||||
},
|
||||
},
|
||||
});
|
||||
const endTime = Date.now();
|
||||
|
||||
Assert.greater(
|
||||
parseInt(
|
||||
Services.prefs.getStringPref(
|
||||
"datareporting.policy.dataSubmissionPolicyNotifiedTime"
|
||||
)
|
||||
),
|
||||
startTime,
|
||||
"Policy notified time is greater than start time."
|
||||
);
|
||||
Assert.greaterOrEqual(
|
||||
endTime,
|
||||
parseInt(
|
||||
Services.prefs.getStringPref(
|
||||
"datareporting.policy.dataSubmissionPolicyNotifiedTime"
|
||||
)
|
||||
),
|
||||
"Policy notified time is less than or equal to end time."
|
||||
);
|
||||
});
|
||||
|
||||
@@ -691,6 +691,34 @@ const POLICIES_TESTS = [
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
policies: {
|
||||
UserMessaging: {
|
||||
SkipTermsOfUse: false,
|
||||
Locked: false,
|
||||
},
|
||||
},
|
||||
unlockedPrefs: {
|
||||
"datareporting.policy.dataSubmissionPolicyAcceptedVersion": 0,
|
||||
"datareporting.policy.dataSubmissionPolicyNotifiedTime": "0",
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
policies: {
|
||||
UserMessaging: {
|
||||
SkipTermsOfUse: true,
|
||||
Locked: true,
|
||||
},
|
||||
},
|
||||
lockedPrefs: {
|
||||
"datareporting.policy.dataSubmissionPolicyAcceptedVersion": 999,
|
||||
// "datareporting.policy.dataSubmissionPolicyNotifiedTime" is a string of
|
||||
// the timestamp at which the policy was set, this is tested in
|
||||
// browser/components/enterprisepolicies/tests/browser/browser_policy_usermessaging.js
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
policies: {
|
||||
UserMessaging: {
|
||||
|
||||
@@ -226,6 +226,8 @@ policy-SecurityDevices2 = Add or delete PKCS #11 modules.
|
||||
|
||||
policy-ShowHomeButton = Show the home button on the toolbar.
|
||||
|
||||
policy-SkipTermsOfUse = Don’t show the Terms of Use and Privacy Notice on startup.
|
||||
|
||||
policy-SSLVersionMax = Set the maximum SSL version.
|
||||
|
||||
policy-SSLVersionMin = Set the minimum SSL version.
|
||||
|
||||
Reference in New Issue
Block a user