#52448: test: warm up HID subsystem before navigator.hid requestDevice
Merged
- #52417 included the Chromium CL 'hid: Recursively filter nested collections':
https://chromium-review.googlesource.com/c/chromium/src/+/7987617. This change caused thenavigator.hidtest to be flaky on macOS, eg
2026-07-24T18:24:14.1824340Z not ok 1928 navigator.hid returns a device when select-hid-device event is defined
2026-07-24T18:24:14.1825010Z expected '' to include '[object HIDDevice]'
2026-07-24T18:24:14.1825660Z AssertionError: expected '' to include '[object HIDDevice]'
2026-07-24T18:24:14.1826310Z at Context.<anonymous> (electron/spec/chromium-spec.ts:4688:25)
The WebHID blocklist is populated lazily on first access and, with Chromium's recursive nested-collection filtering, a composite device could be enumerated into the select-hid-device list before the blocklist was fully applied, then excluded during the post-selection permission recheck, making requestDevice() resolve empty and the test flaky. This PR fixes that issue by enumerating devices first to stabilize the device list.
Assisted-by: Claude Opus 4.8
Description of Change
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
-
npm testpasses - tests are changed or added
- PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, and past tense.
Release Notes
Notes: none
Backports
44-x-y
In-flightSemver Impact
Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron