cdp-tunnel 2.10.6 → 2.10.7
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.
|
@@ -178,6 +178,7 @@ importScripts('features/automation-badge.js');
|
|
|
178
178
|
if (state.getGroupIdForClient(clientId) === removedGroupId) {
|
|
179
179
|
Logger.info('[TabGroups] Clearing cached groupId for client:', clientId);
|
|
180
180
|
state.setGroupIdForClient(clientId, null);
|
|
181
|
+
state.setGroupCreationPromise(clientId, null);
|
|
181
182
|
|
|
182
183
|
var attached = state.getAttachedTabIds();
|
|
183
184
|
attached.forEach(function(tid) {
|
|
@@ -209,19 +210,20 @@ importScripts('features/automation-badge.js');
|
|
|
209
210
|
var clientId = state.getClientIdByTabId(tabId);
|
|
210
211
|
if (clientId) {
|
|
211
212
|
var cachedGroupId = state.getGroupIdForClient(clientId);
|
|
213
|
+
var groupPromise = state.getGroupCreationPromise(clientId);
|
|
212
214
|
if (cachedGroupId) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
Logger.info('[Tabs] Tab', tabId, 'left group, re-adding to cached group:', cachedGroupId);
|
|
216
|
+
chrome.tabs.group({ tabIds: tabId, groupId: cachedGroupId }, function() {
|
|
217
|
+
if (chrome.runtime.lastError) {
|
|
218
|
+
Logger.warn('[Tabs] Failed to re-add tab to group:', chrome.runtime.lastError.message);
|
|
219
|
+
var ctx = { _state: state, _wsManager: wsManager, clientId: clientId, mode: state.mode };
|
|
220
|
+
SpecialHandler.addTabToAutomationGroup(tabId, clientId, null, ctx);
|
|
219
221
|
}
|
|
220
222
|
});
|
|
223
|
+
} else if (!groupPromise) {
|
|
224
|
+
Logger.info('[Tabs] Tab', tabId, 'left group, no cache and no pending creation — skipping (onRemoved handles re-group)');
|
|
221
225
|
} else {
|
|
222
|
-
Logger.info('[Tabs] Tab', tabId, 'left group,
|
|
223
|
-
var ctx = { _state: state, _wsManager: wsManager, clientId: clientId, mode: state.mode };
|
|
224
|
-
SpecialHandler.addTabToAutomationGroup(tabId, clientId, null, ctx);
|
|
226
|
+
Logger.info('[Tabs] Tab', tabId, 'left group, group creation pending — skipping');
|
|
225
227
|
}
|
|
226
228
|
}
|
|
227
229
|
}
|
|
@@ -314,6 +314,7 @@ var WebSocketConnection = (function() {
|
|
|
314
314
|
if (self.state.getCDPClients().length === 0) {
|
|
315
315
|
self.state.setHasConnectedClient(false);
|
|
316
316
|
}
|
|
317
|
+
self._cleanupStaleState(discClientId);
|
|
317
318
|
self._broadcastStateUpdate();
|
|
318
319
|
});
|
|
319
320
|
break;
|
|
@@ -374,7 +375,6 @@ var WebSocketConnection = (function() {
|
|
|
374
375
|
return new Promise(function(resolve) {
|
|
375
376
|
var timeoutId = setTimeout(function() {
|
|
376
377
|
Logger.warn('[WS:' + self.connectionId + '] closeTabGroupByClientId timeout for client:', clientId, '— forcing cleanup');
|
|
377
|
-
self._cleanupStaleState(clientId);
|
|
378
378
|
resolve();
|
|
379
379
|
}, 5000);
|
|
380
380
|
|
|
@@ -596,9 +596,9 @@ var WebSocketConnection = (function() {
|
|
|
596
596
|
return;
|
|
597
597
|
}
|
|
598
598
|
self._groupCreationPending.delete(clientId);
|
|
599
|
-
self.state.
|
|
600
|
-
|
|
601
|
-
|
|
599
|
+
if (!self.state.getGroupIdForClient(clientId)) {
|
|
600
|
+
self.state.setGroupIdForClient(clientId, groupId);
|
|
601
|
+
}
|
|
602
602
|
chrome.tabGroups.update(groupId, {
|
|
603
603
|
title: baseName,
|
|
604
604
|
color: CDPUtils.getGroupColorForClient(clientId),
|
|
@@ -607,8 +607,10 @@ var WebSocketConnection = (function() {
|
|
|
607
607
|
if (chrome.runtime.lastError) {
|
|
608
608
|
Logger.warn('[WS:' + self.connectionId + '] Failed to set group title:', chrome.runtime.lastError.message);
|
|
609
609
|
}
|
|
610
|
+
self.state.setGroupCreationPromise(clientId, null);
|
|
611
|
+
resolveGroupReady(groupId);
|
|
612
|
+
Logger.info('[WS:' + self.connectionId + '] Created group for client:', clientId, 'groupId:', groupId, 'title:', baseName);
|
|
610
613
|
});
|
|
611
|
-
Logger.info('[WS:' + self.connectionId + '] Created group for client:', clientId, 'groupId:', groupId, 'title:', baseName);
|
|
612
614
|
});
|
|
613
615
|
});
|
|
614
616
|
};
|
package/package.json
CHANGED