Bug 23949 - HTMLSelectElement is in inconsistent state when handling mutation events
Summary: HTMLSelectElement is in inconsistent state when handling mutation events
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords:
Depends on:
Blocks: 13287
  Show dependency treegraph
 
Reported: 2009-02-13 08:22 PST by Alexey Proskuryakov
Modified: 2009-03-15 01:43 PDT (History)
1 user (show)

See Also:


Attachments
proposed fix (13.66 KB, patch)
2009-02-13 08:25 PST, Alexey Proskuryakov
adele: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2009-02-13 08:22:28 PST
HTMLSelectElement modification methods call setRecalcListItems() after the fact - but mutation event handlers need to see a consistent select state, too. This causes assertion failures.

Patch is forthcoming.
Comment 1 Alexey Proskuryakov 2009-02-13 08:25:28 PST
Created attachment 27662 [details]
proposed fix
Comment 2 Darin Adler 2009-02-13 11:37:39 PST
Comment on attachment 27662 [details]
proposed fix

>  bool HTMLOptGroupElement::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& ec, bool shouldLazyAttach)
>  {
>      bool result = HTMLFormControlElement::insertBefore(newChild, refChild, ec, shouldLazyAttach);
> -    if (result)
> -        recalcSelectOptions();
>      return result;
>  }
>  
>  bool HTMLOptGroupElement::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& ec, bool shouldLazyAttach)
>  {
>      bool result = HTMLFormControlElement::replaceChild(newChild, oldChild, ec, shouldLazyAttach);
> -    if (result)
> -        recalcSelectOptions();
>      return result;
>  }
>  
>  bool HTMLOptGroupElement::removeChild(Node* oldChild, ExceptionCode& ec)
>  {
>      bool result = HTMLFormControlElement::removeChild(oldChild, ec);
> -    if (result)
> -        recalcSelectOptions();
>      return result;
>  }
>  
>  bool HTMLOptGroupElement::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, bool shouldLazyAttach)
>  {
>      bool result = HTMLFormControlElement::appendChild(newChild, ec, shouldLazyAttach);
> -    if (result)
> -        recalcSelectOptions();
>      return result;
>  }
>  
>  bool HTMLOptGroupElement::removeChildren()
>  {
>      bool result = HTMLFormControlElement::removeChildren();
> -    if (result)
> -        recalcSelectOptions();
>      return result;
>  }

These overrides should all be removed entirely.

> @@ -299,40 +295,30 @@ void HTMLSelectElement::restoreState(con
>  bool HTMLSelectElement::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& ec, bool shouldLazyAttach)
>  {
>      bool result = HTMLFormControlElementWithState::insertBefore(newChild, refChild, ec, shouldLazyAttach);
> -    if (result)
> -        setRecalcListItems();
>      return result;
>  }
>  
>  bool HTMLSelectElement::replaceChild(PassRefPtr<Node> newChild, Node *oldChild, ExceptionCode& ec, bool shouldLazyAttach)
>  {
>      bool result = HTMLFormControlElementWithState::replaceChild(newChild, oldChild, ec, shouldLazyAttach);
> -    if (result)
> -        setRecalcListItems();
>      return result;
>  }
>  
>  bool HTMLSelectElement::removeChild(Node* oldChild, ExceptionCode& ec)
>  {
>      bool result = HTMLFormControlElementWithState::removeChild(oldChild, ec);
> -    if (result)
> -        setRecalcListItems();
>      return result;
>  }
>  
>  bool HTMLSelectElement::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, bool shouldLazyAttach)
>  {
>      bool result = HTMLFormControlElementWithState::appendChild(newChild, ec, shouldLazyAttach);
> -    if (result)
> -        setRecalcListItems();
>      return result;
>  }
>  
>  bool HTMLSelectElement::removeChildren()
>  {
>      bool result = HTMLFormControlElementWithState::removeChildren();
> -    if (result)
> -        setRecalcListItems();
>      return result;
>  }

These too.

I haven't reviewed the rest of the patch yet.
Comment 3 Alexey Proskuryakov 2009-02-13 11:53:06 PST
> These overrides should all be removed entirely.

I'm actually adding code in these in bug 13287. 
Comment 4 Alexey Proskuryakov 2009-03-15 01:43:37 PDT
Committed revision 41713.