fix: route Target.detachFromTarget on root CDP session (#40)

When Playwright sends Target.detachFromTarget via the root browser session
(no top-level sessionId), the extension couldn't find the target tab because
it only checked msg.params.sessionId for routing. This caused 'No tab found'
errors that cascaded into disconnects and instability.

- Add getTabForCommand() helper with params.sessionId fallback so any command
  referencing a session in its params can be routed when the top-level
  sessionId is absent
- No-op Target.detachFromTarget for stale/unknown sessions instead of throwing
- Always re-apply tab group color on every sync to prevent Chrome resetting
  it to white
- Replace silent .catch() with error log in aria-snapshot OOPIF detach
- Add regression test using raw WebSocket to verify routing without sessionId

Extension bumped to 0.0.74.
This commit is contained in:
Tommy D. Rossi
2026-03-04 21:57:27 +01:00
parent 5ad2366d1e
commit 905df6eec5
5 changed files with 212 additions and 33 deletions
+8
View File
@@ -1,5 +1,13 @@
# Changelog
## 0.0.74
### Bug Fixes
- **Fix Target.detachFromTarget routing on root CDP session**: Commands sent without a top-level sessionId (e.g. from Playwright's root browser session) now resolve the target tab via `params.sessionId` fallback. Previously the extension threw "No tab found" which caused cascading disconnects and instability. (#40)
- **No-op stale Target.detachFromTarget**: Unknown or already-cleaned-up sessions return `{}` instead of throwing, preventing error cascading during rapid connect/disconnect cycles.
- **Always re-apply tab group color**: Tab group title and color are now re-applied on every sync to prevent Chrome from resetting them to white/unlabeled.
## 0.0.73
### Bug Fixes