diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 1cbbac4fd99f..bfa06eecd50d 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1488,6 +1488,7 @@ pref("browser.ping-centre.production.endpoint", "https://tiles.services.mozilla. pref("media.gmp-provider.enabled", true); pref("browser.contentblocking.enabled", true); +pref("browser.contentblocking.cookies-site-data.ui.reject-trackers.enabled", true); pref("browser.contentblocking.cookies-site-data.ui.reject-trackers.recommended", true); #ifdef NIGHTLY_BUILD pref("browser.contentblocking.ui.enabled", true); diff --git a/browser/components/preferences/in-content/privacy.js b/browser/components/preferences/in-content/privacy.js index 5a241d797811..db58e64f95de 100644 --- a/browser/components/preferences/in-content/privacy.js +++ b/browser/components/preferences/in-content/privacy.js @@ -29,6 +29,9 @@ XPCOMUtils.defineLazyPreferenceGetter(this, "contentBlockingCookiesAndSiteDataUi XPCOMUtils.defineLazyPreferenceGetter(this, "contentBlockingCookiesAndSiteDataRejectTrackersRecommended", "browser.contentblocking.cookies-site-data.ui.reject-trackers.recommended"); +XPCOMUtils.defineLazyPreferenceGetter(this, "contentBlockingCookiesAndSiteDataRejectTrackersEnabled", + "browser.contentblocking.cookies-site-data.ui.reject-trackers.enabled"); + XPCOMUtils.defineLazyPreferenceGetter(this, "contentBlockingEnabled", "browser.contentblocking.enabled"); @@ -531,6 +534,10 @@ var gPrivacyPane = { if (contentBlockingCookiesAndSiteDataRejectTrackersRecommended) { document.l10n.setAttributes(blockCookiesFromTrackers, "sitedata-block-trackers-option-recommended"); } + // Allow hiding the Reject Trackers option based on a pref + if (!contentBlockingCookiesAndSiteDataRejectTrackersEnabled) { + blockCookiesFromTrackers.remove(); + } } }, diff --git a/browser/components/preferences/in-content/tests/browser.ini b/browser/components/preferences/in-content/tests/browser.ini index 81cb32cb2da0..c0bb71155545 100644 --- a/browser/components/preferences/in-content/tests/browser.ini +++ b/browser/components/preferences/in-content/tests/browser.ini @@ -71,6 +71,7 @@ run-if = nightly_build [browser_privacypane_1.js] [browser_privacypane_2.js] [browser_privacypane_3.js] +[browser_privacypane_4.js] [browser_privacypane_5.js] [browser_sanitizeOnShutdown_prefLocked.js] [browser_searchShowSuggestionsFirst.js] diff --git a/browser/components/preferences/in-content/tests/browser_privacypane_2.js b/browser/components/preferences/in-content/tests/browser_privacypane_2.js index cd948327d1da..2166ea33ec58 100644 --- a/browser/components/preferences/in-content/tests/browser_privacypane_2.js +++ b/browser/components/preferences/in-content/tests/browser_privacypane_2.js @@ -8,7 +8,8 @@ if (jar) { Services.scriptloader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this); SpecialPowers.pushPrefEnv({"set": - [["browser.contentblocking.cookies-site-data.ui.enabled", true]] + [["browser.contentblocking.cookies-site-data.ui.enabled", true], + ["browser.contentblocking.cookies-site-data.ui.reject-trackers.enabled", true]] }); run_test_subset([ diff --git a/browser/components/preferences/in-content/tests/browser_privacypane_4.js b/browser/components/preferences/in-content/tests/browser_privacypane_4.js new file mode 100644 index 000000000000..b057d34c00df --- /dev/null +++ b/browser/components/preferences/in-content/tests/browser_privacypane_4.js @@ -0,0 +1,21 @@ +let rootDir = getRootDirectory(gTestPath); +let jar = getJar(rootDir); +if (jar) { + let tmpdir = extractJarToTmp(jar); + rootDir = "file://" + tmpdir.path + "/"; +} +/* import-globals-from privacypane_tests_perwindow.js */ +Services.scriptloader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this); + +SpecialPowers.pushPrefEnv({"set": + [["browser.contentblocking.cookies-site-data.ui.enabled", true], + ["browser.contentblocking.cookies-site-data.ui.reject-trackers.enabled", false]] +}); + +run_test_subset([ + test_pane_visibility, + test_dependent_elements, + test_dependent_cookie_elements, + test_dependent_clearonclose_elements, + test_dependent_prefs, +]); diff --git a/browser/components/preferences/in-content/tests/privacypane_tests_perwindow.js b/browser/components/preferences/in-content/tests/privacypane_tests_perwindow.js index 64b169062c7b..107e27e578f0 100644 --- a/browser/components/preferences/in-content/tests/privacypane_tests_perwindow.js +++ b/browser/components/preferences/in-content/tests/privacypane_tests_perwindow.js @@ -163,7 +163,11 @@ function test_dependent_cookie_elements(win) { expect_disabled(true, [keepUntil, keepCookiesUntil]); expect_disabled(false, [blockCookiesLabel, blockCookiesMenu]); - blockCookiesMenu.value = "trackers"; + if (win.contentBlockingCookiesAndSiteDataRejectTrackersEnabled) { + blockCookiesMenu.value = "trackers"; + } else { + blockCookiesMenu.value = "unvisited"; + } controlChanged(blockCookiesMenu); expect_disabled(false); } else {