Files
Storm DragonandClaude Opus 5.5 9c1fc644ba Add browser accessibility for Chromium windows
Chromium-based Windows applications under Wine (Electron, CEF) exposed only
what the legacy MSAA path could announce, one event at a time. The helper now
starts a publisher for each Chromium window: a PE worker reads the page
through MSAA and IAccessible2 inside the prefix, and a native ATK publisher
presents it on the accessibility bus as toolkit Chromium, matching native
Linux Chromium, so the reader's own browser support handles browse mode,
structural navigation, forms, tables and live regions. Once a window is
published, legacy announcements for it stop, so nothing is spoken twice; if
the publisher fails, the window returns to the legacy path and the helper
retries with backoff. Publishers follow the helper's lifetime.

The publisher marks itself with WINE_ACCESS_BROWSER_PUBLISHER=1 and gives each
frame a wine-access-x11-window attribute so readers can verify window
ownership. Password text, values and boundaries never leave the worker.
Design, mapping rules and verification are in docs/browser.md; the
IAccessible2 IDL is vendored in third_party/ia2.

Checked: xvfb-run ctest (all 10, including the new
browser-publisher-snapshot comparison with native Chromium 158 and Electron
42), menu_integration.py with the menu and edit fixtures, the Orca extension
unit tests, and tests/browser/live_checks.sh against Electron 45: worker
protocol, helper lifecycle (publish, no legacy announcements while typing,
restart, no orphans), and live tree, text boundaries and AT-SPI event
sequence matching native Chromium. A live test with Cthulhu on Electron 45
read the fixture page correctly.

Remaining live checks: Orca with the extension, Firefox, WebView2, 32-bit
browsers, iframes, and window switching under other window managers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 23:15:21 -05:00

54 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# Run a command in a private D-Bus session whose accessibility bus lives in a
# private runtime directory, so tests can never touch the user's live
# accessibility bus. Refuses to run the command if isolation cannot be proven.
# Usage: private_session.sh COMMAND...
#
# Background: at-spi-bus-launcher puts its socket at
# $XDG_RUNTIME_DIR/at-spi/bus_<display>, and advertises it in the AT_SPI_BUS
# property of its display's root window, which libatspi checks first. A
# launcher that sees the user's XDG_RUNTIME_DIR takes over the user's socket
# path and deletes it on exit; one that sees DISPLAY=:0 pulls the user's newly
# connecting applications onto the test bus. So the private D-Bus session gets
# a private runtime directory and no display at all; commands that need a
# display start their own (xvfb-run) inside it.
set -u
if [[ $# -lt 1 ]]; then
echo "Usage: $0 COMMAND..."
exit 2
fi
userDisplay="${DISPLAY:-}"
privateRuntime="$(mktemp -d)"
chmod 700 "$privateRuntime"
trap 'rm -rf "$privateRuntime"' EXIT
export XDG_RUNTIME_DIR="$privateRuntime"
unset AT_SPI_BUS_ADDRESS DISPLAY WAYLAND_DISPLAY
export userDisplay
# shellcheck disable=SC2016 # expanded by the inner shell
dbus-run-session -- bash -c '
busAddress="$(gdbus call --session --dest org.a11y.Bus --object-path /org/a11y/bus \
--method org.a11y.Bus.GetAddress 2> /dev/null)"
case "$busAddress" in
*"unix:path=$XDG_RUNTIME_DIR/"*) ;;
*)
echo "Refusing to run: the accessibility bus is not private ($busAddress)" >&2
exit 90
;;
esac
# Tripwire while the launcher is running (it removes the property on exit):
# the user display must never advertise the test bus.
if [[ -n "$userDisplay" ]] && DISPLAY="$userDisplay" xprop -root AT_SPI_BUS 2> /dev/null |
grep -q "$XDG_RUNTIME_DIR"; then
echo "Refusing to run: the user display advertises the test accessibility bus" >&2
exit 91
fi
gdbus call --session --dest org.a11y.Bus --object-path /org/a11y/bus \
--method org.freedesktop.DBus.Properties.Set org.a11y.Status IsEnabled "<true>" > /dev/null
"$@"
' private_session_inner "$@"
sessionStatus=$?
exit "$sessionStatus"