Expand description
HTTP Basic / Digest auth callback registry.
When CEF fires RequestHandler::get_auth_credentials for a browser
pane, the host returns 1 (will-async-respond), parks the
AuthCallback in this registry keyed by a generated request_id,
and broadcasts a browser-pane-auth-required event to the renderer.
The renderer prompts the user and replies via the
browser_pane_auth_submit / browser_pane_auth_cancel IPC
commands, which resolve the callback here and complete the CEF
flow.
Phase α of SPEC_BROWSER_PANE_HTTP_BASIC_AUTH_2026_05_18.md.
Structs§
- Entry 🔒
- One parked auth challenge — the CEF callback plus the block_id owning it (so pane-close can clean up just its entries) and a monotonically-increasing arming epoch (so a delayed timeout task can detect “this request was already resolved + re-registered under the same id” and bail). The epoch is a defensive guard; uuid request_ids shouldn’t collide.
Constants§
- PARKED_
TTL 🔒 - Maximum time a callback can sit parked before we cancel it automatically. Bounds the leak if the renderer never replies (background tab + suspended JS, hung modal). 5 minutes is well above any realistic credential-entry time and well below “user noticed and wondered what happened.”
Statics§
- NEXT_
EPOCH 🔒 - TOKIO_
HANDLE 🔒 - Tokio runtime Handle captured from
main.rssoregister()can schedule the TTL timer from any thread — CEF invokesget_auth_credentialson its IO thread, which has noHandle::current(), so a baretokio::spawn(...)would panic with “there is no reactor running”.
Functions§
- cancel_
for_ block - Cancel every callback parked for
block_id— called frombrowser_pane_closeso closing a pane mid-prompt doesn’t leak CEF refcounts. Returns the number cancelled. - pending 🔒
- HashMap::new is not const-fn so the static needs lazy init.
- pending_
count - Pending request count. Useful for diagnostics and leak checks in tests.
- register
- Park a CEF auth callback under
request_id. The renderer will resolve it shortly viasubmit/cancel. A 5-minute timeout task is armed alongside so the entry can’t leak indefinitely if the renderer never replies. Replaces any prior entry for the same id (shouldn’t happen — ids are uuid4). - set_
runtime_ handle - Install the Tokio runtime Handle. Called once from
main.rsafterRuntime::new()and before CEF starts dispatching callbacks. - take
- Pop the callback for
request_id. Returns None if it was already resolved (e.g. submit + cancel race) or never existed.