зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1766441 - Remove study prefs set on TCP rollout opt-in/out. r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D144721
This commit is contained in:
Родитель
a29d6732b6
Коммит
b0377fa482
|
@ -18,23 +18,7 @@ const COOKIE_BEHAVIOR_PREF = "network.cookie.cookieBehavior";
|
|||
const defaultPrefs = Services.prefs.getDefaultBranch("");
|
||||
const previousDefaultCB = defaultPrefs.getIntPref(COOKIE_BEHAVIOR_PREF);
|
||||
|
||||
const SEARCH_PREFS_OPT_IN = [
|
||||
["browser.search.param.google_channel_us", "tus7"],
|
||||
["browser.search.param.google_channel_row", "trow7"],
|
||||
["browser.search.param.bing_ptag", "MOZZ0000000031"],
|
||||
];
|
||||
|
||||
const SEARCH_PREFS_OPT_OUT = [
|
||||
["browser.search.param.google_channel_us", "tus7"],
|
||||
["browser.search.param.google_channel_row", "trow7"],
|
||||
["browser.search.param.bing_ptag", "MOZZ0000000031"],
|
||||
];
|
||||
|
||||
function cleanup() {
|
||||
[...SEARCH_PREFS_OPT_IN, ...SEARCH_PREFS_OPT_OUT].forEach(([key]) =>
|
||||
Services.prefs.clearUserPref(key)
|
||||
);
|
||||
|
||||
[COOKIE_BEHAVIOR_PREF, PREF_DFPI_ENABLED_BY_DEFAULT].forEach(
|
||||
Services.prefs.clearUserPref
|
||||
);
|
||||
|
@ -47,22 +31,6 @@ function cleanup() {
|
|||
Services.telemetry.scalarSet("privacy.dfpi_rollout_enabledByDefault", 2);
|
||||
}
|
||||
|
||||
function testSearchPrefState(optIn) {
|
||||
let expectedPrefs = optIn ? SEARCH_PREFS_OPT_IN : SEARCH_PREFS_OPT_OUT;
|
||||
|
||||
expectedPrefs.forEach(([key, value]) => {
|
||||
ok(
|
||||
Services.prefs.prefHasUserValue(key),
|
||||
`Pref '${key}' should have user value.'`
|
||||
);
|
||||
is(
|
||||
Services.prefs.getStringPref(key),
|
||||
value,
|
||||
`Pref '${key}' should have correct value.`
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function testTelemetryState(optIn) {
|
||||
let expectedValue;
|
||||
if (optIn == null) {
|
||||
|
@ -100,7 +68,6 @@ add_task(async function testdFPIRolloutPref() {
|
|||
defaultPrefs.getIntPref(COOKIE_BEHAVIOR_PREF),
|
||||
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER
|
||||
);
|
||||
testSearchPrefState(false);
|
||||
testTelemetryState(false);
|
||||
|
||||
Services.prefs.setBoolPref(PREF_DFPI_ENABLED_BY_DEFAULT, true);
|
||||
|
@ -108,7 +75,6 @@ add_task(async function testdFPIRolloutPref() {
|
|||
defaultPrefs.getIntPref(COOKIE_BEHAVIOR_PREF),
|
||||
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN
|
||||
);
|
||||
testSearchPrefState(true);
|
||||
testTelemetryState(true);
|
||||
|
||||
Services.prefs.setBoolPref(PREF_DFPI_ENABLED_BY_DEFAULT, false);
|
||||
|
@ -116,7 +82,6 @@ add_task(async function testdFPIRolloutPref() {
|
|||
defaultPrefs.getIntPref(COOKIE_BEHAVIOR_PREF),
|
||||
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER
|
||||
);
|
||||
testSearchPrefState(false);
|
||||
testTelemetryState(false);
|
||||
|
||||
Services.prefs.setBoolPref(PREF_DFPI_ENABLED_BY_DEFAULT, true);
|
||||
|
@ -124,7 +89,6 @@ add_task(async function testdFPIRolloutPref() {
|
|||
defaultPrefs.getIntPref(COOKIE_BEHAVIOR_PREF),
|
||||
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN
|
||||
);
|
||||
testSearchPrefState(true);
|
||||
testTelemetryState(true);
|
||||
|
||||
cleanup();
|
||||
|
|
|
@ -1752,34 +1752,6 @@ BrowserGlue.prototype = {
|
|||
"privacy.dfpi_rollout_enabledByDefault",
|
||||
dFPIEnabled ? 1 : 0
|
||||
);
|
||||
|
||||
if (dFPIEnabled) {
|
||||
Services.prefs.setStringPref(
|
||||
"browser.search.param.google_channel_us",
|
||||
"tus7"
|
||||
);
|
||||
Services.prefs.setStringPref(
|
||||
"browser.search.param.google_channel_row",
|
||||
"trow7"
|
||||
);
|
||||
Services.prefs.setStringPref(
|
||||
"browser.search.param.bing_ptag",
|
||||
"MOZZ0000000031"
|
||||
);
|
||||
} else {
|
||||
Services.prefs.setStringPref(
|
||||
"browser.search.param.google_channel_us",
|
||||
"tus7"
|
||||
);
|
||||
Services.prefs.setStringPref(
|
||||
"browser.search.param.google_channel_row",
|
||||
"trow7"
|
||||
);
|
||||
Services.prefs.setStringPref(
|
||||
"browser.search.param.bing_ptag",
|
||||
"MOZZ0000000031"
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
_setPrefExpectations() {
|
||||
|
|
|
@ -3,18 +3,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const OPT_IN_SEARCH_PREFS = [
|
||||
["browser.search.param.google_channel_us", "tus7"],
|
||||
["browser.search.param.google_channel_row", "trow7"],
|
||||
["browser.search.param.bing_ptag", "MOZZ0000000031"],
|
||||
];
|
||||
|
||||
const OPT_OUT_SEARCH_PREFS = [
|
||||
["browser.search.param.google_channel_us", "tus7"],
|
||||
["browser.search.param.google_channel_row", "trow7"],
|
||||
["browser.search.param.bing_ptag", "MOZZ0000000031"],
|
||||
];
|
||||
|
||||
add_task(async function test_tcp_action() {
|
||||
let PREF = "privacy.restrict3rdpartystorage.rollout.enabledByDefault";
|
||||
|
||||
|
@ -29,7 +17,6 @@ add_task(async function test_tcp_action() {
|
|||
ok(!error, "The action should be valid");
|
||||
|
||||
Services.prefs.clearUserPref(PREF);
|
||||
OPT_IN_SEARCH_PREFS.forEach(([key]) => Services.prefs.clearUserPref(key));
|
||||
});
|
||||
|
||||
add_task(async function test_tcp_section_action() {
|
||||
|
@ -50,7 +37,6 @@ add_task(async function test_tcp_section_action() {
|
|||
|
||||
Services.prefs.clearUserPref(PREF);
|
||||
Services.prefs.clearUserPref(PREF_TCP_ENABLED_BY_DEFAULT);
|
||||
OPT_OUT_SEARCH_PREFS.forEach(([key]) => Services.prefs.clearUserPref(key));
|
||||
});
|
||||
|
||||
add_task(async function test_tcp_action_pref() {
|
||||
|
@ -65,17 +51,7 @@ add_task(async function test_tcp_action_pref() {
|
|||
`Pref '${PREF}' is enabled by the action`
|
||||
);
|
||||
|
||||
OPT_IN_SEARCH_PREFS.forEach(([key, value]) => {
|
||||
Assert.ok(Services.prefs.prefHasUserValue(key));
|
||||
is(
|
||||
Services.prefs.getStringPref(key),
|
||||
value,
|
||||
`Pref '${key}' is set by the action`
|
||||
);
|
||||
});
|
||||
|
||||
Services.prefs.clearUserPref(PREF);
|
||||
OPT_IN_SEARCH_PREFS.forEach(([key]) => Services.prefs.clearUserPref(key));
|
||||
});
|
||||
|
||||
add_task(async function test_tcp_section_action_pref() {
|
||||
|
@ -86,9 +62,6 @@ add_task(async function test_tcp_section_action_pref() {
|
|||
|
||||
Assert.ok(!Services.prefs.prefHasUserValue(PREF));
|
||||
Assert.ok(!Services.prefs.prefHasUserValue(PREF_TCP_ENABLED_BY_DEFAULT));
|
||||
OPT_OUT_SEARCH_PREFS.forEach(([key]) =>
|
||||
Assert.ok(!Services.prefs.prefHasUserValue(key))
|
||||
);
|
||||
|
||||
await SMATestUtils.executeAndValidateAction({
|
||||
type: "ENABLE_TOTAL_COOKIE_PROTECTION_SECTION_AND_OPT_OUT",
|
||||
|
@ -105,16 +78,6 @@ add_task(async function test_tcp_section_action_pref() {
|
|||
`Pref '${PREF_TCP_ENABLED_BY_DEFAULT}' is disabled by the action`
|
||||
);
|
||||
|
||||
OPT_OUT_SEARCH_PREFS.forEach(([key, value]) => {
|
||||
Assert.ok(Services.prefs.prefHasUserValue(key));
|
||||
is(
|
||||
Services.prefs.getStringPref(key),
|
||||
value,
|
||||
`Pref '${key}' is set by the action`
|
||||
);
|
||||
});
|
||||
|
||||
Services.prefs.clearUserPref(PREF);
|
||||
Services.prefs.clearUserPref(PREF_TCP_ENABLED_BY_DEFAULT);
|
||||
OPT_OUT_SEARCH_PREFS.forEach(([key]) => Services.prefs.clearUserPref(key));
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче