@browserless.io/browserless 2.25.0 → 2.25.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.
- package/CHANGELOG.md +18 -1
- package/build/browsers/index.js +18 -11
- package/build/limiter.spec.js +1 -1
- package/build/routes/chrome/http/content.post.body.json +9 -9
- package/build/routes/chrome/http/pdf.post.body.json +9 -9
- package/build/routes/chrome/http/scrape.post.body.json +9 -9
- package/build/routes/chrome/http/scrape.post.response.json +1 -1
- package/build/routes/chrome/http/screenshot.post.body.json +9 -9
- package/build/routes/chrome/tests/kill-sessions.spec.js +1 -1
- package/build/routes/chrome/tests/page-websocket.spec.js +0 -3
- package/build/routes/chromium/http/content.post.body.json +9 -9
- package/build/routes/chromium/http/pdf.post.body.json +9 -9
- package/build/routes/chromium/http/scrape.post.body.json +9 -9
- package/build/routes/chromium/http/scrape.post.response.json +1 -1
- package/build/routes/chromium/http/screenshot.post.body.json +9 -9
- package/build/routes/chromium/tests/kill-sessions.spec.js +1 -1
- package/build/routes/chromium/tests/page-websocket.spec.js +0 -3
- package/build/routes/chromium/tests/websocket.spec.js +0 -3
- package/build/routes/edge/http/content.post.body.json +9 -9
- package/build/routes/edge/http/pdf.post.body.json +9 -9
- package/build/routes/edge/http/scrape.post.body.json +9 -9
- package/build/routes/edge/http/scrape.post.response.json +1 -1
- package/build/routes/edge/http/screenshot.post.body.json +9 -9
- package/build/routes/edge/tests/page-websocket.spec.js +0 -3
- package/build/routes/firefox/tests/kill-sessions.spec.js +1 -1
- package/build/routes/webkit/tests/kill-sessions.spec.js +1 -1
- package/build/routes/webkit/tests/websocket.spec.js +0 -3
- package/docker/multi/Dockerfile +4 -4
- package/package.json +11 -11
- package/scripts/test.sh +1 -1
- package/src/browsers/index.ts +38 -14
- package/src/limiter.spec.ts +1 -1
- package/src/routes/chrome/tests/kill-sessions.spec.ts +1 -1
- package/src/routes/chrome/tests/page-websocket.spec.ts +0 -4
- package/src/routes/chromium/tests/kill-sessions.spec.ts +1 -1
- package/src/routes/chromium/tests/page-websocket.spec.ts +0 -4
- package/src/routes/chromium/tests/websocket.spec.ts +0 -4
- package/src/routes/edge/tests/page-websocket.spec.ts +0 -4
- package/src/routes/firefox/tests/kill-sessions.spec.ts +1 -1
- package/src/routes/webkit/tests/kill-sessions.spec.ts +1 -1
- package/src/routes/webkit/tests/websocket.spec.ts +0 -4
- package/static/docs/swagger.json +15 -15
- package/static/docs/swagger.min.json +14 -14
- package/static/function/client.js +33 -20
- package/static/function/index.html +33 -20
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"type": "string"
|
|
130
130
|
},
|
|
131
131
|
"partitionKey": {
|
|
132
|
-
"description": "Cookie partition key. In Chrome, it matches the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n
|
|
132
|
+
"description": "Cookie partition key. In Chrome, it matches the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin in the\n{@link https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey PartitionKey}.",
|
|
133
133
|
"anyOf": [
|
|
134
134
|
{
|
|
135
135
|
"$ref": "#/definitions/CookiePartitionKey"
|
|
@@ -280,14 +280,14 @@
|
|
|
280
280
|
"length": {
|
|
281
281
|
"type": "number"
|
|
282
282
|
},
|
|
283
|
-
"__@toStringTag@
|
|
283
|
+
"__@toStringTag@12614": {
|
|
284
284
|
"type": "string",
|
|
285
285
|
"const": "Uint8Array"
|
|
286
286
|
}
|
|
287
287
|
},
|
|
288
288
|
"required": [
|
|
289
289
|
"BYTES_PER_ELEMENT",
|
|
290
|
-
"__@toStringTag@
|
|
290
|
+
"__@toStringTag@12614",
|
|
291
291
|
"buffer",
|
|
292
292
|
"byteLength",
|
|
293
293
|
"byteOffset",
|
|
@@ -322,13 +322,13 @@
|
|
|
322
322
|
"byteLength": {
|
|
323
323
|
"type": "number"
|
|
324
324
|
},
|
|
325
|
-
"__@toStringTag@
|
|
325
|
+
"__@toStringTag@12614": {
|
|
326
326
|
"type": "string"
|
|
327
327
|
}
|
|
328
328
|
},
|
|
329
329
|
"additionalProperties": false,
|
|
330
330
|
"required": [
|
|
331
|
-
"__@toStringTag@
|
|
331
|
+
"__@toStringTag@12614",
|
|
332
332
|
"byteLength"
|
|
333
333
|
]
|
|
334
334
|
},
|
|
@@ -338,18 +338,18 @@
|
|
|
338
338
|
"byteLength": {
|
|
339
339
|
"type": "number"
|
|
340
340
|
},
|
|
341
|
-
"__@species@
|
|
341
|
+
"__@species@12652": {
|
|
342
342
|
"$ref": "#/definitions/SharedArrayBuffer"
|
|
343
343
|
},
|
|
344
|
-
"__@toStringTag@
|
|
344
|
+
"__@toStringTag@12614": {
|
|
345
345
|
"type": "string",
|
|
346
346
|
"const": "SharedArrayBuffer"
|
|
347
347
|
}
|
|
348
348
|
},
|
|
349
349
|
"additionalProperties": false,
|
|
350
350
|
"required": [
|
|
351
|
-
"__@species@
|
|
352
|
-
"__@toStringTag@
|
|
351
|
+
"__@species@12652",
|
|
352
|
+
"__@toStringTag@12614",
|
|
353
353
|
"byteLength"
|
|
354
354
|
]
|
|
355
355
|
},
|
|
@@ -852,7 +852,7 @@
|
|
|
852
852
|
"type": "string"
|
|
853
853
|
},
|
|
854
854
|
"partitionKey": {
|
|
855
|
-
"description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n
|
|
855
|
+
"description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin in the\n{@link https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey PartitionKey}.",
|
|
856
856
|
"anyOf": [
|
|
857
857
|
{
|
|
858
858
|
"$ref": "#/definitions/CookiePartitionKey"
|
|
@@ -1001,7 +1001,7 @@
|
|
|
1001
1001
|
},
|
|
1002
1002
|
"info": {
|
|
1003
1003
|
"title": "Browserless",
|
|
1004
|
-
"version": "2.25.
|
|
1004
|
+
"version": "2.25.2",
|
|
1005
1005
|
"x-logo": {
|
|
1006
1006
|
"altText": "browserless logo",
|
|
1007
1007
|
"url": "./docs/browserless-logo-inline.svg"
|
|
@@ -2820,7 +2820,7 @@
|
|
|
2820
2820
|
"type": "string"
|
|
2821
2821
|
},
|
|
2822
2822
|
"partitionKey": {
|
|
2823
|
-
"description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n
|
|
2823
|
+
"description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin in the\n{@link https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey PartitionKey}.",
|
|
2824
2824
|
"anyOf": [
|
|
2825
2825
|
{
|
|
2826
2826
|
"$ref": "#/definitions/CookiePartitionKey"
|
|
@@ -5101,7 +5101,7 @@
|
|
|
5101
5101
|
"type": "string"
|
|
5102
5102
|
},
|
|
5103
5103
|
"partitionKey": {
|
|
5104
|
-
"description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n
|
|
5104
|
+
"description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin in the\n{@link https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey PartitionKey}.",
|
|
5105
5105
|
"anyOf": [
|
|
5106
5106
|
{
|
|
5107
5107
|
"$ref": "#/definitions/CookiePartitionKey"
|
|
@@ -7188,7 +7188,7 @@
|
|
|
7188
7188
|
"type": "string"
|
|
7189
7189
|
},
|
|
7190
7190
|
"partitionKey": {
|
|
7191
|
-
"description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin\n
|
|
7191
|
+
"description": "Cookie partition key. In Chrome, it is the top-level site the\npartitioned cookie is available in. In Firefox, it matches the\nsource origin in the\n{@link https://w3c.github.io/webdriver-bidi/#type-storage-PartitionKey PartitionKey}.",
|
|
7192
7192
|
"anyOf": [
|
|
7193
7193
|
{
|
|
7194
7194
|
"$ref": "#/definitions/CookiePartitionKey"
|
|
@@ -2346,8 +2346,8 @@
|
|
|
2346
2346
|
var _ = { label: 0, sent: function() {
|
|
2347
2347
|
if (t[0] & 1) throw t[1];
|
|
2348
2348
|
return t[1];
|
|
2349
|
-
}, trys: [], ops: [] }, f, y, t, g;
|
|
2350
|
-
return g =
|
|
2349
|
+
}, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
2350
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
2351
2351
|
return this;
|
|
2352
2352
|
}), g;
|
|
2353
2353
|
function verb(n) {
|
|
@@ -2454,16 +2454,24 @@
|
|
|
2454
2454
|
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
2455
2455
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
2456
2456
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
2457
|
-
return i =
|
|
2457
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
|
|
2458
2458
|
return this;
|
|
2459
2459
|
}, i;
|
|
2460
|
-
function
|
|
2461
|
-
|
|
2462
|
-
return
|
|
2463
|
-
q.push([n, v, a, b]) > 1 || resume(n, v);
|
|
2464
|
-
});
|
|
2460
|
+
function awaitReturn(f) {
|
|
2461
|
+
return function(v) {
|
|
2462
|
+
return Promise.resolve(v).then(f, reject);
|
|
2465
2463
|
};
|
|
2466
2464
|
}
|
|
2465
|
+
function verb(n, f) {
|
|
2466
|
+
if (g[n]) {
|
|
2467
|
+
i[n] = function(v) {
|
|
2468
|
+
return new Promise(function(a, b) {
|
|
2469
|
+
q.push([n, v, a, b]) > 1 || resume(n, v);
|
|
2470
|
+
});
|
|
2471
|
+
};
|
|
2472
|
+
if (f) i[n] = f(i[n]);
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2467
2475
|
function resume(n, v) {
|
|
2468
2476
|
try {
|
|
2469
2477
|
step(g[n](v));
|
|
@@ -4393,7 +4401,7 @@
|
|
|
4393
4401
|
// node_modules/puppeteer-core/lib/esm/puppeteer/generated/version.js
|
|
4394
4402
|
init_dirname();
|
|
4395
4403
|
init_buffer2();
|
|
4396
|
-
var packageVersion = "24.
|
|
4404
|
+
var packageVersion = "24.3.0";
|
|
4397
4405
|
|
|
4398
4406
|
// node_modules/puppeteer-core/lib/esm/puppeteer/util/assert.js
|
|
4399
4407
|
init_dirname();
|
|
@@ -8565,7 +8573,7 @@
|
|
|
8565
8573
|
connection() {
|
|
8566
8574
|
return this.#connection;
|
|
8567
8575
|
}
|
|
8568
|
-
get
|
|
8576
|
+
get detached() {
|
|
8569
8577
|
return this.#connection._closed || this.#detached;
|
|
8570
8578
|
}
|
|
8571
8579
|
parentSession() {
|
|
@@ -8576,7 +8584,7 @@
|
|
|
8576
8584
|
return parent ?? void 0;
|
|
8577
8585
|
}
|
|
8578
8586
|
send(method, params, options) {
|
|
8579
|
-
if (this
|
|
8587
|
+
if (this.detached) {
|
|
8580
8588
|
return Promise.reject(new TargetCloseError(`Protocol error (${method}): Session closed. Most likely the ${this.#targetType} has been closed.`));
|
|
8581
8589
|
}
|
|
8582
8590
|
return this.#connection._rawSend(this.#callbacks, method, params, this.#sessionId, options);
|
|
@@ -8605,7 +8613,7 @@
|
|
|
8605
8613
|
* won't emit any events and can't be used to send messages.
|
|
8606
8614
|
*/
|
|
8607
8615
|
async detach() {
|
|
8608
|
-
if (this
|
|
8616
|
+
if (this.detached) {
|
|
8609
8617
|
throw new Error(`Session already detached. Most likely the ${this.#targetType} has been closed.`);
|
|
8610
8618
|
}
|
|
8611
8619
|
await this.#connection.send("Target.detachFromTarget", {
|
|
@@ -8685,12 +8693,18 @@
|
|
|
8685
8693
|
get _sessions() {
|
|
8686
8694
|
return this.#sessions;
|
|
8687
8695
|
}
|
|
8696
|
+
/**
|
|
8697
|
+
* @internal
|
|
8698
|
+
*/
|
|
8699
|
+
_session(sessionId) {
|
|
8700
|
+
return this.#sessions.get(sessionId) || null;
|
|
8701
|
+
}
|
|
8688
8702
|
/**
|
|
8689
8703
|
* @param sessionId - The session id
|
|
8690
8704
|
* @returns The current CDP session if it exists
|
|
8691
8705
|
*/
|
|
8692
8706
|
session(sessionId) {
|
|
8693
|
-
return this
|
|
8707
|
+
return this._session(sessionId);
|
|
8694
8708
|
}
|
|
8695
8709
|
url() {
|
|
8696
8710
|
return this.#url;
|
|
@@ -16552,7 +16566,7 @@ ${sourceUrlComment}
|
|
|
16552
16566
|
if (!mainFrame) {
|
|
16553
16567
|
return;
|
|
16554
16568
|
}
|
|
16555
|
-
if (this.
|
|
16569
|
+
if (!this.#page.browser().connected) {
|
|
16556
16570
|
this.#removeFramesRecursively(mainFrame);
|
|
16557
16571
|
return;
|
|
16558
16572
|
}
|
|
@@ -16579,7 +16593,6 @@ ${sourceUrlComment}
|
|
|
16579
16593
|
*/
|
|
16580
16594
|
async swapFrameTree(client) {
|
|
16581
16595
|
this.#client = client;
|
|
16582
|
-
assert(this.#client instanceof CdpCDPSession, "CDPSession is not an instance of CDPSessionImpl.");
|
|
16583
16596
|
const frame = this._frameTree.getMainFrame();
|
|
16584
16597
|
if (frame) {
|
|
16585
16598
|
this.#frameNavigatedReceived.add(this.#client.target()._targetId);
|
|
@@ -18284,9 +18297,9 @@ ${sourceUrlComment}
|
|
|
18284
18297
|
}
|
|
18285
18298
|
}
|
|
18286
18299
|
async #onActivation(newSession) {
|
|
18300
|
+
assert(newSession instanceof CdpCDPSession, "CDPSession is not instance of CdpCDPSession");
|
|
18287
18301
|
this.#primaryTargetClient = newSession;
|
|
18288
|
-
|
|
18289
|
-
this.#primaryTarget = this.#primaryTargetClient.target();
|
|
18302
|
+
this.#primaryTarget = newSession.target();
|
|
18290
18303
|
assert(this.#primaryTarget, "Missing target on swap");
|
|
18291
18304
|
this.#keyboard.updateClient(newSession);
|
|
18292
18305
|
this.#mouse.updateClient(newSession);
|
|
@@ -19151,7 +19164,7 @@ ${sourceUrlComment}
|
|
|
19151
19164
|
this.#browserContext = browserContext;
|
|
19152
19165
|
this._targetId = targetInfo.targetId;
|
|
19153
19166
|
this.#sessionFactory = sessionFactory;
|
|
19154
|
-
if (this.#session
|
|
19167
|
+
if (this.#session) {
|
|
19155
19168
|
this.#session.setTarget(this);
|
|
19156
19169
|
}
|
|
19157
19170
|
}
|
|
@@ -19526,7 +19539,7 @@ ${sourceUrlComment}
|
|
|
19526
19539
|
};
|
|
19527
19540
|
#onAttachedToTarget = async (parentSession, event) => {
|
|
19528
19541
|
const targetInfo = event.targetInfo;
|
|
19529
|
-
const session = this.#connection.
|
|
19542
|
+
const session = this.#connection._session(event.sessionId);
|
|
19530
19543
|
if (!session) {
|
|
19531
19544
|
throw new Error(`Session ${event.sessionId} was not created.`);
|
|
19532
19545
|
}
|
|
@@ -19552,7 +19565,7 @@ ${sourceUrlComment}
|
|
|
19552
19565
|
return;
|
|
19553
19566
|
}
|
|
19554
19567
|
const isExistingTarget = this.#attachedTargetsByTargetId.has(targetInfo.targetId);
|
|
19555
|
-
const target = isExistingTarget ? this.#attachedTargetsByTargetId.get(targetInfo.targetId) : this.#targetFactory(targetInfo, session, parentSession instanceof
|
|
19568
|
+
const target = isExistingTarget ? this.#attachedTargetsByTargetId.get(targetInfo.targetId) : this.#targetFactory(targetInfo, session, parentSession instanceof CdpCDPSession ? parentSession : void 0);
|
|
19556
19569
|
if (this.#targetFilterCallback && !this.#targetFilterCallback(target)) {
|
|
19557
19570
|
this.#ignoredTargets.add(targetInfo.targetId);
|
|
19558
19571
|
this.#finishInitializationIfReady(targetInfo.targetId);
|
|
@@ -2354,8 +2354,8 @@
|
|
|
2354
2354
|
var _ = { label: 0, sent: function() {
|
|
2355
2355
|
if (t[0] & 1) throw t[1];
|
|
2356
2356
|
return t[1];
|
|
2357
|
-
}, trys: [], ops: [] }, f, y, t, g;
|
|
2358
|
-
return g =
|
|
2357
|
+
}, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
2358
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
2359
2359
|
return this;
|
|
2360
2360
|
}), g;
|
|
2361
2361
|
function verb(n) {
|
|
@@ -2462,16 +2462,24 @@
|
|
|
2462
2462
|
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
2463
2463
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
2464
2464
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
2465
|
-
return i =
|
|
2465
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
|
|
2466
2466
|
return this;
|
|
2467
2467
|
}, i;
|
|
2468
|
-
function
|
|
2469
|
-
|
|
2470
|
-
return
|
|
2471
|
-
q.push([n, v, a, b]) > 1 || resume(n, v);
|
|
2472
|
-
});
|
|
2468
|
+
function awaitReturn(f) {
|
|
2469
|
+
return function(v) {
|
|
2470
|
+
return Promise.resolve(v).then(f, reject);
|
|
2473
2471
|
};
|
|
2474
2472
|
}
|
|
2473
|
+
function verb(n, f) {
|
|
2474
|
+
if (g[n]) {
|
|
2475
|
+
i[n] = function(v) {
|
|
2476
|
+
return new Promise(function(a, b) {
|
|
2477
|
+
q.push([n, v, a, b]) > 1 || resume(n, v);
|
|
2478
|
+
});
|
|
2479
|
+
};
|
|
2480
|
+
if (f) i[n] = f(i[n]);
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2475
2483
|
function resume(n, v) {
|
|
2476
2484
|
try {
|
|
2477
2485
|
step(g[n](v));
|
|
@@ -4401,7 +4409,7 @@
|
|
|
4401
4409
|
// node_modules/puppeteer-core/lib/esm/puppeteer/generated/version.js
|
|
4402
4410
|
init_dirname();
|
|
4403
4411
|
init_buffer2();
|
|
4404
|
-
var packageVersion = "24.
|
|
4412
|
+
var packageVersion = "24.3.0";
|
|
4405
4413
|
|
|
4406
4414
|
// node_modules/puppeteer-core/lib/esm/puppeteer/util/assert.js
|
|
4407
4415
|
init_dirname();
|
|
@@ -8573,7 +8581,7 @@
|
|
|
8573
8581
|
connection() {
|
|
8574
8582
|
return this.#connection;
|
|
8575
8583
|
}
|
|
8576
|
-
get
|
|
8584
|
+
get detached() {
|
|
8577
8585
|
return this.#connection._closed || this.#detached;
|
|
8578
8586
|
}
|
|
8579
8587
|
parentSession() {
|
|
@@ -8584,7 +8592,7 @@
|
|
|
8584
8592
|
return parent ?? void 0;
|
|
8585
8593
|
}
|
|
8586
8594
|
send(method, params, options) {
|
|
8587
|
-
if (this
|
|
8595
|
+
if (this.detached) {
|
|
8588
8596
|
return Promise.reject(new TargetCloseError(`Protocol error (${method}): Session closed. Most likely the ${this.#targetType} has been closed.`));
|
|
8589
8597
|
}
|
|
8590
8598
|
return this.#connection._rawSend(this.#callbacks, method, params, this.#sessionId, options);
|
|
@@ -8613,7 +8621,7 @@
|
|
|
8613
8621
|
* won't emit any events and can't be used to send messages.
|
|
8614
8622
|
*/
|
|
8615
8623
|
async detach() {
|
|
8616
|
-
if (this
|
|
8624
|
+
if (this.detached) {
|
|
8617
8625
|
throw new Error(`Session already detached. Most likely the ${this.#targetType} has been closed.`);
|
|
8618
8626
|
}
|
|
8619
8627
|
await this.#connection.send("Target.detachFromTarget", {
|
|
@@ -8693,12 +8701,18 @@
|
|
|
8693
8701
|
get _sessions() {
|
|
8694
8702
|
return this.#sessions;
|
|
8695
8703
|
}
|
|
8704
|
+
/**
|
|
8705
|
+
* @internal
|
|
8706
|
+
*/
|
|
8707
|
+
_session(sessionId) {
|
|
8708
|
+
return this.#sessions.get(sessionId) || null;
|
|
8709
|
+
}
|
|
8696
8710
|
/**
|
|
8697
8711
|
* @param sessionId - The session id
|
|
8698
8712
|
* @returns The current CDP session if it exists
|
|
8699
8713
|
*/
|
|
8700
8714
|
session(sessionId) {
|
|
8701
|
-
return this
|
|
8715
|
+
return this._session(sessionId);
|
|
8702
8716
|
}
|
|
8703
8717
|
url() {
|
|
8704
8718
|
return this.#url;
|
|
@@ -16560,7 +16574,7 @@ ${sourceUrlComment}
|
|
|
16560
16574
|
if (!mainFrame) {
|
|
16561
16575
|
return;
|
|
16562
16576
|
}
|
|
16563
|
-
if (this.
|
|
16577
|
+
if (!this.#page.browser().connected) {
|
|
16564
16578
|
this.#removeFramesRecursively(mainFrame);
|
|
16565
16579
|
return;
|
|
16566
16580
|
}
|
|
@@ -16587,7 +16601,6 @@ ${sourceUrlComment}
|
|
|
16587
16601
|
*/
|
|
16588
16602
|
async swapFrameTree(client) {
|
|
16589
16603
|
this.#client = client;
|
|
16590
|
-
assert(this.#client instanceof CdpCDPSession, "CDPSession is not an instance of CDPSessionImpl.");
|
|
16591
16604
|
const frame = this._frameTree.getMainFrame();
|
|
16592
16605
|
if (frame) {
|
|
16593
16606
|
this.#frameNavigatedReceived.add(this.#client.target()._targetId);
|
|
@@ -18292,9 +18305,9 @@ ${sourceUrlComment}
|
|
|
18292
18305
|
}
|
|
18293
18306
|
}
|
|
18294
18307
|
async #onActivation(newSession) {
|
|
18308
|
+
assert(newSession instanceof CdpCDPSession, "CDPSession is not instance of CdpCDPSession");
|
|
18295
18309
|
this.#primaryTargetClient = newSession;
|
|
18296
|
-
|
|
18297
|
-
this.#primaryTarget = this.#primaryTargetClient.target();
|
|
18310
|
+
this.#primaryTarget = newSession.target();
|
|
18298
18311
|
assert(this.#primaryTarget, "Missing target on swap");
|
|
18299
18312
|
this.#keyboard.updateClient(newSession);
|
|
18300
18313
|
this.#mouse.updateClient(newSession);
|
|
@@ -19159,7 +19172,7 @@ ${sourceUrlComment}
|
|
|
19159
19172
|
this.#browserContext = browserContext;
|
|
19160
19173
|
this._targetId = targetInfo.targetId;
|
|
19161
19174
|
this.#sessionFactory = sessionFactory;
|
|
19162
|
-
if (this.#session
|
|
19175
|
+
if (this.#session) {
|
|
19163
19176
|
this.#session.setTarget(this);
|
|
19164
19177
|
}
|
|
19165
19178
|
}
|
|
@@ -19534,7 +19547,7 @@ ${sourceUrlComment}
|
|
|
19534
19547
|
};
|
|
19535
19548
|
#onAttachedToTarget = async (parentSession, event) => {
|
|
19536
19549
|
const targetInfo = event.targetInfo;
|
|
19537
|
-
const session = this.#connection.
|
|
19550
|
+
const session = this.#connection._session(event.sessionId);
|
|
19538
19551
|
if (!session) {
|
|
19539
19552
|
throw new Error(`Session ${event.sessionId} was not created.`);
|
|
19540
19553
|
}
|
|
@@ -19560,7 +19573,7 @@ ${sourceUrlComment}
|
|
|
19560
19573
|
return;
|
|
19561
19574
|
}
|
|
19562
19575
|
const isExistingTarget = this.#attachedTargetsByTargetId.has(targetInfo.targetId);
|
|
19563
|
-
const target = isExistingTarget ? this.#attachedTargetsByTargetId.get(targetInfo.targetId) : this.#targetFactory(targetInfo, session, parentSession instanceof
|
|
19576
|
+
const target = isExistingTarget ? this.#attachedTargetsByTargetId.get(targetInfo.targetId) : this.#targetFactory(targetInfo, session, parentSession instanceof CdpCDPSession ? parentSession : void 0);
|
|
19564
19577
|
if (this.#targetFilterCallback && !this.#targetFilterCallback(target)) {
|
|
19565
19578
|
this.#ignoredTargets.add(targetInfo.targetId);
|
|
19566
19579
|
this.#finishInitializationIfReady(targetInfo.targetId);
|