Changeset 220551 in webkit


Ignore:
Timestamp:
Aug 10, 2017 3:15:49 PM (7 years ago)
Author:
n_wang@apple.com
Message:

AX: crash at WebCore::AccessibilityObject::supportsARIALiveRegion() const + 24
https://bugs.webkit.org/show_bug.cgi?id=175340
<rdar://problem/33782159>

Reviewed by Chris Fleizach.

Source/WebCore:

The issue here is that we manualy set the parent object of the AccessibilitySVGRoot object
and there are chances that the parent doesn't detach it properly during the parent's destroying
process. Accessing the stale parent object will lead to a crash.
Fixed this by making the parent object a weak pointer so we don't access an invalid memory.

Test: accessibility/add-children-pseudo-element.html

  • accessibility/AccessibilityRenderObject.cpp:

(WebCore::AccessibilityRenderObject::AccessibilityRenderObject):

  • accessibility/AccessibilityRenderObject.h:

(WebCore::AccessibilityRenderObject::createWeakPtr):

  • accessibility/AccessibilitySVGRoot.cpp:

(WebCore::AccessibilitySVGRoot::AccessibilitySVGRoot):
(WebCore::AccessibilitySVGRoot::setParent):
(WebCore::AccessibilitySVGRoot::parentObject const):

  • accessibility/AccessibilitySVGRoot.h:

LayoutTests:

  • accessibility/add-children-pseudo-element-expected.txt: Added.
  • accessibility/add-children-pseudo-element.html: Added.
  • accessibility/resources/svg-circle.svg: Added.
Location:
trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r220549 r220551  
     12017-08-10  Nan Wang  <n_wang@apple.com>
     2
     3        AX: crash at WebCore::AccessibilityObject::supportsARIALiveRegion() const + 24
     4        https://bugs.webkit.org/show_bug.cgi?id=175340
     5        <rdar://problem/33782159>
     6
     7        Reviewed by Chris Fleizach.
     8
     9        * accessibility/add-children-pseudo-element-expected.txt: Added.
     10        * accessibility/add-children-pseudo-element.html: Added.
     11        * accessibility/resources/svg-circle.svg: Added.
     12
    1132017-08-10  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r220549 r220551  
     12017-08-10  Nan Wang  <n_wang@apple.com>
     2
     3        AX: crash at WebCore::AccessibilityObject::supportsARIALiveRegion() const + 24
     4        https://bugs.webkit.org/show_bug.cgi?id=175340
     5        <rdar://problem/33782159>
     6
     7        Reviewed by Chris Fleizach.
     8
     9        The issue here is that we manualy set the parent object of the AccessibilitySVGRoot object
     10        and there are chances that the parent doesn't detach it properly during the parent's destroying
     11        process. Accessing the stale parent object will lead to a crash.
     12        Fixed this by making the parent object a weak pointer so we don't access an invalid memory.
     13
     14        Test: accessibility/add-children-pseudo-element.html
     15
     16        * accessibility/AccessibilityRenderObject.cpp:
     17        (WebCore::AccessibilityRenderObject::AccessibilityRenderObject):
     18        * accessibility/AccessibilityRenderObject.h:
     19        (WebCore::AccessibilityRenderObject::createWeakPtr):
     20        * accessibility/AccessibilitySVGRoot.cpp:
     21        (WebCore::AccessibilitySVGRoot::AccessibilitySVGRoot):
     22        (WebCore::AccessibilitySVGRoot::setParent):
     23        (WebCore::AccessibilitySVGRoot::parentObject const):
     24        * accessibility/AccessibilitySVGRoot.h:
     25
    1262017-08-10  Chris Dumez  <cdumez@apple.com>
    227
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp

    r219595 r220551  
    110110    : AccessibilityNodeObject(renderer->node())
    111111    , m_renderer(renderer)
     112    , m_weakPtrFactory(this)
    112113{
    113114#ifndef NDEBUG
  • trunk/Source/WebCore/accessibility/AccessibilityRenderObject.h

    r215975 r220551  
    3232#include "LayoutRect.h"
    3333#include <wtf/Forward.h>
     34#include <wtf/WeakPtr.h>
    3435
    3536namespace WebCore {
     
    199200
    200201    String passwordFieldValue() const override;
     202   
     203    WeakPtr<AccessibilityRenderObject> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
    201204
    202205protected:
     
    218221
    219222private:
     223    WeakPtrFactory<AccessibilityRenderObject> m_weakPtrFactory;
    220224    bool isAccessibilityRenderObject() const final { return true; }
    221225    void ariaListboxSelectedChildren(AccessibilityChildrenVector&);
  • trunk/Source/WebCore/accessibility/AccessibilitySVGRoot.cpp

    r198137 r220551  
    3636AccessibilitySVGRoot::AccessibilitySVGRoot(RenderObject* renderer)
    3737    : AccessibilitySVGElement(renderer)
    38     , m_parent(nullptr)
    3938{
    4039}
     
    4847    return adoptRef(*new AccessibilitySVGRoot(renderer));
    4948}
     49
     50void AccessibilitySVGRoot::setParent(AccessibilityRenderObject *parent)
     51{
     52    if (parent)
     53        m_parent = parent->createWeakPtr();
     54    else
     55        m_parent = nullptr;
     56}
    5057   
    5158AccessibilityObject* AccessibilitySVGRoot::parentObject() const
     
    5461    // but otherwise, we should rely on the standard render tree for the parent.
    5562    if (m_parent)
    56         return m_parent;
     63        return m_parent.get();
    5764   
    5865    return AccessibilitySVGElement::parentObject();
  • trunk/Source/WebCore/accessibility/AccessibilitySVGRoot.h

    r208179 r220551  
    3030
    3131#include "AccessibilitySVGElement.h"
     32#include <wtf/WeakPtr.h>
    3233
    3334namespace WebCore {
     
    3839    virtual ~AccessibilitySVGRoot();
    3940   
    40     void setParent(AccessibilityObject* parent) { m_parent = parent; }
     41    void setParent(AccessibilityRenderObject*);
    4142
    4243private:
     
    4647    bool isAccessibilitySVGRoot() const override { return true; }
    4748
    48     AccessibilityObject* m_parent;
     49    WeakPtr<AccessibilityRenderObject> m_parent;
    4950    AccessibilityRole roleValue() const override { return GroupRole; }
    5051};
Note: See TracChangeset for help on using the changeset viewer.