mirror of
https://github.com/Tencent/BrowserSkill.git
synced 2026-09-10 13:01:23 +08:00
`enableConsoleDomains` marked the tab in `consoleDomainsAttemptedTabs` before issuing `Runtime.enable`/`Log.enable` and swallowed any errors, so a transient failure (e.g. a restricted page during attach) permanently disabled console capture for that tab: every later `ensureConsoleCapture` was a no-op and the agent silently got an empty console buffer with no indication that capture was broken. This was inconsistent with `enableNetworkDomain`, which records the tab only after `Network.enable` succeeds (and is explicitly tested as "retries and surfaces failures"). Bring `enableConsoleDomains` in line: mark the tab only after both domains enable successfully, so a later `ensureConsoleCapture` can recover from a transient failure. Renamed the flag `consoleDomainsAttemptedTabs` -> `consoleDomainsEnabledTabs` to match `networkDomainsEnabledTabs` and reflect the new semantics. Attach remains best-effort (it still succeeds when a domain can't be enabled). Adds a regression test asserting `ensureConsoleCapture` retries after a failed enable; it fails (no retry) on the previous code. Co-Authored-By: Claude <noreply@anthropic.com>