Commit b88841d2 authored by Tim Huang's avatar Tim Huang
Browse files

Bug 1363508 - Part 3: Spoofing navigator.maxTouchPoints into 0 if...

Bug 1363508 - Part 3: Spoofing navigator.maxTouchPoints into 0 if fingerprinting resistance is enabled r=arthuredelstein,masayuki,smaug

The maxTouchPoints is going to review the detail of users' hardware. So,
we will spoof it into 0 if fingerprinting resistance is on.

Depends on D6004

Differential Revision: https://phabricator.services.mozilla.com/D6005

--HG--
extra : moz-landing-system : lando
parent a8de9d00
......@@ -880,8 +880,15 @@ Navigator::Vibrate(const nsTArray<uint32_t>& aPattern)
//*****************************************************************************
uint32_t
Navigator::MaxTouchPoints()
Navigator::MaxTouchPoints(CallerType aCallerType)
{
// The maxTouchPoints is going to reveal the detail of users' hardware. So,
// we will spoof it into 0 if fingerprinting resistance is on.
if (aCallerType != CallerType::System &&
nsContentUtils::ShouldResistFingerprinting()) {
return 0;
}
nsCOMPtr<nsIWidget> widget = widget::WidgetUtils::DOMWindowToWidget(mWindow->GetOuterWindow());
NS_ENSURE_TRUE(widget, 0);
......
......@@ -150,7 +150,7 @@ public:
bool Vibrate(uint32_t aDuration);
bool Vibrate(const nsTArray<uint32_t>& aDuration);
void SetVibrationPermission(bool aPermitted, bool aPersistent);
uint32_t MaxTouchPoints();
uint32_t MaxTouchPoints(CallerType aCallerType);
void GetAppCodeName(nsAString& aAppCodeName, ErrorResult& aRv);
void GetOscpu(nsAString& aOscpu, CallerType aCallerType,
ErrorResult& aRv) const;
......
......@@ -147,7 +147,7 @@ partial interface Navigator {
// http://www.w3.org/TR/pointerevents/#extensions-to-the-navigator-interface
partial interface Navigator {
[Pref="dom.w3c_pointer_events.enabled"]
[Pref="dom.w3c_pointer_events.enabled", NeedsCallerType]
readonly attribute long maxTouchPoints;
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment