cdp-tunnel 3.3.4 → 3.3.5
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
|
@@ -191,6 +191,22 @@ class PortPoolManager {
|
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
+
// SW 冷启动 warmup:第一个 client 连接时创建一个临时 tab 再关闭
|
|
195
|
+
// 确保 chrome.debugger API 完全初始化,避免第一批并发请求失败
|
|
196
|
+
if (!session.warmedUp) {
|
|
197
|
+
session.warmedUp = true;
|
|
198
|
+
const warmupId = `pool${session.portIndex}_internal_warmup`;
|
|
199
|
+
pluginWs.send(JSON.stringify({
|
|
200
|
+
id: warmupId,
|
|
201
|
+
method: 'Target.createTarget',
|
|
202
|
+
params: { url: 'about:blank' },
|
|
203
|
+
__portIndex: session.portIndex,
|
|
204
|
+
__clientId: `pool_${session.port}`
|
|
205
|
+
}));
|
|
206
|
+
// 响应回来后在 handlePluginMessage 里丢弃(_internal 前缀)
|
|
207
|
+
// tab 会在 Browser.close 或断开时清理
|
|
208
|
+
}
|
|
209
|
+
|
|
194
210
|
// 通知扩展有 client 连接(带端口号作为分组标识)
|
|
195
211
|
// clientId 固定为 pool_{port},让扩展为每个端口建一个独立分组
|
|
196
212
|
const poolClientId = `pool_${session.port}`;
|