[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor-browser/tor-browser-52.1.0esr-7.0-2] Bug 10286: Touch API fingerprinting resistance
commit 331f089d6b6ba62463d8362d7ca01641a4cc92dc
Author: Arthur Edelstein <arthuredelstein@xxxxxxxxx>
Date: Mon Apr 24 08:18:25 2017 -0700
Bug 10286: Touch API fingerprinting resistance
---
dom/events/Touch.cpp | 7 +++++++
dom/events/Touch.h | 16 ++++++++++------
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/dom/events/Touch.cpp b/dom/events/Touch.cpp
index a538fa6..39d50e3 100644
--- a/dom/events/Touch.cpp
+++ b/dom/events/Touch.cpp
@@ -188,5 +188,12 @@ Touch::GetParentObject()
return mTarget->GetOwnerGlobal();
}
+bool
+Touch::ResistFingerprinting() const
+{
+ return !nsContentUtils::LegacyIsCallerChromeOrNativeCode() &&
+ nsContentUtils::ResistFingerprinting();
+}
+
} // namespace dom
} // namespace mozilla
diff --git a/dom/events/Touch.h b/dom/events/Touch.h
index f98f7f9..858fb16 100644
--- a/dom/events/Touch.h
+++ b/dom/events/Touch.h
@@ -67,16 +67,19 @@ public:
// WebIDL
int32_t Identifier() const { return mIdentifier; }
EventTarget* GetTarget() const;
- int32_t ScreenX() const { return mScreenPoint.x; }
- int32_t ScreenY() const { return mScreenPoint.y; }
+ int32_t ScreenX() const { return ResistFingerprinting() ?
+ mClientPoint.x : mScreenPoint.x; }
+ int32_t ScreenY() const { return ResistFingerprinting() ?
+ mClientPoint.y : mScreenPoint.y; }
int32_t ClientX() const { return mClientPoint.x; }
int32_t ClientY() const { return mClientPoint.y; }
int32_t PageX() const { return mPagePoint.x; }
int32_t PageY() const { return mPagePoint.y; }
- int32_t RadiusX() const { return mRadius.x; }
- int32_t RadiusY() const { return mRadius.y; }
- float RotationAngle() const { return mRotationAngle; }
- float Force() const { return mForce; }
+ int32_t RadiusX() const { return ResistFingerprinting() ? 1 : mRadius.x; }
+ int32_t RadiusY() const { return ResistFingerprinting() ? 1 : mRadius.y; }
+ float RotationAngle() const { return ResistFingerprinting() ?
+ 0.0 : mRotationAngle; }
+ float Force() const { return ResistFingerprinting() ? 0.0 : mForce; }
nsCOMPtr<EventTarget> mTarget;
LayoutDeviceIntPoint mRefPoint;
@@ -90,6 +93,7 @@ public:
float mRotationAngle;
float mForce;
protected:
+ bool ResistFingerprinting() const;
~Touch();
bool mPointsInitialized;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits