зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1222285 - Part 2: Making the keyboard events of modifier keys been suppressed when 'privacy.resistFingerprinting' is true. r=arthuredelstein,masayuki
This patch makes 'Shift', 'Alt', 'Contorl' and 'AltGraph' been suppressed for content when fingerprinting resistance is enabled. Chrome can still get these events. The reason behind this is that websites can still observe key combinations to tell which keyboard layout is using even we spoof the keyboardEvent.code, keyboardEvent.keyCode and modifier states. For example, the AZERTY France keyboard, the digit keys of it requires the user press the Shift key. So, it is easy to differentiate AZERTY and QWERTY keyboard by observing whether a Shift key generates its own before the digit keys. There are similar issues for 'Alt' and 'AltGraph' as well. MozReview-Commit-ID: 3CwCgvey4lK --HG-- extra : rebase_source : 225a34ab188f6cca288a6c0e9874261df7db629f
This commit is contained in:
Родитель
8933d9d799
Коммит
98af9c6f96
|
@ -7980,6 +7980,10 @@ PresShell::DispatchEventToDOM(WidgetEvent* aEvent,
|
|||
}
|
||||
}
|
||||
if (eventTarget) {
|
||||
if (aEvent->IsBlockedForFingerprintingResistance()) {
|
||||
aEvent->mFlags.mOnlySystemGroupDispatchInContent = true;
|
||||
}
|
||||
|
||||
if (aEvent->mClass == eCompositionEventClass) {
|
||||
IMEStateManager::DispatchCompositionEvent(eventTarget, mPresContext,
|
||||
aEvent->AsCompositionEvent(),
|
||||
|
|
|
@ -861,6 +861,10 @@ public:
|
|||
* Whether the event should be dispatched in system group.
|
||||
*/
|
||||
bool IsAllowedToDispatchInSystemGroup() const;
|
||||
/**
|
||||
* Whether the event should be blocked for fingerprinting resistance.
|
||||
*/
|
||||
bool IsBlockedForFingerprintingResistance() const;
|
||||
/**
|
||||
* Initialize mComposed
|
||||
*/
|
||||
|
|
|
@ -510,6 +510,24 @@ WidgetEvent::IsAllowedToDispatchInSystemGroup() const
|
|||
return mClass != ePointerEventClass;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::WidgetEvent
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче