@browserless.io/browserless 2.24.0-beta-3 → 2.24.0-beta-5
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/build/http.d.ts +1 -0
- package/build/http.js +1 -0
- package/build/routes/chrome/http/content.post.body.json +35 -10
- package/build/routes/chrome/http/pdf.post.body.json +35 -10
- package/build/routes/chrome/http/scrape.post.body.json +35 -10
- package/build/routes/chrome/http/scrape.post.response.json +26 -1
- package/build/routes/chrome/http/screenshot.post.body.json +35 -10
- package/build/routes/chromium/http/content.post.body.json +35 -10
- package/build/routes/chromium/http/pdf.post.body.json +35 -10
- package/build/routes/chromium/http/scrape.post.body.json +35 -10
- package/build/routes/chromium/http/scrape.post.response.json +26 -1
- package/build/routes/chromium/http/screenshot.post.body.json +35 -10
- package/build/routes/management/http/meta.get.d.ts +41 -0
- package/build/routes/management/http/meta.get.js +40 -0
- package/build/routes/management/http/meta.get.response.json +54 -0
- package/build/routes/management/tests/management.spec.js +7 -0
- package/build/types.d.ts +2 -0
- package/build/types.js +1 -0
- package/package.json +5 -5
- package/src/http.ts +1 -0
- package/src/routes/management/http/meta.get.ts +102 -0
- package/src/routes/management/tests/management.spec.ts +13 -0
- package/src/types.ts +1 -0
- package/static/docs/swagger.json +202 -14
- package/static/docs/swagger.min.json +202 -14
- package/static/function/client.js +916 -821
- package/static/function/index.html +916 -821
|
@@ -4379,7 +4379,7 @@
|
|
|
4379
4379
|
// node_modules/puppeteer-core/lib/esm/puppeteer/generated/version.js
|
|
4380
4380
|
init_dirname();
|
|
4381
4381
|
init_buffer2();
|
|
4382
|
-
var packageVersion = "23.
|
|
4382
|
+
var packageVersion = "23.10.0";
|
|
4383
4383
|
|
|
4384
4384
|
// node_modules/puppeteer-core/lib/esm/puppeteer/util/assert.js
|
|
4385
4385
|
init_dirname();
|
|
@@ -5236,6 +5236,39 @@
|
|
|
5236
5236
|
return acc.concat(x);
|
|
5237
5237
|
}, []);
|
|
5238
5238
|
}
|
|
5239
|
+
/**
|
|
5240
|
+
* Returns all cookies in the default {@link BrowserContext}.
|
|
5241
|
+
*
|
|
5242
|
+
* @remarks
|
|
5243
|
+
*
|
|
5244
|
+
* Shortcut for
|
|
5245
|
+
* {@link BrowserContext.cookies | browser.defaultBrowserContext().cookies()}.
|
|
5246
|
+
*/
|
|
5247
|
+
async cookies() {
|
|
5248
|
+
return await this.defaultBrowserContext().cookies();
|
|
5249
|
+
}
|
|
5250
|
+
/**
|
|
5251
|
+
* Sets cookies in the default {@link BrowserContext}.
|
|
5252
|
+
*
|
|
5253
|
+
* @remarks
|
|
5254
|
+
*
|
|
5255
|
+
* Shortcut for
|
|
5256
|
+
* {@link BrowserContext.setCookie | browser.defaultBrowserContext().setCookie()}.
|
|
5257
|
+
*/
|
|
5258
|
+
async setCookie(...cookies) {
|
|
5259
|
+
return await this.defaultBrowserContext().setCookie(...cookies);
|
|
5260
|
+
}
|
|
5261
|
+
/**
|
|
5262
|
+
* Removes cookies from the default {@link BrowserContext}.
|
|
5263
|
+
*
|
|
5264
|
+
* @remarks
|
|
5265
|
+
*
|
|
5266
|
+
* Shortcut for
|
|
5267
|
+
* {@link BrowserContext.deleteCookie | browser.defaultBrowserContext().deleteCookie()}.
|
|
5268
|
+
*/
|
|
5269
|
+
async deleteCookie(...cookies) {
|
|
5270
|
+
return await this.defaultBrowserContext().deleteCookie(...cookies);
|
|
5271
|
+
}
|
|
5239
5272
|
/**
|
|
5240
5273
|
* Whether Puppeteer is connected to this {@link Browser | browser}.
|
|
5241
5274
|
*
|
|
@@ -5485,6 +5518,18 @@
|
|
|
5485
5518
|
/* BrowserContextEvent.TargetChanged */
|
|
5486
5519
|
), from(this.targets())).pipe(filterAsync(predicate), raceWith(timeout(ms))));
|
|
5487
5520
|
}
|
|
5521
|
+
/**
|
|
5522
|
+
* Removes cookie in the browser context
|
|
5523
|
+
* @param cookies - {@link Cookie | cookie} to remove
|
|
5524
|
+
*/
|
|
5525
|
+
async deleteCookie(...cookies) {
|
|
5526
|
+
return await this.setCookie(...cookies.map((cookie) => {
|
|
5527
|
+
return {
|
|
5528
|
+
...cookie,
|
|
5529
|
+
expires: 1
|
|
5530
|
+
};
|
|
5531
|
+
}));
|
|
5532
|
+
}
|
|
5488
5533
|
/**
|
|
5489
5534
|
* Whether this {@link BrowserContext | browser context} is closed.
|
|
5490
5535
|
*/
|
|
@@ -5507,7 +5552,51 @@
|
|
|
5507
5552
|
}
|
|
5508
5553
|
};
|
|
5509
5554
|
|
|
5510
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/
|
|
5555
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Page.js
|
|
5556
|
+
init_dirname();
|
|
5557
|
+
init_buffer2();
|
|
5558
|
+
|
|
5559
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/api/Page.js
|
|
5560
|
+
init_dirname();
|
|
5561
|
+
init_buffer2();
|
|
5562
|
+
|
|
5563
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.js
|
|
5564
|
+
init_dirname();
|
|
5565
|
+
init_buffer2();
|
|
5566
|
+
var DEFAULT_TIMEOUT = 3e4;
|
|
5567
|
+
var TimeoutSettings = class {
|
|
5568
|
+
#defaultTimeout;
|
|
5569
|
+
#defaultNavigationTimeout;
|
|
5570
|
+
constructor() {
|
|
5571
|
+
this.#defaultTimeout = null;
|
|
5572
|
+
this.#defaultNavigationTimeout = null;
|
|
5573
|
+
}
|
|
5574
|
+
setDefaultTimeout(timeout2) {
|
|
5575
|
+
this.#defaultTimeout = timeout2;
|
|
5576
|
+
}
|
|
5577
|
+
setDefaultNavigationTimeout(timeout2) {
|
|
5578
|
+
this.#defaultNavigationTimeout = timeout2;
|
|
5579
|
+
}
|
|
5580
|
+
navigationTimeout() {
|
|
5581
|
+
if (this.#defaultNavigationTimeout !== null) {
|
|
5582
|
+
return this.#defaultNavigationTimeout;
|
|
5583
|
+
}
|
|
5584
|
+
if (this.#defaultTimeout !== null) {
|
|
5585
|
+
return this.#defaultTimeout;
|
|
5586
|
+
}
|
|
5587
|
+
return DEFAULT_TIMEOUT;
|
|
5588
|
+
}
|
|
5589
|
+
timeout() {
|
|
5590
|
+
if (this.#defaultTimeout !== null) {
|
|
5591
|
+
return this.#defaultTimeout;
|
|
5592
|
+
}
|
|
5593
|
+
return DEFAULT_TIMEOUT;
|
|
5594
|
+
}
|
|
5595
|
+
};
|
|
5596
|
+
|
|
5597
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/util/decorators.js
|
|
5598
|
+
init_dirname();
|
|
5599
|
+
init_buffer2();
|
|
5511
5600
|
var __addDisposableResource = function(env, value, async2) {
|
|
5512
5601
|
if (value !== null && value !== void 0) {
|
|
5513
5602
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
@@ -5566,405 +5655,107 @@
|
|
|
5566
5655
|
var e = new Error(message);
|
|
5567
5656
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
5568
5657
|
});
|
|
5569
|
-
var
|
|
5570
|
-
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
targets() {
|
|
5583
|
-
return this.#browser.targets().filter((target) => {
|
|
5584
|
-
return target.browserContext() === this;
|
|
5585
|
-
});
|
|
5586
|
-
}
|
|
5587
|
-
async pages() {
|
|
5588
|
-
const pages = await Promise.all(this.targets().filter((target) => {
|
|
5589
|
-
return target.type() === "page" || target.type() === "other" && this.#browser._getIsPageTargetCallback()?.(target);
|
|
5590
|
-
}).map((target) => {
|
|
5591
|
-
return target.page();
|
|
5592
|
-
}));
|
|
5593
|
-
return pages.filter((page) => {
|
|
5594
|
-
return !!page;
|
|
5595
|
-
});
|
|
5658
|
+
var instances = /* @__PURE__ */ new WeakSet();
|
|
5659
|
+
function moveable(Class, _) {
|
|
5660
|
+
let hasDispose = false;
|
|
5661
|
+
if (Class.prototype[disposeSymbol]) {
|
|
5662
|
+
const dispose = Class.prototype[disposeSymbol];
|
|
5663
|
+
Class.prototype[disposeSymbol] = function() {
|
|
5664
|
+
if (instances.has(this)) {
|
|
5665
|
+
instances.delete(this);
|
|
5666
|
+
return;
|
|
5667
|
+
}
|
|
5668
|
+
return dispose.call(this);
|
|
5669
|
+
};
|
|
5670
|
+
hasDispose = true;
|
|
5596
5671
|
}
|
|
5597
|
-
|
|
5598
|
-
const
|
|
5599
|
-
|
|
5600
|
-
if (
|
|
5601
|
-
|
|
5672
|
+
if (Class.prototype[asyncDisposeSymbol]) {
|
|
5673
|
+
const asyncDispose = Class.prototype[asyncDisposeSymbol];
|
|
5674
|
+
Class.prototype[asyncDisposeSymbol] = function() {
|
|
5675
|
+
if (instances.has(this)) {
|
|
5676
|
+
instances.delete(this);
|
|
5677
|
+
return;
|
|
5602
5678
|
}
|
|
5603
|
-
return
|
|
5604
|
-
}
|
|
5605
|
-
|
|
5606
|
-
origin,
|
|
5607
|
-
browserContextId: this.#id || void 0,
|
|
5608
|
-
permissions: protocolPermissions
|
|
5609
|
-
});
|
|
5679
|
+
return asyncDispose.call(this);
|
|
5680
|
+
};
|
|
5681
|
+
hasDispose = true;
|
|
5610
5682
|
}
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5683
|
+
if (hasDispose) {
|
|
5684
|
+
Class.prototype.move = function() {
|
|
5685
|
+
instances.add(this);
|
|
5686
|
+
return this;
|
|
5687
|
+
};
|
|
5615
5688
|
}
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5689
|
+
return Class;
|
|
5690
|
+
}
|
|
5691
|
+
function throwIfDisposed(message = (value) => {
|
|
5692
|
+
return `Attempted to use disposed ${value.constructor.name}.`;
|
|
5693
|
+
}) {
|
|
5694
|
+
return (target, _) => {
|
|
5695
|
+
return function(...args) {
|
|
5696
|
+
if (this.disposed) {
|
|
5697
|
+
throw new Error(message(this));
|
|
5698
|
+
}
|
|
5699
|
+
return target.call(this, ...args);
|
|
5700
|
+
};
|
|
5701
|
+
};
|
|
5702
|
+
}
|
|
5703
|
+
function invokeAtMostOnceForArguments(target, _) {
|
|
5704
|
+
const cache = /* @__PURE__ */ new WeakMap();
|
|
5705
|
+
let cacheDepth = -1;
|
|
5706
|
+
return function(...args) {
|
|
5707
|
+
if (cacheDepth === -1) {
|
|
5708
|
+
cacheDepth = args.length;
|
|
5626
5709
|
}
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
}
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5710
|
+
if (cacheDepth !== args.length) {
|
|
5711
|
+
throw new Error("Memoized method was called with the wrong number of arguments");
|
|
5712
|
+
}
|
|
5713
|
+
let freshArguments = false;
|
|
5714
|
+
let cacheIterator = cache;
|
|
5715
|
+
for (const arg of args) {
|
|
5716
|
+
if (cacheIterator.has(arg)) {
|
|
5717
|
+
cacheIterator = cacheIterator.get(arg);
|
|
5718
|
+
} else {
|
|
5719
|
+
freshArguments = true;
|
|
5720
|
+
cacheIterator.set(arg, /* @__PURE__ */ new WeakMap());
|
|
5721
|
+
cacheIterator = cacheIterator.get(arg);
|
|
5722
|
+
}
|
|
5723
|
+
}
|
|
5724
|
+
if (!freshArguments) {
|
|
5725
|
+
return;
|
|
5726
|
+
}
|
|
5727
|
+
return target.call(this, ...args);
|
|
5728
|
+
};
|
|
5729
|
+
}
|
|
5730
|
+
function guarded(getKey = function() {
|
|
5731
|
+
return this;
|
|
5732
|
+
}) {
|
|
5733
|
+
return (target, _) => {
|
|
5734
|
+
const mutexes = /* @__PURE__ */ new WeakMap();
|
|
5735
|
+
return async function(...args) {
|
|
5736
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
5737
|
+
try {
|
|
5738
|
+
const key = getKey.call(this);
|
|
5739
|
+
let mutex = mutexes.get(key);
|
|
5740
|
+
if (!mutex) {
|
|
5741
|
+
mutex = new Mutex();
|
|
5742
|
+
mutexes.set(key, mutex);
|
|
5743
|
+
}
|
|
5744
|
+
const _2 = __addDisposableResource(env_1, await mutex.acquire(), true);
|
|
5745
|
+
return await target.call(this, ...args);
|
|
5746
|
+
} catch (e_1) {
|
|
5747
|
+
env_1.error = e_1;
|
|
5748
|
+
env_1.hasError = true;
|
|
5749
|
+
} finally {
|
|
5750
|
+
const result_1 = __disposeResources(env_1);
|
|
5751
|
+
if (result_1)
|
|
5752
|
+
await result_1;
|
|
5753
|
+
}
|
|
5754
|
+
};
|
|
5755
|
+
};
|
|
5756
|
+
}
|
|
5651
5757
|
|
|
5652
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/api/
|
|
5653
|
-
init_dirname();
|
|
5654
|
-
init_buffer2();
|
|
5655
|
-
var TargetType;
|
|
5656
|
-
(function(TargetType2) {
|
|
5657
|
-
TargetType2["PAGE"] = "page";
|
|
5658
|
-
TargetType2["BACKGROUND_PAGE"] = "background_page";
|
|
5659
|
-
TargetType2["SERVICE_WORKER"] = "service_worker";
|
|
5660
|
-
TargetType2["SHARED_WORKER"] = "shared_worker";
|
|
5661
|
-
TargetType2["BROWSER"] = "browser";
|
|
5662
|
-
TargetType2["WEBVIEW"] = "webview";
|
|
5663
|
-
TargetType2["OTHER"] = "other";
|
|
5664
|
-
TargetType2["TAB"] = "tab";
|
|
5665
|
-
})(TargetType || (TargetType = {}));
|
|
5666
|
-
var Target = class {
|
|
5667
|
-
/**
|
|
5668
|
-
* @internal
|
|
5669
|
-
*/
|
|
5670
|
-
constructor() {
|
|
5671
|
-
}
|
|
5672
|
-
/**
|
|
5673
|
-
* If the target is not of type `"service_worker"` or `"shared_worker"`, returns `null`.
|
|
5674
|
-
*/
|
|
5675
|
-
async worker() {
|
|
5676
|
-
return null;
|
|
5677
|
-
}
|
|
5678
|
-
/**
|
|
5679
|
-
* If the target is not of type `"page"`, `"webview"` or `"background_page"`,
|
|
5680
|
-
* returns `null`.
|
|
5681
|
-
*/
|
|
5682
|
-
async page() {
|
|
5683
|
-
return null;
|
|
5684
|
-
}
|
|
5685
|
-
};
|
|
5686
|
-
|
|
5687
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/CDPSession.js
|
|
5688
|
-
init_dirname();
|
|
5689
|
-
init_buffer2();
|
|
5690
|
-
|
|
5691
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/common/CallbackRegistry.js
|
|
5692
|
-
init_dirname();
|
|
5693
|
-
init_buffer2();
|
|
5694
|
-
|
|
5695
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/util/ErrorLike.js
|
|
5696
|
-
init_dirname();
|
|
5697
|
-
init_buffer2();
|
|
5698
|
-
function isErrorLike(obj) {
|
|
5699
|
-
return typeof obj === "object" && obj !== null && "name" in obj && "message" in obj;
|
|
5700
|
-
}
|
|
5701
|
-
function rewriteError(error, message, originalMessage) {
|
|
5702
|
-
error.message = message;
|
|
5703
|
-
error.originalMessage = originalMessage ?? error.originalMessage;
|
|
5704
|
-
return error;
|
|
5705
|
-
}
|
|
5706
|
-
function createProtocolErrorMessage(object) {
|
|
5707
|
-
let message = object.error.message;
|
|
5708
|
-
if (object.error && typeof object.error === "object" && "data" in object.error) {
|
|
5709
|
-
message += ` ${object.error.data}`;
|
|
5710
|
-
}
|
|
5711
|
-
return message;
|
|
5712
|
-
}
|
|
5713
|
-
|
|
5714
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/util/incremental-id-generator.js
|
|
5715
|
-
init_dirname();
|
|
5716
|
-
init_buffer2();
|
|
5717
|
-
function createIncrementalIdGenerator() {
|
|
5718
|
-
let id = 0;
|
|
5719
|
-
return () => {
|
|
5720
|
-
return ++id;
|
|
5721
|
-
};
|
|
5722
|
-
}
|
|
5723
|
-
|
|
5724
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/common/CallbackRegistry.js
|
|
5725
|
-
var CallbackRegistry = class {
|
|
5726
|
-
#callbacks = /* @__PURE__ */ new Map();
|
|
5727
|
-
#idGenerator = createIncrementalIdGenerator();
|
|
5728
|
-
create(label, timeout2, request) {
|
|
5729
|
-
const callback = new Callback(this.#idGenerator(), label, timeout2);
|
|
5730
|
-
this.#callbacks.set(callback.id, callback);
|
|
5731
|
-
try {
|
|
5732
|
-
request(callback.id);
|
|
5733
|
-
} catch (error) {
|
|
5734
|
-
callback.promise.catch(debugError).finally(() => {
|
|
5735
|
-
this.#callbacks.delete(callback.id);
|
|
5736
|
-
});
|
|
5737
|
-
callback.reject(error);
|
|
5738
|
-
throw error;
|
|
5739
|
-
}
|
|
5740
|
-
return callback.promise.finally(() => {
|
|
5741
|
-
this.#callbacks.delete(callback.id);
|
|
5742
|
-
});
|
|
5743
|
-
}
|
|
5744
|
-
reject(id, message, originalMessage) {
|
|
5745
|
-
const callback = this.#callbacks.get(id);
|
|
5746
|
-
if (!callback) {
|
|
5747
|
-
return;
|
|
5748
|
-
}
|
|
5749
|
-
this._reject(callback, message, originalMessage);
|
|
5750
|
-
}
|
|
5751
|
-
_reject(callback, errorMessage, originalMessage) {
|
|
5752
|
-
let error;
|
|
5753
|
-
let message;
|
|
5754
|
-
if (errorMessage instanceof ProtocolError) {
|
|
5755
|
-
error = errorMessage;
|
|
5756
|
-
error.cause = callback.error;
|
|
5757
|
-
message = errorMessage.message;
|
|
5758
|
-
} else {
|
|
5759
|
-
error = callback.error;
|
|
5760
|
-
message = errorMessage;
|
|
5761
|
-
}
|
|
5762
|
-
callback.reject(rewriteError(error, `Protocol error (${callback.label}): ${message}`, originalMessage));
|
|
5763
|
-
}
|
|
5764
|
-
resolve(id, value) {
|
|
5765
|
-
const callback = this.#callbacks.get(id);
|
|
5766
|
-
if (!callback) {
|
|
5767
|
-
return;
|
|
5768
|
-
}
|
|
5769
|
-
callback.resolve(value);
|
|
5770
|
-
}
|
|
5771
|
-
clear() {
|
|
5772
|
-
for (const callback of this.#callbacks.values()) {
|
|
5773
|
-
this._reject(callback, new TargetCloseError("Target closed"));
|
|
5774
|
-
}
|
|
5775
|
-
this.#callbacks.clear();
|
|
5776
|
-
}
|
|
5777
|
-
/**
|
|
5778
|
-
* @internal
|
|
5779
|
-
*/
|
|
5780
|
-
getPendingProtocolErrors() {
|
|
5781
|
-
const result = [];
|
|
5782
|
-
for (const callback of this.#callbacks.values()) {
|
|
5783
|
-
result.push(new Error(`${callback.label} timed out. Trace: ${callback.error.stack}`));
|
|
5784
|
-
}
|
|
5785
|
-
return result;
|
|
5786
|
-
}
|
|
5787
|
-
};
|
|
5788
|
-
var Callback = class {
|
|
5789
|
-
#id;
|
|
5790
|
-
#error = new ProtocolError();
|
|
5791
|
-
#deferred = Deferred.create();
|
|
5792
|
-
#timer;
|
|
5793
|
-
#label;
|
|
5794
|
-
constructor(id, label, timeout2) {
|
|
5795
|
-
this.#id = id;
|
|
5796
|
-
this.#label = label;
|
|
5797
|
-
if (timeout2) {
|
|
5798
|
-
this.#timer = setTimeout(() => {
|
|
5799
|
-
this.#deferred.reject(rewriteError(this.#error, `${label} timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.`));
|
|
5800
|
-
}, timeout2);
|
|
5801
|
-
}
|
|
5802
|
-
}
|
|
5803
|
-
resolve(value) {
|
|
5804
|
-
clearTimeout(this.#timer);
|
|
5805
|
-
this.#deferred.resolve(value);
|
|
5806
|
-
}
|
|
5807
|
-
reject(error) {
|
|
5808
|
-
clearTimeout(this.#timer);
|
|
5809
|
-
this.#deferred.reject(error);
|
|
5810
|
-
}
|
|
5811
|
-
get id() {
|
|
5812
|
-
return this.#id;
|
|
5813
|
-
}
|
|
5814
|
-
get promise() {
|
|
5815
|
-
return this.#deferred.valueOrThrow();
|
|
5816
|
-
}
|
|
5817
|
-
get error() {
|
|
5818
|
-
return this.#error;
|
|
5819
|
-
}
|
|
5820
|
-
get label() {
|
|
5821
|
-
return this.#label;
|
|
5822
|
-
}
|
|
5823
|
-
};
|
|
5824
|
-
|
|
5825
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/CDPSession.js
|
|
5826
|
-
var CdpCDPSession = class extends CDPSession {
|
|
5827
|
-
#sessionId;
|
|
5828
|
-
#targetType;
|
|
5829
|
-
#callbacks = new CallbackRegistry();
|
|
5830
|
-
#connection;
|
|
5831
|
-
#parentSessionId;
|
|
5832
|
-
#target;
|
|
5833
|
-
/**
|
|
5834
|
-
* @internal
|
|
5835
|
-
*/
|
|
5836
|
-
constructor(connection, targetType, sessionId, parentSessionId) {
|
|
5837
|
-
super();
|
|
5838
|
-
this.#connection = connection;
|
|
5839
|
-
this.#targetType = targetType;
|
|
5840
|
-
this.#sessionId = sessionId;
|
|
5841
|
-
this.#parentSessionId = parentSessionId;
|
|
5842
|
-
}
|
|
5843
|
-
/**
|
|
5844
|
-
* Sets the {@link CdpTarget} associated with the session instance.
|
|
5845
|
-
*
|
|
5846
|
-
* @internal
|
|
5847
|
-
*/
|
|
5848
|
-
_setTarget(target) {
|
|
5849
|
-
this.#target = target;
|
|
5850
|
-
}
|
|
5851
|
-
/**
|
|
5852
|
-
* Gets the {@link CdpTarget} associated with the session instance.
|
|
5853
|
-
*
|
|
5854
|
-
* @internal
|
|
5855
|
-
*/
|
|
5856
|
-
_target() {
|
|
5857
|
-
assert(this.#target, "Target must exist");
|
|
5858
|
-
return this.#target;
|
|
5859
|
-
}
|
|
5860
|
-
connection() {
|
|
5861
|
-
return this.#connection;
|
|
5862
|
-
}
|
|
5863
|
-
parentSession() {
|
|
5864
|
-
if (!this.#parentSessionId) {
|
|
5865
|
-
return this;
|
|
5866
|
-
}
|
|
5867
|
-
const parent = this.#connection?.session(this.#parentSessionId);
|
|
5868
|
-
return parent ?? void 0;
|
|
5869
|
-
}
|
|
5870
|
-
send(method, params, options) {
|
|
5871
|
-
if (!this.#connection) {
|
|
5872
|
-
return Promise.reject(new TargetCloseError(`Protocol error (${method}): Session closed. Most likely the ${this.#targetType} has been closed.`));
|
|
5873
|
-
}
|
|
5874
|
-
return this.#connection._rawSend(this.#callbacks, method, params, this.#sessionId, options);
|
|
5875
|
-
}
|
|
5876
|
-
/**
|
|
5877
|
-
* @internal
|
|
5878
|
-
*/
|
|
5879
|
-
_onMessage(object) {
|
|
5880
|
-
if (object.id) {
|
|
5881
|
-
if (object.error) {
|
|
5882
|
-
this.#callbacks.reject(object.id, createProtocolErrorMessage(object), object.error.message);
|
|
5883
|
-
} else {
|
|
5884
|
-
this.#callbacks.resolve(object.id, object.result);
|
|
5885
|
-
}
|
|
5886
|
-
} else {
|
|
5887
|
-
assert(!object.id);
|
|
5888
|
-
this.emit(object.method, object.params);
|
|
5889
|
-
}
|
|
5890
|
-
}
|
|
5891
|
-
/**
|
|
5892
|
-
* Detaches the cdpSession from the target. Once detached, the cdpSession object
|
|
5893
|
-
* won't emit any events and can't be used to send messages.
|
|
5894
|
-
*/
|
|
5895
|
-
async detach() {
|
|
5896
|
-
if (!this.#connection) {
|
|
5897
|
-
throw new Error(`Session already detached. Most likely the ${this.#targetType} has been closed.`);
|
|
5898
|
-
}
|
|
5899
|
-
await this.#connection.send("Target.detachFromTarget", {
|
|
5900
|
-
sessionId: this.#sessionId
|
|
5901
|
-
});
|
|
5902
|
-
}
|
|
5903
|
-
/**
|
|
5904
|
-
* @internal
|
|
5905
|
-
*/
|
|
5906
|
-
_onClosed() {
|
|
5907
|
-
this.#callbacks.clear();
|
|
5908
|
-
this.#connection = void 0;
|
|
5909
|
-
this.emit(CDPSessionEvent.Disconnected, void 0);
|
|
5910
|
-
}
|
|
5911
|
-
/**
|
|
5912
|
-
* Returns the session's id.
|
|
5913
|
-
*/
|
|
5914
|
-
id() {
|
|
5915
|
-
return this.#sessionId;
|
|
5916
|
-
}
|
|
5917
|
-
/**
|
|
5918
|
-
* @internal
|
|
5919
|
-
*/
|
|
5920
|
-
getPendingProtocolErrors() {
|
|
5921
|
-
return this.#callbacks.getPendingProtocolErrors();
|
|
5922
|
-
}
|
|
5923
|
-
};
|
|
5924
|
-
|
|
5925
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Page.js
|
|
5926
|
-
init_dirname();
|
|
5927
|
-
init_buffer2();
|
|
5928
|
-
|
|
5929
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/api/Page.js
|
|
5930
|
-
init_dirname();
|
|
5931
|
-
init_buffer2();
|
|
5932
|
-
|
|
5933
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.js
|
|
5934
|
-
init_dirname();
|
|
5935
|
-
init_buffer2();
|
|
5936
|
-
var DEFAULT_TIMEOUT = 3e4;
|
|
5937
|
-
var TimeoutSettings = class {
|
|
5938
|
-
#defaultTimeout;
|
|
5939
|
-
#defaultNavigationTimeout;
|
|
5940
|
-
constructor() {
|
|
5941
|
-
this.#defaultTimeout = null;
|
|
5942
|
-
this.#defaultNavigationTimeout = null;
|
|
5943
|
-
}
|
|
5944
|
-
setDefaultTimeout(timeout2) {
|
|
5945
|
-
this.#defaultTimeout = timeout2;
|
|
5946
|
-
}
|
|
5947
|
-
setDefaultNavigationTimeout(timeout2) {
|
|
5948
|
-
this.#defaultNavigationTimeout = timeout2;
|
|
5949
|
-
}
|
|
5950
|
-
navigationTimeout() {
|
|
5951
|
-
if (this.#defaultNavigationTimeout !== null) {
|
|
5952
|
-
return this.#defaultNavigationTimeout;
|
|
5953
|
-
}
|
|
5954
|
-
if (this.#defaultTimeout !== null) {
|
|
5955
|
-
return this.#defaultTimeout;
|
|
5956
|
-
}
|
|
5957
|
-
return DEFAULT_TIMEOUT;
|
|
5958
|
-
}
|
|
5959
|
-
timeout() {
|
|
5960
|
-
if (this.#defaultTimeout !== null) {
|
|
5961
|
-
return this.#defaultTimeout;
|
|
5962
|
-
}
|
|
5963
|
-
return DEFAULT_TIMEOUT;
|
|
5964
|
-
}
|
|
5965
|
-
};
|
|
5966
|
-
|
|
5967
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/util/decorators.js
|
|
5758
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/api/locators/locators.js
|
|
5968
5759
|
init_dirname();
|
|
5969
5760
|
init_buffer2();
|
|
5970
5761
|
var __addDisposableResource2 = function(env, value, async2) {
|
|
@@ -6025,167 +5816,6 @@
|
|
|
6025
5816
|
var e = new Error(message);
|
|
6026
5817
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
6027
5818
|
});
|
|
6028
|
-
var instances = /* @__PURE__ */ new WeakSet();
|
|
6029
|
-
function moveable(Class, _) {
|
|
6030
|
-
let hasDispose = false;
|
|
6031
|
-
if (Class.prototype[disposeSymbol]) {
|
|
6032
|
-
const dispose = Class.prototype[disposeSymbol];
|
|
6033
|
-
Class.prototype[disposeSymbol] = function() {
|
|
6034
|
-
if (instances.has(this)) {
|
|
6035
|
-
instances.delete(this);
|
|
6036
|
-
return;
|
|
6037
|
-
}
|
|
6038
|
-
return dispose.call(this);
|
|
6039
|
-
};
|
|
6040
|
-
hasDispose = true;
|
|
6041
|
-
}
|
|
6042
|
-
if (Class.prototype[asyncDisposeSymbol]) {
|
|
6043
|
-
const asyncDispose = Class.prototype[asyncDisposeSymbol];
|
|
6044
|
-
Class.prototype[asyncDisposeSymbol] = function() {
|
|
6045
|
-
if (instances.has(this)) {
|
|
6046
|
-
instances.delete(this);
|
|
6047
|
-
return;
|
|
6048
|
-
}
|
|
6049
|
-
return asyncDispose.call(this);
|
|
6050
|
-
};
|
|
6051
|
-
hasDispose = true;
|
|
6052
|
-
}
|
|
6053
|
-
if (hasDispose) {
|
|
6054
|
-
Class.prototype.move = function() {
|
|
6055
|
-
instances.add(this);
|
|
6056
|
-
return this;
|
|
6057
|
-
};
|
|
6058
|
-
}
|
|
6059
|
-
return Class;
|
|
6060
|
-
}
|
|
6061
|
-
function throwIfDisposed(message = (value) => {
|
|
6062
|
-
return `Attempted to use disposed ${value.constructor.name}.`;
|
|
6063
|
-
}) {
|
|
6064
|
-
return (target, _) => {
|
|
6065
|
-
return function(...args) {
|
|
6066
|
-
if (this.disposed) {
|
|
6067
|
-
throw new Error(message(this));
|
|
6068
|
-
}
|
|
6069
|
-
return target.call(this, ...args);
|
|
6070
|
-
};
|
|
6071
|
-
};
|
|
6072
|
-
}
|
|
6073
|
-
function invokeAtMostOnceForArguments(target, _) {
|
|
6074
|
-
const cache = /* @__PURE__ */ new WeakMap();
|
|
6075
|
-
let cacheDepth = -1;
|
|
6076
|
-
return function(...args) {
|
|
6077
|
-
if (cacheDepth === -1) {
|
|
6078
|
-
cacheDepth = args.length;
|
|
6079
|
-
}
|
|
6080
|
-
if (cacheDepth !== args.length) {
|
|
6081
|
-
throw new Error("Memoized method was called with the wrong number of arguments");
|
|
6082
|
-
}
|
|
6083
|
-
let freshArguments = false;
|
|
6084
|
-
let cacheIterator = cache;
|
|
6085
|
-
for (const arg of args) {
|
|
6086
|
-
if (cacheIterator.has(arg)) {
|
|
6087
|
-
cacheIterator = cacheIterator.get(arg);
|
|
6088
|
-
} else {
|
|
6089
|
-
freshArguments = true;
|
|
6090
|
-
cacheIterator.set(arg, /* @__PURE__ */ new WeakMap());
|
|
6091
|
-
cacheIterator = cacheIterator.get(arg);
|
|
6092
|
-
}
|
|
6093
|
-
}
|
|
6094
|
-
if (!freshArguments) {
|
|
6095
|
-
return;
|
|
6096
|
-
}
|
|
6097
|
-
return target.call(this, ...args);
|
|
6098
|
-
};
|
|
6099
|
-
}
|
|
6100
|
-
function guarded(getKey = function() {
|
|
6101
|
-
return this;
|
|
6102
|
-
}) {
|
|
6103
|
-
return (target, _) => {
|
|
6104
|
-
const mutexes = /* @__PURE__ */ new WeakMap();
|
|
6105
|
-
return async function(...args) {
|
|
6106
|
-
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
6107
|
-
try {
|
|
6108
|
-
const key = getKey.call(this);
|
|
6109
|
-
let mutex = mutexes.get(key);
|
|
6110
|
-
if (!mutex) {
|
|
6111
|
-
mutex = new Mutex();
|
|
6112
|
-
mutexes.set(key, mutex);
|
|
6113
|
-
}
|
|
6114
|
-
const _2 = __addDisposableResource2(env_1, await mutex.acquire(), true);
|
|
6115
|
-
return await target.call(this, ...args);
|
|
6116
|
-
} catch (e_1) {
|
|
6117
|
-
env_1.error = e_1;
|
|
6118
|
-
env_1.hasError = true;
|
|
6119
|
-
} finally {
|
|
6120
|
-
const result_1 = __disposeResources2(env_1);
|
|
6121
|
-
if (result_1)
|
|
6122
|
-
await result_1;
|
|
6123
|
-
}
|
|
6124
|
-
};
|
|
6125
|
-
};
|
|
6126
|
-
}
|
|
6127
|
-
|
|
6128
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/api/locators/locators.js
|
|
6129
|
-
init_dirname();
|
|
6130
|
-
init_buffer2();
|
|
6131
|
-
var __addDisposableResource3 = function(env, value, async2) {
|
|
6132
|
-
if (value !== null && value !== void 0) {
|
|
6133
|
-
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
6134
|
-
var dispose, inner;
|
|
6135
|
-
if (async2) {
|
|
6136
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
6137
|
-
dispose = value[Symbol.asyncDispose];
|
|
6138
|
-
}
|
|
6139
|
-
if (dispose === void 0) {
|
|
6140
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
6141
|
-
dispose = value[Symbol.dispose];
|
|
6142
|
-
if (async2) inner = dispose;
|
|
6143
|
-
}
|
|
6144
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
6145
|
-
if (inner) dispose = function() {
|
|
6146
|
-
try {
|
|
6147
|
-
inner.call(this);
|
|
6148
|
-
} catch (e) {
|
|
6149
|
-
return Promise.reject(e);
|
|
6150
|
-
}
|
|
6151
|
-
};
|
|
6152
|
-
env.stack.push({ value, dispose, async: async2 });
|
|
6153
|
-
} else if (async2) {
|
|
6154
|
-
env.stack.push({ async: true });
|
|
6155
|
-
}
|
|
6156
|
-
return value;
|
|
6157
|
-
};
|
|
6158
|
-
var __disposeResources3 = /* @__PURE__ */ function(SuppressedError2) {
|
|
6159
|
-
return function(env) {
|
|
6160
|
-
function fail(e) {
|
|
6161
|
-
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
6162
|
-
env.hasError = true;
|
|
6163
|
-
}
|
|
6164
|
-
var r, s = 0;
|
|
6165
|
-
function next() {
|
|
6166
|
-
while (r = env.stack.pop()) {
|
|
6167
|
-
try {
|
|
6168
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
6169
|
-
if (r.dispose) {
|
|
6170
|
-
var result = r.dispose.call(r.value);
|
|
6171
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
|
|
6172
|
-
fail(e);
|
|
6173
|
-
return next();
|
|
6174
|
-
});
|
|
6175
|
-
} else s |= 1;
|
|
6176
|
-
} catch (e) {
|
|
6177
|
-
fail(e);
|
|
6178
|
-
}
|
|
6179
|
-
}
|
|
6180
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
6181
|
-
if (env.hasError) throw env.error;
|
|
6182
|
-
}
|
|
6183
|
-
return next();
|
|
6184
|
-
};
|
|
6185
|
-
}(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
6186
|
-
var e = new Error(message);
|
|
6187
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
6188
|
-
});
|
|
6189
5819
|
var LocatorEvent;
|
|
6190
5820
|
(function(LocatorEvent2) {
|
|
6191
5821
|
LocatorEvent2["Action"] = "action";
|
|
@@ -6544,13 +6174,13 @@
|
|
|
6544
6174
|
async wait(options) {
|
|
6545
6175
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
6546
6176
|
try {
|
|
6547
|
-
const handle =
|
|
6177
|
+
const handle = __addDisposableResource2(env_1, await this.waitHandle(options), false);
|
|
6548
6178
|
return await handle.jsonValue();
|
|
6549
6179
|
} catch (e_1) {
|
|
6550
6180
|
env_1.error = e_1;
|
|
6551
6181
|
env_1.hasError = true;
|
|
6552
6182
|
} finally {
|
|
6553
|
-
|
|
6183
|
+
__disposeResources2(env_1);
|
|
6554
6184
|
}
|
|
6555
6185
|
}
|
|
6556
6186
|
/**
|
|
@@ -6837,7 +6467,7 @@
|
|
|
6837
6467
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
6838
6468
|
done = true;
|
|
6839
6469
|
};
|
|
6840
|
-
var
|
|
6470
|
+
var __addDisposableResource3 = function(env, value, async2) {
|
|
6841
6471
|
if (value !== null && value !== void 0) {
|
|
6842
6472
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
6843
6473
|
var dispose, inner;
|
|
@@ -6864,7 +6494,7 @@
|
|
|
6864
6494
|
}
|
|
6865
6495
|
return value;
|
|
6866
6496
|
};
|
|
6867
|
-
var
|
|
6497
|
+
var __disposeResources3 = /* @__PURE__ */ function(SuppressedError2) {
|
|
6868
6498
|
return function(env) {
|
|
6869
6499
|
function fail(e) {
|
|
6870
6500
|
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
@@ -7736,7 +7366,7 @@
|
|
|
7736
7366
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
7737
7367
|
try {
|
|
7738
7368
|
const viewport = this.viewport();
|
|
7739
|
-
const stack =
|
|
7369
|
+
const stack = __addDisposableResource3(env_1, new DisposableStack(), false);
|
|
7740
7370
|
if (viewport && viewport.deviceScaleFactor !== 0) {
|
|
7741
7371
|
await this.setViewport({ ...viewport, deviceScaleFactor: 0 });
|
|
7742
7372
|
stack.defer(() => {
|
|
@@ -7754,14 +7384,13 @@
|
|
|
7754
7384
|
env_1.error = e_1;
|
|
7755
7385
|
env_1.hasError = true;
|
|
7756
7386
|
} finally {
|
|
7757
|
-
|
|
7387
|
+
__disposeResources3(env_1);
|
|
7758
7388
|
}
|
|
7759
7389
|
}
|
|
7760
7390
|
async screenshot(userOptions = {}) {
|
|
7761
7391
|
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
7762
7392
|
try {
|
|
7763
|
-
const _guard =
|
|
7764
|
-
await this.bringToFront();
|
|
7393
|
+
const _guard = __addDisposableResource3(env_2, await this.browserContext().startScreenshot(), false);
|
|
7765
7394
|
const options = {
|
|
7766
7395
|
...userOptions,
|
|
7767
7396
|
clip: userOptions.clip ? {
|
|
@@ -7801,7 +7430,7 @@
|
|
|
7801
7430
|
}
|
|
7802
7431
|
}
|
|
7803
7432
|
setDefaultScreenshotOptions(options);
|
|
7804
|
-
const stack =
|
|
7433
|
+
const stack = __addDisposableResource3(env_2, new AsyncDisposableStack(), true);
|
|
7805
7434
|
if (options.clip) {
|
|
7806
7435
|
if (options.fullPage) {
|
|
7807
7436
|
throw new Error("'clip' and 'fullPage' are mutually exclusive");
|
|
@@ -7841,7 +7470,7 @@
|
|
|
7841
7470
|
env_2.error = e_2;
|
|
7842
7471
|
env_2.hasError = true;
|
|
7843
7472
|
} finally {
|
|
7844
|
-
const result_1 =
|
|
7473
|
+
const result_1 = __disposeResources3(env_2);
|
|
7845
7474
|
if (result_1)
|
|
7846
7475
|
await result_1;
|
|
7847
7476
|
}
|
|
@@ -8334,19 +7963,38 @@
|
|
|
8334
7963
|
element.dispatchEvent(new Event("cancel", { bubbles: true }));
|
|
8335
7964
|
});
|
|
8336
7965
|
}
|
|
8337
|
-
};
|
|
8338
|
-
|
|
8339
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManagerEvents.js
|
|
8340
|
-
init_dirname();
|
|
8341
|
-
init_buffer2();
|
|
8342
|
-
var NetworkManagerEvent;
|
|
8343
|
-
(function(NetworkManagerEvent2) {
|
|
8344
|
-
NetworkManagerEvent2.Request = Symbol("NetworkManager.Request");
|
|
8345
|
-
NetworkManagerEvent2.RequestServedFromCache = Symbol("NetworkManager.RequestServedFromCache");
|
|
8346
|
-
NetworkManagerEvent2.Response = Symbol("NetworkManager.Response");
|
|
8347
|
-
NetworkManagerEvent2.RequestFailed = Symbol("NetworkManager.RequestFailed");
|
|
8348
|
-
NetworkManagerEvent2.RequestFinished = Symbol("NetworkManager.RequestFinished");
|
|
8349
|
-
})(NetworkManagerEvent || (NetworkManagerEvent = {}));
|
|
7966
|
+
};
|
|
7967
|
+
|
|
7968
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManagerEvents.js
|
|
7969
|
+
init_dirname();
|
|
7970
|
+
init_buffer2();
|
|
7971
|
+
var NetworkManagerEvent;
|
|
7972
|
+
(function(NetworkManagerEvent2) {
|
|
7973
|
+
NetworkManagerEvent2.Request = Symbol("NetworkManager.Request");
|
|
7974
|
+
NetworkManagerEvent2.RequestServedFromCache = Symbol("NetworkManager.RequestServedFromCache");
|
|
7975
|
+
NetworkManagerEvent2.Response = Symbol("NetworkManager.Response");
|
|
7976
|
+
NetworkManagerEvent2.RequestFailed = Symbol("NetworkManager.RequestFailed");
|
|
7977
|
+
NetworkManagerEvent2.RequestFinished = Symbol("NetworkManager.RequestFinished");
|
|
7978
|
+
})(NetworkManagerEvent || (NetworkManagerEvent = {}));
|
|
7979
|
+
|
|
7980
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/util/ErrorLike.js
|
|
7981
|
+
init_dirname();
|
|
7982
|
+
init_buffer2();
|
|
7983
|
+
function isErrorLike(obj) {
|
|
7984
|
+
return typeof obj === "object" && obj !== null && "name" in obj && "message" in obj;
|
|
7985
|
+
}
|
|
7986
|
+
function rewriteError(error, message, originalMessage) {
|
|
7987
|
+
error.message = message;
|
|
7988
|
+
error.originalMessage = originalMessage ?? error.originalMessage;
|
|
7989
|
+
return error;
|
|
7990
|
+
}
|
|
7991
|
+
function createProtocolErrorMessage(object) {
|
|
7992
|
+
let message = object.error.message;
|
|
7993
|
+
if (object.error && typeof object.error === "object" && "data" in object.error) {
|
|
7994
|
+
message += ` ${object.error.data}`;
|
|
7995
|
+
}
|
|
7996
|
+
return message;
|
|
7997
|
+
}
|
|
8350
7998
|
|
|
8351
7999
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Binding.js
|
|
8352
8000
|
init_dirname();
|
|
@@ -8394,7 +8042,7 @@
|
|
|
8394
8042
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
8395
8043
|
done = true;
|
|
8396
8044
|
};
|
|
8397
|
-
var
|
|
8045
|
+
var __addDisposableResource4 = function(env, value, async2) {
|
|
8398
8046
|
if (value !== null && value !== void 0) {
|
|
8399
8047
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
8400
8048
|
var dispose, inner;
|
|
@@ -8421,7 +8069,7 @@
|
|
|
8421
8069
|
}
|
|
8422
8070
|
return value;
|
|
8423
8071
|
};
|
|
8424
|
-
var
|
|
8072
|
+
var __disposeResources4 = /* @__PURE__ */ function(SuppressedError2) {
|
|
8425
8073
|
return function(env) {
|
|
8426
8074
|
function fail(e) {
|
|
8427
8075
|
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
@@ -8538,7 +8186,7 @@
|
|
|
8538
8186
|
for (const [key, value] of Object.entries(propertyNames)) {
|
|
8539
8187
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
8540
8188
|
try {
|
|
8541
|
-
const handle =
|
|
8189
|
+
const handle = __addDisposableResource4(env_1, results[key], false);
|
|
8542
8190
|
if (handle) {
|
|
8543
8191
|
map2.set(value, handle.move());
|
|
8544
8192
|
}
|
|
@@ -8546,7 +8194,7 @@
|
|
|
8546
8194
|
env_1.error = e_1;
|
|
8547
8195
|
env_1.hasError = true;
|
|
8548
8196
|
} finally {
|
|
8549
|
-
|
|
8197
|
+
__disposeResources4(env_1);
|
|
8550
8198
|
}
|
|
8551
8199
|
}
|
|
8552
8200
|
return map2;
|
|
@@ -8564,7 +8212,7 @@
|
|
|
8564
8212
|
})();
|
|
8565
8213
|
|
|
8566
8214
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Binding.js
|
|
8567
|
-
var
|
|
8215
|
+
var __addDisposableResource5 = function(env, value, async2) {
|
|
8568
8216
|
if (value !== null && value !== void 0) {
|
|
8569
8217
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
8570
8218
|
var dispose, inner;
|
|
@@ -8589,119 +8237,351 @@
|
|
|
8589
8237
|
} else if (async2) {
|
|
8590
8238
|
env.stack.push({ async: true });
|
|
8591
8239
|
}
|
|
8592
|
-
return value;
|
|
8240
|
+
return value;
|
|
8241
|
+
};
|
|
8242
|
+
var __disposeResources5 = /* @__PURE__ */ function(SuppressedError2) {
|
|
8243
|
+
return function(env) {
|
|
8244
|
+
function fail(e) {
|
|
8245
|
+
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
8246
|
+
env.hasError = true;
|
|
8247
|
+
}
|
|
8248
|
+
var r, s = 0;
|
|
8249
|
+
function next() {
|
|
8250
|
+
while (r = env.stack.pop()) {
|
|
8251
|
+
try {
|
|
8252
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
8253
|
+
if (r.dispose) {
|
|
8254
|
+
var result = r.dispose.call(r.value);
|
|
8255
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
|
|
8256
|
+
fail(e);
|
|
8257
|
+
return next();
|
|
8258
|
+
});
|
|
8259
|
+
} else s |= 1;
|
|
8260
|
+
} catch (e) {
|
|
8261
|
+
fail(e);
|
|
8262
|
+
}
|
|
8263
|
+
}
|
|
8264
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
8265
|
+
if (env.hasError) throw env.error;
|
|
8266
|
+
}
|
|
8267
|
+
return next();
|
|
8268
|
+
};
|
|
8269
|
+
}(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
8270
|
+
var e = new Error(message);
|
|
8271
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
8272
|
+
});
|
|
8273
|
+
var Binding = class {
|
|
8274
|
+
#name;
|
|
8275
|
+
#fn;
|
|
8276
|
+
#initSource;
|
|
8277
|
+
constructor(name, fn, initSource) {
|
|
8278
|
+
this.#name = name;
|
|
8279
|
+
this.#fn = fn;
|
|
8280
|
+
this.#initSource = initSource;
|
|
8281
|
+
}
|
|
8282
|
+
get name() {
|
|
8283
|
+
return this.#name;
|
|
8284
|
+
}
|
|
8285
|
+
get initSource() {
|
|
8286
|
+
return this.#initSource;
|
|
8287
|
+
}
|
|
8288
|
+
/**
|
|
8289
|
+
* @param context - Context to run the binding in; the context should have
|
|
8290
|
+
* the binding added to it beforehand.
|
|
8291
|
+
* @param id - ID of the call. This should come from the CDP
|
|
8292
|
+
* `onBindingCalled` response.
|
|
8293
|
+
* @param args - Plain arguments from CDP.
|
|
8294
|
+
*/
|
|
8295
|
+
async run(context2, id, args, isTrivial) {
|
|
8296
|
+
const stack = new DisposableStack();
|
|
8297
|
+
try {
|
|
8298
|
+
if (!isTrivial) {
|
|
8299
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
8300
|
+
try {
|
|
8301
|
+
const handles = __addDisposableResource5(env_1, await context2.evaluateHandle((name, seq) => {
|
|
8302
|
+
return globalThis[name].args.get(seq);
|
|
8303
|
+
}, this.#name, id), false);
|
|
8304
|
+
const properties = await handles.getProperties();
|
|
8305
|
+
for (const [index, handle] of properties) {
|
|
8306
|
+
if (index in args) {
|
|
8307
|
+
switch (handle.remoteObject().subtype) {
|
|
8308
|
+
case "node":
|
|
8309
|
+
args[+index] = handle;
|
|
8310
|
+
break;
|
|
8311
|
+
default:
|
|
8312
|
+
stack.use(handle);
|
|
8313
|
+
}
|
|
8314
|
+
} else {
|
|
8315
|
+
stack.use(handle);
|
|
8316
|
+
}
|
|
8317
|
+
}
|
|
8318
|
+
} catch (e_1) {
|
|
8319
|
+
env_1.error = e_1;
|
|
8320
|
+
env_1.hasError = true;
|
|
8321
|
+
} finally {
|
|
8322
|
+
__disposeResources5(env_1);
|
|
8323
|
+
}
|
|
8324
|
+
}
|
|
8325
|
+
await context2.evaluate((name, seq, result) => {
|
|
8326
|
+
const callbacks = globalThis[name].callbacks;
|
|
8327
|
+
callbacks.get(seq).resolve(result);
|
|
8328
|
+
callbacks.delete(seq);
|
|
8329
|
+
}, this.#name, id, await this.#fn(...args));
|
|
8330
|
+
for (const arg of args) {
|
|
8331
|
+
if (arg instanceof JSHandle) {
|
|
8332
|
+
stack.use(arg);
|
|
8333
|
+
}
|
|
8334
|
+
}
|
|
8335
|
+
} catch (error) {
|
|
8336
|
+
if (isErrorLike(error)) {
|
|
8337
|
+
await context2.evaluate((name, seq, message, stack2) => {
|
|
8338
|
+
const error2 = new Error(message);
|
|
8339
|
+
error2.stack = stack2;
|
|
8340
|
+
const callbacks = globalThis[name].callbacks;
|
|
8341
|
+
callbacks.get(seq).reject(error2);
|
|
8342
|
+
callbacks.delete(seq);
|
|
8343
|
+
}, this.#name, id, error.message, error.stack).catch(debugError);
|
|
8344
|
+
} else {
|
|
8345
|
+
await context2.evaluate((name, seq, error2) => {
|
|
8346
|
+
const callbacks = globalThis[name].callbacks;
|
|
8347
|
+
callbacks.get(seq).reject(error2);
|
|
8348
|
+
callbacks.delete(seq);
|
|
8349
|
+
}, this.#name, id, error).catch(debugError);
|
|
8350
|
+
}
|
|
8351
|
+
}
|
|
8352
|
+
}
|
|
8353
|
+
};
|
|
8354
|
+
|
|
8355
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/CDPSession.js
|
|
8356
|
+
init_dirname();
|
|
8357
|
+
init_buffer2();
|
|
8358
|
+
|
|
8359
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/common/CallbackRegistry.js
|
|
8360
|
+
init_dirname();
|
|
8361
|
+
init_buffer2();
|
|
8362
|
+
|
|
8363
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/util/incremental-id-generator.js
|
|
8364
|
+
init_dirname();
|
|
8365
|
+
init_buffer2();
|
|
8366
|
+
function createIncrementalIdGenerator() {
|
|
8367
|
+
let id = 0;
|
|
8368
|
+
return () => {
|
|
8369
|
+
return ++id;
|
|
8370
|
+
};
|
|
8371
|
+
}
|
|
8372
|
+
|
|
8373
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/common/CallbackRegistry.js
|
|
8374
|
+
var CallbackRegistry = class {
|
|
8375
|
+
#callbacks = /* @__PURE__ */ new Map();
|
|
8376
|
+
#idGenerator = createIncrementalIdGenerator();
|
|
8377
|
+
create(label, timeout2, request) {
|
|
8378
|
+
const callback = new Callback(this.#idGenerator(), label, timeout2);
|
|
8379
|
+
this.#callbacks.set(callback.id, callback);
|
|
8380
|
+
try {
|
|
8381
|
+
request(callback.id);
|
|
8382
|
+
} catch (error) {
|
|
8383
|
+
callback.promise.catch(debugError).finally(() => {
|
|
8384
|
+
this.#callbacks.delete(callback.id);
|
|
8385
|
+
});
|
|
8386
|
+
callback.reject(error);
|
|
8387
|
+
throw error;
|
|
8388
|
+
}
|
|
8389
|
+
return callback.promise.finally(() => {
|
|
8390
|
+
this.#callbacks.delete(callback.id);
|
|
8391
|
+
});
|
|
8392
|
+
}
|
|
8393
|
+
reject(id, message, originalMessage) {
|
|
8394
|
+
const callback = this.#callbacks.get(id);
|
|
8395
|
+
if (!callback) {
|
|
8396
|
+
return;
|
|
8397
|
+
}
|
|
8398
|
+
this._reject(callback, message, originalMessage);
|
|
8399
|
+
}
|
|
8400
|
+
rejectRaw(id, error) {
|
|
8401
|
+
const callback = this.#callbacks.get(id);
|
|
8402
|
+
if (!callback) {
|
|
8403
|
+
return;
|
|
8404
|
+
}
|
|
8405
|
+
callback.reject(error);
|
|
8406
|
+
}
|
|
8407
|
+
_reject(callback, errorMessage, originalMessage) {
|
|
8408
|
+
let error;
|
|
8409
|
+
let message;
|
|
8410
|
+
if (errorMessage instanceof ProtocolError) {
|
|
8411
|
+
error = errorMessage;
|
|
8412
|
+
error.cause = callback.error;
|
|
8413
|
+
message = errorMessage.message;
|
|
8414
|
+
} else {
|
|
8415
|
+
error = callback.error;
|
|
8416
|
+
message = errorMessage;
|
|
8417
|
+
}
|
|
8418
|
+
callback.reject(rewriteError(error, `Protocol error (${callback.label}): ${message}`, originalMessage));
|
|
8419
|
+
}
|
|
8420
|
+
resolve(id, value) {
|
|
8421
|
+
const callback = this.#callbacks.get(id);
|
|
8422
|
+
if (!callback) {
|
|
8423
|
+
return;
|
|
8424
|
+
}
|
|
8425
|
+
callback.resolve(value);
|
|
8426
|
+
}
|
|
8427
|
+
clear() {
|
|
8428
|
+
for (const callback of this.#callbacks.values()) {
|
|
8429
|
+
this._reject(callback, new TargetCloseError("Target closed"));
|
|
8430
|
+
}
|
|
8431
|
+
this.#callbacks.clear();
|
|
8432
|
+
}
|
|
8433
|
+
/**
|
|
8434
|
+
* @internal
|
|
8435
|
+
*/
|
|
8436
|
+
getPendingProtocolErrors() {
|
|
8437
|
+
const result = [];
|
|
8438
|
+
for (const callback of this.#callbacks.values()) {
|
|
8439
|
+
result.push(new Error(`${callback.label} timed out. Trace: ${callback.error.stack}`));
|
|
8440
|
+
}
|
|
8441
|
+
return result;
|
|
8442
|
+
}
|
|
8443
|
+
};
|
|
8444
|
+
var Callback = class {
|
|
8445
|
+
#id;
|
|
8446
|
+
#error = new ProtocolError();
|
|
8447
|
+
#deferred = Deferred.create();
|
|
8448
|
+
#timer;
|
|
8449
|
+
#label;
|
|
8450
|
+
constructor(id, label, timeout2) {
|
|
8451
|
+
this.#id = id;
|
|
8452
|
+
this.#label = label;
|
|
8453
|
+
if (timeout2) {
|
|
8454
|
+
this.#timer = setTimeout(() => {
|
|
8455
|
+
this.#deferred.reject(rewriteError(this.#error, `${label} timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.`));
|
|
8456
|
+
}, timeout2);
|
|
8457
|
+
}
|
|
8458
|
+
}
|
|
8459
|
+
resolve(value) {
|
|
8460
|
+
clearTimeout(this.#timer);
|
|
8461
|
+
this.#deferred.resolve(value);
|
|
8462
|
+
}
|
|
8463
|
+
reject(error) {
|
|
8464
|
+
clearTimeout(this.#timer);
|
|
8465
|
+
this.#deferred.reject(error);
|
|
8466
|
+
}
|
|
8467
|
+
get id() {
|
|
8468
|
+
return this.#id;
|
|
8469
|
+
}
|
|
8470
|
+
get promise() {
|
|
8471
|
+
return this.#deferred.valueOrThrow();
|
|
8472
|
+
}
|
|
8473
|
+
get error() {
|
|
8474
|
+
return this.#error;
|
|
8475
|
+
}
|
|
8476
|
+
get label() {
|
|
8477
|
+
return this.#label;
|
|
8478
|
+
}
|
|
8593
8479
|
};
|
|
8594
|
-
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
8598
|
-
|
|
8599
|
-
|
|
8600
|
-
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
}
|
|
8615
|
-
}
|
|
8616
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
8617
|
-
if (env.hasError) throw env.error;
|
|
8618
|
-
}
|
|
8619
|
-
return next();
|
|
8620
|
-
};
|
|
8621
|
-
}(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
8622
|
-
var e = new Error(message);
|
|
8623
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
8624
|
-
});
|
|
8625
|
-
var Binding = class {
|
|
8626
|
-
#name;
|
|
8627
|
-
#fn;
|
|
8628
|
-
#initSource;
|
|
8629
|
-
constructor(name, fn, initSource) {
|
|
8630
|
-
this.#name = name;
|
|
8631
|
-
this.#fn = fn;
|
|
8632
|
-
this.#initSource = initSource;
|
|
8480
|
+
|
|
8481
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/CDPSession.js
|
|
8482
|
+
var CdpCDPSession = class extends CDPSession {
|
|
8483
|
+
#sessionId;
|
|
8484
|
+
#targetType;
|
|
8485
|
+
#callbacks = new CallbackRegistry();
|
|
8486
|
+
#connection;
|
|
8487
|
+
#parentSessionId;
|
|
8488
|
+
#target;
|
|
8489
|
+
#rawErrors = false;
|
|
8490
|
+
/**
|
|
8491
|
+
* @internal
|
|
8492
|
+
*/
|
|
8493
|
+
constructor(connection, targetType, sessionId, parentSessionId, rawErrors) {
|
|
8494
|
+
super();
|
|
8495
|
+
this.#connection = connection;
|
|
8496
|
+
this.#targetType = targetType;
|
|
8497
|
+
this.#sessionId = sessionId;
|
|
8498
|
+
this.#parentSessionId = parentSessionId;
|
|
8499
|
+
this.#rawErrors = rawErrors;
|
|
8633
8500
|
}
|
|
8634
|
-
|
|
8635
|
-
|
|
8501
|
+
/**
|
|
8502
|
+
* Sets the {@link CdpTarget} associated with the session instance.
|
|
8503
|
+
*
|
|
8504
|
+
* @internal
|
|
8505
|
+
*/
|
|
8506
|
+
_setTarget(target) {
|
|
8507
|
+
this.#target = target;
|
|
8636
8508
|
}
|
|
8637
|
-
|
|
8638
|
-
|
|
8509
|
+
/**
|
|
8510
|
+
* Gets the {@link CdpTarget} associated with the session instance.
|
|
8511
|
+
*
|
|
8512
|
+
* @internal
|
|
8513
|
+
*/
|
|
8514
|
+
_target() {
|
|
8515
|
+
assert(this.#target, "Target must exist");
|
|
8516
|
+
return this.#target;
|
|
8517
|
+
}
|
|
8518
|
+
connection() {
|
|
8519
|
+
return this.#connection;
|
|
8520
|
+
}
|
|
8521
|
+
parentSession() {
|
|
8522
|
+
if (!this.#parentSessionId) {
|
|
8523
|
+
return this;
|
|
8524
|
+
}
|
|
8525
|
+
const parent = this.#connection?.session(this.#parentSessionId);
|
|
8526
|
+
return parent ?? void 0;
|
|
8527
|
+
}
|
|
8528
|
+
send(method, params, options) {
|
|
8529
|
+
if (!this.#connection) {
|
|
8530
|
+
return Promise.reject(new TargetCloseError(`Protocol error (${method}): Session closed. Most likely the ${this.#targetType} has been closed.`));
|
|
8531
|
+
}
|
|
8532
|
+
return this.#connection._rawSend(this.#callbacks, method, params, this.#sessionId, options);
|
|
8639
8533
|
}
|
|
8640
8534
|
/**
|
|
8641
|
-
* @
|
|
8642
|
-
* the binding added to it beforehand.
|
|
8643
|
-
* @param id - ID of the call. This should come from the CDP
|
|
8644
|
-
* `onBindingCalled` response.
|
|
8645
|
-
* @param args - Plain arguments from CDP.
|
|
8535
|
+
* @internal
|
|
8646
8536
|
*/
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
return globalThis[name].args.get(seq);
|
|
8655
|
-
}, this.#name, id), false);
|
|
8656
|
-
const properties = await handles.getProperties();
|
|
8657
|
-
for (const [index, handle] of properties) {
|
|
8658
|
-
if (index in args) {
|
|
8659
|
-
switch (handle.remoteObject().subtype) {
|
|
8660
|
-
case "node":
|
|
8661
|
-
args[+index] = handle;
|
|
8662
|
-
break;
|
|
8663
|
-
default:
|
|
8664
|
-
stack.use(handle);
|
|
8665
|
-
}
|
|
8666
|
-
} else {
|
|
8667
|
-
stack.use(handle);
|
|
8668
|
-
}
|
|
8669
|
-
}
|
|
8670
|
-
} catch (e_1) {
|
|
8671
|
-
env_1.error = e_1;
|
|
8672
|
-
env_1.hasError = true;
|
|
8673
|
-
} finally {
|
|
8674
|
-
__disposeResources6(env_1);
|
|
8675
|
-
}
|
|
8676
|
-
}
|
|
8677
|
-
await context2.evaluate((name, seq, result) => {
|
|
8678
|
-
const callbacks = globalThis[name].callbacks;
|
|
8679
|
-
callbacks.get(seq).resolve(result);
|
|
8680
|
-
callbacks.delete(seq);
|
|
8681
|
-
}, this.#name, id, await this.#fn(...args));
|
|
8682
|
-
for (const arg of args) {
|
|
8683
|
-
if (arg instanceof JSHandle) {
|
|
8684
|
-
stack.use(arg);
|
|
8537
|
+
_onMessage(object) {
|
|
8538
|
+
if (object.id) {
|
|
8539
|
+
if (object.error) {
|
|
8540
|
+
if (this.#rawErrors) {
|
|
8541
|
+
this.#callbacks.rejectRaw(object.id, object.error);
|
|
8542
|
+
} else {
|
|
8543
|
+
this.#callbacks.reject(object.id, createProtocolErrorMessage(object), object.error.message);
|
|
8685
8544
|
}
|
|
8686
|
-
}
|
|
8687
|
-
} catch (error) {
|
|
8688
|
-
if (isErrorLike(error)) {
|
|
8689
|
-
await context2.evaluate((name, seq, message, stack2) => {
|
|
8690
|
-
const error2 = new Error(message);
|
|
8691
|
-
error2.stack = stack2;
|
|
8692
|
-
const callbacks = globalThis[name].callbacks;
|
|
8693
|
-
callbacks.get(seq).reject(error2);
|
|
8694
|
-
callbacks.delete(seq);
|
|
8695
|
-
}, this.#name, id, error.message, error.stack).catch(debugError);
|
|
8696
8545
|
} else {
|
|
8697
|
-
|
|
8698
|
-
const callbacks = globalThis[name].callbacks;
|
|
8699
|
-
callbacks.get(seq).reject(error2);
|
|
8700
|
-
callbacks.delete(seq);
|
|
8701
|
-
}, this.#name, id, error).catch(debugError);
|
|
8546
|
+
this.#callbacks.resolve(object.id, object.result);
|
|
8702
8547
|
}
|
|
8548
|
+
} else {
|
|
8549
|
+
assert(!object.id);
|
|
8550
|
+
this.emit(object.method, object.params);
|
|
8703
8551
|
}
|
|
8704
8552
|
}
|
|
8553
|
+
/**
|
|
8554
|
+
* Detaches the cdpSession from the target. Once detached, the cdpSession object
|
|
8555
|
+
* won't emit any events and can't be used to send messages.
|
|
8556
|
+
*/
|
|
8557
|
+
async detach() {
|
|
8558
|
+
if (!this.#connection) {
|
|
8559
|
+
throw new Error(`Session already detached. Most likely the ${this.#targetType} has been closed.`);
|
|
8560
|
+
}
|
|
8561
|
+
await this.#connection.send("Target.detachFromTarget", {
|
|
8562
|
+
sessionId: this.#sessionId
|
|
8563
|
+
});
|
|
8564
|
+
}
|
|
8565
|
+
/**
|
|
8566
|
+
* @internal
|
|
8567
|
+
*/
|
|
8568
|
+
_onClosed() {
|
|
8569
|
+
this.#callbacks.clear();
|
|
8570
|
+
this.#connection = void 0;
|
|
8571
|
+
this.emit(CDPSessionEvent.Disconnected, void 0);
|
|
8572
|
+
}
|
|
8573
|
+
/**
|
|
8574
|
+
* Returns the session's id.
|
|
8575
|
+
*/
|
|
8576
|
+
id() {
|
|
8577
|
+
return this.#sessionId;
|
|
8578
|
+
}
|
|
8579
|
+
/**
|
|
8580
|
+
* @internal
|
|
8581
|
+
*/
|
|
8582
|
+
getPendingProtocolErrors() {
|
|
8583
|
+
return this.#callbacks.getPendingProtocolErrors();
|
|
8584
|
+
}
|
|
8705
8585
|
};
|
|
8706
8586
|
|
|
8707
8587
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Connection.js
|
|
@@ -8717,9 +8597,12 @@
|
|
|
8717
8597
|
#sessions = /* @__PURE__ */ new Map();
|
|
8718
8598
|
#closed = false;
|
|
8719
8599
|
#manuallyAttached = /* @__PURE__ */ new Set();
|
|
8720
|
-
#callbacks
|
|
8721
|
-
|
|
8600
|
+
#callbacks;
|
|
8601
|
+
#rawErrors = false;
|
|
8602
|
+
constructor(url, transport, delay = 0, timeout2, rawErrors = false) {
|
|
8722
8603
|
super();
|
|
8604
|
+
this.#rawErrors = rawErrors;
|
|
8605
|
+
this.#callbacks = new CallbackRegistry();
|
|
8723
8606
|
this.#url = url;
|
|
8724
8607
|
this.#delay = delay;
|
|
8725
8608
|
this.#timeout = timeout2 ?? 18e4;
|
|
@@ -8801,7 +8684,7 @@
|
|
|
8801
8684
|
const object = JSON.parse(message);
|
|
8802
8685
|
if (object.method === "Target.attachedToTarget") {
|
|
8803
8686
|
const sessionId = object.params.sessionId;
|
|
8804
|
-
const session = new CdpCDPSession(this, object.params.targetInfo.type, sessionId, object.sessionId);
|
|
8687
|
+
const session = new CdpCDPSession(this, object.params.targetInfo.type, sessionId, object.sessionId, this.#rawErrors);
|
|
8805
8688
|
this.#sessions.set(sessionId, session);
|
|
8806
8689
|
this.emit(CDPSessionEvent.SessionAttached, session);
|
|
8807
8690
|
const parentSession = this.#sessions.get(object.sessionId);
|
|
@@ -8827,7 +8710,11 @@
|
|
|
8827
8710
|
}
|
|
8828
8711
|
} else if (object.id) {
|
|
8829
8712
|
if (object.error) {
|
|
8830
|
-
this.#
|
|
8713
|
+
if (this.#rawErrors) {
|
|
8714
|
+
this.#callbacks.rejectRaw(object.id, object.error);
|
|
8715
|
+
} else {
|
|
8716
|
+
this.#callbacks.reject(object.id, createProtocolErrorMessage(object), object.error.message);
|
|
8717
|
+
}
|
|
8831
8718
|
} else {
|
|
8832
8719
|
this.#callbacks.resolve(object.id, object.result);
|
|
8833
8720
|
}
|
|
@@ -9931,7 +9818,7 @@
|
|
|
9931
9818
|
// node_modules/puppeteer-core/lib/esm/puppeteer/common/HandleIterator.js
|
|
9932
9819
|
init_dirname();
|
|
9933
9820
|
init_buffer2();
|
|
9934
|
-
var
|
|
9821
|
+
var __addDisposableResource6 = function(env, value, async2) {
|
|
9935
9822
|
if (value !== null && value !== void 0) {
|
|
9936
9823
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
9937
9824
|
var dispose, inner;
|
|
@@ -9958,7 +9845,7 @@
|
|
|
9958
9845
|
}
|
|
9959
9846
|
return value;
|
|
9960
9847
|
};
|
|
9961
|
-
var
|
|
9848
|
+
var __disposeResources6 = /* @__PURE__ */ function(SuppressedError2) {
|
|
9962
9849
|
return function(env) {
|
|
9963
9850
|
function fail(e) {
|
|
9964
9851
|
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
@@ -9993,7 +9880,7 @@
|
|
|
9993
9880
|
async function* fastTransposeIteratorHandle(iterator2, size) {
|
|
9994
9881
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
9995
9882
|
try {
|
|
9996
|
-
const array =
|
|
9883
|
+
const array = __addDisposableResource6(env_1, await iterator2.evaluateHandle(async (iterator3, size2) => {
|
|
9997
9884
|
const results = [];
|
|
9998
9885
|
while (results.length < size2) {
|
|
9999
9886
|
const result = await iterator3.next();
|
|
@@ -10006,18 +9893,18 @@
|
|
|
10006
9893
|
}, size), false);
|
|
10007
9894
|
const properties = await array.getProperties();
|
|
10008
9895
|
const handles = properties.values();
|
|
10009
|
-
const stack =
|
|
9896
|
+
const stack = __addDisposableResource6(env_1, new DisposableStack(), false);
|
|
10010
9897
|
stack.defer(() => {
|
|
10011
9898
|
for (const handle_1 of handles) {
|
|
10012
9899
|
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
10013
9900
|
try {
|
|
10014
|
-
const handle =
|
|
9901
|
+
const handle = __addDisposableResource6(env_2, handle_1, false);
|
|
10015
9902
|
handle[disposeSymbol]();
|
|
10016
9903
|
} catch (e_2) {
|
|
10017
9904
|
env_2.error = e_2;
|
|
10018
9905
|
env_2.hasError = true;
|
|
10019
9906
|
} finally {
|
|
10020
|
-
|
|
9907
|
+
__disposeResources6(env_2);
|
|
10021
9908
|
}
|
|
10022
9909
|
}
|
|
10023
9910
|
});
|
|
@@ -10027,7 +9914,7 @@
|
|
|
10027
9914
|
env_1.error = e_1;
|
|
10028
9915
|
env_1.hasError = true;
|
|
10029
9916
|
} finally {
|
|
10030
|
-
|
|
9917
|
+
__disposeResources6(env_1);
|
|
10031
9918
|
}
|
|
10032
9919
|
}
|
|
10033
9920
|
async function* transposeIteratorHandle(iterator2) {
|
|
@@ -10039,7 +9926,7 @@
|
|
|
10039
9926
|
async function* transposeIterableHandle(handle) {
|
|
10040
9927
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
10041
9928
|
try {
|
|
10042
|
-
const generatorHandle =
|
|
9929
|
+
const generatorHandle = __addDisposableResource6(env_3, await handle.evaluateHandle((iterable) => {
|
|
10043
9930
|
return async function* () {
|
|
10044
9931
|
yield* iterable;
|
|
10045
9932
|
}();
|
|
@@ -10049,7 +9936,7 @@
|
|
|
10049
9936
|
env_3.error = e_3;
|
|
10050
9937
|
env_3.hasError = true;
|
|
10051
9938
|
} finally {
|
|
10052
|
-
|
|
9939
|
+
__disposeResources6(env_3);
|
|
10053
9940
|
}
|
|
10054
9941
|
}
|
|
10055
9942
|
|
|
@@ -10070,7 +9957,7 @@
|
|
|
10070
9957
|
};
|
|
10071
9958
|
|
|
10072
9959
|
// node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.js
|
|
10073
|
-
var
|
|
9960
|
+
var __addDisposableResource7 = function(env, value, async2) {
|
|
10074
9961
|
if (value !== null && value !== void 0) {
|
|
10075
9962
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
10076
9963
|
var dispose, inner;
|
|
@@ -10097,7 +9984,7 @@
|
|
|
10097
9984
|
}
|
|
10098
9985
|
return value;
|
|
10099
9986
|
};
|
|
10100
|
-
var
|
|
9987
|
+
var __disposeResources7 = /* @__PURE__ */ function(SuppressedError2) {
|
|
10101
9988
|
return function(env) {
|
|
10102
9989
|
function fail(e) {
|
|
10103
9990
|
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
@@ -10175,7 +10062,7 @@
|
|
|
10175
10062
|
static async *queryAll(element, selector) {
|
|
10176
10063
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
10177
10064
|
try {
|
|
10178
|
-
const handle =
|
|
10065
|
+
const handle = __addDisposableResource7(env_1, await element.evaluateHandle(this._querySelectorAll, selector, LazyArg.create((context2) => {
|
|
10179
10066
|
return context2.puppeteerUtil;
|
|
10180
10067
|
})), false);
|
|
10181
10068
|
yield* transposeIterableHandle(handle);
|
|
@@ -10183,7 +10070,7 @@
|
|
|
10183
10070
|
env_1.error = e_1;
|
|
10184
10071
|
env_1.hasError = true;
|
|
10185
10072
|
} finally {
|
|
10186
|
-
|
|
10073
|
+
__disposeResources7(env_1);
|
|
10187
10074
|
}
|
|
10188
10075
|
}
|
|
10189
10076
|
/**
|
|
@@ -10194,7 +10081,7 @@
|
|
|
10194
10081
|
static async queryOne(element, selector) {
|
|
10195
10082
|
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
10196
10083
|
try {
|
|
10197
|
-
const result =
|
|
10084
|
+
const result = __addDisposableResource7(env_2, await element.evaluateHandle(this._querySelector, selector, LazyArg.create((context2) => {
|
|
10198
10085
|
return context2.puppeteerUtil;
|
|
10199
10086
|
})), false);
|
|
10200
10087
|
if (!(_isElementHandle in result)) {
|
|
@@ -10205,7 +10092,7 @@
|
|
|
10205
10092
|
env_2.error = e_2;
|
|
10206
10093
|
env_2.hasError = true;
|
|
10207
10094
|
} finally {
|
|
10208
|
-
|
|
10095
|
+
__disposeResources7(env_2);
|
|
10209
10096
|
}
|
|
10210
10097
|
}
|
|
10211
10098
|
/**
|
|
@@ -10219,7 +10106,7 @@
|
|
|
10219
10106
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
10220
10107
|
try {
|
|
10221
10108
|
let frame;
|
|
10222
|
-
const element =
|
|
10109
|
+
const element = __addDisposableResource7(env_3, await (async () => {
|
|
10223
10110
|
if (!(_isElementHandle in elementOrFrame)) {
|
|
10224
10111
|
frame = elementOrFrame;
|
|
10225
10112
|
return;
|
|
@@ -10233,7 +10120,7 @@
|
|
|
10233
10120
|
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
10234
10121
|
try {
|
|
10235
10122
|
signal?.throwIfAborted();
|
|
10236
|
-
const handle =
|
|
10123
|
+
const handle = __addDisposableResource7(env_4, await frame.isolatedRealm().waitForFunction(async (PuppeteerUtil, query, selector2, root, visible2) => {
|
|
10237
10124
|
const querySelector = PuppeteerUtil.createFunction(query);
|
|
10238
10125
|
const node = await querySelector(root ?? document, selector2, PuppeteerUtil);
|
|
10239
10126
|
return PuppeteerUtil.checkVisibility(node, visible2);
|
|
@@ -10256,7 +10143,7 @@
|
|
|
10256
10143
|
env_4.error = e_3;
|
|
10257
10144
|
env_4.hasError = true;
|
|
10258
10145
|
} finally {
|
|
10259
|
-
|
|
10146
|
+
__disposeResources7(env_4);
|
|
10260
10147
|
}
|
|
10261
10148
|
} catch (error) {
|
|
10262
10149
|
if (!isErrorLike(error)) {
|
|
@@ -10272,7 +10159,7 @@
|
|
|
10272
10159
|
env_3.error = e_4;
|
|
10273
10160
|
env_3.hasError = true;
|
|
10274
10161
|
} finally {
|
|
10275
|
-
|
|
10162
|
+
__disposeResources7(env_3);
|
|
10276
10163
|
}
|
|
10277
10164
|
}
|
|
10278
10165
|
};
|
|
@@ -10665,32 +10552,22 @@
|
|
|
10665
10552
|
}
|
|
10666
10553
|
return tokens;
|
|
10667
10554
|
}
|
|
10668
|
-
function
|
|
10669
|
-
|
|
10555
|
+
function stringify(listOrNode) {
|
|
10556
|
+
if (Array.isArray(listOrNode)) {
|
|
10557
|
+
return listOrNode.map((token) => token.content).join("");
|
|
10558
|
+
}
|
|
10559
|
+
switch (listOrNode.type) {
|
|
10670
10560
|
case "list":
|
|
10671
|
-
|
|
10672
|
-
|
|
10673
|
-
|
|
10674
|
-
break;
|
|
10561
|
+
return listOrNode.list.map(stringify).join(",");
|
|
10562
|
+
case "relative":
|
|
10563
|
+
return listOrNode.combinator + stringify(listOrNode.right);
|
|
10675
10564
|
case "complex":
|
|
10676
|
-
|
|
10677
|
-
yield* flatten(node.right, node);
|
|
10678
|
-
break;
|
|
10565
|
+
return stringify(listOrNode.left) + listOrNode.combinator + stringify(listOrNode.right);
|
|
10679
10566
|
case "compound":
|
|
10680
|
-
|
|
10681
|
-
break;
|
|
10567
|
+
return listOrNode.list.map(stringify).join("");
|
|
10682
10568
|
default:
|
|
10683
|
-
|
|
10684
|
-
}
|
|
10685
|
-
}
|
|
10686
|
-
function stringify(listOrNode) {
|
|
10687
|
-
let tokens;
|
|
10688
|
-
if (Array.isArray(listOrNode)) {
|
|
10689
|
-
tokens = listOrNode;
|
|
10690
|
-
} else {
|
|
10691
|
-
tokens = [...flatten(listOrNode)].map(([token]) => token);
|
|
10569
|
+
return listOrNode.content;
|
|
10692
10570
|
}
|
|
10693
|
-
return tokens.map((token) => token.content).join("");
|
|
10694
10571
|
}
|
|
10695
10572
|
|
|
10696
10573
|
// node_modules/puppeteer-core/lib/esm/puppeteer/common/PSelectorParser.js
|
|
@@ -10907,7 +10784,7 @@
|
|
|
10907
10784
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
10908
10785
|
done = true;
|
|
10909
10786
|
};
|
|
10910
|
-
var
|
|
10787
|
+
var __addDisposableResource8 = function(env, value, async2) {
|
|
10911
10788
|
if (value !== null && value !== void 0) {
|
|
10912
10789
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
10913
10790
|
var dispose, inner;
|
|
@@ -10934,7 +10811,7 @@
|
|
|
10934
10811
|
}
|
|
10935
10812
|
return value;
|
|
10936
10813
|
};
|
|
10937
|
-
var
|
|
10814
|
+
var __disposeResources8 = /* @__PURE__ */ function(SuppressedError2) {
|
|
10938
10815
|
return function(env) {
|
|
10939
10816
|
function fail(e) {
|
|
10940
10817
|
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
@@ -11097,13 +10974,13 @@
|
|
|
11097
10974
|
if (!parentFrame) {
|
|
11098
10975
|
return null;
|
|
11099
10976
|
}
|
|
11100
|
-
const list =
|
|
10977
|
+
const list = __addDisposableResource8(env_1, await parentFrame.isolatedRealm().evaluateHandle(() => {
|
|
11101
10978
|
return document.querySelectorAll("iframe,frame");
|
|
11102
10979
|
}), false);
|
|
11103
10980
|
for await (const iframe_1 of transposeIterableHandle(list)) {
|
|
11104
10981
|
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
11105
10982
|
try {
|
|
11106
|
-
const iframe =
|
|
10983
|
+
const iframe = __addDisposableResource8(env_2, iframe_1, false);
|
|
11107
10984
|
const frame = await iframe.contentFrame();
|
|
11108
10985
|
if (frame?._id === this._id) {
|
|
11109
10986
|
return await parentFrame.mainRealm().adoptHandle(iframe);
|
|
@@ -11112,7 +10989,7 @@
|
|
|
11112
10989
|
env_2.error = e_1;
|
|
11113
10990
|
env_2.hasError = true;
|
|
11114
10991
|
} finally {
|
|
11115
|
-
|
|
10992
|
+
__disposeResources8(env_2);
|
|
11116
10993
|
}
|
|
11117
10994
|
}
|
|
11118
10995
|
return null;
|
|
@@ -11120,7 +10997,7 @@
|
|
|
11120
10997
|
env_1.error = e_2;
|
|
11121
10998
|
env_1.hasError = true;
|
|
11122
10999
|
} finally {
|
|
11123
|
-
|
|
11000
|
+
__disposeResources8(env_1);
|
|
11124
11001
|
}
|
|
11125
11002
|
}
|
|
11126
11003
|
/**
|
|
@@ -11524,7 +11401,7 @@
|
|
|
11524
11401
|
async click(selector, options = {}) {
|
|
11525
11402
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
11526
11403
|
try {
|
|
11527
|
-
const handle =
|
|
11404
|
+
const handle = __addDisposableResource8(env_3, await this.$(selector), false);
|
|
11528
11405
|
assert(handle, `No element found for selector: ${selector}`);
|
|
11529
11406
|
await handle.click(options);
|
|
11530
11407
|
await handle.dispose();
|
|
@@ -11532,7 +11409,7 @@
|
|
|
11532
11409
|
env_3.error = e_3;
|
|
11533
11410
|
env_3.hasError = true;
|
|
11534
11411
|
} finally {
|
|
11535
|
-
|
|
11412
|
+
__disposeResources8(env_3);
|
|
11536
11413
|
}
|
|
11537
11414
|
}
|
|
11538
11415
|
/**
|
|
@@ -11544,14 +11421,14 @@
|
|
|
11544
11421
|
async focus(selector) {
|
|
11545
11422
|
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
11546
11423
|
try {
|
|
11547
|
-
const handle =
|
|
11424
|
+
const handle = __addDisposableResource8(env_4, await this.$(selector), false);
|
|
11548
11425
|
assert(handle, `No element found for selector: ${selector}`);
|
|
11549
11426
|
await handle.focus();
|
|
11550
11427
|
} catch (e_4) {
|
|
11551
11428
|
env_4.error = e_4;
|
|
11552
11429
|
env_4.hasError = true;
|
|
11553
11430
|
} finally {
|
|
11554
|
-
|
|
11431
|
+
__disposeResources8(env_4);
|
|
11555
11432
|
}
|
|
11556
11433
|
}
|
|
11557
11434
|
/**
|
|
@@ -11564,14 +11441,14 @@
|
|
|
11564
11441
|
async hover(selector) {
|
|
11565
11442
|
const env_5 = { stack: [], error: void 0, hasError: false };
|
|
11566
11443
|
try {
|
|
11567
|
-
const handle =
|
|
11444
|
+
const handle = __addDisposableResource8(env_5, await this.$(selector), false);
|
|
11568
11445
|
assert(handle, `No element found for selector: ${selector}`);
|
|
11569
11446
|
await handle.hover();
|
|
11570
11447
|
} catch (e_5) {
|
|
11571
11448
|
env_5.error = e_5;
|
|
11572
11449
|
env_5.hasError = true;
|
|
11573
11450
|
} finally {
|
|
11574
|
-
|
|
11451
|
+
__disposeResources8(env_5);
|
|
11575
11452
|
}
|
|
11576
11453
|
}
|
|
11577
11454
|
/**
|
|
@@ -11595,14 +11472,14 @@
|
|
|
11595
11472
|
async select(selector, ...values) {
|
|
11596
11473
|
const env_6 = { stack: [], error: void 0, hasError: false };
|
|
11597
11474
|
try {
|
|
11598
|
-
const handle =
|
|
11475
|
+
const handle = __addDisposableResource8(env_6, await this.$(selector), false);
|
|
11599
11476
|
assert(handle, `No element found for selector: ${selector}`);
|
|
11600
11477
|
return await handle.select(...values);
|
|
11601
11478
|
} catch (e_6) {
|
|
11602
11479
|
env_6.error = e_6;
|
|
11603
11480
|
env_6.hasError = true;
|
|
11604
11481
|
} finally {
|
|
11605
|
-
|
|
11482
|
+
__disposeResources8(env_6);
|
|
11606
11483
|
}
|
|
11607
11484
|
}
|
|
11608
11485
|
/**
|
|
@@ -11614,14 +11491,14 @@
|
|
|
11614
11491
|
async tap(selector) {
|
|
11615
11492
|
const env_7 = { stack: [], error: void 0, hasError: false };
|
|
11616
11493
|
try {
|
|
11617
|
-
const handle =
|
|
11494
|
+
const handle = __addDisposableResource8(env_7, await this.$(selector), false);
|
|
11618
11495
|
assert(handle, `No element found for selector: ${selector}`);
|
|
11619
11496
|
await handle.tap();
|
|
11620
11497
|
} catch (e_7) {
|
|
11621
11498
|
env_7.error = e_7;
|
|
11622
11499
|
env_7.hasError = true;
|
|
11623
11500
|
} finally {
|
|
11624
|
-
|
|
11501
|
+
__disposeResources8(env_7);
|
|
11625
11502
|
}
|
|
11626
11503
|
}
|
|
11627
11504
|
/**
|
|
@@ -11648,14 +11525,14 @@
|
|
|
11648
11525
|
async type(selector, text, options) {
|
|
11649
11526
|
const env_8 = { stack: [], error: void 0, hasError: false };
|
|
11650
11527
|
try {
|
|
11651
|
-
const handle =
|
|
11528
|
+
const handle = __addDisposableResource8(env_8, await this.$(selector), false);
|
|
11652
11529
|
assert(handle, `No element found for selector: ${selector}`);
|
|
11653
11530
|
await handle.type(text, options);
|
|
11654
11531
|
} catch (e_8) {
|
|
11655
11532
|
env_8.error = e_8;
|
|
11656
11533
|
env_8.hasError = true;
|
|
11657
11534
|
} finally {
|
|
11658
|
-
|
|
11535
|
+
__disposeResources8(env_8);
|
|
11659
11536
|
}
|
|
11660
11537
|
}
|
|
11661
11538
|
/**
|
|
@@ -11933,7 +11810,7 @@
|
|
|
11933
11810
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
11934
11811
|
done = true;
|
|
11935
11812
|
};
|
|
11936
|
-
var
|
|
11813
|
+
var __addDisposableResource9 = function(env, value, async2) {
|
|
11937
11814
|
if (value !== null && value !== void 0) {
|
|
11938
11815
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
11939
11816
|
var dispose, inner;
|
|
@@ -11960,7 +11837,7 @@
|
|
|
11960
11837
|
}
|
|
11961
11838
|
return value;
|
|
11962
11839
|
};
|
|
11963
|
-
var
|
|
11840
|
+
var __disposeResources9 = /* @__PURE__ */ function(SuppressedError2) {
|
|
11964
11841
|
return function(env) {
|
|
11965
11842
|
function fail(e) {
|
|
11966
11843
|
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
@@ -12333,7 +12210,7 @@
|
|
|
12333
12210
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
12334
12211
|
try {
|
|
12335
12212
|
pageFunction = withSourcePuppeteerURLIfNone(this.$eval.name, pageFunction);
|
|
12336
|
-
const elementHandle =
|
|
12213
|
+
const elementHandle = __addDisposableResource9(env_1, await this.$(selector), false);
|
|
12337
12214
|
if (!elementHandle) {
|
|
12338
12215
|
throw new Error(`Error: failed to find element matching selector "${selector}"`);
|
|
12339
12216
|
}
|
|
@@ -12342,7 +12219,7 @@
|
|
|
12342
12219
|
env_1.error = e_1;
|
|
12343
12220
|
env_1.hasError = true;
|
|
12344
12221
|
} finally {
|
|
12345
|
-
|
|
12222
|
+
__disposeResources9(env_1);
|
|
12346
12223
|
}
|
|
12347
12224
|
}
|
|
12348
12225
|
/**
|
|
@@ -12397,7 +12274,7 @@
|
|
|
12397
12274
|
try {
|
|
12398
12275
|
pageFunction = withSourcePuppeteerURLIfNone(this.$$eval.name, pageFunction);
|
|
12399
12276
|
const results = await this.$$(selector);
|
|
12400
|
-
const elements =
|
|
12277
|
+
const elements = __addDisposableResource9(env_2, await this.evaluateHandle((_, ...elements2) => {
|
|
12401
12278
|
return elements2;
|
|
12402
12279
|
}, ...results), false);
|
|
12403
12280
|
const [result] = await Promise.all([
|
|
@@ -12411,7 +12288,7 @@
|
|
|
12411
12288
|
env_2.error = e_2;
|
|
12412
12289
|
env_2.hasError = true;
|
|
12413
12290
|
} finally {
|
|
12414
|
-
|
|
12291
|
+
__disposeResources9(env_2);
|
|
12415
12292
|
}
|
|
12416
12293
|
}
|
|
12417
12294
|
/**
|
|
@@ -12805,7 +12682,7 @@
|
|
|
12805
12682
|
while (parentFrame = frame?.parentFrame()) {
|
|
12806
12683
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
12807
12684
|
try {
|
|
12808
|
-
const handle =
|
|
12685
|
+
const handle = __addDisposableResource9(env_3, await frame.frameElement(), false);
|
|
12809
12686
|
if (!handle) {
|
|
12810
12687
|
throw new Error("Unsupported frame type");
|
|
12811
12688
|
}
|
|
@@ -12833,7 +12710,7 @@
|
|
|
12833
12710
|
env_3.error = e_3;
|
|
12834
12711
|
env_3.hasError = true;
|
|
12835
12712
|
} finally {
|
|
12836
|
-
|
|
12713
|
+
__disposeResources9(env_3);
|
|
12837
12714
|
}
|
|
12838
12715
|
}
|
|
12839
12716
|
const box = boxes.find((box2) => {
|
|
@@ -12995,7 +12872,7 @@
|
|
|
12995
12872
|
while (parentFrame = frame?.parentFrame()) {
|
|
12996
12873
|
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
12997
12874
|
try {
|
|
12998
|
-
const handle =
|
|
12875
|
+
const handle = __addDisposableResource9(env_4, await frame.frameElement(), false);
|
|
12999
12876
|
if (!handle) {
|
|
13000
12877
|
throw new Error("Unsupported frame type");
|
|
13001
12878
|
}
|
|
@@ -13020,7 +12897,7 @@
|
|
|
13020
12897
|
env_4.error = e_4;
|
|
13021
12898
|
env_4.hasError = true;
|
|
13022
12899
|
} finally {
|
|
13023
|
-
|
|
12900
|
+
__disposeResources9(env_4);
|
|
13024
12901
|
}
|
|
13025
12902
|
}
|
|
13026
12903
|
return point;
|
|
@@ -13099,7 +12976,7 @@
|
|
|
13099
12976
|
try {
|
|
13100
12977
|
await this.assertConnectedElement();
|
|
13101
12978
|
const handle = await this.#asSVGElementHandle();
|
|
13102
|
-
const target =
|
|
12979
|
+
const target = __addDisposableResource9(env_5, handle && await handle.#getOwnerSVGElement(), false);
|
|
13103
12980
|
return await (target ?? this).evaluate(async (element, threshold) => {
|
|
13104
12981
|
const visibleRatio = await new Promise((resolve) => {
|
|
13105
12982
|
const observer = new IntersectionObserver((entries) => {
|
|
@@ -13114,7 +12991,7 @@
|
|
|
13114
12991
|
env_5.error = e_5;
|
|
13115
12992
|
env_5.hasError = true;
|
|
13116
12993
|
} finally {
|
|
13117
|
-
|
|
12994
|
+
__disposeResources9(env_5);
|
|
13118
12995
|
}
|
|
13119
12996
|
}
|
|
13120
12997
|
/**
|
|
@@ -13450,9 +13327,9 @@
|
|
|
13450
13327
|
__esDecorate6(this, null, _autofill_decorators, { kind: "method", name: "autofill", static: false, private: false, access: { has: (obj) => "autofill" in obj, get: (obj) => obj.autofill }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
13451
13328
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
13452
13329
|
}
|
|
13330
|
+
#backendNodeId = __runInitializers6(this, _instanceExtraInitializers);
|
|
13453
13331
|
constructor(world, remoteObject) {
|
|
13454
13332
|
super(new CdpJSHandle(world, remoteObject));
|
|
13455
|
-
__runInitializers6(this, _instanceExtraInitializers);
|
|
13456
13333
|
}
|
|
13457
13334
|
get realm() {
|
|
13458
13335
|
return this.handle.realm;
|
|
@@ -13555,11 +13432,21 @@
|
|
|
13555
13432
|
return this.realm.adoptBackendNode(node.backendDOMNodeId);
|
|
13556
13433
|
});
|
|
13557
13434
|
}
|
|
13435
|
+
async backendNodeId() {
|
|
13436
|
+
if (this.#backendNodeId) {
|
|
13437
|
+
return this.#backendNodeId;
|
|
13438
|
+
}
|
|
13439
|
+
const { node } = await this.client.send("DOM.describeNode", {
|
|
13440
|
+
objectId: this.handle.id
|
|
13441
|
+
});
|
|
13442
|
+
this.#backendNodeId = node.backendNodeId;
|
|
13443
|
+
return this.#backendNodeId;
|
|
13444
|
+
}
|
|
13558
13445
|
};
|
|
13559
13446
|
})();
|
|
13560
13447
|
|
|
13561
13448
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/ExecutionContext.js
|
|
13562
|
-
var
|
|
13449
|
+
var __addDisposableResource10 = function(env, value, async2) {
|
|
13563
13450
|
if (value !== null && value !== void 0) {
|
|
13564
13451
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
13565
13452
|
var dispose, inner;
|
|
@@ -13586,7 +13473,7 @@
|
|
|
13586
13473
|
}
|
|
13587
13474
|
return value;
|
|
13588
13475
|
};
|
|
13589
|
-
var
|
|
13476
|
+
var __disposeResources10 = /* @__PURE__ */ function(SuppressedError2) {
|
|
13590
13477
|
return function(env) {
|
|
13591
13478
|
function fail(e) {
|
|
13592
13479
|
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
@@ -13664,7 +13551,7 @@
|
|
|
13664
13551
|
if (this.#bindings.has(binding.name)) {
|
|
13665
13552
|
return;
|
|
13666
13553
|
}
|
|
13667
|
-
const _ =
|
|
13554
|
+
const _ = __addDisposableResource10(env_1, await this.#mutex.acquire(), false);
|
|
13668
13555
|
try {
|
|
13669
13556
|
await this.#client.send("Runtime.addBinding", this.#name ? {
|
|
13670
13557
|
name: CDP_BINDING_PREFIX + binding.name,
|
|
@@ -13690,7 +13577,7 @@
|
|
|
13690
13577
|
env_1.error = e_1;
|
|
13691
13578
|
env_1.hasError = true;
|
|
13692
13579
|
} finally {
|
|
13693
|
-
|
|
13580
|
+
__disposeResources10(env_1);
|
|
13694
13581
|
}
|
|
13695
13582
|
}
|
|
13696
13583
|
async #onBindingCalled(event) {
|
|
@@ -18024,10 +17911,45 @@ ${sourceUrlComment}
|
|
|
18024
17911
|
}
|
|
18025
17912
|
};
|
|
18026
17913
|
|
|
18027
|
-
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/WebWorker.js
|
|
18028
|
-
init_dirname();
|
|
18029
|
-
init_buffer2();
|
|
18030
|
-
|
|
17914
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/WebWorker.js
|
|
17915
|
+
init_dirname();
|
|
17916
|
+
init_buffer2();
|
|
17917
|
+
|
|
17918
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/api/Target.js
|
|
17919
|
+
init_dirname();
|
|
17920
|
+
init_buffer2();
|
|
17921
|
+
var TargetType;
|
|
17922
|
+
(function(TargetType2) {
|
|
17923
|
+
TargetType2["PAGE"] = "page";
|
|
17924
|
+
TargetType2["BACKGROUND_PAGE"] = "background_page";
|
|
17925
|
+
TargetType2["SERVICE_WORKER"] = "service_worker";
|
|
17926
|
+
TargetType2["SHARED_WORKER"] = "shared_worker";
|
|
17927
|
+
TargetType2["BROWSER"] = "browser";
|
|
17928
|
+
TargetType2["WEBVIEW"] = "webview";
|
|
17929
|
+
TargetType2["OTHER"] = "other";
|
|
17930
|
+
TargetType2["TAB"] = "tab";
|
|
17931
|
+
})(TargetType || (TargetType = {}));
|
|
17932
|
+
var Target = class {
|
|
17933
|
+
/**
|
|
17934
|
+
* @internal
|
|
17935
|
+
*/
|
|
17936
|
+
constructor() {
|
|
17937
|
+
}
|
|
17938
|
+
/**
|
|
17939
|
+
* If the target is not of type `"service_worker"` or `"shared_worker"`, returns `null`.
|
|
17940
|
+
*/
|
|
17941
|
+
async worker() {
|
|
17942
|
+
return null;
|
|
17943
|
+
}
|
|
17944
|
+
/**
|
|
17945
|
+
* If the target is not of type `"page"`, `"webview"` or `"background_page"`,
|
|
17946
|
+
* returns `null`.
|
|
17947
|
+
*/
|
|
17948
|
+
async page() {
|
|
17949
|
+
return null;
|
|
17950
|
+
}
|
|
17951
|
+
};
|
|
17952
|
+
|
|
18031
17953
|
// node_modules/puppeteer-core/lib/esm/puppeteer/api/WebWorker.js
|
|
18032
17954
|
init_dirname();
|
|
18033
17955
|
init_buffer2();
|
|
@@ -18159,7 +18081,7 @@ ${sourceUrlComment}
|
|
|
18159
18081
|
};
|
|
18160
18082
|
|
|
18161
18083
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Page.js
|
|
18162
|
-
var
|
|
18084
|
+
var __addDisposableResource11 = function(env, value, async2) {
|
|
18163
18085
|
if (value !== null && value !== void 0) {
|
|
18164
18086
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
18165
18087
|
var dispose, inner;
|
|
@@ -18186,7 +18108,7 @@ ${sourceUrlComment}
|
|
|
18186
18108
|
}
|
|
18187
18109
|
return value;
|
|
18188
18110
|
};
|
|
18189
|
-
var
|
|
18111
|
+
var __disposeResources11 = /* @__PURE__ */ function(SuppressedError2) {
|
|
18190
18112
|
return function(env) {
|
|
18191
18113
|
function fail(e) {
|
|
18192
18114
|
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
@@ -18428,7 +18350,7 @@ ${sourceUrlComment}
|
|
|
18428
18350
|
}
|
|
18429
18351
|
const frame = this.#frameManager.frame(event.frameId);
|
|
18430
18352
|
assert(frame, "This should never happen.");
|
|
18431
|
-
const handle =
|
|
18353
|
+
const handle = __addDisposableResource11(env_1, await frame.worlds[MAIN_WORLD].adoptBackendNode(event.backendNodeId), false);
|
|
18432
18354
|
const fileChooser = new FileChooser(handle.move(), event);
|
|
18433
18355
|
for (const promise of this.#fileChooserDeferreds) {
|
|
18434
18356
|
promise.resolve(fileChooser);
|
|
@@ -18438,7 +18360,7 @@ ${sourceUrlComment}
|
|
|
18438
18360
|
env_1.error = e_1;
|
|
18439
18361
|
env_1.hasError = true;
|
|
18440
18362
|
} finally {
|
|
18441
|
-
|
|
18363
|
+
__disposeResources11(env_1);
|
|
18442
18364
|
}
|
|
18443
18365
|
}
|
|
18444
18366
|
_client() {
|
|
@@ -18594,9 +18516,7 @@ ${sourceUrlComment}
|
|
|
18594
18516
|
for (const cookie of cookies) {
|
|
18595
18517
|
const item = {
|
|
18596
18518
|
...cookie,
|
|
18597
|
-
|
|
18598
|
-
// type in Puppeteer.
|
|
18599
|
-
partitionKey: cookie.partitionKey ? { topLevelSite: cookie.partitionKey, hasCrossSiteAncestor: false } : void 0
|
|
18519
|
+
partitionKey: convertCookiesPartitionKeyFromPuppeteerToCdp(cookie.partitionKey)
|
|
18600
18520
|
};
|
|
18601
18521
|
if (!cookie.url && pageURL.startsWith("http")) {
|
|
18602
18522
|
item.url = pageURL;
|
|
@@ -18632,12 +18552,7 @@ ${sourceUrlComment}
|
|
|
18632
18552
|
cookies: items.map((cookieParam) => {
|
|
18633
18553
|
return {
|
|
18634
18554
|
...cookieParam,
|
|
18635
|
-
partitionKey: cookieParam.partitionKey
|
|
18636
|
-
// TODO: a breaking change neeeded to change the partition key
|
|
18637
|
-
// type in Puppeteer.
|
|
18638
|
-
topLevelSite: cookieParam.partitionKey,
|
|
18639
|
-
hasCrossSiteAncestor: false
|
|
18640
|
-
} : void 0
|
|
18555
|
+
partitionKey: convertCookiesPartitionKeyFromPuppeteerToCdp(cookieParam.partitionKey)
|
|
18641
18556
|
};
|
|
18642
18557
|
})
|
|
18643
18558
|
});
|
|
@@ -18854,7 +18769,7 @@ ${sourceUrlComment}
|
|
|
18854
18769
|
try {
|
|
18855
18770
|
const { fromSurface, omitBackground, optimizeForSpeed, quality, clip: userClip, type, captureBeyondViewport } = options;
|
|
18856
18771
|
const isFirefox = this.target()._targetManager() instanceof FirefoxTargetManager;
|
|
18857
|
-
const stack =
|
|
18772
|
+
const stack = __addDisposableResource11(env_2, new AsyncDisposableStack(), true);
|
|
18858
18773
|
if (!isFirefox && omitBackground && (type === "png" || type === "webp")) {
|
|
18859
18774
|
await this.#emulationManager.setTransparentBackgroundColor();
|
|
18860
18775
|
stack.defer(async () => {
|
|
@@ -18882,7 +18797,7 @@ ${sourceUrlComment}
|
|
|
18882
18797
|
env_2.error = e_2;
|
|
18883
18798
|
env_2.hasError = true;
|
|
18884
18799
|
} finally {
|
|
18885
|
-
const result_1 =
|
|
18800
|
+
const result_1 = __disposeResources11(env_2);
|
|
18886
18801
|
if (result_1)
|
|
18887
18802
|
await result_1;
|
|
18888
18803
|
}
|
|
@@ -18934,7 +18849,7 @@ ${sourceUrlComment}
|
|
|
18934
18849
|
async close(options = { runBeforeUnload: void 0 }) {
|
|
18935
18850
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
18936
18851
|
try {
|
|
18937
|
-
const _guard =
|
|
18852
|
+
const _guard = __addDisposableResource11(env_3, await this.browserContext().waitForScreenshotOperations(), false);
|
|
18938
18853
|
const connection = this.#primaryTargetClient.connection();
|
|
18939
18854
|
assert(connection, "Protocol error: Connection closed. Most likely the page has been closed.");
|
|
18940
18855
|
const runBeforeUnload = !!options.runBeforeUnload;
|
|
@@ -18950,7 +18865,7 @@ ${sourceUrlComment}
|
|
|
18950
18865
|
env_3.error = e_3;
|
|
18951
18866
|
env_3.hasError = true;
|
|
18952
18867
|
} finally {
|
|
18953
|
-
|
|
18868
|
+
__disposeResources11(env_3);
|
|
18954
18869
|
}
|
|
18955
18870
|
}
|
|
18956
18871
|
isClosed() {
|
|
@@ -19011,8 +18926,188 @@ ${sourceUrlComment}
|
|
|
19011
18926
|
height: Math.max(Math.min(clip.y + clip.height, viewport.y + viewport.height) - y, 0)
|
|
19012
18927
|
};
|
|
19013
18928
|
}
|
|
18929
|
+
function convertCookiesPartitionKeyFromPuppeteerToCdp(partitionKey) {
|
|
18930
|
+
if (partitionKey === void 0) {
|
|
18931
|
+
return void 0;
|
|
18932
|
+
}
|
|
18933
|
+
if (typeof partitionKey === "string") {
|
|
18934
|
+
return {
|
|
18935
|
+
topLevelSite: partitionKey,
|
|
18936
|
+
hasCrossSiteAncestor: false
|
|
18937
|
+
};
|
|
18938
|
+
}
|
|
18939
|
+
return {
|
|
18940
|
+
topLevelSite: partitionKey.sourceOrigin,
|
|
18941
|
+
hasCrossSiteAncestor: partitionKey.hasCrossSiteAncestor ?? false
|
|
18942
|
+
};
|
|
18943
|
+
}
|
|
18944
|
+
|
|
18945
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/BrowserContext.js
|
|
18946
|
+
var __addDisposableResource12 = function(env, value, async2) {
|
|
18947
|
+
if (value !== null && value !== void 0) {
|
|
18948
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
18949
|
+
var dispose, inner;
|
|
18950
|
+
if (async2) {
|
|
18951
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
18952
|
+
dispose = value[Symbol.asyncDispose];
|
|
18953
|
+
}
|
|
18954
|
+
if (dispose === void 0) {
|
|
18955
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
18956
|
+
dispose = value[Symbol.dispose];
|
|
18957
|
+
if (async2) inner = dispose;
|
|
18958
|
+
}
|
|
18959
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
18960
|
+
if (inner) dispose = function() {
|
|
18961
|
+
try {
|
|
18962
|
+
inner.call(this);
|
|
18963
|
+
} catch (e) {
|
|
18964
|
+
return Promise.reject(e);
|
|
18965
|
+
}
|
|
18966
|
+
};
|
|
18967
|
+
env.stack.push({ value, dispose, async: async2 });
|
|
18968
|
+
} else if (async2) {
|
|
18969
|
+
env.stack.push({ async: true });
|
|
18970
|
+
}
|
|
18971
|
+
return value;
|
|
18972
|
+
};
|
|
18973
|
+
var __disposeResources12 = /* @__PURE__ */ function(SuppressedError2) {
|
|
18974
|
+
return function(env) {
|
|
18975
|
+
function fail(e) {
|
|
18976
|
+
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
18977
|
+
env.hasError = true;
|
|
18978
|
+
}
|
|
18979
|
+
var r, s = 0;
|
|
18980
|
+
function next() {
|
|
18981
|
+
while (r = env.stack.pop()) {
|
|
18982
|
+
try {
|
|
18983
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
18984
|
+
if (r.dispose) {
|
|
18985
|
+
var result = r.dispose.call(r.value);
|
|
18986
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
|
|
18987
|
+
fail(e);
|
|
18988
|
+
return next();
|
|
18989
|
+
});
|
|
18990
|
+
} else s |= 1;
|
|
18991
|
+
} catch (e) {
|
|
18992
|
+
fail(e);
|
|
18993
|
+
}
|
|
18994
|
+
}
|
|
18995
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
18996
|
+
if (env.hasError) throw env.error;
|
|
18997
|
+
}
|
|
18998
|
+
return next();
|
|
18999
|
+
};
|
|
19000
|
+
}(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
19001
|
+
var e = new Error(message);
|
|
19002
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
19003
|
+
});
|
|
19004
|
+
var CdpBrowserContext = class extends BrowserContext {
|
|
19005
|
+
#connection;
|
|
19006
|
+
#browser;
|
|
19007
|
+
#id;
|
|
19008
|
+
constructor(connection, browser, contextId) {
|
|
19009
|
+
super();
|
|
19010
|
+
this.#connection = connection;
|
|
19011
|
+
this.#browser = browser;
|
|
19012
|
+
this.#id = contextId;
|
|
19013
|
+
}
|
|
19014
|
+
get id() {
|
|
19015
|
+
return this.#id;
|
|
19016
|
+
}
|
|
19017
|
+
targets() {
|
|
19018
|
+
return this.#browser.targets().filter((target) => {
|
|
19019
|
+
return target.browserContext() === this;
|
|
19020
|
+
});
|
|
19021
|
+
}
|
|
19022
|
+
async pages() {
|
|
19023
|
+
const pages = await Promise.all(this.targets().filter((target) => {
|
|
19024
|
+
return target.type() === "page" || target.type() === "other" && this.#browser._getIsPageTargetCallback()?.(target);
|
|
19025
|
+
}).map((target) => {
|
|
19026
|
+
return target.page();
|
|
19027
|
+
}));
|
|
19028
|
+
return pages.filter((page) => {
|
|
19029
|
+
return !!page;
|
|
19030
|
+
});
|
|
19031
|
+
}
|
|
19032
|
+
async overridePermissions(origin, permissions) {
|
|
19033
|
+
const protocolPermissions = permissions.map((permission) => {
|
|
19034
|
+
const protocolPermission = WEB_PERMISSION_TO_PROTOCOL_PERMISSION.get(permission);
|
|
19035
|
+
if (!protocolPermission) {
|
|
19036
|
+
throw new Error("Unknown permission: " + permission);
|
|
19037
|
+
}
|
|
19038
|
+
return protocolPermission;
|
|
19039
|
+
});
|
|
19040
|
+
await this.#connection.send("Browser.grantPermissions", {
|
|
19041
|
+
origin,
|
|
19042
|
+
browserContextId: this.#id || void 0,
|
|
19043
|
+
permissions: protocolPermissions
|
|
19044
|
+
});
|
|
19045
|
+
}
|
|
19046
|
+
async clearPermissionOverrides() {
|
|
19047
|
+
await this.#connection.send("Browser.resetPermissions", {
|
|
19048
|
+
browserContextId: this.#id || void 0
|
|
19049
|
+
});
|
|
19050
|
+
}
|
|
19051
|
+
async newPage() {
|
|
19052
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
19053
|
+
try {
|
|
19054
|
+
const _guard = __addDisposableResource12(env_1, await this.waitForScreenshotOperations(), false);
|
|
19055
|
+
return await this.#browser._createPageInContext(this.#id);
|
|
19056
|
+
} catch (e_1) {
|
|
19057
|
+
env_1.error = e_1;
|
|
19058
|
+
env_1.hasError = true;
|
|
19059
|
+
} finally {
|
|
19060
|
+
__disposeResources12(env_1);
|
|
19061
|
+
}
|
|
19062
|
+
}
|
|
19063
|
+
browser() {
|
|
19064
|
+
return this.#browser;
|
|
19065
|
+
}
|
|
19066
|
+
async close() {
|
|
19067
|
+
assert(this.#id, "Default BrowserContext cannot be closed!");
|
|
19068
|
+
await this.#browser._disposeContext(this.#id);
|
|
19069
|
+
}
|
|
19070
|
+
async cookies() {
|
|
19071
|
+
const { cookies } = await this.#connection.send("Storage.getCookies", {
|
|
19072
|
+
browserContextId: this.#id
|
|
19073
|
+
});
|
|
19074
|
+
return cookies.map((cookie) => {
|
|
19075
|
+
return {
|
|
19076
|
+
...cookie,
|
|
19077
|
+
partitionKey: cookie.partitionKey ? {
|
|
19078
|
+
sourceOrigin: cookie.partitionKey.topLevelSite,
|
|
19079
|
+
hasCrossSiteAncestor: cookie.partitionKey.hasCrossSiteAncestor
|
|
19080
|
+
} : void 0
|
|
19081
|
+
};
|
|
19082
|
+
});
|
|
19083
|
+
}
|
|
19084
|
+
async setCookie(...cookies) {
|
|
19085
|
+
return await this.#connection.send("Storage.setCookies", {
|
|
19086
|
+
browserContextId: this.#id,
|
|
19087
|
+
cookies: cookies.map((cookie) => {
|
|
19088
|
+
return {
|
|
19089
|
+
...cookie,
|
|
19090
|
+
partitionKey: convertCookiesPartitionKeyFromPuppeteerToCdp(cookie.partitionKey)
|
|
19091
|
+
};
|
|
19092
|
+
})
|
|
19093
|
+
});
|
|
19094
|
+
}
|
|
19095
|
+
async setDownloadBehavior(downloadBehavior) {
|
|
19096
|
+
await this.#connection.send("Browser.setDownloadBehavior", {
|
|
19097
|
+
behavior: downloadBehavior.policy,
|
|
19098
|
+
downloadPath: downloadBehavior.downloadPath,
|
|
19099
|
+
browserContextId: this.#id
|
|
19100
|
+
});
|
|
19101
|
+
}
|
|
19102
|
+
};
|
|
19103
|
+
|
|
19104
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/ChromeTargetManager.js
|
|
19105
|
+
init_dirname();
|
|
19106
|
+
init_buffer2();
|
|
19014
19107
|
|
|
19015
19108
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Target.js
|
|
19109
|
+
init_dirname();
|
|
19110
|
+
init_buffer2();
|
|
19016
19111
|
var InitializationStatus;
|
|
19017
19112
|
(function(InitializationStatus2) {
|
|
19018
19113
|
InitializationStatus2["SUCCESS"] = "success";
|
|
@@ -19895,101 +19990,87 @@ puppeteer-core/lib/esm/puppeteer/api/BrowserContext.js:
|
|
|
19895
19990
|
* SPDX-License-Identifier: Apache-2.0
|
|
19896
19991
|
*)
|
|
19897
19992
|
|
|
19898
|
-
puppeteer-core/lib/esm/puppeteer/
|
|
19993
|
+
puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.js:
|
|
19899
19994
|
(**
|
|
19900
19995
|
* @license
|
|
19901
|
-
* Copyright
|
|
19996
|
+
* Copyright 2019 Google Inc.
|
|
19902
19997
|
* SPDX-License-Identifier: Apache-2.0
|
|
19903
19998
|
*)
|
|
19904
19999
|
|
|
19905
|
-
puppeteer-core/lib/esm/puppeteer/
|
|
20000
|
+
puppeteer-core/lib/esm/puppeteer/util/decorators.js:
|
|
19906
20001
|
(**
|
|
19907
20002
|
* @license
|
|
19908
20003
|
* Copyright 2023 Google Inc.
|
|
19909
20004
|
* SPDX-License-Identifier: Apache-2.0
|
|
19910
20005
|
*)
|
|
19911
20006
|
|
|
19912
|
-
puppeteer-core/lib/esm/puppeteer/
|
|
20007
|
+
puppeteer-core/lib/esm/puppeteer/api/Page.js:
|
|
19913
20008
|
(**
|
|
19914
20009
|
* @license
|
|
19915
|
-
* Copyright
|
|
20010
|
+
* Copyright 2017 Google Inc.
|
|
19916
20011
|
* SPDX-License-Identifier: Apache-2.0
|
|
19917
20012
|
*)
|
|
19918
20013
|
|
|
19919
|
-
puppeteer-core/lib/esm/puppeteer/
|
|
20014
|
+
puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.js:
|
|
19920
20015
|
(**
|
|
19921
20016
|
* @license
|
|
19922
|
-
* Copyright
|
|
20017
|
+
* Copyright 2020 Google Inc.
|
|
19923
20018
|
* SPDX-License-Identifier: Apache-2.0
|
|
19924
20019
|
*)
|
|
19925
20020
|
|
|
19926
|
-
puppeteer-core/lib/esm/puppeteer/common/
|
|
20021
|
+
puppeteer-core/lib/esm/puppeteer/common/FileChooser.js:
|
|
19927
20022
|
(**
|
|
19928
20023
|
* @license
|
|
19929
|
-
* Copyright
|
|
20024
|
+
* Copyright 2020 Google Inc.
|
|
19930
20025
|
* SPDX-License-Identifier: Apache-2.0
|
|
19931
20026
|
*)
|
|
19932
20027
|
|
|
19933
|
-
puppeteer-core/lib/esm/puppeteer/
|
|
20028
|
+
puppeteer-core/lib/esm/puppeteer/common/NetworkManagerEvents.js:
|
|
19934
20029
|
(**
|
|
19935
20030
|
* @license
|
|
19936
|
-
* Copyright
|
|
20031
|
+
* Copyright 2022 Google Inc.
|
|
19937
20032
|
* SPDX-License-Identifier: Apache-2.0
|
|
19938
20033
|
*)
|
|
19939
20034
|
|
|
19940
|
-
puppeteer-core/lib/esm/puppeteer/
|
|
20035
|
+
puppeteer-core/lib/esm/puppeteer/util/ErrorLike.js:
|
|
19941
20036
|
(**
|
|
19942
20037
|
* @license
|
|
19943
|
-
* Copyright
|
|
20038
|
+
* Copyright 2022 Google Inc.
|
|
19944
20039
|
* SPDX-License-Identifier: Apache-2.0
|
|
19945
20040
|
*)
|
|
19946
20041
|
|
|
19947
|
-
puppeteer-core/lib/esm/puppeteer/
|
|
20042
|
+
puppeteer-core/lib/esm/puppeteer/api/JSHandle.js:
|
|
19948
20043
|
(**
|
|
19949
20044
|
* @license
|
|
19950
20045
|
* Copyright 2023 Google Inc.
|
|
19951
20046
|
* SPDX-License-Identifier: Apache-2.0
|
|
19952
20047
|
*)
|
|
19953
20048
|
|
|
19954
|
-
puppeteer-core/lib/esm/puppeteer/
|
|
19955
|
-
(**
|
|
19956
|
-
* @license
|
|
19957
|
-
* Copyright 2017 Google Inc.
|
|
19958
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
19959
|
-
*)
|
|
19960
|
-
|
|
19961
|
-
puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.js:
|
|
19962
|
-
(**
|
|
19963
|
-
* @license
|
|
19964
|
-
* Copyright 2020 Google Inc.
|
|
19965
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
19966
|
-
*)
|
|
19967
|
-
|
|
19968
|
-
puppeteer-core/lib/esm/puppeteer/common/FileChooser.js:
|
|
20049
|
+
puppeteer-core/lib/esm/puppeteer/cdp/Binding.js:
|
|
19969
20050
|
(**
|
|
19970
20051
|
* @license
|
|
19971
|
-
* Copyright
|
|
20052
|
+
* Copyright 2024 Google Inc.
|
|
19972
20053
|
* SPDX-License-Identifier: Apache-2.0
|
|
19973
20054
|
*)
|
|
19974
20055
|
|
|
19975
|
-
puppeteer-core/lib/esm/puppeteer/
|
|
20056
|
+
puppeteer-core/lib/esm/puppeteer/util/incremental-id-generator.js:
|
|
19976
20057
|
(**
|
|
19977
20058
|
* @license
|
|
19978
|
-
* Copyright
|
|
20059
|
+
* Copyright 2024 Google Inc.
|
|
19979
20060
|
* SPDX-License-Identifier: Apache-2.0
|
|
19980
20061
|
*)
|
|
19981
20062
|
|
|
19982
|
-
puppeteer-core/lib/esm/puppeteer/
|
|
20063
|
+
puppeteer-core/lib/esm/puppeteer/common/CallbackRegistry.js:
|
|
19983
20064
|
(**
|
|
19984
20065
|
* @license
|
|
19985
20066
|
* Copyright 2023 Google Inc.
|
|
19986
20067
|
* SPDX-License-Identifier: Apache-2.0
|
|
19987
20068
|
*)
|
|
19988
20069
|
|
|
19989
|
-
puppeteer-core/lib/esm/puppeteer/cdp/
|
|
20070
|
+
puppeteer-core/lib/esm/puppeteer/cdp/CDPSession.js:
|
|
19990
20071
|
(**
|
|
19991
20072
|
* @license
|
|
19992
|
-
* Copyright
|
|
20073
|
+
* Copyright 2017 Google Inc.
|
|
19993
20074
|
* SPDX-License-Identifier: Apache-2.0
|
|
19994
20075
|
*)
|
|
19995
20076
|
|
|
@@ -20308,6 +20389,13 @@ puppeteer-core/lib/esm/puppeteer/cdp/Input.js:
|
|
|
20308
20389
|
* SPDX-License-Identifier: Apache-2.0
|
|
20309
20390
|
*)
|
|
20310
20391
|
|
|
20392
|
+
puppeteer-core/lib/esm/puppeteer/api/Target.js:
|
|
20393
|
+
(**
|
|
20394
|
+
* @license
|
|
20395
|
+
* Copyright 2023 Google Inc.
|
|
20396
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
20397
|
+
*)
|
|
20398
|
+
|
|
20311
20399
|
puppeteer-core/lib/esm/puppeteer/api/WebWorker.js:
|
|
20312
20400
|
(**
|
|
20313
20401
|
* @license
|
|
@@ -20322,6 +20410,13 @@ puppeteer-core/lib/esm/puppeteer/cdp/Page.js:
|
|
|
20322
20410
|
* SPDX-License-Identifier: Apache-2.0
|
|
20323
20411
|
*)
|
|
20324
20412
|
|
|
20413
|
+
puppeteer-core/lib/esm/puppeteer/cdp/BrowserContext.js:
|
|
20414
|
+
(**
|
|
20415
|
+
* @license
|
|
20416
|
+
* Copyright 2024 Google Inc.
|
|
20417
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
20418
|
+
*)
|
|
20419
|
+
|
|
20325
20420
|
puppeteer-core/lib/esm/puppeteer/cdp/Target.js:
|
|
20326
20421
|
(**
|
|
20327
20422
|
* @license
|