[Webkit-unassigned] [Bug 231914] AX: Any addition of children should funnel through AccessibilityObject::addChild

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 19 08:37:38 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=231914

--- Comment #11 from Tyler Wilcock <tyler_w at apple.com> ---
(In reply to Andres Gonzalez from comment #6)
> (In reply to Tyler Wilcock from comment #3)
> > Created attachment 441675 [details]
> > Patch
> 
> --- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
> +++ a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
> 
> -    if (HTMLElement* autoFillElement = input.autoFillButtonElement()) {
> -        if (AccessibilityObject* axAutoFill =
> axObjectCache()->getOrCreate(autoFillElement))
> -            m_children.append(axAutoFill);
> -    }
> +    if (HTMLElement* autoFillElement = input.autoFillButtonElement())
> 
> if (auto* autoFillElement = input.autoFillButtonElement())
> 
> +        addChild(axObjectCache()->getOrCreate(autoFillElement));
> 
> We were checking for nullity of axObjectCache() before. I wouldn't remove
> that check yet, until we solidify the life times of the objects respect to
> the cache.

I might be mis-reading it, but I don't think the code before checked the nullity of the cache before dereferencing it.

Old:

if (HTMLElement* autoFillElement = input.autoFillButtonElement()) {
    if (AccessibilityObject* axAutoFill = axObjectCache()->getOrCreate(autoFillElement))
        m_children.append(axAutoFill);
}

New:

if (HTMLElement* autoFillElement = input.autoFillButtonElement())
    addChild(axObjectCache()->getOrCreate(autoFillElement));

If the new object the cache returns is null, `addChild` does nothing.

I can add a null check of the cache, though. Can also use an auto* here.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20211019/549902af/attachment-0001.htm>


More information about the webkit-unassigned mailing list