mirror of
https://github.com/unclecode/crawl4ai.git
synced 2026-06-11 00:08:01 +00:00
context.add_init_script() was called in both setup_context() and _crawl_web(), causing unbounded script accumulation on shared contexts under concurrent load. Chromium kills the overloaded context, cascading "Target page, context or browser has been closed" to all concurrent crawls. Add flag-based dedup: after injecting navigator_overrider or shadow-DOM scripts, set _crawl4ai_nav_overrider_injected / _crawl4ai_shadow_dom_injected on the context. Before injecting, check the flag. This preserves context-level scope (popups/iframes covered) and the fallback for managed/persistent/CDP paths where setup_context() runs without crawlerRunConfig.
15 KiB
15 KiB