Bug 738744 - Fix "ASSERTION: Form controls should always have parents". r=bz

This commit is contained in:
Mounir Lamouri 2012-03-26 17:52:39 -07:00
parent 51ba3dd231
commit 832858eb8d
3 changed files with 11 additions and 1 deletions

View File

@ -0,0 +1,4 @@
<input xmlns="http://www.w3.org/1999/xhtml" form="f">
<form id="f" />
<input form="f" />
</input>

View File

@ -33,3 +33,4 @@ load 680922-1.xul
load 682058.xhtml load 682058.xhtml
load 682460.html load 682460.html
load 673853.html load 673853.html
load 738744.xhtml

View File

@ -1053,7 +1053,12 @@ CompareFormControlPosition(nsGenericHTMLFormElement *aControl1,
{ {
NS_ASSERTION(aControl1 != aControl2, "Comparing a form control to itself"); NS_ASSERTION(aControl1 != aControl2, "Comparing a form control to itself");
NS_ASSERTION(aControl1->GetParent() && aControl2->GetParent(), // If an element has a @form, we can assume it *might* be able to not have
// a parent and still be in the form.
NS_ASSERTION((aControl1->HasAttr(kNameSpaceID_None, nsGkAtoms::form) ||
aControl1->GetParent()) &&
(aControl2->HasAttr(kNameSpaceID_None, nsGkAtoms::form) ||
aControl2->GetParent()),
"Form controls should always have parents"); "Form controls should always have parents");
// If we pass aForm, we are assuming both controls are form descendants which // If we pass aForm, we are assuming both controls are form descendants which