Bug 1318576. Remove entries from a form's past names map when an element is removed from the form, even if that element doesn't have a name or id anymore. r=baku

This commit is contained in:
Boris Zbarsky
2016-11-21 12:34:02 -05:00
parent b59fc632ad
commit ab063f5422
6 changed files with 147 additions and 69 deletions

View File

@@ -1791,13 +1791,11 @@ nsGenericHTMLFormElement::ClearForm(bool aRemoveFromForm)
mForm->RemoveElement(this, true);
if (!nameVal.IsEmpty()) {
mForm->RemoveElementFromTable(this, nameVal,
HTMLFormElement::ElementRemoved);
mForm->RemoveElementFromTable(this, nameVal);
}
if (!idVal.IsEmpty()) {
mForm->RemoveElementFromTable(this, idVal,
HTMLFormElement::ElementRemoved);
mForm->RemoveElementFromTable(this, idVal);
}
}
@@ -1934,8 +1932,7 @@ nsGenericHTMLFormElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
GetAttr(kNameSpaceID_None, aName, tmp);
if (!tmp.IsEmpty()) {
mForm->RemoveElementFromTable(this, tmp,
HTMLFormElement::AttributeUpdated);
mForm->RemoveElementFromTable(this, tmp);
}
}
@@ -1943,15 +1940,13 @@ nsGenericHTMLFormElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
GetAttr(kNameSpaceID_None, nsGkAtoms::name, tmp);
if (!tmp.IsEmpty()) {
mForm->RemoveElementFromTable(this, tmp,
HTMLFormElement::AttributeUpdated);
mForm->RemoveElementFromTable(this, tmp);
}
GetAttr(kNameSpaceID_None, nsGkAtoms::id, tmp);
if (!tmp.IsEmpty()) {
mForm->RemoveElementFromTable(this, tmp,
HTMLFormElement::AttributeUpdated);
mForm->RemoveElementFromTable(this, tmp);
}
mForm->RemoveElement(this, false);