Repository navigation
Resolve aria-labelledby by id in previews to stop Firefox crashing under Playwright 1.65 - #6045
Merged
Merged
Conversation
…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
This was referenced Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 readselement.ariaLabelledByElementsin 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 shipsfirefox-1572. #6040 named the playground's range byaria-labelledby, so two page-world reads now reach it:labelsOfandmarkupNameinbrowser/runtime/preview.jsreadariaLabelledByElementswhen the pointer or focus lands on the control. They now resolvearia-labelledbyby 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_nothingpasses.dispatch_event. On a role locator,dispatch_eventresolves 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 dispatchespointercancelthrough 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-1572crash on<span id="l">Max</span><input type="range" aria-labelledby="l">whenpage.evaluate("…ariaLabelledByElements")andget_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 callingget_by_role(...).count()crashed before the preview change and passes after it.role.dispatch_event(...)followed byrole.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