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
-
4a33efb7
by hackademix at 2024-10-31T19:10:51+01:00
-
036aaa05
by Pier Angelo Vendrame at 2024-10-31T19:13:04+01:00
-
8a4eb9d3
by Pier Angelo Vendrame at 2024-10-31T19:13:50+01:00
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:
| ... | ... | @@ -445,9 +445,6 @@ pref("privacy.resistFingerprinting.letterboxing.gradient", true); |
| 445 | 445 | pref("privacy.resistFingerprinting.letterboxing.rememberSize", false);
|
| 446 | 446 | // tor-browser#41695: how many warnings we show if user closes them without restoring the window size
|
| 447 | 447 | pref("privacy.resistFingerprinting.resizeWarnings", 3);
|
| 448 | -// tor-browser#33282: new windows start at 1400x900 when there's enough screen space, otherwise down by 200x100 blocks
|
|
| 449 | -pref("privacy.window.maxInnerWidth", 1400);
|
|
| 450 | -pref("privacy.window.maxInnerHeight", 900);
|
|
| 451 | 448 | // Enforce Network Information API as disabled
|
| 452 | 449 | pref("dom.netinfo.enabled", false);
|
| 453 | 450 | pref("network.http.referer.defaultPolicy", 2); // Bug 32948: Make referer behavior consistent regardless of private browing mode status
|
| ... | ... | @@ -53,8 +53,8 @@ function checkForDefaultSetting( |
| 53 | 53 | aRealHeight
|
| 54 | 54 | ) {
|
| 55 | 55 | // We can get the rounded size by subtracting twice the margin.
|
| 56 | - let targetWidth = aRealWidth - 2 * RFPHelper.steppedRange(aRealWidth);
|
|
| 57 | - let targetHeight = aRealHeight - 2 * RFPHelper.steppedRange(aRealHeight);
|
|
| 56 | + let targetWidth = aRealWidth - 2 * RFPHelper.steppedSize(aRealWidth, true);
|
|
| 57 | + let targetHeight = aRealHeight - 2 * RFPHelper.steppedSize(aRealHeight);
|
|
| 58 | 58 | |
| 59 | 59 | // This platform-specific code is explained in the large comment below.
|
| 60 | 60 | if (getPlatform() != "linux") {
|
| ... | ... | @@ -4,23 +4,26 @@ |
| 4 | 4 | * maximum values.
|
| 5 | 5 | */
|
| 6 | 6 | |
| 7 | +let targetWidth = Services.prefs.getIntPref("privacy.window.maxInnerWidth");
|
|
| 8 | +let targetHeight = Services.prefs.getIntPref("privacy.window.maxInnerHeight");
|
|
| 9 | + |
|
| 7 | 10 | OpenTest.run([
|
| 8 | 11 | {
|
| 9 | - settingWidth: 1025,
|
|
| 10 | - settingHeight: 1050,
|
|
| 11 | - targetWidth: 1000,
|
|
| 12 | - targetHeight: 1000,
|
|
| 12 | + settingWidth: targetWidth + 25,
|
|
| 13 | + settingHeight: targetHeight + 50,
|
|
| 14 | + targetWidth,
|
|
| 15 | + targetHeight,
|
|
| 13 | 16 | },
|
| 14 | 17 | {
|
| 15 | 18 | settingWidth: 9999,
|
| 16 | 19 | settingHeight: 9999,
|
| 17 | - targetWidth: 1000,
|
|
| 18 | - targetHeight: 1000,
|
|
| 20 | + targetWidth,
|
|
| 21 | + targetHeight,
|
|
| 19 | 22 | },
|
| 20 | 23 | {
|
| 21 | - settingWidth: 999,
|
|
| 22 | - settingHeight: 999,
|
|
| 23 | - targetWidth: 1000,
|
|
| 24 | - targetHeight: 1000,
|
|
| 24 | + settingWidth: targetWidth - 1,
|
|
| 25 | + settingHeight: targetHeight - 1,
|
|
| 26 | + targetWidth,
|
|
| 27 | + targetHeight,
|
|
| 25 | 28 | },
|
| 26 | 29 | ]); |
| ... | ... | @@ -306,19 +306,28 @@ async function calcMaximumAvailSize(aChromeWidth, aChromeHeight) { |
| 306 | 306 | let availWidth = window.screen.availWidth;
|
| 307 | 307 | let availHeight = window.screen.availHeight;
|
| 308 | 308 | |
| 309 | - // Ideally, we would round the window size as 1000x1000. But the available
|
|
| 310 | - // screen space might not suffice. So, we decide the size according to the
|
|
| 311 | - // available screen size.
|
|
| 312 | - let availContentWidth = Math.min(1000, availWidth - chromeUIWidth);
|
|
| 309 | + // Ideally, we would round the window size as
|
|
| 310 | + // privacy.window.maxInnerWidth x privacy.window.maxInnerHeight. But the
|
|
| 311 | + // available screen space might not suffice. So, we decide the size according
|
|
| 312 | + // to the available screen size.
|
|
| 313 | + let maxInnerWidth = Services.prefs.getIntPref("privacy.window.maxInnerWidth");
|
|
| 314 | + let maxInnerHeight = Services.prefs.getIntPref(
|
|
| 315 | + "privacy.window.maxInnerHeight"
|
|
| 316 | + );
|
|
| 317 | + |
|
| 318 | + let availContentWidth = Math.min(maxInnerWidth, availWidth - chromeUIWidth);
|
|
| 313 | 319 | let availContentHeight;
|
| 314 | 320 | |
| 315 | 321 | // If it is GTK window, we would consider the system decorations when we
|
| 316 | 322 | // calculating avail content height since the system decorations won't be
|
| 317 | 323 | // reported when we get available screen dimensions.
|
| 318 | 324 | if (AppConstants.MOZ_WIDGET_GTK) {
|
| 319 | - availContentHeight = Math.min(1000, -40 + availHeight - chromeUIHeight);
|
|
| 325 | + availContentHeight = Math.min(
|
|
| 326 | + maxInnerHeight,
|
|
| 327 | + -40 + availHeight - chromeUIHeight
|
|
| 328 | + );
|
|
| 320 | 329 | } else {
|
| 321 | - availContentHeight = Math.min(1000, availHeight - chromeUIHeight);
|
|
| 330 | + availContentHeight = Math.min(maxInnerHeight, availHeight - chromeUIHeight);
|
|
| 322 | 331 | }
|
| 323 | 332 | |
| 324 | 333 | // Rounded the desire size to the nearest 200x100.
|
| ... | ... | @@ -14352,12 +14352,12 @@ |
| 14352 | 14352 | |
| 14353 | 14353 | - name: privacy.window.maxInnerWidth
|
| 14354 | 14354 | type: int32_t
|
| 14355 | - value: 1000
|
|
| 14355 | + value: 1400
|
|
| 14356 | 14356 | mirror: always
|
| 14357 | 14357 | |
| 14358 | 14358 | - name: privacy.window.maxInnerHeight
|
| 14359 | 14359 | type: int32_t
|
| 14360 | - value: 1000
|
|
| 14360 | + value: 900
|
|
| 14361 | 14361 | mirror: always
|
| 14362 | 14362 | |
| 14363 | 14363 | - name: privacy.sanitize.useOldClearHistoryDialog
|
| ... | ... | @@ -522,14 +522,14 @@ class _RFPHelper { |
| 522 | 522 | /**
|
| 523 | 523 | * Given a width or height, rounds it with the proper stepping.
|
| 524 | 524 | */
|
| 525 | - steppedSize(aDimension, isWidth = false) {
|
|
| 525 | + steppedSize(aDimension, aIsWidth = false) {
|
|
| 526 | 526 | let stepping;
|
| 527 | 527 | if (aDimension <= 50) {
|
| 528 | 528 | return 0;
|
| 529 | 529 | } else if (aDimension <= 500) {
|
| 530 | 530 | stepping = 50;
|
| 531 | 531 | } else if (aDimension <= 1600) {
|
| 532 | - stepping = isWidth ? 200 : 100;
|
|
| 532 | + stepping = aIsWidth ? 200 : 100;
|
|
| 533 | 533 | } else {
|
| 534 | 534 | stepping = 200;
|
| 535 | 535 | }
|