Skip to content

Commit 4b61512

Browse files
committed
Bug 1971444 - Create ETP Advanced settings in config-based prefs. r=fluent-reviewers,desktop-theme-reviewers,hjones,bolsson
Differential Revision: https://phabricator.services.mozilla.com/D274001
1 parent 7b4f02f commit 4b61512

File tree

9 files changed

+236
-2
lines changed

9 files changed

+236
-2
lines changed
Lines changed: 29 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading

browser/components/preferences/jar.mn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ browser.jar:
2323
content/browser/preferences/more-from-mozilla-qr-code-simple-cn.svg
2424
content/browser/preferences/web-appearance-dark.svg
2525
content/browser/preferences/web-appearance-light.svg
26+
content/browser/preferences/etp-toggle-promo.svg
27+
content/browser/preferences/etp-advanced-banner.svg
2628
content/browser/preferences/widgets/dialog-button.mjs (widgets/dialog-button/dialog-button.mjs)
2729
content/browser/preferences/widgets/placeholder-message.mjs (widgets/placeholder-message/placeholder-message.mjs)
2830
content/browser/preferences/widgets/placeholder-message.css (widgets/placeholder-message/placeholder-message.css)

browser/components/preferences/main.js

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2980,6 +2980,87 @@ SettingGroupManager.registerGroups({
29802980
},
29812981
],
29822982
},
2983+
etpBanner: {
2984+
inProgress: true,
2985+
items: [
2986+
{
2987+
id: "etpBannerEl",
2988+
control: "moz-card",
2989+
},
2990+
],
2991+
},
2992+
etpAdvanced: {
2993+
inProgress: true,
2994+
headingLevel: 2,
2995+
l10nId: "preferences-etp-advanced-settings-group",
2996+
supportPage: "enhanced-tracking-protection",
2997+
items: [
2998+
{
2999+
id: "contentBlockingCategory",
3000+
control: "moz-radio-group",
3001+
options: [
3002+
{
3003+
id: "etpLevelStandard",
3004+
value: "standard",
3005+
l10nId: "preferences-etp-level-standard",
3006+
},
3007+
{
3008+
id: "etpLevelStrict",
3009+
value: "strict",
3010+
l10nId: "preferences-etp-level-strict",
3011+
items: [
3012+
{
3013+
id: "etpAllowListBaselineEnabled",
3014+
l10nId: "content-blocking-baseline-exceptions-3",
3015+
supportPage: "manage-enhanced-tracking-protection-exceptions",
3016+
control: "moz-checkbox",
3017+
items: [
3018+
{
3019+
id: "etpAllowListConvenienceEnabled",
3020+
l10nId: "content-blocking-convenience-exceptions-3",
3021+
control: "moz-checkbox",
3022+
},
3023+
],
3024+
},
3025+
],
3026+
},
3027+
{
3028+
id: "etpLevelCustom",
3029+
value: "custom",
3030+
l10nId: "preferences-etp-level-custom",
3031+
items: [
3032+
{
3033+
id: "etpCustomizeButton",
3034+
l10nId: "preferences-etp-customize-button",
3035+
control: "moz-box-button",
3036+
},
3037+
],
3038+
},
3039+
],
3040+
},
3041+
{
3042+
id: "rfpWarning",
3043+
control: "moz-message-bar",
3044+
l10nId: "preferences-etp-rfp-warning-message",
3045+
supportPage: "resist-fingerprinting",
3046+
},
3047+
{
3048+
id: "etpLevelWarning",
3049+
control: "moz-promo",
3050+
l10nId: "preferences-etp-level-warning-message",
3051+
controlAttrs: {
3052+
".imageAlignment": "end",
3053+
".imageSrc":
3054+
"chrome://browser/content/preferences/etp-toggle-promo.svg",
3055+
},
3056+
},
3057+
{
3058+
id: "etpManageExceptionsButton",
3059+
l10nId: "preferences-etp-manage-exceptions-button",
3060+
control: "moz-box-button",
3061+
},
3062+
],
3063+
},
29833064
});
29843065

29853066
/**

browser/components/preferences/preferences.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ const CONFIG_PANES = Object.freeze({
286286
l10nId: "preferences-profiles-group-header",
287287
groupIds: ["profilePane"],
288288
},
289+
etp: {
290+
parent: "privacy",
291+
l10nId: "preferences-etp-header",
292+
groupIds: ["etpBanner", "etpAdvanced"],
293+
},
289294
});
290295

291296
var gLastCategory = { category: undefined, subcategory: undefined };

browser/components/preferences/privacy.js

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2832,13 +2832,85 @@ Preferences.addSetting({
28322832

28332833
Preferences.addSetting({
28342834
id: "etpStatusAdvancedButton",
2835-
// TODO: Bug 1971444 - Click action to switch to advanced subview.
2835+
onUserClick(e) {
2836+
e.preventDefault();
2837+
gotoPref("etp");
2838+
},
28362839
});
28372840

28382841
Preferences.addSetting({
28392842
id: "protectionsDashboardLink",
28402843
});
28412844

2845+
Preferences.addSetting({
2846+
id: "etpBannerEl",
2847+
});
2848+
2849+
Preferences.addSetting({
2850+
id: "etpAllowListBaselineEnabled",
2851+
pref: "privacy.trackingprotection.allow_list.baseline.enabled",
2852+
deps: ["contentBlockingCategory"],
2853+
visible({ contentBlockingCategory }) {
2854+
return contentBlockingCategory.value == "strict";
2855+
},
2856+
});
2857+
2858+
Preferences.addSetting({
2859+
id: "etpAllowListConvenienceEnabled",
2860+
pref: "privacy.trackingprotection.allow_list.convenience.enabled",
2861+
});
2862+
2863+
Preferences.addSetting({
2864+
id: "etpCustomizeButton",
2865+
onUserClick(e) {
2866+
e.preventDefault();
2867+
gotoPref("etpCustomize");
2868+
},
2869+
});
2870+
2871+
Preferences.addSetting({
2872+
id: "resistFingerprinting",
2873+
pref: "privacy.resistFingerprinting",
2874+
});
2875+
2876+
Preferences.addSetting({
2877+
id: "resistFingerprintingPBM",
2878+
pref: "privacy.resistFingerprinting.pbmode",
2879+
});
2880+
2881+
Preferences.addSetting({
2882+
id: "rfpWarning",
2883+
deps: ["resistFingerprinting", "resistFingerprintingPBM"],
2884+
visible({ resistFingerprinting, resistFingerprintingPBM }) {
2885+
return resistFingerprinting.value || resistFingerprintingPBM.value;
2886+
},
2887+
});
2888+
2889+
Preferences.addSetting({
2890+
id: "etpLevelWarning",
2891+
deps: ["contentBlockingCategory"],
2892+
visible({ contentBlockingCategory }) {
2893+
return contentBlockingCategory.value != "standard";
2894+
},
2895+
});
2896+
2897+
Preferences.addSetting({
2898+
id: "etpManageExceptionsButton",
2899+
onUserClick() {
2900+
let params = {
2901+
permissionType: "trackingprotection",
2902+
disableETPVisible: true,
2903+
prefilledHost: "",
2904+
hideStatusColumn: true,
2905+
};
2906+
gSubDialog.open(
2907+
"chrome://browser/content/preferences/dialogs/permissions.xhtml",
2908+
undefined,
2909+
params
2910+
);
2911+
},
2912+
});
2913+
28422914
function setEventListener(aId, aEventType, aCallback) {
28432915
document
28442916
.getElementById(aId)
@@ -3401,6 +3473,8 @@ var gPrivacyPane = {
34013473
initSettingGroup("dnsOverHttps");
34023474
initSettingGroup("dnsOverHttpsAdvanced");
34033475
initSettingGroup("etpStatus");
3476+
initSettingGroup("etpBanner");
3477+
initSettingGroup("etpAdvanced");
34043478

34053479
/* Initialize Content Blocking */
34063480
this.initContentBlocking();

browser/locales-preview/privacyPreferences.ftl

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,25 @@ preferences-etp-status-advanced-button =
233233
preferences-etp-status-protections-dashboard-link =
234234
.label = View your personalized Protections Dashboard
235235
.description = See how many creepers { -brand-short-name } has blocked for you, including social media trackers, fingerprinters, and cryptominers.
236+
237+
preferences-etp-header =
238+
.heading = Enhanced Tracking Protection
239+
.description = Aut voluptates deleniti ut. Aut et praesentium voluptas dolore nostrum occaecati.
240+
241+
preferences-etp-advanced-settings-group =
242+
.label = Advanced settings
243+
.description = Trackers follow you around online to collect information about your browsing habits and interests. { -brand-short-name } blocks many of these trackers and other malicious scripts.
244+
245+
preferences-etp-customize-button =
246+
.label = Customize
247+
248+
preferences-etp-rfp-warning-message =
249+
.message = You’re using Resist Fingerprinting (RFP), which replaces some of { -brand-short-name }’s fingerprinting protection settings. This might cause some sites to break.
250+
251+
preferences-etp-level-warning-message =
252+
.heading = Heads up
253+
.message = Your settings may cause some websites to not display content or work correctly. If a site seems broken, you may want to turn off tracking protection for that site to load all content.
254+
255+
preferences-etp-manage-exceptions-button =
256+
.label = Manage exceptions
257+
.description = Manage websites where Enhanced Tracking Protection is disabled.

browser/themes/shared/preferences/preferences.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,3 +1493,19 @@ setting-group[groupid="home"] {
14931493
#browserContainersbox moz-message-bar {
14941494
margin-block-start: 0;
14951495
}
1496+
1497+
#etpBannerEl {
1498+
border-radius: var(--border-radius-large);
1499+
background-clip: content-box;
1500+
background-image:
1501+
url("chrome://browser/content/preferences/etp-advanced-banner.svg"),
1502+
radial-gradient(94.12% 34.67% at 50% 50%, rgba(159, 116, 255, 0.5) 0%, rgba(159, 116, 255, 0) 100%), linear-gradient(135deg, #592acb 0%, #ab43e7 100%);
1503+
background-repeat: no-repeat;
1504+
background-position: center;
1505+
background-size: cover;
1506+
height: 128px;
1507+
}
1508+
1509+
#etpLevelWarning {
1510+
--promo-image-position: top;
1511+
}

toolkit/content/widgets/moz-promo/moz-promo.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
gap: var(--space-xsmall);
6262
min-height: 56px;
6363
align-items: center;
64+
overflow: hidden;
6465
}
6566

6667
.text-container {
@@ -74,7 +75,7 @@
7475
.image-container {
7576
background-image: var(--promo-image-url);
7677
background-size: cover;
77-
background-position: center;
78+
background-position: var(--promo-image-position, center);
7879
background-repeat: no-repeat;
7980
flex-basis: 25%;
8081
align-self: stretch;

0 commit comments

Comments
 (0)