cdp-tunnel 2.7.9 → 2.7.10
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.
|
@@ -3,6 +3,7 @@ var WebSocketManager = (function() {
|
|
|
3
3
|
var _isSending = false;
|
|
4
4
|
var _maxQueueSize = 100;
|
|
5
5
|
var _bufferThreshold = 512 * 1024;
|
|
6
|
+
var _groupCreationPending = new Set();
|
|
6
7
|
|
|
7
8
|
function connect() {
|
|
8
9
|
var ws = State.getWs();
|
|
@@ -204,6 +205,7 @@ var WebSocketManager = (function() {
|
|
|
204
205
|
case 'client-disconnected':
|
|
205
206
|
Logger.info('[WS] Client disconnected:', message.clientId);
|
|
206
207
|
var discClientId = message.clientId;
|
|
208
|
+
_groupCreationPending.delete(discClientId);
|
|
207
209
|
closeTabGroupByClientId(discClientId).then(function() {
|
|
208
210
|
return new Promise(function(resolve) {
|
|
209
211
|
closeTabsByClientId(discClientId, resolve);
|
|
@@ -456,24 +458,34 @@ var WebSocketManager = (function() {
|
|
|
456
458
|
function createGroupForClient(clientId) {
|
|
457
459
|
if (!clientId || !chrome.tabGroups) return;
|
|
458
460
|
|
|
461
|
+
if (_groupCreationPending.has(clientId)) {
|
|
462
|
+
Logger.info('[WS] Group creation already pending for client:', clientId);
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
|
|
459
466
|
var existingGroupId = State.getGroupIdForClient(clientId);
|
|
460
467
|
if (existingGroupId) {
|
|
461
468
|
Logger.info('[WS] Group already cached for client:', clientId, 'groupId:', existingGroupId);
|
|
462
469
|
return;
|
|
463
470
|
}
|
|
464
471
|
|
|
472
|
+
_groupCreationPending.add(clientId);
|
|
473
|
+
|
|
465
474
|
var baseName = CDPUtils.getGroupBaseName(clientId);
|
|
466
475
|
chrome.tabs.query({ currentWindow: true }, function(tabs) {
|
|
467
476
|
if (!tabs || tabs.length === 0) {
|
|
468
477
|
Logger.warn('[WS] No tabs found for group creation');
|
|
478
|
+
_groupCreationPending.delete(clientId);
|
|
469
479
|
return;
|
|
470
480
|
}
|
|
471
481
|
var windowId = tabs[0].windowId;
|
|
472
482
|
chrome.tabs.group({ createProperties: { windowId: windowId } }, function(groupId) {
|
|
473
483
|
if (chrome.runtime.lastError) {
|
|
474
484
|
Logger.warn('[WS] Failed to create group on connect:', chrome.runtime.lastError.message);
|
|
485
|
+
_groupCreationPending.delete(clientId);
|
|
475
486
|
return;
|
|
476
487
|
}
|
|
488
|
+
_groupCreationPending.delete(clientId);
|
|
477
489
|
chrome.tabGroups.update(groupId, {
|
|
478
490
|
title: baseName,
|
|
479
491
|
color: CDPUtils.getGroupColorForClient(clientId),
|
package/package.json
CHANGED