diff options
| author | amankumarsingh77 <amankumarsingh7702@gmail.com> | 2026-07-28 19:42:25 +0530 |
|---|---|---|
| committer | Aman Kumar <145339995+amankumarsingh77@users.noreply.github.com> | 2026-08-02 19:12:46 +0530 |
| commit | ce30547af39f692bef777591bdb329a7fa00e86e (patch) | |
| tree | 01b331fa9794d55d0ffa7d37f1ccfc8f75098cee /src/cdp/session.ts | |
| parent | d3fb25a8e1297f00dbf7ce4a188b12290b594c73 (diff) | |
fix(cdp): re-enable domains when re-attaching to a known tab
Every Target.attachToTarget mints a new sessionId and CDP domain enablement is
per-session, but switchTo only enabled domains on a tab's first visit. Switching
away and back left the refreshed session with Page, Network, Runtime and Log
disabled, so that tab silently stopped collecting console and network records and
stopped reporting dialogs and load events for the rest of the session.
Report: docs/superpowers/reports/2026-07-26-bug-audit.md#f3
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'src/cdp/session.ts')
| -rw-r--r-- | src/cdp/session.ts | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/cdp/session.ts b/src/cdp/session.ts index bf423e1..39cd87e 100644 --- a/src/cdp/session.ts +++ b/src/cdp/session.ts @@ -369,12 +369,11 @@ export const createCdpSession = ( // Each Target.attachToTarget produces a new sessionId — update it. sessionIdToTargetId.delete(existing.sessionId); existing.sessionId = attachedSessionId; - sessionIdToTargetId.set(attachedSessionId, tid); } else { tabs.set(tid, tab); - await enableDomains(attachedSessionId); - sessionIdToTargetId.set(attachedSessionId, tid); } + sessionIdToTargetId.set(attachedSessionId, tid); + await enableDomains(attachedSessionId); // Update global pointers to point at the new active tab sessionId = tab.sessionId; targetId = tid; |
