Bug 1499571 - HTMLOptionsCollection::Remove shouldn't remove the first element of the collection if out of bounds. r=bzbarsky

Make it just forward to HTMLSelectElement::Remove like other browsers.

Differential Revision: https://phabricator.services.mozilla.com/D8934
This commit is contained in:
Emilio Cobos Álvarez
2018-10-17 01:35:21 +00:00
parent d1989c7dda
commit aea418392a
4 changed files with 6 additions and 11 deletions

View File

@@ -600,6 +600,10 @@ HTMLSelectElement::Add(nsGenericHTMLElement& aElement,
void
HTMLSelectElement::Remove(int32_t aIndex)
{
if (aIndex < 0) {
return;
}
nsCOMPtr<nsINode> option = Item(static_cast<uint32_t>(aIndex));
if (!option) {
return;