Retire ATK nodes without accessing freed children or retaining dangling parent and ID pointers. Treat failed and malformed MSAA state queries as protected, and initialize worker logging before argument validation. Add publisher lifetime and worker privacy regressions, correct the publisher build target dependency, and remove both browser artifacts during uninstall. Validation: build, all 12 CTests, updated startup-error regression, AddressSanitizer lifetime check, shellcheck, and temporary-prefix removal check passed. Live speech and Braille acceptance remains separate.
124 lines
6.8 KiB
Markdown
124 lines
6.8 KiB
Markdown
# Browser accessibility (Chromium under Wine)
|
|
|
|
Wine Access publishes Windows Chromium windows (Electron, CEF and other
|
|
Chromium hosts) on the Linux accessibility bus so that Cthulhu and Orca read
|
|
them with their own browser support: browse and focus modes, structural
|
|
navigation, tables, forms, live regions, speech and Braille. It is on for every
|
|
Chromium window the helper sees; there is no switch to turn it off.
|
|
|
|
## Components
|
|
|
|
```text
|
|
Chromium window in a Wine prefix
|
|
| MSAA + IAccessible2, cross-process through Wine's ia2comproxy.dll
|
|
wine-access-browser-worker.exe (PE, one per window, inside the prefix)
|
|
| JSON lines over stdin/stdout
|
|
wine-access-browser-publisher (native Linux, ATK + atk-bridge)
|
|
| AT-SPI on the accessibility bus, toolkit "Chromium"
|
|
Cthulhu / Orca browser support
|
|
```
|
|
|
|
- The helper (`browser_bridge.cpp`) starts one publisher for each visible
|
|
top-level `Chrome_WidgetWin_1` window that contains a
|
|
`Chrome_RenderWidgetHostHWND`. The publisher starts the worker through the
|
|
prefix's own Wine loader (`WINELOADER`, which both readers pass, or the
|
|
helper's preloader) so it joins the same wineserver.
|
|
- When the publisher prints `published`, the helper stops legacy
|
|
announcements (WinEvent presentation, control polling) for that window;
|
|
otherwise every change would be spoken twice. If the publisher exits while
|
|
the window still exists, the window returns to legacy announcements and the
|
|
helper retries with backoff (at most three failures per window).
|
|
- Publishers follow the helper: they receive SIGTERM when it dies, because
|
|
readers stop the helper with a signal that skips its shutdown code. The
|
|
worker exits when its input closes.
|
|
- The publisher re-executes itself with `WINE_ACCESS_BROWSER_PUBLISHER=1` in
|
|
its environment and gives each frame a `wine-access-x11-window` attribute.
|
|
Readers that compare the accessible window's PID with the X11 window owner
|
|
(Cthulhu) use these to accept the publisher for that window only: same user,
|
|
same prefix, matching window. Orca checks window state, not PIDs.
|
|
|
|
## Worker (`browser_worker.cpp`)
|
|
|
|
- Activation: Chromium exposes web content only to clients that look like
|
|
screen readers. The worker calls `accDefaultAction` on every object of the
|
|
initial window tree (the measured trigger), then verifies that content
|
|
appeared.
|
|
- Identity: objects are keyed by IA2 `uniqueID`. Web content resolves through
|
|
the `Chrome_RenderWidgetHostHWND` child's root, browser UI through the
|
|
top-level window.
|
|
- Threads: the main thread owns the WinEvent hook and sends tree updates; a
|
|
query thread with its own COM apartment answers the publisher's synchronous
|
|
queries and actions, so long refreshes never delay a reader. Each thread
|
|
caches its resolved objects; a stale object is resolved again, and only
|
|
read-only queries are retried.
|
|
- Events are coalesced per batch and sent in native order: structure, the
|
|
newly focused object's caret, focus, property changes, remaining carets and
|
|
selections, layout, anchors, then `flush`.
|
|
- Privacy: protected (password) text, values and boundaries never leave the
|
|
worker; only the length is sent.
|
|
|
|
## Publisher (`browser_publisher.c`)
|
|
|
|
The publisher's output must match native Linux Chromium for the same page.
|
|
Rules established by comparison with native Chromium 158 and Electron 42:
|
|
|
|
- Roles follow `map_role`; pairings not yet covered by the fixture are marked.
|
|
- Every object exposes Action, Component, Document and Text; text fields lack
|
|
Hypertext; everything except DOM text leaves is a hyperlink implementation.
|
|
- Chromium's views layer (browser UI) has no IA2 links or actions: links are
|
|
rebuilt when its text is one embedded-object character per child, actions
|
|
come from the MSAA default action plus `showContextMenu`, and internal
|
|
`view_N` ids are dropped. Never inside web content.
|
|
- Exactly one focused object (the end of the window's `accFocus` chain); no
|
|
read-only state on documents and lists; header cells report no header cells.
|
|
- Offsets convert explicitly between UTF-16 (Windows) and characters
|
|
(AT-SPI). Boundaries inside a surrogate pair round to whole characters;
|
|
native Chromium reports such a word end as `-1`.
|
|
- Word, sentence, line and paragraph boundaries come from IA2
|
|
`get_textAtOffset` on demand (they depend on layout); at the end of the text
|
|
no segment is reported. Character and range extents come from one batched
|
|
request per object. Both are cached until the text or the layout changes.
|
|
- Events: removals and text changes are emitted at once, additions at the end
|
|
of the worker's batch in document order. When a container's children
|
|
change, its text is reported as wholly replaced (nothing for text made only
|
|
of embedded objects). Scrolling to an anchor moves the caret to the target.
|
|
- The frame's extents come from the X11 window, which readers compare with the
|
|
window manager's view of the foreground window.
|
|
- Every few seconds of activity the publisher logs synchronous request counts
|
|
and times; `WINE_ACCESS_BROWSER_TRACE=1` logs every worker message.
|
|
|
|
## Verification
|
|
|
|
- `ctest -R 'browser-publisher-lifetime|browser-worker-privacy'`: checks node
|
|
retirement, replacement ID ownership, retained defunct objects, failed or
|
|
malformed password-state queries, and worker argument-error logging.
|
|
Unknown protection is treated as protected before reading values or text.
|
|
- `ctest -R browser-publisher-snapshot`: publishes a recorded Electron 45
|
|
snapshot (no Wine) and compares the tree, including text boundaries, with
|
|
native Chromium 158 and Electron 42.
|
|
- `tests/browser/live_checks.sh BUILD_DIR PREFIX`: needs native Chromium and a
|
|
prefix with Electron (`WINE_ACCESS_BROWSER_TEST_ELECTRON`, default
|
|
`C:\electron\v45\electron.exe`). Runs the worker protocol checks, the
|
|
helper lifecycle (publish, no legacy announcements, restart, no orphans),
|
|
and the same scripted scenario natively and through the bridge, comparing
|
|
trees and AT-SPI event sequences and checking that no password characters
|
|
appear.
|
|
- Every test runs through `tests/browser/private_session.sh`: a private
|
|
runtime directory and no display for the private D-Bus session, with a
|
|
tripwire on the user's display. A bare `dbus-run-session` can take over the
|
|
user's accessibility bus socket or advertise the test bus on the user's
|
|
display.
|
|
|
|
Recorded results do not prove audible speech, Braille or keyboard behavior;
|
|
check those live with each reader.
|
|
|
|
## Limitations
|
|
|
|
- Full Chrome does not start under Wine 11.22 (missing
|
|
`user32.GetPointerDevice`); Electron and other embedded Chromium work.
|
|
- Firefox, WebView2 (a Chromium window inside another application's window),
|
|
32-bit browsers and iframes are untested.
|
|
- Each Chromium window is its own AT-SPI application.
|
|
- The frame's active state follows Wine's foreground events; a Linux window
|
|
taking focus may not always deactivate it.
|