Skip to content

audit F43 [robustness]: web::app unwraps web_sys::window() on user-gesture path #543

@intendednull

Description

@intendednull

File: crates/web/src/app.rs:925
Severity: robustness
Obvious? no

Inside the click handler that requests getUserMedia, web_sys::window().unwrap() panics if invoked from a non-window context (e.g. a worker harness during testing). The surrounding code path uses graceful let Ok(...) = ... for media_devices and get_user_media_with_constraints, so the unwrap() here is inconsistent with the established style.

Fix: convert to let Some(window) = web_sys::window() else { tracing::error!(...); return; } consistent with the surrounding gracefulness.


Filed by /general-audit @ b901575 (2026-05-02). master: #513.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions