Loading browser/app/profile/001-base-profile.js +2 −0 Original line number Diff line number Diff line Loading @@ -377,6 +377,8 @@ pref("privacy.resistFingerprinting.letterboxing", true); pref("privacy.resistFingerprinting.letterboxing.vcenter", true); // tor-browser#41917 letterboxing gradient background pref("privacy.resistFingerprinting.letterboxing.gradient", true); // tor-browser#41918: should we reuse last window sizes if letterboxing is enabled pref("privacy.resistFingerprinting.letterboxing.rememberSize", false); // 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); Loading dom/base/nsContentUtils.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -2663,6 +2663,18 @@ void nsContentUtils::CalcRoundedWindowSizeForResistingFingerprinting( *aOutputHeight = resultHeight; } bool nsContentUtils::ShouldRoundWindowSizeForResistingFingerprinting() { return !( Preferences::GetBool("privacy.resistFingerprinting.letterboxing", false) && // We want to round window size at least once in the browser's life time: // AppWindow::ForceRoundedDimensions() will set this preference to true. Preferences::GetBool( "privacy.resistFingerprinting.letterboxing.didForceSize", false) && Preferences::GetBool( "privacy.resistFingerprinting.letterboxing.rememberSize", false)); } bool nsContentUtils::ThreadsafeIsCallerChrome() { return NS_IsMainThread() ? IsCallerChrome() : IsCurrentThreadRunningChromeWorker(); Loading dom/base/nsContentUtils.h +4 −0 Original line number Diff line number Diff line Loading @@ -406,6 +406,10 @@ class nsContentUtils { bool aSetOuterWidth, bool aSetOuterHeight, int32_t* aOutputWidth, int32_t* aOutputHeight); // Tell if we actually want to round size of new windows for RFP, // depending on letterboxing status and user's preference. static bool ShouldRoundWindowSizeForResistingFingerprinting(); /** * Returns the parent node of aChild crossing document boundaries, but skips * any cross-process parent frames and continues with the nearest in-process Loading toolkit/components/resistfingerprinting/RFPHelper.sys.mjs +4 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ const kPrefLetterboxingVcenter = "privacy.resistFingerprinting.letterboxing.vcenter"; const kPrefLetterboxingGradient = "privacy.resistFingerprinting.letterboxing.gradient"; const kPrefLetterboxingDidForceSize = "privacy.resistFingerprinting.letterboxing.didForceSize"; const kTopicDOMWindowOpened = "domwindowopened"; Loading Loading @@ -138,12 +140,14 @@ class _RFPHelper { _handlePrefChanged(data) { switch (data) { case kPrefResistFingerprinting: Service.prefs.clearUserPref(kPrefLetterboxingDidForceSize); this._handleResistFingerprintingChanged(); break; case kPrefSpoofEnglish: this._handleSpoofEnglishChanged(); break; case kPrefLetterboxing: Service.prefs.clearUserPref(kPrefLetterboxingDidForceSize); case kPrefLetterboxingVcenter: case kPrefLetterboxingGradient: this._handleLetterboxingPrefChanged(); Loading toolkit/components/windowwatcher/nsWindowWatcher.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -2333,7 +2333,9 @@ static void SizeOpenedWindow(nsIDocShellTreeOwner* aTreeOwner, screenDesktopRect.Size() / screenCssToDesktopScale; if (aSizeSpec.SizeSpecified()) { if (!nsContentUtils::ShouldResistFingerprinting()) { if (!(nsContentUtils::ShouldResistFingerprinting() && nsContentUtils:: ShouldRoundWindowSizeForResistingFingerprinting())) { /* Unlike position, force size out-of-bounds check only if size actually was specified. Otherwise, intrinsically sized windows are broken. */ Loading Loading
browser/app/profile/001-base-profile.js +2 −0 Original line number Diff line number Diff line Loading @@ -377,6 +377,8 @@ pref("privacy.resistFingerprinting.letterboxing", true); pref("privacy.resistFingerprinting.letterboxing.vcenter", true); // tor-browser#41917 letterboxing gradient background pref("privacy.resistFingerprinting.letterboxing.gradient", true); // tor-browser#41918: should we reuse last window sizes if letterboxing is enabled pref("privacy.resistFingerprinting.letterboxing.rememberSize", false); // 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); Loading
dom/base/nsContentUtils.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -2663,6 +2663,18 @@ void nsContentUtils::CalcRoundedWindowSizeForResistingFingerprinting( *aOutputHeight = resultHeight; } bool nsContentUtils::ShouldRoundWindowSizeForResistingFingerprinting() { return !( Preferences::GetBool("privacy.resistFingerprinting.letterboxing", false) && // We want to round window size at least once in the browser's life time: // AppWindow::ForceRoundedDimensions() will set this preference to true. Preferences::GetBool( "privacy.resistFingerprinting.letterboxing.didForceSize", false) && Preferences::GetBool( "privacy.resistFingerprinting.letterboxing.rememberSize", false)); } bool nsContentUtils::ThreadsafeIsCallerChrome() { return NS_IsMainThread() ? IsCallerChrome() : IsCurrentThreadRunningChromeWorker(); Loading
dom/base/nsContentUtils.h +4 −0 Original line number Diff line number Diff line Loading @@ -406,6 +406,10 @@ class nsContentUtils { bool aSetOuterWidth, bool aSetOuterHeight, int32_t* aOutputWidth, int32_t* aOutputHeight); // Tell if we actually want to round size of new windows for RFP, // depending on letterboxing status and user's preference. static bool ShouldRoundWindowSizeForResistingFingerprinting(); /** * Returns the parent node of aChild crossing document boundaries, but skips * any cross-process parent frames and continues with the nearest in-process Loading
toolkit/components/resistfingerprinting/RFPHelper.sys.mjs +4 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ const kPrefLetterboxingVcenter = "privacy.resistFingerprinting.letterboxing.vcenter"; const kPrefLetterboxingGradient = "privacy.resistFingerprinting.letterboxing.gradient"; const kPrefLetterboxingDidForceSize = "privacy.resistFingerprinting.letterboxing.didForceSize"; const kTopicDOMWindowOpened = "domwindowopened"; Loading Loading @@ -138,12 +140,14 @@ class _RFPHelper { _handlePrefChanged(data) { switch (data) { case kPrefResistFingerprinting: Service.prefs.clearUserPref(kPrefLetterboxingDidForceSize); this._handleResistFingerprintingChanged(); break; case kPrefSpoofEnglish: this._handleSpoofEnglishChanged(); break; case kPrefLetterboxing: Service.prefs.clearUserPref(kPrefLetterboxingDidForceSize); case kPrefLetterboxingVcenter: case kPrefLetterboxingGradient: this._handleLetterboxingPrefChanged(); Loading
toolkit/components/windowwatcher/nsWindowWatcher.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -2333,7 +2333,9 @@ static void SizeOpenedWindow(nsIDocShellTreeOwner* aTreeOwner, screenDesktopRect.Size() / screenCssToDesktopScale; if (aSizeSpec.SizeSpecified()) { if (!nsContentUtils::ShouldResistFingerprinting()) { if (!(nsContentUtils::ShouldResistFingerprinting() && nsContentUtils:: ShouldRoundWindowSizeForResistingFingerprinting())) { /* Unlike position, force size out-of-bounds check only if size actually was specified. Otherwise, intrinsically sized windows are broken. */ Loading