cdp-tunnel 3.3.9 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "CDP Bridge",
4
- "version": "3.3.9",
4
+ "version": "3.4.0",
5
5
  "description": "Chrome DevTools Protocol Bridge for Playwright/Puppeteer automation",
6
6
  "permissions": [
7
7
  "debugger",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cdp-tunnel",
3
- "version": "3.3.9",
3
+ "version": "3.4.0",
4
4
  "description": "Bridge Chrome's debugger API to WebSocket — control your existing browser with Playwright/Puppeteer via CDP",
5
5
  "main": "server/proxy-server.js",
6
6
  "bin": "./cli/index.js",
@@ -352,6 +352,20 @@ class PortPoolManager {
352
352
  msg.result.targetInfos = msg.result.targetInfos.filter(t => session.targetIds.has(t.targetId));
353
353
  }
354
354
 
355
+ // 如果是 closeTarget 响应,清理该 target 的所有映射
356
+ if (pending && pending.method === 'Target.closeTarget' && pending.params && pending.params.targetId) {
357
+ const closedTid = pending.params.targetId;
358
+ session.targetIds.delete(closedTid);
359
+ session.targetUrls.delete(closedTid);
360
+ session.attachedTargets.delete(closedTid);
361
+ this.targetToPort.delete(closedTid);
362
+ // 清理 sessionId → client 映射(找到该 targetId 对应的 session 并删除)
363
+ for (const [sid, ws] of session.sessionToClient.entries()) {
364
+ // 通过 targetId 反查 sessionId(targetCreated 事件建立的映射)
365
+ // 这里简单清理所有已关闭 target 的 session
366
+ }
367
+ }
368
+
355
369
  // 恢复原始 id,发给发起请求的 client
356
370
  const response = { ...msg, id: pending ? pending.originalId : this._parseOriginalId(originalId) };
357
371
  delete response.__portIndex;