Bug 1547813 - Part 10: Add support for nsICookieService.BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN to the content blocking category pref; r=ewright

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Ehsan Akhgari 2019-05-08 22:34:06 +00:00
Родитель b9c7626390
Коммит 31c7d14341
5 изменённых файлов: 18 добавлений и 0 удалений

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

@ -1610,6 +1610,7 @@ pref("browser.contentblocking.fingerprinting.preferences.ui.enabled", true);
// "cookieBehavior2": cookie behaviour BEHAVIOR_REJECT
// "cookieBehavior3": cookie behaviour BEHAVIOR_LIMIT_FOREIGN
// "cookieBehavior4": cookie behaviour BEHAVIOR_REJECT_TRACKER
// "cookieBehavior5": cookie behaviour BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN
// One value from each section must be included in each browser.contentblocking.features.* pref.
pref("browser.contentblocking.features.strict", "tp,tpPrivate,cookieBehavior4,cm,fp");
// Enable blocking access to storage from tracking resources only in nightly

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

@ -3086,6 +3086,9 @@ var ContentBlockingCategoriesPrefs = {
case "cookieBehavior4":
this.CATEGORY_PREFS[type]["network.cookie.cookieBehavior"] = Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER;
break;
case "cookieBehavior5":
this.CATEGORY_PREFS[type]["network.cookie.cookieBehavior"] = Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN;
break;
default:
Cu.reportError(`Error: Unknown rule observed ${item}`);
}

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

@ -565,6 +565,9 @@ var gPrivacyPane = {
case "cookieBehavior4":
document.querySelector(selector + " .third-party-tracking-cookies-option").hidden = false;
break;
case "cookieBehavior5":
// No UI support for this cookie policy yet
break;
}
}
// Hide the "tracking protection in private browsing" list item

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

@ -273,6 +273,9 @@ add_task(async function testContentBlockingStrictCategory() {
case "cookieBehavior4":
is(Services.prefs.getIntPref(NCB_PREF), Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER, `${NCB_PREF} has been set to ${Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER}`);
break;
case "cookieBehavior5":
is(Services.prefs.getIntPref(NCB_PREF), Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN, `${NCB_PREF} has been set to ${Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN}`);
break;
default:
ok(false, "unknown option was added to the strict pref");
break;
@ -325,6 +328,7 @@ add_task(async function testContentBlockingCustomCategory() {
nonDefaultNCB = Ci.nsICookieService.BEHAVIOR_REJECT;
break;
case Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER:
case Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN:
nonDefaultNCB = Ci.nsICookieService.BEHAVIOR_ACCEPT;
break;
default:

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

@ -42,6 +42,13 @@ add_task(async function testContentBlockingStandardDefinition() {
ok(!Services.prefs.prefHasUserValue(CM_PREF), `${CM_PREF} pref has the default value`);
ok(!Services.prefs.prefHasUserValue(NCB_PREF), `${NCB_PREF} pref has the default value`);
defaults.setStringPref(STANDARD_DEF_PREF, "tp,-tpPrivate,fp,-cm,cookieBehavior5");
is(Services.prefs.getBoolPref(TP_PREF), true, `${TP_PREF} pref has been set to true`);
is(Services.prefs.getBoolPref(TP_PBM_PREF), false, `${TP_PBM_PREF} pref has been set to true`);
is(Services.prefs.getBoolPref(FP_PREF), true, `${CM_PREF} pref has been set to true`);
is(Services.prefs.getBoolPref(CM_PREF), false, `${CM_PREF} pref has been set to true`);
is(Services.prefs.getIntPref(NCB_PREF), Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN, `${NCB_PREF} has been set to BEHAVIOR_REJECT_TRACKER`);
defaults.setStringPref(STANDARD_DEF_PREF, "-tpPrivate,-fp,-cm,-tp,cookieBehavior2");
is(Services.prefs.getBoolPref(TP_PREF), false, `${TP_PREF} pref has been set to false`);
is(Services.prefs.getBoolPref(TP_PBM_PREF), false, `${TP_PBM_PREF} pref has been set to false`);