cdp-tunnel 3.2.0 → 3.2.2
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.
|
@@ -414,7 +414,8 @@ var SpecialHandler = (function() {
|
|
|
414
414
|
var groupId = state ? state.getGroupIdForClient(clientId) : null;
|
|
415
415
|
if (!groupId) return;
|
|
416
416
|
|
|
417
|
-
var connectionTag = (
|
|
417
|
+
var connectionTag = (state && state.getTagForClient) ? state.getTagForClient(clientId) : null;
|
|
418
|
+
if (!connectionTag) connectionTag = (wsManager && wsManager.config && wsManager.config.tag) || null;
|
|
418
419
|
|
|
419
420
|
chrome.tabs.query({ groupId: groupId }, function(tabs) {
|
|
420
421
|
if (chrome.runtime.lastError || !tabs) return;
|
package/package.json
CHANGED
|
@@ -150,10 +150,20 @@ class PortPoolManager {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
if (path === '/json' || path === '/json/list') {
|
|
153
|
-
//
|
|
154
|
-
|
|
153
|
+
// 返回这个端口创建的 tab 列表
|
|
154
|
+
// 从 session.targetIds 构建(这些是 createTarget 时记录的)
|
|
155
|
+
const targets = [];
|
|
156
|
+
for (const targetId of session.targetIds) {
|
|
157
|
+
targets.push({
|
|
158
|
+
id: targetId,
|
|
159
|
+
type: 'page',
|
|
160
|
+
url: 'about:blank',
|
|
161
|
+
title: '',
|
|
162
|
+
webSocketDebuggerUrl: `ws://localhost:${session.port}/devtools/page/${targetId}`
|
|
163
|
+
});
|
|
164
|
+
}
|
|
155
165
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
156
|
-
res.end(JSON.stringify(
|
|
166
|
+
res.end(JSON.stringify(targets));
|
|
157
167
|
return;
|
|
158
168
|
}
|
|
159
169
|
|