Skip to content

Resolve aria-labelledby by id in previews to stop Firefox crashing under Playwright 1.65 - #6045

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-6044
Nov 15, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-6044

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

test_playground_range_preserves_preview_focus_without_cancelling_native_drag[firefox_browser] has crashed Firefox's content process since #6040. The cause is upstream. Playwright 1.65's role locator reads element.ariaLabelledByElements in its isolated world, and Firefox segfaults once the page's own world has read that property too (microsoft/playwright#43967, Mozilla bug 2090055). Playwright has closed its issue as fixed by the next Firefox roll, but every released Playwright up to 1.65.2 still ships firefox-1572. #6040 named the playground's range by aria-labelledby, so two page-world reads now reach it:

  • Leaf's preview. labelsOf and markupName in browser/runtime/preview.js read ariaLabelledByElements when the pointer or focus lands on the control. They now resolve aria-labelledby by id in the control's tree, so a Leaf page never reads that property in the page's world. Leaf sets no labelling elements from script, so this finds the same elements and changes no behavior. Name a playground's controls by the words beside them, so their preview doesn't repeat those words #6040's preview rule still holds: test_a_control_whose_words_stand_beside_it_previews_nothing passes.
  • The test's own dispatch_event. On a role locator, dispatch_event resolves the accessible name in the page's world, and the surrounding actions resolve it again in Playwright's world. That crashes Firefox with no Leaf code involved. The test now dispatches pointercancel through an element handle, which doesn't resolve the name again.

Before the change, the Firefox variant crashed in 3 of 3 runs on main. With only one of the two changes it still crashes. With both, it passes 3 of 3 locally, on main after #6043 as well. Both changes cite the upstream issue in a comment, so they can be dropped once Playwright ships the fixed Firefox.

Reproduction and checks

With no Leaf code, Playwright 1.65.0 and firefox-1572 crash on <span id="l">Max</span><input type="range" aria-labelledby="l"> when page.evaluate("…ariaLabelledByElements") and get_by_role("slider", name="Max").count() both run, in either order. Either one alone passes, and so does an id lookup followed by the role query. On a Leaf page, hovering the range and then calling get_by_role(...).count() crashed before the preview change and passes after it. role.dispatch_event(...) followed by role.count() crashes whether or not Leaf has read the property.

Passed: the three variants of the reproducing test, all of tests/browser/controls/test_previews.py, and the playground tests that select labels, take focus or hold a range press (139 tests). pnpm run check:browser, pnpm run test:runtime (980 passed) and pre-commit on the changed files also passed.

Closes #6044 — automated triage

…range through a handle, so Firefox under Playwright 1.65 stops crashing

Playwright 1.65's role locator reads `ariaLabelledByElements` in its isolated
world, and Firefox's content process segfaults once the page's world has read
the same property too (microsoft/playwright#43967, Mozilla bug 2090055). Since
#6040 named the playground's range by `aria-labelledby`, two reads met on it:
the preview's `labelsOf`/`markupName` on hover, and a role locator's
`dispatch_event`, which resolves the name in the page's world.

The preview now finds what `aria-labelledby` names by id in the control's
tree, so a Leaf page never makes the page-world read. The test cancels its
press through an element handle, which dispatches without resolving the name
again. Each half alone still crashes; with both, the Firefox variant passes.
No behavior changes: Leaf sets no labelling elements from script, so the id
read finds the same elements.

Closes #6044
@leaf-agent
leaf-agent merged commit 9f3c659 into main Nov 15, 2026
6 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-6044 branch November 15, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_playground_range_preserves_preview_focus_without_cancelling_native_drag[firefox_browser]: Firefox content process segfaults since #6040

1 participant