mirror of
https://github.com/browser-use/browser-use.git
synced 2026-09-14 19:59:47 +08:00
351163660c
When the JS codegen LLM prepends explanation text before the IIFE
(e.g. "Here is the script:\n(function(){...})()"), strip the preamble
to avoid CDP SyntaxError. Handles both (function and (async patterns.
Addresses ~1-2 eval failures where invalid JS caused confusing CDP
errors and wasted retry cycles.