Changeset 198090 in webkit


Ignore:
Timestamp:
Mar 13, 2016 6:57:17 PM (8 years ago)
Author:
rniwa@webkit.org
Message:

REGRESSION (r190840): crash inside details element's slotNameFunction
https://bugs.webkit.org/show_bug.cgi?id=155388

Reviewed by Antti Koivisto.

Source/WebCore:

The bug was caused by HTMLDetailsElement::isActiveSummary calling findAssignedSlot with a summary element
inside the shadow tree of the detials element. Fixed it by existing early when the summary element passed
to isActiveSummary is not a direct child of the details element.

Test: fast/html/details-summary-tabindex-crash.html

  • dom/ShadowRoot.cpp:

(WebCore::ShadowRoot::findAssignedSlot): Added an assertion for regression testing.

  • dom/SlotAssignment.cpp:

(WebCore::SlotAssignment::findAssignedSlot): Removed the superfluous call to assignSlots added in r190840.
There is no need to update the slot assignments here (entires in m_slots are added or removed by
addSlotElementByName or removeSlotElementByName and assignSlots only updates assignedNodes in each SlotInfo
which is never used in this function or findFirstSlotElement.

  • html/HTMLDetailsElement.cpp:

(WebCore::HTMLDetailsElement::isActiveSummary): Fixed the bug.

LayoutTests:

Added a regression test.

  • fast/html/details-summary-tabindex-crash-expected.txt: Added.
  • fast/html/details-summary-tabindex-crash.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r198088 r198090  
     12016-03-13  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        REGRESSION (r190840): crash inside details element's slotNameFunction
     4        https://bugs.webkit.org/show_bug.cgi?id=155388
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Added a regression test.
     9
     10        * fast/html/details-summary-tabindex-crash-expected.txt: Added.
     11        * fast/html/details-summary-tabindex-crash.html: Added.
     12
    1132016-03-13  Dean Jackson  <dino@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r198087 r198090  
     12016-03-13  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        REGRESSION (r190840): crash inside details element's slotNameFunction
     4        https://bugs.webkit.org/show_bug.cgi?id=155388
     5
     6        Reviewed by Antti Koivisto.
     7
     8        The bug was caused by HTMLDetailsElement::isActiveSummary calling findAssignedSlot with a summary element
     9        inside the shadow tree of the detials element. Fixed it by existing early when the summary element passed
     10        to isActiveSummary is not a direct child of the details element.
     11
     12        Test: fast/html/details-summary-tabindex-crash.html
     13
     14        * dom/ShadowRoot.cpp:
     15        (WebCore::ShadowRoot::findAssignedSlot): Added an assertion for regression testing.
     16        * dom/SlotAssignment.cpp:
     17        (WebCore::SlotAssignment::findAssignedSlot): Removed the superfluous call to assignSlots added in r190840.
     18        There is no need to update the slot assignments here (entires in m_slots are added or removed by
     19        addSlotElementByName or removeSlotElementByName and assignSlots only updates assignedNodes in each SlotInfo
     20        which is never used in this function or findFirstSlotElement.
     21        * html/HTMLDetailsElement.cpp:
     22        (WebCore::HTMLDetailsElement::isActiveSummary): Fixed the bug.
     23
    1242016-03-13  Antti Koivisto  <antti@apple.com>
    225
  • trunk/Source/WebCore/dom/ShadowRoot.cpp

    r195243 r198090  
    183183HTMLSlotElement* ShadowRoot::findAssignedSlot(const Node& node)
    184184{
     185    ASSERT(node.parentNode() == host());
    185186    if (!m_slotAssignment)
    186187        return nullptr;
  • trunk/Source/WebCore/dom/SlotAssignment.cpp

    r194496 r198090  
    6565        return nullptr;
    6666
    67     if (!m_slotAssignmentsIsValid)
    68         assignSlots(shadowRoot);
    69 
    7067    auto slotName = m_slotNameFunction(node);
    7168    if (!slotName)
  • trunk/Source/WebCore/html/HTMLDetailsElement.cpp

    r194496 r198090  
    104104        return &summary == m_defaultSummary;
    105105
     106    if (summary.parentNode() != this)
     107        return false;
     108
    106109    auto* slot = shadowRoot()->findAssignedSlot(summary);
    107110    if (!slot)
Note: See TracChangeset for help on using the changeset viewer.