<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>287716</bug_id>
          
          <creation_ts>2025-02-14 10:51:16 -0800</creation_ts>
          <short_desc>AX: performDeferredCacheUpdate needs to check document.hasPendingStyleRecalc</short_desc>
          <delta_ts>2025-02-24 12:08:18 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Accessibility</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dominic Mazzoni">dm_mazzoni</reporter>
          <assigned_to name="Dominic Mazzoni">dm_mazzoni</assigned_to>
          <cc>andresg_22</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2094823</commentid>
    <comment_count>0</comment_count>
    <who name="Dominic Mazzoni">dm_mazzoni</who>
    <bug_when>2025-02-14 10:51:16 -0800</bug_when>
    <thetext>When AXObjectCache::performDeferredCacheUpdate is called, it checks to see if the document needs layout first before updating the accessibility tree. If this isn&apos;t done, walking the accessibility tree can trigger a layout in the middle, leading to inconsistencies and crashes.

I discovered this while debugging this ARIA example. I can trigger a crash using VoiceOver, but the repro steps are quite tricky and I didn&apos;t have any luck turning it into a layout test.

https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/

The underlying issue was that the listbox was changing from display:none to display:block, but under some circumstances it was possible for AXObjectCache::performDeferredCacheUpdate to get called when style is dirty but needsLayout still returns false, so it wouldn&apos;t update layout, and that would lead to the listbox options getting created with the wrong parent id. VoiceOver wouldn&apos;t speak them, and in debug mode we&apos;d get an assertion failure.

I did write a layout test that successfully triggers this scenario, however it also triggers a separate unrelated assertion failure so I can&apos;t merge it yet. I filed a separate bug for that one: https://bugs.webkit.org/show_bug.cgi?id=287715 (AX: attached layout test triggers assertion in AXIsolatedObject::children)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2094825</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-02-14 10:53:21 -0800</bug_when>
    <thetext>&lt;rdar://problem/144875397&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2094826</commentid>
    <comment_count>2</comment_count>
    <who name="Dominic Mazzoni">dm_mazzoni</who>
    <bug_when>2025-02-14 10:57:49 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/40631</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2097443</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-02-24 12:08:15 -0800</bug_when>
    <thetext>Committed 290961@main (f4ed96d58ea8): &lt;https://commits.webkit.org/290961@main&gt;

Reviewed commits have been landed. Closing PR #40631 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>