Bug 1907390 - Add BounceTrackingProtection prefs to ETP Strict configuration. r=anti-tracking-reviewers,settings-reviewers,firefox-desktop-core-reviewers ,manuel
Differential Revision: https://phabricator.services.mozilla.com/D225681
This commit is contained in:
@@ -2249,8 +2249,11 @@ pref("browser.contentblocking.reject-and-isolate-cookies.preferences.ui.enabled"
|
||||
// Third-party cookie deprecation behavior:
|
||||
// "3pcd": Third-party cookie deprecation enabled
|
||||
// "-3pcd": Third-party cookie deprecation disabled
|
||||
// Bounce Tracking Protection:
|
||||
// "btp": BTP enabled
|
||||
// "-btp": BTP disabled
|
||||
// One value from each section must be included in the browser.contentblocking.features.strict pref.
|
||||
pref("browser.contentblocking.features.strict", "tp,tpPrivate,cookieBehavior5,cookieBehaviorPBM5,cm,fp,stp,emailTP,emailTPPrivate,lvl2,rp,rpTop,ocsp,qps,qpsPBM,fpp,fppPrivate,3pcd");
|
||||
pref("browser.contentblocking.features.strict", "tp,tpPrivate,cookieBehavior5,cookieBehaviorPBM5,cm,fp,stp,emailTP,emailTPPrivate,lvl2,rp,rpTop,ocsp,qps,qpsPBM,fpp,fppPrivate,3pcd,btp");
|
||||
|
||||
// Hide the "Change Block List" link for trackers/tracking content in the custom
|
||||
// Content Blocking/ETP panel. By default, it will not be visible. There is also
|
||||
|
||||
@@ -5246,6 +5246,7 @@ var ContentBlockingCategoriesPrefs = {
|
||||
"privacy.fingerprintingProtection": null,
|
||||
"privacy.fingerprintingProtection.pbmode": null,
|
||||
"network.cookie.cookieBehavior.optInPartitioning": null,
|
||||
"privacy.bounceTrackingProtection.mode": null,
|
||||
},
|
||||
standard: {
|
||||
"network.cookie.cookieBehavior": null,
|
||||
@@ -5267,6 +5268,7 @@ var ContentBlockingCategoriesPrefs = {
|
||||
"privacy.fingerprintingProtection": null,
|
||||
"privacy.fingerprintingProtection.pbmode": null,
|
||||
"network.cookie.cookieBehavior.optInPartitioning": null,
|
||||
"privacy.bounceTrackingProtection.mode": null,
|
||||
},
|
||||
};
|
||||
let type = "strict";
|
||||
@@ -5475,6 +5477,16 @@ var ContentBlockingCategoriesPrefs = {
|
||||
"network.cookie.cookieBehavior.optInPartitioning"
|
||||
] = false;
|
||||
break;
|
||||
case "btp":
|
||||
this.CATEGORY_PREFS[type]["privacy.bounceTrackingProtection.mode"] =
|
||||
Ci.nsIBounceTrackingProtection.MODE_ENABLED;
|
||||
break;
|
||||
case "-btp":
|
||||
// We currently consider MODE_ENABLED_DRY_RUN the "off" state. See
|
||||
// nsIBounceTrackingProtection.idl for details.
|
||||
this.CATEGORY_PREFS[type]["privacy.bounceTrackingProtection.mode"] =
|
||||
Ci.nsIBounceTrackingProtection.MODE_ENABLED_DRY_RUN;
|
||||
break;
|
||||
default:
|
||||
console.error(`Error: Unknown rule observed ${item}`);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ const FPP_PREF = "privacy.fingerprintingProtection";
|
||||
const FPP_PBM_PREF = "privacy.fingerprintingProtection.pbmode";
|
||||
const THIRD_PARTY_COOKIE_DEPRECATION_PREF =
|
||||
"network.cookie.cookieBehavior.optInPartitioning";
|
||||
const BTP_PREF = "privacy.bounceTrackingProtection.mode";
|
||||
|
||||
const { EnterprisePolicyTesting, PoliciesPrefTracker } =
|
||||
ChromeUtils.importESModule(
|
||||
@@ -342,6 +343,7 @@ add_task(async function testContentBlockingStandardCategory() {
|
||||
[FPP_PREF]: null,
|
||||
[FPP_PBM_PREF]: null,
|
||||
[THIRD_PARTY_COOKIE_DEPRECATION_PREF]: null,
|
||||
[BTP_PREF]: null,
|
||||
};
|
||||
|
||||
for (let pref in prefs) {
|
||||
@@ -412,6 +414,10 @@ add_task(async function testContentBlockingStandardCategory() {
|
||||
THIRD_PARTY_COOKIE_DEPRECATION_PREF,
|
||||
!Services.prefs.getBoolPref(THIRD_PARTY_COOKIE_DEPRECATION_PREF)
|
||||
);
|
||||
Services.prefs.setIntPref(
|
||||
BTP_PREF,
|
||||
Ci.nsIBounceTrackingProtection.MODE_ENABLED
|
||||
);
|
||||
|
||||
for (let pref in prefs) {
|
||||
switch (Services.prefs.getPrefType(pref)) {
|
||||
@@ -491,6 +497,10 @@ add_task(async function testContentBlockingStrictCategory() {
|
||||
Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN
|
||||
);
|
||||
Services.prefs.setBoolPref(THIRD_PARTY_COOKIE_DEPRECATION_PREF, false);
|
||||
Services.prefs.setIntPref(
|
||||
BTP_PREF,
|
||||
Ci.nsIBounceTrackingProtection.MODE_ENABLED_DRY_RUN
|
||||
);
|
||||
let strict_pref = Services.prefs.getStringPref(STRICT_PREF).split(",");
|
||||
|
||||
await openPreferencesViaOpenPreferencesAPI("privacy", { leaveOpen: true });
|
||||
@@ -815,6 +825,20 @@ add_task(async function testContentBlockingStrictCategory() {
|
||||
`${THIRD_PARTY_COOKIE_DEPRECATION_PREF} has been set to false`
|
||||
);
|
||||
break;
|
||||
case "btp":
|
||||
is(
|
||||
Services.prefs.getIntPref(BTP_PREF),
|
||||
Ci.nsIBounceTrackingProtection.MODE_ENABLED,
|
||||
`${BTP_PREF} has been set to MODE_ENABLED`
|
||||
);
|
||||
break;
|
||||
case "-btp":
|
||||
is(
|
||||
Services.prefs.getIntPref(BTP_PREF),
|
||||
Ci.nsIBounceTrackingProtection.MODE_ENABLED_DRY_RUN,
|
||||
`${BTP_PREF} has been set to MODE_ENABLED_DRY_RUN`
|
||||
);
|
||||
break;
|
||||
default:
|
||||
ok(false, "unknown option was added to the strict pref");
|
||||
break;
|
||||
|
||||
@@ -29,6 +29,7 @@ const FPP_PREF = "privacy.fingerprintingProtection";
|
||||
const FPP_PBM_PREF = "privacy.fingerprintingProtection.pbmode";
|
||||
const THIRD_PARTY_COOKIE_DEPRECATION_PREF =
|
||||
"network.cookie.cookieBehavior.optInPartitioning";
|
||||
const BTP_PREF = "privacy.bounceTrackingProtection.mode";
|
||||
const STRICT_DEF_PREF = "browser.contentblocking.features.strict";
|
||||
|
||||
// Tests that the content blocking standard category definition is based on the default settings of
|
||||
@@ -115,6 +116,10 @@ add_task(async function testContentBlockingStandardDefinition() {
|
||||
!Services.prefs.prefHasUserValue(THIRD_PARTY_COOKIE_DEPRECATION_PREF),
|
||||
`${THIRD_PARTY_COOKIE_DEPRECATION_PREF} pref has the default value`
|
||||
);
|
||||
ok(
|
||||
!Services.prefs.prefHasUserValue(BTP_PREF),
|
||||
`${BTP_PREF} pref has the default value`
|
||||
);
|
||||
|
||||
let defaults = Services.prefs.getDefaultBranch("");
|
||||
let originalTP = defaults.getBoolPref(TP_PREF);
|
||||
@@ -137,6 +142,7 @@ add_task(async function testContentBlockingStandardDefinition() {
|
||||
let originalFPP = defaults.getBoolPref(FPP_PREF);
|
||||
let originalFPPPBM = defaults.getBoolPref(FPP_PBM_PREF);
|
||||
let original3PCD = defaults.getBoolPref(THIRD_PARTY_COOKIE_DEPRECATION_PREF);
|
||||
let originalBTP = defaults.getIntPref(BTP_PREF);
|
||||
|
||||
let nonDefaultNCB;
|
||||
switch (originalNCB) {
|
||||
@@ -175,6 +181,7 @@ add_task(async function testContentBlockingStandardDefinition() {
|
||||
defaults.setBoolPref(FPP_PREF, !originalFPP);
|
||||
defaults.setBoolPref(FPP_PBM_PREF, !originalFPPPBM);
|
||||
defaults.setBoolPref(THIRD_PARTY_COOKIE_DEPRECATION_PREF, !original3PCD);
|
||||
defaults.setIntPref(BTP_PREF, Ci.nsIBounceTrackingProtection.MODE_ENABLED);
|
||||
|
||||
ok(
|
||||
!Services.prefs.prefHasUserValue(TP_PREF),
|
||||
@@ -248,6 +255,10 @@ add_task(async function testContentBlockingStandardDefinition() {
|
||||
!Services.prefs.prefHasUserValue(THIRD_PARTY_COOKIE_DEPRECATION_PREF),
|
||||
`${THIRD_PARTY_COOKIE_DEPRECATION_PREF} pref has the default value`
|
||||
);
|
||||
ok(
|
||||
!Services.prefs.prefHasUserValue(BTP_PREF),
|
||||
`${BTP_PREF} pref has the default value`
|
||||
);
|
||||
|
||||
// cleanup
|
||||
defaults.setIntPref(NCB_PREF, originalNCB);
|
||||
@@ -269,6 +280,7 @@ add_task(async function testContentBlockingStandardDefinition() {
|
||||
defaults.setBoolPref(FPP_PREF, originalFPP);
|
||||
defaults.setBoolPref(FPP_PBM_PREF, originalFPPPBM);
|
||||
defaults.setBoolPref(THIRD_PARTY_COOKIE_DEPRECATION_PREF, original3PCD);
|
||||
defaults.setIntPref(BTP_PREF, originalBTP);
|
||||
});
|
||||
|
||||
// Tests that the content blocking strict category definition changes the behavior
|
||||
@@ -279,7 +291,7 @@ add_task(async function testContentBlockingStrictDefinition() {
|
||||
let originalStrictPref = defaults.getStringPref(STRICT_DEF_PREF);
|
||||
defaults.setStringPref(
|
||||
STRICT_DEF_PREF,
|
||||
"tp,tpPrivate,fp,cm,cookieBehavior0,cookieBehaviorPBM0,stp,emailTP,emailTPPrivate,lvl2,rp,rpTop,ocsp,qps,qpsPBM,fpp,fppPrivate,3pcd"
|
||||
"tp,tpPrivate,fp,cm,cookieBehavior0,cookieBehaviorPBM0,stp,emailTP,emailTPPrivate,lvl2,rp,rpTop,ocsp,qps,qpsPBM,fpp,fppPrivate,3pcd,btp"
|
||||
);
|
||||
Services.prefs.setStringPref(CAT_PREF, "strict");
|
||||
is(
|
||||
@@ -294,7 +306,7 @@ add_task(async function testContentBlockingStrictDefinition() {
|
||||
);
|
||||
is(
|
||||
Services.prefs.getStringPref(STRICT_DEF_PREF),
|
||||
"tp,tpPrivate,fp,cm,cookieBehavior0,cookieBehaviorPBM0,stp,emailTP,emailTPPrivate,lvl2,rp,rpTop,ocsp,qps,qpsPBM,fpp,fppPrivate,3pcd",
|
||||
"tp,tpPrivate,fp,cm,cookieBehavior0,cookieBehaviorPBM0,stp,emailTP,emailTPPrivate,lvl2,rp,rpTop,ocsp,qps,qpsPBM,fpp,fppPrivate,3pcd,btp",
|
||||
`${STRICT_DEF_PREF} changed to what we set.`
|
||||
);
|
||||
|
||||
@@ -388,6 +400,11 @@ add_task(async function testContentBlockingStrictDefinition() {
|
||||
true,
|
||||
`${THIRD_PARTY_COOKIE_DEPRECATION_PREF} pref has been set to true`
|
||||
);
|
||||
is(
|
||||
Services.prefs.getIntPref(BTP_PREF),
|
||||
Ci.nsIBounceTrackingProtection.MODE_ENABLED,
|
||||
`${BTP_PREF} pref has been set to MODE_ENABLED`
|
||||
);
|
||||
|
||||
// Note, if a pref is not listed it will use the default value, however this is only meant as a
|
||||
// backup if a mistake is made. The UI will not respond correctly.
|
||||
@@ -464,10 +481,14 @@ add_task(async function testContentBlockingStrictDefinition() {
|
||||
!Services.prefs.prefHasUserValue(THIRD_PARTY_COOKIE_DEPRECATION_PREF),
|
||||
`${THIRD_PARTY_COOKIE_DEPRECATION_PREF} pref has the default value`
|
||||
);
|
||||
ok(
|
||||
!Services.prefs.prefHasUserValue(BTP_PREF),
|
||||
`${BTP_PREF} pref has the default value`
|
||||
);
|
||||
|
||||
defaults.setStringPref(
|
||||
STRICT_DEF_PREF,
|
||||
"-tpPrivate,-fp,-cm,-tp,cookieBehavior3,cookieBehaviorPBM2,-stp,-emailTP,-emailTPPrivate,-lvl2,-rp,-ocsp,-qps,-qpsPBM,-fpp,-fppPrivate,-3pcd"
|
||||
"-tpPrivate,-fp,-cm,-tp,cookieBehavior3,cookieBehaviorPBM2,-stp,-emailTP,-emailTPPrivate,-lvl2,-rp,-ocsp,-qps,-qpsPBM,-fpp,-fppPrivate,-3pcd,-btp"
|
||||
);
|
||||
is(
|
||||
Services.prefs.getBoolPref(TP_PREF),
|
||||
@@ -559,6 +580,11 @@ add_task(async function testContentBlockingStrictDefinition() {
|
||||
false,
|
||||
`${THIRD_PARTY_COOKIE_DEPRECATION_PREF} pref has been set to false`
|
||||
);
|
||||
is(
|
||||
Services.prefs.getIntPref(BTP_PREF),
|
||||
Ci.nsIBounceTrackingProtection.MODE_ENABLED_DRY_RUN,
|
||||
`${BTP_PREF} pref has been set to MODE_ENABLED_DRY_RUN`
|
||||
);
|
||||
|
||||
// cleanup
|
||||
defaults.setStringPref(STRICT_DEF_PREF, originalStrictPref);
|
||||
|
||||
@@ -23,9 +23,12 @@ interface nsIBounceTrackingProtection : nsISupports {
|
||||
* without risking data loss.
|
||||
*
|
||||
* For toggling the feature in privacy settings UI switch between
|
||||
* MODE_ENABLED and MODE_NO_PURGE. This is important so that user activation
|
||||
* signals are still collected even if the feature is "turned off" for the
|
||||
* user.
|
||||
* MODE_ENABLED and MODE_ENABLED_DRY_RUN. This is important so that user
|
||||
* activation signals and telemetry are still collected even if the feature
|
||||
* is "turned off" for the user. In the future when we're done collecting
|
||||
* telemetry we may switch this to MODE_ENABLED_STANDBY where we still
|
||||
* collect user activation signals but do not simulate purging.
|
||||
*
|
||||
* Fully enabling / disabling the feature (MODE_DISABLED -> x or x ->
|
||||
* MODE_DISABLED) requires a restart to apply.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user