Changeset 178038 in webkit


Ignore:
Timestamp:
Jan 7, 2015 8:55:10 AM (9 years ago)
Author:
Chris Fleizach
Message:

AX: Crash: com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::AXObjectCache::clearTextMarkerNodesInUse + 149
https://bugs.webkit.org/show_bug.cgi?id=139929

Reviewed by Darin Adler.

Source/WebCore:

When a frame is replaced, there were instances when it was not clearing its associated nodes in the accessibility text marker -> Node cache.
This caused dead Nodes to be left in the cache which would eventually be accessed when the cache was cleaned out at a later time.

To fix this we should be clearing out the cache in Document::prepareForDestruction, instead of Frame::disconnectOwnerElement.

While working on this, it also exposed a problem where when a frame goes away, it doesn't inform its parent to update its children,
which causes an ASSERT to be hit with this test as well.

Tests: accessibility/frame-disconnect-textmarker-cache-crash.html

  • dom/Document.cpp:

(WebCore::Document::prepareForDestruction):

  • page/Frame.cpp:

(WebCore::Frame::disconnectOwnerElement):

Remove cache management from here since it is superceded by code in Document::prepareForDestruction

  • page/FrameView.cpp:

(WebCore::FrameView::removeFromAXObjectCache):

LayoutTests:

  • accessibility/frame-disconnect-textmarker-cache-crash-expected.txt: Added.
  • accessibility/frame-disconnect-textmarker-cache-crash.html: Added.
  • accessibility/resources/frameset.html: Added.
  • accessibility/resources/inform-parent-of-load.html: Added.
  • accessibility/resources/text.html: Added.
Location:
trunk
Files:
5 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r178037 r178038  
     12015-01-07  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: Crash: com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::AXObjectCache::clearTextMarkerNodesInUse + 149
     4        https://bugs.webkit.org/show_bug.cgi?id=139929
     5
     6        Reviewed by Darin Adler.
     7
     8        * accessibility/frame-disconnect-textmarker-cache-crash-expected.txt: Added.
     9        * accessibility/frame-disconnect-textmarker-cache-crash.html: Added.
     10        * accessibility/resources/frameset.html: Added.
     11        * accessibility/resources/inform-parent-of-load.html: Added.
     12        * accessibility/resources/text.html: Added.
     13
    1142015-01-07  Carlos Alberto Lopez Perez  <clopez@igalia.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r178036 r178038  
     12015-01-07  Chris Fleizach  <cfleizach@apple.com>
     2
     3        AX: Crash: com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::AXObjectCache::clearTextMarkerNodesInUse + 149
     4        https://bugs.webkit.org/show_bug.cgi?id=139929
     5
     6        Reviewed by Darin Adler.
     7
     8        When a frame is replaced, there were instances when it was not clearing its associated nodes in the accessibility text marker -> Node cache.
     9        This caused dead Nodes to be left in the cache which would eventually be accessed when the cache was cleaned out at a later time.
     10
     11        To fix this we should be clearing out the cache in Document::prepareForDestruction, instead of Frame::disconnectOwnerElement.
     12
     13        While working on this, it also exposed a problem where when a frame goes away, it doesn't inform its parent to update its children,
     14        which causes an ASSERT to be hit with this test as well.
     15
     16        Tests: accessibility/frame-disconnect-textmarker-cache-crash.html
     17
     18        * dom/Document.cpp:
     19        (WebCore::Document::prepareForDestruction):
     20        * page/Frame.cpp:
     21        (WebCore::Frame::disconnectOwnerElement):
     22            Remove cache management from here since it is superceded by code in Document::prepareForDestruction
     23        * page/FrameView.cpp:
     24        (WebCore::FrameView::removeFromAXObjectCache):
     25
    1262015-01-07  Zan Dobersek  <zdobersek@igalia.com>
    227
  • trunk/Source/WebCore/dom/Document.cpp

    r178013 r178038  
    20802080#endif
    20812081
     2082#if HAVE(ACCESSIBILITY)
     2083    // Sub-frames need to cleanup Nodes in the text marker cache when the Document disappears.
     2084    if (this != &topDocument()) {
     2085        if (AXObjectCache* cache = existingAXObjectCache())
     2086            cache->clearTextMarkerNodesInUse(this);
     2087    }
     2088#endif
     2089   
    20822090    disconnectDescendantFrames();
    20832091    if (m_domWindow && m_frame)
  • trunk/Source/WebCore/page/Frame.cpp

    r177857 r178038  
    804804{
    805805    if (m_ownerElement) {
    806         // We use the ownerElement's document to retrieve the cache, because the contentDocument for this
    807         // frame is already detached (and can't access the top level AX cache).
    808         // However, we pass in the current document to clearTextMarkerNodesInUse so we can identify the
    809         // nodes inside this document that need to be removed from the cache.
    810        
    811         // We don't clear the AXObjectCache here because we don't want to clear the top level cache
    812         // when a sub-frame is removed.
    813 #if HAVE(ACCESSIBILITY)
    814         if (AXObjectCache* cache = m_ownerElement->document().existingAXObjectCache())
    815             cache->clearTextMarkerNodesInUse(document());
    816 #endif
    817        
    818806        m_ownerElement->clearContentFrame();
    819807        if (m_page)
  • trunk/Source/WebCore/page/FrameView.cpp

    r178013 r178038  
    296296void FrameView::removeFromAXObjectCache()
    297297{
    298     if (AXObjectCache* cache = axObjectCache())
     298    if (AXObjectCache* cache = axObjectCache()) {
     299        if (HTMLFrameOwnerElement* owner = frame().ownerElement())
     300            cache->childrenChanged(owner->renderer());
    299301        cache->remove(this);
     302    }
    300303}
    301304
Note: See TracChangeset for help on using the changeset viewer.