Bug 1593366 - Check default prevented status in nsListControlFrame::KeyDown. r=mats

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-11-06 12:53:53 +00:00
Родитель 6023989158
Коммит 7cc5a6c96c
2 изменённых файлов: 7 добавлений и 7 удалений

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

@ -1968,11 +1968,9 @@ nsresult nsListControlFrame::KeyDown(dom::Event* aKeyEvent) {
AutoIncrementalSearchResetter incrementalSearchResetter;
// Don't check defaultPrevented value because other browsers don't prevent
// the key navigation of list control even if preventDefault() is called.
// XXXmats 2015-04-16: the above is not true anymore, Chrome prevents all
// XXXmats keyboard events, even tabbing, when preventDefault() is called
// XXXmats in onkeydown. That seems sub-optimal though.
if (aKeyEvent->DefaultPrevented()) {
return NS_OK;
}
const WidgetKeyboardEvent* keyEvent =
aKeyEvent->WidgetEventPtr()->AsKeyboardEvent();

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

@ -49,10 +49,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=291082
previousValue = element.value;
otherKeys.forEach(function(key) {
sendKey(key);
isnot(element.value, previousValue, "value should have changed while testing key " + key + " (id: " + id + ")");
// All these preventDefault on key down in various ways.
let shouldchange = id != "keydown" && id != "one" && id != "three";
(shouldchange ? isnot : is)(element.value, previousValue, "value should " + (shouldchange ? "" : "not ") + "have changed while testing key " + key + " (id: " + id + ")");
previousValue = element.value;
});
});
});
SimpleTest.finish();
});
}