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
This commit is contained in:
Tim Huang 2018-10-09 11:50:03 +00:00
parent a8de9d009f
commit b88841d2fd
3 changed files with 10 additions and 3 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;
};