Bug 1547813 - Part 10: Add support for nsICookieService.BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN to the content blocking category pref; r=ewright
☠☠ backed out by 8fea66166287 ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 08 May 2019 22:34:06 +0000
changeset 532063 a29f58cef0224159623273401d17c769ab98fc6d
parent 532062 c1288949de1cc38beee2a6cea0704f59c46f2551
child 532064 f9d790139a26b2733cb1f83bdecce06633f4f94a
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersewright
bugs1547813
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
browser/app/profile/firefox.js
browser/components/BrowserGlue.jsm
browser/components/preferences/in-content/privacy.js
browser/components/preferences/in-content/tests/browser_contentblocking.js
browser/components/preferences/in-content/tests/browser_contentblocking_categories.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1605,16 +1605,17 @@ pref("browser.contentblocking.fingerprin
 //     "cm": cryptomining blocking enabled
 //     "-cm": cryptomining blocking disabled
 //   Cookie behavior:
 //     "cookieBehavior0": cookie behaviour BEHAVIOR_ACCEPT
 //     "cookieBehavior1": cookie behaviour BEHAVIOR_REJECT_FOREIGN
 //     "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
 // and early beta. By default the value is "cookieBehavior0": BEHAVIOR_ACCEPT
 // Enable cryptomining blocking in standard in nightly and early beta.
 // Enable fingerprinting blocking in standard in nightly and early beta.
 #ifdef EARLY_BETA_OR_EARLIER
 pref("browser.contentblocking.features.standard", "-tp,tpPrivate,cookieBehavior4,cm,fp");
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -3081,16 +3081,19 @@ var ContentBlockingCategoriesPrefs = {
           this.CATEGORY_PREFS[type]["network.cookie.cookieBehavior"] = Ci.nsICookieService.BEHAVIOR_REJECT;
           break;
         case "cookieBehavior3":
           this.CATEGORY_PREFS[type]["network.cookie.cookieBehavior"] = Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN;
           break;
         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}`);
         }
       }
     }
   },
 
   /**
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -560,16 +560,19 @@ var gPrivacyPane = {
           document.querySelector(selector + " .all-cookies-option").hidden = false;
           break;
         case "cookieBehavior3":
           document.querySelector(selector + " .unvisited-cookies-option").hidden = false;
           break;
         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
       // if the "tracking protection enabled in all windows" list item is showing.
       if (!document.querySelector(selector + " .trackers-option").hidden) {
         document.querySelector(selector + " .pb-trackers-option").hidden = true;
       }
     }
--- a/browser/components/preferences/in-content/tests/browser_contentblocking.js
+++ b/browser/components/preferences/in-content/tests/browser_contentblocking.js
@@ -268,16 +268,19 @@ add_task(async function testContentBlock
       is(Services.prefs.getIntPref(NCB_PREF), Ci.nsICookieService.BEHAVIOR_REJECT, `${NCB_PREF} has been set to ${Ci.nsICookieService.BEHAVIOR_REJECT}`);
       break;
     case "cookieBehavior3":
       is(Services.prefs.getIntPref(NCB_PREF), Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN, `${NCB_PREF} has been set to ${Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN}`);
       break;
     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;
     }
   }
 
   gBrowser.removeCurrentTab();
 });
@@ -320,16 +323,17 @@ add_task(async function testContentBlock
   // Changing the NCB_PREF should necessarily set CAT_PREF to "custom"
   let defaultNCB = defaults.get(NCB_PREF);
   let nonDefaultNCB;
   switch (defaultNCB) {
   case Ci.nsICookieService.BEHAVIOR_ACCEPT:
     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:
     ok(false, "Unexpected default value found for " + NCB_PREF + ": " + defaultNCB);
     break;
   }
   Services.prefs.setIntPref(NCB_PREF, nonDefaultNCB);
   await TestUtils.waitForCondition(() => Services.prefs.prefHasUserValue(NCB_PREF));
--- a/browser/components/preferences/in-content/tests/browser_contentblocking_categories.js
+++ b/browser/components/preferences/in-content/tests/browser_contentblocking_categories.js
@@ -37,16 +37,23 @@ add_task(async function testContentBlock
   // backup if a mistake is made. The UI will not respond correctly.
   defaults.setStringPref(STANDARD_DEF_PREF, "");
   ok(!Services.prefs.prefHasUserValue(TP_PREF), `${TP_PREF} pref has the default value`);
   ok(!Services.prefs.prefHasUserValue(TP_PBM_PREF), `${TP_PBM_PREF} pref has the default value`);
   ok(!Services.prefs.prefHasUserValue(FP_PREF), `${FP_PREF} pref has the default value`);
   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`);
   is(Services.prefs.getBoolPref(FP_PREF), false, `${FP_PREF} pref has been set to false`);
   is(Services.prefs.getBoolPref(CM_PREF), false, `${CM_PREF} pref has been set to false`);
   is(Services.prefs.getIntPref(NCB_PREF), Ci.nsICookieService.BEHAVIOR_REJECT, `${NCB_PREF} has been set to BEHAVIOR_REJECT_TRACKER`);
 
   // cleanup