mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 17:46:32 -04:00
Replace the hardcoded stub with a working implementation that stores registered scripts and evaluates them in each new document. Changes: - Add ScriptOnNewDocument struct and storage list on BrowserContext - Store scripts with unique identifiers when addScript is called - Evaluate all registered scripts in pageNavigated, after the execution context is created but before frameNavigated/loadEventFired events are sent to the CDP client - Add removeScriptToEvaluateOnNewDocument for cleanup - Return unique identifiers per the CDP spec (was hardcoded to "1") Scripts are evaluated with error suppression (warns on failure) to avoid breaking navigation if a script has issues. This unblocks CDP clients that rely on auto-injected scripts (polyfills, monitoring, test helpers) persisting across navigations. Previously clients had to manually re-inject after every Page.navigate. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>