/** * Multi-context browser handling — detects and records new tabs, iframes, * popups, and file downloads triggered during a page crawl. * This lets ZeTa discover cross-origin flows, OAuth redirects, embedded * third-party content, and downloadable resources that single-page HTTP * crawlers would miss entirely. */ import type { Page, BrowserContext } from 'playwright'; export interface NewTabRecord { url: string; linkText: string; isInternal: boolean; httpStatus?: number; } export interface IframeRecord { src: string; crossOrigin: boolean; sandboxed: boolean; sandboxValue: string | null; accessible: boolean; contentSample: string; hasForm: boolean; } export interface PopupRecord { url: string; triggerLabel: string; isOAuthLike: boolean; } export interface DownloadRecord { filename: string; downloadUrl: string; triggerLabel: string; } export interface MultiContextResult { newTabs: NewTabRecord[]; iframes: IframeRecord[]; popups: PopupRecord[]; downloads: DownloadRecord[]; } /** * Attaches a listener to the BrowserContext that records every new tab * opened while the listener is active. Returns an unsubscribe function. * * Call this before navigating / clicking so that tabs opened during the * crawl are captured, then call the returned function to stop listening. */ export declare function attachNewTabListener(context: BrowserContext, seedUrl: string, result: MultiContextResult): () => void; /** * Probes the current page for multi-context browser events: iframes, * popup windows, and file downloads. * * New-tab tracking is intentionally excluded here — it must be set up at * the crawler level (before navigation) using `attachNewTabListener`. */ export declare function probeMultiContext(page: Page, context: BrowserContext, seedUrl: string): Promise;