Pier Angelo Vendrame pushed to branch tor-browser-128.4.0esr-14.5-1 at The Tor Project / Applications / Tor Browser
Commits: 385447ad by Pier Angelo Vendrame at 2024-10-31T19:10:50+01:00 dropme! Bug 32308: Use direct browser sizing for letterboxing.
Revert a couple of lines to make the backport easier.
- - - - - 4a33efb7 by hackademix at 2024-10-31T19:10:51+01:00 Bug 1556002 - Update initial window size and letterboxing stepping. r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D226598
- - - - - 036aaa05 by Pier Angelo Vendrame at 2024-10-31T19:13:04+01:00 fixup! Bug 32308: Use direct browser sizing for letterboxing.
Restore our changes after backporting MozBug 1556002.
- - - - - 8a4eb9d3 by Pier Angelo Vendrame at 2024-10-31T19:13:50+01:00 fixup! Firefox preference overrides.
Remove our custom letterboxing size, since they are going to be also Firefox's default one after MozBug 1556002.
- - - - -
6 changed files:
- browser/app/profile/001-base-profile.js - browser/components/resistfingerprinting/test/browser/browser_dynamical_window_rounding.js - browser/components/resistfingerprinting/test/browser/browser_roundedWindow_open_max_inner.js - browser/components/resistfingerprinting/test/browser/head.js - modules/libpref/init/StaticPrefList.yaml - toolkit/components/resistfingerprinting/RFPHelper.sys.mjs
Changes:
===================================== browser/app/profile/001-base-profile.js ===================================== @@ -445,9 +445,6 @@ pref("privacy.resistFingerprinting.letterboxing.gradient", true); pref("privacy.resistFingerprinting.letterboxing.rememberSize", false); // tor-browser#41695: how many warnings we show if user closes them without restoring the window size pref("privacy.resistFingerprinting.resizeWarnings", 3); -// tor-browser#33282: new windows start at 1400x900 when there's enough screen space, otherwise down by 200x100 blocks -pref("privacy.window.maxInnerWidth", 1400); -pref("privacy.window.maxInnerHeight", 900); // Enforce Network Information API as disabled pref("dom.netinfo.enabled", false); pref("network.http.referer.defaultPolicy", 2); // Bug 32948: Make referer behavior consistent regardless of private browing mode status
===================================== browser/components/resistfingerprinting/test/browser/browser_dynamical_window_rounding.js ===================================== @@ -53,8 +53,8 @@ function checkForDefaultSetting( aRealHeight ) { // We can get the rounded size by subtracting twice the margin. - let targetWidth = aRealWidth - 2 * RFPHelper.steppedRange(aRealWidth); - let targetHeight = aRealHeight - 2 * RFPHelper.steppedRange(aRealHeight); + let targetWidth = aRealWidth - 2 * RFPHelper.steppedSize(aRealWidth, true); + let targetHeight = aRealHeight - 2 * RFPHelper.steppedSize(aRealHeight);
// This platform-specific code is explained in the large comment below. if (getPlatform() != "linux") {
===================================== browser/components/resistfingerprinting/test/browser/browser_roundedWindow_open_max_inner.js ===================================== @@ -4,23 +4,26 @@ * maximum values. */
+let targetWidth = Services.prefs.getIntPref("privacy.window.maxInnerWidth"); +let targetHeight = Services.prefs.getIntPref("privacy.window.maxInnerHeight"); + OpenTest.run([ { - settingWidth: 1025, - settingHeight: 1050, - targetWidth: 1000, - targetHeight: 1000, + settingWidth: targetWidth + 25, + settingHeight: targetHeight + 50, + targetWidth, + targetHeight, }, { settingWidth: 9999, settingHeight: 9999, - targetWidth: 1000, - targetHeight: 1000, + targetWidth, + targetHeight, }, { - settingWidth: 999, - settingHeight: 999, - targetWidth: 1000, - targetHeight: 1000, + settingWidth: targetWidth - 1, + settingHeight: targetHeight - 1, + targetWidth, + targetHeight, }, ]);
===================================== browser/components/resistfingerprinting/test/browser/head.js ===================================== @@ -306,19 +306,28 @@ async function calcMaximumAvailSize(aChromeWidth, aChromeHeight) { let availWidth = window.screen.availWidth; let availHeight = window.screen.availHeight;
- // Ideally, we would round the window size as 1000x1000. But the available - // screen space might not suffice. So, we decide the size according to the - // available screen size. - let availContentWidth = Math.min(1000, availWidth - chromeUIWidth); + // Ideally, we would round the window size as + // privacy.window.maxInnerWidth x privacy.window.maxInnerHeight. But the + // available screen space might not suffice. So, we decide the size according + // to the available screen size. + let maxInnerWidth = Services.prefs.getIntPref("privacy.window.maxInnerWidth"); + let maxInnerHeight = Services.prefs.getIntPref( + "privacy.window.maxInnerHeight" + ); + + let availContentWidth = Math.min(maxInnerWidth, availWidth - chromeUIWidth); let availContentHeight;
// If it is GTK window, we would consider the system decorations when we // calculating avail content height since the system decorations won't be // reported when we get available screen dimensions. if (AppConstants.MOZ_WIDGET_GTK) { - availContentHeight = Math.min(1000, -40 + availHeight - chromeUIHeight); + availContentHeight = Math.min( + maxInnerHeight, + -40 + availHeight - chromeUIHeight + ); } else { - availContentHeight = Math.min(1000, availHeight - chromeUIHeight); + availContentHeight = Math.min(maxInnerHeight, availHeight - chromeUIHeight); }
// Rounded the desire size to the nearest 200x100.
===================================== modules/libpref/init/StaticPrefList.yaml ===================================== @@ -14352,12 +14352,12 @@
- name: privacy.window.maxInnerWidth type: int32_t - value: 1000 + value: 1400 mirror: always
- name: privacy.window.maxInnerHeight type: int32_t - value: 1000 + value: 900 mirror: always
- name: privacy.sanitize.useOldClearHistoryDialog
===================================== toolkit/components/resistfingerprinting/RFPHelper.sys.mjs ===================================== @@ -522,14 +522,14 @@ class _RFPHelper { /** * Given a width or height, rounds it with the proper stepping. */ - steppedSize(aDimension, isWidth = false) { + steppedSize(aDimension, aIsWidth = false) { let stepping; if (aDimension <= 50) { return 0; } else if (aDimension <= 500) { stepping = 50; } else if (aDimension <= 1600) { - stepping = isWidth ? 200 : 100; + stepping = aIsWidth ? 200 : 100; } else { stepping = 200; }
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/3f690c6...