Bug 256238 - AX: Avoid hitting the main thread in [WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames] in isolated tree mode.
Summary: AX: Avoid hitting the main thread in [WKAccessibilityWebPageObject accessibil...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Andres Gonzalez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-05-02 17:43 PDT by Andres Gonzalez
Modified: 2023-05-03 13:40 PDT (History)
3 users (show)

See Also:


Attachments
Patch (5.68 KB, patch)
2023-05-02 17:56 PDT, Andres Gonzalez
no flags Details | Formatted Diff | Diff
Patch (5.84 KB, patch)
2023-05-03 10:19 PDT, Andres Gonzalez
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andres Gonzalez 2023-05-02 17:43:41 PDT
this method is hitting the main thread during page load.
Comment 1 Radar WebKit Bug Importer 2023-05-02 17:43:56 PDT
<rdar://problem/108818952>
Comment 2 Andres Gonzalez 2023-05-02 17:56:02 PDT
Created attachment 466184 [details]
Patch
Comment 3 Tyler Wilcock 2023-05-02 18:02:33 PDT
Comment on attachment 466184 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=466184&action=review

> Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:93
> +    m_parameterizedAttributeNames = createNSArray(corePage->pageOverlayController().copyAccessibilityAttributesNames(true));

PageOverlayController uses PageOverlayController::m_pageOverlays in copyAccessibilityAttributesNames, and m_pageOverlays can change. Do we need to update this value when that happens?
Comment 4 Andres Gonzalez 2023-05-03 10:19:53 PDT
Created attachment 466194 [details]
Patch
Comment 5 Andres Gonzalez 2023-05-03 10:28:14 PDT
(In reply to Tyler Wilcock from comment #3)
> Comment on attachment 466184 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=466184&action=review
> 
> > Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:93
> > +    m_parameterizedAttributeNames = createNSArray(corePage->pageOverlayController().copyAccessibilityAttributesNames(true));
> 
> PageOverlayController uses PageOverlayController::m_pageOverlays in
> copyAccessibilityAttributesNames, and m_pageOverlays can change. Do we need
> to update this value when that happens?

Added a FIXME concerning this, but this was not being updated before and it didn't cause any problem that we know of. Attribute names should not change much at all, and their importance is rather low because a client can query for any attribute whether it is returned here or not. In fact, this API is deprecated altogether since it only serves a purpose for discoverability but nothing else.
Comment 6 Tyler Wilcock 2023-05-03 10:34:12 PDT
(In reply to Andres Gonzalez from comment #5)
> (In reply to Tyler Wilcock from comment #3)
> > Comment on attachment 466184 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=466184&action=review
> > 
> > > Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm:93
> > > +    m_parameterizedAttributeNames = createNSArray(corePage->pageOverlayController().copyAccessibilityAttributesNames(true));
> > 
> > PageOverlayController uses PageOverlayController::m_pageOverlays in
> > copyAccessibilityAttributesNames, and m_pageOverlays can change. Do we need
> > to update this value when that happens?
> 
> Added a FIXME concerning this, but this was not being updated before and it
> didn't cause any problem that we know of. Attribute names should not change
> much at all, and their importance is rather low because a client can query
> for any attribute whether it is returned here or not. In fact, this API is
> deprecated altogether since it only serves a purpose for discoverability but
> nothing else.
Ah, I missed that we were already caching these ones. Sounds good, thanks!
Comment 7 EWS 2023-05-03 11:59:42 PDT
Committed 263642@main (d68576bd2062): <https://commits.webkit.org/263642@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 466194 [details].