Bug 1618763 - Part 1. mHTMLInputInputmode should be lower case except to mozAwesomebar. r=masayuki

Since we cannot use HTMLInputElement.GetInputMode since we still support
mozAwesomebar, inputmode attribute isn't sanitized. Since I would like to reduce
comparing cost, it should be lower case except to mozAwesomebar.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Makoto Kato 2020-03-23 01:41:29 +00:00
Родитель 202a285024
Коммит 7f74bada1a
1 изменённых файлов: 8 добавлений и 4 удалений

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

@ -1287,10 +1287,14 @@ void IMEStateManager::SetIMEState(const IMEState& aState,
nsContentUtils::IsChromeDoc(aContent->OwnerDoc())) {
aContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::inputmode,
context.mHTMLInputInputmode);
if (context.mHTMLInputInputmode.EqualsLiteral("mozAwesomebar") &&
!nsContentUtils::IsChromeDoc(aContent->OwnerDoc())) {
// mozAwesomebar should be allowed only in chrome
context.mHTMLInputInputmode.Truncate();
if (context.mHTMLInputInputmode.EqualsLiteral("mozAwesomebar")) {
if (!nsContentUtils::IsChromeDoc(aContent->OwnerDoc())) {
// mozAwesomebar should be allowed only in chrome
context.mHTMLInputInputmode.Truncate();
}
} else {
// Except to mozAwesomebar, inputmode should be lower case.
ToLowerCase(context.mHTMLInputInputmode);
}
}