Expand description
Per-origin permission model for sensitive host APIs.
Sensitive capabilities (camera, microphone, geolocation, screen capture) are not granted
automatically. The first time an app requests one, the host queues a PendingPermission
and the UI shell renders a Chrome-style prompt (top-left, under the toolbar). Until the
user decides, the gated API returns a “pending” code (PERMISSION_PENDING for i32
APIs) and the guest is expected to retry on a later frame.
Decisions are remembered per (origin, kind) pair for the lifetime of the tab, where
origin is derived via crate::url::app_origin_of (scheme + host + port for network
URLs, the containing directory for file:// URLs).
This flow is deliberately non-blocking: guest frame callbacks run on the UI thread, so a modal prompt inside a host function would deadlock the renderer.
Structs§
- Pending
Permission - A permission request awaiting a user decision, rendered by the UI shell.
- Permissions
State - Per-tab permission decisions plus the prompt currently awaiting the user.
Enums§
- Permission
Kind - A sensitive capability that requires an explicit user grant.
- Permission
Status - Outcome of a permission check from a host function.
Constants§
- PERMISSION_
PENDING - Return code for permission-gated
i32host APIs while the prompt is awaiting a decision.
Functions§
- check_
or_ request - Looks up the decision for
(origin, kind), queueing a prompt when undecided. - resolve_
pending - Records the user’s decision for the active prompt and dismisses it.
Type Aliases§
- Shared
Permissions - Shared handle stored in
HostStateand read by the UI shell each frame.