Bug 1501985 - Update Content Blocking section UI r=flod,johannh

This adds a card-like UI to the content blocking section in preferences.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Erica Wright 2018-11-19 17:40:28 +00:00
Родитель 246b04e791
Коммит 87adf060e5
11 изменённых файлов: 588 добавлений и 533 удалений

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

@ -227,10 +227,28 @@ var ContentBlocking = {
PREF_REPORT_BREAKAGE_ENABLED: "browser.contentblocking.reportBreakage.enabled",
PREF_REPORT_BREAKAGE_URL: "browser.contentblocking.reportBreakage.url",
PREF_INTRO_COUNT_CB: "browser.contentblocking.introCount",
PREF_CB_CATEGORY: "browser.contentblocking.category",
// The prefs inside CATEGORY_PREFS set expected behavior for each CB category.
// A null value means that pref is default.
CATEGORY_PREFS: {
strict: [
[TrackingProtection.PREF_TRACKING_TABLE, null],
[ThirdPartyCookies.PREF_ENABLED, Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN],
[TrackingProtection.PREF_ENABLED_IN_PRIVATE_WINDOWS, true],
[TrackingProtection.PREF_ENABLED_GLOBALLY, true],
],
standard: [
[TrackingProtection.PREF_TRACKING_TABLE, null],
[ThirdPartyCookies.PREF_ENABLED, null],
[TrackingProtection.PREF_ENABLED_IN_PRIVATE_WINDOWS, null],
[TrackingProtection.PREF_ENABLED_GLOBALLY, null],
],
},
content: null,
icon: null,
activeTooltipText: null,
disabledTooltipText: null,
switchingCategory: false,
get prefIntroCount() {
return this.PREF_INTRO_COUNT_CB;
@ -324,6 +342,14 @@ var ContentBlocking = {
gNavigatorBundle.getString("trackingProtection.icon.activeTooltip");
this.disabledTooltipText =
gNavigatorBundle.getString("trackingProtection.icon.disabledTooltip");
this.matchCBCategory = this.matchCBCategory.bind(this);
this.updateCBCategory = this.updateCBCategory.bind(this);
this.matchCBCategory();
Services.prefs.addObserver(TrackingProtection.PREF_ENABLED_GLOBALLY, this.matchCBCategory);
Services.prefs.addObserver(TrackingProtection.PREF_ENABLED_IN_PRIVATE_WINDOWS, this.matchCBCategory);
Services.prefs.addObserver(ThirdPartyCookies.PREF_ENABLED, this.matchCBCategory);
Services.prefs.addObserver(this.PREF_CB_CATEGORY, this.updateCBCategory);
},
uninit() {
@ -334,6 +360,10 @@ var ContentBlocking = {
}
Services.prefs.removeObserver(this.PREF_ANIMATIONS_ENABLED, this.updateAnimationsEnabled);
Services.prefs.removeObserver(TrackingProtection.PREF_ENABLED_GLOBALLY, this.matchCBCategory);
Services.prefs.removeObserver(TrackingProtection.PREF_ENABLED_IN_PRIVATE_WINDOWS, this.matchCBCategory);
Services.prefs.removeObserver(ThirdPartyCookies.PREF_ENABLED, this.matchCBCategory);
Services.prefs.removeObserver(this.PREF_CB_CATEGORY, this.updateCBCategory);
},
hideIdentityPopupAndReload() {
@ -610,4 +640,89 @@ var ContentBlocking = {
UITour.showInfo(window, panelTarget, introTitle, introDescription, undefined, buttons,
{ closeButtonCallback: () => this.dontShowIntroPanelAgain() });
},
/**
* 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, value] of this.CATEGORY_PREFS[category]) {
if (!value) {
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)) {
return false;
}
}
}
return true;
},
async matchCBCategory() {
if (this.switchingCategory) {
return;
}
// If PREF_CB_CATEGORY is not set match users to a Content Blocking category. Check if prefs fit
// perfectly into strict or standard, otherwise match with custom. If PREF_CB_CATEGORY has previously been set,
// a change of one of these prefs necessarily puts us in "custom".
if (this.prefsMatch("standard")) {
Services.prefs.setStringPref(this.PREF_CB_CATEGORY, "standard");
} else if (this.prefsMatch("strict")) {
Services.prefs.setStringPref(this.PREF_CB_CATEGORY, "strict");
} else {
Services.prefs.setStringPref(this.PREF_CB_CATEGORY, "custom");
}
},
updateCBCategory() {
if (this.switchingCategory) {
return;
}
// Turn on switchingCategory flag, to ensure that when the individual prefs that change as a result
// of the category change do not trigger yet another category change.
this.switchingCategory = true;
let value = Services.prefs.getStringPref(this.PREF_CB_CATEGORY);
this.setPrefsToCategory(value);
this.switchingCategory = false;
},
/**
* Sets all user-exposed content blocking preferences to values that match the selected category.
*/
setPrefsToCategory(category) {
// Leave prefs as they were if we are switching to "custom" category.
if (category == "custom") {
return;
}
for (let [pref, value] of this.CATEGORY_PREFS[category]) {
// this.setPrefIfNotLocked(pref[0], pref[1]);
if (!Services.prefs.prefIsLocked(pref)) {
if (!value) {
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);
break;
case Services.prefs.PREF_STRING:
Services.prefs.setStringPref(pref, value);
break;
}
}
}
}
},
};

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

@ -20,12 +20,6 @@ ChromeUtils.defineModuleGetter(this, "SiteDataManager",
ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
XPCOMUtils.defineLazyPreferenceGetter(this, "contentBlockingTrackingProtectionUiEnabled",
"browser.contentblocking.trackingprotection.ui.enabled");
XPCOMUtils.defineLazyPreferenceGetter(this, "contentBlockingRejectTrackersUiEnabled",
"browser.contentblocking.rejecttrackers.ui.enabled");
const PREF_UPLOAD_ENABLED = "datareporting.healthreport.uploadEnabled";
const TRACKING_PROTECTION_KEY = "websites.trackingProtectionMode";
@ -52,11 +46,6 @@ Preferences.addAll([
// Tracking Protection
{ id: "privacy.trackingprotection.enabled", type: "bool" },
{ id: "privacy.trackingprotection.pbmode.enabled", type: "bool" },
// This isn't a configuration pref, rather it's for saving the previous state
// of the UI when we turn off the TP controls when the user checks off the
// All Detected Trackers under Content Blocking. This pref isn't listed in
// all.js/firefox.js to make sure it doesn't appear in about:config by default.
{ id: "browser.privacy.trackingprotection.menu", type: "string" },
// Button prefs
{ id: "pref.privacy.disable_button.cookie_exceptions", type: "bool" },
@ -77,6 +66,7 @@ Preferences.addAll([
{ id: "network.cookie.cookieBehavior", type: "int" },
{ id: "network.cookie.lifetimePolicy", type: "int" },
{ id: "network.cookie.blockFutureCookies", type: "bool" },
{ id: "browser.contentblocking.category", type: "string"},
// Clear Private Data
{ id: "privacy.sanitize.sanitizeOnShutdown", type: "bool" },
{ id: "privacy.sanitize.timeSpan", type: "int" },
@ -175,6 +165,15 @@ var gPrivacyPane = {
!tpCheckbox.checked;
tpCheckbox.disabled = disabled;
document.getElementById("standardRadio").disabled = isControlled;
document.getElementById("strictRadio").disabled = isControlled;
document.getElementById("contentBlockingOptionStrict").classList.toggle("disabled", isControlled);
document.getElementById("contentBlockingOptionStandard").classList.toggle("disabled", isControlled);
let arrowButtons = document.querySelectorAll("button.arrowhead");
for (let button of arrowButtons) {
button.disabled = isControlled;
}
// Notify observers that the TP UI has been updated.
// This is needed since our tests need to be notified about the
// trackingProtectionMenu element getting disabled/enabled at the right time.
@ -423,115 +422,79 @@ var gPrivacyPane = {
*/
initContentBlocking() {
setEventListener("changeBlockListLink", "click", this.showBlockLists);
setEventListener("contentBlockingRestoreDefaults", "command",
this.restoreContentBlockingPrefs);
setEventListener("contentBlockingTrackingProtectionCheckbox", "command",
this.trackingProtectionWritePrefs);
setEventListener("contentBlockingTrackingProtectionCheckbox", "command",
this._updateTrackingProtectionUI);
setEventListener("trackingProtectionMenu", "command",
this.trackingProtectionWritePrefs);
setEventListener("contentBlockingChangeCookieSettings", "command",
this.changeCookieSettings);
setEventListener("contentBlockingBlockCookiesCheckbox", "command",
this.writeBlockCookiesCheckbox);
setEventListener("standardArrow", "command", this.toggleExpansion);
setEventListener("strictArrow", "command", this.toggleExpansion);
setEventListener("customArrow", "command", this.toggleExpansion);
Preferences.get("network.cookie.cookieBehavior").on("change",
gPrivacyPane.readBlockCookiesCheckbox.bind(gPrivacyPane));
gPrivacyPane.readBlockCookies.bind(gPrivacyPane));
Preferences.get("browser.contentblocking.category").on("change",
gPrivacyPane.highlightCBCategory);
this.readBlockCookiesCheckbox();
this.highlightCBCategory();
this.readBlockCookies();
let link = document.getElementById("contentBlockingLearnMore");
let url = Services.urlFormatter.formatURLPref("app.support.baseURL") + "tracking-protection";
link.setAttribute("href", url);
// Honour our Content Blocking category UI prefs. If each pref is set to false,
// Make all descendants of the corresponding selector hidden.
let selectorPrefMap = {
".tracking-protection-ui": contentBlockingTrackingProtectionUiEnabled,
".reject-trackers-ui": contentBlockingRejectTrackersUiEnabled,
};
for (let selector in selectorPrefMap) {
let pref = selectorPrefMap[selector];
if (!pref) {
let elements = document.querySelectorAll(selector);
for (let element of elements) {
element.hidden = true;
}
}
let warningLinks = document.getElementsByClassName("content-blocking-warning-learn-how");
for (let warningLink of warningLinks) {
let warningUrl = Services.urlFormatter.formatURLPref("app.support.baseURL") + "content-blocking";
warningLink.setAttribute("href", warningUrl);
}
},
/**
* Resets all user-exposed content blocking preferences to their default values.
*/
async restoreContentBlockingPrefs() {
function clearIfNotLocked(pref) {
if (!Services.prefs.prefIsLocked(pref)) {
Services.prefs.clearUserPref(pref);
}
highlightCBCategory() {
let value = document.getElementById("contentBlockingCategoryRadio").value;
let standardEl = document.getElementById("contentBlockingOptionStandard");
let strictEl = document.getElementById("contentBlockingOptionStrict");
let customEl = document.getElementById("contentBlockingOptionCustom");
standardEl.classList.remove("selected");
strictEl.classList.remove("selected");
customEl.classList.remove("selected");
switch (value) {
case "standard":
standardEl.classList.add("selected");
break;
case "strict":
strictEl.classList.add("selected");
break;
case "custom":
customEl.classList.add("selected");
break;
}
clearIfNotLocked("urlclassifier.trackingTable");
clearIfNotLocked("network.cookie.cookieBehavior");
clearIfNotLocked("network.cookie.lifetimePolicy");
let controllingExtension = await getControllingExtension(
PREF_SETTING_TYPE, TRACKING_PROTECTION_KEY);
if (!controllingExtension) {
for (let preference of TRACKING_PROTECTION_PREFS) {
clearIfNotLocked(preference);
}
}
},
/**
* Highlights the Cookies & Site Data UI section.
*/
changeCookieSettings() {
gotoPref("privacy-sitedata");
},
// TRACKING PROTECTION MODE
/**
* Selects the right item of the Tracking Protection radiogroup.
* Selects the right item of the Tracking Protection menulist and checkbox.
*/
trackingProtectionReadPrefs() {
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 = document.getElementById("trackingProtectionMenu");
let tpMenu = document.getElementById("trackingProtectionMenu");
let tpCheckbox = document.getElementById("contentBlockingTrackingProtectionCheckbox");
let savedMenuValue;
// 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();
// Global enable takes precedence over enabled in Private Browsing.
if (enabledPref.value) {
tpControl.value = "always";
if (tpCheckbox) {
tpCheckbox.checked = true;
}
tpMenu.value = "always";
tpCheckbox.checked = true;
} else if (pbmPref.value) {
tpControl.value = "private";
if (tpCheckbox) {
tpCheckbox.checked = true;
}
} else if (!tpCheckbox) {
tpControl.value = "never";
tpMenu.value = "private";
tpCheckbox.checked = true;
} else {
if (savedMenuValue) {
tpControl.value = savedMenuValue;
}
tpMenu.value = "never";
tpCheckbox.checked = false;
}
},
@ -541,17 +504,15 @@ var gPrivacyPane = {
*/
networkCookieBehaviorReadPrefs() {
let behavior = Preferences.get("network.cookie.cookieBehavior").value;
let blockCookiesCtrl = document.getElementById("blockCookies");
let blockCookiesLabel = document.getElementById("blockCookiesLabel");
let blockCookiesMenu = document.getElementById("blockCookiesMenu");
let deleteOnCloseCheckbox = document.getElementById("deleteOnClose");
let blockCookies = (behavior != 0);
let blockCookies = (behavior != Ci.nsICookieService.BEHAVIOR_ACCEPT);
let cookieBehaviorLocked = Services.prefs.prefIsLocked("network.cookie.cookieBehavior");
let blockCookiesControlsDisabled = !blockCookies || cookieBehaviorLocked;
blockCookiesLabel.disabled = blockCookiesMenu.disabled = blockCookiesControlsDisabled;
blockCookiesMenu.disabled = blockCookiesControlsDisabled;
let completelyBlockCookies = (behavior == 2);
let completelyBlockCookies = (behavior == Ci.nsICookieService.BEHAVIOR_REJECT);
let privateBrowsing = Preferences.get("browser.privatebrowsing.autostart").value;
let cookieExpirationLocked = Services.prefs.prefIsLocked("network.cookie.lifetimePolicy");
deleteOnCloseCheckbox.disabled = privateBrowsing || completelyBlockCookies ||
@ -559,22 +520,17 @@ var gPrivacyPane = {
switch (behavior) {
case Ci.nsICookieService.BEHAVIOR_ACCEPT:
blockCookiesCtrl.value = "allow";
break;
case Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN:
blockCookiesCtrl.value = "disallow";
blockCookiesMenu.value = "all-third-parties";
break;
case Ci.nsICookieService.BEHAVIOR_REJECT:
blockCookiesCtrl.value = "disallow";
blockCookiesMenu.value = "always";
break;
case Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN:
blockCookiesCtrl.value = "disallow";
blockCookiesMenu.value = "unvisited";
break;
case Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER:
blockCookiesCtrl.value = "disallow";
blockCookiesMenu.value = "trackers";
break;
}
@ -586,20 +542,18 @@ var gPrivacyPane = {
trackingProtectionWritePrefs() {
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 = document.getElementById("trackingProtectionMenu");
let tpMenu = document.getElementById("trackingProtectionMenu");
let tpCheckbox = document.getElementById("contentBlockingTrackingProtectionCheckbox");
let value;
if (tpCheckbox) {
if (tpCheckbox.checked) {
value = tpControl.value;
btpmPref.value = value;
} else {
value = "never";
if (tpCheckbox.checked) {
if (tpMenu.value == "never") {
tpMenu.value = "private";
}
value = tpMenu.value;
} else {
value = tpControl.value;
tpMenu.value = "never";
value = "never";
}
switch (value) {
@ -618,6 +572,12 @@ var gPrivacyPane = {
}
},
toggleExpansion(e) {
let carat = e.target;
carat.classList.toggle("up");
carat.closest(".content-blocking-category").classList.toggle("expanded");
},
// HISTORY MODE
/**
@ -946,31 +906,24 @@ var gPrivacyPane = {
/**
* Reads the network.cookie.cookieBehavior preference value and
* enables/disables the rest of the new cookie & site data UI accordingly.
*
* Returns "allow" if cookies are accepted and "disallow" if they are entirely
* disabled.
* enables/disables the "blockCookiesMenu" menulist accordingly.
*/
readBlockCookies() {
// enable the rest of the UI for anything other than "accept all cookies"
let pref = Preferences.get("network.cookie.cookieBehavior");
let blockCookies = (pref.value != 0);
// Our top-level setting is a radiogroup that only sets "enable all"
// and "disable all", so convert the pref value accordingly.
return blockCookies ? "disallow" : "allow";
let bcControl = document.getElementById("blockCookiesMenu");
bcControl.disabled = pref.value == Ci.nsICookieService.BEHAVIOR_ACCEPT;
},
/**
* Updates the "accept third party cookies" menu based on whether the
* "accept cookies" or "block cookies" radio buttons are selected.
* "contentBlockingBlockCookiesCheckbox" checkbox is checked.
*/
writeBlockCookies() {
let block = document.getElementById("blockCookies");
let block = document.getElementById("contentBlockingBlockCookiesCheckbox");
let blockCookiesMenu = document.getElementById("blockCookiesMenu");
// if we're disabling cookies, automatically select 'third-party trackers'
if (block.value == "disallow") {
if (block.checked) {
// Automatically select 'third-party trackers' as the default.
blockCookiesMenu.selectedIndex = 0;
return this.writeBlockCookiesFrom();
}
@ -978,112 +931,6 @@ var gPrivacyPane = {
return Ci.nsICookieService.BEHAVIOR_ACCEPT;
},
enableThirdPartyCookiesUI() {
document.getElementById("blockCookiesCBDeck").selectedIndex = 0;
document.getElementById("contentBlockingChangeCookieSettings").hidden = true;
},
disableThirdPartyCookiesUI(reason) {
let deckIndex = 0;
switch (reason) {
case "always":
deckIndex = 1;
break;
case "unvisited":
deckIndex = 2;
break;
}
document.getElementById("blockCookiesCBDeck").selectedIndex = deckIndex;
document.getElementById("contentBlockingChangeCookieSettings").hidden = false;
},
/**
* Converts between network.cookie.cookieBehavior and the new content blocking UI
*/
readBlockCookiesCB() {
let pref = Preferences.get("network.cookie.cookieBehavior");
switch (pref.value) {
case Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN:
return "all-third-parties";
case Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER:
return "trackers";
default:
return undefined;
}
},
writeBlockCookiesCB() {
let block = document.getElementById("blockCookiesCB").selectedItem;
switch (block.value) {
case "trackers":
return Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER;
case "all-third-parties":
return Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN;
default:
return undefined;
}
},
writeBlockCookiesCheckbox() {
let pref = Preferences.get("network.cookie.cookieBehavior");
let bcCheckbox = document.getElementById("contentBlockingBlockCookiesCheckbox");
let bcControl = document.getElementById("blockCookiesCB");
let value;
if (bcCheckbox.checked) {
value = bcControl.selectedItem.value;
} else {
value = "none";
}
switch (value) {
case "trackers":
case "all-third-parties":
bcControl.disabled = false;
pref.value = this.writeBlockCookiesCB();
break;
default:
bcControl.disabled = true;
pref.value = Ci.nsICookieService.BEHAVIOR_ACCEPT;
break;
}
},
readBlockCookiesCheckbox() {
let pref = Preferences.get("network.cookie.cookieBehavior");
let bcCheckbox = document.getElementById("contentBlockingBlockCookiesCheckbox");
let bcControl = document.getElementById("blockCookiesCB");
switch (pref.value) {
case Ci.nsICookieService.BEHAVIOR_ACCEPT:
this.enableThirdPartyCookiesUI();
bcCheckbox.checked = false;
bcControl.disabled = true;
break;
case Ci.nsICookieService.BEHAVIOR_REJECT:
this.disableThirdPartyCookiesUI("always");
break;
case Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN:
this.disableThirdPartyCookiesUI("unvisited");
break;
case Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN:
this.enableThirdPartyCookiesUI();
bcCheckbox.checked = true;
bcControl.disabled = false;
break;
case Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER:
this.enableThirdPartyCookiesUI();
bcCheckbox.checked = true;
bcControl.disabled = false;
break;
default:
break;
}
},
/**
* Converts between network.cookie.cookieBehavior and the new third-party cookies UI
*/
readBlockCookiesFrom() {
let pref = Preferences.get("network.cookie.cookieBehavior");
switch (pref.value) {

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

@ -23,24 +23,20 @@
</caption>
<vbox data-subcategory="trackingprotection">
<hbox align="start">
<image id="trackingProtectionShield"/>
<vbox flex="1">
<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"/>
<description class="description-with-side-element">
<html:span id="contentBlockingDescription" class="tail-with-learn-more" data-l10n-id="content-blocking-description"></html:span>
<label id="contentBlockingLearnMore" class="learnMore text-link" data-l10n-id="content-blocking-learn-more"/>
</description>
</vbox>
<vbox>
<!-- 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="contentBlockingRestoreDefaults"
class="accessory-button"
flex="1"
data-l10n-id="content-blocking-restore-defaults"/>
</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="trackingProtectionExceptions"
class="accessory-button"
flex="1"
data-l10n-id="tracking-exceptions"
data-l10n-id="tracking-manage-exceptions"
preference="pref.privacy.disable_button.tracking_protection_exceptions"
search-l10n-ids="
permissions-remove.label,
@ -54,15 +50,80 @@
</vbox>
</hbox>
<vbox id="contentBlockingCategories">
<label id="content-blocking-categories-label" data-l10n-id="content-blocking-category-label"/>
<vbox>
<hbox class="content-blocking-category tracking-protection-ui">
<vbox>
<checkbox id="contentBlockingTrackingProtectionCheckbox"
class="content-blocking-checkbox" flex="1"
src="chrome://browser/skin/controlcenter/trackers.svg"
data-l10n-id="content-blocking-tracking-protection-trackers-label"/>
<vbox class="content-blocking-category-labels" flex="1">
<radiogroup id="contentBlockingCategoryRadio"
preference="browser.contentblocking.category"
aria-labelledby="trackingProtectionMenuDesc">
<vbox id="contentBlockingOptionStandard" class="content-blocking-category">
<hbox>
<radio id="standardRadio"
value="standard"
data-l10n-id="content-blocking-setting-standard"
flex="1"/>
<button id="standardArrow" class="arrowhead"/>
</hbox>
<vbox class="indent">
<description data-l10n-id="content-blocking-standard-desc"></description>
<vbox class="content-blocking-extra-information">
<vbox class="indent">
<hbox class="extra-information-label">
<image class="content-blocking-trackers-image"/>
<label data-l10n-id="content-blocking-private-trackers"/>
</hbox>
<hbox class="extra-information-label">
<image class="content-blocking-cookies-image"/>
<label data-l10n-id="content-blocking-third-party-cookies"/>
</hbox>
</vbox>
</vbox>
</vbox>
</vbox>
<vbox id="contentBlockingOptionStrict" class="content-blocking-category">
<hbox>
<radio id="strictRadio"
value="strict"
data-l10n-id="content-blocking-setting-strict"
flex="1"/>
<button id="strictArrow" class="arrowhead"/>
</hbox>
<vbox class="indent">
<label data-l10n-id="content-blocking-strict-desc"></label>
<vbox class="content-blocking-extra-information">
<vbox class="indent">
<hbox class="extra-information-label">
<image class="content-blocking-trackers-image"/>
<label data-l10n-id="content-blocking-all-windows-trackers"/>
</hbox>
<hbox class="extra-information-label">
<image class="content-blocking-cookies-image"/>
<label data-l10n-id="content-blocking-all-third-party-cookies"/>
</hbox>
</vbox>
<vbox class="content-blocking-warning">
<vbox class="indent">
<hbox>
<image class="content-blocking-warning-image"/>
<label class="content-blocking-warning-title" data-l10n-id="content-blocking-warning-title"/>
</hbox>
<description class="indent">
<html:span class="tail-with-learn-more" data-l10n-id="content-blocking-warning-desc"></html:span>
<label class="text-link content-blocking-warning-learn-how" data-l10n-id="content-blocking-learn-how"/>
</description>
</vbox>
</vbox>
</vbox>
</vbox>
</vbox>
<vbox id="contentBlockingOptionCustom" class="tracking-protection-ui content-blocking-category">
<hbox>
<radio id="customRadio"
value="custom"
data-l10n-id="content-blocking-setting-custom"
flex="1"/>
<button id="customArrow" class="arrowhead"/>
</hbox>
<vbox class="indent">
<description id="contentBlockingCustomDesc" data-l10n-id="content-blocking-custom-desc"></description>
<vbox class="content-blocking-extra-information">
<hbox id="contentBlockingTrackingProtectionExtensionContentLabel"
align="center" hidden="true" class="extension-controlled">
<description control="contentBlockingDisableTrackingProtectionExtension" flex="1"/>
@ -70,72 +131,65 @@
class="extension-controlled-button accessory-button"
data-l10n-id="disable-extension" hidden="true"/>
</hbox>
<description data-l10n-id="content-blocking-tracking-protection-new-description"
class="content-blocking-category-description"
id="trackingProtectionMenuDesc"/>
<radiogroup id="trackingProtectionMenu"
aria-labelledby="trackingProtectionMenuDesc">
<radio value="private"
data-l10n-id="content-blocking-tracking-protection-option-private"
flex="1" />
<radio value="always"
data-l10n-id="content-blocking-tracking-protection-option-always"
flex="1" />
</radiogroup>
<label id="changeBlockListLink"
data-l10n-id="content-blocking-tracking-protection-change-block-list"
class="text-link"
search-l10n-ids="blocklist-window.title, blocklist-desc, blocklist-button-cancel.label, blocklist-button-ok.label"/>
</vbox>
</vbox>
</hbox>
</vbox>
<hbox class="content-blocking-category reject-trackers-ui">
<hbox flex="1">
<vbox class="content-blocking-category-checkbox">
<checkbox id="contentBlockingBlockCookiesCheckbox"
class="content-blocking-checkbox" flex="1"
src="chrome://browser/skin/controlcenter/3rdpartycookies.svg"
data-l10n-id="content-blocking-third-party-cookies-label"/>
<vbox class="content-blocking-category-labels" flex="1">
<hbox>
<vbox flex="1">
<deck id="blockCookiesCBDeck">
<description id="blockCookiesCBDesc"
data-l10n-id="content-blocking-reject-trackers-description"
class="content-blocking-category-description"/>
<description data-l10n-id="content-blocking-reject-trackers-warning-your-settings-prevent-changes"
class="content-blocking-category-description description-with-side-element warning-description"/>
<description data-l10n-id="content-blocking-reject-trackers-warning-your-settings-prevent-changes"
class="content-blocking-category-description description-with-side-element warning-description"/>
</deck>
</vbox>
<hbox align="center" pack="end">
<vbox align="center">
<button id="contentBlockingChangeCookieSettings"
class="accessory-button"
flex="1"
hidden="true"
data-l10n-id="content-blocking-change-cookie-settings"/>
<hbox class="custom-option">
<checkbox id="contentBlockingTrackingProtectionCheckbox"
class="content-blocking-checkbox" flex="1"
data-l10n-id="content-blocking-tracking-protection-trackers-label"
aria-describedby="contentBlockingCustomDesc"/>
<vbox>
<menulist id="trackingProtectionMenu">
<menupopup>
<menuitem data-l10n-id="content-blocking-tracking-protection-option-private" value="private"/>
<menuitem data-l10n-id="content-blocking-tracking-protection-option-always" value="always"/>
</menupopup>
</menulist>
</vbox>
</hbox>
</hbox>
<radiogroup id="blockCookiesCB"
aria-labelledby="blockCookiesCBDesc"
preference="network.cookie.cookieBehavior"
onsyncfrompreference="return gPrivacyPane.readBlockCookiesCB();"
onsynctopreference="return gPrivacyPane.writeBlockCookiesCB();">
<radio value="trackers"
data-l10n-id="content-blocking-reject-trackers-block-trackers-option-recommended"
flex="1" />
<radio value="all-third-parties"
data-l10n-id="content-blocking-reject-trackers-all-third-parties-option"
flex="1" />
</radiogroup>
<label id="changeBlockListLink"
data-l10n-id="content-blocking-tracking-protection-change-block-list"
class="text-link"
search-l10n-ids="blocklist-window.title, blocklist-desc, blocklist-button-cancel.label, blocklist-button-ok.label"/>
<hbox class="reject-trackers-ui custom-option">
<checkbox id="contentBlockingBlockCookiesCheckbox"
class="content-blocking-checkbox" flex="1"
data-l10n-id="content-blocking-cookies-label"
aria-describedby="contentBlockingCustomDesc"
preference="network.cookie.cookieBehavior"
onsyncfrompreference="return gPrivacyPane.readBlockCookies();"
onsynctopreference="return gPrivacyPane.writeBlockCookies();"/>
<vbox>
<!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
<hbox>
<menulist id="blockCookiesMenu"
preference="network.cookie.cookieBehavior"
onsyncfrompreference="return gPrivacyPane.readBlockCookiesFrom();"
onsynctopreference="return gPrivacyPane.writeBlockCookiesFrom();">
<menupopup>
<menuitem data-l10n-id="sitedata-block-trackers-option-recommended" value="trackers"/>
<menuitem data-l10n-id="sitedata-block-unvisited-option" value="unvisited"/>
<menuitem data-l10n-id="sitedata-block-all-third-party-option" value="all-third-parties"/>
<menuitem data-l10n-id="sitedata-block-all-option" value="always"/>
</menupopup>
</menulist>
</hbox>
</vbox>
</hbox>
<vbox class="content-blocking-warning">
<vbox class="indent">
<hbox>
<image class="content-blocking-warning-image"/>
<label class="content-blocking-warning-title" data-l10n-id="content-blocking-warning-title"/>
</hbox>
<description class="indent">
<html:span class="tail-with-learn-more" data-l10n-id="content-blocking-warning-desc"></html:span>
<label class="text-link content-blocking-warning-learn-how" data-l10n-id="content-blocking-learn-how"/>
</description>
</vbox>
</vbox>
</vbox>
</vbox>
</hbox>
</hbox>
</vbox>
</radiogroup>
</vbox>
<vbox id="doNotTrackLearnMoreBox">
<label><label class="tail-with-learn-more" data-l10n-id="do-not-track-description" id="doNotTrackDesc"></label><label
@ -160,47 +214,17 @@
<label id="siteDataLearnMoreLink"
class="learnMore text-link" data-l10n-id="sitedata-learn-more"/>
</description>
<radiogroup id="blockCookies"
preference="network.cookie.cookieBehavior"
onsyncfrompreference="return gPrivacyPane.readBlockCookies();"
onsynctopreference="return gPrivacyPane.writeBlockCookies();">
<radio value="allow"
data-l10n-id="sitedata-allow-cookies-option"
flex="1" />
<radio value="disallow"
data-l10n-id="sitedata-disallow-cookies-option"
flex="1" />
<hbox id="blockThirdPartyRow"
class="indent"
align="center">
<label id="blockCookiesLabel" control="blockCookiesMenu"
data-l10n-id="sitedata-block-desc"/>
<!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
<hbox>
<menulist id="blockCookiesMenu" preference="network.cookie.cookieBehavior"
onsyncfrompreference="return gPrivacyPane.readBlockCookiesFrom();"
onsynctopreference="return gPrivacyPane.writeBlockCookiesFrom();">
<menupopup>
<menuitem data-l10n-id="sitedata-block-trackers-option-recommended" value="trackers"/>
<menuitem data-l10n-id="sitedata-block-unvisited-option" value="unvisited"/>
<menuitem data-l10n-id="sitedata-block-all-third-party-option" value="all-third-parties"/>
<menuitem data-l10n-id="sitedata-block-all-option" value="always"/>
</menupopup>
</menulist>
</hbox>
</hbox>
<hbox id="keepRow"
align="center">
<checkbox id="deleteOnClose"
data-l10n-id="sitedata-delete-on-close"
preference="network.cookie.lifetimePolicy"
onsyncfrompreference="return gPrivacyPane.readDeleteOnClose();"
onsynctopreference="return gPrivacyPane.writeDeleteOnClose();"
flex="1" />
</hbox>
</radiogroup>
<hbox id="keepRow"
align="center">
<checkbox id="deleteOnClose"
data-l10n-id="sitedata-delete-on-close"
preference="network.cookie.lifetimePolicy"
onsyncfrompreference="return gPrivacyPane.readDeleteOnClose();"
onsynctopreference="return gPrivacyPane.writeDeleteOnClose();"
flex="1" />
</hbox>
</vbox>
<vbox>
<vbox align="end">
<!-- 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="clearSiteDataButton"
@ -225,7 +249,7 @@
<hbox>
<button id="cookieExceptions"
class="accessory-button"
data-l10n-id="sitedata-cookies-exceptions"
data-l10n-id="sitedata-cookies-permissions"
preference="pref.privacy.disable_button.cookie_exceptions"
search-l10n-ids="
permissions-address,

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

@ -6,6 +6,7 @@ const TP_PREF = "privacy.trackingprotection.enabled";
const TP_PBM_PREF = "privacy.trackingprotection.pbmode.enabled";
const TP_LIST_PREF = "urlclassifier.trackingTable";
const NCB_PREF = "network.cookie.cookieBehavior";
const CAT_PREF = "browser.contentblocking.category";
requestLongerTimeout(2);
@ -58,9 +59,10 @@ add_task(async function testContentBlockingMainCategory() {
tpCheckbox.checked = true;
// Select "Always" under "All Detected Trackers".
let always = doc.querySelector("#trackingProtectionMenu > radio[value=always]");
let private = doc.querySelector("#trackingProtectionMenu > radio[value=private]");
always.radioGroup.selectedItem = always;
let menu = doc.querySelector("#trackingProtectionMenu");
let always = doc.querySelector("#trackingProtectionMenu > menupopup > menuitem[value=always]");
let private = doc.querySelector("#trackingProtectionMenu > menupopup > menuitem[value=private]");
menu.selectedItem = always;
ok(!private.selected, "The Only in private windows item should not be selected");
ok(always.selected, "The Always item should be selected");
@ -72,7 +74,7 @@ add_task(async function testContentBlockingMainCategory() {
checkControlState(doc, alwaysEnabledControls, true);
let promise = TestUtils.topicObserved("privacy-pane-tp-ui-updated");
EventUtils.synthesizeMouseAtCenter(tpCheckbox, {}, doc.defaultView);
tpCheckbox.click();
await promise;
ok(!tpCheckbox.checked, "The checkbox should now be unchecked");
@ -88,12 +90,12 @@ add_task(async function testContentBlockingMainCategory() {
// checked again...
for (let i = 0; i < 3; ++i) {
promise = TestUtils.topicObserved("privacy-pane-tp-ui-updated");
EventUtils.synthesizeMouseAtCenter(tpCheckbox, {}, doc.defaultView);
tpCheckbox.click();
await promise;
is(tpCheckbox.checked, i % 2 == 0, "The checkbox should now be unchecked");
ok(!private.selected, "The Only in private windows item should still not be selected");
ok(always.selected, "The Always item should still be selected");
is(private.selected, i % 2 == 0, "The Only in private windows item should be selected by default, when the checkbox is checked");
ok(!always.selected, "The Always item should no longer be selected");
}
gBrowser.removeCurrentTab();
@ -103,8 +105,8 @@ add_task(async function testContentBlockingMainCategory() {
}
});
// Tests that the content blocking "Restore Defaults" button does what it's supposed to.
add_task(async function testContentBlockingRestoreDefaults() {
// Tests that the content blocking "Standard" category radio sets the prefs to their default values.
add_task(async function testContentBlockingStandardCategory() {
let prefs = {
[TP_LIST_PREF]: null,
[TP_PREF]: null,
@ -159,8 +161,8 @@ add_task(async function testContentBlockingRestoreDefaults() {
await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
let doc = gBrowser.contentDocument;
let contentBlockingRestoreDefaults = doc.getElementById("contentBlockingRestoreDefaults");
contentBlockingRestoreDefaults.click();
let standardRadioOption = doc.getElementById("standardRadio");
standardRadioOption.click();
// TP prefs are reset async to check for extensions controlling them.
await TestUtils.waitForCondition(() => !Services.prefs.prefHasUserValue(TP_PREF));
@ -168,92 +170,72 @@ add_task(async function testContentBlockingRestoreDefaults() {
for (let pref in prefs) {
ok(!Services.prefs.prefHasUserValue(pref), `reset the pref ${pref}`);
}
is(Services.prefs.getStringPref(CAT_PREF), "standard", `${CAT_PREF} has been set to standard`);
gBrowser.removeCurrentTab();
});
// Tests that the content blocking "Restore Defaults" button does not restore prefs
// that are controlled by extensions.
add_task(async function testContentBlockingRestoreDefaultsSkipExtensionControlled() {
function background() {
browser.privacy.websites.trackingProtectionMode.set({value: "always"});
}
// Install an extension that sets Tracking Protection.
let extension = ExtensionTestUtils.loadExtension({
useAddonManager: "permanent",
manifest: {
name: "set_tp",
applications: {gecko: {id: "@set_tp"}},
permissions: ["privacy"],
},
background,
});
let resettable = {
[TP_LIST_PREF]: null,
[NCB_PREF]: null,
};
for (let pref in resettable) {
switch (Services.prefs.getPrefType(pref)) {
case Services.prefs.PREF_STRING:
resettable[pref] = Services.prefs.getCharPref(pref);
break;
case Services.prefs.PREF_INT:
resettable[pref] = Services.prefs.getIntPref(pref);
break;
default:
ok(false, `Unknown pref type for ${pref}`);
}
}
// Tests that the content blocking "Strict" category radio sets the prefs to the expected values.
add_task(async function testContentBlockingStrictCategory() {
Services.prefs.setBoolPref(TP_PREF, false);
Services.prefs.setBoolPref(TP_PBM_PREF, false);
Services.prefs.setIntPref(NCB_PREF, Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN);
Services.prefs.setStringPref(TP_LIST_PREF, "test-track-simple,base-track-digest256,content-track-digest256");
Services.prefs.setIntPref(NCB_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER);
for (let pref in resettable) {
switch (Services.prefs.getPrefType(pref)) {
case Services.prefs.PREF_STRING:
// Account for prefs that may have retained their default value
if (Services.prefs.getCharPref(pref) != resettable[pref]) {
ok(Services.prefs.prefHasUserValue(pref), `modified the pref ${pref}`);
}
break;
case Services.prefs.PREF_INT:
if (Services.prefs.getIntPref(pref) != resettable[pref]) {
ok(Services.prefs.prefHasUserValue(pref), `modified the pref ${pref}`);
}
break;
default:
ok(false, `Unknown pref type for ${pref}`);
}
}
await extension.startup();
await TestUtils.waitForCondition(() => Services.prefs.prefHasUserValue(TP_PREF));
let disabledControls = [
".tracking-protection-ui .content-blocking-checkbox",
"#trackingProtectionMenu",
"[control=trackingProtectionMenu]",
];
await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
let doc = gBrowser.contentDocument;
checkControlState(doc, disabledControls, false);
let strictRadioOption = doc.getElementById("strictRadio");
strictRadioOption.click();
let contentBlockingRestoreDefaults = doc.getElementById("contentBlockingRestoreDefaults");
contentBlockingRestoreDefaults.click();
// TP prefs are reset async to check for extensions controlling them.
await TestUtils.waitForCondition(() => Services.prefs.prefHasUserValue(TP_PREF));
for (let pref in resettable) {
ok(!Services.prefs.prefHasUserValue(pref), `reset the pref ${pref}`);
is(Services.prefs.getStringPref(CAT_PREF), "strict", `${CAT_PREF} has been set to strict`);
is(Services.prefs.getBoolPref(TP_PREF), true, `${TP_PREF} has been set to true`);
is(Services.prefs.getBoolPref(TP_PBM_PREF), true, `${TP_PBM_PREF} has been set to true`);
is(Services.prefs.getIntPref(NCB_PREF), Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN, `${NCB_PREF} has been set to ${Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN}`);
ok(!Services.prefs.prefHasUserValue(TP_LIST_PREF), `reset the pref ${TP_LIST_PREF}`);
gBrowser.removeCurrentTab();
});
// Tests that the content blocking "Custom" category behaves as expected.
add_task(async function testContentBlockingCustomCategory() {
let prefs = [TP_LIST_PREF, TP_PREF, TP_PBM_PREF, NCB_PREF];
await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
let doc = gBrowser.contentDocument;
let strictRadioOption = doc.getElementById("strictRadio");
let standardRadioOption = doc.getElementById("standardRadio");
let customRadioOption = doc.getElementById("customRadio");
standardRadioOption.click();
await TestUtils.waitForCondition(() => !Services.prefs.prefHasUserValue(TP_PREF));
customRadioOption.click();
await TestUtils.waitForCondition(() => Services.prefs.getStringPref(CAT_PREF) == "custom");
// The custom option does not force changes of any prefs, other than CAT_PREF, all other TP prefs should remain as they were for standard.
for (let pref of prefs) {
ok(!Services.prefs.prefHasUserValue(pref), `the pref ${pref} remains as default value`);
}
is(Services.prefs.getStringPref(CAT_PREF), "custom", `${CAT_PREF} has been set to custom`);
ok(Services.prefs.prefHasUserValue(TP_PREF), "did not reset the TP pref");
strictRadioOption.click();
await TestUtils.waitForCondition(() => Services.prefs.prefHasUserValue(TP_PREF));
await extension.unload();
// Changing the TP_PREF should necessarily set CAT_PREF to "custom"
Services.prefs.setBoolPref(TP_PREF, false);
await TestUtils.waitForCondition(() => !Services.prefs.prefHasUserValue(TP_PREF));
is(Services.prefs.getStringPref(CAT_PREF), "custom", `${CAT_PREF} has been set to custom`);
strictRadioOption.click();
await TestUtils.waitForCondition(() => Services.prefs.getStringPref(CAT_PREF) == "strict");
// Changing the NCB_PREF should necessarily set CAT_PREF to "custom"
Services.prefs.setIntPref(NCB_PREF, 4);
await TestUtils.waitForCondition(() => !Services.prefs.prefHasUserValue(NCB_PREF));
is(Services.prefs.getStringPref(CAT_PREF), "custom", `${CAT_PREF} has been set to custom`);
gBrowser.removeCurrentTab();
});
@ -270,57 +252,25 @@ function checkControlState(doc, controls, enabled) {
}
}
// Checks that the controls for tracking protection are disabled when all TP prefs are off.
// Checks that the menulists for tracking protection and cookie blocking are disabled when all TP prefs are off.
add_task(async function testContentBlockingDependentTPControls() {
SpecialPowers.pushPrefEnv({set: [
[CB_TP_UI_PREF, true],
[CB_RT_UI_PREF, true],
[TP_PREF, false],
[TP_PBM_PREF, false],
[NCB_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER],
[NCB_PREF, Ci.nsICookieService.BEHAVIOR_ACCEPT],
[CAT_PREF, "custom"],
]});
let disabledControls = [
"#trackingProtectionMenu",
"#blockCookiesMenu",
];
await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
let doc = gBrowser.contentDocument;
checkControlState(doc, disabledControls, false);
gBrowser.removeCurrentTab();
});
// Checks that the warnings in the Content Blocking Third-Party Cookies section correctly appear based on
// the selections in the Cookies and Site Data section.
add_task(async function testContentBlockingThirdPartyCookiesWarning() {
await SpecialPowers.pushPrefEnv({set: [
[CB_TP_UI_PREF, true],
[CB_RT_UI_PREF, true],
]});
let expectedDeckIndex = new Map([
[Ci.nsICookieService.BEHAVIOR_ACCEPT, 0],
[Ci.nsICookieService.BEHAVIOR_REJECT_FOREIGN, 0],
[Ci.nsICookieService.BEHAVIOR_REJECT, 1],
[Ci.nsICookieService.BEHAVIOR_LIMIT_FOREIGN, 2],
[Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER, 0],
]);
await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
let doc = gBrowser.contentDocument;
let deck = doc.getElementById("blockCookiesCBDeck");
for (let obj of expectedDeckIndex) {
Services.prefs.setIntPref(NCB_PREF, obj[0]);
is(deck.selectedIndex, obj[1], "Correct deck index is being displayed");
Services.prefs.clearUserPref(NCB_PREF);
}
gBrowser.removeCurrentTab();
});

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

@ -30,6 +30,6 @@ add_task(async function() {
add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
await evaluateSearchResults("third-party", ["siteDataGroup", "trackingGroup"]);
await evaluateSearchResults("third-party", ["trackingGroup"]);
BrowserTestUtils.removeTab(gBrowser.selectedTab);
});

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

@ -67,14 +67,5 @@ add_task(async function test_change_cookie_settings() {
is(doc.querySelector(".spotlight"), null,
"The spotlighted section is cleared.");
let changeCookieSettings = doc.getElementById("contentBlockingChangeCookieSettings");
changeCookieSettings.doCommand();
await TestUtils.waitForCondition(() => doc.querySelector(".spotlight"),
"Wait for the content-blocking section to be spotlighted.");
is(doc.querySelector(".spotlight").getAttribute("data-subcategory"), "sitedata",
"The sitedata section is spotlighted.");
is(prefs.selectedPane, "panePrivacy", "Privacy pane is selected by default");
is(doc.location.hash, "#privacy", "The subcategory should be removed from the URI");
BrowserTestUtils.removeTab(gBrowser.selectedTab);
});

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

@ -53,7 +53,7 @@ function test_dependent_elements(win) {
ok(control, "the dependent controls should exist");
});
let independents = [
win.document.getElementById("blockCookies"),
win.document.getElementById("contentBlockingBlockCookiesCheckbox"),
];
independents.forEach(function(control) {
ok(control, "the independent controls should exist");
@ -112,15 +112,14 @@ function test_dependent_elements(win) {
function test_dependent_cookie_elements(win) {
let deleteOnCloseCheckbox = win.document.getElementById("deleteOnClose");
let blockCookiesLabel = win.document.getElementById("blockCookiesLabel");
let blockCookiesMenu = win.document.getElementById("blockCookiesMenu");
let controls = [blockCookiesLabel, blockCookiesMenu, deleteOnCloseCheckbox];
let controls = [blockCookiesMenu, deleteOnCloseCheckbox];
controls.forEach(function(control) {
ok(control, "the dependent cookie controls should exist");
});
let blockcookies = win.document.getElementById("blockCookies");
ok(blockcookies, "the block cookies checkbox should exist");
let blockCookiesCheckbox = win.document.getElementById("contentBlockingBlockCookiesCheckbox");
ok(blockCookiesCheckbox, "the block cookies checkbox should exist");
function expect_disabled(disabled, c = controls) {
c.forEach(function(control) {
@ -129,19 +128,19 @@ function test_dependent_cookie_elements(win) {
});
}
blockcookies.value = "disallow";
controlChanged(blockcookies);
blockCookiesCheckbox.checked = true;
controlChanged(blockCookiesCheckbox);
expect_disabled(false);
blockcookies.value = "allow";
controlChanged(blockcookies);
expect_disabled(true, [blockCookiesLabel, blockCookiesMenu]);
blockCookiesCheckbox.checked = false;
controlChanged(blockCookiesCheckbox);
expect_disabled(true, [blockCookiesMenu]);
expect_disabled(false, [deleteOnCloseCheckbox]);
blockCookiesMenu.value = "always";
controlChanged(blockCookiesMenu);
expect_disabled(true, [deleteOnCloseCheckbox]);
expect_disabled(false, [blockCookiesLabel, blockCookiesMenu]);
expect_disabled(false, [blockCookiesMenu]);
if (win.contentBlockingCookiesAndSiteDataRejectTrackersEnabled) {
blockCookiesMenu.value = "trackers";
@ -158,7 +157,7 @@ function test_dependent_cookie_elements(win) {
historymode.value = "dontremember";
controlChanged(historymode);
expect_disabled(true, [deleteOnCloseCheckbox]);
expect_disabled(false, [blockCookiesLabel, blockCookiesMenu]);
expect_disabled(false, [blockCookiesMenu]);
historymode.value = "remember";
controlChanged(historymode);

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

@ -787,9 +787,9 @@ sitedata-settings =
.label = Manage Data…
.accesskey = M
sitedata-cookies-exceptions =
.label = Exceptions…
.accesskey = E
sitedata-cookies-permissions =
.label = Manage Permissions…
.accesskey = P
## Privacy Section - Address Bar
@ -813,14 +813,32 @@ addressbar-suggestions-settings = Change preferences for search engine suggestio
content-blocking-header = Content Blocking
content-blocking-desc = Block third-party content, like ads or code, that can slow your browsing and track you around the web. Customize your settings for the best balance of protection and performance.
content-blocking-description = Block third-party content that tracks you around the web. Control how much of your online activity gets stored and shared between websites.
content-blocking-learn-more = Learn more
content-blocking-restore-defaults =
.label = Restore Defaults
.accesskey = R
content-blocking-category-label = Choose what to block
content-blocking-setting-standard =
.label = Standard
.accesskey = d
content-blocking-setting-strict =
.label = Strict
.accesskey = r
content-blocking-setting-custom =
.label = Custom
.accesskey = C
content-blocking-standard-desc = Balanced for protection and performance. Allows some trackers so websites function properly.
content-blocking-strict-desc = Blocks all trackers { -brand-short-name } detects. May cause some sites to break.
content-blocking-custom-desc = Choose what to block.
content-blocking-private-trackers = Known trackers only in Private Windows
content-blocking-third-party-cookies = Third-party tracking cookies
content-blocking-all-windows-trackers = Known trackers in all windows
content-blocking-all-third-party-cookies = All third-party cookies
content-blocking-warning-title = Heads up!
content-blocking-warning-desc = Blocking cookies and trackers can cause some websites to break. Its easy to disable blocking for sites you trust.
content-blocking-learn-how = Learn how
content-blocking-tracking-protection-trackers-label =
.label = Trackers
@ -828,7 +846,6 @@ content-blocking-tracking-protection-trackers-label =
content-blocking-tracking-protection-all-detected-trackers-label =
.label = All Detected Trackers
.accesskey = T
content-blocking-tracking-protection-new-description = Block all known trackers. (May prevent some pages from loading.)
content-blocking-tracking-protection-option-always =
.label = Always
.accesskey = A
@ -837,29 +854,14 @@ content-blocking-tracking-protection-option-private =
.accesskey = p
content-blocking-tracking-protection-change-block-list = Change block list
content-blocking-third-party-cookies-label =
.label = Third-Party Cookies
content-blocking-cookies-label =
.label = Cookies
.accesskey = C
content-blocking-reject-trackers-description = Block all third-party cookies or just those set by trackers.
# This is a warning message shown next to a yellow warning icon when the Third-Party Cookies subsection
# of the Content Blocking UI in Preferences has been disabled due to the either the "All cookies" option
# or the "Cookies from unvisited websites" option being selected in the Cookies and Site Data section of
# the UI.
content-blocking-reject-trackers-warning-your-settings-prevent-changes = Your settings in Cookies and Site Data are preventing changes to Third-Party Cookies settings.
content-blocking-change-cookie-settings =
.label = Change Cookie Settings
.accesskey = S
content-blocking-reject-trackers-block-trackers-option-recommended =
.label = Trackers (recommended)
.accesskey = k
content-blocking-reject-trackers-all-third-parties-option =
.label = All third-party cookies (may cause websites to break)
.accesskey = A
## Privacy Section - Tracking
tracking-exceptions =
.label = Exceptions…
tracking-manage-exceptions =
.label = Manage Exceptions…
.accesskey = x
## Privacy Section - Permissions

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

@ -18,6 +18,23 @@
width: 16px;
}
#contentBlockingTrackingProtectionCheckbox > .checkbox-label-box {
list-style-image: url("chrome://browser/skin/controlcenter/trackers.svg");
}
#contentBlockingTrackingProtectionCheckbox[checked] > .checkbox-label-box {
list-style-image: url("chrome://browser/skin/controlcenter/trackers-disabled.svg");
}
#contentBlockingBlockCookiesCheckbox > .checkbox-label-box {
list-style-image: url("chrome://browser/skin/controlcenter/3rdpartycookies.svg");
}
#contentBlockingBlockCookiesCheckbox[checked] > .checkbox-label-box {
list-style-image: url("chrome://browser/skin/controlcenter/3rdpartycookies-disabled.svg");
}
.content-blocking-icon,
.permission-icon {
-moz-context-properties: fill;
@ -50,44 +67,154 @@
/* Content Blocking */
#contentBlockingLearnMore {
margin-top: 4px !important;
/* Override styling that sets descriptions as grey */
#trackingGroup description.indent,
#trackingGroup .indent > description {
color: #000;
}
[data-subcategory="trackingprotection"] {
margin-top: 10px;
}
#contentBlockingCategories {
margin-top: 16px;
}
#trackingProtectionShield {
background-image: url("chrome://browser/skin/controlcenter/tracking-protection.svg");
-moz-context-properties: fill;
fill: #737373;
width: 64px;
height: 64px;
background-repeat: no-repeat;
background-size: contain;
margin-inline-end: 10px;
}
.content-blocking-category {
margin: 16px 0;
border-radius: 4px;
margin: 3px 0;
padding: 9px;
border: 1px solid #D7D7DB;
background-color: rgba(215, 215, 219, 0.2);
}
.content-blocking-category-labels {
padding-inline-start: 4px;
margin-inline-start: 25px !important;
.content-blocking-category.disabled {
opacity: 0.5;
}
#trackingProtectionMenu {
margin-top: 0.75em;
.content-blocking-category.disabled .radio-check {
opacity: 1;
}
#blockCookiesCBDeck[selectedIndex]:not([selectedIndex="0"]) {
max-width: 444px;
.content-blocking-warning > .indent,
.content-blocking-category > .indent {
margin-inline-end: 28px;
}
#blockCookiesCBDeck:not([selectedIndex]) > .warning-description,
#blockCookiesCBDeck[selectedIndex="0"] > .warning-description {
.arrowhead {
-moz-appearance: none;
border: none;
border-radius: 2px;
min-height: 20px;
min-width: 20px;
max-height: 20px;
max-width: 20px;
background-color: transparent;
background-image: url("chrome://global/skin/icons/arrow-dropdown-12.svg");
background-repeat: no-repeat;
background-position: center;
}
.arrowhead:not([disabled]):hover {
cursor: pointer;
background-color: var(--grey-90-a10);
}
.arrowhead:not([disabled]):hover:active {
background-color: var(--grey-90-a20);
}
.arrowhead.up {
background-image: url("chrome://global/skin/icons/arrow-up-12.svg");
}
.arrowhead > .button-box {
padding: 0 !important;
}
.content-blocking-category.expanded:not(.selected) .content-blocking-warning {
background-color: var(--grey-90-a10);
}
.content-blocking-category.selected .arrowhead {
display: none;
}
#blockCookiesCBDeck > .warning-description {
margin-bottom: 0.75em !important;
.content-blocking-category.selected {
border: 1px solid #45A1FF;
background-color: rgba(69, 161, 255, 0.2);
}
.content-blocking-warning-title,
.content-blocking-category .radio-label-box {
font-weight: bold;
}
.content-blocking-extra-information {
visibility: collapse;
}
.extra-information-label {
margin-top: 18px;
}
.extra-information-label:last-child {
margin-bottom: 18px;
}
.content-blocking-category.expanded .content-blocking-extra-information,
.content-blocking-category.selected .content-blocking-extra-information {
visibility: visible;
}
.content-blocking-extra-information > .custom-option {
margin: 10px 0;
}
.content-blocking-warning {
background-color: rgba(69, 161, 255, 0.2);
border-radius: 4px;
padding: 10px 0;
margin: 10px 0;
}
.content-blocking-trackers-image {
list-style-image: url("chrome://browser/skin/controlcenter/trackers-disabled.svg");
margin-inline-end: 5px;
}
.content-blocking-cookies-image {
list-style-image: url("chrome://browser/skin/controlcenter/3rdpartycookies-disabled.svg");
margin-inline-end: 5px;
}
.content-blocking-warning-image {
list-style-image: url("chrome://global/skin/icons/warning.svg");
-moz-context-properties: fill;
fill: currentColor;
margin-inline-end: 8px;
margin-inline-start: 4px;
}
#blockCookiesMenu,
#trackingProtectionMenu {
margin: 0;
}
#changeBlockListLink {
font-size: 90%;
/* In order to override the margins set in preferences.inc.css, we have to use !important. */
margin-top: 1em !important;
margin-inline-start: 56px;
}
.content-blocking-category-description {

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

@ -63,7 +63,6 @@ toolkit.jar:
skin/classic/global/icons/question-16.png (icons/question-16.png)
skin/classic/global/icons/question-64.png (icons/question-64.png)
skin/classic/global/icons/sslWarning.png (icons/sslWarning.png)
skin/classic/global/icons/arrow-up-12.svg (../../shared/icons/arrow-up-12.svg)
* skin/classic/global/in-content/common.css (in-content/common.css)
* skin/classic/global/in-content/info-pages.css (in-content/info-pages.css)
skin/classic/global/tree/columnpicker.gif (tree/columnpicker.gif)

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

@ -49,6 +49,7 @@ toolkit.jar:
skin/classic/global/icons/twisty-expanded.svg (../../shared/icons/twisty-expanded.svg)
skin/classic/global/icons/arrow-dropdown-12.svg (../../shared/icons/arrow-dropdown-12.svg)
skin/classic/global/icons/arrow-dropdown-16.svg (../../shared/icons/arrow-dropdown-16.svg)
skin/classic/global/icons/arrow-up-12.svg (../../shared/icons/arrow-up-12.svg)
skin/classic/global/icons/warning.svg (../../shared/icons/warning.svg)
skin/classic/global/illustrations/about-rights.svg (../../shared/illustrations/about-rights.svg)
skin/classic/global/icons/blocked.svg (../../shared/incontent-icons/blocked.svg)