⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 277434 in webkit


Ignore:
Timestamp:
May 13, 2021, 7:30:23 AM (5 years ago)
Author:
Chris Fleizach
Message:

AX: Crash at WebCore::Document::updateLayout
https://bugs.webkit.org/show_bug.cgi?id=225677

Reviewed by Alan Bujtas.

Source/WebCore:

Handling notifications while during layout is risky because we can call back into an update method.
We have handled many other cases like this by deferring the notification, as we do here.
Special note: this test can't be made to crash because actual crash requires the accessibility
runtime to be initialized and posting real notifications to the system. But, we can verify that the
notification is still sent correctly under conditions that could lead to a crash.

Test: accessibility/mac/menu-selection-notification-crash.html

  • accessibility/AXObjectCache.cpp:

(WebCore::AXObjectCache::deferMenuListValueChange):
(WebCore::AXObjectCache::performDeferredCacheUpdate):

  • accessibility/AXObjectCache.h:
  • accessibility/AccessibilityMenuList.cpp:

(WebCore::AccessibilityMenuList::didUpdateActiveOption):

LayoutTests:

  • accessibility/mac/menu-selection-notification-crash-expected.txt: Added.
  • accessibility/mac/menu-selection-notification-crash.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r277432 r277434  
     12021-05-13  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: Crash at WebCore::Document::updateLayout
     4        https://bugs.webkit.org/show_bug.cgi?id=225677
     5
     6        Reviewed by Alan Bujtas.
     7
     8        * accessibility/mac/menu-selection-notification-crash-expected.txt: Added.
     9        * accessibility/mac/menu-selection-notification-crash.html: Added.
     10
    1112021-05-13  Enrique Ocaña González  <eocanha@igalia.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r277432 r277434  
     12021-05-13  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: Crash at WebCore::Document::updateLayout
     4        https://bugs.webkit.org/show_bug.cgi?id=225677
     5
     6        Reviewed by Alan Bujtas.
     7
     8        Handling notifications while during layout is risky because we can call back into an update method.
     9        We have handled many other cases like this by deferring the notification, as we do here.
     10        Special note: this test can't be made to crash because actual crash requires the accessibility
     11        runtime to be initialized and posting real notifications to the system. But, we can verify that the
     12        notification is still sent correctly under conditions that could lead to a crash.
     13
     14        Test: accessibility/mac/menu-selection-notification-crash.html
     15
     16        * accessibility/AXObjectCache.cpp:
     17        (WebCore::AXObjectCache::deferMenuListValueChange):
     18        (WebCore::AXObjectCache::performDeferredCacheUpdate):
     19        * accessibility/AXObjectCache.h:
     20        * accessibility/AccessibilityMenuList.cpp:
     21        (WebCore::AccessibilityMenuList::didUpdateActiveOption):
     22
    1232021-05-13  Enrique Ocaña González  <eocanha@igalia.com>
    224
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r277382 r277434  
    12291229    } else
    12301230        handleFocusedUIElementChanged(oldNode, newNode);
     1231}
     1232
     1233void AXObjectCache::deferMenuListValueChange(Element* element)
     1234{
     1235    m_deferredMenuListChange.add(element);
     1236    if (!m_performCacheUpdateTimer.isActive())
     1237        m_performCacheUpdateTimer.startOneShot(0_s);
    12311238}
    12321239
     
    31973204    m_deferredModalChangedList.clear();
    31983205
     3206    for (auto& deferredMenuListChangeElement : m_deferredMenuListChange)
     3207        postNotification(&deferredMenuListChangeElement, AXObjectCache::AXMenuListValueChanged);
     3208    m_deferredMenuListChange.clear();
     3209   
    31993210    platformPerformDeferredCacheUpdate();
    32003211}
  • trunk/Source/WebCore/accessibility/AXObjectCache.h

    r273869 r277434  
    188188    void deferFocusedUIElementChangeIfNeeded(Node* oldFocusedNode, Node* newFocusedNode);
    189189    void deferModalChange(Element*);
     190    void deferMenuListValueChange(Element*);
    190191    void handleScrolledToAnchor(const Node* anchorNode);
    191192    void handleScrollbarUpdate(ScrollView*);
     
    514515    ListHashSet<Node*> m_deferredChildrenChangedNodeList;
    515516    WeakHashSet<Element> m_deferredModalChangedList;
     517    WeakHashSet<Element> m_deferredMenuListChange;
    516518    HashMap<Element*, String> m_deferredTextFormControlValue;
    517519    HashMap<Element*, QualifiedName> m_deferredAttributeChange;
  • trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp

    r266805 r277434  
    137137
    138138    if (auto* cache = document->axObjectCache())
    139         cache->postNotification(this, document.ptr(), AXObjectCache::AXMenuListValueChanged);
     139        cache->deferMenuListValueChange(element());
    140140}
    141141
Note: See TracChangeset for help on using the changeset viewer.