[Regression]: Firefox page crashes on getByRole with a name when aria-labelledby is also read in the main world

Đang mở
#43,967 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
playwright, typescript
Lĩnh vực
backend, testing-qa

Hướng nghiên cứu

Start with the accessible name resolution used by getByRole and the aria-labelledby handling that reads ariaLabelledByElements; the issue gives a minimal reproducer and identifies the failing Firefox behavior. Reproduce with the linked project and compare the main world and utility world read paths. Done means the regression test passes in Firefox without breaking the existing control cases; the reporter has a proposed change ready, so coordinate with them before taking it on.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

needs-triage
Last Good Version

1.64.1

First Bad Version

1.65.0

Steps to reproduce
  1. Clone https://github.com/bartech-lab/firefox-aria-reflection-crash
  2. npm ci
  3. npx playwright install firefox
  4. npm test
  5. You should see 2 failures with "Page crashed", and 3 control tests passing

The failing test is:

await page.setContent(`<span id="l">Save</span><button id="b" aria-labelledby="l"></button>`);
await page.evaluate(() => document.getElementById('b').ariaLabelledByElements);
await page.getByRole('button', { name: 'Save' }).click({ trial: true });
Expected behavior

The test passes, as it does on Chromium and WebKit.

Actual behavior

locator.click: Page crashed. The Firefox content process exits on signal 11.

20 of 20 runs crash, in either read order. The controls pass 30 of 30: main world twice, utility world twice, and no aria-labelledby. It also reproduces on main at 58d69dcc3.

The test does not need its own read. A real suite hit this in two ways:

  • locator.dispatchEvent() resolves getByRole in the main world, then an action or assertion resolves it in the utility world.
  • getByRole in the utility world, then an @axe-core/playwright scan. A plain page.evaluate of the property crashes at the same point. I did not identify which axe call crashes.
Additional context

This is a Firefox bug, which #43577 exposed by reading element.ariaLabelledByElements in the utility world. It also crashes stock Firefox 159.0.1 and Nightly 162.0a1 with an extension content script: https://bugzilla.mozilla.org/show_bug.cgi?id=2090055, with a tested patch. Playwright's Firefox 157 crashes too when a custom selector engine does the same read.

I would like to work on this. I have a change ready for a PR if you approve it:

const attribute = element.getAttribute('aria-labelledby');
const refs = attribute ? getIdRefs(element, attribute) : element.ariaLabelledByElements;

One added line in SE-060 crashes Firefox without this change and passes with it. npm run flint passes.

Limit: this does not cover references set from script. If a page sets ariaLabelledByElements and reads it back, the attribute is empty, so Playwright still reads the property and Firefox still crashes. Only the Firefox fix closes that case, so you may prefer to carry it in your Firefox patches, which I did not try.

Environment
  System:
    OS: Linux 7.2 EndeavourOS
    CPU: (16) x64 AMD Ryzen 7 9800X3D 8-Core Processor
    Memory: 37.05 GB / 60.20 GB
    Container: Yes
  Binaries:
    Node: 26.13.0 - /usr/bin/node
    npm: 12.2.2 - /usr/bin/npm
    Deno: 2.9.8 - /usr/bin/deno
  Languages:
    Bash: 5.3.20 - /usr/bin/bash
  npmPackages:
    @playwright/test: 1.65.0 => 1.65.0
Ngôn ngữ chính
TypeScript
Star
99.1k
Fork
6.8k
Merge trung bình
17 giờ 6 phút
Pull request đã merge (30 ngày)
306

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/playwright

Tất cả issue của microsoft/playwright

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.