Bug 1749677 - Do not trigger change, input, or focus events on untrusted keypress events for input elements. r=edgar
Differential Revision: https://phabricator.services.mozilla.com/D154854
This commit is contained in:
@@ -3755,8 +3755,9 @@ nsresult HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
|
||||
break;
|
||||
}
|
||||
case eKeyPress: {
|
||||
if (mType == FormControlType::InputRadio && !keyEvent->IsAlt() &&
|
||||
!keyEvent->IsControl() && !keyEvent->IsMeta()) {
|
||||
if (mType == FormControlType::InputRadio && keyEvent->IsTrusted() &&
|
||||
!keyEvent->IsAlt() && !keyEvent->IsControl() &&
|
||||
!keyEvent->IsMeta()) {
|
||||
rv = MaybeHandleRadioButtonNavigation(aVisitor, keyEvent->mKeyCode);
|
||||
}
|
||||
|
||||
@@ -3788,8 +3789,9 @@ nsresult HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor) {
|
||||
}
|
||||
}
|
||||
|
||||
if (mType == FormControlType::InputRange && !keyEvent->IsAlt() &&
|
||||
!keyEvent->IsControl() && !keyEvent->IsMeta() &&
|
||||
if (mType == FormControlType::InputRange && keyEvent->IsTrusted() &&
|
||||
!keyEvent->IsAlt() && !keyEvent->IsControl() &&
|
||||
!keyEvent->IsMeta() &&
|
||||
(keyEvent->mKeyCode == NS_VK_LEFT ||
|
||||
keyEvent->mKeyCode == NS_VK_RIGHT ||
|
||||
keyEvent->mKeyCode == NS_VK_UP ||
|
||||
|
||||
Reference in New Issue
Block a user