mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
Bug 1501286 - Part 1: Remove support for the tracking protection UI from Preferences r=flod,johannh
Differential Revision: https://phabricator.services.mozilla.com/D9519 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
ae04660846
commit
6b3a2ee705
@ -17,9 +17,6 @@ ChromeUtils.defineModuleGetter(this, "DeferredTask",
|
||||
ChromeUtils.defineModuleGetter(this, "ExtensionSettingsStore",
|
||||
"resource://gre/modules/ExtensionSettingsStore.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "contentBlockingUiEnabled",
|
||||
"browser.contentblocking.ui.enabled");
|
||||
|
||||
const PREF_SETTING_TYPE = "prefs";
|
||||
const PROXY_KEY = "proxy.settings";
|
||||
const API_PROXY_PREFS = [
|
||||
@ -49,12 +46,8 @@ let extensionControlledContentIds = {
|
||||
"proxy.settings": "proxyExtensionContent",
|
||||
get "websites.trackingProtectionMode"() {
|
||||
return {
|
||||
button: contentBlockingUiEnabled ?
|
||||
"contentBlockingDisableTrackingProtectionExtension" :
|
||||
"trackingProtectionExtensionContentButton",
|
||||
section: contentBlockingUiEnabled ?
|
||||
"contentBlockingTrackingProtectionExtensionContentLabel" :
|
||||
"trackingProtectionExtensionContentLabel",
|
||||
button: "contentBlockingDisableTrackingProtectionExtension",
|
||||
section: "contentBlockingTrackingProtectionExtensionContentLabel",
|
||||
};
|
||||
},
|
||||
};
|
||||
@ -65,9 +58,7 @@ const extensionControlledL10nKeys = {
|
||||
"webNotificationsDisabled": "web-notifications",
|
||||
"defaultSearch": "default-search",
|
||||
"privacy.containers": "privacy-containers",
|
||||
"websites.trackingProtectionMode": contentBlockingUiEnabled ?
|
||||
"websites-content-blocking-all-trackers" :
|
||||
"websites-tracking-protection-mode",
|
||||
"websites.trackingProtectionMode": "websites-content-blocking-all-trackers",
|
||||
"proxy.settings": "proxy-config",
|
||||
};
|
||||
|
||||
|
@ -20,9 +20,6 @@ ChromeUtils.defineModuleGetter(this, "SiteDataManager",
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "contentBlockingUiEnabled",
|
||||
"browser.contentblocking.ui.enabled");
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "contentBlockingCookiesAndSiteDataRejectTrackersRecommended",
|
||||
"browser.contentblocking.cookies-site-data.ui.reject-trackers.recommended");
|
||||
|
||||
@ -184,19 +181,6 @@ var gPrivacyPane = {
|
||||
*/
|
||||
_shouldPromptForRestart: true,
|
||||
|
||||
/**
|
||||
* Initialize the tracking protection prefs and linkify its Learn More link.
|
||||
*/
|
||||
_initTrackingProtection() {
|
||||
setEventListener("trackingProtectionRadioGroup", "command",
|
||||
this.trackingProtectionWritePrefs);
|
||||
setEventListener("changeBlockList", "command", this.showBlockLists);
|
||||
|
||||
let link = document.getElementById("trackingProtectionLearnMore");
|
||||
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection";
|
||||
link.setAttribute("href", url);
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the tracking protection UI to deal with extension control.
|
||||
*/
|
||||
@ -206,24 +190,15 @@ var gPrivacyPane = {
|
||||
|
||||
function setInputsDisabledState(isControlled) {
|
||||
let disabled = isLocked || isControlled;
|
||||
if (contentBlockingUiEnabled) {
|
||||
let tpCheckbox =
|
||||
document.getElementById("contentBlockingTrackingProtectionCheckbox");
|
||||
// Only enable the TP menu if content blocking and Detect All Trackers
|
||||
// are enabled.
|
||||
document.getElementById("trackingProtectionMenu").disabled = disabled ||
|
||||
!tpCheckbox.checked ||
|
||||
!contentBlockingEnabled;
|
||||
// Only enable the TP category checkbox if content blocking is enabled.
|
||||
tpCheckbox.disabled = disabled || !contentBlockingEnabled;
|
||||
} else {
|
||||
document.querySelectorAll("#trackingProtectionRadioGroup > radio")
|
||||
.forEach((element) => {
|
||||
element.disabled = disabled;
|
||||
});
|
||||
document.querySelector("#trackingProtectionDesc > label")
|
||||
.disabled = disabled;
|
||||
}
|
||||
let tpCheckbox =
|
||||
document.getElementById("contentBlockingTrackingProtectionCheckbox");
|
||||
// Only enable the TP menu if content blocking and Detect All Trackers
|
||||
// are enabled.
|
||||
document.getElementById("trackingProtectionMenu").disabled = disabled ||
|
||||
!tpCheckbox.checked ||
|
||||
!contentBlockingEnabled;
|
||||
// Only enable the TP category checkbox if content blocking is enabled.
|
||||
tpCheckbox.disabled = disabled || !contentBlockingEnabled;
|
||||
|
||||
// Notify observers that the TP UI has been updated.
|
||||
// This is needed since our tests need to be notified about the
|
||||
@ -248,9 +223,7 @@ var gPrivacyPane = {
|
||||
* for tracking protection.
|
||||
*/
|
||||
_initTrackingProtectionExtensionControl() {
|
||||
let disableButton = contentBlockingUiEnabled ?
|
||||
"contentBlockingDisableTrackingProtectionExtension" : "disableTrackingProtectionExtension";
|
||||
setEventListener(disableButton, "command",
|
||||
setEventListener("contentBlockingDisableTrackingProtectionExtension", "command",
|
||||
makeDisableControllingExtension(
|
||||
PREF_SETTING_TYPE, TRACKING_PROTECTION_KEY));
|
||||
|
||||
@ -292,13 +265,8 @@ var gPrivacyPane = {
|
||||
this.initAutoStartPrivateBrowsingReverter();
|
||||
this._initAutocomplete();
|
||||
|
||||
/* Initialize Content Blocking / Tracking Protection */
|
||||
|
||||
if (contentBlockingUiEnabled) {
|
||||
this.initContentBlocking();
|
||||
} else {
|
||||
this._initTrackingProtection();
|
||||
}
|
||||
/* Initialize Content Blocking */
|
||||
this.initContentBlocking();
|
||||
|
||||
this.trackingProtectionReadPrefs();
|
||||
this.networkCookieBehaviorReadPrefs();
|
||||
@ -567,38 +535,13 @@ var gPrivacyPane = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Changes the visibility of elements in the TP/CB section depending on the
|
||||
* content blocking UI pref.
|
||||
* Changes the visibility of elements in the CB section depending on the
|
||||
* content blocking UI prefs.
|
||||
*/
|
||||
updateContentBlockingVisibility() {
|
||||
// First, update the content blocking UI.
|
||||
let visibleState = {
|
||||
"contentBlockingHeader": true,
|
||||
"contentBlockingDescription": true,
|
||||
"contentBlockingLearnMore": true,
|
||||
"contentBlockingRestoreDefaults": true,
|
||||
"contentBlockingCheckboxContainer": true,
|
||||
"contentBlockingCategories": true,
|
||||
|
||||
"trackingProtectionHeader": false,
|
||||
"trackingProtectionDescription": false,
|
||||
"trackingProtectionBox": false,
|
||||
};
|
||||
for (let id in visibleState) {
|
||||
document.getElementById(id).hidden = contentBlockingUiEnabled != visibleState[id];
|
||||
}
|
||||
|
||||
if (contentBlockingUiEnabled) {
|
||||
// Update the Do Not Track section to not mention "Tracking Protection".
|
||||
let dntDefaultRadioItem =
|
||||
document.querySelector("#doNotTrackRadioGroup > radio[value=false]");
|
||||
document.l10n.setAttributes(
|
||||
dntDefaultRadioItem, "do-not-track-option-default-content-blocking");
|
||||
|
||||
// Potentially hide the global toggle.
|
||||
document.getElementById("contentBlockingCheckboxContainer").hidden =
|
||||
!Services.prefs.getBoolPref("browser.contentblocking.global-toggle.enabled", true);
|
||||
}
|
||||
// Potentially hide the global toggle.
|
||||
document.getElementById("contentBlockingCheckboxContainer").hidden =
|
||||
!Services.prefs.getBoolPref("browser.contentblocking.global-toggle.enabled", true);
|
||||
|
||||
// Allow turning off the "(recommended)" label using a pref
|
||||
let blockCookiesFromTrackers = document.getElementById("blockCookiesFromTrackers");
|
||||
@ -688,23 +631,15 @@ var gPrivacyPane = {
|
||||
let enabledPref = Preferences.get("privacy.trackingprotection.enabled");
|
||||
let pbmPref = Preferences.get("privacy.trackingprotection.pbmode.enabled");
|
||||
let btpmPref = Preferences.get("browser.privacy.trackingprotection.menu");
|
||||
let tpControl,
|
||||
tpCheckbox;
|
||||
if (contentBlockingUiEnabled) {
|
||||
tpControl = document.getElementById("trackingProtectionMenu");
|
||||
tpCheckbox = document.getElementById("contentBlockingTrackingProtectionCheckbox");
|
||||
} else {
|
||||
tpControl = document.getElementById("trackingProtectionRadioGroup");
|
||||
}
|
||||
let tpControl = document.getElementById("trackingProtectionMenu");
|
||||
let tpCheckbox = document.getElementById("contentBlockingTrackingProtectionCheckbox");
|
||||
|
||||
let savedMenuValue;
|
||||
if (contentBlockingUiEnabled) {
|
||||
// Only look at the backup pref when restoring the checkbox next to
|
||||
// "All Detected Trackers".
|
||||
if (["always", "private"].includes(btpmPref.value) &&
|
||||
tpCheckbox.checked) {
|
||||
savedMenuValue = btpmPref.value;
|
||||
}
|
||||
// Only look at the backup pref when restoring the checkbox next to
|
||||
// "All Detected Trackers".
|
||||
if (["always", "private"].includes(btpmPref.value) &&
|
||||
tpCheckbox.checked) {
|
||||
savedMenuValue = btpmPref.value;
|
||||
}
|
||||
|
||||
this._updateTrackingProtectionUI();
|
||||
@ -741,7 +676,7 @@ var gPrivacyPane = {
|
||||
let keepUntilLabel = document.getElementById("keepUntil");
|
||||
let keepUntilMenu = document.getElementById("keepCookiesUntil");
|
||||
|
||||
let disabledByCB = contentBlockingUiEnabled ? !contentBlockingEnabled : false;
|
||||
let disabledByCB = !contentBlockingEnabled;
|
||||
let blockCookies = (behavior != 0);
|
||||
let cookieBehaviorLocked = Services.prefs.prefIsLocked("network.cookie.cookieBehavior");
|
||||
let blockCookiesControlsDisabled = !blockCookies || cookieBehaviorLocked || disabledByCB;
|
||||
@ -784,14 +719,8 @@ var gPrivacyPane = {
|
||||
let enabledPref = Preferences.get("privacy.trackingprotection.enabled");
|
||||
let pbmPref = Preferences.get("privacy.trackingprotection.pbmode.enabled");
|
||||
let btpmPref = Preferences.get("browser.privacy.trackingprotection.menu");
|
||||
let tpControl,
|
||||
tpCheckbox;
|
||||
if (contentBlockingUiEnabled) {
|
||||
tpControl = document.getElementById("trackingProtectionMenu");
|
||||
tpCheckbox = document.getElementById("contentBlockingTrackingProtectionCheckbox");
|
||||
} else {
|
||||
tpControl = document.getElementById("trackingProtectionRadioGroup");
|
||||
}
|
||||
let tpControl = document.getElementById("trackingProtectionMenu");
|
||||
let tpCheckbox = document.getElementById("contentBlockingTrackingProtectionCheckbox");
|
||||
|
||||
let value;
|
||||
if (tpCheckbox) {
|
||||
|
@ -19,15 +19,11 @@
|
||||
<!-- Tracking / Content Blocking -->
|
||||
<groupbox id="trackingGroup" data-category="panePrivacy" hidden="true" aria-describedby="contentBlockingDescription">
|
||||
<caption>
|
||||
<label id="trackingProtectionHeader" hidden="true" data-l10n-id="tracking-header"/>
|
||||
<label id="contentBlockingHeader" data-l10n-id="content-blocking-header"/>
|
||||
</caption>
|
||||
<vbox data-subcategory="trackingprotection">
|
||||
<hbox align="start">
|
||||
<vbox flex="1">
|
||||
<description id="trackingProtectionDescription" class="description-with-side-element" hidden="true" data-l10n-id="tracking-desc">
|
||||
<html:a id="trackingProtectionLearnMore" data-l10n-name="learn-more" target="_blank" class="learnMore text-link"/>
|
||||
</description>
|
||||
<description id="contentBlockingDescription" class="description-with-side-element" data-l10n-id="content-blocking-desc"></description>
|
||||
<label id="contentBlockingLearnMore" data-l10n-id="content-blocking-learn-more" class="learnMore text-link"/>
|
||||
</vbox>
|
||||
@ -165,53 +161,13 @@
|
||||
</hbox>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<hbox id="trackingProtectionBox" hidden="true">
|
||||
<vbox flex="1">
|
||||
<vbox>
|
||||
<hbox id="trackingProtectionExtensionContentLabel" align="center" hidden="true">
|
||||
<description control="disableTrackingProtectionExtension" flex="1"/>
|
||||
</hbox>
|
||||
<vbox>
|
||||
<description id="trackingProtectionDesc"
|
||||
control="trackingProtectionRadioGroup">
|
||||
<label data-l10n-id="tracking-mode-label"/>
|
||||
</description>
|
||||
<radiogroup id="trackingProtectionRadioGroup" aria-labelledby="trackingProtectionDesc">
|
||||
<radio value="always"
|
||||
data-l10n-id="tracking-mode-always"/>
|
||||
<radio value="private"
|
||||
data-l10n-id="tracking-mode-private"/>
|
||||
<radio value="never"
|
||||
data-l10n-id="tracking-mode-never"/>
|
||||
</radiogroup>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</vbox>
|
||||
<vbox id="trackingProtectionAdvancedSettings">
|
||||
<hbox id="trackingProtectionExtensionContentButton" hidden="true">
|
||||
<button id="disableTrackingProtectionExtension"
|
||||
class="extension-controlled-button accessory-button"
|
||||
flex="1"
|
||||
data-l10n-id="disable-extension"/>
|
||||
</hbox>
|
||||
<!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
|
||||
<hbox>
|
||||
<button id="changeBlockList"
|
||||
class="accessory-button"
|
||||
flex="1"
|
||||
data-l10n-id="tracking-change-block-list"
|
||||
preference="pref.privacy.disable_button.change_blocklist"
|
||||
search-l10n-ids="blocklist-window.title, blocklist-desc, blocklist-button-cancel.label, blocklist-button-ok.label"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</hbox>
|
||||
<vbox id="doNotTrackLearnMoreBox">
|
||||
<label><label class="tail-with-learn-more" data-l10n-id="do-not-track-description" id="doNotTrackDesc"></label><label
|
||||
class="learnMore text-link" href="https://www.mozilla.org/dnt"
|
||||
data-l10n-id="do-not-track-learn-more"></label></label>
|
||||
<radiogroup id="doNotTrackRadioGroup" aria-labelledby="doNotTrackDesc" preference="privacy.donottrackheader.enabled">
|
||||
<radio value="true" data-l10n-id="do-not-track-option-always"/>
|
||||
<radio value="false" data-l10n-id="do-not-track-option-default"/>
|
||||
<radio value="false" data-l10n-id="do-not-track-option-default-content-blocking"/>
|
||||
</radiogroup>
|
||||
</vbox>
|
||||
</vbox>
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* eslint-env webextensions */
|
||||
|
||||
const CB_PREF = "browser.contentblocking.enabled";
|
||||
const CB_UI_PREF = "browser.contentblocking.ui.enabled";
|
||||
const CB_FB_UI_PREF = "browser.contentblocking.fastblock.ui.enabled";
|
||||
const CB_TP_UI_PREF = "browser.contentblocking.trackingprotection.ui.enabled";
|
||||
const CB_RT_UI_PREF = "browser.contentblocking.rejecttrackers.ui.enabled";
|
||||
@ -17,7 +16,6 @@ requestLongerTimeout(2);
|
||||
// Checks that the content blocking toggle follows and changes the CB pref.
|
||||
add_task(async function testContentBlockingToggle() {
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
[CB_UI_PREF, true],
|
||||
[TOGGLE_PREF, true],
|
||||
]});
|
||||
|
||||
@ -60,10 +58,6 @@ add_task(async function testContentBlockingToggle() {
|
||||
|
||||
// Tests that the content blocking main category checkboxes have the correct default state.
|
||||
add_task(async function testContentBlockingMainCategory() {
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
[CB_UI_PREF, true],
|
||||
]});
|
||||
|
||||
let prefs = [
|
||||
[CB_PREF, true],
|
||||
[FB_PREF, true],
|
||||
@ -161,10 +155,6 @@ add_task(async function testContentBlockingMainCategory() {
|
||||
|
||||
// Tests that the content blocking "Restore Defaults" button does what it's supposed to.
|
||||
add_task(async function testContentBlockingRestoreDefaults() {
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
[CB_UI_PREF, true],
|
||||
]});
|
||||
|
||||
let prefs = {
|
||||
CB_PREF: null,
|
||||
FB_PREF: null,
|
||||
@ -227,10 +217,6 @@ add_task(async function testContentBlockingRestoreDefaults() {
|
||||
// Tests that the content blocking "Restore Defaults" button does not restore prefs
|
||||
// that are controlled by extensions.
|
||||
add_task(async function testContentBlockingRestoreDefaultsSkipExtensionControlled() {
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
[CB_UI_PREF, true],
|
||||
]});
|
||||
|
||||
function background() {
|
||||
browser.privacy.websites.trackingProtectionMode.set({value: "always"});
|
||||
}
|
||||
@ -390,7 +376,6 @@ add_task(async function testContentBlockingDependentControls() {
|
||||
// In Accept All Cookies mode, the radiogroup under Third-Party Cookies is always disabled
|
||||
// since the checkbox next to Third-Party Cookies would be unchecked.
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
[CB_UI_PREF, true],
|
||||
[CB_FB_UI_PREF, true],
|
||||
[CB_TP_UI_PREF, true],
|
||||
[CB_RT_UI_PREF, true],
|
||||
@ -417,7 +402,6 @@ add_task(async function testContentBlockingDependentControls() {
|
||||
// In Block Cookies from Trackers (or Block Cookies from All Third-Parties) mode, the
|
||||
// radiogroup's disabled status must obey the content blocking enabled state.
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
[CB_UI_PREF, true],
|
||||
[CB_FB_UI_PREF, true],
|
||||
[CB_TP_UI_PREF, true],
|
||||
[CB_RT_UI_PREF, true],
|
||||
@ -443,7 +427,6 @@ add_task(async function testContentBlockingDependentControls() {
|
||||
// Checks that the controls for tracking protection are disabled when all TP prefs are off.
|
||||
add_task(async function testContentBlockingDependentTPControls() {
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
[CB_UI_PREF, true],
|
||||
[CB_FB_UI_PREF, true],
|
||||
[CB_TP_UI_PREF, true],
|
||||
[CB_RT_UI_PREF, true],
|
||||
@ -481,7 +464,6 @@ add_task(async function testContentBlockingDependentControlsOnSiteDataUI() {
|
||||
];
|
||||
for (let value of prefValuesToTest) {
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
[CB_UI_PREF, true],
|
||||
[CB_FB_UI_PREF, true],
|
||||
[CB_TP_UI_PREF, true],
|
||||
[CB_RT_UI_PREF, true],
|
||||
@ -525,7 +507,6 @@ add_task(async function testContentBlockingDependentControlsOnSiteDataUI() {
|
||||
];
|
||||
for (let value of prefValuesToTest) {
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
[CB_UI_PREF, true],
|
||||
[CB_FB_UI_PREF, true],
|
||||
[CB_TP_UI_PREF, true],
|
||||
[CB_RT_UI_PREF, true],
|
||||
@ -567,7 +548,6 @@ add_task(async function testContentBlockingDependentControlsOnSiteDataUI() {
|
||||
];
|
||||
for (let value of prefValuesToTest) {
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
[CB_UI_PREF, true],
|
||||
[CB_FB_UI_PREF, true],
|
||||
[CB_TP_UI_PREF, true],
|
||||
[CB_RT_UI_PREF, true],
|
||||
@ -604,7 +584,6 @@ add_task(async function testContentBlockingDependentControlsOnSiteDataUI() {
|
||||
];
|
||||
for (let value of prefValuesToTest) {
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
[CB_UI_PREF, true],
|
||||
[CB_FB_UI_PREF, true],
|
||||
[CB_TP_UI_PREF, true],
|
||||
[CB_RT_UI_PREF, true],
|
||||
@ -638,7 +617,6 @@ add_task(async function testContentBlockingDependentControlsOnSiteDataUI() {
|
||||
add_task(async function testContentBlockingThirdPartyCookiesWarning() {
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
[CB_PREF, true],
|
||||
[CB_UI_PREF, true],
|
||||
[CB_FB_UI_PREF, true],
|
||||
[CB_TP_UI_PREF, true],
|
||||
[CB_RT_UI_PREF, true],
|
||||
|
@ -588,28 +588,17 @@ add_task(async function testExtensionControlledHomepageUninstalledAddon() {
|
||||
});
|
||||
|
||||
add_task(async function testExtensionControlledTrackingProtection() {
|
||||
const CB_UI_PREF = "browser.contentblocking.ui.enabled";
|
||||
const TP_PREF = "privacy.trackingprotection.enabled";
|
||||
const TP_DEFAULT = false;
|
||||
const EXTENSION_ID = "@set_tp";
|
||||
const CONTROLLED_LABEL_ID = {
|
||||
old: "trackingProtectionExtensionContentLabel",
|
||||
new: "contentBlockingTrackingProtectionExtensionContentLabel",
|
||||
};
|
||||
const CONTROLLED_BUTTON_ID = {
|
||||
old: "trackingProtectionExtensionContentButton",
|
||||
new: "contentBlockingDisableTrackingProtectionExtension",
|
||||
};
|
||||
const DISABLE_BUTTON_ID = {
|
||||
old: "disableTrackingProtectionExtension",
|
||||
new: "contentBlockingDisableTrackingProtectionExtension",
|
||||
};
|
||||
const CONTROLLED_LABEL_ID = "contentBlockingTrackingProtectionExtensionContentLabel";
|
||||
const CONTROLLED_BUTTON_ID = "contentBlockingDisableTrackingProtectionExtension";
|
||||
const DISABLE_BUTTON_ID = "contentBlockingDisableTrackingProtectionExtension";
|
||||
|
||||
let tpEnabledPref = () => Services.prefs.getBoolPref(TP_PREF);
|
||||
let cbUIEnabledPref = () => Services.prefs.getBoolPref(CB_UI_PREF);
|
||||
|
||||
await SpecialPowers.pushPrefEnv(
|
||||
{"set": [[TP_PREF, TP_DEFAULT], [CB_UI_PREF, true]]});
|
||||
{"set": [[TP_PREF, TP_DEFAULT]]});
|
||||
|
||||
function background() {
|
||||
browser.privacy.websites.trackingProtectionMode.set({value: "always"});
|
||||
@ -618,39 +607,29 @@ add_task(async function testExtensionControlledTrackingProtection() {
|
||||
function verifyState(isControlled) {
|
||||
is(tpEnabledPref(), isControlled, "TP pref is set to the expected value.");
|
||||
|
||||
let controlledLabel = doc.getElementById(CONTROLLED_LABEL_ID[uiType]);
|
||||
let controlledButton = doc.getElementById(CONTROLLED_BUTTON_ID[uiType]);
|
||||
let controlledLabel = doc.getElementById(CONTROLLED_LABEL_ID);
|
||||
let controlledButton = doc.getElementById(CONTROLLED_BUTTON_ID);
|
||||
|
||||
is(controlledLabel.hidden, !isControlled, "The extension controlled row's visibility is as expected.");
|
||||
is(controlledButton.hidden, !isControlled, "The disable extension button's visibility is as expected.");
|
||||
if (isControlled) {
|
||||
let controlledDesc = controlledLabel.querySelector("description");
|
||||
Assert.deepEqual(doc.l10n.getAttributes(controlledDesc), {
|
||||
id: cbUIEnabledPref() ? "extension-controlled-websites-content-blocking-all-trackers" :
|
||||
"extension-controlled-websites-tracking-protection-mode",
|
||||
id: "extension-controlled-websites-content-blocking-all-trackers",
|
||||
args: {
|
||||
name: "set_tp",
|
||||
},
|
||||
}, "The user is notified that an extension is controlling TP.");
|
||||
}
|
||||
|
||||
if (uiType === "old") {
|
||||
for (let element of doc.querySelectorAll("#trackingProtectionRadioGroup > radio")) {
|
||||
is(element.disabled, isControlled, "TP controls are enabled.");
|
||||
}
|
||||
is(doc.querySelector("#trackingProtectionDesc > label").disabled,
|
||||
isControlled,
|
||||
"TP control label is enabled.");
|
||||
} else {
|
||||
is(doc.getElementById("trackingProtectionMenu").disabled,
|
||||
isControlled,
|
||||
"TP control is enabled.");
|
||||
}
|
||||
is(doc.getElementById("trackingProtectionMenu").disabled,
|
||||
isControlled,
|
||||
"TP control is enabled.");
|
||||
}
|
||||
|
||||
async function disableViaClick() {
|
||||
let labelId = CONTROLLED_LABEL_ID[uiType];
|
||||
let disableId = DISABLE_BUTTON_ID[uiType];
|
||||
let labelId = CONTROLLED_LABEL_ID;
|
||||
let disableId = DISABLE_BUTTON_ID;
|
||||
let controlledLabel = doc.getElementById(labelId);
|
||||
|
||||
let enableMessageShown = waitForEnableMessage(labelId);
|
||||
@ -670,13 +649,11 @@ add_task(async function testExtensionControlledTrackingProtection() {
|
||||
}
|
||||
|
||||
async function reEnableExtension(addon) {
|
||||
let controlledMessageShown = waitForMessageShown(CONTROLLED_LABEL_ID[uiType]);
|
||||
let controlledMessageShown = waitForMessageShown(CONTROLLED_LABEL_ID);
|
||||
await addon.enable();
|
||||
await controlledMessageShown;
|
||||
}
|
||||
|
||||
let uiType = "new";
|
||||
|
||||
await openPreferencesViaOpenPreferencesAPI("panePrivacy", {leaveOpen: true});
|
||||
let doc = gBrowser.contentDocument;
|
||||
|
||||
@ -696,7 +673,7 @@ add_task(async function testExtensionControlledTrackingProtection() {
|
||||
background,
|
||||
});
|
||||
|
||||
let messageShown = waitForMessageShown(CONTROLLED_LABEL_ID[uiType]);
|
||||
let messageShown = waitForMessageShown(CONTROLLED_LABEL_ID);
|
||||
await extension.startup();
|
||||
await messageShown;
|
||||
let addon = await AddonManager.getAddonByID(EXTENSION_ID);
|
||||
@ -707,27 +684,6 @@ add_task(async function testExtensionControlledTrackingProtection() {
|
||||
|
||||
verifyState(false);
|
||||
|
||||
// Switch to the "old" Tracking Protection UI.
|
||||
uiType = "old";
|
||||
Services.prefs.setBoolPref(CB_UI_PREF, false);
|
||||
|
||||
let browserLoaded = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, "about:preferences#privacy");
|
||||
gBrowser.selectedBrowser.reload();
|
||||
await browserLoaded;
|
||||
is(gBrowser.currentURI.spec, "about:preferences#privacy",
|
||||
"#privacy should be in the URI for about:preferences");
|
||||
doc = gBrowser.contentDocument;
|
||||
|
||||
verifyState(false);
|
||||
|
||||
await reEnableExtension(addon);
|
||||
|
||||
verifyState(true);
|
||||
|
||||
await disableViaClick();
|
||||
|
||||
verifyState(false);
|
||||
|
||||
// Enable the extension so we get the UNINSTALL event, which is needed by
|
||||
// ExtensionPreferencesManager to clean up properly.
|
||||
// TODO: BUG 1408226
|
||||
|
@ -18,15 +18,6 @@ add_task(async function() {
|
||||
await evaluateSearchResults("block Web elements", "trackingGroup");
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
}
|
||||
await SpecialPowers.pushPrefEnv({"set": [
|
||||
["browser.contentblocking.ui.enabled", true],
|
||||
]});
|
||||
info("Run the test with Content Blocking UI enabled");
|
||||
await doTest();
|
||||
await SpecialPowers.pushPrefEnv({"set": [
|
||||
["browser.contentblocking.ui.enabled", false],
|
||||
]});
|
||||
info("Run the test with Content Blocking UI disabled");
|
||||
await doTest();
|
||||
});
|
||||
|
||||
|
@ -7,43 +7,6 @@ add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({"set": [["browser.preferences.search", true]]});
|
||||
});
|
||||
|
||||
// First, run the tests without the Content Blocking UI.
|
||||
add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({"set": [["browser.contentblocking.ui.enabled", false]]});
|
||||
});
|
||||
|
||||
/**
|
||||
* Test for searching for the "Settings - Site Data" subdialog.
|
||||
*/
|
||||
add_task(async function() {
|
||||
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
|
||||
await evaluateSearchResults("cookies", ["siteDataGroup"]);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
||||
add_task(async function() {
|
||||
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
|
||||
await evaluateSearchResults("site data", ["siteDataGroup"]);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
||||
add_task(async function() {
|
||||
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
|
||||
await evaluateSearchResults("cache", ["siteDataGroup"]);
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
||||
add_task(async function() {
|
||||
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
|
||||
await evaluateSearchResults("third-party", "siteDataGroup");
|
||||
BrowserTestUtils.removeTab(gBrowser.selectedTab);
|
||||
});
|
||||
|
||||
// Now, run the tests with the Content Blocking UI.
|
||||
add_task(async function() {
|
||||
await SpecialPowers.pushPrefEnv({"set": [["browser.contentblocking.ui.enabled", true]]});
|
||||
});
|
||||
|
||||
/**
|
||||
* Test for searching for the "Settings - Site Data" subdialog.
|
||||
*/
|
||||
|
@ -53,7 +53,6 @@ add_task(async function test_form_autofill_section() {
|
||||
add_task(async function test_change_cookie_settings() {
|
||||
await SpecialPowers.pushPrefEnv({set: [
|
||||
["browser.contentblocking.enabled", true],
|
||||
["browser.contentblocking.ui.enabled", true],
|
||||
["browser.contentblocking.fastblock.ui.enabled", true],
|
||||
["browser.contentblocking.trackingprotection.ui.enabled", true],
|
||||
["browser.contentblocking.rejecttrackers.ui.enabled", true],
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
do-not-track-description = Send websites a “Do Not Track” signal that you don’t want to be tracked
|
||||
do-not-track-learn-more = Learn more
|
||||
do-not-track-option-default =
|
||||
.label = Only when using Tracking Protection
|
||||
do-not-track-option-default-content-blocking =
|
||||
.label = Only when { -brand-short-name } is set to block Detected Trackers
|
||||
do-not-track-option-always =
|
||||
@ -109,10 +107,6 @@ extension-controlled-default-search = An extension, <img data-l10n-name="icon"/>
|
||||
# are being enabled by an extension.
|
||||
extension-controlled-privacy-containers = An extension, <img data-l10n-name="icon"/> { $name }, requires Container Tabs.
|
||||
|
||||
# This string is shown to notify the user that their tracking protection preferences
|
||||
# are being controlled by an extension.
|
||||
extension-controlled-websites-tracking-protection-mode = An extension, <img data-l10n-name="icon"/> { $name }, is controlling tracking protection.
|
||||
|
||||
# This string is shown to notify the user that their content blocking "All Detected Trackers"
|
||||
# preferences are being controlled by an extension.
|
||||
extension-controlled-websites-content-blocking-all-trackers = An extension, <img data-l10n-name="icon"/> { $name }, is controlling this setting.
|
||||
@ -889,30 +883,10 @@ content-blocking-reject-trackers-all-third-parties-option =
|
||||
|
||||
## Privacy Section - Tracking
|
||||
|
||||
tracking-header = Tracking Protection
|
||||
|
||||
tracking-desc = Tracking Protection blocks online trackers that collect your browsing data across multiple websites. <a data-l10n-name="learn-more">Learn more about Tracking Protection and your privacy</a>
|
||||
|
||||
tracking-mode-label = Use Tracking Protection to block known trackers
|
||||
|
||||
tracking-mode-always =
|
||||
.label = Always
|
||||
.accesskey = y
|
||||
tracking-mode-private =
|
||||
.label = Only in private windows
|
||||
.accesskey = l
|
||||
tracking-mode-never =
|
||||
.label = Never
|
||||
.accesskey = N
|
||||
|
||||
tracking-exceptions =
|
||||
.label = Exceptions…
|
||||
.accesskey = x
|
||||
|
||||
tracking-change-block-list =
|
||||
.label = Change Block List…
|
||||
.accesskey = C
|
||||
|
||||
## Privacy Section - Permissions
|
||||
|
||||
permissions-header = Permissions
|
||||
|
@ -398,18 +398,10 @@ button > hbox > label {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
#trackingProtectionBox {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
#doNotTrackLearnMoreBox {
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
#trackingProtectionAdvancedSettings {
|
||||
margin-inline-start: 15px;
|
||||
}
|
||||
|
||||
#historyPane {
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user