commit cab2fcca42615a29c1504c065b7721d337b5d67b
parent b1323404cafad60b36eb1cf20a2b90de579c7f74
Author: Henry Wilkes <henry@torproject.org>
Date: Tue, 12 Dec 2023 11:50:52 +0000
BB 42528: Don't leak system scrollbar size on windows.
Diffstat:
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/widget/ScrollbarDrawingWin.cpp b/widget/ScrollbarDrawingWin.cpp
@@ -11,6 +11,7 @@
#include "nsLayoutUtils.h"
#include "Theme.h"
#include "nsNativeTheme.h"
+#include "nsContentUtils.h"
namespace mozilla::widget {
@@ -157,7 +158,10 @@ void ScrollbarDrawingWin::RecomputeScrollbarParams() {
}
ConfigureScrollbarSize(defaultSize);
- if (StaticPrefs::widget_non_native_theme_win_scrollbar_use_system_size()) {
+ // Do not leak system size when using ResistFingerprinting.
+ if (!nsContentUtils::ShouldResistFingerprinting("No context available",
+ RFPTarget::CSSResolution) &&
+ StaticPrefs::widget_non_native_theme_win_scrollbar_use_system_size()) {
ConfigureScrollbarSize(LookAndFeel::GetInt(
LookAndFeel::IntID::SystemScrollbarSize, defaultSize));
}
diff --git a/widget/ScrollbarDrawingWin11.cpp b/widget/ScrollbarDrawingWin11.cpp
@@ -11,6 +11,7 @@
#include "nsLayoutUtils.h"
#include "Theme.h"
#include "nsNativeTheme.h"
+#include "nsContentUtils.h"
using mozilla::gfx::sRGBColor;
@@ -348,6 +349,11 @@ bool ScrollbarDrawingWin11::PaintScrollbarThumb(
void ScrollbarDrawingWin11::RecomputeScrollbarParams() {
ScrollbarDrawingWin::RecomputeScrollbarParams();
+ if (nsContentUtils::ShouldResistFingerprinting("No context available",
+ RFPTarget::CSSResolution)) {
+ // Do not distinguish sizes between windows 10 and 11.
+ return;
+ }
// TODO(emilio): Maybe make this configurable? Though this doesn't respect
// classic Windows registry settings, and cocoa overlay scrollbars also don't
// respect the override it seems, so this should be fine.