Bug 256238

Summary: AX: Avoid hitting the main thread in [WKAccessibilityWebPageObject accessibilityParameterizedAttributeNames] in isolated tree mode.
Product: WebKit Reporter: Andres Gonzalez <andresg_22>
Component: AccessibilityAssignee: Andres Gonzalez <andresg_22>
Status: RESOLVED FIXED    
Severity: Normal CC: andresg_22, tyler_w, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch ews-feeder: commit-queue-

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].