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

Bug 1363508 - Part 2: Suppressing the pointer events that have isPrimary as...

Bug 1363508 - Part 2: Suppressing the pointer events that have isPrimary as false for fingerprinting resistance r=arthuredelstein,masayuki

Because of that the isPrimary of mouse pointer events will always be
true. So, we suppress other events that have isPrimary as false when
fingerprinting resistance is enabled.

Depends on D6003

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

--HG--
extra : moz-landing-system : lando
parent 0a30f56c
......@@ -503,19 +503,31 @@ WidgetEvent::IsAllowedToDispatchInSystemGroup() const
bool
WidgetEvent::IsBlockedForFingerprintingResistance() const
{
if (mClass == eKeyboardEventClass &&
nsContentUtils::ShouldResistFingerprinting()) {
const WidgetKeyboardEvent* keyboardEvent = AsKeyboardEvent();
if (keyboardEvent->mKeyNameIndex == KEY_NAME_INDEX_Alt ||
keyboardEvent->mKeyNameIndex == KEY_NAME_INDEX_Shift ||
keyboardEvent->mKeyNameIndex == KEY_NAME_INDEX_Control ||
keyboardEvent->mKeyNameIndex == KEY_NAME_INDEX_AltGraph) {
return true;
}
if (!nsContentUtils::ShouldResistFingerprinting()) {
return false;
}
return false;
switch (mClass) {
case eKeyboardEventClass: {
const WidgetKeyboardEvent* keyboardEvent = AsKeyboardEvent();
return (keyboardEvent->mKeyNameIndex == KEY_NAME_INDEX_Alt ||
keyboardEvent->mKeyNameIndex == KEY_NAME_INDEX_Shift ||
keyboardEvent->mKeyNameIndex == KEY_NAME_INDEX_Control ||
keyboardEvent->mKeyNameIndex == KEY_NAME_INDEX_AltGraph);
}
case ePointerEventClass: {
const WidgetPointerEvent* pointerEvent = AsPointerEvent();
// We suppress the pointer events if it is not primary for fingerprinting
// resistance. It is because of that we want to spoof any pointer event
// into a mouse pointer event and the mouse pointer event only has
// isPrimary as true.
return !pointerEvent->mIsPrimary;
}
default:
return false;
}
}
/******************************************************************************
......
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