Skip to content

Fix compatibility check when mediaDevices is unavailable - #212

Open
volksec wants to merge 1 commit into
highfidelity:mainfrom
volksec:agent/handle-missing-media-devices
Open

Fix compatibility check when mediaDevices is unavailable#212
volksec wants to merge 1 commit into
highfidelity:mainfrom
volksec:agent/handle-missing-media-devices

Conversation

@volksec

@volksec volksec commented Jul 28, 2026

Copy link
Copy Markdown

What changed

  • replace eval()-based browser feature checks with guarded accessors
  • return false when navigator.mediaDevices is unavailable instead of throwing a TypeError
  • preserve the existing compatibility error messages
  • add unit coverage for missing mediaDevices and for a fully compatible browser environment

Why

checkBrowserCompatibility() checks navigator.mediaDevices.getUserMedia by evaluating the full property path. When navigator exists but mediaDevices does not (for example, in an insecure browser context), evaluating that path throws before the method can report incompatibility and return false.

This fixes #211.

Validation

  • npm test -- --runInBand tests/unit/src/utilities/HiFiUtilities.unit.test.ts — 2 tests passed
  • npm run build:node — passed
  • git diff --check — passed

The broader unit command passed 25 tests, but two existing suites could not start locally because the native wrtc.node binary was unavailable on Windows.

@volksec
volksec marked this pull request as ready for review July 30, 2026 18:20
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.

fix(web): getting TypeError when browser is missing navigator.mediaDevices

1 participant