#52467: fix: filter discarded devices from WebHID chooser
Merged
- Follow up to #52448 which included CL 7987617: hid: Recursively filter nested collections (hid: Recursively filter nested collections), HidService::FinishRequestDevice recursively strips protected reports from a selected device and drops it entirely when all of its collections are removed. The
select-hid-deviceevent only filtered devices by the HID blocklist, FIDO usage, and request filters, so it could present a device that FinishRequestDevice then discarded, causingnavigator.hid.requestDevice()to resolve with an empty array. - This PR fixes the issues by using
content::HidService::RemoveProtectedReportsto filter out unusable device, so that what gets returned by theselect-hid-deviceevent consists of devices that can actually be granted.
Fixes: #52459
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 - PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, and past tense.
Release Notes
Notes: Fixed select-hid-device presenting HID devices that could not be granted, which caused navigator.hid.requestDevice() to resolve with no device.
Backports
Semver 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