Skip to content

AX: Bound all indefinite-blocking main-thread retrieval calls from the accessibility thread with timeouts#64519

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
twilco:eng/AX-Bound-all-indefinite-blocking-main-thread-retrieval-calls-from-the-accessibility-thread-with-timeouts
May 8, 2026
Merged

AX: Bound all indefinite-blocking main-thread retrieval calls from the accessibility thread with timeouts#64519
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
twilco:eng/AX-Bound-all-indefinite-blocking-main-thread-retrieval-calls-from-the-accessibility-thread-with-timeouts

Conversation

@twilco
Copy link
Copy Markdown
Contributor

@twilco twilco commented May 8, 2026

ab00c2f

AX: Bound all indefinite-blocking main-thread retrieval calls from the accessibility thread with timeouts
https://bugs.webkit.org/show_bug.cgi?id=314367
rdar://176524311

Reviewed by Dominic Mazzoni.

retrieveAutoreleasedValueFromMainThread and retrieveValueFromMainThread block
the AX thread forever via callOnMainThreadAndWait if the main thread is busy
(e.g. long-running JS, layout, synchronous IPC). This can cause assistive
technologies to hang waiting for responses that never come.

Convert all unguarded call sites in WebAccessibilityObjectWrapperMac to use
retrieveValueFromMainThreadWithTimeout (or the WithDefault variant), returning
nil on timeout.

For three operations (text marker for position, start/end text marker for
bounds), add approximate-hit-test fallbacks: when the main thread times out,
use AXIsolatedObject::approximateHitTest to find the element at the relevant
point and return the start/end of its text marker range. This provides a
potentially less accurate, but usable result rather than nothing.

Make AXIsolatedObject::approximateHitTest public so the wrapper can call it
directly for these fallbacks without going through accessibilityHitTest (which
would redundantly attempt the main thread again).

* Source/WebCore/accessibility/AXCoreObject.h:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h:
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper attachmentView]):
(-[WebAccessibilityObjectWrapper _associatedPluginParentWith:]):
(handleLineRectsAndTextAttribute):
(-[WebAccessibilityObjectWrapper _accessibilityHitTest:returnPlatformElements:]):
(handleSelectTextWithCriteriaAttribute):
(handleSearchTextWithCriteriaAttribute):
(handleTextOperationAttribute):
(handleEndTextMarkerForBoundsAttribute):
(handleStartTextMarkerForBoundsAttribute):
(handleMisspellingTextMarkerRangeAttribute):
(handleTextMarkerForPositionAttribute):

Canonical link: https://commits.webkit.org/312880@main

60729d3

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe 🛠 win ⏳ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 🧪 win-tests ⏳ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ⏳ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@twilco twilco self-assigned this May 8, 2026
@twilco twilco added the Accessibility For bugs related to accessibility. label May 8, 2026
@twilco twilco added the merge-queue Applied to send a pull request to merge-queue label May 8, 2026
…e accessibility thread with timeouts

https://bugs.webkit.org/show_bug.cgi?id=314367
rdar://176524311

Reviewed by Dominic Mazzoni.

retrieveAutoreleasedValueFromMainThread and retrieveValueFromMainThread block
the AX thread forever via callOnMainThreadAndWait if the main thread is busy
(e.g. long-running JS, layout, synchronous IPC). This can cause assistive
technologies to hang waiting for responses that never come.

Convert all unguarded call sites in WebAccessibilityObjectWrapperMac to use
retrieveValueFromMainThreadWithTimeout (or the WithDefault variant), returning
nil on timeout.

For three operations (text marker for position, start/end text marker for
bounds), add approximate-hit-test fallbacks: when the main thread times out,
use AXIsolatedObject::approximateHitTest to find the element at the relevant
point and return the start/end of its text marker range. This provides a
potentially less accurate, but usable result rather than nothing.

Make AXIsolatedObject::approximateHitTest public so the wrapper can call it
directly for these fallbacks without going through accessibilityHitTest (which
would redundantly attempt the main thread again).

* Source/WebCore/accessibility/AXCoreObject.h:
* Source/WebCore/accessibility/isolatedtree/AXIsolatedObject.h:
* Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper attachmentView]):
(-[WebAccessibilityObjectWrapper _associatedPluginParentWith:]):
(handleLineRectsAndTextAttribute):
(-[WebAccessibilityObjectWrapper _accessibilityHitTest:returnPlatformElements:]):
(handleSelectTextWithCriteriaAttribute):
(handleSearchTextWithCriteriaAttribute):
(handleTextOperationAttribute):
(handleEndTextMarkerForBoundsAttribute):
(handleStartTextMarkerForBoundsAttribute):
(handleMisspellingTextMarkerRangeAttribute):
(handleTextMarkerForPositionAttribute):

Canonical link: https://commits.webkit.org/312880@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/AX-Bound-all-indefinite-blocking-main-thread-retrieval-calls-from-the-accessibility-thread-with-timeouts branch from 60729d3 to ab00c2f Compare May 8, 2026 14:10
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 312880@main (ab00c2f): https://commits.webkit.org/312880@main

Reviewed commits have been landed. Closing PR #64519 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit ab00c2f into WebKit:main May 8, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Accessibility For bugs related to accessibility.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants