@browserless.io/browserless 2.16.0-beta-1 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -1
- package/build/logger.js +1 -1
- package/build/routes/chrome/http/content.post.body.json +8 -8
- package/build/routes/chrome/http/pdf.post.body.json +13 -9
- package/build/routes/chrome/http/scrape.post.body.json +8 -8
- package/build/routes/chrome/http/screenshot.post.body.json +8 -8
- package/build/routes/chromium/http/content.post.body.json +8 -8
- package/build/routes/chromium/http/pdf.post.body.json +13 -9
- package/build/routes/chromium/http/scrape.post.body.json +8 -8
- package/build/routes/chromium/http/screenshot.post.body.json +8 -8
- package/package.json +5 -5
- package/src/logger.ts +1 -1
- package/static/docs/swagger.json +15 -11
- package/static/docs/swagger.min.json +14 -10
- package/static/function/client.js +446 -163
- package/static/function/index.html +446 -163
|
@@ -16841,7 +16841,8 @@
|
|
|
16841
16841
|
preferCSSPageSize: false,
|
|
16842
16842
|
omitBackground: false,
|
|
16843
16843
|
outline: false,
|
|
16844
|
-
tagged: true
|
|
16844
|
+
tagged: true,
|
|
16845
|
+
waitForFonts: true
|
|
16845
16846
|
};
|
|
16846
16847
|
let width = 8.5;
|
|
16847
16848
|
let height = 11;
|
|
@@ -17525,17 +17526,20 @@
|
|
|
17525
17526
|
Mutex = class _Mutex {
|
|
17526
17527
|
static Guard = class Guard {
|
|
17527
17528
|
#mutex;
|
|
17528
|
-
|
|
17529
|
+
#onRelease;
|
|
17530
|
+
constructor(mutex, onRelease) {
|
|
17529
17531
|
this.#mutex = mutex;
|
|
17532
|
+
this.#onRelease = onRelease;
|
|
17530
17533
|
}
|
|
17531
17534
|
[disposeSymbol]() {
|
|
17535
|
+
this.#onRelease?.();
|
|
17532
17536
|
return this.#mutex.release();
|
|
17533
17537
|
}
|
|
17534
17538
|
};
|
|
17535
17539
|
#locked = false;
|
|
17536
17540
|
#acquirers = [];
|
|
17537
17541
|
// This is FIFO.
|
|
17538
|
-
async acquire() {
|
|
17542
|
+
async acquire(onRelease) {
|
|
17539
17543
|
if (!this.#locked) {
|
|
17540
17544
|
this.#locked = true;
|
|
17541
17545
|
return new _Mutex.Guard(this);
|
|
@@ -17543,7 +17547,7 @@
|
|
|
17543
17547
|
const deferred = Deferred.create();
|
|
17544
17548
|
this.#acquirers.push(deferred.resolve.bind(deferred));
|
|
17545
17549
|
await deferred.valueOrThrow();
|
|
17546
|
-
return new _Mutex.Guard(this);
|
|
17550
|
+
return new _Mutex.Guard(this, onRelease);
|
|
17547
17551
|
}
|
|
17548
17552
|
release() {
|
|
17549
17553
|
const resolve3 = this.#acquirers.shift();
|
|
@@ -17643,27 +17647,27 @@
|
|
|
17643
17647
|
mutex = new Mutex();
|
|
17644
17648
|
mutexes.set(key, mutex);
|
|
17645
17649
|
}
|
|
17646
|
-
const _5 =
|
|
17650
|
+
const _5 = __addDisposableResource2(env_1, await mutex.acquire(), true);
|
|
17647
17651
|
return await target.call(this, ...args);
|
|
17648
17652
|
} catch (e_1) {
|
|
17649
17653
|
env_1.error = e_1;
|
|
17650
17654
|
env_1.hasError = true;
|
|
17651
17655
|
} finally {
|
|
17652
|
-
const result_1 =
|
|
17656
|
+
const result_1 = __disposeResources2(env_1);
|
|
17653
17657
|
if (result_1)
|
|
17654
17658
|
await result_1;
|
|
17655
17659
|
}
|
|
17656
17660
|
};
|
|
17657
17661
|
};
|
|
17658
17662
|
}
|
|
17659
|
-
var
|
|
17663
|
+
var __addDisposableResource2, __disposeResources2, instances;
|
|
17660
17664
|
var init_decorators = __esm({
|
|
17661
17665
|
"node_modules/puppeteer-core/lib/esm/puppeteer/util/decorators.js"() {
|
|
17662
17666
|
init_dirname();
|
|
17663
17667
|
init_buffer2();
|
|
17664
17668
|
init_disposable();
|
|
17665
17669
|
init_Mutex();
|
|
17666
|
-
|
|
17670
|
+
__addDisposableResource2 = function(env, value, async2) {
|
|
17667
17671
|
if (value !== null && value !== void 0) {
|
|
17668
17672
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
17669
17673
|
var dispose;
|
|
@@ -17682,7 +17686,7 @@
|
|
|
17682
17686
|
}
|
|
17683
17687
|
return value;
|
|
17684
17688
|
};
|
|
17685
|
-
|
|
17689
|
+
__disposeResources2 = /* @__PURE__ */ function(SuppressedError2) {
|
|
17686
17690
|
return function(env) {
|
|
17687
17691
|
function fail2(e9) {
|
|
17688
17692
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -18134,6 +18138,7 @@
|
|
|
18134
18138
|
init_EventEmitter();
|
|
18135
18139
|
init_util2();
|
|
18136
18140
|
init_disposable();
|
|
18141
|
+
init_Mutex();
|
|
18137
18142
|
var BrowserContext = class extends EventEmitter2 {
|
|
18138
18143
|
/**
|
|
18139
18144
|
* @internal
|
|
@@ -18141,6 +18146,31 @@
|
|
|
18141
18146
|
constructor() {
|
|
18142
18147
|
super();
|
|
18143
18148
|
}
|
|
18149
|
+
/**
|
|
18150
|
+
* If defined, indicates an ongoing screenshot opereation.
|
|
18151
|
+
*/
|
|
18152
|
+
#pageScreenshotMutex;
|
|
18153
|
+
#screenshotOperationsCount = 0;
|
|
18154
|
+
/**
|
|
18155
|
+
* @internal
|
|
18156
|
+
*/
|
|
18157
|
+
startScreenshot() {
|
|
18158
|
+
const mutex = this.#pageScreenshotMutex || new Mutex();
|
|
18159
|
+
this.#pageScreenshotMutex = mutex;
|
|
18160
|
+
this.#screenshotOperationsCount++;
|
|
18161
|
+
return mutex.acquire(() => {
|
|
18162
|
+
this.#screenshotOperationsCount--;
|
|
18163
|
+
if (this.#screenshotOperationsCount === 0) {
|
|
18164
|
+
this.#pageScreenshotMutex = void 0;
|
|
18165
|
+
}
|
|
18166
|
+
});
|
|
18167
|
+
}
|
|
18168
|
+
/**
|
|
18169
|
+
* @internal
|
|
18170
|
+
*/
|
|
18171
|
+
waitForScreenshotOperations() {
|
|
18172
|
+
return this.#pageScreenshotMutex?.acquire();
|
|
18173
|
+
}
|
|
18144
18174
|
/**
|
|
18145
18175
|
* Waits until a {@link Target | target} matching the given `predicate`
|
|
18146
18176
|
* appears and returns it.
|
|
@@ -18192,6 +18222,52 @@
|
|
|
18192
18222
|
|
|
18193
18223
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/BrowserContext.js
|
|
18194
18224
|
init_assert();
|
|
18225
|
+
var __addDisposableResource = function(env, value, async2) {
|
|
18226
|
+
if (value !== null && value !== void 0) {
|
|
18227
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
18228
|
+
var dispose;
|
|
18229
|
+
if (async2) {
|
|
18230
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
18231
|
+
dispose = value[Symbol.asyncDispose];
|
|
18232
|
+
}
|
|
18233
|
+
if (dispose === void 0) {
|
|
18234
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
18235
|
+
dispose = value[Symbol.dispose];
|
|
18236
|
+
}
|
|
18237
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
18238
|
+
env.stack.push({ value, dispose, async: async2 });
|
|
18239
|
+
} else if (async2) {
|
|
18240
|
+
env.stack.push({ async: true });
|
|
18241
|
+
}
|
|
18242
|
+
return value;
|
|
18243
|
+
};
|
|
18244
|
+
var __disposeResources = /* @__PURE__ */ function(SuppressedError2) {
|
|
18245
|
+
return function(env) {
|
|
18246
|
+
function fail2(e9) {
|
|
18247
|
+
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
18248
|
+
env.hasError = true;
|
|
18249
|
+
}
|
|
18250
|
+
function next() {
|
|
18251
|
+
while (env.stack.length) {
|
|
18252
|
+
var rec = env.stack.pop();
|
|
18253
|
+
try {
|
|
18254
|
+
var result = rec.dispose && rec.dispose.call(rec.value);
|
|
18255
|
+
if (rec.async) return Promise.resolve(result).then(next, function(e9) {
|
|
18256
|
+
fail2(e9);
|
|
18257
|
+
return next();
|
|
18258
|
+
});
|
|
18259
|
+
} catch (e9) {
|
|
18260
|
+
fail2(e9);
|
|
18261
|
+
}
|
|
18262
|
+
}
|
|
18263
|
+
if (env.hasError) throw env.error;
|
|
18264
|
+
}
|
|
18265
|
+
return next();
|
|
18266
|
+
};
|
|
18267
|
+
}(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
18268
|
+
var e9 = new Error(message);
|
|
18269
|
+
return e9.name = "SuppressedError", e9.error = error, e9.suppressed = suppressed, e9;
|
|
18270
|
+
});
|
|
18195
18271
|
var CdpBrowserContext = class extends BrowserContext {
|
|
18196
18272
|
#connection;
|
|
18197
18273
|
#browser;
|
|
@@ -18242,8 +18318,17 @@
|
|
|
18242
18318
|
browserContextId: this.#id || void 0
|
|
18243
18319
|
});
|
|
18244
18320
|
}
|
|
18245
|
-
newPage() {
|
|
18246
|
-
|
|
18321
|
+
async newPage() {
|
|
18322
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
18323
|
+
try {
|
|
18324
|
+
const _guard = __addDisposableResource(env_1, await this.waitForScreenshotOperations(), false);
|
|
18325
|
+
return await this.#browser._createPageInContext(this.#id);
|
|
18326
|
+
} catch (e_1) {
|
|
18327
|
+
env_1.error = e_1;
|
|
18328
|
+
env_1.hasError = true;
|
|
18329
|
+
} finally {
|
|
18330
|
+
__disposeResources(env_1);
|
|
18331
|
+
}
|
|
18247
18332
|
}
|
|
18248
18333
|
browser() {
|
|
18249
18334
|
return this.#browser;
|
|
@@ -18604,7 +18689,7 @@
|
|
|
18604
18689
|
init_rxjs();
|
|
18605
18690
|
init_EventEmitter();
|
|
18606
18691
|
init_util2();
|
|
18607
|
-
var
|
|
18692
|
+
var __addDisposableResource3 = function(env, value, async2) {
|
|
18608
18693
|
if (value !== null && value !== void 0) {
|
|
18609
18694
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
18610
18695
|
var dispose;
|
|
@@ -18623,7 +18708,7 @@
|
|
|
18623
18708
|
}
|
|
18624
18709
|
return value;
|
|
18625
18710
|
};
|
|
18626
|
-
var
|
|
18711
|
+
var __disposeResources3 = /* @__PURE__ */ function(SuppressedError2) {
|
|
18627
18712
|
return function(env) {
|
|
18628
18713
|
function fail2(e9) {
|
|
18629
18714
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -19008,13 +19093,13 @@
|
|
|
19008
19093
|
async wait(options) {
|
|
19009
19094
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
19010
19095
|
try {
|
|
19011
|
-
const handle =
|
|
19096
|
+
const handle = __addDisposableResource3(env_1, await this.waitHandle(options), false);
|
|
19012
19097
|
return await handle.jsonValue();
|
|
19013
19098
|
} catch (e_1) {
|
|
19014
19099
|
env_1.error = e_1;
|
|
19015
19100
|
env_1.hasError = true;
|
|
19016
19101
|
} finally {
|
|
19017
|
-
|
|
19102
|
+
__disposeResources3(env_1);
|
|
19018
19103
|
}
|
|
19019
19104
|
}
|
|
19020
19105
|
/**
|
|
@@ -19301,7 +19386,7 @@
|
|
|
19301
19386
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
19302
19387
|
done = true;
|
|
19303
19388
|
};
|
|
19304
|
-
var
|
|
19389
|
+
var __addDisposableResource4 = function(env, value, async2) {
|
|
19305
19390
|
if (value !== null && value !== void 0) {
|
|
19306
19391
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
19307
19392
|
var dispose;
|
|
@@ -19320,7 +19405,7 @@
|
|
|
19320
19405
|
}
|
|
19321
19406
|
return value;
|
|
19322
19407
|
};
|
|
19323
|
-
var
|
|
19408
|
+
var __disposeResources4 = /* @__PURE__ */ function(SuppressedError2) {
|
|
19324
19409
|
return function(env) {
|
|
19325
19410
|
function fail2(e9) {
|
|
19326
19411
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -20193,7 +20278,7 @@
|
|
|
20193
20278
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
20194
20279
|
try {
|
|
20195
20280
|
const viewport = this.viewport();
|
|
20196
|
-
const stack =
|
|
20281
|
+
const stack = __addDisposableResource4(env_1, new DisposableStack(), false);
|
|
20197
20282
|
if (viewport && viewport.deviceScaleFactor !== 0) {
|
|
20198
20283
|
await this.setViewport({ ...viewport, deviceScaleFactor: 0 });
|
|
20199
20284
|
stack.defer(() => {
|
|
@@ -20211,12 +20296,13 @@
|
|
|
20211
20296
|
env_1.error = e_1;
|
|
20212
20297
|
env_1.hasError = true;
|
|
20213
20298
|
} finally {
|
|
20214
|
-
|
|
20299
|
+
__disposeResources4(env_1);
|
|
20215
20300
|
}
|
|
20216
20301
|
}
|
|
20217
20302
|
async screenshot(userOptions = {}) {
|
|
20218
20303
|
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
20219
20304
|
try {
|
|
20305
|
+
const _guard = __addDisposableResource4(env_2, await this.browserContext().startScreenshot(), false);
|
|
20220
20306
|
await this.bringToFront();
|
|
20221
20307
|
const options = {
|
|
20222
20308
|
...userOptions,
|
|
@@ -20241,7 +20327,7 @@
|
|
|
20241
20327
|
}
|
|
20242
20328
|
}
|
|
20243
20329
|
if (options.quality !== void 0) {
|
|
20244
|
-
if (options.quality < 0
|
|
20330
|
+
if (options.quality < 0 || options.quality > 100) {
|
|
20245
20331
|
throw new Error(`Expected 'quality' (${options.quality}) to be between 0 and 100, inclusive.`);
|
|
20246
20332
|
}
|
|
20247
20333
|
if (options.type === void 0 || !["jpeg", "webp"].includes(options.type)) {
|
|
@@ -20257,7 +20343,7 @@
|
|
|
20257
20343
|
}
|
|
20258
20344
|
}
|
|
20259
20345
|
setDefaultScreenshotOptions(options);
|
|
20260
|
-
const stack =
|
|
20346
|
+
const stack = __addDisposableResource4(env_2, new AsyncDisposableStack(), true);
|
|
20261
20347
|
if (options.clip) {
|
|
20262
20348
|
if (options.fullPage) {
|
|
20263
20349
|
throw new Error("'clip' and 'fullPage' are mutually exclusive");
|
|
@@ -20297,7 +20383,7 @@
|
|
|
20297
20383
|
env_2.error = e_2;
|
|
20298
20384
|
env_2.hasError = true;
|
|
20299
20385
|
} finally {
|
|
20300
|
-
const result_1 =
|
|
20386
|
+
const result_1 = __disposeResources4(env_2);
|
|
20301
20387
|
if (result_1)
|
|
20302
20388
|
await result_1;
|
|
20303
20389
|
}
|
|
@@ -20774,7 +20860,7 @@
|
|
|
20774
20860
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
20775
20861
|
done = true;
|
|
20776
20862
|
};
|
|
20777
|
-
var
|
|
20863
|
+
var __addDisposableResource5 = function(env, value, async2) {
|
|
20778
20864
|
if (value !== null && value !== void 0) {
|
|
20779
20865
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
20780
20866
|
var dispose;
|
|
@@ -20793,7 +20879,7 @@
|
|
|
20793
20879
|
}
|
|
20794
20880
|
return value;
|
|
20795
20881
|
};
|
|
20796
|
-
var
|
|
20882
|
+
var __disposeResources5 = /* @__PURE__ */ function(SuppressedError2) {
|
|
20797
20883
|
return function(env) {
|
|
20798
20884
|
function fail2(e9) {
|
|
20799
20885
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -20906,7 +20992,7 @@
|
|
|
20906
20992
|
for (const [key, value] of Object.entries(propertyNames)) {
|
|
20907
20993
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
20908
20994
|
try {
|
|
20909
|
-
const handle =
|
|
20995
|
+
const handle = __addDisposableResource5(env_1, results[key], false);
|
|
20910
20996
|
if (handle) {
|
|
20911
20997
|
map2.set(value, handle.move());
|
|
20912
20998
|
}
|
|
@@ -20914,7 +21000,7 @@
|
|
|
20914
21000
|
env_1.error = e_1;
|
|
20915
21001
|
env_1.hasError = true;
|
|
20916
21002
|
} finally {
|
|
20917
|
-
|
|
21003
|
+
__disposeResources5(env_1);
|
|
20918
21004
|
}
|
|
20919
21005
|
}
|
|
20920
21006
|
return map2;
|
|
@@ -20934,7 +21020,7 @@
|
|
|
20934
21020
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Binding.js
|
|
20935
21021
|
init_util2();
|
|
20936
21022
|
init_disposable();
|
|
20937
|
-
var
|
|
21023
|
+
var __addDisposableResource6 = function(env, value, async2) {
|
|
20938
21024
|
if (value !== null && value !== void 0) {
|
|
20939
21025
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
20940
21026
|
var dispose;
|
|
@@ -20953,7 +21039,7 @@
|
|
|
20953
21039
|
}
|
|
20954
21040
|
return value;
|
|
20955
21041
|
};
|
|
20956
|
-
var
|
|
21042
|
+
var __disposeResources6 = /* @__PURE__ */ function(SuppressedError2) {
|
|
20957
21043
|
return function(env) {
|
|
20958
21044
|
function fail2(e9) {
|
|
20959
21045
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -20983,13 +21069,18 @@
|
|
|
20983
21069
|
var Binding = class {
|
|
20984
21070
|
#name;
|
|
20985
21071
|
#fn;
|
|
20986
|
-
|
|
21072
|
+
#initSource;
|
|
21073
|
+
constructor(name2, fn, initSource) {
|
|
20987
21074
|
this.#name = name2;
|
|
20988
21075
|
this.#fn = fn;
|
|
21076
|
+
this.#initSource = initSource;
|
|
20989
21077
|
}
|
|
20990
21078
|
get name() {
|
|
20991
21079
|
return this.#name;
|
|
20992
21080
|
}
|
|
21081
|
+
get initSource() {
|
|
21082
|
+
return this.#initSource;
|
|
21083
|
+
}
|
|
20993
21084
|
/**
|
|
20994
21085
|
* @param context - Context to run the binding in; the context should have
|
|
20995
21086
|
* the binding added to it beforehand.
|
|
@@ -21003,7 +21094,7 @@
|
|
|
21003
21094
|
if (!isTrivial) {
|
|
21004
21095
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
21005
21096
|
try {
|
|
21006
|
-
const handles =
|
|
21097
|
+
const handles = __addDisposableResource6(env_1, await context2.evaluateHandle((name2, seq) => {
|
|
21007
21098
|
return globalThis[name2].args.get(seq);
|
|
21008
21099
|
}, this.#name, id), false);
|
|
21009
21100
|
const properties = await handles.getProperties();
|
|
@@ -21024,7 +21115,7 @@
|
|
|
21024
21115
|
env_1.error = e_1;
|
|
21025
21116
|
env_1.hasError = true;
|
|
21026
21117
|
} finally {
|
|
21027
|
-
|
|
21118
|
+
__disposeResources6(env_1);
|
|
21028
21119
|
}
|
|
21029
21120
|
}
|
|
21030
21121
|
await context2.evaluate((name2, seq, result) => {
|
|
@@ -22154,6 +22245,9 @@
|
|
|
22154
22245
|
getAvailableTargets() {
|
|
22155
22246
|
return this.#availableTargetsByTargetId;
|
|
22156
22247
|
}
|
|
22248
|
+
getChildTargets(_target) {
|
|
22249
|
+
return /* @__PURE__ */ new Set();
|
|
22250
|
+
}
|
|
22157
22251
|
dispose() {
|
|
22158
22252
|
this.#connection.off("Target.targetCreated", this.#onTargetCreated);
|
|
22159
22253
|
this.#connection.off("Target.targetDestroyed", this.#onTargetDestroyed);
|
|
@@ -22298,7 +22392,7 @@
|
|
|
22298
22392
|
init_dirname();
|
|
22299
22393
|
init_buffer2();
|
|
22300
22394
|
init_disposable();
|
|
22301
|
-
var
|
|
22395
|
+
var __addDisposableResource7 = function(env, value, async2) {
|
|
22302
22396
|
if (value !== null && value !== void 0) {
|
|
22303
22397
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
22304
22398
|
var dispose;
|
|
@@ -22317,7 +22411,7 @@
|
|
|
22317
22411
|
}
|
|
22318
22412
|
return value;
|
|
22319
22413
|
};
|
|
22320
|
-
var
|
|
22414
|
+
var __disposeResources7 = /* @__PURE__ */ function(SuppressedError2) {
|
|
22321
22415
|
return function(env) {
|
|
22322
22416
|
function fail2(e9) {
|
|
22323
22417
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -22348,7 +22442,7 @@
|
|
|
22348
22442
|
async function* fastTransposeIteratorHandle(iterator2, size) {
|
|
22349
22443
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
22350
22444
|
try {
|
|
22351
|
-
const array =
|
|
22445
|
+
const array = __addDisposableResource7(env_1, await iterator2.evaluateHandle(async (iterator3, size2) => {
|
|
22352
22446
|
const results = [];
|
|
22353
22447
|
while (results.length < size2) {
|
|
22354
22448
|
const result = await iterator3.next();
|
|
@@ -22361,18 +22455,18 @@
|
|
|
22361
22455
|
}, size), false);
|
|
22362
22456
|
const properties = await array.getProperties();
|
|
22363
22457
|
const handles = properties.values();
|
|
22364
|
-
const stack =
|
|
22458
|
+
const stack = __addDisposableResource7(env_1, new DisposableStack(), false);
|
|
22365
22459
|
stack.defer(() => {
|
|
22366
22460
|
for (const handle_1 of handles) {
|
|
22367
22461
|
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
22368
22462
|
try {
|
|
22369
|
-
const handle =
|
|
22463
|
+
const handle = __addDisposableResource7(env_2, handle_1, false);
|
|
22370
22464
|
handle[disposeSymbol]();
|
|
22371
22465
|
} catch (e_2) {
|
|
22372
22466
|
env_2.error = e_2;
|
|
22373
22467
|
env_2.hasError = true;
|
|
22374
22468
|
} finally {
|
|
22375
|
-
|
|
22469
|
+
__disposeResources7(env_2);
|
|
22376
22470
|
}
|
|
22377
22471
|
}
|
|
22378
22472
|
});
|
|
@@ -22382,7 +22476,7 @@
|
|
|
22382
22476
|
env_1.error = e_1;
|
|
22383
22477
|
env_1.hasError = true;
|
|
22384
22478
|
} finally {
|
|
22385
|
-
|
|
22479
|
+
__disposeResources7(env_1);
|
|
22386
22480
|
}
|
|
22387
22481
|
}
|
|
22388
22482
|
async function* transposeIteratorHandle(iterator2) {
|
|
@@ -22394,7 +22488,7 @@
|
|
|
22394
22488
|
async function* transposeIterableHandle(handle) {
|
|
22395
22489
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
22396
22490
|
try {
|
|
22397
|
-
const generatorHandle =
|
|
22491
|
+
const generatorHandle = __addDisposableResource7(env_3, await handle.evaluateHandle((iterable) => {
|
|
22398
22492
|
return async function* () {
|
|
22399
22493
|
yield* iterable;
|
|
22400
22494
|
}();
|
|
@@ -22404,7 +22498,7 @@
|
|
|
22404
22498
|
env_3.error = e_3;
|
|
22405
22499
|
env_3.hasError = true;
|
|
22406
22500
|
} finally {
|
|
22407
|
-
|
|
22501
|
+
__disposeResources7(env_3);
|
|
22408
22502
|
}
|
|
22409
22503
|
}
|
|
22410
22504
|
|
|
@@ -22425,7 +22519,7 @@
|
|
|
22425
22519
|
};
|
|
22426
22520
|
|
|
22427
22521
|
// node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.js
|
|
22428
|
-
var
|
|
22522
|
+
var __addDisposableResource8 = function(env, value, async2) {
|
|
22429
22523
|
if (value !== null && value !== void 0) {
|
|
22430
22524
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
22431
22525
|
var dispose;
|
|
@@ -22444,7 +22538,7 @@
|
|
|
22444
22538
|
}
|
|
22445
22539
|
return value;
|
|
22446
22540
|
};
|
|
22447
|
-
var
|
|
22541
|
+
var __disposeResources8 = /* @__PURE__ */ function(SuppressedError2) {
|
|
22448
22542
|
return function(env) {
|
|
22449
22543
|
function fail2(e9) {
|
|
22450
22544
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -22518,7 +22612,7 @@
|
|
|
22518
22612
|
static async *queryAll(element, selector) {
|
|
22519
22613
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
22520
22614
|
try {
|
|
22521
|
-
const handle =
|
|
22615
|
+
const handle = __addDisposableResource8(env_1, await element.evaluateHandle(this._querySelectorAll, selector, LazyArg.create((context2) => {
|
|
22522
22616
|
return context2.puppeteerUtil;
|
|
22523
22617
|
})), false);
|
|
22524
22618
|
yield* transposeIterableHandle(handle);
|
|
@@ -22526,7 +22620,7 @@
|
|
|
22526
22620
|
env_1.error = e_1;
|
|
22527
22621
|
env_1.hasError = true;
|
|
22528
22622
|
} finally {
|
|
22529
|
-
|
|
22623
|
+
__disposeResources8(env_1);
|
|
22530
22624
|
}
|
|
22531
22625
|
}
|
|
22532
22626
|
/**
|
|
@@ -22537,7 +22631,7 @@
|
|
|
22537
22631
|
static async queryOne(element, selector) {
|
|
22538
22632
|
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
22539
22633
|
try {
|
|
22540
|
-
const result =
|
|
22634
|
+
const result = __addDisposableResource8(env_2, await element.evaluateHandle(this._querySelector, selector, LazyArg.create((context2) => {
|
|
22541
22635
|
return context2.puppeteerUtil;
|
|
22542
22636
|
})), false);
|
|
22543
22637
|
if (!(_isElementHandle in result)) {
|
|
@@ -22548,7 +22642,7 @@
|
|
|
22548
22642
|
env_2.error = e_2;
|
|
22549
22643
|
env_2.hasError = true;
|
|
22550
22644
|
} finally {
|
|
22551
|
-
|
|
22645
|
+
__disposeResources8(env_2);
|
|
22552
22646
|
}
|
|
22553
22647
|
}
|
|
22554
22648
|
/**
|
|
@@ -22562,7 +22656,7 @@
|
|
|
22562
22656
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
22563
22657
|
try {
|
|
22564
22658
|
let frame;
|
|
22565
|
-
const element =
|
|
22659
|
+
const element = __addDisposableResource8(env_3, await (async () => {
|
|
22566
22660
|
if (!(_isElementHandle in elementOrFrame)) {
|
|
22567
22661
|
frame = elementOrFrame;
|
|
22568
22662
|
return;
|
|
@@ -22576,7 +22670,7 @@
|
|
|
22576
22670
|
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
22577
22671
|
try {
|
|
22578
22672
|
signal?.throwIfAborted();
|
|
22579
|
-
const handle =
|
|
22673
|
+
const handle = __addDisposableResource8(env_4, await frame.isolatedRealm().waitForFunction(async (PuppeteerUtil, query, selector2, root, visible2) => {
|
|
22580
22674
|
const querySelector = PuppeteerUtil.createFunction(query);
|
|
22581
22675
|
const node = await querySelector(root ?? document, selector2, PuppeteerUtil);
|
|
22582
22676
|
return PuppeteerUtil.checkVisibility(node, visible2);
|
|
@@ -22599,7 +22693,7 @@
|
|
|
22599
22693
|
env_4.error = e_3;
|
|
22600
22694
|
env_4.hasError = true;
|
|
22601
22695
|
} finally {
|
|
22602
|
-
|
|
22696
|
+
__disposeResources8(env_4);
|
|
22603
22697
|
}
|
|
22604
22698
|
} catch (error) {
|
|
22605
22699
|
if (!isErrorLike(error)) {
|
|
@@ -22615,7 +22709,7 @@
|
|
|
22615
22709
|
env_3.error = e_4;
|
|
22616
22710
|
env_3.hasError = true;
|
|
22617
22711
|
} finally {
|
|
22618
|
-
|
|
22712
|
+
__disposeResources8(env_3);
|
|
22619
22713
|
}
|
|
22620
22714
|
}
|
|
22621
22715
|
};
|
|
@@ -23258,7 +23352,7 @@
|
|
|
23258
23352
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
23259
23353
|
done = true;
|
|
23260
23354
|
};
|
|
23261
|
-
var
|
|
23355
|
+
var __addDisposableResource9 = function(env, value, async2) {
|
|
23262
23356
|
if (value !== null && value !== void 0) {
|
|
23263
23357
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
23264
23358
|
var dispose;
|
|
@@ -23277,7 +23371,7 @@
|
|
|
23277
23371
|
}
|
|
23278
23372
|
return value;
|
|
23279
23373
|
};
|
|
23280
|
-
var
|
|
23374
|
+
var __disposeResources9 = /* @__PURE__ */ function(SuppressedError2) {
|
|
23281
23375
|
return function(env) {
|
|
23282
23376
|
function fail2(e9) {
|
|
23283
23377
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -23436,13 +23530,13 @@
|
|
|
23436
23530
|
if (!parentFrame) {
|
|
23437
23531
|
return null;
|
|
23438
23532
|
}
|
|
23439
|
-
const list =
|
|
23533
|
+
const list = __addDisposableResource9(env_1, await parentFrame.isolatedRealm().evaluateHandle(() => {
|
|
23440
23534
|
return document.querySelectorAll("iframe,frame");
|
|
23441
23535
|
}), false);
|
|
23442
23536
|
for await (const iframe_1 of transposeIterableHandle(list)) {
|
|
23443
23537
|
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
23444
23538
|
try {
|
|
23445
|
-
const iframe =
|
|
23539
|
+
const iframe = __addDisposableResource9(env_2, iframe_1, false);
|
|
23446
23540
|
const frame = await iframe.contentFrame();
|
|
23447
23541
|
if (frame?._id === this._id) {
|
|
23448
23542
|
return iframe.move();
|
|
@@ -23451,7 +23545,7 @@
|
|
|
23451
23545
|
env_2.error = e_1;
|
|
23452
23546
|
env_2.hasError = true;
|
|
23453
23547
|
} finally {
|
|
23454
|
-
|
|
23548
|
+
__disposeResources9(env_2);
|
|
23455
23549
|
}
|
|
23456
23550
|
}
|
|
23457
23551
|
return null;
|
|
@@ -23459,7 +23553,7 @@
|
|
|
23459
23553
|
env_1.error = e_2;
|
|
23460
23554
|
env_1.hasError = true;
|
|
23461
23555
|
} finally {
|
|
23462
|
-
|
|
23556
|
+
__disposeResources9(env_1);
|
|
23463
23557
|
}
|
|
23464
23558
|
}
|
|
23465
23559
|
/**
|
|
@@ -23865,7 +23959,7 @@
|
|
|
23865
23959
|
async click(selector, options = {}) {
|
|
23866
23960
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
23867
23961
|
try {
|
|
23868
|
-
const handle =
|
|
23962
|
+
const handle = __addDisposableResource9(env_3, await this.$(selector), false);
|
|
23869
23963
|
assert(handle, `No element found for selector: ${selector}`);
|
|
23870
23964
|
await handle.click(options);
|
|
23871
23965
|
await handle.dispose();
|
|
@@ -23873,7 +23967,7 @@
|
|
|
23873
23967
|
env_3.error = e_3;
|
|
23874
23968
|
env_3.hasError = true;
|
|
23875
23969
|
} finally {
|
|
23876
|
-
|
|
23970
|
+
__disposeResources9(env_3);
|
|
23877
23971
|
}
|
|
23878
23972
|
}
|
|
23879
23973
|
/**
|
|
@@ -23885,14 +23979,14 @@
|
|
|
23885
23979
|
async focus(selector) {
|
|
23886
23980
|
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
23887
23981
|
try {
|
|
23888
|
-
const handle =
|
|
23982
|
+
const handle = __addDisposableResource9(env_4, await this.$(selector), false);
|
|
23889
23983
|
assert(handle, `No element found for selector: ${selector}`);
|
|
23890
23984
|
await handle.focus();
|
|
23891
23985
|
} catch (e_4) {
|
|
23892
23986
|
env_4.error = e_4;
|
|
23893
23987
|
env_4.hasError = true;
|
|
23894
23988
|
} finally {
|
|
23895
|
-
|
|
23989
|
+
__disposeResources9(env_4);
|
|
23896
23990
|
}
|
|
23897
23991
|
}
|
|
23898
23992
|
/**
|
|
@@ -23905,14 +23999,14 @@
|
|
|
23905
23999
|
async hover(selector) {
|
|
23906
24000
|
const env_5 = { stack: [], error: void 0, hasError: false };
|
|
23907
24001
|
try {
|
|
23908
|
-
const handle =
|
|
24002
|
+
const handle = __addDisposableResource9(env_5, await this.$(selector), false);
|
|
23909
24003
|
assert(handle, `No element found for selector: ${selector}`);
|
|
23910
24004
|
await handle.hover();
|
|
23911
24005
|
} catch (e_5) {
|
|
23912
24006
|
env_5.error = e_5;
|
|
23913
24007
|
env_5.hasError = true;
|
|
23914
24008
|
} finally {
|
|
23915
|
-
|
|
24009
|
+
__disposeResources9(env_5);
|
|
23916
24010
|
}
|
|
23917
24011
|
}
|
|
23918
24012
|
/**
|
|
@@ -23936,14 +24030,14 @@
|
|
|
23936
24030
|
async select(selector, ...values) {
|
|
23937
24031
|
const env_6 = { stack: [], error: void 0, hasError: false };
|
|
23938
24032
|
try {
|
|
23939
|
-
const handle =
|
|
24033
|
+
const handle = __addDisposableResource9(env_6, await this.$(selector), false);
|
|
23940
24034
|
assert(handle, `No element found for selector: ${selector}`);
|
|
23941
24035
|
return await handle.select(...values);
|
|
23942
24036
|
} catch (e_6) {
|
|
23943
24037
|
env_6.error = e_6;
|
|
23944
24038
|
env_6.hasError = true;
|
|
23945
24039
|
} finally {
|
|
23946
|
-
|
|
24040
|
+
__disposeResources9(env_6);
|
|
23947
24041
|
}
|
|
23948
24042
|
}
|
|
23949
24043
|
/**
|
|
@@ -23955,14 +24049,14 @@
|
|
|
23955
24049
|
async tap(selector) {
|
|
23956
24050
|
const env_7 = { stack: [], error: void 0, hasError: false };
|
|
23957
24051
|
try {
|
|
23958
|
-
const handle =
|
|
24052
|
+
const handle = __addDisposableResource9(env_7, await this.$(selector), false);
|
|
23959
24053
|
assert(handle, `No element found for selector: ${selector}`);
|
|
23960
24054
|
await handle.tap();
|
|
23961
24055
|
} catch (e_7) {
|
|
23962
24056
|
env_7.error = e_7;
|
|
23963
24057
|
env_7.hasError = true;
|
|
23964
24058
|
} finally {
|
|
23965
|
-
|
|
24059
|
+
__disposeResources9(env_7);
|
|
23966
24060
|
}
|
|
23967
24061
|
}
|
|
23968
24062
|
/**
|
|
@@ -23989,14 +24083,14 @@
|
|
|
23989
24083
|
async type(selector, text, options) {
|
|
23990
24084
|
const env_8 = { stack: [], error: void 0, hasError: false };
|
|
23991
24085
|
try {
|
|
23992
|
-
const handle =
|
|
24086
|
+
const handle = __addDisposableResource9(env_8, await this.$(selector), false);
|
|
23993
24087
|
assert(handle, `No element found for selector: ${selector}`);
|
|
23994
24088
|
await handle.type(text, options);
|
|
23995
24089
|
} catch (e_8) {
|
|
23996
24090
|
env_8.error = e_8;
|
|
23997
24091
|
env_8.hasError = true;
|
|
23998
24092
|
} finally {
|
|
23999
|
-
|
|
24093
|
+
__disposeResources9(env_8);
|
|
24000
24094
|
}
|
|
24001
24095
|
}
|
|
24002
24096
|
/**
|
|
@@ -24017,6 +24111,40 @@
|
|
|
24017
24111
|
init_Deferred();
|
|
24018
24112
|
init_disposable();
|
|
24019
24113
|
|
|
24114
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/CdpPreloadScript.js
|
|
24115
|
+
init_dirname();
|
|
24116
|
+
init_buffer2();
|
|
24117
|
+
var CdpPreloadScript = class {
|
|
24118
|
+
/**
|
|
24119
|
+
* This is the ID of the preload script returned by
|
|
24120
|
+
* Page.addScriptToEvaluateOnNewDocument in the main frame.
|
|
24121
|
+
*
|
|
24122
|
+
* Sub-frames would get a different CDP ID because
|
|
24123
|
+
* addScriptToEvaluateOnNewDocument is called for each subframe. But
|
|
24124
|
+
* users only see this ID and subframe IDs are internal to Puppeteer.
|
|
24125
|
+
*/
|
|
24126
|
+
#id;
|
|
24127
|
+
#source;
|
|
24128
|
+
#frameToId = /* @__PURE__ */ new WeakMap();
|
|
24129
|
+
constructor(mainFrame, id, source2) {
|
|
24130
|
+
this.#id = id;
|
|
24131
|
+
this.#source = source2;
|
|
24132
|
+
this.#frameToId.set(mainFrame, id);
|
|
24133
|
+
}
|
|
24134
|
+
get id() {
|
|
24135
|
+
return this.#id;
|
|
24136
|
+
}
|
|
24137
|
+
get source() {
|
|
24138
|
+
return this.#source;
|
|
24139
|
+
}
|
|
24140
|
+
getIdForFrame(frame) {
|
|
24141
|
+
return this.#frameToId.get(frame);
|
|
24142
|
+
}
|
|
24143
|
+
setIdForFrame(frame, identifier) {
|
|
24144
|
+
this.#frameToId.set(frame, identifier);
|
|
24145
|
+
}
|
|
24146
|
+
};
|
|
24147
|
+
|
|
24020
24148
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/DeviceRequestPrompt.js
|
|
24021
24149
|
init_dirname();
|
|
24022
24150
|
init_buffer2();
|
|
@@ -24247,7 +24375,7 @@
|
|
|
24247
24375
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
24248
24376
|
done = true;
|
|
24249
24377
|
};
|
|
24250
|
-
var
|
|
24378
|
+
var __addDisposableResource10 = function(env, value, async2) {
|
|
24251
24379
|
if (value !== null && value !== void 0) {
|
|
24252
24380
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
24253
24381
|
var dispose;
|
|
@@ -24266,7 +24394,7 @@
|
|
|
24266
24394
|
}
|
|
24267
24395
|
return value;
|
|
24268
24396
|
};
|
|
24269
|
-
var
|
|
24397
|
+
var __disposeResources10 = /* @__PURE__ */ function(SuppressedError2) {
|
|
24270
24398
|
return function(env) {
|
|
24271
24399
|
function fail2(e9) {
|
|
24272
24400
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -24644,7 +24772,7 @@
|
|
|
24644
24772
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
24645
24773
|
try {
|
|
24646
24774
|
pageFunction = withSourcePuppeteerURLIfNone(this.$eval.name, pageFunction);
|
|
24647
|
-
const elementHandle =
|
|
24775
|
+
const elementHandle = __addDisposableResource10(env_1, await this.$(selector), false);
|
|
24648
24776
|
if (!elementHandle) {
|
|
24649
24777
|
throw new Error(`Error: failed to find element matching selector "${selector}"`);
|
|
24650
24778
|
}
|
|
@@ -24653,7 +24781,7 @@
|
|
|
24653
24781
|
env_1.error = e_1;
|
|
24654
24782
|
env_1.hasError = true;
|
|
24655
24783
|
} finally {
|
|
24656
|
-
|
|
24784
|
+
__disposeResources10(env_1);
|
|
24657
24785
|
}
|
|
24658
24786
|
}
|
|
24659
24787
|
/**
|
|
@@ -24708,7 +24836,7 @@
|
|
|
24708
24836
|
try {
|
|
24709
24837
|
pageFunction = withSourcePuppeteerURLIfNone(this.$$eval.name, pageFunction);
|
|
24710
24838
|
const results = await this.$$(selector);
|
|
24711
|
-
const elements =
|
|
24839
|
+
const elements = __addDisposableResource10(env_2, await this.evaluateHandle((_6, ...elements2) => {
|
|
24712
24840
|
return elements2;
|
|
24713
24841
|
}, ...results), false);
|
|
24714
24842
|
const [result] = await Promise.all([
|
|
@@ -24722,7 +24850,7 @@
|
|
|
24722
24850
|
env_2.error = e_2;
|
|
24723
24851
|
env_2.hasError = true;
|
|
24724
24852
|
} finally {
|
|
24725
|
-
|
|
24853
|
+
__disposeResources10(env_2);
|
|
24726
24854
|
}
|
|
24727
24855
|
}
|
|
24728
24856
|
/**
|
|
@@ -25102,7 +25230,7 @@
|
|
|
25102
25230
|
while (parentFrame = frame?.parentFrame()) {
|
|
25103
25231
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
25104
25232
|
try {
|
|
25105
|
-
const handle =
|
|
25233
|
+
const handle = __addDisposableResource10(env_3, await frame.frameElement(), false);
|
|
25106
25234
|
if (!handle) {
|
|
25107
25235
|
throw new Error("Unsupported frame type");
|
|
25108
25236
|
}
|
|
@@ -25130,7 +25258,7 @@
|
|
|
25130
25258
|
env_3.error = e_3;
|
|
25131
25259
|
env_3.hasError = true;
|
|
25132
25260
|
} finally {
|
|
25133
|
-
|
|
25261
|
+
__disposeResources10(env_3);
|
|
25134
25262
|
}
|
|
25135
25263
|
}
|
|
25136
25264
|
const box = boxes.find((box2) => {
|
|
@@ -25292,7 +25420,7 @@
|
|
|
25292
25420
|
while (parentFrame = frame?.parentFrame()) {
|
|
25293
25421
|
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
25294
25422
|
try {
|
|
25295
|
-
const handle =
|
|
25423
|
+
const handle = __addDisposableResource10(env_4, await frame.frameElement(), false);
|
|
25296
25424
|
if (!handle) {
|
|
25297
25425
|
throw new Error("Unsupported frame type");
|
|
25298
25426
|
}
|
|
@@ -25317,7 +25445,7 @@
|
|
|
25317
25445
|
env_4.error = e_4;
|
|
25318
25446
|
env_4.hasError = true;
|
|
25319
25447
|
} finally {
|
|
25320
|
-
|
|
25448
|
+
__disposeResources10(env_4);
|
|
25321
25449
|
}
|
|
25322
25450
|
}
|
|
25323
25451
|
return point;
|
|
@@ -25396,7 +25524,7 @@
|
|
|
25396
25524
|
try {
|
|
25397
25525
|
await this.assertConnectedElement();
|
|
25398
25526
|
const handle = await this.#asSVGElementHandle();
|
|
25399
|
-
const target =
|
|
25527
|
+
const target = __addDisposableResource10(env_5, handle && await handle.#getOwnerSVGElement(), false);
|
|
25400
25528
|
return await (target ?? this).evaluate(async (element, threshold) => {
|
|
25401
25529
|
const visibleRatio = await new Promise((resolve3) => {
|
|
25402
25530
|
const observer = new IntersectionObserver((entries) => {
|
|
@@ -25411,7 +25539,7 @@
|
|
|
25411
25539
|
env_5.error = e_5;
|
|
25412
25540
|
env_5.hasError = true;
|
|
25413
25541
|
} finally {
|
|
25414
|
-
|
|
25542
|
+
__disposeResources10(env_5);
|
|
25415
25543
|
}
|
|
25416
25544
|
}
|
|
25417
25545
|
/**
|
|
@@ -25571,9 +25699,8 @@
|
|
|
25571
25699
|
}
|
|
25572
25700
|
return remoteObject.value;
|
|
25573
25701
|
}
|
|
25574
|
-
function addPageBinding(type, name2) {
|
|
25575
|
-
|
|
25576
|
-
if (callCdp[Symbol.toStringTag] === "PuppeteerBinding") {
|
|
25702
|
+
function addPageBinding(type, name2, prefix) {
|
|
25703
|
+
if (globalThis[name2]) {
|
|
25577
25704
|
return;
|
|
25578
25705
|
}
|
|
25579
25706
|
Object.assign(globalThis, {
|
|
@@ -25584,7 +25711,7 @@
|
|
|
25584
25711
|
const seq = (callPuppeteer.lastSeq ?? 0) + 1;
|
|
25585
25712
|
callPuppeteer.lastSeq = seq;
|
|
25586
25713
|
callPuppeteer.args.set(seq, args);
|
|
25587
|
-
|
|
25714
|
+
globalThis[prefix + name2](JSON.stringify({
|
|
25588
25715
|
type,
|
|
25589
25716
|
name: name2,
|
|
25590
25717
|
seq,
|
|
@@ -25607,10 +25734,10 @@
|
|
|
25607
25734
|
});
|
|
25608
25735
|
}
|
|
25609
25736
|
});
|
|
25610
|
-
globalThis[name2][Symbol.toStringTag] = "PuppeteerBinding";
|
|
25611
25737
|
}
|
|
25738
|
+
var CDP_BINDING_PREFIX = "puppeteer_";
|
|
25612
25739
|
function pageBindingInitString(type, name2) {
|
|
25613
|
-
return evaluationString(addPageBinding, type, name2);
|
|
25740
|
+
return evaluationString(addPageBinding, type, name2, CDP_BINDING_PREFIX);
|
|
25614
25741
|
}
|
|
25615
25742
|
|
|
25616
25743
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/JSHandle.js
|
|
@@ -25872,7 +25999,7 @@
|
|
|
25872
25999
|
})();
|
|
25873
26000
|
|
|
25874
26001
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/ExecutionContext.js
|
|
25875
|
-
var
|
|
26002
|
+
var __addDisposableResource11 = function(env, value, async2) {
|
|
25876
26003
|
if (value !== null && value !== void 0) {
|
|
25877
26004
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
25878
26005
|
var dispose;
|
|
@@ -25891,7 +26018,7 @@
|
|
|
25891
26018
|
}
|
|
25892
26019
|
return value;
|
|
25893
26020
|
};
|
|
25894
|
-
var
|
|
26021
|
+
var __disposeResources11 = /* @__PURE__ */ function(SuppressedError2) {
|
|
25895
26022
|
return function(env) {
|
|
25896
26023
|
function fail2(e9) {
|
|
25897
26024
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -25918,13 +26045,23 @@
|
|
|
25918
26045
|
var e9 = new Error(message);
|
|
25919
26046
|
return e9.name = "SuppressedError", e9.error = error, e9.suppressed = suppressed, e9;
|
|
25920
26047
|
});
|
|
25921
|
-
var ariaQuerySelectorBinding = new Binding(
|
|
25922
|
-
|
|
25923
|
-
|
|
25924
|
-
|
|
25925
|
-
|
|
25926
|
-
|
|
25927
|
-
|
|
26048
|
+
var ariaQuerySelectorBinding = new Binding(
|
|
26049
|
+
"__ariaQuerySelector",
|
|
26050
|
+
ARIAQueryHandler.queryOne,
|
|
26051
|
+
""
|
|
26052
|
+
// custom init
|
|
26053
|
+
);
|
|
26054
|
+
var ariaQuerySelectorAllBinding = new Binding(
|
|
26055
|
+
"__ariaQuerySelectorAll",
|
|
26056
|
+
async (element, selector) => {
|
|
26057
|
+
const results = ARIAQueryHandler.queryAll(element, selector);
|
|
26058
|
+
return await element.realm.evaluateHandle((...elements) => {
|
|
26059
|
+
return elements;
|
|
26060
|
+
}, ...await AsyncIterableUtil.collect(results));
|
|
26061
|
+
},
|
|
26062
|
+
""
|
|
26063
|
+
// custom init
|
|
26064
|
+
);
|
|
25928
26065
|
var ExecutionContext = class extends EventEmitter2 {
|
|
25929
26066
|
#client;
|
|
25930
26067
|
#world;
|
|
@@ -25965,16 +26102,16 @@
|
|
|
25965
26102
|
if (this.#bindings.has(binding.name)) {
|
|
25966
26103
|
return;
|
|
25967
26104
|
}
|
|
25968
|
-
const _4 =
|
|
26105
|
+
const _4 = __addDisposableResource11(env_1, await this.#mutex.acquire(), false);
|
|
25969
26106
|
try {
|
|
25970
26107
|
await this.#client.send("Runtime.addBinding", this.#name ? {
|
|
25971
|
-
name: binding.name,
|
|
26108
|
+
name: CDP_BINDING_PREFIX + binding.name,
|
|
25972
26109
|
executionContextName: this.#name
|
|
25973
26110
|
} : {
|
|
25974
|
-
name: binding.name,
|
|
26111
|
+
name: CDP_BINDING_PREFIX + binding.name,
|
|
25975
26112
|
executionContextId: this.#id
|
|
25976
26113
|
});
|
|
25977
|
-
await this.evaluate(addPageBinding, "internal", binding.name);
|
|
26114
|
+
await this.evaluate(addPageBinding, "internal", binding.name, CDP_BINDING_PREFIX);
|
|
25978
26115
|
this.#bindings.set(binding.name, binding);
|
|
25979
26116
|
} catch (error) {
|
|
25980
26117
|
if (error instanceof Error) {
|
|
@@ -25991,7 +26128,7 @@
|
|
|
25991
26128
|
env_1.error = e_1;
|
|
25992
26129
|
env_1.hasError = true;
|
|
25993
26130
|
} finally {
|
|
25994
|
-
|
|
26131
|
+
__disposeResources11(env_1);
|
|
25995
26132
|
}
|
|
25996
26133
|
}
|
|
25997
26134
|
async #onBindingCalled(event) {
|
|
@@ -26261,6 +26398,7 @@ ${sourceUrlComment}
|
|
|
26261
26398
|
init_dirname();
|
|
26262
26399
|
init_buffer2();
|
|
26263
26400
|
init_Errors();
|
|
26401
|
+
init_util2();
|
|
26264
26402
|
init_Deferred();
|
|
26265
26403
|
init_disposable();
|
|
26266
26404
|
|
|
@@ -27200,6 +27338,9 @@ ${sourceUrlComment}
|
|
|
27200
27338
|
let _goto_decorators;
|
|
27201
27339
|
let _waitForNavigation_decorators;
|
|
27202
27340
|
let _setContent_decorators;
|
|
27341
|
+
let _addPreloadScript_decorators;
|
|
27342
|
+
let _addExposedFunctionBinding_decorators;
|
|
27343
|
+
let _removeExposedFunctionBinding_decorators;
|
|
27203
27344
|
let _waitForDevicePrompt_decorators;
|
|
27204
27345
|
return class CdpFrame extends _classSuper {
|
|
27205
27346
|
static {
|
|
@@ -27207,6 +27348,9 @@ ${sourceUrlComment}
|
|
|
27207
27348
|
__esDecorate8(this, null, _goto_decorators, { kind: "method", name: "goto", static: false, private: false, access: { has: (obj) => "goto" in obj, get: (obj) => obj.goto }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
27208
27349
|
__esDecorate8(this, null, _waitForNavigation_decorators, { kind: "method", name: "waitForNavigation", static: false, private: false, access: { has: (obj) => "waitForNavigation" in obj, get: (obj) => obj.waitForNavigation }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
27209
27350
|
__esDecorate8(this, null, _setContent_decorators, { kind: "method", name: "setContent", static: false, private: false, access: { has: (obj) => "setContent" in obj, get: (obj) => obj.setContent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
27351
|
+
__esDecorate8(this, null, _addPreloadScript_decorators, { kind: "method", name: "addPreloadScript", static: false, private: false, access: { has: (obj) => "addPreloadScript" in obj, get: (obj) => obj.addPreloadScript }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
27352
|
+
__esDecorate8(this, null, _addExposedFunctionBinding_decorators, { kind: "method", name: "addExposedFunctionBinding", static: false, private: false, access: { has: (obj) => "addExposedFunctionBinding" in obj, get: (obj) => obj.addExposedFunctionBinding }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
27353
|
+
__esDecorate8(this, null, _removeExposedFunctionBinding_decorators, { kind: "method", name: "removeExposedFunctionBinding", static: false, private: false, access: { has: (obj) => "removeExposedFunctionBinding" in obj, get: (obj) => obj.removeExposedFunctionBinding }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
27210
27354
|
__esDecorate8(this, null, _waitForDevicePrompt_decorators, { kind: "method", name: "waitForDevicePrompt", static: false, private: false, access: { has: (obj) => "waitForDevicePrompt" in obj, get: (obj) => obj.waitForDevicePrompt }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
27211
27355
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
27212
27356
|
}
|
|
@@ -27380,6 +27524,42 @@ ${sourceUrlComment}
|
|
|
27380
27524
|
return rootFrame._frameManager._deviceRequestPromptManager(this.#client);
|
|
27381
27525
|
}
|
|
27382
27526
|
}
|
|
27527
|
+
async addPreloadScript(preloadScript) {
|
|
27528
|
+
if (!this.isOOPFrame() && this !== this._frameManager.mainFrame()) {
|
|
27529
|
+
return;
|
|
27530
|
+
}
|
|
27531
|
+
if (preloadScript.getIdForFrame(this)) {
|
|
27532
|
+
return;
|
|
27533
|
+
}
|
|
27534
|
+
const { identifier } = await this.#client.send("Page.addScriptToEvaluateOnNewDocument", {
|
|
27535
|
+
source: preloadScript.source
|
|
27536
|
+
});
|
|
27537
|
+
preloadScript.setIdForFrame(this, identifier);
|
|
27538
|
+
}
|
|
27539
|
+
async addExposedFunctionBinding(binding) {
|
|
27540
|
+
if (this !== this._frameManager.mainFrame() && !this._hasStartedLoading) {
|
|
27541
|
+
return;
|
|
27542
|
+
}
|
|
27543
|
+
await Promise.all([
|
|
27544
|
+
this.#client.send("Runtime.addBinding", {
|
|
27545
|
+
name: CDP_BINDING_PREFIX + binding.name
|
|
27546
|
+
}),
|
|
27547
|
+
this.evaluate(binding.initSource).catch(debugError)
|
|
27548
|
+
]);
|
|
27549
|
+
}
|
|
27550
|
+
async removeExposedFunctionBinding(binding) {
|
|
27551
|
+
if (this !== this._frameManager.mainFrame() && !this._hasStartedLoading) {
|
|
27552
|
+
return;
|
|
27553
|
+
}
|
|
27554
|
+
await Promise.all([
|
|
27555
|
+
this.#client.send("Runtime.removeBinding", {
|
|
27556
|
+
name: CDP_BINDING_PREFIX + binding.name
|
|
27557
|
+
}),
|
|
27558
|
+
this.evaluate((name2) => {
|
|
27559
|
+
globalThis[name2] = void 0;
|
|
27560
|
+
}, binding.name).catch(debugError)
|
|
27561
|
+
]);
|
|
27562
|
+
}
|
|
27383
27563
|
async waitForDevicePrompt(options = {}) {
|
|
27384
27564
|
return await this.#deviceRequestPromptManager().waitForDevicePrompt(options);
|
|
27385
27565
|
}
|
|
@@ -27407,7 +27587,7 @@ ${sourceUrlComment}
|
|
|
27407
27587
|
get detached() {
|
|
27408
27588
|
return this.#detached;
|
|
27409
27589
|
}
|
|
27410
|
-
[(_goto_decorators = [throwIfDetached], _waitForNavigation_decorators = [throwIfDetached], _setContent_decorators = [throwIfDetached], _waitForDevicePrompt_decorators = [throwIfDetached], disposeSymbol)]() {
|
|
27590
|
+
[(_goto_decorators = [throwIfDetached], _waitForNavigation_decorators = [throwIfDetached], _setContent_decorators = [throwIfDetached], _addPreloadScript_decorators = [throwIfDetached], _addExposedFunctionBinding_decorators = [throwIfDetached], _removeExposedFunctionBinding_decorators = [throwIfDetached], _waitForDevicePrompt_decorators = [throwIfDetached], disposeSymbol)]() {
|
|
27411
27591
|
if (this.#detached) {
|
|
27412
27592
|
return;
|
|
27413
27593
|
}
|
|
@@ -27782,6 +27962,20 @@ ${sourceUrlComment}
|
|
|
27782
27962
|
return;
|
|
27783
27963
|
}
|
|
27784
27964
|
}
|
|
27965
|
+
/**
|
|
27966
|
+
* @internal
|
|
27967
|
+
*/
|
|
27968
|
+
static getResponse(body) {
|
|
27969
|
+
const byteBody = isString3(body) ? new TextEncoder().encode(body) : body;
|
|
27970
|
+
const bytes = [];
|
|
27971
|
+
for (const byte of byteBody) {
|
|
27972
|
+
bytes.push(String.fromCharCode(byte));
|
|
27973
|
+
}
|
|
27974
|
+
return {
|
|
27975
|
+
contentLength: byteBody.byteLength,
|
|
27976
|
+
base64: btoa(bytes.join(""))
|
|
27977
|
+
};
|
|
27978
|
+
}
|
|
27785
27979
|
};
|
|
27786
27980
|
var InterceptResolutionAction;
|
|
27787
27981
|
(function(InterceptResolutionAction2) {
|
|
@@ -27988,7 +28182,7 @@ ${sourceUrlComment}
|
|
|
27988
28182
|
async _continue(overrides = {}) {
|
|
27989
28183
|
const { url, method, postData, headers } = overrides;
|
|
27990
28184
|
this.interception.handled = true;
|
|
27991
|
-
const postDataBinaryBase64 = postData ?
|
|
28185
|
+
const postDataBinaryBase64 = postData ? btoa(postData) : void 0;
|
|
27992
28186
|
if (this._interceptionId === void 0) {
|
|
27993
28187
|
throw new Error("HTTPRequest is missing _interceptionId needed for Fetch.continueRequest");
|
|
27994
28188
|
}
|
|
@@ -28005,7 +28199,10 @@ ${sourceUrlComment}
|
|
|
28005
28199
|
}
|
|
28006
28200
|
async _respond(response) {
|
|
28007
28201
|
this.interception.handled = true;
|
|
28008
|
-
|
|
28202
|
+
let parsedBody;
|
|
28203
|
+
if (response.body) {
|
|
28204
|
+
parsedBody = HTTPRequest.getResponse(response.body);
|
|
28205
|
+
}
|
|
28009
28206
|
const responseHeaders = {};
|
|
28010
28207
|
if (response.headers) {
|
|
28011
28208
|
for (const header of Object.keys(response.headers)) {
|
|
@@ -28018,8 +28215,8 @@ ${sourceUrlComment}
|
|
|
28018
28215
|
if (response.contentType) {
|
|
28019
28216
|
responseHeaders["content-type"] = response.contentType;
|
|
28020
28217
|
}
|
|
28021
|
-
if (
|
|
28022
|
-
responseHeaders["content-length"] = String(
|
|
28218
|
+
if (parsedBody?.contentLength && !("content-length" in responseHeaders)) {
|
|
28219
|
+
responseHeaders["content-length"] = String(parsedBody.contentLength);
|
|
28023
28220
|
}
|
|
28024
28221
|
const status = response.status || 200;
|
|
28025
28222
|
if (this._interceptionId === void 0) {
|
|
@@ -28030,7 +28227,7 @@ ${sourceUrlComment}
|
|
|
28030
28227
|
responseCode: status,
|
|
28031
28228
|
responsePhrase: STATUS_TEXTS[status],
|
|
28032
28229
|
responseHeaders: headersArray(responseHeaders),
|
|
28033
|
-
body:
|
|
28230
|
+
body: parsedBody?.base64
|
|
28034
28231
|
}).catch((error) => {
|
|
28035
28232
|
this.interception.handled = false;
|
|
28036
28233
|
return handleError(error);
|
|
@@ -28801,6 +28998,8 @@ ${sourceUrlComment}
|
|
|
28801
28998
|
#timeoutSettings;
|
|
28802
28999
|
#isolatedWorlds = /* @__PURE__ */ new Set();
|
|
28803
29000
|
#client;
|
|
29001
|
+
#scriptsToEvaluateOnNewDocument = /* @__PURE__ */ new Map();
|
|
29002
|
+
#bindings = /* @__PURE__ */ new Set();
|
|
28804
29003
|
_frameTree = new FrameTree();
|
|
28805
29004
|
/**
|
|
28806
29005
|
* Set of frame IDs stored to indicate if a frame has received a
|
|
@@ -28876,7 +29075,7 @@ ${sourceUrlComment}
|
|
|
28876
29075
|
client.once(CDPSessionEvent.Disconnected, () => {
|
|
28877
29076
|
this.#onClientDisconnect().catch(debugError);
|
|
28878
29077
|
});
|
|
28879
|
-
await this.initialize(client);
|
|
29078
|
+
await this.initialize(client, frame);
|
|
28880
29079
|
await this.#networkManager.addClient(client);
|
|
28881
29080
|
if (frame) {
|
|
28882
29081
|
frame.emit(FrameEvent.FrameSwappedByActivation, void 0);
|
|
@@ -28920,7 +29119,7 @@ ${sourceUrlComment}
|
|
|
28920
29119
|
this.#onLifecycleEvent(event);
|
|
28921
29120
|
});
|
|
28922
29121
|
}
|
|
28923
|
-
async initialize(client) {
|
|
29122
|
+
async initialize(client, frame) {
|
|
28924
29123
|
try {
|
|
28925
29124
|
this.#frameTreeHandled?.resolve();
|
|
28926
29125
|
this.#frameTreeHandled = Deferred.create();
|
|
@@ -28934,6 +29133,12 @@ ${sourceUrlComment}
|
|
|
28934
29133
|
client.send("Page.setLifecycleEventsEnabled", { enabled: true }),
|
|
28935
29134
|
client.send("Runtime.enable").then(() => {
|
|
28936
29135
|
return this.#createIsolatedWorld(client, UTILITY_WORLD_NAME);
|
|
29136
|
+
}),
|
|
29137
|
+
...(frame ? Array.from(this.#scriptsToEvaluateOnNewDocument.values()) : []).map((script) => {
|
|
29138
|
+
return frame?.addPreloadScript(script);
|
|
29139
|
+
}),
|
|
29140
|
+
...(frame ? Array.from(this.#bindings.values()) : []).map((binding) => {
|
|
29141
|
+
return frame?.addExposedFunctionBinding(binding);
|
|
28937
29142
|
})
|
|
28938
29143
|
]);
|
|
28939
29144
|
} catch (error) {
|
|
@@ -28958,6 +29163,45 @@ ${sourceUrlComment}
|
|
|
28958
29163
|
frame(frameId) {
|
|
28959
29164
|
return this._frameTree.getById(frameId) || null;
|
|
28960
29165
|
}
|
|
29166
|
+
async addExposedFunctionBinding(binding) {
|
|
29167
|
+
this.#bindings.add(binding);
|
|
29168
|
+
await Promise.all(this.frames().map(async (frame) => {
|
|
29169
|
+
return await frame.addExposedFunctionBinding(binding);
|
|
29170
|
+
}));
|
|
29171
|
+
}
|
|
29172
|
+
async removeExposedFunctionBinding(binding) {
|
|
29173
|
+
this.#bindings.delete(binding);
|
|
29174
|
+
await Promise.all(this.frames().map(async (frame) => {
|
|
29175
|
+
return await frame.removeExposedFunctionBinding(binding);
|
|
29176
|
+
}));
|
|
29177
|
+
}
|
|
29178
|
+
async evaluateOnNewDocument(source2) {
|
|
29179
|
+
const { identifier } = await this.mainFrame()._client().send("Page.addScriptToEvaluateOnNewDocument", {
|
|
29180
|
+
source: source2
|
|
29181
|
+
});
|
|
29182
|
+
const preloadScript = new CdpPreloadScript(this.mainFrame(), identifier, source2);
|
|
29183
|
+
this.#scriptsToEvaluateOnNewDocument.set(identifier, preloadScript);
|
|
29184
|
+
await Promise.all(this.frames().map(async (frame) => {
|
|
29185
|
+
return await frame.addPreloadScript(preloadScript);
|
|
29186
|
+
}));
|
|
29187
|
+
return { identifier };
|
|
29188
|
+
}
|
|
29189
|
+
async removeScriptToEvaluateOnNewDocument(identifier) {
|
|
29190
|
+
const preloadScript = this.#scriptsToEvaluateOnNewDocument.get(identifier);
|
|
29191
|
+
if (!preloadScript) {
|
|
29192
|
+
throw new Error(`Script to evaluate on new document with id ${identifier} not found`);
|
|
29193
|
+
}
|
|
29194
|
+
this.#scriptsToEvaluateOnNewDocument.delete(identifier);
|
|
29195
|
+
await Promise.all(this.frames().map((frame) => {
|
|
29196
|
+
const identifier2 = preloadScript.getIdForFrame(frame);
|
|
29197
|
+
if (!identifier2) {
|
|
29198
|
+
return;
|
|
29199
|
+
}
|
|
29200
|
+
return frame._client().send("Page.removeScriptToEvaluateOnNewDocument", {
|
|
29201
|
+
identifier: identifier2
|
|
29202
|
+
}).catch(debugError);
|
|
29203
|
+
}));
|
|
29204
|
+
}
|
|
28961
29205
|
onAttachedToTarget(target) {
|
|
28962
29206
|
if (target._getTargetInfo().type !== "iframe") {
|
|
28963
29207
|
return;
|
|
@@ -28967,7 +29211,7 @@ ${sourceUrlComment}
|
|
|
28967
29211
|
frame.updateClient(target._session());
|
|
28968
29212
|
}
|
|
28969
29213
|
this.setupEventListeners(target._session());
|
|
28970
|
-
void this.initialize(target._session());
|
|
29214
|
+
void this.initialize(target._session(), frame);
|
|
28971
29215
|
}
|
|
28972
29216
|
_deviceRequestPromptManager(client) {
|
|
28973
29217
|
let manager = this.#deviceRequestPromptManagerMap.get(client);
|
|
@@ -30241,7 +30485,7 @@ ${sourceUrlComment}
|
|
|
30241
30485
|
};
|
|
30242
30486
|
|
|
30243
30487
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Page.js
|
|
30244
|
-
var
|
|
30488
|
+
var __addDisposableResource12 = function(env, value, async2) {
|
|
30245
30489
|
if (value !== null && value !== void 0) {
|
|
30246
30490
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
30247
30491
|
var dispose;
|
|
@@ -30260,7 +30504,7 @@ ${sourceUrlComment}
|
|
|
30260
30504
|
}
|
|
30261
30505
|
return value;
|
|
30262
30506
|
};
|
|
30263
|
-
var
|
|
30507
|
+
var __disposeResources12 = /* @__PURE__ */ function(SuppressedError2) {
|
|
30264
30508
|
return function(env) {
|
|
30265
30509
|
function fail2(e9) {
|
|
30266
30510
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -30449,6 +30693,25 @@ ${sourceUrlComment}
|
|
|
30449
30693
|
this.#closed = true;
|
|
30450
30694
|
}).catch(debugError);
|
|
30451
30695
|
this.#setupPrimaryTargetListeners();
|
|
30696
|
+
this.#attachExistingTargets();
|
|
30697
|
+
}
|
|
30698
|
+
#attachExistingTargets() {
|
|
30699
|
+
const queue = [];
|
|
30700
|
+
for (const childTarget of this.#targetManager.getChildTargets(this.#primaryTarget)) {
|
|
30701
|
+
queue.push(childTarget);
|
|
30702
|
+
}
|
|
30703
|
+
let idx = 0;
|
|
30704
|
+
while (idx < queue.length) {
|
|
30705
|
+
const next = queue[idx];
|
|
30706
|
+
idx++;
|
|
30707
|
+
const session = next._session();
|
|
30708
|
+
if (session) {
|
|
30709
|
+
this.#onAttachedToTarget(session);
|
|
30710
|
+
}
|
|
30711
|
+
for (const childTarget of this.#targetManager.getChildTargets(next)) {
|
|
30712
|
+
queue.push(childTarget);
|
|
30713
|
+
}
|
|
30714
|
+
}
|
|
30452
30715
|
}
|
|
30453
30716
|
async #onActivation(newSession) {
|
|
30454
30717
|
this.#primaryTargetClient = newSession;
|
|
@@ -30524,7 +30787,7 @@ ${sourceUrlComment}
|
|
|
30524
30787
|
}
|
|
30525
30788
|
const frame = this.#frameManager.frame(event.frameId);
|
|
30526
30789
|
assert(frame, "This should never happen.");
|
|
30527
|
-
const handle =
|
|
30790
|
+
const handle = __addDisposableResource12(env_1, await frame.worlds[MAIN_WORLD].adoptBackendNode(event.backendNodeId), false);
|
|
30528
30791
|
const fileChooser = new FileChooser(handle.move(), event);
|
|
30529
30792
|
for (const promise of this.#fileChooserDeferreds) {
|
|
30530
30793
|
promise.resolve(fileChooser);
|
|
@@ -30534,7 +30797,7 @@ ${sourceUrlComment}
|
|
|
30534
30797
|
env_1.error = e_1;
|
|
30535
30798
|
env_1.hasError = true;
|
|
30536
30799
|
} finally {
|
|
30537
|
-
|
|
30800
|
+
__disposeResources12(env_1);
|
|
30538
30801
|
}
|
|
30539
30802
|
}
|
|
30540
30803
|
_client() {
|
|
@@ -30703,46 +30966,35 @@ ${sourceUrlComment}
|
|
|
30703
30966
|
if (this.#bindings.has(name2)) {
|
|
30704
30967
|
throw new Error(`Failed to add page binding with name ${name2}: window['${name2}'] already exists!`);
|
|
30705
30968
|
}
|
|
30969
|
+
const source2 = pageBindingInitString("exposedFun", name2);
|
|
30706
30970
|
let binding;
|
|
30707
30971
|
switch (typeof pptrFunction) {
|
|
30708
30972
|
case "function":
|
|
30709
|
-
binding = new Binding(name2, pptrFunction);
|
|
30973
|
+
binding = new Binding(name2, pptrFunction, source2);
|
|
30710
30974
|
break;
|
|
30711
30975
|
default:
|
|
30712
|
-
binding = new Binding(name2, pptrFunction.default);
|
|
30976
|
+
binding = new Binding(name2, pptrFunction.default, source2);
|
|
30713
30977
|
break;
|
|
30714
30978
|
}
|
|
30715
30979
|
this.#bindings.set(name2, binding);
|
|
30716
|
-
const
|
|
30717
|
-
|
|
30718
|
-
|
|
30719
|
-
|
|
30720
|
-
});
|
|
30980
|
+
const [{ identifier }] = await Promise.all([
|
|
30981
|
+
this.#frameManager.evaluateOnNewDocument(source2),
|
|
30982
|
+
this.#frameManager.addExposedFunctionBinding(binding)
|
|
30983
|
+
]);
|
|
30721
30984
|
this.#exposedFunctions.set(name2, identifier);
|
|
30722
|
-
await Promise.all(this.frames().map((frame) => {
|
|
30723
|
-
if (frame !== this.mainFrame() && !frame._hasStartedLoading) {
|
|
30724
|
-
return;
|
|
30725
|
-
}
|
|
30726
|
-
return frame.evaluate(expression).catch(debugError);
|
|
30727
|
-
}));
|
|
30728
30985
|
}
|
|
30729
30986
|
async removeExposedFunction(name2) {
|
|
30730
|
-
const
|
|
30731
|
-
if (!
|
|
30732
|
-
throw new Error(`
|
|
30987
|
+
const exposedFunctionId = this.#exposedFunctions.get(name2);
|
|
30988
|
+
if (!exposedFunctionId) {
|
|
30989
|
+
throw new Error(`Function with name "${name2}" does not exist`);
|
|
30733
30990
|
}
|
|
30734
|
-
|
|
30735
|
-
await this.removeScriptToEvaluateOnNewDocument(exposedFun);
|
|
30736
|
-
await Promise.all(this.frames().map((frame) => {
|
|
30737
|
-
if (frame !== this.mainFrame() && !frame._hasStartedLoading) {
|
|
30738
|
-
return;
|
|
30739
|
-
}
|
|
30740
|
-
return frame.evaluate((name3) => {
|
|
30741
|
-
globalThis[name3] = void 0;
|
|
30742
|
-
}, name2).catch(debugError);
|
|
30743
|
-
}));
|
|
30991
|
+
const binding = this.#bindings.get(name2);
|
|
30744
30992
|
this.#exposedFunctions.delete(name2);
|
|
30745
30993
|
this.#bindings.delete(name2);
|
|
30994
|
+
await Promise.all([
|
|
30995
|
+
this.#frameManager.removeScriptToEvaluateOnNewDocument(exposedFunctionId),
|
|
30996
|
+
this.#frameManager.removeExposedFunctionBinding(binding)
|
|
30997
|
+
]);
|
|
30746
30998
|
}
|
|
30747
30999
|
async authenticate(credentials) {
|
|
30748
31000
|
return await this.#frameManager.networkManager.authenticate(credentials);
|
|
@@ -30908,15 +31160,10 @@ ${sourceUrlComment}
|
|
|
30908
31160
|
}
|
|
30909
31161
|
async evaluateOnNewDocument(pageFunction, ...args) {
|
|
30910
31162
|
const source2 = evaluationString(pageFunction, ...args);
|
|
30911
|
-
|
|
30912
|
-
source: source2
|
|
30913
|
-
});
|
|
30914
|
-
return { identifier };
|
|
31163
|
+
return await this.#frameManager.evaluateOnNewDocument(source2);
|
|
30915
31164
|
}
|
|
30916
31165
|
async removeScriptToEvaluateOnNewDocument(identifier) {
|
|
30917
|
-
await this.#
|
|
30918
|
-
identifier
|
|
30919
|
-
});
|
|
31166
|
+
return await this.#frameManager.removeScriptToEvaluateOnNewDocument(identifier);
|
|
30920
31167
|
}
|
|
30921
31168
|
async setCacheEnabled(enabled = true) {
|
|
30922
31169
|
await this.#frameManager.networkManager.setCacheEnabled(enabled);
|
|
@@ -30926,7 +31173,7 @@ ${sourceUrlComment}
|
|
|
30926
31173
|
try {
|
|
30927
31174
|
const { fromSurface, omitBackground, optimizeForSpeed, quality, clip: userClip, type, captureBeyondViewport } = options;
|
|
30928
31175
|
const isFirefox = this.target()._targetManager() instanceof FirefoxTargetManager;
|
|
30929
|
-
const stack =
|
|
31176
|
+
const stack = __addDisposableResource12(env_2, new AsyncDisposableStack(), true);
|
|
30930
31177
|
if (!isFirefox && omitBackground && (type === "png" || type === "webp")) {
|
|
30931
31178
|
await this.#emulationManager.setTransparentBackgroundColor();
|
|
30932
31179
|
stack.defer(async () => {
|
|
@@ -30954,20 +31201,22 @@ ${sourceUrlComment}
|
|
|
30954
31201
|
env_2.error = e_2;
|
|
30955
31202
|
env_2.hasError = true;
|
|
30956
31203
|
} finally {
|
|
30957
|
-
const result_1 =
|
|
31204
|
+
const result_1 = __disposeResources12(env_2);
|
|
30958
31205
|
if (result_1)
|
|
30959
31206
|
await result_1;
|
|
30960
31207
|
}
|
|
30961
31208
|
}
|
|
30962
31209
|
async createPDFStream(options = {}) {
|
|
30963
31210
|
const { timeout: ms = this._timeoutSettings.timeout() } = options;
|
|
30964
|
-
const { landscape, displayHeaderFooter, headerTemplate, footerTemplate, printBackground, scale, width: paperWidth, height: paperHeight, margin, pageRanges, preferCSSPageSize, omitBackground, tagged: generateTaggedPDF, outline: generateDocumentOutline } = parsePDFOptions(options);
|
|
31211
|
+
const { landscape, displayHeaderFooter, headerTemplate, footerTemplate, printBackground, scale, width: paperWidth, height: paperHeight, margin, pageRanges, preferCSSPageSize, omitBackground, tagged: generateTaggedPDF, outline: generateDocumentOutline, waitForFonts } = parsePDFOptions(options);
|
|
30965
31212
|
if (omitBackground) {
|
|
30966
31213
|
await this.#emulationManager.setTransparentBackgroundColor();
|
|
30967
31214
|
}
|
|
30968
|
-
|
|
30969
|
-
|
|
30970
|
-
|
|
31215
|
+
if (waitForFonts) {
|
|
31216
|
+
await firstValueFrom(from(this.mainFrame().isolatedRealm().evaluate(() => {
|
|
31217
|
+
return document.fonts.ready;
|
|
31218
|
+
})).pipe(raceWith(timeout(ms))));
|
|
31219
|
+
}
|
|
30971
31220
|
const printCommandPromise = this.#primaryTargetClient.send("Page.printToPDF", {
|
|
30972
31221
|
transferMode: "ReturnAsStream",
|
|
30973
31222
|
landscape,
|
|
@@ -31002,16 +31251,25 @@ ${sourceUrlComment}
|
|
|
31002
31251
|
return buffer2;
|
|
31003
31252
|
}
|
|
31004
31253
|
async close(options = { runBeforeUnload: void 0 }) {
|
|
31005
|
-
const
|
|
31006
|
-
|
|
31007
|
-
|
|
31008
|
-
|
|
31009
|
-
|
|
31010
|
-
|
|
31011
|
-
|
|
31012
|
-
|
|
31013
|
-
}
|
|
31014
|
-
|
|
31254
|
+
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
31255
|
+
try {
|
|
31256
|
+
const _guard = __addDisposableResource12(env_3, await this.browserContext().waitForScreenshotOperations(), false);
|
|
31257
|
+
const connection = this.#primaryTargetClient.connection();
|
|
31258
|
+
assert(connection, "Protocol error: Connection closed. Most likely the page has been closed.");
|
|
31259
|
+
const runBeforeUnload = !!options.runBeforeUnload;
|
|
31260
|
+
if (runBeforeUnload) {
|
|
31261
|
+
await this.#primaryTargetClient.send("Page.close");
|
|
31262
|
+
} else {
|
|
31263
|
+
await connection.send("Target.closeTarget", {
|
|
31264
|
+
targetId: this.#primaryTarget._targetId
|
|
31265
|
+
});
|
|
31266
|
+
await this.#tabTarget._isClosedDeferred.valueOrThrow();
|
|
31267
|
+
}
|
|
31268
|
+
} catch (e_3) {
|
|
31269
|
+
env_3.error = e_3;
|
|
31270
|
+
env_3.hasError = true;
|
|
31271
|
+
} finally {
|
|
31272
|
+
__disposeResources12(env_3);
|
|
31015
31273
|
}
|
|
31016
31274
|
}
|
|
31017
31275
|
isClosed() {
|
|
@@ -31085,6 +31343,7 @@ ${sourceUrlComment}
|
|
|
31085
31343
|
#targetInfo;
|
|
31086
31344
|
#targetManager;
|
|
31087
31345
|
#sessionFactory;
|
|
31346
|
+
#childTargets = /* @__PURE__ */ new Set();
|
|
31088
31347
|
_initializedDeferred = Deferred.create();
|
|
31089
31348
|
_isClosedDeferred = Deferred.create();
|
|
31090
31349
|
_targetId;
|
|
@@ -31120,6 +31379,15 @@ ${sourceUrlComment}
|
|
|
31120
31379
|
_session() {
|
|
31121
31380
|
return this.#session;
|
|
31122
31381
|
}
|
|
31382
|
+
_addChildTarget(target) {
|
|
31383
|
+
this.#childTargets.add(target);
|
|
31384
|
+
}
|
|
31385
|
+
_removeChildTarget(target) {
|
|
31386
|
+
this.#childTargets.delete(target);
|
|
31387
|
+
}
|
|
31388
|
+
_childTargets() {
|
|
31389
|
+
return this.#childTargets;
|
|
31390
|
+
}
|
|
31123
31391
|
_sessionFactory() {
|
|
31124
31392
|
if (!this.#sessionFactory) {
|
|
31125
31393
|
throw new Error("sessionFactory is not initialized");
|
|
@@ -31372,6 +31640,9 @@ ${sourceUrlComment}
|
|
|
31372
31640
|
this.#finishInitializationIfReady();
|
|
31373
31641
|
await this.#initializeDeferred.valueOrThrow();
|
|
31374
31642
|
}
|
|
31643
|
+
getChildTargets(target) {
|
|
31644
|
+
return target._childTargets();
|
|
31645
|
+
}
|
|
31375
31646
|
dispose() {
|
|
31376
31647
|
this.#connection.off("Target.targetCreated", this.#onTargetCreated);
|
|
31377
31648
|
this.#connection.off("Target.targetDestroyed", this.#onTargetDestroyed);
|
|
@@ -31503,6 +31774,8 @@ ${sourceUrlComment}
|
|
|
31503
31774
|
this.#attachedTargetsByTargetId.set(targetInfo.targetId, target);
|
|
31504
31775
|
this.#attachedTargetsBySessionId.set(session.id(), target);
|
|
31505
31776
|
}
|
|
31777
|
+
const parentTarget = parentSession instanceof CDPSession ? parentSession._target() : null;
|
|
31778
|
+
parentTarget?._addChildTarget(target);
|
|
31506
31779
|
parentSession.emit(CDPSessionEvent.Ready, session);
|
|
31507
31780
|
this.#targetsIdsForInit.delete(target._targetId);
|
|
31508
31781
|
if (!isExistingTarget) {
|
|
@@ -31525,12 +31798,15 @@ ${sourceUrlComment}
|
|
|
31525
31798
|
this.#initializeDeferred.resolve();
|
|
31526
31799
|
}
|
|
31527
31800
|
}
|
|
31528
|
-
#onDetachedFromTarget = (
|
|
31801
|
+
#onDetachedFromTarget = (parentSession, event) => {
|
|
31529
31802
|
const target = this.#attachedTargetsBySessionId.get(event.sessionId);
|
|
31530
31803
|
this.#attachedTargetsBySessionId.delete(event.sessionId);
|
|
31531
31804
|
if (!target) {
|
|
31532
31805
|
return;
|
|
31533
31806
|
}
|
|
31807
|
+
if (parentSession instanceof CDPSession) {
|
|
31808
|
+
parentSession._target()._removeChildTarget(target);
|
|
31809
|
+
}
|
|
31534
31810
|
this.#attachedTargetsByTargetId.delete(target._targetId);
|
|
31535
31811
|
this.emit("targetGone", target);
|
|
31536
31812
|
};
|
|
@@ -32185,6 +32461,13 @@ puppeteer-core/lib/esm/puppeteer/api/Frame.js:
|
|
|
32185
32461
|
* SPDX-License-Identifier: Apache-2.0
|
|
32186
32462
|
*)
|
|
32187
32463
|
|
|
32464
|
+
puppeteer-core/lib/esm/puppeteer/cdp/CdpPreloadScript.js:
|
|
32465
|
+
(**
|
|
32466
|
+
* @license
|
|
32467
|
+
* Copyright 2024 Google Inc.
|
|
32468
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
32469
|
+
*)
|
|
32470
|
+
|
|
32188
32471
|
puppeteer-core/lib/esm/puppeteer/cdp/DeviceRequestPrompt.js:
|
|
32189
32472
|
(**
|
|
32190
32473
|
* @license
|