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

Changeset 263285 in webkit


Ignore:
Timestamp:
Jun 19, 2020, 2:03:35 PM (6 years ago)
Author:
Andres Gonzalez
Message:

AX: web process crash in AXObjectCache::postNotification.
https://bugs.webkit.org/show_bug.cgi?id=213398

Reviewed by Chris Fleizach.

AXObjectCache was being instantiated on the AX secondary thread.
Therefore the timers for the different delayed notifications where
initialized with the secondary thread. When postNotification was triggered
on the main thread as it should, and the timer was accessed, the timer
would assert/crash for being accessed in a thread different than where
it was created. This change guaranties that AXObjectCache is always
created on the main thread.

Source/WebCore:

  • accessibility/AXObjectCache.cpp:

(WebCore::AXObjectCache::enableAccessibility):
(WebCore::AXObjectCache::AXObjectCache):
(WebCore::AXObjectCache::postNotification):

Source/WebKit:

  • WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:

(-[WKAccessibilityWebPageObjectBase axObjectCache]):
(-[WKAccessibilityWebPageObjectBase accessibilityPluginObject]):
(-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
(-[WKAccessibilityWebPageObjectBase setWebPage:]):
(-[WKAccessibilityWebPageObjectBase setHasMainFramePlugin:]):
(-[WKAccessibilityWebPageObjectBase setRemoteParent:]):

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r263282 r263285  
     12020-06-19  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        AX: web process crash in AXObjectCache::postNotification.
     4        https://bugs.webkit.org/show_bug.cgi?id=213398
     5
     6        Reviewed by Chris Fleizach.
     7
     8        AXObjectCache was being instantiated on the AX secondary thread.
     9        Therefore the timers for the different delayed notifications where
     10        initialized with the secondary thread. When postNotification was triggered
     11        on the main thread as it should, and the timer was accessed, the timer
     12        would assert/crash for being accessed in a thread different than where
     13        it was created. This change guaranties that AXObjectCache is always
     14        created on the main thread.
     15
     16        * accessibility/AXObjectCache.cpp:
     17        (WebCore::AXObjectCache::enableAccessibility):
     18        (WebCore::AXObjectCache::AXObjectCache):
     19        (WebCore::AXObjectCache::postNotification):
     20
    1212020-06-19  Chris Dumez  <cdumez@apple.com>
    222
  • trunk/Source/WebCore/accessibility/AXObjectCache.cpp

    r262073 r263285  
    196196void AXObjectCache::enableAccessibility()
    197197{
     198    ASSERT(isMainThread());
    198199    gAccessibilityEnabled = true;
    199200}
     
    223224    , m_performCacheUpdateTimer(*this, &AXObjectCache::performCacheUpdateTimerFired)
    224225{
     226    ASSERT(isMainThread());
    225227}
    226228
     
    11301132    AXTRACE("AXObjectCache::postNotification");
    11311133    AXLOG(std::make_pair(object, notification));
     1134    ASSERT(isMainThread());
    11321135
    11331136    stopCachingComputedObjectAttributes();
  • trunk/Source/WebKit/ChangeLog

    r263275 r263285  
     12020-06-19  Andres Gonzalez  <andresg_22@apple.com>
     2
     3        AX: web process crash in AXObjectCache::postNotification.
     4        https://bugs.webkit.org/show_bug.cgi?id=213398
     5
     6        Reviewed by Chris Fleizach.
     7
     8        AXObjectCache was being instantiated on the AX secondary thread.
     9        Therefore the timers for the different delayed notifications where
     10        initialized with the secondary thread. When postNotification was triggered
     11        on the main thread as it should, and the timer was accessed, the timer
     12        would assert/crash for being accessed in a thread different than where
     13        it was created. This change guaranties that AXObjectCache is always
     14        created on the main thread.
     15
     16        * WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm:
     17        (-[WKAccessibilityWebPageObjectBase axObjectCache]):
     18        (-[WKAccessibilityWebPageObjectBase accessibilityPluginObject]):
     19        (-[WKAccessibilityWebPageObjectBase accessibilityRootObjectWrapper]):
     20        (-[WKAccessibilityWebPageObjectBase setWebPage:]):
     21        (-[WKAccessibilityWebPageObjectBase setHasMainFramePlugin:]):
     22        (-[WKAccessibilityWebPageObjectBase setRemoteParent:]):
     23
    1242020-06-19  Chris Fleizach  <cfleizach@apple.com>
    225
  • trunk/Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectBase.mm

    r259843 r263285  
    4343#import <WebCore/Scrollbar.h>
    4444
     45namespace ax = WebCore::Accessibility;
     46
    4547@implementation WKAccessibilityWebPageObjectBase
    4648
    4749- (NakedPtr<WebCore::AXObjectCache>)axObjectCache
    4850{
     51    ASSERT(isMainThread());
     52
    4953    if (!m_page)
    5054        return nullptr;
     
    6367- (id)accessibilityPluginObject
    6468{
     69    ASSERT(isMainThread());
    6570    auto retrieveBlock = [&self]() -> id {
    6671        id axPlugin = nil;
     
    8590- (id)accessibilityRootObjectWrapper
    8691{
    87     if (!WebCore::AXObjectCache::accessibilityEnabled())
    88         WebCore::AXObjectCache::enableAccessibility();
     92    return ax::retrieveAutoreleasedValueFromMainThread<id>([protectedSelf = retainPtr(self)] () -> RetainPtr<id> {
     93        if (!WebCore::AXObjectCache::accessibilityEnabled())
     94            WebCore::AXObjectCache::enableAccessibility();
    8995
    90     if (m_hasMainFramePlugin)
    91         return self.accessibilityPluginObject;
     96        if (protectedSelf.get()->m_hasMainFramePlugin)
     97            return protectedSelf.get().accessibilityPluginObject;
    9298
    93     if (auto cache = [self axObjectCache]) {
    94         if (WebCore::AXCoreObject* root = cache->rootObject())
    95             return root->wrapper();
    96     }
     99        if (auto cache = protectedSelf.get().axObjectCache) {
     100            if (auto* root = cache->rootObject())
     101                return root->wrapper();
     102        }
    97103
    98     return nil;
     104        return nil;
     105    });
    99106}
    100107
    101108- (void)setWebPage:(NakedPtr<WebKit::WebPage>)page
    102109{
     110    ASSERT(isMainThread());
     111
    103112    m_page = page;
    104113
     
    116125- (void)setHasMainFramePlugin:(bool)hasPlugin
    117126{
     127    ASSERT(isMainThread());
    118128    m_hasMainFramePlugin = hasPlugin;
    119129}
     
    121131- (void)setRemoteParent:(id)parent
    122132{
     133    ASSERT(isMainThread());
    123134    if (parent != m_parent) {
    124135        [m_parent release];
     
    132143}
    133144
    134 
    135145@end
Note: See TracChangeset for help on using the changeset viewer.