Changeset 245746 in webkit


Ignore:
Timestamp:
May 24, 2019 9:33:57 AM (5 years ago)
Author:
rniwa@webkit.org
Message:

Asssertion failure in dispatchSubtreeModifiedEvent due to TextFieldInputType updating UA shadow tree inside Element::removedFromAncestor
https://bugs.webkit.org/show_bug.cgi?id=198216

Reviewed by Brent Fulgham.

Source/WebCore:

The bug was caused by ListAttributeTargetObserver::idTargetChanged() updating the shadow tree of an input element
within Element::removedFromAncestor via TextFieldInputType::createDataListDropdownIndicator(). Fixed it by
supressing the assertions with ScriptDisallowedScope::EventAllowedScope since it's always safe to update
UA shadow trees of input elements as it's not exposed to author scripts.

Avoiding the creation of dropdown indicator in this particular scenario is a lot more involved and it's not
particularly correct because there could be another datalist element which matches the ID specified in list
content attribute after the removal of the old datalist element.

Test: fast/forms/datalist/datalist-removal-assertion.html

  • html/TextFieldInputType.cpp:

(WebCore::TextFieldInputType::createDataListDropdownIndicator):
(WebCore::TextFieldInputType::createContainer):

  • html/shadow/DataListButtonElement.cpp:

(WebCore::DataListButtonElement::DataListButtonElement):

LayoutTests:

Added a regression test.

  • fast/forms/datalist/datalist-removal-assertion-expected.txt: Added.
  • fast/forms/datalist/datalist-removal-assertion.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r245742 r245746  
     12019-05-24  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Asssertion failure in dispatchSubtreeModifiedEvent due to TextFieldInputType updating UA shadow tree inside Element::removedFromAncestor
     4        https://bugs.webkit.org/show_bug.cgi?id=198216
     5
     6        Reviewed by Brent Fulgham.
     7
     8        Added a regression test.
     9
     10        * fast/forms/datalist/datalist-removal-assertion-expected.txt: Added.
     11        * fast/forms/datalist/datalist-removal-assertion.html: Added.
     12
    1132019-05-23  Simon Fraser  <simon.fraser@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r245745 r245746  
     12019-05-24  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Asssertion failure in dispatchSubtreeModifiedEvent due to TextFieldInputType updating UA shadow tree inside Element::removedFromAncestor
     4        https://bugs.webkit.org/show_bug.cgi?id=198216
     5
     6        Reviewed by Brent Fulgham.
     7
     8        The bug was caused by ListAttributeTargetObserver::idTargetChanged() updating the shadow tree of an input element
     9        within Element::removedFromAncestor via TextFieldInputType::createDataListDropdownIndicator(). Fixed it by
     10        supressing the assertions with ScriptDisallowedScope::EventAllowedScope since it's always safe to update
     11        UA shadow trees of input elements as it's not exposed to author scripts.
     12
     13        Avoiding the creation of dropdown indicator in this particular scenario is a lot more involved and it's not
     14        particularly correct because there could be another datalist element which matches the ID specified in list
     15        content attribute after the removal of the old datalist element.
     16
     17        Test: fast/forms/datalist/datalist-removal-assertion.html
     18
     19        * html/TextFieldInputType.cpp:
     20        (WebCore::TextFieldInputType::createDataListDropdownIndicator):
     21        (WebCore::TextFieldInputType::createContainer):
     22        * html/shadow/DataListButtonElement.cpp:
     23        (WebCore::DataListButtonElement::DataListButtonElement):
     24
    1252019-05-24  Saam barati  <sbarati@apple.com>
    226
  • trunk/Source/WebCore/html/TextFieldInputType.cpp

    r242518 r245746  
    5353#include "RenderTheme.h"
    5454#include "RuntimeEnabledFeatures.h"
     55#include "ScriptDisallowedScope.h"
    5556#include "ShadowRoot.h"
    5657#include "TextControlInnerElements.h"
     
    453454    if (!m_container)
    454455        createContainer();
     456
     457    ScriptDisallowedScope::EventAllowedScope allowedScope(*m_container);
    455458    m_dataListDropdownIndicator = DataListButtonElement::create(element()->document(), *this);
     459    m_container->appendChild(*m_dataListDropdownIndicator);
     460    m_dataListDropdownIndicator->setPseudo(AtomicString("-webkit-list-button", AtomicString::ConstructFromLiteral));
    456461    m_dataListDropdownIndicator->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone, true);
    457     m_container->appendChild(*m_dataListDropdownIndicator);
     462
    458463}
    459464#endif
     
    774779    ASSERT(element());
    775780
     781    ScriptDisallowedScope::EventAllowedScope allowedScope(*element()->userAgentShadowRoot());
     782
    776783    m_container = TextControlInnerContainer::create(element()->document());
     784    element()->userAgentShadowRoot()->appendChild(*m_container);
    777785    m_container->setPseudo(AtomicString("-webkit-textfield-decoration-container", AtomicString::ConstructFromLiteral));
    778786
    779787    m_innerBlock = TextControlInnerElement::create(element()->document());
     788    m_container->appendChild(*m_innerBlock);
    780789    m_innerBlock->appendChild(*m_innerText);
    781     m_container->appendChild(*m_innerBlock);
    782 
    783     element()->userAgentShadowRoot()->appendChild(*m_container);
    784790}
    785791
  • trunk/Source/WebCore/html/shadow/DataListButtonElement.cpp

    r234898 r245746  
    5050    , m_owner(owner)
    5151{
    52     setPseudo(AtomicString("-webkit-list-button", AtomicString::ConstructFromLiteral));
    5352}
    5453
Note: See TracChangeset for help on using the changeset viewer.