lists.torproject.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

tbb-commits

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2015 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2014 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
tbb-commits@lists.torproject.org

March 2024

  • 1 participants
  • 178 discussions
[Git][tpo/applications/tor-browser][base-browser-115.9.0esr-13.5-1] 2 commits: fixup! Base Browser strings
by ma1 (@ma1) 21 Mar '24

21 Mar '24
ma1 pushed to branch base-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: 0cd97c5f by hackademix at 2024-03-21T14:57:32+01:00 fixup! Base Browser strings Bug 41916: Letterboxing preferences UI - - - - - d3f79d43 by hackademix at 2024-03-21T14:57:49+01:00 Bug 41916: Letterboxing preferences UI - - - - - 12 changed files: - browser/components/preferences/jar.mn - + browser/components/preferences/letterboxing-middle-dark.svg - + browser/components/preferences/letterboxing-middle-light.svg - + browser/components/preferences/letterboxing-top-dark.svg - + browser/components/preferences/letterboxing-top-light.svg - + browser/components/preferences/letterboxing.css - + browser/components/preferences/letterboxing.inc.xhtml - + browser/components/preferences/letterboxing.js - browser/components/preferences/main.inc.xhtml - browser/components/preferences/main.js - browser/components/preferences/preferences.xhtml - browser/locales/en-US/browser/base-browser.ftl Changes: ===================================== browser/components/preferences/jar.mn ===================================== @@ -22,3 +22,10 @@ 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/letterboxing.js + content/browser/preferences/letterboxing.css + content/browser/preferences/letterboxing-middle-dark.svg + content/browser/preferences/letterboxing-middle-light.svg + content/browser/preferences/letterboxing-top-dark.svg + content/browser/preferences/letterboxing-top-light.svg ===================================== browser/components/preferences/letterboxing-middle-dark.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_2272_529)"> +<g clip-path="url(#clip0_2272_529)"> +<path d="M58 3H4V45H58V3Z" fill="#42414D"/> +<path d="M58 3H4V14H58V3Z" fill="#42414D"/> +<path d="M58 3H4V8H58V3Z" fill="#2B2A33"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="white"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="white"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="white"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="white"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="white"/> +<path d="M58 14H4V45H58V14Z" fill="#5B5B66"/> +<rect x="8" y="18" width="46" height="23" rx="2" fill="#3A3944"/> +<path d="M38 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H38C38.5523 24 39 23.5523 39 23C39 22.4477 38.5523 22 38 22Z" fill="white"/> +<path d="M27 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H27C27.5523 28 28 27.5523 28 27C28 26.4477 27.5523 26 27 26Z" fill="white"/> +<path d="M42 30H13C12.4477 30 12 30.4477 12 31C12 31.5523 12.4477 32 13 32H42C42.5523 32 43 31.5523 43 31C43 30.4477 42.5523 30 42 30Z" fill="white"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="1.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_2272_529" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2272_529"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2272_529" result="shape"/> +</filter> +<clipPath id="clip0_2272_529"> +<rect x="4" y="3" width="54" height="42" rx="2" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing-middle-light.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_202_960)"> +<g clip-path="url(#clip0_202_960)"> +<path d="M58 3H4V45H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V14H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V8H58V3Z" fill="#E0E0E6"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="#52525E"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="#52525E"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="#52525E"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="#52525E"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="#52525E"/> +<path d="M58 14H4V45H58V14Z" fill="#CFCFD8"/> +<rect x="8" y="18" width="46" height="23" rx="2" fill="white"/> +<path d="M38 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H38C38.5523 24 39 23.5523 39 23C39 22.4477 38.5523 22 38 22Z" fill="#52525E"/> +<path d="M27 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H27C27.5523 28 28 27.5523 28 27C28 26.4477 27.5523 26 27 26Z" fill="#52525E"/> +<path d="M42 30H13C12.4477 30 12 30.4477 12 31C12 31.5523 12.4477 32 13 32H42C42.5523 32 43 31.5523 43 31C43 30.4477 42.5523 30 42 30Z" fill="#52525E"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="1.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_202_960" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_202_960"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_202_960" result="shape"/> +</filter> +<clipPath id="clip0_202_960"> +<rect x="4" y="3" width="54" height="42" rx="2" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing-top-dark.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_2272_508)"> +<g clip-path="url(#clip0_2272_508)"> +<path d="M58 3H4V45H58V3Z" fill="#52525E"/> +<path d="M58 3H4V14H58V3Z" fill="#42414D"/> +<path d="M58 3H4V8H58V3Z" fill="#2B2A33"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="white"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="white"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="white"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="white"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="white"/> +<path d="M58 14H4V45H58V14Z" fill="#5B5B66"/> +<path d="M8 14H55V39C55 40.1046 54.1046 41 53 41H10C8.89543 41 8 40.1046 8 39V14Z" fill="#3A3944"/> +<path d="M38 18H13C12.4477 18 12 18.4477 12 19C12 19.5523 12.4477 20 13 20H38C38.5523 20 39 19.5523 39 19C39 18.4477 38.5523 18 38 18Z" fill="white"/> +<path d="M27 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H27C27.5523 24 28 23.5523 28 23C28 22.4477 27.5523 22 27 22Z" fill="white"/> +<path d="M42 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H42C42.5523 28 43 27.5523 43 27C43 26.4477 42.5523 26 42 26Z" fill="white"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="3.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_2272_508" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2272_508"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2272_508" result="shape"/> +</filter> +<clipPath id="clip0_2272_508"> +<rect x="4" y="3" width="54" height="42" rx="4" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing-top-light.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_202_926)"> +<g clip-path="url(#clip0_202_926)"> +<path d="M58 3H4V45H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V14H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V8H58V3Z" fill="#E0E0E6"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="#52525E"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="#52525E"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="#52525E"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="#52525E"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="#52525E"/> +<path d="M58 14H4V45H58V14Z" fill="#CFCFD8"/> +<path d="M8 14H55V39C55 40.1046 54.1046 41 53 41H10C8.89543 41 8 40.1046 8 39V14Z" fill="white"/> +<path d="M38 18H13C12.4477 18 12 18.4477 12 19C12 19.5523 12.4477 20 13 20H38C38.5523 20 39 19.5523 39 19C39 18.4477 38.5523 18 38 18Z" fill="#52525E"/> +<path d="M27 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H27C27.5523 24 28 23.5523 28 23C28 22.4477 27.5523 22 27 22Z" fill="#52525E"/> +<path d="M42 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H42C42.5523 28 43 27.5523 43 27C43 26.4477 42.5523 26 42 26Z" fill="#52525E"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="3.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_202_926" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_202_926"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_202_926" result="shape"/> +</filter> +<clipPath id="clip0_202_926"> +<rect x="4" y="3" width="54" height="42" rx="4" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing.css ===================================== @@ -0,0 +1,72 @@ +.letterboxing-overview { + margin-block-end: 32px; +} + +.letterboxing-search-overview { + margin-block-end: 16px; +} +#letterboxingAligner { + display: flex; + justify-content: start; + gap: 16px; + margin-block: 12px; + + --letterboxing-alignment-img-top: url("chrome://browser/content/preferences/letterboxing-top-light.svg"); + --letterboxing-alignment-img-middle: url("chrome://browser/content/preferences/letterboxing-middle-light.svg"); +} + +@media (prefers-color-scheme: dark) { + #letterboxingAligner { + --letterboxing-alignment-img-top: url("chrome://browser/content/preferences/letterboxing-top-dark.svg"); + --letterboxing-alignment-img-middle: url("chrome://browser/content/preferences/letterboxing-middle-dark.svg"); + } +} + +#letterboxingAligner .letterboxing-align-top img { + content: var(--letterboxing-alignment-img-top); +} +#letterboxingAligner .letterboxing-align-middle img { + content: var(--letterboxing-alignment-img-middle); +} + +#letterboxingAligner label { + width: 200px; + flex: 0 0 auto; +} + +#letterboxingAligner img { + border: none; + box-shadow: none; +} + +/* Hide letterboxing options depending on whether ResistFingerprinting or + * Letterboxing is enabled. */ +#letterboxingCategory:not(.rfp-enabled), +#letterboxingCategory:not(.rfp-enabled) ~ #letterboxingDisabled, +#letterboxingCategory.letterboxing-enabled ~ #letterboxingDisabled, +#letterboxingCategory:not(.rfp-enabled.letterboxing-enabled) ~ .letterboxing-category { + display: none; +} + +/* We duplicate the Letterboxing overview to appear in search results. + * We want to hide them whenever they are *not* part of a search result. */ +:is( + /* Hide the duplicates when the category is *not* hidden. */ + #letterboxingCategory:not(.visually-hidden) ~ .letterboxing-category, + /* Also hide the duplicated overview for subsequence search results if a + * previous groupbox is *not* hidden. */ + .letterboxing-category:not(.visually-hidden) ~ .letterboxing-category, +) .letterboxing-search-overview { + display: none; +} + +/* Similarly for #letterboxingDisabled, but we also want to hide its + * "Letterboxing" heading. + * NOTE: This should only appear in isolation, so we do not need to worry about + * subsequent groupboxes. */ +#letterboxingCategory:not(.visually-hidden) ~ #letterboxingDisabled :is( + .letterboxing-search-heading, + .letterboxing-search-overview +) { + display: none; +} ===================================== browser/components/preferences/letterboxing.inc.xhtml ===================================== @@ -0,0 +1,134 @@ +<script src="chrome://browser/content/preferences/letterboxing.js" /> +<vbox + id="letterboxingCategory" + class="subcategory" + hidden="true" + data-category="paneGeneral" +> + <html:h1 data-l10n-id="letterboxing-header" /> + <description class="letterboxing-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> +</vbox> +<groupbox + class="letterboxing-category" + data-category="paneGeneral" + hidden="true" +> + <label><html:h2 + data-l10n-id="letterboxing-window-size-header"/></label> + <description class="letterboxing-search-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> + <checkbox + id="letterboxingRememberSize" + data-l10n-id="letterboxing-remember-size" + preference="privacy.resistFingerprinting.letterboxing.rememberSize" + /> +</groupbox> +<groupbox + class="letterboxing-category" + data-category="paneGeneral" + hidden="true" +> + <label><html:h2 + data-l10n-id="letterboxing-alignment-header" + /></label> + <description class="letterboxing-search-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> + <description + id="letterboxingAlignmentDesc" + flex="1" + data-l10n-id="letterboxing-alignment-description" + /> + <form + xmlns="http://www.w3.org/1999/xhtml" + id="letterboxingAligner" + autocomplete="off" + aria-labelledby="letterboxingAlignmentDesc" + > + <label class="web-appearance-choice letterboxing-align-top"> + <div class="web-appearance-choice-image-container"> + <img role="presentation" /> + </div> + <div class="web-appearance-choice-footer"> + <input type="radio" name="alignment" value="top" /> + <span data-l10n-id="letterboxing-alignment-top"></span> + </div> + </label> + <label class="web-appearance-choice letterboxing-align-middle"> + <div class="web-appearance-choice-image-container"> + <img role="presentation" /> + </div> + <div class="web-appearance-choice-footer"> + <input type="radio" name="alignment" value="middle" /> + <span data-l10n-id="letterboxing-alignment-middle"></span> + </div> + </label> + </form> +</groupbox> +<groupbox + id="letterboxingDisabled" + data-category="paneGeneral" + hidden="true" +> + <label class="letterboxing-search-heading"><html:h2 + data-l10n-id="letterboxing-header"/></label> + <description class="letterboxing-search-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> + <hbox align="center"> + <label + class="face-sad" + flex="1" + data-l10n-id="letterboxing-disabled-description" + /> + <button + id="letterboxingEnableButton" + class="accessory-button" + is="highlightable-button" + data-l10n-id="letterboxing-enable-button" + /> + </hbox> +</groupbox> ===================================== browser/components/preferences/letterboxing.js ===================================== @@ -0,0 +1,113 @@ +/* import-globals-from /browser/components/preferences/preferences.js */ +/* import-globals-from /browser/components/preferences/findInPage.js */ +/* import-globals-from /toolkit/content/preferencesBindings.js */ + +Preferences.addAll([ + { + id: "privacy.resistFingerprinting.letterboxing.rememberSize", + type: "bool", + }, +]); + +{ + const lbEnabledPref = "privacy.resistFingerprinting.letterboxing"; + const visibilityPrefs = ["privacy.resistFingerprinting", lbEnabledPref]; + const alignMiddlePref = "privacy.resistFingerprinting.letterboxing.vcenter"; + + const hideFromSearchIf = (mustHide, ...elements) => { + for (const element of elements) { + if (mustHide) { + element.setAttribute("data-hidden-from-search", "true"); + } else { + element.removeAttribute("data-hidden-from-search"); + } + } + }; + + const syncVisibility = () => { + const [rfpEnabled, letterboxingEnabled] = visibilityPrefs.map(pref => + Services.prefs.getBoolPref(pref, false) + ); + const categoryElement = document.getElementById("letterboxingCategory"); + const { classList } = categoryElement; + + // Show the letterboxing section only if resistFingerprinting is enabled + classList.toggle("rfp-enabled", rfpEnabled); + classList.toggle("letterboxing-enabled", letterboxingEnabled); + + // To ensure the hidden parts do not contribute to search results, we need + // to add "data-hidden-from-search". + hideFromSearchIf( + !rfpEnabled || !letterboxingEnabled, + ...document.querySelectorAll(".letterboxing-category") + ); + hideFromSearchIf( + !rfpEnabled || letterboxingEnabled, + document.getElementById("letterboxingDisabled") + ); + }; + + const onVisibilityPrefChange = () => { + syncVisibility(); + // NOTE: Firefox does not expect "data-hidden-from-search" to change + // dynamically after page initialization. So we need to manually recall the + // methods that use "data-hidden-from-search". I.e. the "search" method, + // using the currently shown category. + // NOTE: We skip this if we are just initializing on page load. + // NOTE: data-hidden-from-search is also used when the user has entered a + // search term. We do not update the results in this case. Instead, it will + // update when the search term changes or is cleared. + if (!gSearchResultsPane.query) { + search(gLastCategory.category, "data-category"); + } + }; + + const alignerId = "letterboxingAligner"; + const syncAligner = () => { + const value = Services.prefs.getBoolPref(alignMiddlePref) + ? "middle" + : "top"; + document.querySelector( + `#${alignerId} input[value="${value}"]` + ).checked = true; + }; + + var gLetterboxingPrefs = { + init() { + syncVisibility(); + document + .getElementById("letterboxingEnableButton") + .addEventListener("command", () => { + Services.prefs.setBoolPref(lbEnabledPref, true); + // Button should have focus when activated but will be hidden now, + // so re-assign focus to the newly revealed options. + Services.focus.moveFocus( + window, + document.querySelector(".letterboxing-category"), + Services.focus.MOVEFOCUS_FIRST, + 0 + ); + }); + for (const pref of visibilityPrefs) { + Services.prefs.addObserver(pref, onVisibilityPrefChange); + } + + syncAligner(); + document.getElementById(alignerId).addEventListener("change", e => { + // NOTE: the "change" event is only fired on the checked input. + Services.prefs.setBoolPref( + alignMiddlePref, + e.target.value === "middle" + ); + }); + Services.prefs.addObserver(alignMiddlePref, syncAligner); + }, + + destroy() { + for (const pref of visibilityPrefs) { + Services.prefs.removeObserver(pref, onVisibilityPrefChange); + } + Services.prefs.removeObserver(alignMiddlePref, syncAligner); + }, + }; +} ===================================== browser/components/preferences/main.inc.xhtml ===================================== @@ -130,6 +130,9 @@ </vbox> </groupbox> +<!-- Letterboxing --> +#include ./letterboxing.inc.xhtml + <hbox id="languageAndAppearanceCategory" class="subcategory" hidden="true" ===================================== browser/components/preferences/main.js ===================================== @@ -736,6 +736,7 @@ var gMainPane = { ]); AppearanceChooser.init(); + gLetterboxingPrefs.init(); // Notify observers that the UI is now ready Services.obs.notifyObservers(window, "main-pane-loaded"); @@ -2591,6 +2592,7 @@ var gMainPane = { Services.prefs.removeObserver(PREF_CONTAINERS_EXTENSION, this); Services.obs.removeObserver(this, AUTO_UPDATE_CHANGED_TOPIC); Services.obs.removeObserver(this, BACKGROUND_UPDATE_CHANGED_TOPIC); + gLetterboxingPrefs.destroy(); AppearanceChooser.destroy(); }, ===================================== browser/components/preferences/preferences.xhtml ===================================== @@ -12,6 +12,7 @@ <?xml-stylesheet href="chrome://browser/skin/preferences/search.css"?> <?xml-stylesheet href="chrome://browser/skin/preferences/containers.css"?> <?xml-stylesheet href="chrome://browser/skin/preferences/privacy.css"?> +<?xml-stylesheet href="chrome://browser/content/preferences/letterboxing.css"?> <?xml-stylesheet href="chrome://browser/content/securitylevel/securityLevelPreferences.css"?> <!DOCTYPE html> @@ -40,6 +41,7 @@ <!-- Links below are only used for search-l10n-ids into subdialogs --> <link rel="localization" href="browser/aboutDialog.ftl"/> + <link rel="localization" href="browser/base-browser.ftl"/> <link rel="localization" href="browser/preferences/addEngine.ftl"/> <link rel="localization" href="browser/preferences/blocklists.ftl"/> <link rel="localization" href="browser/preferences/clearSiteData.ftl"/> ===================================== browser/locales/en-US/browser/base-browser.ftl ===================================== @@ -70,3 +70,27 @@ new-identity-dialog-confirm = new-identity-blocked-home-notification = { -brand-short-name } blocked your homepage ({ $url }) from loading because it might recognize your previous session. # Button to continue loading the home page, despite the warning message. new-identity-blocked-home-ignore-button = Load it anyway +## Preferences - Letterboxing. + +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-header = Letterboxing +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-overview = { -brand-short-name }'s Letterboxing feature restricts websites to display at specific sizes, making it harder to single out users on the basis of their window or screen size. +letterboxing-learn-more = Learn more +letterboxing-window-size-header = Window size +letterboxing-remember-size = + .label = Reuse last window size when opening a new window + .accesskey = R +letterboxing-alignment-header = Content Alignment +letterboxing-alignment-description = Choose where you want to align the website’s content. +letterboxing-alignment-top = Top +letterboxing-alignment-middle = Middle +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-disabled-description = Letterboxing is currently disabled. +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-enable-button = + .label = Enable Letterboxing View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/d873c0… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/d873c0… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.9.0esr-13.5-1] 2 commits: fixup! Base Browser strings
by ma1 (@ma1) 21 Mar '24

21 Mar '24
ma1 pushed to branch tor-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: 106d93c8 by hackademix at 2024-03-21T14:52:16+01:00 fixup! Base Browser strings Bug 41916: Letterboxing preferences UI - - - - - f7adb137 by hackademix at 2024-03-21T14:52:17+01:00 Bug 41916: Letterboxing preferences UI - - - - - 12 changed files: - browser/components/preferences/jar.mn - + browser/components/preferences/letterboxing-middle-dark.svg - + browser/components/preferences/letterboxing-middle-light.svg - + browser/components/preferences/letterboxing-top-dark.svg - + browser/components/preferences/letterboxing-top-light.svg - + browser/components/preferences/letterboxing.css - + browser/components/preferences/letterboxing.inc.xhtml - + browser/components/preferences/letterboxing.js - browser/components/preferences/main.inc.xhtml - browser/components/preferences/main.js - browser/components/preferences/preferences.xhtml - browser/locales/en-US/browser/base-browser.ftl Changes: ===================================== browser/components/preferences/jar.mn ===================================== @@ -22,3 +22,10 @@ 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/letterboxing.js + content/browser/preferences/letterboxing.css + content/browser/preferences/letterboxing-middle-dark.svg + content/browser/preferences/letterboxing-middle-light.svg + content/browser/preferences/letterboxing-top-dark.svg + content/browser/preferences/letterboxing-top-light.svg ===================================== browser/components/preferences/letterboxing-middle-dark.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_2272_529)"> +<g clip-path="url(#clip0_2272_529)"> +<path d="M58 3H4V45H58V3Z" fill="#42414D"/> +<path d="M58 3H4V14H58V3Z" fill="#42414D"/> +<path d="M58 3H4V8H58V3Z" fill="#2B2A33"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="white"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="white"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="white"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="white"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="white"/> +<path d="M58 14H4V45H58V14Z" fill="#5B5B66"/> +<rect x="8" y="18" width="46" height="23" rx="2" fill="#3A3944"/> +<path d="M38 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H38C38.5523 24 39 23.5523 39 23C39 22.4477 38.5523 22 38 22Z" fill="white"/> +<path d="M27 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H27C27.5523 28 28 27.5523 28 27C28 26.4477 27.5523 26 27 26Z" fill="white"/> +<path d="M42 30H13C12.4477 30 12 30.4477 12 31C12 31.5523 12.4477 32 13 32H42C42.5523 32 43 31.5523 43 31C43 30.4477 42.5523 30 42 30Z" fill="white"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="1.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_2272_529" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2272_529"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2272_529" result="shape"/> +</filter> +<clipPath id="clip0_2272_529"> +<rect x="4" y="3" width="54" height="42" rx="2" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing-middle-light.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_202_960)"> +<g clip-path="url(#clip0_202_960)"> +<path d="M58 3H4V45H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V14H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V8H58V3Z" fill="#E0E0E6"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="#52525E"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="#52525E"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="#52525E"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="#52525E"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="#52525E"/> +<path d="M58 14H4V45H58V14Z" fill="#CFCFD8"/> +<rect x="8" y="18" width="46" height="23" rx="2" fill="white"/> +<path d="M38 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H38C38.5523 24 39 23.5523 39 23C39 22.4477 38.5523 22 38 22Z" fill="#52525E"/> +<path d="M27 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H27C27.5523 28 28 27.5523 28 27C28 26.4477 27.5523 26 27 26Z" fill="#52525E"/> +<path d="M42 30H13C12.4477 30 12 30.4477 12 31C12 31.5523 12.4477 32 13 32H42C42.5523 32 43 31.5523 43 31C43 30.4477 42.5523 30 42 30Z" fill="#52525E"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="1.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_202_960" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_202_960"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_202_960" result="shape"/> +</filter> +<clipPath id="clip0_202_960"> +<rect x="4" y="3" width="54" height="42" rx="2" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing-top-dark.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_2272_508)"> +<g clip-path="url(#clip0_2272_508)"> +<path d="M58 3H4V45H58V3Z" fill="#52525E"/> +<path d="M58 3H4V14H58V3Z" fill="#42414D"/> +<path d="M58 3H4V8H58V3Z" fill="#2B2A33"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="white"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="white"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="white"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="white"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="white"/> +<path d="M58 14H4V45H58V14Z" fill="#5B5B66"/> +<path d="M8 14H55V39C55 40.1046 54.1046 41 53 41H10C8.89543 41 8 40.1046 8 39V14Z" fill="#3A3944"/> +<path d="M38 18H13C12.4477 18 12 18.4477 12 19C12 19.5523 12.4477 20 13 20H38C38.5523 20 39 19.5523 39 19C39 18.4477 38.5523 18 38 18Z" fill="white"/> +<path d="M27 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H27C27.5523 24 28 23.5523 28 23C28 22.4477 27.5523 22 27 22Z" fill="white"/> +<path d="M42 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H42C42.5523 28 43 27.5523 43 27C43 26.4477 42.5523 26 42 26Z" fill="white"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="3.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_2272_508" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2272_508"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2272_508" result="shape"/> +</filter> +<clipPath id="clip0_2272_508"> +<rect x="4" y="3" width="54" height="42" rx="4" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing-top-light.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_202_926)"> +<g clip-path="url(#clip0_202_926)"> +<path d="M58 3H4V45H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V14H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V8H58V3Z" fill="#E0E0E6"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="#52525E"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="#52525E"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="#52525E"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="#52525E"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="#52525E"/> +<path d="M58 14H4V45H58V14Z" fill="#CFCFD8"/> +<path d="M8 14H55V39C55 40.1046 54.1046 41 53 41H10C8.89543 41 8 40.1046 8 39V14Z" fill="white"/> +<path d="M38 18H13C12.4477 18 12 18.4477 12 19C12 19.5523 12.4477 20 13 20H38C38.5523 20 39 19.5523 39 19C39 18.4477 38.5523 18 38 18Z" fill="#52525E"/> +<path d="M27 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H27C27.5523 24 28 23.5523 28 23C28 22.4477 27.5523 22 27 22Z" fill="#52525E"/> +<path d="M42 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H42C42.5523 28 43 27.5523 43 27C43 26.4477 42.5523 26 42 26Z" fill="#52525E"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="3.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_202_926" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_202_926"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_202_926" result="shape"/> +</filter> +<clipPath id="clip0_202_926"> +<rect x="4" y="3" width="54" height="42" rx="4" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing.css ===================================== @@ -0,0 +1,72 @@ +.letterboxing-overview { + margin-block-end: 32px; +} + +.letterboxing-search-overview { + margin-block-end: 16px; +} +#letterboxingAligner { + display: flex; + justify-content: start; + gap: 16px; + margin-block: 12px; + + --letterboxing-alignment-img-top: url("chrome://browser/content/preferences/letterboxing-top-light.svg"); + --letterboxing-alignment-img-middle: url("chrome://browser/content/preferences/letterboxing-middle-light.svg"); +} + +@media (prefers-color-scheme: dark) { + #letterboxingAligner { + --letterboxing-alignment-img-top: url("chrome://browser/content/preferences/letterboxing-top-dark.svg"); + --letterboxing-alignment-img-middle: url("chrome://browser/content/preferences/letterboxing-middle-dark.svg"); + } +} + +#letterboxingAligner .letterboxing-align-top img { + content: var(--letterboxing-alignment-img-top); +} +#letterboxingAligner .letterboxing-align-middle img { + content: var(--letterboxing-alignment-img-middle); +} + +#letterboxingAligner label { + width: 200px; + flex: 0 0 auto; +} + +#letterboxingAligner img { + border: none; + box-shadow: none; +} + +/* Hide letterboxing options depending on whether ResistFingerprinting or + * Letterboxing is enabled. */ +#letterboxingCategory:not(.rfp-enabled), +#letterboxingCategory:not(.rfp-enabled) ~ #letterboxingDisabled, +#letterboxingCategory.letterboxing-enabled ~ #letterboxingDisabled, +#letterboxingCategory:not(.rfp-enabled.letterboxing-enabled) ~ .letterboxing-category { + display: none; +} + +/* We duplicate the Letterboxing overview to appear in search results. + * We want to hide them whenever they are *not* part of a search result. */ +:is( + /* Hide the duplicates when the category is *not* hidden. */ + #letterboxingCategory:not(.visually-hidden) ~ .letterboxing-category, + /* Also hide the duplicated overview for subsequence search results if a + * previous groupbox is *not* hidden. */ + .letterboxing-category:not(.visually-hidden) ~ .letterboxing-category, +) .letterboxing-search-overview { + display: none; +} + +/* Similarly for #letterboxingDisabled, but we also want to hide its + * "Letterboxing" heading. + * NOTE: This should only appear in isolation, so we do not need to worry about + * subsequent groupboxes. */ +#letterboxingCategory:not(.visually-hidden) ~ #letterboxingDisabled :is( + .letterboxing-search-heading, + .letterboxing-search-overview +) { + display: none; +} ===================================== browser/components/preferences/letterboxing.inc.xhtml ===================================== @@ -0,0 +1,134 @@ +<script src="chrome://browser/content/preferences/letterboxing.js" /> +<vbox + id="letterboxingCategory" + class="subcategory" + hidden="true" + data-category="paneGeneral" +> + <html:h1 data-l10n-id="letterboxing-header" /> + <description class="letterboxing-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> +</vbox> +<groupbox + class="letterboxing-category" + data-category="paneGeneral" + hidden="true" +> + <label><html:h2 + data-l10n-id="letterboxing-window-size-header"/></label> + <description class="letterboxing-search-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> + <checkbox + id="letterboxingRememberSize" + data-l10n-id="letterboxing-remember-size" + preference="privacy.resistFingerprinting.letterboxing.rememberSize" + /> +</groupbox> +<groupbox + class="letterboxing-category" + data-category="paneGeneral" + hidden="true" +> + <label><html:h2 + data-l10n-id="letterboxing-alignment-header" + /></label> + <description class="letterboxing-search-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> + <description + id="letterboxingAlignmentDesc" + flex="1" + data-l10n-id="letterboxing-alignment-description" + /> + <form + xmlns="http://www.w3.org/1999/xhtml" + id="letterboxingAligner" + autocomplete="off" + aria-labelledby="letterboxingAlignmentDesc" + > + <label class="web-appearance-choice letterboxing-align-top"> + <div class="web-appearance-choice-image-container"> + <img role="presentation" /> + </div> + <div class="web-appearance-choice-footer"> + <input type="radio" name="alignment" value="top" /> + <span data-l10n-id="letterboxing-alignment-top"></span> + </div> + </label> + <label class="web-appearance-choice letterboxing-align-middle"> + <div class="web-appearance-choice-image-container"> + <img role="presentation" /> + </div> + <div class="web-appearance-choice-footer"> + <input type="radio" name="alignment" value="middle" /> + <span data-l10n-id="letterboxing-alignment-middle"></span> + </div> + </label> + </form> +</groupbox> +<groupbox + id="letterboxingDisabled" + data-category="paneGeneral" + hidden="true" +> + <label class="letterboxing-search-heading"><html:h2 + data-l10n-id="letterboxing-header"/></label> + <description class="letterboxing-search-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> + <hbox align="center"> + <label + class="face-sad" + flex="1" + data-l10n-id="letterboxing-disabled-description" + /> + <button + id="letterboxingEnableButton" + class="accessory-button" + is="highlightable-button" + data-l10n-id="letterboxing-enable-button" + /> + </hbox> +</groupbox> ===================================== browser/components/preferences/letterboxing.js ===================================== @@ -0,0 +1,113 @@ +/* import-globals-from /browser/components/preferences/preferences.js */ +/* import-globals-from /browser/components/preferences/findInPage.js */ +/* import-globals-from /toolkit/content/preferencesBindings.js */ + +Preferences.addAll([ + { + id: "privacy.resistFingerprinting.letterboxing.rememberSize", + type: "bool", + }, +]); + +{ + const lbEnabledPref = "privacy.resistFingerprinting.letterboxing"; + const visibilityPrefs = ["privacy.resistFingerprinting", lbEnabledPref]; + const alignMiddlePref = "privacy.resistFingerprinting.letterboxing.vcenter"; + + const hideFromSearchIf = (mustHide, ...elements) => { + for (const element of elements) { + if (mustHide) { + element.setAttribute("data-hidden-from-search", "true"); + } else { + element.removeAttribute("data-hidden-from-search"); + } + } + }; + + const syncVisibility = () => { + const [rfpEnabled, letterboxingEnabled] = visibilityPrefs.map(pref => + Services.prefs.getBoolPref(pref, false) + ); + const categoryElement = document.getElementById("letterboxingCategory"); + const { classList } = categoryElement; + + // Show the letterboxing section only if resistFingerprinting is enabled + classList.toggle("rfp-enabled", rfpEnabled); + classList.toggle("letterboxing-enabled", letterboxingEnabled); + + // To ensure the hidden parts do not contribute to search results, we need + // to add "data-hidden-from-search". + hideFromSearchIf( + !rfpEnabled || !letterboxingEnabled, + ...document.querySelectorAll(".letterboxing-category") + ); + hideFromSearchIf( + !rfpEnabled || letterboxingEnabled, + document.getElementById("letterboxingDisabled") + ); + }; + + const onVisibilityPrefChange = () => { + syncVisibility(); + // NOTE: Firefox does not expect "data-hidden-from-search" to change + // dynamically after page initialization. So we need to manually recall the + // methods that use "data-hidden-from-search". I.e. the "search" method, + // using the currently shown category. + // NOTE: We skip this if we are just initializing on page load. + // NOTE: data-hidden-from-search is also used when the user has entered a + // search term. We do not update the results in this case. Instead, it will + // update when the search term changes or is cleared. + if (!gSearchResultsPane.query) { + search(gLastCategory.category, "data-category"); + } + }; + + const alignerId = "letterboxingAligner"; + const syncAligner = () => { + const value = Services.prefs.getBoolPref(alignMiddlePref) + ? "middle" + : "top"; + document.querySelector( + `#${alignerId} input[value="${value}"]` + ).checked = true; + }; + + var gLetterboxingPrefs = { + init() { + syncVisibility(); + document + .getElementById("letterboxingEnableButton") + .addEventListener("command", () => { + Services.prefs.setBoolPref(lbEnabledPref, true); + // Button should have focus when activated but will be hidden now, + // so re-assign focus to the newly revealed options. + Services.focus.moveFocus( + window, + document.querySelector(".letterboxing-category"), + Services.focus.MOVEFOCUS_FIRST, + 0 + ); + }); + for (const pref of visibilityPrefs) { + Services.prefs.addObserver(pref, onVisibilityPrefChange); + } + + syncAligner(); + document.getElementById(alignerId).addEventListener("change", e => { + // NOTE: the "change" event is only fired on the checked input. + Services.prefs.setBoolPref( + alignMiddlePref, + e.target.value === "middle" + ); + }); + Services.prefs.addObserver(alignMiddlePref, syncAligner); + }, + + destroy() { + for (const pref of visibilityPrefs) { + Services.prefs.removeObserver(pref, onVisibilityPrefChange); + } + Services.prefs.removeObserver(alignMiddlePref, syncAligner); + }, + }; +} ===================================== browser/components/preferences/main.inc.xhtml ===================================== @@ -130,6 +130,9 @@ </vbox> </groupbox> +<!-- Letterboxing --> +#include ./letterboxing.inc.xhtml + <hbox id="languageAndAppearanceCategory" class="subcategory" hidden="true" ===================================== browser/components/preferences/main.js ===================================== @@ -729,6 +729,7 @@ var gMainPane = { ]); AppearanceChooser.init(); + gLetterboxingPrefs.init(); // Notify observers that the UI is now ready Services.obs.notifyObservers(window, "main-pane-loaded"); @@ -2585,6 +2586,7 @@ var gMainPane = { Services.prefs.removeObserver(PREF_CONTAINERS_EXTENSION, this); Services.obs.removeObserver(this, AUTO_UPDATE_CHANGED_TOPIC); Services.obs.removeObserver(this, BACKGROUND_UPDATE_CHANGED_TOPIC); + gLetterboxingPrefs.destroy(); AppearanceChooser.destroy(); }, ===================================== browser/components/preferences/preferences.xhtml ===================================== @@ -12,6 +12,7 @@ <?xml-stylesheet href="chrome://browser/skin/preferences/search.css"?> <?xml-stylesheet href="chrome://browser/skin/preferences/containers.css"?> <?xml-stylesheet href="chrome://browser/skin/preferences/privacy.css"?> +<?xml-stylesheet href="chrome://browser/content/preferences/letterboxing.css"?> <?xml-stylesheet href="chrome://browser/content/securitylevel/securityLevelPreferences.css"?> <?xml-stylesheet href="chrome://browser/content/torpreferences/torPreferences.css"?> <?xml-stylesheet href="chrome://browser/content/onionservices/authPreferences.css"?> @@ -42,6 +43,7 @@ <!-- Links below are only used for search-l10n-ids into subdialogs --> <link rel="localization" href="browser/aboutDialog.ftl"/> + <link rel="localization" href="browser/base-browser.ftl"/> <link rel="localization" href="browser/preferences/addEngine.ftl"/> <link rel="localization" href="browser/preferences/blocklists.ftl"/> <link rel="localization" href="browser/preferences/clearSiteData.ftl"/> ===================================== browser/locales/en-US/browser/base-browser.ftl ===================================== @@ -70,3 +70,27 @@ new-identity-dialog-confirm = new-identity-blocked-home-notification = { -brand-short-name } blocked your homepage ({ $url }) from loading because it might recognize your previous session. # Button to continue loading the home page, despite the warning message. new-identity-blocked-home-ignore-button = Load it anyway +## Preferences - Letterboxing. + +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-header = Letterboxing +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-overview = { -brand-short-name }'s Letterboxing feature restricts websites to display at specific sizes, making it harder to single out users on the basis of their window or screen size. +letterboxing-learn-more = Learn more +letterboxing-window-size-header = Window size +letterboxing-remember-size = + .label = Reuse last window size when opening a new window + .accesskey = R +letterboxing-alignment-header = Content Alignment +letterboxing-alignment-description = Choose where you want to align the website’s content. +letterboxing-alignment-top = Top +letterboxing-alignment-middle = Middle +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-disabled-description = Letterboxing is currently disabled. +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-enable-button = + .label = Enable Letterboxing View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/96be79… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/96be79… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][base-browser-115.9.0esr-13.5-1] Bug 41916: Letterboxing preferences UI
by ma1 (@ma1) 21 Mar '24

21 Mar '24
ma1 pushed to branch base-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: d873c008 by hackademix at 2024-03-21T13:56:42+01:00 Bug 41916: Letterboxing preferences UI - - - - - 12 changed files: - browser/components/preferences/jar.mn - + browser/components/preferences/letterboxing-middle-dark.svg - + browser/components/preferences/letterboxing-middle-light.svg - + browser/components/preferences/letterboxing-top-dark.svg - + browser/components/preferences/letterboxing-top-light.svg - + browser/components/preferences/letterboxing.css - + browser/components/preferences/letterboxing.inc.xhtml - + browser/components/preferences/letterboxing.js - browser/components/preferences/main.inc.xhtml - browser/components/preferences/main.js - browser/components/preferences/preferences.xhtml - browser/locales/en-US/browser/base-browser.ftl Changes: ===================================== browser/components/preferences/jar.mn ===================================== @@ -22,3 +22,10 @@ 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/letterboxing.js + content/browser/preferences/letterboxing.css + content/browser/preferences/letterboxing-middle-dark.svg + content/browser/preferences/letterboxing-middle-light.svg + content/browser/preferences/letterboxing-top-dark.svg + content/browser/preferences/letterboxing-top-light.svg ===================================== browser/components/preferences/letterboxing-middle-dark.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_2272_529)"> +<g clip-path="url(#clip0_2272_529)"> +<path d="M58 3H4V45H58V3Z" fill="#42414D"/> +<path d="M58 3H4V14H58V3Z" fill="#42414D"/> +<path d="M58 3H4V8H58V3Z" fill="#2B2A33"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="white"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="white"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="white"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="white"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="white"/> +<path d="M58 14H4V45H58V14Z" fill="#5B5B66"/> +<rect x="8" y="18" width="46" height="23" rx="2" fill="#3A3944"/> +<path d="M38 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H38C38.5523 24 39 23.5523 39 23C39 22.4477 38.5523 22 38 22Z" fill="white"/> +<path d="M27 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H27C27.5523 28 28 27.5523 28 27C28 26.4477 27.5523 26 27 26Z" fill="white"/> +<path d="M42 30H13C12.4477 30 12 30.4477 12 31C12 31.5523 12.4477 32 13 32H42C42.5523 32 43 31.5523 43 31C43 30.4477 42.5523 30 42 30Z" fill="white"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="1.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_2272_529" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2272_529"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2272_529" result="shape"/> +</filter> +<clipPath id="clip0_2272_529"> +<rect x="4" y="3" width="54" height="42" rx="2" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing-middle-light.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_202_960)"> +<g clip-path="url(#clip0_202_960)"> +<path d="M58 3H4V45H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V14H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V8H58V3Z" fill="#E0E0E6"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="#52525E"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="#52525E"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="#52525E"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="#52525E"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="#52525E"/> +<path d="M58 14H4V45H58V14Z" fill="#CFCFD8"/> +<rect x="8" y="18" width="46" height="23" rx="2" fill="white"/> +<path d="M38 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H38C38.5523 24 39 23.5523 39 23C39 22.4477 38.5523 22 38 22Z" fill="#52525E"/> +<path d="M27 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H27C27.5523 28 28 27.5523 28 27C28 26.4477 27.5523 26 27 26Z" fill="#52525E"/> +<path d="M42 30H13C12.4477 30 12 30.4477 12 31C12 31.5523 12.4477 32 13 32H42C42.5523 32 43 31.5523 43 31C43 30.4477 42.5523 30 42 30Z" fill="#52525E"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="1.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_202_960" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_202_960"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_202_960" result="shape"/> +</filter> +<clipPath id="clip0_202_960"> +<rect x="4" y="3" width="54" height="42" rx="2" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing-top-dark.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_2272_508)"> +<g clip-path="url(#clip0_2272_508)"> +<path d="M58 3H4V45H58V3Z" fill="#52525E"/> +<path d="M58 3H4V14H58V3Z" fill="#42414D"/> +<path d="M58 3H4V8H58V3Z" fill="#2B2A33"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="white"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="white"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="white"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="white"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="white"/> +<path d="M58 14H4V45H58V14Z" fill="#5B5B66"/> +<path d="M8 14H55V39C55 40.1046 54.1046 41 53 41H10C8.89543 41 8 40.1046 8 39V14Z" fill="#3A3944"/> +<path d="M38 18H13C12.4477 18 12 18.4477 12 19C12 19.5523 12.4477 20 13 20H38C38.5523 20 39 19.5523 39 19C39 18.4477 38.5523 18 38 18Z" fill="white"/> +<path d="M27 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H27C27.5523 24 28 23.5523 28 23C28 22.4477 27.5523 22 27 22Z" fill="white"/> +<path d="M42 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H42C42.5523 28 43 27.5523 43 27C43 26.4477 42.5523 26 42 26Z" fill="white"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="3.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_2272_508" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2272_508"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2272_508" result="shape"/> +</filter> +<clipPath id="clip0_2272_508"> +<rect x="4" y="3" width="54" height="42" rx="4" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing-top-light.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_202_926)"> +<g clip-path="url(#clip0_202_926)"> +<path d="M58 3H4V45H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V14H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V8H58V3Z" fill="#E0E0E6"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="#52525E"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="#52525E"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="#52525E"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="#52525E"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="#52525E"/> +<path d="M58 14H4V45H58V14Z" fill="#CFCFD8"/> +<path d="M8 14H55V39C55 40.1046 54.1046 41 53 41H10C8.89543 41 8 40.1046 8 39V14Z" fill="white"/> +<path d="M38 18H13C12.4477 18 12 18.4477 12 19C12 19.5523 12.4477 20 13 20H38C38.5523 20 39 19.5523 39 19C39 18.4477 38.5523 18 38 18Z" fill="#52525E"/> +<path d="M27 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H27C27.5523 24 28 23.5523 28 23C28 22.4477 27.5523 22 27 22Z" fill="#52525E"/> +<path d="M42 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H42C42.5523 28 43 27.5523 43 27C43 26.4477 42.5523 26 42 26Z" fill="#52525E"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="3.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_202_926" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_202_926"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_202_926" result="shape"/> +</filter> +<clipPath id="clip0_202_926"> +<rect x="4" y="3" width="54" height="42" rx="4" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing.css ===================================== @@ -0,0 +1,72 @@ +.letterboxing-overview { + margin-block-end: 32px; +} + +.letterboxing-search-overview { + margin-block-end: 16px; +} +#letterboxingAligner { + display: flex; + justify-content: start; + gap: 16px; + margin-block: 12px; + + --letterboxing-alignment-img-top: url("chrome://browser/content/preferences/letterboxing-top-light.svg"); + --letterboxing-alignment-img-middle: url("chrome://browser/content/preferences/letterboxing-middle-light.svg"); +} + +@media (prefers-color-scheme: dark) { + #letterboxingAligner { + --letterboxing-alignment-img-top: url("chrome://browser/content/preferences/letterboxing-top-dark.svg"); + --letterboxing-alignment-img-middle: url("chrome://browser/content/preferences/letterboxing-middle-dark.svg"); + } +} + +#letterboxingAligner .letterboxing-align-top img { + content: var(--letterboxing-alignment-img-top); +} +#letterboxingAligner .letterboxing-align-middle img { + content: var(--letterboxing-alignment-img-middle); +} + +#letterboxingAligner label { + width: 200px; + flex: 0 0 auto; +} + +#letterboxingAligner img { + border: none; + box-shadow: none; +} + +/* Hide letterboxing options depending on whether ResistFingerprinting or + * Letterboxing is enabled. */ +#letterboxingCategory:not(.rfp-enabled), +#letterboxingCategory:not(.rfp-enabled) ~ #letterboxingDisabled, +#letterboxingCategory.letterboxing-enabled ~ #letterboxingDisabled, +#letterboxingCategory:not(.rfp-enabled.letterboxing-enabled) ~ .letterboxing-category { + display: none; +} + +/* We duplicate the Letterboxing overview to appear in search results. + * We want to hide them whenever they are *not* part of a search result. */ +:is( + /* Hide the duplicates when the category is *not* hidden. */ + #letterboxingCategory:not(.visually-hidden) ~ .letterboxing-category, + /* Also hide the duplicated overview for subsequence search results if a + * previous groupbox is *not* hidden. */ + .letterboxing-category:not(.visually-hidden) ~ .letterboxing-category, +) .letterboxing-search-overview { + display: none; +} + +/* Similarly for #letterboxingDisabled, but we also want to hide its + * "Letterboxing" heading. + * NOTE: This should only appear in isolation, so we do not need to worry about + * subsequent groupboxes. */ +#letterboxingCategory:not(.visually-hidden) ~ #letterboxingDisabled :is( + .letterboxing-search-heading, + .letterboxing-search-overview +) { + display: none; +} ===================================== browser/components/preferences/letterboxing.inc.xhtml ===================================== @@ -0,0 +1,134 @@ +<script src="chrome://browser/content/preferences/letterboxing.js" /> +<vbox + id="letterboxingCategory" + class="subcategory" + hidden="true" + data-category="paneGeneral" +> + <html:h1 data-l10n-id="letterboxing-header" /> + <description class="letterboxing-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> +</vbox> +<groupbox + class="letterboxing-category" + data-category="paneGeneral" + hidden="true" +> + <label><html:h2 + data-l10n-id="letterboxing-window-size-header"/></label> + <description class="letterboxing-search-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> + <checkbox + id="letterboxingRememberSize" + data-l10n-id="letterboxing-remember-size" + preference="privacy.resistFingerprinting.letterboxing.rememberSize" + /> +</groupbox> +<groupbox + class="letterboxing-category" + data-category="paneGeneral" + hidden="true" +> + <label><html:h2 + data-l10n-id="letterboxing-alignment-header" + /></label> + <description class="letterboxing-search-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> + <description + id="letterboxingAlignmentDesc" + flex="1" + data-l10n-id="letterboxing-alignment-description" + /> + <form + xmlns="http://www.w3.org/1999/xhtml" + id="letterboxingAligner" + autocomplete="off" + aria-labelledby="letterboxingAlignmentDesc" + > + <label class="web-appearance-choice letterboxing-align-top"> + <div class="web-appearance-choice-image-container"> + <img role="presentation" /> + </div> + <div class="web-appearance-choice-footer"> + <input type="radio" name="alignment" value="top" /> + <span data-l10n-id="letterboxing-alignment-top"></span> + </div> + </label> + <label class="web-appearance-choice letterboxing-align-middle"> + <div class="web-appearance-choice-image-container"> + <img role="presentation" /> + </div> + <div class="web-appearance-choice-footer"> + <input type="radio" name="alignment" value="middle" /> + <span data-l10n-id="letterboxing-alignment-middle"></span> + </div> + </label> + </form> +</groupbox> +<groupbox + id="letterboxingDisabled" + data-category="paneGeneral" + hidden="true" +> + <label class="letterboxing-search-heading"><html:h2 + data-l10n-id="letterboxing-header"/></label> + <description class="letterboxing-search-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> + <hbox align="center"> + <label + class="face-sad" + flex="1" + data-l10n-id="letterboxing-disabled-description" + /> + <button + id="letterboxingEnableButton" + class="accessory-button" + is="highlightable-button" + data-l10n-id="letterboxing-enable-button" + /> + </hbox> +</groupbox> ===================================== browser/components/preferences/letterboxing.js ===================================== @@ -0,0 +1,113 @@ +/* import-globals-from /browser/components/preferences/preferences.js */ +/* import-globals-from /browser/components/preferences/findInPage.js */ +/* import-globals-from /toolkit/content/preferencesBindings.js */ + +Preferences.addAll([ + { + id: "privacy.resistFingerprinting.letterboxing.rememberSize", + type: "bool", + }, +]); + +{ + const lbEnabledPref = "privacy.resistFingerprinting.letterboxing"; + const visibilityPrefs = ["privacy.resistFingerprinting", lbEnabledPref]; + const alignMiddlePref = "privacy.resistFingerprinting.letterboxing.vcenter"; + + const hideFromSearchIf = (mustHide, ...elements) => { + for (const element of elements) { + if (mustHide) { + element.setAttribute("data-hidden-from-search", "true"); + } else { + element.removeAttribute("data-hidden-from-search"); + } + } + }; + + const syncVisibility = () => { + const [rfpEnabled, letterboxingEnabled] = visibilityPrefs.map(pref => + Services.prefs.getBoolPref(pref, false) + ); + const categoryElement = document.getElementById("letterboxingCategory"); + const { classList } = categoryElement; + + // Show the letterboxing section only if resistFingerprinting is enabled + classList.toggle("rfp-enabled", rfpEnabled); + classList.toggle("letterboxing-enabled", letterboxingEnabled); + + // To ensure the hidden parts do not contribute to search results, we need + // to add "data-hidden-from-search". + hideFromSearchIf( + !rfpEnabled || !letterboxingEnabled, + ...document.querySelectorAll(".letterboxing-category") + ); + hideFromSearchIf( + !rfpEnabled || letterboxingEnabled, + document.getElementById("letterboxingDisabled") + ); + }; + + const onVisibilityPrefChange = () => { + syncVisibility(); + // NOTE: Firefox does not expect "data-hidden-from-search" to change + // dynamically after page initialization. So we need to manually recall the + // methods that use "data-hidden-from-search". I.e. the "search" method, + // using the currently shown category. + // NOTE: We skip this if we are just initializing on page load. + // NOTE: data-hidden-from-search is also used when the user has entered a + // search term. We do not update the results in this case. Instead, it will + // update when the search term changes or is cleared. + if (!gSearchResultsPane.query) { + search(gLastCategory.category, "data-category"); + } + }; + + const alignerId = "letterboxingAligner"; + const syncAligner = () => { + const value = Services.prefs.getBoolPref(alignMiddlePref) + ? "middle" + : "top"; + document.querySelector( + `#${alignerId} input[value="${value}"]` + ).checked = true; + }; + + var gLetterboxingPrefs = { + init() { + syncVisibility(); + document + .getElementById("letterboxingEnableButton") + .addEventListener("command", () => { + Services.prefs.setBoolPref(lbEnabledPref, true); + // Button should have focus when activated but will be hidden now, + // so re-assign focus to the newly revealed options. + Services.focus.moveFocus( + window, + document.querySelector(".letterboxing-category"), + Services.focus.MOVEFOCUS_FIRST, + 0 + ); + }); + for (const pref of visibilityPrefs) { + Services.prefs.addObserver(pref, onVisibilityPrefChange); + } + + syncAligner(); + document.getElementById(alignerId).addEventListener("change", e => { + // NOTE: the "change" event is only fired on the checked input. + Services.prefs.setBoolPref( + alignMiddlePref, + e.target.value === "middle" + ); + }); + Services.prefs.addObserver(alignMiddlePref, syncAligner); + }, + + destroy() { + for (const pref of visibilityPrefs) { + Services.prefs.removeObserver(pref, onVisibilityPrefChange); + } + Services.prefs.removeObserver(alignMiddlePref, syncAligner); + }, + }; +} ===================================== browser/components/preferences/main.inc.xhtml ===================================== @@ -130,6 +130,9 @@ </vbox> </groupbox> +<!-- Letterboxing --> +#include ./letterboxing.inc.xhtml + <hbox id="languageAndAppearanceCategory" class="subcategory" hidden="true" ===================================== browser/components/preferences/main.js ===================================== @@ -736,6 +736,7 @@ var gMainPane = { ]); AppearanceChooser.init(); + gLetterboxingPrefs.init(); // Notify observers that the UI is now ready Services.obs.notifyObservers(window, "main-pane-loaded"); @@ -2591,6 +2592,7 @@ var gMainPane = { Services.prefs.removeObserver(PREF_CONTAINERS_EXTENSION, this); Services.obs.removeObserver(this, AUTO_UPDATE_CHANGED_TOPIC); Services.obs.removeObserver(this, BACKGROUND_UPDATE_CHANGED_TOPIC); + gLetterboxingPrefs.destroy(); AppearanceChooser.destroy(); }, ===================================== browser/components/preferences/preferences.xhtml ===================================== @@ -12,6 +12,7 @@ <?xml-stylesheet href="chrome://browser/skin/preferences/search.css"?> <?xml-stylesheet href="chrome://browser/skin/preferences/containers.css"?> <?xml-stylesheet href="chrome://browser/skin/preferences/privacy.css"?> +<?xml-stylesheet href="chrome://browser/content/preferences/letterboxing.css"?> <?xml-stylesheet href="chrome://browser/content/securitylevel/securityLevelPreferences.css"?> <!DOCTYPE html> @@ -40,6 +41,7 @@ <!-- Links below are only used for search-l10n-ids into subdialogs --> <link rel="localization" href="browser/aboutDialog.ftl"/> + <link rel="localization" href="browser/base-browser.ftl"/> <link rel="localization" href="browser/preferences/addEngine.ftl"/> <link rel="localization" href="browser/preferences/blocklists.ftl"/> <link rel="localization" href="browser/preferences/clearSiteData.ftl"/> ===================================== browser/locales/en-US/browser/base-browser.ftl ===================================== @@ -70,3 +70,27 @@ new-identity-dialog-confirm = new-identity-blocked-home-notification = { -brand-short-name } blocked your homepage ({ $url }) from loading because it might recognize your previous session. # Button to continue loading the home page, despite the warning message. new-identity-blocked-home-ignore-button = Load it anyway +## Preferences - Letterboxing. + +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-header = Letterboxing +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-overview = { -brand-short-name }'s Letterboxing feature restricts websites to display at specific sizes, making it harder to single out users on the basis of their window or screen size. +letterboxing-learn-more = Learn more +letterboxing-window-size-header = Window size +letterboxing-remember-size = + .label = Reuse last window size when opening a new window + .accesskey = R +letterboxing-alignment-header = Content Alignment +letterboxing-alignment-description = Choose where you want to align the website’s content. +letterboxing-alignment-top = Top +letterboxing-alignment-middle = Middle +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-disabled-description = Letterboxing is currently disabled. +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-enable-button = + .label = Enable Letterboxing View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/d873c00… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/d873c00… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.9.0esr-13.5-1] Bug 41916: Letterboxing preferences UI
by ma1 (@ma1) 21 Mar '24

21 Mar '24
ma1 pushed to branch tor-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: 96be793b by hackademix at 2024-03-21T13:41:16+01:00 Bug 41916: Letterboxing preferences UI - - - - - 12 changed files: - browser/components/preferences/jar.mn - + browser/components/preferences/letterboxing-middle-dark.svg - + browser/components/preferences/letterboxing-middle-light.svg - + browser/components/preferences/letterboxing-top-dark.svg - + browser/components/preferences/letterboxing-top-light.svg - + browser/components/preferences/letterboxing.css - + browser/components/preferences/letterboxing.inc.xhtml - + browser/components/preferences/letterboxing.js - browser/components/preferences/main.inc.xhtml - browser/components/preferences/main.js - browser/components/preferences/preferences.xhtml - browser/locales/en-US/browser/base-browser.ftl Changes: ===================================== browser/components/preferences/jar.mn ===================================== @@ -22,3 +22,10 @@ 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/letterboxing.js + content/browser/preferences/letterboxing.css + content/browser/preferences/letterboxing-middle-dark.svg + content/browser/preferences/letterboxing-middle-light.svg + content/browser/preferences/letterboxing-top-dark.svg + content/browser/preferences/letterboxing-top-light.svg ===================================== browser/components/preferences/letterboxing-middle-dark.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_2272_529)"> +<g clip-path="url(#clip0_2272_529)"> +<path d="M58 3H4V45H58V3Z" fill="#42414D"/> +<path d="M58 3H4V14H58V3Z" fill="#42414D"/> +<path d="M58 3H4V8H58V3Z" fill="#2B2A33"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="white"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="white"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="white"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="white"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="white"/> +<path d="M58 14H4V45H58V14Z" fill="#5B5B66"/> +<rect x="8" y="18" width="46" height="23" rx="2" fill="#3A3944"/> +<path d="M38 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H38C38.5523 24 39 23.5523 39 23C39 22.4477 38.5523 22 38 22Z" fill="white"/> +<path d="M27 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H27C27.5523 28 28 27.5523 28 27C28 26.4477 27.5523 26 27 26Z" fill="white"/> +<path d="M42 30H13C12.4477 30 12 30.4477 12 31C12 31.5523 12.4477 32 13 32H42C42.5523 32 43 31.5523 43 31C43 30.4477 42.5523 30 42 30Z" fill="white"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="1.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_2272_529" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2272_529"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2272_529" result="shape"/> +</filter> +<clipPath id="clip0_2272_529"> +<rect x="4" y="3" width="54" height="42" rx="2" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing-middle-light.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_202_960)"> +<g clip-path="url(#clip0_202_960)"> +<path d="M58 3H4V45H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V14H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V8H58V3Z" fill="#E0E0E6"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="#52525E"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="#52525E"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="#52525E"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="#52525E"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="#52525E"/> +<path d="M58 14H4V45H58V14Z" fill="#CFCFD8"/> +<rect x="8" y="18" width="46" height="23" rx="2" fill="white"/> +<path d="M38 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H38C38.5523 24 39 23.5523 39 23C39 22.4477 38.5523 22 38 22Z" fill="#52525E"/> +<path d="M27 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H27C27.5523 28 28 27.5523 28 27C28 26.4477 27.5523 26 27 26Z" fill="#52525E"/> +<path d="M42 30H13C12.4477 30 12 30.4477 12 31C12 31.5523 12.4477 32 13 32H42C42.5523 32 43 31.5523 43 31C43 30.4477 42.5523 30 42 30Z" fill="#52525E"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="1.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_202_960" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_202_960"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_202_960" result="shape"/> +</filter> +<clipPath id="clip0_202_960"> +<rect x="4" y="3" width="54" height="42" rx="2" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing-top-dark.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_2272_508)"> +<g clip-path="url(#clip0_2272_508)"> +<path d="M58 3H4V45H58V3Z" fill="#52525E"/> +<path d="M58 3H4V14H58V3Z" fill="#42414D"/> +<path d="M58 3H4V8H58V3Z" fill="#2B2A33"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="white"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="white"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="white"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="white"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="white"/> +<path d="M58 14H4V45H58V14Z" fill="#5B5B66"/> +<path d="M8 14H55V39C55 40.1046 54.1046 41 53 41H10C8.89543 41 8 40.1046 8 39V14Z" fill="#3A3944"/> +<path d="M38 18H13C12.4477 18 12 18.4477 12 19C12 19.5523 12.4477 20 13 20H38C38.5523 20 39 19.5523 39 19C39 18.4477 38.5523 18 38 18Z" fill="white"/> +<path d="M27 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H27C27.5523 24 28 23.5523 28 23C28 22.4477 27.5523 22 27 22Z" fill="white"/> +<path d="M42 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H42C42.5523 28 43 27.5523 43 27C43 26.4477 42.5523 26 42 26Z" fill="white"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="3.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_2272_508" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2272_508"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2272_508" result="shape"/> +</filter> +<clipPath id="clip0_2272_508"> +<rect x="4" y="3" width="54" height="42" rx="4" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing-top-light.svg ===================================== @@ -0,0 +1,35 @@ +<svg width="62" height="50" viewBox="0 0 62 50" fill="none" xmlns="http://www.w3.org/2000/svg"> +<g filter="url(#filter0_d_202_926)"> +<g clip-path="url(#clip0_202_926)"> +<path d="M58 3H4V45H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V14H58V3Z" fill="#F0F0F4"/> +<path d="M58 3H4V8H58V3Z" fill="#E0E0E6"/> +<path d="M20 5H10C9.44772 5 9 5.44772 9 6C9 6.55228 9.44772 7 10 7H20C20.5523 7 21 6.55228 21 6C21 5.44772 20.5523 5 20 5Z" fill="#52525E"/> +<path d="M56 11C56 10.4477 55.5523 10 55 10C54.4477 10 54 10.4477 54 11C54 11.5523 54.4477 12 55 12C55.5523 12 56 11.5523 56 11Z" fill="#52525E"/> +<path d="M8 11C8 10.4477 7.55228 10 7 10C6.44772 10 6 10.4477 6 11C6 11.5523 6.44772 12 7 12C7.55228 12 8 11.5523 8 11Z" fill="#52525E"/> +<path d="M12 11C12 10.4477 11.5523 10 11 10C10.4477 10 10 10.4477 10 11C10 11.5523 10.4477 12 11 12C11.5523 12 12 11.5523 12 11Z" fill="#52525E"/> +<path d="M51 10H15C14.4477 10 14 10.4477 14 11C14 11.5523 14.4477 12 15 12H51C51.5523 12 52 11.5523 52 11C52 10.4477 51.5523 10 51 10Z" fill="#52525E"/> +<path d="M58 14H4V45H58V14Z" fill="#CFCFD8"/> +<path d="M8 14H55V39C55 40.1046 54.1046 41 53 41H10C8.89543 41 8 40.1046 8 39V14Z" fill="white"/> +<path d="M38 18H13C12.4477 18 12 18.4477 12 19C12 19.5523 12.4477 20 13 20H38C38.5523 20 39 19.5523 39 19C39 18.4477 38.5523 18 38 18Z" fill="#52525E"/> +<path d="M27 22H13C12.4477 22 12 22.4477 12 23C12 23.5523 12.4477 24 13 24H27C27.5523 24 28 23.5523 28 23C28 22.4477 27.5523 22 27 22Z" fill="#52525E"/> +<path d="M42 26H13C12.4477 26 12 26.4477 12 27C12 27.5523 12.4477 28 13 28H42C42.5523 28 43 27.5523 43 27C43 26.4477 42.5523 26 42 26Z" fill="#52525E"/> +</g> +<rect x="4.5" y="3.5" width="53" height="41" rx="3.5" stroke="#8F8F9D" shape-rendering="crispEdges"/> +</g> +<defs> +<filter id="filter0_d_202_926" x="0" y="0" width="62" height="50" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> +<feFlood flood-opacity="0" result="BackgroundImageFix"/> +<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> +<feOffset dy="1"/> +<feGaussianBlur stdDeviation="2"/> +<feComposite in2="hardAlpha" operator="out"/> +<feColorMatrix type="matrix" values="0 0 0 0 0.0470588 0 0 0 0 0.0470588 0 0 0 0 0.0509804 0 0 0 0.1 0"/> +<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_202_926"/> +<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_202_926" result="shape"/> +</filter> +<clipPath id="clip0_202_926"> +<rect x="4" y="3" width="54" height="42" rx="4" fill="white"/> +</clipPath> +</defs> +</svg> ===================================== browser/components/preferences/letterboxing.css ===================================== @@ -0,0 +1,72 @@ +.letterboxing-overview { + margin-block-end: 32px; +} + +.letterboxing-search-overview { + margin-block-end: 16px; +} +#letterboxingAligner { + display: flex; + justify-content: start; + gap: 16px; + margin-block: 12px; + + --letterboxing-alignment-img-top: url("chrome://browser/content/preferences/letterboxing-top-light.svg"); + --letterboxing-alignment-img-middle: url("chrome://browser/content/preferences/letterboxing-middle-light.svg"); +} + +@media (prefers-color-scheme: dark) { + #letterboxingAligner { + --letterboxing-alignment-img-top: url("chrome://browser/content/preferences/letterboxing-top-dark.svg"); + --letterboxing-alignment-img-middle: url("chrome://browser/content/preferences/letterboxing-middle-dark.svg"); + } +} + +#letterboxingAligner .letterboxing-align-top img { + content: var(--letterboxing-alignment-img-top); +} +#letterboxingAligner .letterboxing-align-middle img { + content: var(--letterboxing-alignment-img-middle); +} + +#letterboxingAligner label { + width: 200px; + flex: 0 0 auto; +} + +#letterboxingAligner img { + border: none; + box-shadow: none; +} + +/* Hide letterboxing options depending on whether ResistFingerprinting or + * Letterboxing is enabled. */ +#letterboxingCategory:not(.rfp-enabled), +#letterboxingCategory:not(.rfp-enabled) ~ #letterboxingDisabled, +#letterboxingCategory.letterboxing-enabled ~ #letterboxingDisabled, +#letterboxingCategory:not(.rfp-enabled.letterboxing-enabled) ~ .letterboxing-category { + display: none; +} + +/* We duplicate the Letterboxing overview to appear in search results. + * We want to hide them whenever they are *not* part of a search result. */ +:is( + /* Hide the duplicates when the category is *not* hidden. */ + #letterboxingCategory:not(.visually-hidden) ~ .letterboxing-category, + /* Also hide the duplicated overview for subsequence search results if a + * previous groupbox is *not* hidden. */ + .letterboxing-category:not(.visually-hidden) ~ .letterboxing-category, +) .letterboxing-search-overview { + display: none; +} + +/* Similarly for #letterboxingDisabled, but we also want to hide its + * "Letterboxing" heading. + * NOTE: This should only appear in isolation, so we do not need to worry about + * subsequent groupboxes. */ +#letterboxingCategory:not(.visually-hidden) ~ #letterboxingDisabled :is( + .letterboxing-search-heading, + .letterboxing-search-overview +) { + display: none; +} ===================================== browser/components/preferences/letterboxing.inc.xhtml ===================================== @@ -0,0 +1,134 @@ +<script src="chrome://browser/content/preferences/letterboxing.js" /> +<vbox + id="letterboxingCategory" + class="subcategory" + hidden="true" + data-category="paneGeneral" +> + <html:h1 data-l10n-id="letterboxing-header" /> + <description class="letterboxing-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> +</vbox> +<groupbox + class="letterboxing-category" + data-category="paneGeneral" + hidden="true" +> + <label><html:h2 + data-l10n-id="letterboxing-window-size-header"/></label> + <description class="letterboxing-search-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> + <checkbox + id="letterboxingRememberSize" + data-l10n-id="letterboxing-remember-size" + preference="privacy.resistFingerprinting.letterboxing.rememberSize" + /> +</groupbox> +<groupbox + class="letterboxing-category" + data-category="paneGeneral" + hidden="true" +> + <label><html:h2 + data-l10n-id="letterboxing-alignment-header" + /></label> + <description class="letterboxing-search-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> + <description + id="letterboxingAlignmentDesc" + flex="1" + data-l10n-id="letterboxing-alignment-description" + /> + <form + xmlns="http://www.w3.org/1999/xhtml" + id="letterboxingAligner" + autocomplete="off" + aria-labelledby="letterboxingAlignmentDesc" + > + <label class="web-appearance-choice letterboxing-align-top"> + <div class="web-appearance-choice-image-container"> + <img role="presentation" /> + </div> + <div class="web-appearance-choice-footer"> + <input type="radio" name="alignment" value="top" /> + <span data-l10n-id="letterboxing-alignment-top"></span> + </div> + </label> + <label class="web-appearance-choice letterboxing-align-middle"> + <div class="web-appearance-choice-image-container"> + <img role="presentation" /> + </div> + <div class="web-appearance-choice-footer"> + <input type="radio" name="alignment" value="middle" /> + <span data-l10n-id="letterboxing-alignment-middle"></span> + </div> + </label> + </form> +</groupbox> +<groupbox + id="letterboxingDisabled" + data-category="paneGeneral" + hidden="true" +> + <label class="letterboxing-search-heading"><html:h2 + data-l10n-id="letterboxing-header"/></label> + <description class="letterboxing-search-overview"> + <html:span + data-l10n-id="letterboxing-overview" + class="tail-with-learn-more" + ></html:span> + <label + data-l10n-id="letterboxing-learn-more" + class="learnMore text-link" + is="text-link" + href="about:manual#letterboxing" + useoriginprincipal="true" + /> + </description> + <hbox align="center"> + <label + class="face-sad" + flex="1" + data-l10n-id="letterboxing-disabled-description" + /> + <button + id="letterboxingEnableButton" + class="accessory-button" + is="highlightable-button" + data-l10n-id="letterboxing-enable-button" + /> + </hbox> +</groupbox> ===================================== browser/components/preferences/letterboxing.js ===================================== @@ -0,0 +1,113 @@ +/* import-globals-from /browser/components/preferences/preferences.js */ +/* import-globals-from /browser/components/preferences/findInPage.js */ +/* import-globals-from /toolkit/content/preferencesBindings.js */ + +Preferences.addAll([ + { + id: "privacy.resistFingerprinting.letterboxing.rememberSize", + type: "bool", + }, +]); + +{ + const lbEnabledPref = "privacy.resistFingerprinting.letterboxing"; + const visibilityPrefs = ["privacy.resistFingerprinting", lbEnabledPref]; + const alignMiddlePref = "privacy.resistFingerprinting.letterboxing.vcenter"; + + const hideFromSearchIf = (mustHide, ...elements) => { + for (const element of elements) { + if (mustHide) { + element.setAttribute("data-hidden-from-search", "true"); + } else { + element.removeAttribute("data-hidden-from-search"); + } + } + }; + + const syncVisibility = () => { + const [rfpEnabled, letterboxingEnabled] = visibilityPrefs.map(pref => + Services.prefs.getBoolPref(pref, false) + ); + const categoryElement = document.getElementById("letterboxingCategory"); + const { classList } = categoryElement; + + // Show the letterboxing section only if resistFingerprinting is enabled + classList.toggle("rfp-enabled", rfpEnabled); + classList.toggle("letterboxing-enabled", letterboxingEnabled); + + // To ensure the hidden parts do not contribute to search results, we need + // to add "data-hidden-from-search". + hideFromSearchIf( + !rfpEnabled || !letterboxingEnabled, + ...document.querySelectorAll(".letterboxing-category") + ); + hideFromSearchIf( + !rfpEnabled || letterboxingEnabled, + document.getElementById("letterboxingDisabled") + ); + }; + + const onVisibilityPrefChange = () => { + syncVisibility(); + // NOTE: Firefox does not expect "data-hidden-from-search" to change + // dynamically after page initialization. So we need to manually recall the + // methods that use "data-hidden-from-search". I.e. the "search" method, + // using the currently shown category. + // NOTE: We skip this if we are just initializing on page load. + // NOTE: data-hidden-from-search is also used when the user has entered a + // search term. We do not update the results in this case. Instead, it will + // update when the search term changes or is cleared. + if (!gSearchResultsPane.query) { + search(gLastCategory.category, "data-category"); + } + }; + + const alignerId = "letterboxingAligner"; + const syncAligner = () => { + const value = Services.prefs.getBoolPref(alignMiddlePref) + ? "middle" + : "top"; + document.querySelector( + `#${alignerId} input[value="${value}"]` + ).checked = true; + }; + + var gLetterboxingPrefs = { + init() { + syncVisibility(); + document + .getElementById("letterboxingEnableButton") + .addEventListener("command", () => { + Services.prefs.setBoolPref(lbEnabledPref, true); + // Button should have focus when activated but will be hidden now, + // so re-assign focus to the newly revealed options. + Services.focus.moveFocus( + window, + document.querySelector(".letterboxing-category"), + Services.focus.MOVEFOCUS_FIRST, + 0 + ); + }); + for (const pref of visibilityPrefs) { + Services.prefs.addObserver(pref, onVisibilityPrefChange); + } + + syncAligner(); + document.getElementById(alignerId).addEventListener("change", e => { + // NOTE: the "change" event is only fired on the checked input. + Services.prefs.setBoolPref( + alignMiddlePref, + e.target.value === "middle" + ); + }); + Services.prefs.addObserver(alignMiddlePref, syncAligner); + }, + + destroy() { + for (const pref of visibilityPrefs) { + Services.prefs.removeObserver(pref, onVisibilityPrefChange); + } + Services.prefs.removeObserver(alignMiddlePref, syncAligner); + }, + }; +} ===================================== browser/components/preferences/main.inc.xhtml ===================================== @@ -130,6 +130,9 @@ </vbox> </groupbox> +<!-- Letterboxing --> +#include ./letterboxing.inc.xhtml + <hbox id="languageAndAppearanceCategory" class="subcategory" hidden="true" ===================================== browser/components/preferences/main.js ===================================== @@ -729,6 +729,7 @@ var gMainPane = { ]); AppearanceChooser.init(); + gLetterboxingPrefs.init(); // Notify observers that the UI is now ready Services.obs.notifyObservers(window, "main-pane-loaded"); @@ -2585,6 +2586,7 @@ var gMainPane = { Services.prefs.removeObserver(PREF_CONTAINERS_EXTENSION, this); Services.obs.removeObserver(this, AUTO_UPDATE_CHANGED_TOPIC); Services.obs.removeObserver(this, BACKGROUND_UPDATE_CHANGED_TOPIC); + gLetterboxingPrefs.destroy(); AppearanceChooser.destroy(); }, ===================================== browser/components/preferences/preferences.xhtml ===================================== @@ -12,6 +12,7 @@ <?xml-stylesheet href="chrome://browser/skin/preferences/search.css"?> <?xml-stylesheet href="chrome://browser/skin/preferences/containers.css"?> <?xml-stylesheet href="chrome://browser/skin/preferences/privacy.css"?> +<?xml-stylesheet href="chrome://browser/content/preferences/letterboxing.css"?> <?xml-stylesheet href="chrome://browser/content/securitylevel/securityLevelPreferences.css"?> <?xml-stylesheet href="chrome://browser/content/torpreferences/torPreferences.css"?> <?xml-stylesheet href="chrome://browser/content/onionservices/authPreferences.css"?> @@ -42,6 +43,7 @@ <!-- Links below are only used for search-l10n-ids into subdialogs --> <link rel="localization" href="browser/aboutDialog.ftl"/> + <link rel="localization" href="browser/base-browser.ftl"/> <link rel="localization" href="browser/preferences/addEngine.ftl"/> <link rel="localization" href="browser/preferences/blocklists.ftl"/> <link rel="localization" href="browser/preferences/clearSiteData.ftl"/> ===================================== browser/locales/en-US/browser/base-browser.ftl ===================================== @@ -70,3 +70,27 @@ new-identity-dialog-confirm = new-identity-blocked-home-notification = { -brand-short-name } blocked your homepage ({ $url }) from loading because it might recognize your previous session. # Button to continue loading the home page, despite the warning message. new-identity-blocked-home-ignore-button = Load it anyway +## Preferences - Letterboxing. + +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-header = Letterboxing +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-overview = { -brand-short-name }'s Letterboxing feature restricts websites to display at specific sizes, making it harder to single out users on the basis of their window or screen size. +letterboxing-learn-more = Learn more +letterboxing-window-size-header = Window size +letterboxing-remember-size = + .label = Reuse last window size when opening a new window + .accesskey = R +letterboxing-alignment-header = Content Alignment +letterboxing-alignment-description = Choose where you want to align the website’s content. +letterboxing-alignment-top = Top +letterboxing-alignment-middle = Middle +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-disabled-description = Letterboxing is currently disabled. +# The word "Letterboxing" is the proper noun for the Tor Browser feature, and is therefore capitalised. +# "Letterboxing" should be treated as a feature/product name, and likely not changed in other languages. +letterboxing-enable-button = + .label = Enable Letterboxing View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/96be793… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/96be793… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/mullvad-browser][mullvad-browser-115.9.0esr-13.5-1] 3 commits: fixup! Bug 40926: Implemented the New Identity feature
by richard (@richard) 20 Mar '24

20 Mar '24
richard pushed to branch mullvad-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser Commits: 2ce971c7 by Henry Wilkes at 2024-03-20T20:54:07+00:00 fixup! Bug 40926: Implemented the New Identity feature Bug 42211: Migrate to Fluent. - - - - - 5a1f3b54 by Henry Wilkes at 2024-03-20T20:54:14+00:00 fixup! Base Browser strings Bug 42211: Migrate new identity to Fluent. Also change some strings to sentence case in en-US. Also removed the hard-coded &quot;Tor Browser&quot;, which is not appropriate in base-browser (e.g. for Mullvad Browser). - - - - - a8282d9c by Henry Wilkes at 2024-03-20T20:54:20+00:00 fixup! Tor Browser localization migration scripts. Bug 42211: Migrate new identity strings to Fluent. - - - - - 10 changed files: - browser/base/content/appmenu-viewcache.inc.xhtml - browser/base/content/browser-menubar.inc - browser/base/content/navigator-toolbox.inc.xhtml - browser/components/newidentity/content/newIdentityDialog.js - browser/components/newidentity/content/newIdentityDialog.xhtml - browser/components/newidentity/content/newidentity.js - browser/locales/en-US/browser/base-browser.ftl - − browser/locales/en-US/chrome/browser/newIdentity.properties - browser/locales/jar.mn - + tools/torbrowser/l10n/migrations/bug-42211-new-identity.py Changes: ===================================== browser/base/content/appmenu-viewcache.inc.xhtml ===================================== @@ -57,6 +57,7 @@ <toolbarseparator/> <toolbarbutton id="appMenu-new-identity" class="subviewbutton" + data-l10n-id="appmenuitem-new-identity" key="new-identity-key"/> <toolbarseparator/> <toolbarbutton id="appMenu-bookmarks-button" ===================================== browser/base/content/browser-menubar.inc ===================================== @@ -30,7 +30,7 @@ key="key_privatebrowsing" data-l10n-id="menu-file-new-private-window"/> <menuseparator/> <menuitem id="menu_newIdentity" - key="new-identity-key"/> + key="new-identity-key" data-l10n-id="menu-new-identity"/> <menuseparator/> <menuitem id="menu_openLocation" hidden="true" ===================================== browser/base/content/navigator-toolbox.inc.xhtml ===================================== @@ -590,7 +590,8 @@ ondragover="newWindowButtonObserver.onDragOver(event)" ondragenter="newWindowButtonObserver.onDragOver(event)"/> - <toolbarbutton id="new-identity-button" class="toolbarbutton-1 chromeclass-toolbar-additional"/> + <toolbarbutton id="new-identity-button" class="toolbarbutton-1 chromeclass-toolbar-additional" + data-l10n-id="toolbar-new-identity"/> <toolbarbutton id="fullscreen-button" class="toolbarbutton-1 chromeclass-toolbar-additional" observes="View:FullScreen" ===================================== browser/components/newidentity/content/newIdentityDialog.js ===================================== @@ -5,20 +5,13 @@ document.addEventListener("dialogaccept", () => { const retvals = window.arguments[0]; retvals.confirmed = true; - retvals.neverAskAgain = document.querySelector("#neverAskAgain").checked; + retvals.neverAskAgain = document.getElementById("neverAskAgain").checked; }); document.addEventListener("DOMContentLoaded", () => { - const { NewIdentityStrings } = window.arguments[0]; - const dialog = document.querySelector("#newIdentityDialog"); + const dialog = document.getElementById("newIdentityDialog"); - dialog.querySelector("#infoTitle").textContent = - NewIdentityStrings.new_identity_prompt_title; - dialog.querySelector("#infoBody").textContent = - NewIdentityStrings.new_identity_prompt; - dialog.querySelector("#neverAskAgain").label = - NewIdentityStrings.new_identity_ask_again; const accept = dialog.getButton("accept"); - accept.label = NewIdentityStrings.new_identity_restart; + document.l10n.setAttributes(accept, "new-identity-dialog-confirm"); accept.classList.add("danger-button"); }); ===================================== browser/components/newidentity/content/newIdentityDialog.xhtml ===================================== @@ -21,9 +21,8 @@ > <dialog id="newIdentityDialog" buttons="accept,cancel" defaultButton="accept"> <linkset> - <!-- Without this document.l10n is not initialized, and we need it for the - cancel button. --> <html:link rel="localization" href="branding/brand.ftl" /> + <html:link rel="localization" href="browser/base-browser.ftl" /> </linkset> <div xmlns="http://www.w3.org/1999/xhtml"> @@ -33,13 +32,18 @@ <xul:image id="infoIcon" /> </div> <div id="infoContainer"> - <xul:description id="infoTitle" /> + <xul:description + id="infoTitle" + data-l10n-id="new-identity-dialog-title" + /> <xul:description id="infoBody" - context="contentAreaContextMenu" - noinitialfocus="true" + data-l10n-id="new-identity-dialog-description" + /> + <xul:checkbox + id="neverAskAgain" + data-l10n-id="new-identity-dialog-never-ask-checkbox" /> - <xul:checkbox id="neverAskAgain" /> </div> </div> </div> ===================================== browser/components/newidentity/content/newidentity.js ===================================== @@ -1,40 +1,6 @@ "use strict"; -/* globals CustomizableUI Services gFindBarInitialized gFindBar - OpenBrowserWindow PrivateBrowsingUtils XPCOMUtils - */ - -XPCOMUtils.defineLazyGetter(this, "NewIdentityStrings", () => { - const brandBundle = Services.strings.createBundle( - "chrome://branding/locale/brand.properties" - ); - const brandShortName = brandBundle.GetStringFromName("brandShortName"); - - const fallbackBundle = Services.strings.createBundle( - "resource:///chrome/en-US/locale/browser/newIdentity.properties" - ); - const strings = {}; - const brandedStrings = ["new_identity_prompt", "new_identity_restart"]; - for (let { key } of fallbackBundle.getSimpleEnumeration()) { - strings[key] = fallbackBundle.GetStringFromName(key); - } - try { - const bundle = Services.strings.createBundle( - "chrome://browser/locale/newIdentity.properties" - ); - for (const key of Object.keys(strings)) { - try { - strings[key] = bundle.GetStringFromName(key); - } catch (e) {} - } - } catch (e) { - console.warn("Could not load localized New Identity strings"); - } - for (let key of brandedStrings) { - strings[key] = strings[key].replaceAll("%S", brandShortName); - } - return strings; -}); +/* eslint-env mozilla/browser-window */ // Use a lazy getter because NewIdentityButton is declared more than once // otherwise. @@ -471,11 +437,6 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => { // malformed URL, bail out return; } - const label = - NewIdentityStrings.new_identity_home_notification.replace( - "%S", - displayAddress - ); const callback = () => { Services.prefs.setStringPref(trustedHomePref, homeURL); win.BrowserHome(); @@ -484,12 +445,15 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => { notificationBox.appendNotification( "new-identity-safe-home", { - label, + label: { + "l10n-id": "new-identity-blocked-home-notification", + "l10n-args": { url: displayAddress }, + }, priority: notificationBox.PRIORITY_INFO_MEDIUM, }, [ { - label: NewIdentityStrings.new_identity_home_load_button, + "l10n-id": "new-identity-blocked-home-ignore-button", callback, }, ] @@ -550,37 +514,20 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => { const button = document.getElementById("new-identity-button") || window.gNavToolbox.palette.querySelector("#new-identity-button"); - if (button) { - button.setAttribute("tooltiptext", NewIdentityStrings.new_identity); - // Include an equal label, shown in the overflow menu or during - // customization. - button.setAttribute("label", NewIdentityStrings.new_identity); - button.addEventListener("command", () => { - this.onCommand(); - }); - } - const viewCache = document.getElementById("appMenu-viewCache").content; - const appButton = viewCache.querySelector("#appMenu-new-identity"); - if (appButton) { - appButton.setAttribute( - "label", - NewIdentityStrings.new_identity_sentence_case - ); - appButton.addEventListener("command", () => { + button?.addEventListener("command", () => { + this.onCommand(); + }); + document + .getElementById("appMenu-viewCache") + .content.querySelector("#appMenu-new-identity") + ?.addEventListener("command", () => { this.onCommand(); }); - } - const menu = document.querySelector("#menu_newIdentity"); - if (menu) { - menu.setAttribute("label", NewIdentityStrings.new_identity); - menu.setAttribute( - "accesskey", - NewIdentityStrings.new_identity_menu_accesskey - ); - menu.addEventListener("command", () => { + document + .getElementById("menu_newIdentity") + ?.addEventListener("command", () => { this.onCommand(); }); - } }, uninit() {}, @@ -598,7 +545,6 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => { const shouldConfirm = Services.prefs.getBoolPref(prefConfirm, true); if (shouldConfirm) { const params = { - NewIdentityStrings, confirmed: false, neverAskAgain: false, }; ===================================== browser/locales/en-US/browser/base-browser.ftl ===================================== @@ -11,20 +11,19 @@ language-notification-label-system = { -brand-short-name } has set your display language-notification-label = { -brand-short-name } has set your display language to { $language }. language-notification-button = Change Language… - ## Fullscreen/maximization notification shown when letterboxing is disabled basebrowser-rfp-maximize-warning-message = Maximizing the browser window can allow websites to determine your monitor size, which can be used to track you. We recommend that you leave browser windows in their original default size. basebrowser-rfp-restore-window-size-button-label = Restore basebrowser-rfp-restore-window-size-button-ak = R - ## Tooltip for the about:addons recommended badge basebrowser-addon-badge-recommended = Mozilla only recommends extensions that meet their standards for security and performance basebrowser-addon-badge-verified = Mozilla has reviewed this extension to meet their standards for security and performance ## Option to show or hide the NoScript extension button/item. + basebrowser-addon-noscript-visibility-label = Toolbar button basebrowser-addon-noscript-visibility-show = Show basebrowser-addon-noscript-visibility-hide = Hide @@ -35,3 +34,39 @@ basebrowser-addon-noscript-visibility-hide = Hide # $version (String) - The current browser version. E.g. "12.5.3". # $firefoxVersion (String) - The version number of Firefox the current browser is based on. E.g. "102.15.0esr". basebrowser-about-dialog-version = { $version } (based on Mozilla Firefox { $firefoxVersion }) + +## New identity. + +# File menu items use title case for English (US). +menu-new-identity = + .label = New Identity + .accesskey = I + +# App menu (hamburger menu) items use sentence case for English (US). +appmenuitem-new-identity = + .label = New identity + +# Uses sentence case for English (US). +# ".label" is the accessible name, and is visible in the overflow menu and when +# customizing the toolbar. +# ".tooltiptext" will be identical to the label. +toolbar-new-identity = + .label = New identity + .tooltiptext = { toolbar-new-identity.label } + +## New identity dialog. + +new-identity-dialog-title = Reset your identity? +new-identity-dialog-description = { -brand-short-name } will close all windows and tabs. All website sessions will be lost. +new-identity-dialog-never-ask-checkbox = + .label = Never ask me again +new-identity-dialog-confirm = + .label = Restart { -brand-short-name } + +## New identity: blocked home page notification. + +# '-brand-short-name' is the localized browser name, like "Tor Browser". +# $url (String) - The URL of the home page, possibly shortened. +new-identity-blocked-home-notification = { -brand-short-name } blocked your homepage ({ $url }) from loading because it might recognize your previous session. +# Button to continue loading the home page, despite the warning message. +new-identity-blocked-home-ignore-button = Load it anyway ===================================== browser/locales/en-US/chrome/browser/newIdentity.properties deleted ===================================== @@ -1,13 +0,0 @@ -new_identity = New Identity -# This is the string for the hamburger menu -new_identity_sentence_case = New identity -# %S is the application name. Keep it as a placeholder -new_identity_prompt_title = Reset your identity? -new_identity_prompt = %S will close all windows and tabs. All website sessions will be lost. \nRestart %S now to reset your identity? -new_identity_restart = Restart %S -new_identity_ask_again = Never ask me again -# Shown in the File menu (use Alt to show File, if you do not see) -new_identity_menu_accesskey = I -new_identity_home_notification = Tor Browser blocked your homepage (%S) from loading because it might recognize your previous session. -# %S is replaced with the custom homepage URL's domain if applicable, or some short-hand of it otherwise -new_identity_home_load_button = Load it anyway ===================================== browser/locales/jar.mn ===================================== @@ -33,5 +33,4 @@ locale/browser/feeds/subscribe.properties (%chrome/browser/feeds/subscribe.properties) locale/browser/syncSetup.properties (%chrome/browser/syncSetup.properties) locale/browser/securityLevel.properties (%chrome/browser/securityLevel.properties) - locale/browser/newIdentity.properties (%chrome/browser/newIdentity.properties) % locale browser-region @AB_CD@ %locale/browser-region/ ===================================== tools/torbrowser/l10n/migrations/bug-42211-new-identity.py ===================================== @@ -0,0 +1,48 @@ +import fluent.syntax.ast as FTL +from fluent.migrate.helpers import TERM_REFERENCE, transforms_from +from fluent.migrate.transforms import REPLACE + + +def migrate(ctx): + legacy_path = "newIdentity.properties" + + ctx.add_transforms( + "base-browser.ftl", + "base-browser.ftl", + transforms_from( + """ +menu-new-identity = + .label = { COPY(path, "new_identity") } + .accesskey = { COPY(path, "new_identity_menu_accesskey") } +appmenuitem-new-identity = + .label = { COPY(path, "new_identity_sentence_case") } +toolbar-new-identity = + .label = { COPY(path, "new_identity_sentence_case") } + .tooltiptext = { toolbar-new-identity.label } + +new-identity-dialog-title = { COPY(path, "new_identity_prompt_title") } +new-identity-dialog-never-ask-checkbox = + .label = { COPY(path, "new_identity_ask_again") } + +new-identity-blocked-home-ignore-button = { COPY(path, "new_identity_home_load_button") } +""", + path=legacy_path, + ) + + [ + # Replace "%S" with "{ -brand-short-name }" in confirm button. + FTL.Message( + id=FTL.Identifier("new-identity-dialog-confirm"), + value=None, + attributes=[ + FTL.Attribute( + id=FTL.Identifier("label"), + value=REPLACE( + legacy_path, + "new_identity_restart", + {"%1$S": TERM_REFERENCE("brand-short-name")}, + ), + ), + ], + ), + ], + ) View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/96… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/compare/96… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][base-browser-115.9.0esr-13.5-1] 3 commits: fixup! Bug 40926: Implemented the New Identity feature
by richard (@richard) 20 Mar '24

20 Mar '24
richard pushed to branch base-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: 83797a6f by Henry Wilkes at 2024-03-20T20:50:50+00:00 fixup! Bug 40926: Implemented the New Identity feature Bug 42211: Migrate to Fluent. - - - - - d7d04937 by Henry Wilkes at 2024-03-20T20:50:58+00:00 fixup! Base Browser strings Bug 42211: Migrate new identity to Fluent. Also change some strings to sentence case in en-US. Also removed the hard-coded &quot;Tor Browser&quot;, which is not appropriate in base-browser (e.g. for Mullvad Browser). - - - - - 57b8a1d5 by Henry Wilkes at 2024-03-20T20:51:09+00:00 fixup! Tor Browser localization migration scripts. Bug 42211: Migrate new identity strings to Fluent. - - - - - 10 changed files: - browser/base/content/appmenu-viewcache.inc.xhtml - browser/base/content/browser-menubar.inc - browser/base/content/navigator-toolbox.inc.xhtml - browser/components/newidentity/content/newIdentityDialog.js - browser/components/newidentity/content/newIdentityDialog.xhtml - browser/components/newidentity/content/newidentity.js - browser/locales/en-US/browser/base-browser.ftl - − browser/locales/en-US/chrome/browser/newIdentity.properties - browser/locales/jar.mn - + tools/torbrowser/l10n/migrations/bug-42211-new-identity.py Changes: ===================================== browser/base/content/appmenu-viewcache.inc.xhtml ===================================== @@ -57,6 +57,7 @@ <toolbarseparator/> <toolbarbutton id="appMenu-new-identity" class="subviewbutton" + data-l10n-id="appmenuitem-new-identity" key="new-identity-key"/> <toolbarseparator/> <toolbarbutton id="appMenu-bookmarks-button" ===================================== browser/base/content/browser-menubar.inc ===================================== @@ -30,7 +30,7 @@ key="key_privatebrowsing" data-l10n-id="menu-file-new-private-window"/> <menuseparator/> <menuitem id="menu_newIdentity" - key="new-identity-key"/> + key="new-identity-key" data-l10n-id="menu-new-identity"/> <menuseparator/> <menuitem id="menu_openLocation" hidden="true" ===================================== browser/base/content/navigator-toolbox.inc.xhtml ===================================== @@ -590,7 +590,8 @@ ondragover="newWindowButtonObserver.onDragOver(event)" ondragenter="newWindowButtonObserver.onDragOver(event)"/> - <toolbarbutton id="new-identity-button" class="toolbarbutton-1 chromeclass-toolbar-additional"/> + <toolbarbutton id="new-identity-button" class="toolbarbutton-1 chromeclass-toolbar-additional" + data-l10n-id="toolbar-new-identity"/> <toolbarbutton id="fullscreen-button" class="toolbarbutton-1 chromeclass-toolbar-additional" observes="View:FullScreen" ===================================== browser/components/newidentity/content/newIdentityDialog.js ===================================== @@ -5,20 +5,13 @@ document.addEventListener("dialogaccept", () => { const retvals = window.arguments[0]; retvals.confirmed = true; - retvals.neverAskAgain = document.querySelector("#neverAskAgain").checked; + retvals.neverAskAgain = document.getElementById("neverAskAgain").checked; }); document.addEventListener("DOMContentLoaded", () => { - const { NewIdentityStrings } = window.arguments[0]; - const dialog = document.querySelector("#newIdentityDialog"); + const dialog = document.getElementById("newIdentityDialog"); - dialog.querySelector("#infoTitle").textContent = - NewIdentityStrings.new_identity_prompt_title; - dialog.querySelector("#infoBody").textContent = - NewIdentityStrings.new_identity_prompt; - dialog.querySelector("#neverAskAgain").label = - NewIdentityStrings.new_identity_ask_again; const accept = dialog.getButton("accept"); - accept.label = NewIdentityStrings.new_identity_restart; + document.l10n.setAttributes(accept, "new-identity-dialog-confirm"); accept.classList.add("danger-button"); }); ===================================== browser/components/newidentity/content/newIdentityDialog.xhtml ===================================== @@ -21,9 +21,8 @@ > <dialog id="newIdentityDialog" buttons="accept,cancel" defaultButton="accept"> <linkset> - <!-- Without this document.l10n is not initialized, and we need it for the - cancel button. --> <html:link rel="localization" href="branding/brand.ftl" /> + <html:link rel="localization" href="browser/base-browser.ftl" /> </linkset> <div xmlns="http://www.w3.org/1999/xhtml"> @@ -33,13 +32,18 @@ <xul:image id="infoIcon" /> </div> <div id="infoContainer"> - <xul:description id="infoTitle" /> + <xul:description + id="infoTitle" + data-l10n-id="new-identity-dialog-title" + /> <xul:description id="infoBody" - context="contentAreaContextMenu" - noinitialfocus="true" + data-l10n-id="new-identity-dialog-description" + /> + <xul:checkbox + id="neverAskAgain" + data-l10n-id="new-identity-dialog-never-ask-checkbox" /> - <xul:checkbox id="neverAskAgain" /> </div> </div> </div> ===================================== browser/components/newidentity/content/newidentity.js ===================================== @@ -1,40 +1,6 @@ "use strict"; -/* globals CustomizableUI Services gFindBarInitialized gFindBar - OpenBrowserWindow PrivateBrowsingUtils XPCOMUtils - */ - -XPCOMUtils.defineLazyGetter(this, "NewIdentityStrings", () => { - const brandBundle = Services.strings.createBundle( - "chrome://branding/locale/brand.properties" - ); - const brandShortName = brandBundle.GetStringFromName("brandShortName"); - - const fallbackBundle = Services.strings.createBundle( - "resource:///chrome/en-US/locale/browser/newIdentity.properties" - ); - const strings = {}; - const brandedStrings = ["new_identity_prompt", "new_identity_restart"]; - for (let { key } of fallbackBundle.getSimpleEnumeration()) { - strings[key] = fallbackBundle.GetStringFromName(key); - } - try { - const bundle = Services.strings.createBundle( - "chrome://browser/locale/newIdentity.properties" - ); - for (const key of Object.keys(strings)) { - try { - strings[key] = bundle.GetStringFromName(key); - } catch (e) {} - } - } catch (e) { - console.warn("Could not load localized New Identity strings"); - } - for (let key of brandedStrings) { - strings[key] = strings[key].replaceAll("%S", brandShortName); - } - return strings; -}); +/* eslint-env mozilla/browser-window */ // Use a lazy getter because NewIdentityButton is declared more than once // otherwise. @@ -471,11 +437,6 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => { // malformed URL, bail out return; } - const label = - NewIdentityStrings.new_identity_home_notification.replace( - "%S", - displayAddress - ); const callback = () => { Services.prefs.setStringPref(trustedHomePref, homeURL); win.BrowserHome(); @@ -484,12 +445,15 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => { notificationBox.appendNotification( "new-identity-safe-home", { - label, + label: { + "l10n-id": "new-identity-blocked-home-notification", + "l10n-args": { url: displayAddress }, + }, priority: notificationBox.PRIORITY_INFO_MEDIUM, }, [ { - label: NewIdentityStrings.new_identity_home_load_button, + "l10n-id": "new-identity-blocked-home-ignore-button", callback, }, ] @@ -550,37 +514,20 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => { const button = document.getElementById("new-identity-button") || window.gNavToolbox.palette.querySelector("#new-identity-button"); - if (button) { - button.setAttribute("tooltiptext", NewIdentityStrings.new_identity); - // Include an equal label, shown in the overflow menu or during - // customization. - button.setAttribute("label", NewIdentityStrings.new_identity); - button.addEventListener("command", () => { - this.onCommand(); - }); - } - const viewCache = document.getElementById("appMenu-viewCache").content; - const appButton = viewCache.querySelector("#appMenu-new-identity"); - if (appButton) { - appButton.setAttribute( - "label", - NewIdentityStrings.new_identity_sentence_case - ); - appButton.addEventListener("command", () => { + button?.addEventListener("command", () => { + this.onCommand(); + }); + document + .getElementById("appMenu-viewCache") + .content.querySelector("#appMenu-new-identity") + ?.addEventListener("command", () => { this.onCommand(); }); - } - const menu = document.querySelector("#menu_newIdentity"); - if (menu) { - menu.setAttribute("label", NewIdentityStrings.new_identity); - menu.setAttribute( - "accesskey", - NewIdentityStrings.new_identity_menu_accesskey - ); - menu.addEventListener("command", () => { + document + .getElementById("menu_newIdentity") + ?.addEventListener("command", () => { this.onCommand(); }); - } }, uninit() {}, @@ -598,7 +545,6 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => { const shouldConfirm = Services.prefs.getBoolPref(prefConfirm, true); if (shouldConfirm) { const params = { - NewIdentityStrings, confirmed: false, neverAskAgain: false, }; ===================================== browser/locales/en-US/browser/base-browser.ftl ===================================== @@ -11,20 +11,19 @@ language-notification-label-system = { -brand-short-name } has set your display language-notification-label = { -brand-short-name } has set your display language to { $language }. language-notification-button = Change Language… - ## Fullscreen/maximization notification shown when letterboxing is disabled basebrowser-rfp-maximize-warning-message = Maximizing the browser window can allow websites to determine your monitor size, which can be used to track you. We recommend that you leave browser windows in their original default size. basebrowser-rfp-restore-window-size-button-label = Restore basebrowser-rfp-restore-window-size-button-ak = R - ## Tooltip for the about:addons recommended badge basebrowser-addon-badge-recommended = Mozilla only recommends extensions that meet their standards for security and performance basebrowser-addon-badge-verified = Mozilla has reviewed this extension to meet their standards for security and performance ## Option to show or hide the NoScript extension button/item. + basebrowser-addon-noscript-visibility-label = Toolbar button basebrowser-addon-noscript-visibility-show = Show basebrowser-addon-noscript-visibility-hide = Hide @@ -35,3 +34,39 @@ basebrowser-addon-noscript-visibility-hide = Hide # $version (String) - The current browser version. E.g. "12.5.3". # $firefoxVersion (String) - The version number of Firefox the current browser is based on. E.g. "102.15.0esr". basebrowser-about-dialog-version = { $version } (based on Mozilla Firefox { $firefoxVersion }) + +## New identity. + +# File menu items use title case for English (US). +menu-new-identity = + .label = New Identity + .accesskey = I + +# App menu (hamburger menu) items use sentence case for English (US). +appmenuitem-new-identity = + .label = New identity + +# Uses sentence case for English (US). +# ".label" is the accessible name, and is visible in the overflow menu and when +# customizing the toolbar. +# ".tooltiptext" will be identical to the label. +toolbar-new-identity = + .label = New identity + .tooltiptext = { toolbar-new-identity.label } + +## New identity dialog. + +new-identity-dialog-title = Reset your identity? +new-identity-dialog-description = { -brand-short-name } will close all windows and tabs. All website sessions will be lost. +new-identity-dialog-never-ask-checkbox = + .label = Never ask me again +new-identity-dialog-confirm = + .label = Restart { -brand-short-name } + +## New identity: blocked home page notification. + +# '-brand-short-name' is the localized browser name, like "Tor Browser". +# $url (String) - The URL of the home page, possibly shortened. +new-identity-blocked-home-notification = { -brand-short-name } blocked your homepage ({ $url }) from loading because it might recognize your previous session. +# Button to continue loading the home page, despite the warning message. +new-identity-blocked-home-ignore-button = Load it anyway ===================================== browser/locales/en-US/chrome/browser/newIdentity.properties deleted ===================================== @@ -1,13 +0,0 @@ -new_identity = New Identity -# This is the string for the hamburger menu -new_identity_sentence_case = New identity -# %S is the application name. Keep it as a placeholder -new_identity_prompt_title = Reset your identity? -new_identity_prompt = %S will close all windows and tabs. All website sessions will be lost. \nRestart %S now to reset your identity? -new_identity_restart = Restart %S -new_identity_ask_again = Never ask me again -# Shown in the File menu (use Alt to show File, if you do not see) -new_identity_menu_accesskey = I -new_identity_home_notification = Tor Browser blocked your homepage (%S) from loading because it might recognize your previous session. -# %S is replaced with the custom homepage URL's domain if applicable, or some short-hand of it otherwise -new_identity_home_load_button = Load it anyway ===================================== browser/locales/jar.mn ===================================== @@ -33,5 +33,4 @@ locale/browser/feeds/subscribe.properties (%chrome/browser/feeds/subscribe.properties) locale/browser/syncSetup.properties (%chrome/browser/syncSetup.properties) locale/browser/securityLevel.properties (%chrome/browser/securityLevel.properties) - locale/browser/newIdentity.properties (%chrome/browser/newIdentity.properties) % locale browser-region @AB_CD@ %locale/browser-region/ ===================================== tools/torbrowser/l10n/migrations/bug-42211-new-identity.py ===================================== @@ -0,0 +1,48 @@ +import fluent.syntax.ast as FTL +from fluent.migrate.helpers import TERM_REFERENCE, transforms_from +from fluent.migrate.transforms import REPLACE + + +def migrate(ctx): + legacy_path = "newIdentity.properties" + + ctx.add_transforms( + "base-browser.ftl", + "base-browser.ftl", + transforms_from( + """ +menu-new-identity = + .label = { COPY(path, "new_identity") } + .accesskey = { COPY(path, "new_identity_menu_accesskey") } +appmenuitem-new-identity = + .label = { COPY(path, "new_identity_sentence_case") } +toolbar-new-identity = + .label = { COPY(path, "new_identity_sentence_case") } + .tooltiptext = { toolbar-new-identity.label } + +new-identity-dialog-title = { COPY(path, "new_identity_prompt_title") } +new-identity-dialog-never-ask-checkbox = + .label = { COPY(path, "new_identity_ask_again") } + +new-identity-blocked-home-ignore-button = { COPY(path, "new_identity_home_load_button") } +""", + path=legacy_path, + ) + + [ + # Replace "%S" with "{ -brand-short-name }" in confirm button. + FTL.Message( + id=FTL.Identifier("new-identity-dialog-confirm"), + value=None, + attributes=[ + FTL.Attribute( + id=FTL.Identifier("label"), + value=REPLACE( + legacy_path, + "new_identity_restart", + {"%1$S": TERM_REFERENCE("brand-short-name")}, + ), + ), + ], + ), + ], + ) View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/369e13… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/369e13… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.9.0esr-13.5-1] 3 commits: fixup! Bug 40926: Implemented the New Identity feature
by richard (@richard) 20 Mar '24

20 Mar '24
richard pushed to branch tor-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: 9ef44caa by Henry Wilkes at 2024-03-20T12:24:28+00:00 fixup! Bug 40926: Implemented the New Identity feature Bug 42211: Migrate to Fluent. - - - - - 93302237 by Henry Wilkes at 2024-03-20T12:24:28+00:00 fixup! Base Browser strings Bug 42211: Migrate new identity to Fluent. Also change some strings to sentence case in en-US. Also removed the hard-coded &quot;Tor Browser&quot;, which is not appropriate in base-browser (e.g. for Mullvad Browser). - - - - - 124ce63b by Henry Wilkes at 2024-03-20T12:24:29+00:00 fixup! Tor Browser localization migration scripts. Bug 42211: Migrate new identity strings to Fluent. - - - - - 10 changed files: - browser/base/content/appmenu-viewcache.inc.xhtml - browser/base/content/browser-menubar.inc - browser/base/content/navigator-toolbox.inc.xhtml - browser/components/newidentity/content/newIdentityDialog.js - browser/components/newidentity/content/newIdentityDialog.xhtml - browser/components/newidentity/content/newidentity.js - browser/locales/en-US/browser/base-browser.ftl - − browser/locales/en-US/chrome/browser/newIdentity.properties - browser/locales/jar.mn - + tools/torbrowser/l10n/migrations/bug-42211-new-identity.py Changes: ===================================== browser/base/content/appmenu-viewcache.inc.xhtml ===================================== @@ -57,6 +57,7 @@ <toolbarseparator/> <toolbarbutton id="appMenu-new-identity" class="subviewbutton" + data-l10n-id="appmenuitem-new-identity" key="new-identity-key"/> <toolbarbutton id="appMenuNewCircuit" class="subviewbutton" ===================================== browser/base/content/browser-menubar.inc ===================================== @@ -30,7 +30,7 @@ key="key_privatebrowsing" data-l10n-id="menu-file-new-private-window"/> <menuseparator/> <menuitem id="menu_newIdentity" - key="new-identity-key"/> + key="new-identity-key" data-l10n-id="menu-new-identity"/> <menuitem id="menu_newCircuit" accesskey="&torbutton.context_menu.new_circuit_key;" key="new-circuit-key" ===================================== browser/base/content/navigator-toolbox.inc.xhtml ===================================== @@ -617,7 +617,8 @@ ondragover="newWindowButtonObserver.onDragOver(event)" ondragenter="newWindowButtonObserver.onDragOver(event)"/> - <toolbarbutton id="new-identity-button" class="toolbarbutton-1 chromeclass-toolbar-additional"/> + <toolbarbutton id="new-identity-button" class="toolbarbutton-1 chromeclass-toolbar-additional" + data-l10n-id="toolbar-new-identity"/> <toolbarbutton id="new-circuit-button" class="toolbarbutton-1 chromeclass-toolbar-additional" label="&torbutton.context_menu.new_circuit;" ===================================== browser/components/newidentity/content/newIdentityDialog.js ===================================== @@ -5,20 +5,13 @@ document.addEventListener("dialogaccept", () => { const retvals = window.arguments[0]; retvals.confirmed = true; - retvals.neverAskAgain = document.querySelector("#neverAskAgain").checked; + retvals.neverAskAgain = document.getElementById("neverAskAgain").checked; }); document.addEventListener("DOMContentLoaded", () => { - const { NewIdentityStrings } = window.arguments[0]; - const dialog = document.querySelector("#newIdentityDialog"); + const dialog = document.getElementById("newIdentityDialog"); - dialog.querySelector("#infoTitle").textContent = - NewIdentityStrings.new_identity_prompt_title; - dialog.querySelector("#infoBody").textContent = - NewIdentityStrings.new_identity_prompt; - dialog.querySelector("#neverAskAgain").label = - NewIdentityStrings.new_identity_ask_again; const accept = dialog.getButton("accept"); - accept.label = NewIdentityStrings.new_identity_restart; + document.l10n.setAttributes(accept, "new-identity-dialog-confirm"); accept.classList.add("danger-button"); }); ===================================== browser/components/newidentity/content/newIdentityDialog.xhtml ===================================== @@ -21,9 +21,8 @@ > <dialog id="newIdentityDialog" buttons="accept,cancel" defaultButton="accept"> <linkset> - <!-- Without this document.l10n is not initialized, and we need it for the - cancel button. --> <html:link rel="localization" href="branding/brand.ftl" /> + <html:link rel="localization" href="browser/base-browser.ftl" /> </linkset> <div xmlns="http://www.w3.org/1999/xhtml"> @@ -33,13 +32,18 @@ <xul:image id="infoIcon" /> </div> <div id="infoContainer"> - <xul:description id="infoTitle" /> + <xul:description + id="infoTitle" + data-l10n-id="new-identity-dialog-title" + /> <xul:description id="infoBody" - context="contentAreaContextMenu" - noinitialfocus="true" + data-l10n-id="new-identity-dialog-description" + /> + <xul:checkbox + id="neverAskAgain" + data-l10n-id="new-identity-dialog-never-ask-checkbox" /> - <xul:checkbox id="neverAskAgain" /> </div> </div> </div> ===================================== browser/components/newidentity/content/newidentity.js ===================================== @@ -1,40 +1,6 @@ "use strict"; -/* globals CustomizableUI Services gFindBarInitialized gFindBar - OpenBrowserWindow PrivateBrowsingUtils XPCOMUtils - */ - -XPCOMUtils.defineLazyGetter(this, "NewIdentityStrings", () => { - const brandBundle = Services.strings.createBundle( - "chrome://branding/locale/brand.properties" - ); - const brandShortName = brandBundle.GetStringFromName("brandShortName"); - - const fallbackBundle = Services.strings.createBundle( - "resource:///chrome/en-US/locale/browser/newIdentity.properties" - ); - const strings = {}; - const brandedStrings = ["new_identity_prompt", "new_identity_restart"]; - for (let { key } of fallbackBundle.getSimpleEnumeration()) { - strings[key] = fallbackBundle.GetStringFromName(key); - } - try { - const bundle = Services.strings.createBundle( - "chrome://browser/locale/newIdentity.properties" - ); - for (const key of Object.keys(strings)) { - try { - strings[key] = bundle.GetStringFromName(key); - } catch (e) {} - } - } catch (e) { - console.warn("Could not load localized New Identity strings"); - } - for (let key of brandedStrings) { - strings[key] = strings[key].replaceAll("%S", brandShortName); - } - return strings; -}); +/* eslint-env mozilla/browser-window */ // Use a lazy getter because NewIdentityButton is declared more than once // otherwise. @@ -471,11 +437,6 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => { // malformed URL, bail out return; } - const label = - NewIdentityStrings.new_identity_home_notification.replace( - "%S", - displayAddress - ); const callback = () => { Services.prefs.setStringPref(trustedHomePref, homeURL); win.BrowserHome(); @@ -484,12 +445,15 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => { notificationBox.appendNotification( "new-identity-safe-home", { - label, + label: { + "l10n-id": "new-identity-blocked-home-notification", + "l10n-args": { url: displayAddress }, + }, priority: notificationBox.PRIORITY_INFO_MEDIUM, }, [ { - label: NewIdentityStrings.new_identity_home_load_button, + "l10n-id": "new-identity-blocked-home-ignore-button", callback, }, ] @@ -550,37 +514,20 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => { const button = document.getElementById("new-identity-button") || window.gNavToolbox.palette.querySelector("#new-identity-button"); - if (button) { - button.setAttribute("tooltiptext", NewIdentityStrings.new_identity); - // Include an equal label, shown in the overflow menu or during - // customization. - button.setAttribute("label", NewIdentityStrings.new_identity); - button.addEventListener("command", () => { - this.onCommand(); - }); - } - const viewCache = document.getElementById("appMenu-viewCache").content; - const appButton = viewCache.querySelector("#appMenu-new-identity"); - if (appButton) { - appButton.setAttribute( - "label", - NewIdentityStrings.new_identity_sentence_case - ); - appButton.addEventListener("command", () => { + button?.addEventListener("command", () => { + this.onCommand(); + }); + document + .getElementById("appMenu-viewCache") + .content.querySelector("#appMenu-new-identity") + ?.addEventListener("command", () => { this.onCommand(); }); - } - const menu = document.querySelector("#menu_newIdentity"); - if (menu) { - menu.setAttribute("label", NewIdentityStrings.new_identity); - menu.setAttribute( - "accesskey", - NewIdentityStrings.new_identity_menu_accesskey - ); - menu.addEventListener("command", () => { + document + .getElementById("menu_newIdentity") + ?.addEventListener("command", () => { this.onCommand(); }); - } }, uninit() {}, @@ -598,7 +545,6 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => { const shouldConfirm = Services.prefs.getBoolPref(prefConfirm, true); if (shouldConfirm) { const params = { - NewIdentityStrings, confirmed: false, neverAskAgain: false, }; ===================================== browser/locales/en-US/browser/base-browser.ftl ===================================== @@ -11,20 +11,19 @@ language-notification-label-system = { -brand-short-name } has set your display language-notification-label = { -brand-short-name } has set your display language to { $language }. language-notification-button = Change Language… - ## Fullscreen/maximization notification shown when letterboxing is disabled basebrowser-rfp-maximize-warning-message = Maximizing the browser window can allow websites to determine your monitor size, which can be used to track you. We recommend that you leave browser windows in their original default size. basebrowser-rfp-restore-window-size-button-label = Restore basebrowser-rfp-restore-window-size-button-ak = R - ## Tooltip for the about:addons recommended badge basebrowser-addon-badge-recommended = Mozilla only recommends extensions that meet their standards for security and performance basebrowser-addon-badge-verified = Mozilla has reviewed this extension to meet their standards for security and performance ## Option to show or hide the NoScript extension button/item. + basebrowser-addon-noscript-visibility-label = Toolbar button basebrowser-addon-noscript-visibility-show = Show basebrowser-addon-noscript-visibility-hide = Hide @@ -35,3 +34,39 @@ basebrowser-addon-noscript-visibility-hide = Hide # $version (String) - The current browser version. E.g. "12.5.3". # $firefoxVersion (String) - The version number of Firefox the current browser is based on. E.g. "102.15.0esr". basebrowser-about-dialog-version = { $version } (based on Mozilla Firefox { $firefoxVersion }) + +## New identity. + +# File menu items use title case for English (US). +menu-new-identity = + .label = New Identity + .accesskey = I + +# App menu (hamburger menu) items use sentence case for English (US). +appmenuitem-new-identity = + .label = New identity + +# Uses sentence case for English (US). +# ".label" is the accessible name, and is visible in the overflow menu and when +# customizing the toolbar. +# ".tooltiptext" will be identical to the label. +toolbar-new-identity = + .label = New identity + .tooltiptext = { toolbar-new-identity.label } + +## New identity dialog. + +new-identity-dialog-title = Reset your identity? +new-identity-dialog-description = { -brand-short-name } will close all windows and tabs. All website sessions will be lost. +new-identity-dialog-never-ask-checkbox = + .label = Never ask me again +new-identity-dialog-confirm = + .label = Restart { -brand-short-name } + +## New identity: blocked home page notification. + +# '-brand-short-name' is the localized browser name, like "Tor Browser". +# $url (String) - The URL of the home page, possibly shortened. +new-identity-blocked-home-notification = { -brand-short-name } blocked your homepage ({ $url }) from loading because it might recognize your previous session. +# Button to continue loading the home page, despite the warning message. +new-identity-blocked-home-ignore-button = Load it anyway ===================================== browser/locales/en-US/chrome/browser/newIdentity.properties deleted ===================================== @@ -1,13 +0,0 @@ -new_identity = New Identity -# This is the string for the hamburger menu -new_identity_sentence_case = New identity -# %S is the application name. Keep it as a placeholder -new_identity_prompt_title = Reset your identity? -new_identity_prompt = %S will close all windows and tabs. All website sessions will be lost. \nRestart %S now to reset your identity? -new_identity_restart = Restart %S -new_identity_ask_again = Never ask me again -# Shown in the File menu (use Alt to show File, if you do not see) -new_identity_menu_accesskey = I -new_identity_home_notification = Tor Browser blocked your homepage (%S) from loading because it might recognize your previous session. -# %S is replaced with the custom homepage URL's domain if applicable, or some short-hand of it otherwise -new_identity_home_load_button = Load it anyway ===================================== browser/locales/jar.mn ===================================== @@ -34,6 +34,5 @@ locale/browser/feeds/subscribe.properties (%chrome/browser/feeds/subscribe.properties) locale/browser/syncSetup.properties (%chrome/browser/syncSetup.properties) locale/browser/securityLevel.properties (%chrome/browser/securityLevel.properties) - locale/browser/newIdentity.properties (%chrome/browser/newIdentity.properties) locale/browser/cryptoSafetyPrompt.properties (%chrome/browser/cryptoSafetyPrompt.properties) % locale browser-region @AB_CD@ %locale/browser-region/ ===================================== tools/torbrowser/l10n/migrations/bug-42211-new-identity.py ===================================== @@ -0,0 +1,48 @@ +import fluent.syntax.ast as FTL +from fluent.migrate.helpers import TERM_REFERENCE, transforms_from +from fluent.migrate.transforms import REPLACE + + +def migrate(ctx): + legacy_path = "newIdentity.properties" + + ctx.add_transforms( + "base-browser.ftl", + "base-browser.ftl", + transforms_from( + """ +menu-new-identity = + .label = { COPY(path, "new_identity") } + .accesskey = { COPY(path, "new_identity_menu_accesskey") } +appmenuitem-new-identity = + .label = { COPY(path, "new_identity_sentence_case") } +toolbar-new-identity = + .label = { COPY(path, "new_identity_sentence_case") } + .tooltiptext = { toolbar-new-identity.label } + +new-identity-dialog-title = { COPY(path, "new_identity_prompt_title") } +new-identity-dialog-never-ask-checkbox = + .label = { COPY(path, "new_identity_ask_again") } + +new-identity-blocked-home-ignore-button = { COPY(path, "new_identity_home_load_button") } +""", + path=legacy_path, + ) + + [ + # Replace "%S" with "{ -brand-short-name }" in confirm button. + FTL.Message( + id=FTL.Identifier("new-identity-dialog-confirm"), + value=None, + attributes=[ + FTL.Attribute( + id=FTL.Identifier("label"), + value=REPLACE( + legacy_path, + "new_identity_restart", + {"%1$S": TERM_REFERENCE("brand-short-name")}, + ), + ), + ], + ), + ], + ) View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/c122e1… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/c122e1… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/mullvad-browser][mullvad-browser-115.9.0esr-13.5-1] Bug 42428: Make RFP spoof the timezone of document.lastModified.
by Pier Angelo Vendrame (@pierov) 20 Mar '24

20 Mar '24
Pier Angelo Vendrame pushed to branch mullvad-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser Commits: 96ab6401 by Pier Angelo Vendrame at 2024-03-20T11:06:04+01:00 Bug 42428: Make RFP spoof the timezone of document.lastModified. - - - - - 1 changed file: - dom/base/Document.cpp Changes: ===================================== dom/base/Document.cpp ===================================== @@ -4103,10 +4103,11 @@ void Document::SetDocumentURI(nsIURI* aURI) { } } -static void GetFormattedTimeString(PRTime aTime, +static void GetFormattedTimeString(PRTime aTime, bool aUniversal, nsAString& aFormattedTimeString) { PRExplodedTime prtime; - PR_ExplodeTime(aTime, PR_LocalTimeParameters, &prtime); + PR_ExplodeTime(aTime, aUniversal ? PR_GMTParameters : PR_LocalTimeParameters, + &prtime); // "MM/DD/YYYY hh:mm:ss" char formatedTime[24]; if (SprintfLiteral(formatedTime, "%02d/%02d/%04d %02d:%02d:%02d", @@ -4124,7 +4125,9 @@ void Document::GetLastModified(nsAString& aLastModified) const { if (!mLastModified.IsEmpty()) { aLastModified.Assign(mLastModified); } else { - GetFormattedTimeString(PR_Now(), aLastModified); + GetFormattedTimeString(PR_Now(), + ShouldResistFingerprinting(RFPTarget::Unknown), + aLastModified); } } @@ -11053,7 +11056,8 @@ void Document::RetrieveRelevantHeaders(nsIChannel* aChannel) { mLastModified.Truncate(); if (modDate != 0) { - GetFormattedTimeString(modDate, mLastModified); + GetFormattedTimeString( + modDate, ShouldResistFingerprinting(RFPTarget::Unknown), mLastModified); } } View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/96a… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/96a… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][base-browser-115.9.0esr-13.5-1] Bug 42428: Make RFP spoof the timezone of document.lastModified.
by Pier Angelo Vendrame (@pierov) 20 Mar '24

20 Mar '24
Pier Angelo Vendrame pushed to branch base-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: 369e1367 by Pier Angelo Vendrame at 2024-03-20T11:05:38+01:00 Bug 42428: Make RFP spoof the timezone of document.lastModified. - - - - - 1 changed file: - dom/base/Document.cpp Changes: ===================================== dom/base/Document.cpp ===================================== @@ -4103,10 +4103,11 @@ void Document::SetDocumentURI(nsIURI* aURI) { } } -static void GetFormattedTimeString(PRTime aTime, +static void GetFormattedTimeString(PRTime aTime, bool aUniversal, nsAString& aFormattedTimeString) { PRExplodedTime prtime; - PR_ExplodeTime(aTime, PR_LocalTimeParameters, &prtime); + PR_ExplodeTime(aTime, aUniversal ? PR_GMTParameters : PR_LocalTimeParameters, + &prtime); // "MM/DD/YYYY hh:mm:ss" char formatedTime[24]; if (SprintfLiteral(formatedTime, "%02d/%02d/%04d %02d:%02d:%02d", @@ -4124,7 +4125,9 @@ void Document::GetLastModified(nsAString& aLastModified) const { if (!mLastModified.IsEmpty()) { aLastModified.Assign(mLastModified); } else { - GetFormattedTimeString(PR_Now(), aLastModified); + GetFormattedTimeString(PR_Now(), + ShouldResistFingerprinting(RFPTarget::Unknown), + aLastModified); } } @@ -11053,7 +11056,8 @@ void Document::RetrieveRelevantHeaders(nsIChannel* aChannel) { mLastModified.Truncate(); if (modDate != 0) { - GetFormattedTimeString(modDate, mLastModified); + GetFormattedTimeString( + modDate, ShouldResistFingerprinting(RFPTarget::Unknown), mLastModified); } } View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/369e136… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/369e136… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-115.9.0esr-13.5-1] Bug 42428: Make RFP spoof the timezone of document.lastModified.
by Pier Angelo Vendrame (@pierov) 20 Mar '24

20 Mar '24
Pier Angelo Vendrame pushed to branch tor-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser Commits: c122e13b by Pier Angelo Vendrame at 2024-03-20T10:47:58+01:00 Bug 42428: Make RFP spoof the timezone of document.lastModified. - - - - - 1 changed file: - dom/base/Document.cpp Changes: ===================================== dom/base/Document.cpp ===================================== @@ -4104,10 +4104,11 @@ void Document::SetDocumentURI(nsIURI* aURI) { } } -static void GetFormattedTimeString(PRTime aTime, +static void GetFormattedTimeString(PRTime aTime, bool aUniversal, nsAString& aFormattedTimeString) { PRExplodedTime prtime; - PR_ExplodeTime(aTime, PR_LocalTimeParameters, &prtime); + PR_ExplodeTime(aTime, aUniversal ? PR_GMTParameters : PR_LocalTimeParameters, + &prtime); // "MM/DD/YYYY hh:mm:ss" char formatedTime[24]; if (SprintfLiteral(formatedTime, "%02d/%02d/%04d %02d:%02d:%02d", @@ -4125,7 +4126,9 @@ void Document::GetLastModified(nsAString& aLastModified) const { if (!mLastModified.IsEmpty()) { aLastModified.Assign(mLastModified); } else { - GetFormattedTimeString(PR_Now(), aLastModified); + GetFormattedTimeString(PR_Now(), + ShouldResistFingerprinting(RFPTarget::Unknown), + aLastModified); } } @@ -11113,7 +11116,8 @@ void Document::RetrieveRelevantHeaders(nsIChannel* aChannel) { mLastModified.Truncate(); if (modDate != 0) { - GetFormattedTimeString(modDate, mLastModified); + GetFormattedTimeString( + modDate, ShouldResistFingerprinting(RFPTarget::Unknown), mLastModified); } } View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/c122e13… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/c122e13… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
  • ← Newer
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • ...
  • 18
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.