Backed out changeset f15ab7984211 (bug 1433592) for failing browser chrome at browser/components/resistfingerprinting/test/browser/browser_spoofing_keyboard_event.js on a CLOSED TREE

This commit is contained in:
Andreea Pavel 2018-03-02 13:03:58 +02:00
Родитель 2099a2a47b
Коммит bdfa57bfea
3 изменённых файлов: 11 добавлений и 21 удалений

Просмотреть файл

@ -621,16 +621,6 @@ const TEST_CASES_EN = [
location: KeyboardEvent.DOM_KEY_LOCATION_STANDARD, altKey: false, shiftKey: false,
ctrlKey: false, altGraphKey: false }
},
{ key: "a", modifiers: { ctrlKey: true }, expectedKeyEvent: SHOULD_DELIVER_ALL_FOR_PRINTABLE,
result: { key: "a", code: "KeyA", charCode: 97, keyCode: KeyboardEvent.DOM_VK_A,
location: KeyboardEvent.DOM_KEY_LOCATION_STANDARD, altKey: false, shiftKey: false,
ctrlKey: true, altGraphKey: false }
},
{ key: "a", modifiers: { altKey: true }, expectedKeyEvent: SHOULD_DELIVER_ALL_FOR_PRINTABLE,
result: { key: "a", code: "KeyA", charCode: 97, keyCode: KeyboardEvent.DOM_VK_A,
location: KeyboardEvent.DOM_KEY_LOCATION_STANDARD, altKey: false, shiftKey: false,
ctrlKey: false, altGraphKey: false }
},
];
async function testKeyEvent(aTab, aTestCase) {

Просмотреть файл

@ -49,10 +49,15 @@ KeyboardEvent::AltKey(CallerType aCallerType)
bool
KeyboardEvent::CtrlKey(CallerType aCallerType)
{
// We don't spoof this key when privacy.resistFingerprinting
// is enabled, because it is often used for command key
// combinations in web apps.
return mEvent->AsKeyboardEvent()->IsControl();
bool ctrlState = mEvent->AsKeyboardEvent()->IsControl();
if (!ShouldResistFingerprinting(aCallerType)) {
return ctrlState;
}
// We need to give a spoofed state for Control key since it could be used as a
// modifier key in certain asian keyboard layouts.
return GetSpoofedModifierStates(Modifier::MODIFIER_CONTROL, ctrlState);
}
bool
@ -70,9 +75,6 @@ KeyboardEvent::ShiftKey(CallerType aCallerType)
bool
KeyboardEvent::MetaKey()
{
// We don't spoof this key when privacy.resistFingerprinting
// is enabled, because it is often used for command key
// combinations in web apps.
return mEvent->AsKeyboardEvent()->IsMeta();
}

Просмотреть файл

@ -627,10 +627,8 @@ nsRFPService::GetSpoofedModifierStates(const nsIDocument* aDoc,
return false;
}
// We will spoof the modifer state for Alt, Shift, and AltGraph.
// We don't spoof the Control key, because it is often used
// for command key combinations in web apps.
if (aModifier & (MODIFIER_ALT | MODIFIER_SHIFT | MODIFIER_ALTGRAPH)) {
// We will spoof the modifer state for Alt, Shift, AltGraph and Control.
if (aModifier & (MODIFIER_ALT | MODIFIER_SHIFT | MODIFIER_ALTGRAPH | MODIFIER_CONTROL)) {
SpoofingKeyboardCode keyCodeInfo;
if (GetSpoofedKeyCodeInfo(aDoc, aKeyboardEvent, keyCodeInfo)) {