cdp-tunnel 2.10.1 → 2.10.3
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.
|
@@ -183,7 +183,7 @@ importScripts('features/automation-badge.js');
|
|
|
183
183
|
attached.forEach(function(tid) {
|
|
184
184
|
if (state.getClientIdByTabId(tid) === clientId && !state.isPreExistingTab(tid)) {
|
|
185
185
|
Logger.info('[TabGroups] Re-grouping tab', tid, 'for client:', clientId);
|
|
186
|
-
var ctx = { _state: state, _wsManager: wsManager, clientId: clientId };
|
|
186
|
+
var ctx = { _state: state, _wsManager: wsManager, clientId: clientId, mode: state.mode };
|
|
187
187
|
SpecialHandler.addTabToAutomationGroup(tid, clientId, null, ctx);
|
|
188
188
|
}
|
|
189
189
|
});
|
|
@@ -210,17 +210,17 @@ importScripts('features/automation-badge.js');
|
|
|
210
210
|
if (clientId) {
|
|
211
211
|
var cachedGroupId = state.getGroupIdForClient(clientId);
|
|
212
212
|
if (cachedGroupId) {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
213
|
+
Logger.info('[Tabs] Tab', tabId, 'left group, re-adding to cached group:', cachedGroupId);
|
|
214
|
+
chrome.tabs.group({ tabIds: tabId, groupId: cachedGroupId }, function() {
|
|
215
|
+
if (chrome.runtime.lastError) {
|
|
216
|
+
Logger.warn('[Tabs] Failed to re-add tab to group:', chrome.runtime.lastError.message);
|
|
217
|
+
var ctx = { _state: state, _wsManager: wsManager, clientId: clientId, mode: state.mode };
|
|
218
|
+
SpecialHandler.addTabToAutomationGroup(tabId, clientId, null, ctx);
|
|
219
219
|
}
|
|
220
220
|
});
|
|
221
221
|
} else {
|
|
222
222
|
Logger.info('[Tabs] Tab', tabId, 'left group, no cached groupId — delegating to addTabToAutomationGroup');
|
|
223
|
-
var ctx = { _state: state, _wsManager: wsManager, clientId: clientId };
|
|
223
|
+
var ctx = { _state: state, _wsManager: wsManager, clientId: clientId, mode: state.mode };
|
|
224
224
|
SpecialHandler.addTabToAutomationGroup(tabId, clientId, null, ctx);
|
|
225
225
|
}
|
|
226
226
|
}
|
|
@@ -319,7 +319,7 @@ importScripts('features/automation-badge.js');
|
|
|
319
319
|
}
|
|
320
320
|
});
|
|
321
321
|
|
|
322
|
-
var ctx = { _state: state, _wsManager: wsManager, clientId: openerClientId };
|
|
322
|
+
var ctx = { _state: state, _wsManager: wsManager, clientId: openerClientId, mode: state.mode };
|
|
323
323
|
SpecialHandler.addTabToAutomationGroup(tabId, openerClientId, null, ctx);
|
|
324
324
|
|
|
325
325
|
Logger.info('[Tabs] Sending Target.attachedToTarget event');
|
|
@@ -212,6 +212,13 @@ var SpecialHandler = (function() {
|
|
|
212
212
|
function _addTabToAutomationGroupInner(tabId, clientId, callback, context) {
|
|
213
213
|
var state = context ? _getState(context) : null;
|
|
214
214
|
var wsManager = context ? _getWSManager(context) : null;
|
|
215
|
+
var mode = context ? (context.mode || (state ? state.mode : null)) : null;
|
|
216
|
+
|
|
217
|
+
if (mode === 'takeover') {
|
|
218
|
+
Logger.info('[TabGroup] Skipping group for takeover tab:', tabId);
|
|
219
|
+
if (callback) callback(false);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
215
222
|
|
|
216
223
|
Logger.info('[TabGroup] Starting addTabToAutomationGroup for tabId:', tabId, 'clientId:', clientId);
|
|
217
224
|
|
|
@@ -27,6 +27,7 @@ function ConnectionState(connectionId, mode) {
|
|
|
27
27
|
this.browserContextIds = new Set(['default']);
|
|
28
28
|
this.screencastPollingSessions = new Map();
|
|
29
29
|
this.automatedTabs = new Set();
|
|
30
|
+
this._groupCreationPromises = new Map();
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
ConnectionState.prototype.mapSession = function(sessionId, tabId, targetId) {
|
|
@@ -260,6 +261,18 @@ ConnectionState.prototype.removeGroupForClient = function(clientId) {
|
|
|
260
261
|
this.clientIdToGroupId.delete(clientId);
|
|
261
262
|
};
|
|
262
263
|
|
|
264
|
+
ConnectionState.prototype.setGroupCreationPromise = function(clientId, promise) {
|
|
265
|
+
if (promise) {
|
|
266
|
+
this._groupCreationPromises.set(clientId, promise);
|
|
267
|
+
} else {
|
|
268
|
+
this._groupCreationPromises.delete(clientId);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
ConnectionState.prototype.getGroupCreationPromise = function(clientId) {
|
|
273
|
+
return this._groupCreationPromises.get(clientId) || null;
|
|
274
|
+
};
|
|
275
|
+
|
|
263
276
|
ConnectionState.prototype.addPreExistingTab = function(tabId) {
|
|
264
277
|
this.preExistingTabIds.add(tabId);
|
|
265
278
|
};
|
|
@@ -335,6 +348,7 @@ ConnectionState.prototype.clearAllState = function() {
|
|
|
335
348
|
this.pendingCreatedTabUrls.clear();
|
|
336
349
|
this.cdpCreatedTabIds.clear();
|
|
337
350
|
this.cdpClients = [];
|
|
351
|
+
this._groupCreationPromises.clear();
|
|
338
352
|
};
|
|
339
353
|
|
|
340
354
|
ConnectionState.prototype.persist = function(tabId, attached) {
|
package/package.json
CHANGED