cdp-tunnel 3.3.7 → 3.3.8
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
|
@@ -192,7 +192,6 @@ class PortPoolManager {
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
// SW 冷启动 warmup:第一个 client 连接时创建一个临时 tab 再关闭
|
|
195
|
-
// 确保 chrome.debugger API 完全初始化,避免第一批并发请求失败
|
|
196
195
|
if (!session.warmedUp) {
|
|
197
196
|
session.warmedUp = true;
|
|
198
197
|
const warmupId = `pool${session.portIndex}_internal_warmup`;
|
|
@@ -203,8 +202,8 @@ class PortPoolManager {
|
|
|
203
202
|
__portIndex: session.portIndex,
|
|
204
203
|
__clientId: `pool_${session.port}`
|
|
205
204
|
}));
|
|
206
|
-
// 响应回来后在 handlePluginMessage
|
|
207
|
-
|
|
205
|
+
// warmup 响应回来后在 handlePluginMessage 里关闭这个 tab
|
|
206
|
+
session.pendingWarmupClose = true;
|
|
208
207
|
}
|
|
209
208
|
|
|
210
209
|
// 通知扩展有 client 连接(带端口号作为分组标识)
|
|
@@ -280,8 +279,23 @@ class PortPoolManager {
|
|
|
280
279
|
|
|
281
280
|
// 1. 响应消息:id 以 pool 开头(排除事件——事件有 method 字段)
|
|
282
281
|
if (msg.id && typeof msg.id === 'string' && msg.id.startsWith('pool') && !msg.method) {
|
|
283
|
-
//
|
|
282
|
+
// 内部命令响应
|
|
284
283
|
if (msg.id.includes('_internal')) {
|
|
284
|
+
// warmup createTarget 响应——关掉 warmup tab
|
|
285
|
+
const m = msg.id.match(/^pool(\d+)_/);
|
|
286
|
+
if (m && msg.id.includes('_warmup') && msg.result && msg.result.targetId) {
|
|
287
|
+
const pidx = parseInt(m[1]);
|
|
288
|
+
const sess = this.portSessions[pidx];
|
|
289
|
+
const warmupTid = msg.result.targetId;
|
|
290
|
+
const closeId = `pool${pidx}_internal_warmup_close_${Date.now()}`;
|
|
291
|
+
pluginWs.send(JSON.stringify({
|
|
292
|
+
id: closeId,
|
|
293
|
+
method: 'Target.closeTarget',
|
|
294
|
+
params: { targetId: warmupTid },
|
|
295
|
+
__portIndex: pidx,
|
|
296
|
+
__clientId: `pool_${sess.port}`
|
|
297
|
+
}));
|
|
298
|
+
}
|
|
285
299
|
return true;
|
|
286
300
|
}
|
|
287
301
|
const match = msg.id.match(/^pool(\d+)_(.+)$/);
|