Skip to main content

Module dialog

Module dialog 

Source
Expand description

JS dialog (alert/confirm/prompt/beforeunload) and page-initiated download capture via WebDriver BiDi browsingContext.* events.

Firefox surfaces user prompts and downloads as local BiDi events. This module records them into a shared, cheaply-cloneable DialogLog (mirroring crate::network::NetworkLog) so the agent can:

  • Confirm alert-based XSS: the alert() message is captured from userPromptOpened even when the prompt is auto-handled, so a payload that pops alert(document.domain) is proven fired without the automation hanging on the modal.
  • Read confirm/prompt text and answer them via crate::Page::handle_user_prompt (when launched with the ignore prompt-handler so the prompt stays open).
  • Inspect page-initiated downloads: suggested filename (path-traversal / exfil probes) and source URL (without a file landing on disk).

The log never blocks the browser: under the BiDi default prompt handler (dismiss and notify) the events still fire, so recording is side-effect free. Auto-handling policy lives one layer up (the bridge), keeping this a pure observation primitive.

Structs§

CapturedDialog
One captured JS user prompt.
CapturedDownload
One page-initiated download.
DialogLog
Shared, cloneable handle to the dialog + download capture buffer.

Constants§

DIALOG_EVENTS
BiDi event identifiers this module subscribes to.

Functions§

make_dialog_handler
Build the event handler that feeds browsingContext.* dialog and download events into log. Mirrors crate::network::make_network_handler.