Bug 1551675 - remove the Standard category pref and depend on default values to compute standard settings. r=johannh
authorErica Wright <ewright@mozilla.com>
Thu, 16 May 2019 22:05:47 +0000
changeset 474344 b8ad543d54474d5c7dd5faaf714be7d77165c805
parent 474343 566c25b14d477ff86772ed8bb270d64609f5a3dc
child 474345 2bc53ddb0a2b142662265355e54c6deb3ab716ad
push id113149
push userrgurzau@mozilla.com
push dateFri, 17 May 2019 21:50:06 +0000
treeherdermozilla-inbound@6e4c58629a7c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1551675
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 1551675 - remove the Standard category pref and depend on default values to compute standard settings. r=johannh The standard category pref is gone. When the default values change the standard category will change it's expectations to match. Differential Revision: https://phabricator.services.mozilla.com/D31138
browser/app/profile/firefox.js
browser/components/BrowserGlue.jsm
browser/components/preferences/in-content/privacy.js
browser/components/preferences/in-content/tests/browser_contentblocking_categories.js
modules/libpref/init/StaticPrefList.h
modules/libpref/init/all.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1183,17 +1183,16 @@ pref("services.sync.prefs.sync.accessibi
 pref("services.sync.prefs.sync.accessibility.typeaheadfind.linksonly", true);
 pref("services.sync.prefs.sync.addons.ignoreUserEnabledChanges", true);
 // The addons prefs related to repository verification are intentionally
 // not synced for security reasons. If a system is compromised, a user
 // could weaken the pref locally, install an add-on from an untrusted
 // source, and this would propagate automatically to other,
 // uncompromised Sync-connected devices.
 pref("services.sync.prefs.sync.browser.contentblocking.category", true);
-pref("services.sync.prefs.sync.browser.contentblocking.features.standard", true);
 pref("services.sync.prefs.sync.browser.contentblocking.features.strict", true);
 pref("services.sync.prefs.sync.browser.contentblocking.introCount", true);
 pref("services.sync.prefs.sync.browser.crashReports.unsubmittedCheck.autoSubmit2", true);
 pref("services.sync.prefs.sync.browser.ctrlTab.recentlyUsedOrder", true);
 pref("services.sync.prefs.sync.browser.download.useDownloadDir", true);
 pref("services.sync.prefs.sync.browser.formfill.enable", true);
 pref("services.sync.prefs.sync.browser.link.open_newwindow", true);
 pref("services.sync.prefs.sync.browser.newtabpage.activity-stream.showSearch", true);
@@ -1586,17 +1585,17 @@ pref("browser.contentblocking.trackingpr
 pref("browser.contentblocking.rejecttrackers.control-center.ui.enabled", true);
 
 pref("browser.contentblocking.control-center.ui.showBlockedLabels", true);
 pref("browser.contentblocking.control-center.ui.showAllowedLabels", false);
 
 pref("browser.contentblocking.cryptomining.preferences.ui.enabled", true);
 pref("browser.contentblocking.fingerprinting.preferences.ui.enabled", true);
 
-// Possible values for browser.contentblocking.features.* prefs:
+// Possible values for browser.contentblocking.features.strict pref:
 //   Tracking Protection:
 //     "tp": tracking protection enabled
 //     "-tp": tracking protection disabled
 //   Tracking Protection in private windows:
 //     "tpPrivate": tracking protection in private windows enabled
 //     "-tpPrivate": tracking protection in private windows disabled
 //   Fingerprinting:
 //     "fp": fingerprinting blocking enabled
@@ -1605,27 +1604,18 @@ 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
-// One value from each section must be included in each browser.contentblocking.features.* pref.
+// One value from each section must be included in the browser.contentblocking.features.strict 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");
-#else
-pref("browser.contentblocking.features.standard", "-tp,tpPrivate,cookieBehavior0,-cm,-fp");
-#endif
 
 // Enable the Report Breakage UI on Nightly and Beta but not on Release yet.
 #ifdef EARLY_BETA_OR_EARLIER
 pref("browser.contentblocking.reportBreakage.enabled", true);
 #else
 pref("browser.contentblocking.reportBreakage.enabled", false);
 #endif
 // Show report breakage for tracking cookies in all channels.
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -1034,18 +1034,18 @@ BrowserGlue.prototype = {
     os.removeObserver(this, "xpi-signature-changed");
     os.removeObserver(this, "sync-ui-state:update");
     os.removeObserver(this, "shield-init-complete");
 
     Services.prefs.removeObserver("permissions.eventTelemetry.enabled", this._togglePermissionPromptTelemetry);
     Services.prefs.removeObserver("privacy.trackingprotection", this._matchCBCategory);
     Services.prefs.removeObserver("network.cookie.cookieBehavior", this._matchCBCategory);
     Services.prefs.removeObserver(ContentBlockingCategoriesPrefs.PREF_CB_CATEGORY, this._updateCBCategory);
-    Services.prefs.removeObserver("browser.contentblocking.features.standard", this._setPrefExpectations);
-    Services.prefs.removeObserver("browser.contentblocking.features.strict", this._setPrefExpectations);
+    Services.prefs.removeObserver("privacy.trackingprotection", this._setPrefExpectations);
+    Services.prefs.removeObserver("browser.contentblocking.features.strict", this._setPrefExpectationsAndUpdate);
   },
 
   // runs on startup, before the first command line handler is invoked
   // (i.e. before the first window is opened)
   _beforeUIStartup: function BG__beforeUIStartup() {
     SessionStartup.init();
 
     if (Services.prefs.prefHasUserValue(PREF_PDFJS_ENABLED_CACHE_STATE)) {
@@ -1386,35 +1386,39 @@ BrowserGlue.prototype = {
 
     this._firstWindowTelemetry(aWindow);
     this._firstWindowLoaded();
 
     this._collectStartupConditionsTelemetry();
 
     // Set the default favicon size for UI views that use the page-icon protocol.
     PlacesUtils.favicons.setDefaultIconURIPreferredSize(16 * aWindow.devicePixelRatio);
-    this._setPrefExpectations();
+    this._setPrefExpectationsAndUpdate();
     this._matchCBCategory();
 
     // This observes the entire privacy.trackingprotection.* pref tree.
     Services.prefs.addObserver("privacy.trackingprotection", this._matchCBCategory);
     Services.prefs.addObserver("network.cookie.cookieBehavior", this._matchCBCategory);
     Services.prefs.addObserver(ContentBlockingCategoriesPrefs.PREF_CB_CATEGORY, this._updateCBCategory);
     Services.prefs.addObserver("media.autoplay.default", this._updateAutoplayPref);
-    Services.prefs.addObserver("browser.contentblocking.features.standard", this._setPrefExpectations);
-    Services.prefs.addObserver("browser.contentblocking.features.strict", this._setPrefExpectations);
+    Services.prefs.addObserver("privacy.trackingprotection", this._setPrefExpectations);
+    Services.prefs.addObserver("browser.contentblocking.features.strict", this._setPrefExpectationsAndUpdate);
   },
 
   _updateAutoplayPref() {
     let blocked = Services.prefs.getIntPref("media.autoplay.default", 1);
     Services.telemetry.scalarSet("media.autoplay_default_blocked", blocked);
   },
 
   _setPrefExpectations() {
     ContentBlockingCategoriesPrefs.setPrefExpectations();
+  },
+
+  _setPrefExpectationsAndUpdate() {
+    ContentBlockingCategoriesPrefs.setPrefExpectations();
     ContentBlockingCategoriesPrefs.updateCBCategory();
   },
 
   _matchCBCategory() {
     ContentBlockingCategoriesPrefs.matchCBCategory();
   },
 
   _updateCBCategory() {
@@ -3013,108 +3017,99 @@ BrowserGlue.prototype = {
 
   QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver,
                                           Ci.nsISupportsWeakReference]),
 };
 
 var ContentBlockingCategoriesPrefs = {
   PREF_CB_CATEGORY: "browser.contentblocking.category",
   PREF_STRICT_DEF: "browser.contentblocking.features.strict",
-  PREF_STANDARD_DEF: "browser.contentblocking.features.standard",
   switchingCategory: false,
 
   setPrefExpectations() {
-    // The prefs inside CATEGORY_PREFS are initial values, these values then get set.
-    // If the pref remains null, then it will expect the default value,
-    // but the UI will not respond correctly.
+    // The prefs inside CATEGORY_PREFS are initial values.
+    // If the pref remains null, then it will expect the default value.
+    // The "standard" category is defined as expecting all 5 default values.
     this.CATEGORY_PREFS = {
       strict: {
         "network.cookie.cookieBehavior": null,
         "privacy.trackingprotection.pbmode.enabled": null,
         "privacy.trackingprotection.enabled": null,
         "privacy.trackingprotection.fingerprinting.enabled": null,
         "privacy.trackingprotection.cryptomining.enabled": null,
       },
       standard: {
         "network.cookie.cookieBehavior": null,
         "privacy.trackingprotection.pbmode.enabled": null,
         "privacy.trackingprotection.enabled": null,
         "privacy.trackingprotection.fingerprinting.enabled": null,
         "privacy.trackingprotection.cryptomining.enabled": null,
       },
     };
-    let types = ["strict", "standard"];
-    for (let type of types) {
-      let rulesArray;
-      if (type == "strict") {
-        rulesArray = Services.prefs.getStringPref(this.PREF_STRICT_DEF).split(",");
-      } else {
-        rulesArray = Services.prefs.getStringPref(this.PREF_STANDARD_DEF).split(",");
-      }
-      for (let item of rulesArray) {
-        switch (item) {
-        case "tp":
-          this.CATEGORY_PREFS[type]["privacy.trackingprotection.enabled"] = true;
-          break;
-        case "-tp":
-          this.CATEGORY_PREFS[type]["privacy.trackingprotection.enabled"] = false;
-          break;
-        case "tpPrivate":
-          this.CATEGORY_PREFS[type]["privacy.trackingprotection.pbmode.enabled"] = true;
-          break;
-        case "-tpPrivate":
-          this.CATEGORY_PREFS[type]["privacy.trackingprotection.pbmode.enabled"] = false;
-          break;
-        case "fp":
-          this.CATEGORY_PREFS[type]["privacy.trackingprotection.fingerprinting.enabled"] = true;
-          break;
-        case "-fp":
-          this.CATEGORY_PREFS[type]["privacy.trackingprotection.fingerprinting.enabled"] = false;
-          break;
-        case "cm":
-          this.CATEGORY_PREFS[type]["privacy.trackingprotection.cryptomining.enabled"] = true;
-          break;
-        case "-cm":
-          this.CATEGORY_PREFS[type]["privacy.trackingprotection.cryptomining.enabled"] = false;
-          break;
-        case "cookieBehavior0":
-          this.CATEGORY_PREFS[type]["network.cookie.cookieBehavior"] = Ci.nsICookieService.BEHAVIOR_ACCEPT;
-          break;
-        case "cookieBehavior1":
-          this.CATEGORY_PREFS[type]["network.cookie.cookieBehavior"] = Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN;
-          break;
-        case "cookieBehavior2":
-          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;
-        default:
-          Cu.reportError(`Error: Unknown rule observed ${item}`);
-        }
+    let type = "strict";
+    let rulesArray = Services.prefs.getStringPref(this.PREF_STRICT_DEF).split(",");
+    for (let item of rulesArray) {
+      switch (item) {
+      case "tp":
+        this.CATEGORY_PREFS[type]["privacy.trackingprotection.enabled"] = true;
+        break;
+      case "-tp":
+        this.CATEGORY_PREFS[type]["privacy.trackingprotection.enabled"] = false;
+        break;
+      case "tpPrivate":
+        this.CATEGORY_PREFS[type]["privacy.trackingprotection.pbmode.enabled"] = true;
+        break;
+      case "-tpPrivate":
+        this.CATEGORY_PREFS[type]["privacy.trackingprotection.pbmode.enabled"] = false;
+        break;
+      case "fp":
+        this.CATEGORY_PREFS[type]["privacy.trackingprotection.fingerprinting.enabled"] = true;
+        break;
+      case "-fp":
+        this.CATEGORY_PREFS[type]["privacy.trackingprotection.fingerprinting.enabled"] = false;
+        break;
+      case "cm":
+        this.CATEGORY_PREFS[type]["privacy.trackingprotection.cryptomining.enabled"] = true;
+        break;
+      case "-cm":
+        this.CATEGORY_PREFS[type]["privacy.trackingprotection.cryptomining.enabled"] = false;
+        break;
+      case "cookieBehavior0":
+        this.CATEGORY_PREFS[type]["network.cookie.cookieBehavior"] = Ci.nsICookieService.BEHAVIOR_ACCEPT;
+        break;
+      case "cookieBehavior1":
+        this.CATEGORY_PREFS[type]["network.cookie.cookieBehavior"] = Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN;
+        break;
+      case "cookieBehavior2":
+        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;
+      default:
+        Cu.reportError(`Error: Unknown rule observed ${item}`);
       }
     }
   },
 
   /**
    * Checks if CB prefs match perfectly with one of our pre-defined categories.
    */
   prefsMatch(category) {
     // The category pref must be either unset, or match.
     if (Services.prefs.prefHasUserValue(this.PREF_CB_CATEGORY) &&
         Services.prefs.getStringPref(this.PREF_CB_CATEGORY) != category) {
       return false;
     }
     for (let pref in this.CATEGORY_PREFS[category]) {
       let value = this.CATEGORY_PREFS[category][pref];
       if (value == null) {
-        Cu.reportError(`Error: ${pref} has not been defined in ${category}`);
         if (Services.prefs.prefHasUserValue(pref)) {
           return false;
         }
       } else {
         let prefType = Services.prefs.getPrefType(pref);
         if ((prefType == Services.prefs.PREF_BOOL && Services.prefs.getBoolPref(pref) != value) ||
             (prefType == Services.prefs.PREF_INT && Services.prefs.getIntPref(pref) != value) ||
             (prefType == Services.prefs.PREF_STRING && Services.prefs.getStringPref(pref) != value)) {
@@ -3170,17 +3165,16 @@ var ContentBlockingCategoriesPrefs = {
     if (category == "custom") {
       return;
     }
 
     for (let pref in this.CATEGORY_PREFS[category]) {
       let value = this.CATEGORY_PREFS[category][pref];
       if (!Services.prefs.prefIsLocked(pref)) {
         if (value == null) {
-          Cu.reportError(`Error: ${pref} has not been defined in ${category}`);
           Services.prefs.clearUserPref(pref);
         } else {
           switch (Services.prefs.getPrefType(pref)) {
           case Services.prefs.PREF_BOOL:
             Services.prefs.setBoolPref(pref, value);
             break;
           case Services.prefs.PREF_INT:
             Services.prefs.setIntPref(pref, value);
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -75,17 +75,16 @@ Preferences.addAll([
   { id: "browser.formfill.enable", type: "bool" },
   { id: "privacy.history.custom", type: "bool" },
   // Cookies
   { id: "network.cookie.cookieBehavior", type: "int" },
   { id: "network.cookie.lifetimePolicy", type: "int" },
   { id: "network.cookie.blockFutureCookies", type: "bool" },
   // Content blocking category
   { id: "browser.contentblocking.category", type: "string"},
-  { id: "browser.contentblocking.features.standard", type: "string"},
   { id: "browser.contentblocking.features.strict", type: "string"},
 
   // Clear Private Data
   { id: "privacy.sanitize.sanitizeOnShutdown", type: "bool" },
   { id: "privacy.sanitize.timeSpan", type: "int" },
   // Do not track
   { id: "privacy.donottrackheader.enabled", type: "bool" },
 
@@ -472,32 +471,33 @@ var gPrivacyPane = {
       gPrivacyPane.readBlockCookies.bind(gPrivacyPane));
     Preferences.get("browser.contentblocking.category").on("change",
       gPrivacyPane.highlightCBCategory);
 
     // If any relevant content blocking pref changes, show a warning that the changes will
     // not be implemented until they refresh their tabs.
     for (let pref of CONTENT_BLOCKING_PREFS) {
       Preferences.get(pref).on("change", gPrivacyPane.maybeNotifyUserToReload);
+      // If the value changes, run populateCategoryContents, since that change might have been
+      // triggered by a default value changing in the standard category.
+      Preferences.get(pref).on("change", gPrivacyPane.populateCategoryContents);
     }
     Preferences.get("urlclassifier.trackingTable").on("change", gPrivacyPane.maybeNotifyUserToReload);
     for (let button of document.querySelectorAll(".reload-tabs-button")) {
       button.addEventListener("command", gPrivacyPane.reloadAllOtherTabs);
     }
 
     let cryptoMinersOption = document.getElementById("contentBlockingCryptominersOption");
     let fingerprintersOption = document.getElementById("contentBlockingFingerprintersOption");
 
     cryptoMinersOption.hidden =
       !Services.prefs.getBoolPref("browser.contentblocking.cryptomining.preferences.ui.enabled");
     fingerprintersOption.hidden =
       !Services.prefs.getBoolPref("browser.contentblocking.fingerprinting.preferences.ui.enabled");
 
-    Preferences.get("browser.contentblocking.features.standard").on("change",
-      this.populateCategoryContents);
     Preferences.get("browser.contentblocking.features.strict").on("change",
       this.populateCategoryContents);
     this.populateCategoryContents();
     this.highlightCBCategory();
     this.readBlockCookies();
 
     let link = document.getElementById("contentBlockingLearnMore");
     let contentBlockingUrl = Services.urlFormatter.formatURLPref("app.support.baseURL") + "content-blocking";
@@ -508,24 +508,48 @@ var gPrivacyPane = {
     let warningLinks = document.getElementsByClassName("content-blocking-warning-learn-how");
     for (let warningLink of warningLinks) {
       warningLink.setAttribute("href", contentBlockingTour);
     }
   },
 
   populateCategoryContents() {
     for (let type of ["strict", "standard"]) {
-      let rulesArray, selector;
+      let rulesArray = [];
+      let selector;
       if (type == "strict") {
         selector = "#contentBlockingOptionStrict";
         rulesArray = Services.prefs.getStringPref("browser.contentblocking.features.strict").split(",");
       } else {
         selector = "#contentBlockingOptionStandard";
-        let rulesString = Services.prefs.getStringPref("browser.contentblocking.features.standard");
-        rulesArray = rulesString.split(",");
+        // In standard show/hide UI items based on the default values of the relevant prefs.
+        let defaults = Services.prefs.getDefaultBranch("");
+
+        let cookieBehavior = defaults.getIntPref("network.cookie.cookieBehavior");
+        switch (cookieBehavior) {
+        case Ci.nsICookieService.BEHAVIOR_ACCEPT:
+          rulesArray.push("cookieBehavior0");
+          break;
+        case Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN:
+          rulesArray.push("cookieBehavior1");
+          break;
+        case Ci.nsICookieService.BEHAVIOR_REJECT:
+          rulesArray.push("cookieBehavior2");
+          break;
+        case Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN:
+          rulesArray.push("cookieBehavior3");
+          break;
+        case Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER:
+          rulesArray.push("cookieBehavior4");
+          break;
+        }
+        rulesArray.push(defaults.getBoolPref("privacy.trackingprotection.cryptomining.enabled") ? "cm" : "-cm");
+        rulesArray.push(defaults.getBoolPref("privacy.trackingprotection.fingerprinting.enabled") ? "fp" : "-fp");
+        rulesArray.push(defaults.getBoolPref("privacy.trackingprotection.enabled") ? "tp" : "-tp");
+        rulesArray.push(defaults.getBoolPref("privacy.trackingprotection.pbmode.enabled") ? "tpPrivate" : "-tpPrivate");
       }
       // Hide all cookie options first, until we learn which one should be showing.
       document.querySelector(selector + " .all-cookies-option").hidden = true;
       document.querySelector(selector + " .unvisited-cookies-option").hidden = true;
       document.querySelector(selector + " .third-party-tracking-cookies-option").hidden = true;
       document.querySelector(selector + " .all-third-party-cookies-option").hidden = true;
 
       for (let item of rulesArray) {
--- a/browser/components/preferences/in-content/tests/browser_contentblocking_categories.js
+++ b/browser/components/preferences/in-content/tests/browser_contentblocking_categories.js
@@ -8,54 +8,67 @@ ChromeUtils.defineModuleGetter(this, "Pr
 
 const TP_PREF = "privacy.trackingprotection.enabled";
 const TP_PBM_PREF = "privacy.trackingprotection.pbmode.enabled";
 const NCB_PREF = "network.cookie.cookieBehavior";
 const CAT_PREF = "browser.contentblocking.category";
 const FP_PREF = "privacy.trackingprotection.fingerprinting.enabled";
 const CM_PREF = "privacy.trackingprotection.cryptomining.enabled";
 const STRICT_DEF_PREF = "browser.contentblocking.features.strict";
-const STANDARD_DEF_PREF = "browser.contentblocking.features.standard";
 
-// Tests that the content blocking standard category definition changes the behavior
-// of the standard category pref and all prefs it controls.
+// Tests that the content blocking standard category definition is based on the default settings of
+// the content blocking prefs.
 // Changing the definition does not remove the user from the category.
 add_task(async function testContentBlockingStandardDefinition() {
-  let defaults = Services.prefs.getDefaultBranch("");
-  let originalStandardPref = defaults.getStringPref(STANDARD_DEF_PREF);
-  defaults.setStringPref(STANDARD_DEF_PREF, "tp,tpPrivate,fp,cm,cookieBehavior4");
+  Services.prefs.setStringPref(CAT_PREF, "strict");
+  Services.prefs.setStringPref(CAT_PREF, "standard");
   is(Services.prefs.getStringPref(CAT_PREF), "standard", `${CAT_PREF} starts on standard`);
 
-  ok(!Services.prefs.prefHasUserValue(STANDARD_DEF_PREF), `We changed the default value of ${STANDARD_DEF_PREF}`);
-  is(Services.prefs.getStringPref(STANDARD_DEF_PREF), "tp,tpPrivate,fp,cm,cookieBehavior4", "The pref changed to what we set.");
-
-  is(Services.prefs.getBoolPref(TP_PREF), true, `${TP_PREF} pref has been set to true`);
-  is(Services.prefs.getBoolPref(TP_PBM_PREF), true, `${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), true, `${CM_PREF} pref has been set to true`);
-  is(Services.prefs.getIntPref(NCB_PREF), Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER, `${NCB_PREF} has been set to BEHAVIOR_REJECT_TRACKER`);
-
-  // 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.
-  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, "-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`);
+  let defaults = Services.prefs.getDefaultBranch("");
+  let originalTP = defaults.getBoolPref(TP_PREF);
+  let originalTPPBM = defaults.getBoolPref(TP_PBM_PREF);
+  let originalFP = defaults.getBoolPref(FP_PREF);
+  let originalCM = defaults.getBoolPref(CM_PREF);
+  let originalNCB = defaults.getIntPref(NCB_PREF);
+
+  let nonDefaultNCB;
+  switch (originalNCB) {
+  case Ci.nsICookieService.BEHAVIOR_ACCEPT:
+    nonDefaultNCB = Ci.nsICookieService.BEHAVIOR_REJECT;
+    break;
+  default:
+    nonDefaultNCB = Ci.nsICookieService.BEHAVIOR_ACCEPT;
+    break;
+  }
+  defaults.setIntPref(NCB_PREF, nonDefaultNCB);
+  defaults.setBoolPref(TP_PREF, !originalTP);
+  defaults.setBoolPref(TP_PBM_PREF, !originalTPPBM);
+  defaults.setBoolPref(FP_PREF, !originalFP);
+  defaults.setBoolPref(CM_PREF, !originalCM);
+  defaults.setIntPref(NCB_PREF, !originalNCB);
+
+  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`);
 
   // cleanup
-  defaults.setStringPref(STANDARD_DEF_PREF, originalStandardPref);
+  defaults.setIntPref(NCB_PREF, originalNCB);
+  defaults.setBoolPref(TP_PREF, originalTP);
+  defaults.setBoolPref(TP_PBM_PREF, originalTPPBM);
+  defaults.setBoolPref(FP_PREF, originalFP);
+  defaults.setBoolPref(CM_PREF, originalCM);
+  defaults.setIntPref(NCB_PREF, originalNCB);
 });
 
 // Tests that the content blocking strict category definition changes the behavior
 // of the strict category pref and all prefs it controls.
 // Changing the definition does not remove the user from the category.
 add_task(async function testContentBlockingStrictDefinition() {
   let defaults = Services.prefs.getDefaultBranch("");
   let originalStrictPref = defaults.getStringPref(STRICT_DEF_PREF);
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -2170,17 +2170,16 @@ VARCACHE_PREF(
   "network.auth.non-web-content-triggered-resources-http-auth-allow",
    network_auth_non_web_content_triggered_resources_http_auth_allow,
   bool, false
 )
 
 // 0-Accept, 1-dontAcceptForeign, 2-dontAcceptAny, 3-limitForeign,
 // 4-rejectTracker
 // Keep the old default of accepting all cookies
-// In Firefox Desktop this pref is set by browser.contentblocking.features.[standard, strict] see firefox.js for details.
 VARCACHE_PREF(
   "network.cookie.cookieBehavior",
   network_cookie_cookieBehavior,
   RelaxedAtomicInt32, 0
 )
 
 // Stale threshold for cookies in seconds.
 VARCACHE_PREF(
@@ -2423,32 +2422,30 @@ VARCACHE_PREF(
 // Annotate channels based on the tracking protection list in all modes
 VARCACHE_PREF(
   "privacy.trackingprotection.annotate_channels",
    privacy_trackingprotection_annotate_channels,
   bool, true
 )
 
 // Block 3rd party fingerprinting resources.
-// In Firefox Desktop this pref is set by browser.contentblocking.features.[standard, strict] see firefox.js for details.
 VARCACHE_PREF(
   "privacy.trackingprotection.fingerprinting.enabled",
    privacy_trackingprotection_fingerprinting_enabled,
   bool, false
 )
 
 // Annotate fingerprinting resources.
 VARCACHE_PREF(
   "privacy.trackingprotection.fingerprinting.annotate.enabled",
    privacy_trackingprotection_fingerprinting_annotate_enabled,
   bool, true
 )
 
 // Block 3rd party cryptomining resources.
-// In Firefox Desktop this pref is set by browser.contentblocking.features.[standard, strict] see firefox.js for details.
 VARCACHE_PREF(
   "privacy.trackingprotection.cryptomining.enabled",
    privacy_trackingprotection_cryptomining_enabled,
   bool, false
 )
 
 // Annotate cryptomining resources.
 VARCACHE_PREF(
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1386,20 +1386,18 @@ pref("privacy.restrict3rdpartystorage.us
 // by overloading the main process as popups get blocked and when
 // users try to restore all popups, which is the most visible
 // option in our UI at the time of writing.
 // We will invisibly drop any popups from a page that has already
 // opened more than this number of popups.
 pref("privacy.popups.maxReported", 100);
 
 // Enforce tracking protection in all modes
-// In Firefox Desktop this pref is set by browser.contentblocking.features.[standard, strict] see firefox.js for details.
 pref("privacy.trackingprotection.enabled",  false);
 // Enforce tracking protection in Private Browsing mode
-// In Firefox Desktop this pref is set by browser.contentblocking.features.[standard, strict] see firefox.js for details.
 pref("privacy.trackingprotection.pbmode.enabled",  true);
 // First Party Isolation (double keying), disabled by default
 pref("privacy.firstparty.isolate",                        false);
 // If false, two windows in the same domain with different first party domains
 // (top level URLs) can access resources through window.opener.
 // This pref is effective only when "privacy.firstparty.isolate" is true.
 pref("privacy.firstparty.isolate.restrict_opener_access", true);
 // We automatically decline canvas permission requests if they are not initiated