tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 4b61512512f362895db9d670aa3d3712b214a69b
parent 7b4f02f92711c6de97bc6789914c15a40106c632
Author: Emma Zuehlcke <emz@mozilla.com>
Date:   Tue,  2 Dec 2025 11:20:37 +0000

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

Diffstat:
Abrowser/components/preferences/etp-advanced-banner.svg | 30++++++++++++++++++++++++++++++
Abrowser/components/preferences/etp-toggle-promo.svg | 5+++++
Mbrowser/components/preferences/jar.mn | 2++
Mbrowser/components/preferences/main.js | 81+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mbrowser/components/preferences/preferences.js | 5+++++
Mbrowser/components/preferences/privacy.js | 76+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Mbrowser/locales-preview/privacyPreferences.ftl | 22++++++++++++++++++++++
Mbrowser/themes/shared/preferences/preferences.css | 16++++++++++++++++
Mtoolkit/content/widgets/moz-promo/moz-promo.css | 3++-
9 files changed, 238 insertions(+), 2 deletions(-)

diff --git a/browser/components/preferences/etp-advanced-banner.svg b/browser/components/preferences/etp-advanced-banner.svg @@ -0,0 +1,29 @@ +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> +<svg xmlns="http://www.w3.org/2000/svg" data-name="Layer 1" viewBox="0 0 600 128"> + <defs> + <radialGradient id="c" cx="150.25" cy="182.29" r="1" fx="150.25" fy="182.29" + gradientTransform="matrix(0 212 212 0 -38346 -31789)" gradientUnits="userSpaceOnUse"> + <stop offset=".46" stop-color="#fff" stop-opacity="0" /> + <stop offset=".85" stop-color="#fff" stop-opacity=".02" /> + <stop offset="1" stop-color="#fff" stop-opacity=".15" /> + </radialGradient> + <radialGradient id="d" cx="150.43" cy="181.78" r="1" fx="150.43" fy="181.78" + gradientTransform="matrix(0 123 123 0 -22059 -18439)" gradientUnits="userSpaceOnUse"> + <stop offset=".46" stop-color="#fff" stop-opacity="0" /> + <stop offset=".85" stop-color="#fff" stop-opacity=".02" /> + <stop offset="1" stop-color="#fff" stop-opacity=".15" /> + </radialGradient> + <clipPath id="a"> + <path d="M0 0h600v128H0z" style="fill:none" /> + </clipPath> + </defs> + <g style="clip-path:url(#a)"> + <circle cx="300" cy="64" r="212" style="fill:url(#c)" /> + <circle cx="300" cy="64" r="123" style="fill:url(#d)" /> + <path + d="M300 100c-1.68 0-3.37-.42-4.89-1.21-7.76-4.09-14.88-10.71-20.04-18.62-2.56-3.92-4.35-8.64-5.34-14.05l-2.55-14.03a11.3 11.3 0 0 1 .9-6.85c1.01-2.13 2.66-3.88 4.71-5l22.02-11.91c1.59-.87 3.37-1.32 5.17-1.32 1.81 0 3.58.45 5.18 1.31l22.02 12.13c2.06 1.12 3.72 2.87 4.73 5.01s1.32 4.54.89 6.87l-2.54 13.84c-.98 5.38-2.78 10.08-5.32 13.99-5.16 7.92-12.28 14.53-20.05 18.64-1.51.8-3.19 1.22-4.89 1.22Zm-1.75-67.32-24.07 13.05-1.83 4.52 2.72 14.88c.85 4.68 2.38 8.73 4.53 12.03 4.66 7.15 11.06 13.11 18.02 16.78h4.78c6.97-3.68 13.37-9.65 18.03-16.8 2.15-3.29 3.67-7.32 4.52-11.97l2.72-14.92-2.2-4.52-23.67-13.04h-3.53Z" + style="fill:#fbfbfe" /> + </g> +</svg> +\ No newline at end of file diff --git a/browser/components/preferences/etp-toggle-promo.svg b/browser/components/preferences/etp-toggle-promo.svg @@ -0,0 +1,4 @@ +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> +<svg xmlns="http://www.w3.org/2000/svg" width="150" height="118" fill="none" viewBox="0 0 150 118"><g clip-path="url(#a)"><rect width="300.198" height="25" x="10" y="8" fill="#000" fill-opacity=".05" rx="3"/><rect width="21" height="21" x="12" y="10" fill="#000" fill-opacity=".12" rx="3"/><path fill="#5b5b66" d="M22.501 26.5a1.9 1.9 0 0 1-.93-.24c-1.23-.698-2.363-1.77-3.195-3.023-.428-.644-.728-1.432-.893-2.332l-.42-2.265a1.86 1.86 0 0 1 .953-1.988l3.548-1.927c.555-.3 1.222-.3 1.777 0l3.637 1.958c.72.39 1.103 1.192.953 1.994l-.413 2.228c-.165.9-.465 1.68-.892 2.325-.825 1.253-1.957 2.332-3.195 3.03a1.85 1.85 0 0 1-.93.24m-.045-10.875c-.12 0-.247.03-.36.09l-3.54 1.92a.75.75 0 0 0-.383.795l.42 2.265c.143.75.383 1.402.728 1.92.727 1.11 1.725 2.055 2.805 2.663a.76.76 0 0 0 .75 0c1.08-.608 2.077-1.56 2.813-2.67.345-.518.584-1.163.727-1.913l.412-2.235a.735.735 0 0 0-.382-.795l-3.638-1.95a.75.75 0 0 0-.352-.09M46.5 19.75V17.5c0-1.655-1.346-3-3-3s-3 1.345-3 3v2.25a1.5 1.5 0 0 0-1.5 1.5V25a1.5 1.5 0 0 0 1.5 1.5h6A1.5 1.5 0 0 0 48 25v-3.75a1.5 1.5 0 0 0-1.5-1.5m-5.062-2.25c0-1.138.924-2.062 2.062-2.062s2.063.924 2.063 2.062v2.25h-4.126zm5.624 7.613-.45.45h-6.224l-.45-.45v-3.976l.45-.45h6.224l.45.45z"/><rect width="78" height="12" x="60" y="14.5" fill="#15141a" fill-opacity=".69" opacity=".5" rx="6"/><g filter="url(#b)"><rect width="300.198" height="114" x="10" y="33" fill="#fff" rx="6"/><g fill="#15141a" clip-path="url(#c)"><path d="m25.75 51.264 4.1 4.1a.47.47 0 0 0 .662-.665l-3.7-3.7 3.7-3.699a.47.47 0 0 0-.664-.663l-4.098 4.098z"/><rect width="85.5" height="12" x="132.35" y="45" fill-opacity=".69" opacity=".5" rx="6"/></g><path fill="#cfcfd8" d="M16 66h288.198v.75H16z"/><rect width="24" height="12" x="22" y="75.75" fill="#0062fa" rx="6"/><circle cx="40" cy="81.75" r="4.5" fill="#fff"/><rect width="56.25" height="12" x="52" y="75.75" fill="#15141a" fill-opacity=".69" opacity=".5" rx="6"/><rect width="114" height="12" x="52" y="90.75" fill="#15141a" fill-opacity=".69" opacity=".25" rx="6"/></g></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h150v118H0z"/></clipPath><clipPath id="c"><path fill="#fff" d="M16 39h288.198v24H16z"/></clipPath><filter id="b" width="318.197" height="132" x="1" y="25.5" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/><feOffset dy="1.5"/><feGaussianBlur stdDeviation="4.5"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix values="0 0 0 0 0.227451 0 0 0 0 0.223529 0 0 0 0 0.266667 0 0 0 0.3 0"/><feBlend in2="BackgroundImageFix" result="effect1_dropShadow_18452_31243"/><feColorMatrix in="SourceAlpha" result="hardAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/><feOffset dy=".225"/><feGaussianBlur stdDeviation=".563"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix values="0 0 0 0 0.227451 0 0 0 0 0.223529 0 0 0 0 0.266667 0 0 0 0.15 0"/><feBlend in2="effect1_dropShadow_18452_31243" result="effect2_dropShadow_18452_31243"/><feBlend in="SourceGraphic" in2="effect2_dropShadow_18452_31243" result="shape"/></filter></defs></svg> +\ No newline at end of file diff --git a/browser/components/preferences/jar.mn b/browser/components/preferences/jar.mn @@ -23,6 +23,8 @@ browser.jar: content/browser/preferences/more-from-mozilla-qr-code-simple-cn.svg content/browser/preferences/web-appearance-dark.svg content/browser/preferences/web-appearance-light.svg + content/browser/preferences/etp-toggle-promo.svg + content/browser/preferences/etp-advanced-banner.svg content/browser/preferences/widgets/dialog-button.mjs (widgets/dialog-button/dialog-button.mjs) content/browser/preferences/widgets/placeholder-message.mjs (widgets/placeholder-message/placeholder-message.mjs) content/browser/preferences/widgets/placeholder-message.css (widgets/placeholder-message/placeholder-message.css) diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js @@ -2980,6 +2980,87 @@ SettingGroupManager.registerGroups({ }, ], }, + etpBanner: { + inProgress: true, + items: [ + { + id: "etpBannerEl", + control: "moz-card", + }, + ], + }, + etpAdvanced: { + inProgress: true, + headingLevel: 2, + l10nId: "preferences-etp-advanced-settings-group", + supportPage: "enhanced-tracking-protection", + items: [ + { + id: "contentBlockingCategory", + control: "moz-radio-group", + options: [ + { + id: "etpLevelStandard", + value: "standard", + l10nId: "preferences-etp-level-standard", + }, + { + id: "etpLevelStrict", + value: "strict", + l10nId: "preferences-etp-level-strict", + items: [ + { + id: "etpAllowListBaselineEnabled", + l10nId: "content-blocking-baseline-exceptions-3", + supportPage: "manage-enhanced-tracking-protection-exceptions", + control: "moz-checkbox", + items: [ + { + id: "etpAllowListConvenienceEnabled", + l10nId: "content-blocking-convenience-exceptions-3", + control: "moz-checkbox", + }, + ], + }, + ], + }, + { + id: "etpLevelCustom", + value: "custom", + l10nId: "preferences-etp-level-custom", + items: [ + { + id: "etpCustomizeButton", + l10nId: "preferences-etp-customize-button", + control: "moz-box-button", + }, + ], + }, + ], + }, + { + id: "rfpWarning", + control: "moz-message-bar", + l10nId: "preferences-etp-rfp-warning-message", + supportPage: "resist-fingerprinting", + }, + { + id: "etpLevelWarning", + control: "moz-promo", + l10nId: "preferences-etp-level-warning-message", + controlAttrs: { + ".imageAlignment": "end", + ".imageSrc": + "chrome://browser/content/preferences/etp-toggle-promo.svg", + }, + }, + { + id: "etpManageExceptionsButton", + l10nId: "preferences-etp-manage-exceptions-button", + control: "moz-box-button", + }, + ], + }, }); /** diff --git a/browser/components/preferences/preferences.js b/browser/components/preferences/preferences.js @@ -286,6 +286,11 @@ const CONFIG_PANES = Object.freeze({ l10nId: "preferences-profiles-group-header", groupIds: ["profilePane"], }, + etp: { + parent: "privacy", + l10nId: "preferences-etp-header", + groupIds: ["etpBanner", "etpAdvanced"], + }, }); var gLastCategory = { category: undefined, subcategory: undefined }; diff --git a/browser/components/preferences/privacy.js b/browser/components/preferences/privacy.js @@ -2832,13 +2832,85 @@ Preferences.addSetting({ Preferences.addSetting({ id: "etpStatusAdvancedButton", - // TODO: Bug 1971444 - Click action to switch to advanced subview. + onUserClick(e) { + e.preventDefault(); + gotoPref("etp"); + }, }); Preferences.addSetting({ id: "protectionsDashboardLink", }); +Preferences.addSetting({ + id: "etpBannerEl", +}); + +Preferences.addSetting({ + id: "etpAllowListBaselineEnabled", + pref: "privacy.trackingprotection.allow_list.baseline.enabled", + deps: ["contentBlockingCategory"], + visible({ contentBlockingCategory }) { + return contentBlockingCategory.value == "strict"; + }, +}); + +Preferences.addSetting({ + id: "etpAllowListConvenienceEnabled", + pref: "privacy.trackingprotection.allow_list.convenience.enabled", +}); + +Preferences.addSetting({ + id: "etpCustomizeButton", + onUserClick(e) { + e.preventDefault(); + gotoPref("etpCustomize"); + }, +}); + +Preferences.addSetting({ + id: "resistFingerprinting", + pref: "privacy.resistFingerprinting", +}); + +Preferences.addSetting({ + id: "resistFingerprintingPBM", + pref: "privacy.resistFingerprinting.pbmode", +}); + +Preferences.addSetting({ + id: "rfpWarning", + deps: ["resistFingerprinting", "resistFingerprintingPBM"], + visible({ resistFingerprinting, resistFingerprintingPBM }) { + return resistFingerprinting.value || resistFingerprintingPBM.value; + }, +}); + +Preferences.addSetting({ + id: "etpLevelWarning", + deps: ["contentBlockingCategory"], + visible({ contentBlockingCategory }) { + return contentBlockingCategory.value != "standard"; + }, +}); + +Preferences.addSetting({ + id: "etpManageExceptionsButton", + onUserClick() { + let params = { + permissionType: "trackingprotection", + disableETPVisible: true, + prefilledHost: "", + hideStatusColumn: true, + }; + gSubDialog.open( + "chrome://browser/content/preferences/dialogs/permissions.xhtml", + undefined, + params + ); + }, +}); + function setEventListener(aId, aEventType, aCallback) { document .getElementById(aId) @@ -3401,6 +3473,8 @@ var gPrivacyPane = { initSettingGroup("dnsOverHttps"); initSettingGroup("dnsOverHttpsAdvanced"); initSettingGroup("etpStatus"); + initSettingGroup("etpBanner"); + initSettingGroup("etpAdvanced"); /* Initialize Content Blocking */ this.initContentBlocking(); diff --git a/browser/locales-preview/privacyPreferences.ftl b/browser/locales-preview/privacyPreferences.ftl @@ -233,3 +233,25 @@ preferences-etp-status-advanced-button = preferences-etp-status-protections-dashboard-link = .label = View your personalized Protections Dashboard .description = See how many creepers { -brand-short-name } has blocked for you, including social media trackers, fingerprinters, and cryptominers. + +preferences-etp-header = + .heading = Enhanced Tracking Protection + .description = Aut voluptates deleniti ut. Aut et praesentium voluptas dolore nostrum occaecati. + +preferences-etp-advanced-settings-group = + .label = Advanced settings + .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. + +preferences-etp-customize-button = + .label = Customize + +preferences-etp-rfp-warning-message = + .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. + +preferences-etp-level-warning-message = + .heading = Heads up + .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. + +preferences-etp-manage-exceptions-button = + .label = Manage exceptions + .description = Manage websites where Enhanced Tracking Protection is disabled. diff --git a/browser/themes/shared/preferences/preferences.css b/browser/themes/shared/preferences/preferences.css @@ -1493,3 +1493,19 @@ setting-group[groupid="home"] { #browserContainersbox moz-message-bar { margin-block-start: 0; } + +#etpBannerEl { + border-radius: var(--border-radius-large); + background-clip: content-box; + background-image: + url("chrome://browser/content/preferences/etp-advanced-banner.svg"), + 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%); + background-repeat: no-repeat; + background-position: center; + background-size: cover; + height: 128px; +} + +#etpLevelWarning { + --promo-image-position: top; +} diff --git a/toolkit/content/widgets/moz-promo/moz-promo.css b/toolkit/content/widgets/moz-promo/moz-promo.css @@ -61,6 +61,7 @@ gap: var(--space-xsmall); min-height: 56px; align-items: center; + overflow: hidden; } .text-container { @@ -74,7 +75,7 @@ .image-container { background-image: var(--promo-image-url); background-size: cover; - background-position: center; + background-position: var(--promo-image-position, center); background-repeat: no-repeat; flex-basis: 25%; align-self: stretch;