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.
package/package.json
CHANGED
|
@@ -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;
|