@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
|
@@ -16849,7 +16849,8 @@
|
|
|
16849
16849
|
preferCSSPageSize: false,
|
|
16850
16850
|
omitBackground: false,
|
|
16851
16851
|
outline: false,
|
|
16852
|
-
tagged: true
|
|
16852
|
+
tagged: true,
|
|
16853
|
+
waitForFonts: true
|
|
16853
16854
|
};
|
|
16854
16855
|
let width = 8.5;
|
|
16855
16856
|
let height = 11;
|
|
@@ -17533,17 +17534,20 @@
|
|
|
17533
17534
|
Mutex = class _Mutex {
|
|
17534
17535
|
static Guard = class Guard {
|
|
17535
17536
|
#mutex;
|
|
17536
|
-
|
|
17537
|
+
#onRelease;
|
|
17538
|
+
constructor(mutex, onRelease) {
|
|
17537
17539
|
this.#mutex = mutex;
|
|
17540
|
+
this.#onRelease = onRelease;
|
|
17538
17541
|
}
|
|
17539
17542
|
[disposeSymbol]() {
|
|
17543
|
+
this.#onRelease?.();
|
|
17540
17544
|
return this.#mutex.release();
|
|
17541
17545
|
}
|
|
17542
17546
|
};
|
|
17543
17547
|
#locked = false;
|
|
17544
17548
|
#acquirers = [];
|
|
17545
17549
|
// This is FIFO.
|
|
17546
|
-
async acquire() {
|
|
17550
|
+
async acquire(onRelease) {
|
|
17547
17551
|
if (!this.#locked) {
|
|
17548
17552
|
this.#locked = true;
|
|
17549
17553
|
return new _Mutex.Guard(this);
|
|
@@ -17551,7 +17555,7 @@
|
|
|
17551
17555
|
const deferred = Deferred.create();
|
|
17552
17556
|
this.#acquirers.push(deferred.resolve.bind(deferred));
|
|
17553
17557
|
await deferred.valueOrThrow();
|
|
17554
|
-
return new _Mutex.Guard(this);
|
|
17558
|
+
return new _Mutex.Guard(this, onRelease);
|
|
17555
17559
|
}
|
|
17556
17560
|
release() {
|
|
17557
17561
|
const resolve3 = this.#acquirers.shift();
|
|
@@ -17651,27 +17655,27 @@
|
|
|
17651
17655
|
mutex = new Mutex();
|
|
17652
17656
|
mutexes.set(key, mutex);
|
|
17653
17657
|
}
|
|
17654
|
-
const _5 =
|
|
17658
|
+
const _5 = __addDisposableResource2(env_1, await mutex.acquire(), true);
|
|
17655
17659
|
return await target.call(this, ...args);
|
|
17656
17660
|
} catch (e_1) {
|
|
17657
17661
|
env_1.error = e_1;
|
|
17658
17662
|
env_1.hasError = true;
|
|
17659
17663
|
} finally {
|
|
17660
|
-
const result_1 =
|
|
17664
|
+
const result_1 = __disposeResources2(env_1);
|
|
17661
17665
|
if (result_1)
|
|
17662
17666
|
await result_1;
|
|
17663
17667
|
}
|
|
17664
17668
|
};
|
|
17665
17669
|
};
|
|
17666
17670
|
}
|
|
17667
|
-
var
|
|
17671
|
+
var __addDisposableResource2, __disposeResources2, instances;
|
|
17668
17672
|
var init_decorators = __esm({
|
|
17669
17673
|
"node_modules/puppeteer-core/lib/esm/puppeteer/util/decorators.js"() {
|
|
17670
17674
|
init_dirname();
|
|
17671
17675
|
init_buffer2();
|
|
17672
17676
|
init_disposable();
|
|
17673
17677
|
init_Mutex();
|
|
17674
|
-
|
|
17678
|
+
__addDisposableResource2 = function(env, value, async2) {
|
|
17675
17679
|
if (value !== null && value !== void 0) {
|
|
17676
17680
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
17677
17681
|
var dispose;
|
|
@@ -17690,7 +17694,7 @@
|
|
|
17690
17694
|
}
|
|
17691
17695
|
return value;
|
|
17692
17696
|
};
|
|
17693
|
-
|
|
17697
|
+
__disposeResources2 = /* @__PURE__ */ function(SuppressedError2) {
|
|
17694
17698
|
return function(env) {
|
|
17695
17699
|
function fail2(e9) {
|
|
17696
17700
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -18142,6 +18146,7 @@
|
|
|
18142
18146
|
init_EventEmitter();
|
|
18143
18147
|
init_util2();
|
|
18144
18148
|
init_disposable();
|
|
18149
|
+
init_Mutex();
|
|
18145
18150
|
var BrowserContext = class extends EventEmitter2 {
|
|
18146
18151
|
/**
|
|
18147
18152
|
* @internal
|
|
@@ -18149,6 +18154,31 @@
|
|
|
18149
18154
|
constructor() {
|
|
18150
18155
|
super();
|
|
18151
18156
|
}
|
|
18157
|
+
/**
|
|
18158
|
+
* If defined, indicates an ongoing screenshot opereation.
|
|
18159
|
+
*/
|
|
18160
|
+
#pageScreenshotMutex;
|
|
18161
|
+
#screenshotOperationsCount = 0;
|
|
18162
|
+
/**
|
|
18163
|
+
* @internal
|
|
18164
|
+
*/
|
|
18165
|
+
startScreenshot() {
|
|
18166
|
+
const mutex = this.#pageScreenshotMutex || new Mutex();
|
|
18167
|
+
this.#pageScreenshotMutex = mutex;
|
|
18168
|
+
this.#screenshotOperationsCount++;
|
|
18169
|
+
return mutex.acquire(() => {
|
|
18170
|
+
this.#screenshotOperationsCount--;
|
|
18171
|
+
if (this.#screenshotOperationsCount === 0) {
|
|
18172
|
+
this.#pageScreenshotMutex = void 0;
|
|
18173
|
+
}
|
|
18174
|
+
});
|
|
18175
|
+
}
|
|
18176
|
+
/**
|
|
18177
|
+
* @internal
|
|
18178
|
+
*/
|
|
18179
|
+
waitForScreenshotOperations() {
|
|
18180
|
+
return this.#pageScreenshotMutex?.acquire();
|
|
18181
|
+
}
|
|
18152
18182
|
/**
|
|
18153
18183
|
* Waits until a {@link Target | target} matching the given `predicate`
|
|
18154
18184
|
* appears and returns it.
|
|
@@ -18200,6 +18230,52 @@
|
|
|
18200
18230
|
|
|
18201
18231
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/BrowserContext.js
|
|
18202
18232
|
init_assert();
|
|
18233
|
+
var __addDisposableResource = function(env, value, async2) {
|
|
18234
|
+
if (value !== null && value !== void 0) {
|
|
18235
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
18236
|
+
var dispose;
|
|
18237
|
+
if (async2) {
|
|
18238
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
18239
|
+
dispose = value[Symbol.asyncDispose];
|
|
18240
|
+
}
|
|
18241
|
+
if (dispose === void 0) {
|
|
18242
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
18243
|
+
dispose = value[Symbol.dispose];
|
|
18244
|
+
}
|
|
18245
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
18246
|
+
env.stack.push({ value, dispose, async: async2 });
|
|
18247
|
+
} else if (async2) {
|
|
18248
|
+
env.stack.push({ async: true });
|
|
18249
|
+
}
|
|
18250
|
+
return value;
|
|
18251
|
+
};
|
|
18252
|
+
var __disposeResources = /* @__PURE__ */ function(SuppressedError2) {
|
|
18253
|
+
return function(env) {
|
|
18254
|
+
function fail2(e9) {
|
|
18255
|
+
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
18256
|
+
env.hasError = true;
|
|
18257
|
+
}
|
|
18258
|
+
function next() {
|
|
18259
|
+
while (env.stack.length) {
|
|
18260
|
+
var rec = env.stack.pop();
|
|
18261
|
+
try {
|
|
18262
|
+
var result = rec.dispose && rec.dispose.call(rec.value);
|
|
18263
|
+
if (rec.async) return Promise.resolve(result).then(next, function(e9) {
|
|
18264
|
+
fail2(e9);
|
|
18265
|
+
return next();
|
|
18266
|
+
});
|
|
18267
|
+
} catch (e9) {
|
|
18268
|
+
fail2(e9);
|
|
18269
|
+
}
|
|
18270
|
+
}
|
|
18271
|
+
if (env.hasError) throw env.error;
|
|
18272
|
+
}
|
|
18273
|
+
return next();
|
|
18274
|
+
};
|
|
18275
|
+
}(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
18276
|
+
var e9 = new Error(message);
|
|
18277
|
+
return e9.name = "SuppressedError", e9.error = error, e9.suppressed = suppressed, e9;
|
|
18278
|
+
});
|
|
18203
18279
|
var CdpBrowserContext = class extends BrowserContext {
|
|
18204
18280
|
#connection;
|
|
18205
18281
|
#browser;
|
|
@@ -18250,8 +18326,17 @@
|
|
|
18250
18326
|
browserContextId: this.#id || void 0
|
|
18251
18327
|
});
|
|
18252
18328
|
}
|
|
18253
|
-
newPage() {
|
|
18254
|
-
|
|
18329
|
+
async newPage() {
|
|
18330
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
18331
|
+
try {
|
|
18332
|
+
const _guard = __addDisposableResource(env_1, await this.waitForScreenshotOperations(), false);
|
|
18333
|
+
return await this.#browser._createPageInContext(this.#id);
|
|
18334
|
+
} catch (e_1) {
|
|
18335
|
+
env_1.error = e_1;
|
|
18336
|
+
env_1.hasError = true;
|
|
18337
|
+
} finally {
|
|
18338
|
+
__disposeResources(env_1);
|
|
18339
|
+
}
|
|
18255
18340
|
}
|
|
18256
18341
|
browser() {
|
|
18257
18342
|
return this.#browser;
|
|
@@ -18612,7 +18697,7 @@
|
|
|
18612
18697
|
init_rxjs();
|
|
18613
18698
|
init_EventEmitter();
|
|
18614
18699
|
init_util2();
|
|
18615
|
-
var
|
|
18700
|
+
var __addDisposableResource3 = function(env, value, async2) {
|
|
18616
18701
|
if (value !== null && value !== void 0) {
|
|
18617
18702
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
18618
18703
|
var dispose;
|
|
@@ -18631,7 +18716,7 @@
|
|
|
18631
18716
|
}
|
|
18632
18717
|
return value;
|
|
18633
18718
|
};
|
|
18634
|
-
var
|
|
18719
|
+
var __disposeResources3 = /* @__PURE__ */ function(SuppressedError2) {
|
|
18635
18720
|
return function(env) {
|
|
18636
18721
|
function fail2(e9) {
|
|
18637
18722
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -19016,13 +19101,13 @@
|
|
|
19016
19101
|
async wait(options) {
|
|
19017
19102
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
19018
19103
|
try {
|
|
19019
|
-
const handle =
|
|
19104
|
+
const handle = __addDisposableResource3(env_1, await this.waitHandle(options), false);
|
|
19020
19105
|
return await handle.jsonValue();
|
|
19021
19106
|
} catch (e_1) {
|
|
19022
19107
|
env_1.error = e_1;
|
|
19023
19108
|
env_1.hasError = true;
|
|
19024
19109
|
} finally {
|
|
19025
|
-
|
|
19110
|
+
__disposeResources3(env_1);
|
|
19026
19111
|
}
|
|
19027
19112
|
}
|
|
19028
19113
|
/**
|
|
@@ -19309,7 +19394,7 @@
|
|
|
19309
19394
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
19310
19395
|
done = true;
|
|
19311
19396
|
};
|
|
19312
|
-
var
|
|
19397
|
+
var __addDisposableResource4 = function(env, value, async2) {
|
|
19313
19398
|
if (value !== null && value !== void 0) {
|
|
19314
19399
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
19315
19400
|
var dispose;
|
|
@@ -19328,7 +19413,7 @@
|
|
|
19328
19413
|
}
|
|
19329
19414
|
return value;
|
|
19330
19415
|
};
|
|
19331
|
-
var
|
|
19416
|
+
var __disposeResources4 = /* @__PURE__ */ function(SuppressedError2) {
|
|
19332
19417
|
return function(env) {
|
|
19333
19418
|
function fail2(e9) {
|
|
19334
19419
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -20201,7 +20286,7 @@
|
|
|
20201
20286
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
20202
20287
|
try {
|
|
20203
20288
|
const viewport = this.viewport();
|
|
20204
|
-
const stack =
|
|
20289
|
+
const stack = __addDisposableResource4(env_1, new DisposableStack(), false);
|
|
20205
20290
|
if (viewport && viewport.deviceScaleFactor !== 0) {
|
|
20206
20291
|
await this.setViewport({ ...viewport, deviceScaleFactor: 0 });
|
|
20207
20292
|
stack.defer(() => {
|
|
@@ -20219,12 +20304,13 @@
|
|
|
20219
20304
|
env_1.error = e_1;
|
|
20220
20305
|
env_1.hasError = true;
|
|
20221
20306
|
} finally {
|
|
20222
|
-
|
|
20307
|
+
__disposeResources4(env_1);
|
|
20223
20308
|
}
|
|
20224
20309
|
}
|
|
20225
20310
|
async screenshot(userOptions = {}) {
|
|
20226
20311
|
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
20227
20312
|
try {
|
|
20313
|
+
const _guard = __addDisposableResource4(env_2, await this.browserContext().startScreenshot(), false);
|
|
20228
20314
|
await this.bringToFront();
|
|
20229
20315
|
const options = {
|
|
20230
20316
|
...userOptions,
|
|
@@ -20249,7 +20335,7 @@
|
|
|
20249
20335
|
}
|
|
20250
20336
|
}
|
|
20251
20337
|
if (options.quality !== void 0) {
|
|
20252
|
-
if (options.quality < 0
|
|
20338
|
+
if (options.quality < 0 || options.quality > 100) {
|
|
20253
20339
|
throw new Error(`Expected 'quality' (${options.quality}) to be between 0 and 100, inclusive.`);
|
|
20254
20340
|
}
|
|
20255
20341
|
if (options.type === void 0 || !["jpeg", "webp"].includes(options.type)) {
|
|
@@ -20265,7 +20351,7 @@
|
|
|
20265
20351
|
}
|
|
20266
20352
|
}
|
|
20267
20353
|
setDefaultScreenshotOptions(options);
|
|
20268
|
-
const stack =
|
|
20354
|
+
const stack = __addDisposableResource4(env_2, new AsyncDisposableStack(), true);
|
|
20269
20355
|
if (options.clip) {
|
|
20270
20356
|
if (options.fullPage) {
|
|
20271
20357
|
throw new Error("'clip' and 'fullPage' are mutually exclusive");
|
|
@@ -20305,7 +20391,7 @@
|
|
|
20305
20391
|
env_2.error = e_2;
|
|
20306
20392
|
env_2.hasError = true;
|
|
20307
20393
|
} finally {
|
|
20308
|
-
const result_1 =
|
|
20394
|
+
const result_1 = __disposeResources4(env_2);
|
|
20309
20395
|
if (result_1)
|
|
20310
20396
|
await result_1;
|
|
20311
20397
|
}
|
|
@@ -20782,7 +20868,7 @@
|
|
|
20782
20868
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
20783
20869
|
done = true;
|
|
20784
20870
|
};
|
|
20785
|
-
var
|
|
20871
|
+
var __addDisposableResource5 = function(env, value, async2) {
|
|
20786
20872
|
if (value !== null && value !== void 0) {
|
|
20787
20873
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
20788
20874
|
var dispose;
|
|
@@ -20801,7 +20887,7 @@
|
|
|
20801
20887
|
}
|
|
20802
20888
|
return value;
|
|
20803
20889
|
};
|
|
20804
|
-
var
|
|
20890
|
+
var __disposeResources5 = /* @__PURE__ */ function(SuppressedError2) {
|
|
20805
20891
|
return function(env) {
|
|
20806
20892
|
function fail2(e9) {
|
|
20807
20893
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -20914,7 +21000,7 @@
|
|
|
20914
21000
|
for (const [key, value] of Object.entries(propertyNames)) {
|
|
20915
21001
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
20916
21002
|
try {
|
|
20917
|
-
const handle =
|
|
21003
|
+
const handle = __addDisposableResource5(env_1, results[key], false);
|
|
20918
21004
|
if (handle) {
|
|
20919
21005
|
map2.set(value, handle.move());
|
|
20920
21006
|
}
|
|
@@ -20922,7 +21008,7 @@
|
|
|
20922
21008
|
env_1.error = e_1;
|
|
20923
21009
|
env_1.hasError = true;
|
|
20924
21010
|
} finally {
|
|
20925
|
-
|
|
21011
|
+
__disposeResources5(env_1);
|
|
20926
21012
|
}
|
|
20927
21013
|
}
|
|
20928
21014
|
return map2;
|
|
@@ -20942,7 +21028,7 @@
|
|
|
20942
21028
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Binding.js
|
|
20943
21029
|
init_util2();
|
|
20944
21030
|
init_disposable();
|
|
20945
|
-
var
|
|
21031
|
+
var __addDisposableResource6 = function(env, value, async2) {
|
|
20946
21032
|
if (value !== null && value !== void 0) {
|
|
20947
21033
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
20948
21034
|
var dispose;
|
|
@@ -20961,7 +21047,7 @@
|
|
|
20961
21047
|
}
|
|
20962
21048
|
return value;
|
|
20963
21049
|
};
|
|
20964
|
-
var
|
|
21050
|
+
var __disposeResources6 = /* @__PURE__ */ function(SuppressedError2) {
|
|
20965
21051
|
return function(env) {
|
|
20966
21052
|
function fail2(e9) {
|
|
20967
21053
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -20991,13 +21077,18 @@
|
|
|
20991
21077
|
var Binding = class {
|
|
20992
21078
|
#name;
|
|
20993
21079
|
#fn;
|
|
20994
|
-
|
|
21080
|
+
#initSource;
|
|
21081
|
+
constructor(name2, fn, initSource) {
|
|
20995
21082
|
this.#name = name2;
|
|
20996
21083
|
this.#fn = fn;
|
|
21084
|
+
this.#initSource = initSource;
|
|
20997
21085
|
}
|
|
20998
21086
|
get name() {
|
|
20999
21087
|
return this.#name;
|
|
21000
21088
|
}
|
|
21089
|
+
get initSource() {
|
|
21090
|
+
return this.#initSource;
|
|
21091
|
+
}
|
|
21001
21092
|
/**
|
|
21002
21093
|
* @param context - Context to run the binding in; the context should have
|
|
21003
21094
|
* the binding added to it beforehand.
|
|
@@ -21011,7 +21102,7 @@
|
|
|
21011
21102
|
if (!isTrivial) {
|
|
21012
21103
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
21013
21104
|
try {
|
|
21014
|
-
const handles =
|
|
21105
|
+
const handles = __addDisposableResource6(env_1, await context2.evaluateHandle((name2, seq) => {
|
|
21015
21106
|
return globalThis[name2].args.get(seq);
|
|
21016
21107
|
}, this.#name, id), false);
|
|
21017
21108
|
const properties = await handles.getProperties();
|
|
@@ -21032,7 +21123,7 @@
|
|
|
21032
21123
|
env_1.error = e_1;
|
|
21033
21124
|
env_1.hasError = true;
|
|
21034
21125
|
} finally {
|
|
21035
|
-
|
|
21126
|
+
__disposeResources6(env_1);
|
|
21036
21127
|
}
|
|
21037
21128
|
}
|
|
21038
21129
|
await context2.evaluate((name2, seq, result) => {
|
|
@@ -22162,6 +22253,9 @@
|
|
|
22162
22253
|
getAvailableTargets() {
|
|
22163
22254
|
return this.#availableTargetsByTargetId;
|
|
22164
22255
|
}
|
|
22256
|
+
getChildTargets(_target) {
|
|
22257
|
+
return /* @__PURE__ */ new Set();
|
|
22258
|
+
}
|
|
22165
22259
|
dispose() {
|
|
22166
22260
|
this.#connection.off("Target.targetCreated", this.#onTargetCreated);
|
|
22167
22261
|
this.#connection.off("Target.targetDestroyed", this.#onTargetDestroyed);
|
|
@@ -22306,7 +22400,7 @@
|
|
|
22306
22400
|
init_dirname();
|
|
22307
22401
|
init_buffer2();
|
|
22308
22402
|
init_disposable();
|
|
22309
|
-
var
|
|
22403
|
+
var __addDisposableResource7 = function(env, value, async2) {
|
|
22310
22404
|
if (value !== null && value !== void 0) {
|
|
22311
22405
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
22312
22406
|
var dispose;
|
|
@@ -22325,7 +22419,7 @@
|
|
|
22325
22419
|
}
|
|
22326
22420
|
return value;
|
|
22327
22421
|
};
|
|
22328
|
-
var
|
|
22422
|
+
var __disposeResources7 = /* @__PURE__ */ function(SuppressedError2) {
|
|
22329
22423
|
return function(env) {
|
|
22330
22424
|
function fail2(e9) {
|
|
22331
22425
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -22356,7 +22450,7 @@
|
|
|
22356
22450
|
async function* fastTransposeIteratorHandle(iterator2, size) {
|
|
22357
22451
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
22358
22452
|
try {
|
|
22359
|
-
const array =
|
|
22453
|
+
const array = __addDisposableResource7(env_1, await iterator2.evaluateHandle(async (iterator3, size2) => {
|
|
22360
22454
|
const results = [];
|
|
22361
22455
|
while (results.length < size2) {
|
|
22362
22456
|
const result = await iterator3.next();
|
|
@@ -22369,18 +22463,18 @@
|
|
|
22369
22463
|
}, size), false);
|
|
22370
22464
|
const properties = await array.getProperties();
|
|
22371
22465
|
const handles = properties.values();
|
|
22372
|
-
const stack =
|
|
22466
|
+
const stack = __addDisposableResource7(env_1, new DisposableStack(), false);
|
|
22373
22467
|
stack.defer(() => {
|
|
22374
22468
|
for (const handle_1 of handles) {
|
|
22375
22469
|
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
22376
22470
|
try {
|
|
22377
|
-
const handle =
|
|
22471
|
+
const handle = __addDisposableResource7(env_2, handle_1, false);
|
|
22378
22472
|
handle[disposeSymbol]();
|
|
22379
22473
|
} catch (e_2) {
|
|
22380
22474
|
env_2.error = e_2;
|
|
22381
22475
|
env_2.hasError = true;
|
|
22382
22476
|
} finally {
|
|
22383
|
-
|
|
22477
|
+
__disposeResources7(env_2);
|
|
22384
22478
|
}
|
|
22385
22479
|
}
|
|
22386
22480
|
});
|
|
@@ -22390,7 +22484,7 @@
|
|
|
22390
22484
|
env_1.error = e_1;
|
|
22391
22485
|
env_1.hasError = true;
|
|
22392
22486
|
} finally {
|
|
22393
|
-
|
|
22487
|
+
__disposeResources7(env_1);
|
|
22394
22488
|
}
|
|
22395
22489
|
}
|
|
22396
22490
|
async function* transposeIteratorHandle(iterator2) {
|
|
@@ -22402,7 +22496,7 @@
|
|
|
22402
22496
|
async function* transposeIterableHandle(handle) {
|
|
22403
22497
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
22404
22498
|
try {
|
|
22405
|
-
const generatorHandle =
|
|
22499
|
+
const generatorHandle = __addDisposableResource7(env_3, await handle.evaluateHandle((iterable) => {
|
|
22406
22500
|
return async function* () {
|
|
22407
22501
|
yield* iterable;
|
|
22408
22502
|
}();
|
|
@@ -22412,7 +22506,7 @@
|
|
|
22412
22506
|
env_3.error = e_3;
|
|
22413
22507
|
env_3.hasError = true;
|
|
22414
22508
|
} finally {
|
|
22415
|
-
|
|
22509
|
+
__disposeResources7(env_3);
|
|
22416
22510
|
}
|
|
22417
22511
|
}
|
|
22418
22512
|
|
|
@@ -22433,7 +22527,7 @@
|
|
|
22433
22527
|
};
|
|
22434
22528
|
|
|
22435
22529
|
// node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.js
|
|
22436
|
-
var
|
|
22530
|
+
var __addDisposableResource8 = function(env, value, async2) {
|
|
22437
22531
|
if (value !== null && value !== void 0) {
|
|
22438
22532
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
22439
22533
|
var dispose;
|
|
@@ -22452,7 +22546,7 @@
|
|
|
22452
22546
|
}
|
|
22453
22547
|
return value;
|
|
22454
22548
|
};
|
|
22455
|
-
var
|
|
22549
|
+
var __disposeResources8 = /* @__PURE__ */ function(SuppressedError2) {
|
|
22456
22550
|
return function(env) {
|
|
22457
22551
|
function fail2(e9) {
|
|
22458
22552
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -22526,7 +22620,7 @@
|
|
|
22526
22620
|
static async *queryAll(element, selector) {
|
|
22527
22621
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
22528
22622
|
try {
|
|
22529
|
-
const handle =
|
|
22623
|
+
const handle = __addDisposableResource8(env_1, await element.evaluateHandle(this._querySelectorAll, selector, LazyArg.create((context2) => {
|
|
22530
22624
|
return context2.puppeteerUtil;
|
|
22531
22625
|
})), false);
|
|
22532
22626
|
yield* transposeIterableHandle(handle);
|
|
@@ -22534,7 +22628,7 @@
|
|
|
22534
22628
|
env_1.error = e_1;
|
|
22535
22629
|
env_1.hasError = true;
|
|
22536
22630
|
} finally {
|
|
22537
|
-
|
|
22631
|
+
__disposeResources8(env_1);
|
|
22538
22632
|
}
|
|
22539
22633
|
}
|
|
22540
22634
|
/**
|
|
@@ -22545,7 +22639,7 @@
|
|
|
22545
22639
|
static async queryOne(element, selector) {
|
|
22546
22640
|
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
22547
22641
|
try {
|
|
22548
|
-
const result =
|
|
22642
|
+
const result = __addDisposableResource8(env_2, await element.evaluateHandle(this._querySelector, selector, LazyArg.create((context2) => {
|
|
22549
22643
|
return context2.puppeteerUtil;
|
|
22550
22644
|
})), false);
|
|
22551
22645
|
if (!(_isElementHandle in result)) {
|
|
@@ -22556,7 +22650,7 @@
|
|
|
22556
22650
|
env_2.error = e_2;
|
|
22557
22651
|
env_2.hasError = true;
|
|
22558
22652
|
} finally {
|
|
22559
|
-
|
|
22653
|
+
__disposeResources8(env_2);
|
|
22560
22654
|
}
|
|
22561
22655
|
}
|
|
22562
22656
|
/**
|
|
@@ -22570,7 +22664,7 @@
|
|
|
22570
22664
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
22571
22665
|
try {
|
|
22572
22666
|
let frame;
|
|
22573
|
-
const element =
|
|
22667
|
+
const element = __addDisposableResource8(env_3, await (async () => {
|
|
22574
22668
|
if (!(_isElementHandle in elementOrFrame)) {
|
|
22575
22669
|
frame = elementOrFrame;
|
|
22576
22670
|
return;
|
|
@@ -22584,7 +22678,7 @@
|
|
|
22584
22678
|
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
22585
22679
|
try {
|
|
22586
22680
|
signal?.throwIfAborted();
|
|
22587
|
-
const handle =
|
|
22681
|
+
const handle = __addDisposableResource8(env_4, await frame.isolatedRealm().waitForFunction(async (PuppeteerUtil, query, selector2, root, visible2) => {
|
|
22588
22682
|
const querySelector = PuppeteerUtil.createFunction(query);
|
|
22589
22683
|
const node = await querySelector(root ?? document, selector2, PuppeteerUtil);
|
|
22590
22684
|
return PuppeteerUtil.checkVisibility(node, visible2);
|
|
@@ -22607,7 +22701,7 @@
|
|
|
22607
22701
|
env_4.error = e_3;
|
|
22608
22702
|
env_4.hasError = true;
|
|
22609
22703
|
} finally {
|
|
22610
|
-
|
|
22704
|
+
__disposeResources8(env_4);
|
|
22611
22705
|
}
|
|
22612
22706
|
} catch (error) {
|
|
22613
22707
|
if (!isErrorLike(error)) {
|
|
@@ -22623,7 +22717,7 @@
|
|
|
22623
22717
|
env_3.error = e_4;
|
|
22624
22718
|
env_3.hasError = true;
|
|
22625
22719
|
} finally {
|
|
22626
|
-
|
|
22720
|
+
__disposeResources8(env_3);
|
|
22627
22721
|
}
|
|
22628
22722
|
}
|
|
22629
22723
|
};
|
|
@@ -23266,7 +23360,7 @@
|
|
|
23266
23360
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
23267
23361
|
done = true;
|
|
23268
23362
|
};
|
|
23269
|
-
var
|
|
23363
|
+
var __addDisposableResource9 = function(env, value, async2) {
|
|
23270
23364
|
if (value !== null && value !== void 0) {
|
|
23271
23365
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
23272
23366
|
var dispose;
|
|
@@ -23285,7 +23379,7 @@
|
|
|
23285
23379
|
}
|
|
23286
23380
|
return value;
|
|
23287
23381
|
};
|
|
23288
|
-
var
|
|
23382
|
+
var __disposeResources9 = /* @__PURE__ */ function(SuppressedError2) {
|
|
23289
23383
|
return function(env) {
|
|
23290
23384
|
function fail2(e9) {
|
|
23291
23385
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -23444,13 +23538,13 @@
|
|
|
23444
23538
|
if (!parentFrame) {
|
|
23445
23539
|
return null;
|
|
23446
23540
|
}
|
|
23447
|
-
const list =
|
|
23541
|
+
const list = __addDisposableResource9(env_1, await parentFrame.isolatedRealm().evaluateHandle(() => {
|
|
23448
23542
|
return document.querySelectorAll("iframe,frame");
|
|
23449
23543
|
}), false);
|
|
23450
23544
|
for await (const iframe_1 of transposeIterableHandle(list)) {
|
|
23451
23545
|
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
23452
23546
|
try {
|
|
23453
|
-
const iframe =
|
|
23547
|
+
const iframe = __addDisposableResource9(env_2, iframe_1, false);
|
|
23454
23548
|
const frame = await iframe.contentFrame();
|
|
23455
23549
|
if (frame?._id === this._id) {
|
|
23456
23550
|
return iframe.move();
|
|
@@ -23459,7 +23553,7 @@
|
|
|
23459
23553
|
env_2.error = e_1;
|
|
23460
23554
|
env_2.hasError = true;
|
|
23461
23555
|
} finally {
|
|
23462
|
-
|
|
23556
|
+
__disposeResources9(env_2);
|
|
23463
23557
|
}
|
|
23464
23558
|
}
|
|
23465
23559
|
return null;
|
|
@@ -23467,7 +23561,7 @@
|
|
|
23467
23561
|
env_1.error = e_2;
|
|
23468
23562
|
env_1.hasError = true;
|
|
23469
23563
|
} finally {
|
|
23470
|
-
|
|
23564
|
+
__disposeResources9(env_1);
|
|
23471
23565
|
}
|
|
23472
23566
|
}
|
|
23473
23567
|
/**
|
|
@@ -23873,7 +23967,7 @@
|
|
|
23873
23967
|
async click(selector, options = {}) {
|
|
23874
23968
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
23875
23969
|
try {
|
|
23876
|
-
const handle =
|
|
23970
|
+
const handle = __addDisposableResource9(env_3, await this.$(selector), false);
|
|
23877
23971
|
assert(handle, `No element found for selector: ${selector}`);
|
|
23878
23972
|
await handle.click(options);
|
|
23879
23973
|
await handle.dispose();
|
|
@@ -23881,7 +23975,7 @@
|
|
|
23881
23975
|
env_3.error = e_3;
|
|
23882
23976
|
env_3.hasError = true;
|
|
23883
23977
|
} finally {
|
|
23884
|
-
|
|
23978
|
+
__disposeResources9(env_3);
|
|
23885
23979
|
}
|
|
23886
23980
|
}
|
|
23887
23981
|
/**
|
|
@@ -23893,14 +23987,14 @@
|
|
|
23893
23987
|
async focus(selector) {
|
|
23894
23988
|
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
23895
23989
|
try {
|
|
23896
|
-
const handle =
|
|
23990
|
+
const handle = __addDisposableResource9(env_4, await this.$(selector), false);
|
|
23897
23991
|
assert(handle, `No element found for selector: ${selector}`);
|
|
23898
23992
|
await handle.focus();
|
|
23899
23993
|
} catch (e_4) {
|
|
23900
23994
|
env_4.error = e_4;
|
|
23901
23995
|
env_4.hasError = true;
|
|
23902
23996
|
} finally {
|
|
23903
|
-
|
|
23997
|
+
__disposeResources9(env_4);
|
|
23904
23998
|
}
|
|
23905
23999
|
}
|
|
23906
24000
|
/**
|
|
@@ -23913,14 +24007,14 @@
|
|
|
23913
24007
|
async hover(selector) {
|
|
23914
24008
|
const env_5 = { stack: [], error: void 0, hasError: false };
|
|
23915
24009
|
try {
|
|
23916
|
-
const handle =
|
|
24010
|
+
const handle = __addDisposableResource9(env_5, await this.$(selector), false);
|
|
23917
24011
|
assert(handle, `No element found for selector: ${selector}`);
|
|
23918
24012
|
await handle.hover();
|
|
23919
24013
|
} catch (e_5) {
|
|
23920
24014
|
env_5.error = e_5;
|
|
23921
24015
|
env_5.hasError = true;
|
|
23922
24016
|
} finally {
|
|
23923
|
-
|
|
24017
|
+
__disposeResources9(env_5);
|
|
23924
24018
|
}
|
|
23925
24019
|
}
|
|
23926
24020
|
/**
|
|
@@ -23944,14 +24038,14 @@
|
|
|
23944
24038
|
async select(selector, ...values) {
|
|
23945
24039
|
const env_6 = { stack: [], error: void 0, hasError: false };
|
|
23946
24040
|
try {
|
|
23947
|
-
const handle =
|
|
24041
|
+
const handle = __addDisposableResource9(env_6, await this.$(selector), false);
|
|
23948
24042
|
assert(handle, `No element found for selector: ${selector}`);
|
|
23949
24043
|
return await handle.select(...values);
|
|
23950
24044
|
} catch (e_6) {
|
|
23951
24045
|
env_6.error = e_6;
|
|
23952
24046
|
env_6.hasError = true;
|
|
23953
24047
|
} finally {
|
|
23954
|
-
|
|
24048
|
+
__disposeResources9(env_6);
|
|
23955
24049
|
}
|
|
23956
24050
|
}
|
|
23957
24051
|
/**
|
|
@@ -23963,14 +24057,14 @@
|
|
|
23963
24057
|
async tap(selector) {
|
|
23964
24058
|
const env_7 = { stack: [], error: void 0, hasError: false };
|
|
23965
24059
|
try {
|
|
23966
|
-
const handle =
|
|
24060
|
+
const handle = __addDisposableResource9(env_7, await this.$(selector), false);
|
|
23967
24061
|
assert(handle, `No element found for selector: ${selector}`);
|
|
23968
24062
|
await handle.tap();
|
|
23969
24063
|
} catch (e_7) {
|
|
23970
24064
|
env_7.error = e_7;
|
|
23971
24065
|
env_7.hasError = true;
|
|
23972
24066
|
} finally {
|
|
23973
|
-
|
|
24067
|
+
__disposeResources9(env_7);
|
|
23974
24068
|
}
|
|
23975
24069
|
}
|
|
23976
24070
|
/**
|
|
@@ -23997,14 +24091,14 @@
|
|
|
23997
24091
|
async type(selector, text, options) {
|
|
23998
24092
|
const env_8 = { stack: [], error: void 0, hasError: false };
|
|
23999
24093
|
try {
|
|
24000
|
-
const handle =
|
|
24094
|
+
const handle = __addDisposableResource9(env_8, await this.$(selector), false);
|
|
24001
24095
|
assert(handle, `No element found for selector: ${selector}`);
|
|
24002
24096
|
await handle.type(text, options);
|
|
24003
24097
|
} catch (e_8) {
|
|
24004
24098
|
env_8.error = e_8;
|
|
24005
24099
|
env_8.hasError = true;
|
|
24006
24100
|
} finally {
|
|
24007
|
-
|
|
24101
|
+
__disposeResources9(env_8);
|
|
24008
24102
|
}
|
|
24009
24103
|
}
|
|
24010
24104
|
/**
|
|
@@ -24025,6 +24119,40 @@
|
|
|
24025
24119
|
init_Deferred();
|
|
24026
24120
|
init_disposable();
|
|
24027
24121
|
|
|
24122
|
+
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/CdpPreloadScript.js
|
|
24123
|
+
init_dirname();
|
|
24124
|
+
init_buffer2();
|
|
24125
|
+
var CdpPreloadScript = class {
|
|
24126
|
+
/**
|
|
24127
|
+
* This is the ID of the preload script returned by
|
|
24128
|
+
* Page.addScriptToEvaluateOnNewDocument in the main frame.
|
|
24129
|
+
*
|
|
24130
|
+
* Sub-frames would get a different CDP ID because
|
|
24131
|
+
* addScriptToEvaluateOnNewDocument is called for each subframe. But
|
|
24132
|
+
* users only see this ID and subframe IDs are internal to Puppeteer.
|
|
24133
|
+
*/
|
|
24134
|
+
#id;
|
|
24135
|
+
#source;
|
|
24136
|
+
#frameToId = /* @__PURE__ */ new WeakMap();
|
|
24137
|
+
constructor(mainFrame, id, source2) {
|
|
24138
|
+
this.#id = id;
|
|
24139
|
+
this.#source = source2;
|
|
24140
|
+
this.#frameToId.set(mainFrame, id);
|
|
24141
|
+
}
|
|
24142
|
+
get id() {
|
|
24143
|
+
return this.#id;
|
|
24144
|
+
}
|
|
24145
|
+
get source() {
|
|
24146
|
+
return this.#source;
|
|
24147
|
+
}
|
|
24148
|
+
getIdForFrame(frame) {
|
|
24149
|
+
return this.#frameToId.get(frame);
|
|
24150
|
+
}
|
|
24151
|
+
setIdForFrame(frame, identifier) {
|
|
24152
|
+
this.#frameToId.set(frame, identifier);
|
|
24153
|
+
}
|
|
24154
|
+
};
|
|
24155
|
+
|
|
24028
24156
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/DeviceRequestPrompt.js
|
|
24029
24157
|
init_dirname();
|
|
24030
24158
|
init_buffer2();
|
|
@@ -24255,7 +24383,7 @@
|
|
|
24255
24383
|
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
24256
24384
|
done = true;
|
|
24257
24385
|
};
|
|
24258
|
-
var
|
|
24386
|
+
var __addDisposableResource10 = function(env, value, async2) {
|
|
24259
24387
|
if (value !== null && value !== void 0) {
|
|
24260
24388
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
24261
24389
|
var dispose;
|
|
@@ -24274,7 +24402,7 @@
|
|
|
24274
24402
|
}
|
|
24275
24403
|
return value;
|
|
24276
24404
|
};
|
|
24277
|
-
var
|
|
24405
|
+
var __disposeResources10 = /* @__PURE__ */ function(SuppressedError2) {
|
|
24278
24406
|
return function(env) {
|
|
24279
24407
|
function fail2(e9) {
|
|
24280
24408
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -24652,7 +24780,7 @@
|
|
|
24652
24780
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
24653
24781
|
try {
|
|
24654
24782
|
pageFunction = withSourcePuppeteerURLIfNone(this.$eval.name, pageFunction);
|
|
24655
|
-
const elementHandle =
|
|
24783
|
+
const elementHandle = __addDisposableResource10(env_1, await this.$(selector), false);
|
|
24656
24784
|
if (!elementHandle) {
|
|
24657
24785
|
throw new Error(`Error: failed to find element matching selector "${selector}"`);
|
|
24658
24786
|
}
|
|
@@ -24661,7 +24789,7 @@
|
|
|
24661
24789
|
env_1.error = e_1;
|
|
24662
24790
|
env_1.hasError = true;
|
|
24663
24791
|
} finally {
|
|
24664
|
-
|
|
24792
|
+
__disposeResources10(env_1);
|
|
24665
24793
|
}
|
|
24666
24794
|
}
|
|
24667
24795
|
/**
|
|
@@ -24716,7 +24844,7 @@
|
|
|
24716
24844
|
try {
|
|
24717
24845
|
pageFunction = withSourcePuppeteerURLIfNone(this.$$eval.name, pageFunction);
|
|
24718
24846
|
const results = await this.$$(selector);
|
|
24719
|
-
const elements =
|
|
24847
|
+
const elements = __addDisposableResource10(env_2, await this.evaluateHandle((_6, ...elements2) => {
|
|
24720
24848
|
return elements2;
|
|
24721
24849
|
}, ...results), false);
|
|
24722
24850
|
const [result] = await Promise.all([
|
|
@@ -24730,7 +24858,7 @@
|
|
|
24730
24858
|
env_2.error = e_2;
|
|
24731
24859
|
env_2.hasError = true;
|
|
24732
24860
|
} finally {
|
|
24733
|
-
|
|
24861
|
+
__disposeResources10(env_2);
|
|
24734
24862
|
}
|
|
24735
24863
|
}
|
|
24736
24864
|
/**
|
|
@@ -25110,7 +25238,7 @@
|
|
|
25110
25238
|
while (parentFrame = frame?.parentFrame()) {
|
|
25111
25239
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
25112
25240
|
try {
|
|
25113
|
-
const handle =
|
|
25241
|
+
const handle = __addDisposableResource10(env_3, await frame.frameElement(), false);
|
|
25114
25242
|
if (!handle) {
|
|
25115
25243
|
throw new Error("Unsupported frame type");
|
|
25116
25244
|
}
|
|
@@ -25138,7 +25266,7 @@
|
|
|
25138
25266
|
env_3.error = e_3;
|
|
25139
25267
|
env_3.hasError = true;
|
|
25140
25268
|
} finally {
|
|
25141
|
-
|
|
25269
|
+
__disposeResources10(env_3);
|
|
25142
25270
|
}
|
|
25143
25271
|
}
|
|
25144
25272
|
const box = boxes.find((box2) => {
|
|
@@ -25300,7 +25428,7 @@
|
|
|
25300
25428
|
while (parentFrame = frame?.parentFrame()) {
|
|
25301
25429
|
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
25302
25430
|
try {
|
|
25303
|
-
const handle =
|
|
25431
|
+
const handle = __addDisposableResource10(env_4, await frame.frameElement(), false);
|
|
25304
25432
|
if (!handle) {
|
|
25305
25433
|
throw new Error("Unsupported frame type");
|
|
25306
25434
|
}
|
|
@@ -25325,7 +25453,7 @@
|
|
|
25325
25453
|
env_4.error = e_4;
|
|
25326
25454
|
env_4.hasError = true;
|
|
25327
25455
|
} finally {
|
|
25328
|
-
|
|
25456
|
+
__disposeResources10(env_4);
|
|
25329
25457
|
}
|
|
25330
25458
|
}
|
|
25331
25459
|
return point;
|
|
@@ -25404,7 +25532,7 @@
|
|
|
25404
25532
|
try {
|
|
25405
25533
|
await this.assertConnectedElement();
|
|
25406
25534
|
const handle = await this.#asSVGElementHandle();
|
|
25407
|
-
const target =
|
|
25535
|
+
const target = __addDisposableResource10(env_5, handle && await handle.#getOwnerSVGElement(), false);
|
|
25408
25536
|
return await (target ?? this).evaluate(async (element, threshold) => {
|
|
25409
25537
|
const visibleRatio = await new Promise((resolve3) => {
|
|
25410
25538
|
const observer = new IntersectionObserver((entries) => {
|
|
@@ -25419,7 +25547,7 @@
|
|
|
25419
25547
|
env_5.error = e_5;
|
|
25420
25548
|
env_5.hasError = true;
|
|
25421
25549
|
} finally {
|
|
25422
|
-
|
|
25550
|
+
__disposeResources10(env_5);
|
|
25423
25551
|
}
|
|
25424
25552
|
}
|
|
25425
25553
|
/**
|
|
@@ -25579,9 +25707,8 @@
|
|
|
25579
25707
|
}
|
|
25580
25708
|
return remoteObject.value;
|
|
25581
25709
|
}
|
|
25582
|
-
function addPageBinding(type, name2) {
|
|
25583
|
-
|
|
25584
|
-
if (callCdp[Symbol.toStringTag] === "PuppeteerBinding") {
|
|
25710
|
+
function addPageBinding(type, name2, prefix) {
|
|
25711
|
+
if (globalThis[name2]) {
|
|
25585
25712
|
return;
|
|
25586
25713
|
}
|
|
25587
25714
|
Object.assign(globalThis, {
|
|
@@ -25592,7 +25719,7 @@
|
|
|
25592
25719
|
const seq = (callPuppeteer.lastSeq ?? 0) + 1;
|
|
25593
25720
|
callPuppeteer.lastSeq = seq;
|
|
25594
25721
|
callPuppeteer.args.set(seq, args);
|
|
25595
|
-
|
|
25722
|
+
globalThis[prefix + name2](JSON.stringify({
|
|
25596
25723
|
type,
|
|
25597
25724
|
name: name2,
|
|
25598
25725
|
seq,
|
|
@@ -25615,10 +25742,10 @@
|
|
|
25615
25742
|
});
|
|
25616
25743
|
}
|
|
25617
25744
|
});
|
|
25618
|
-
globalThis[name2][Symbol.toStringTag] = "PuppeteerBinding";
|
|
25619
25745
|
}
|
|
25746
|
+
var CDP_BINDING_PREFIX = "puppeteer_";
|
|
25620
25747
|
function pageBindingInitString(type, name2) {
|
|
25621
|
-
return evaluationString(addPageBinding, type, name2);
|
|
25748
|
+
return evaluationString(addPageBinding, type, name2, CDP_BINDING_PREFIX);
|
|
25622
25749
|
}
|
|
25623
25750
|
|
|
25624
25751
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/JSHandle.js
|
|
@@ -25880,7 +26007,7 @@
|
|
|
25880
26007
|
})();
|
|
25881
26008
|
|
|
25882
26009
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/ExecutionContext.js
|
|
25883
|
-
var
|
|
26010
|
+
var __addDisposableResource11 = function(env, value, async2) {
|
|
25884
26011
|
if (value !== null && value !== void 0) {
|
|
25885
26012
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
25886
26013
|
var dispose;
|
|
@@ -25899,7 +26026,7 @@
|
|
|
25899
26026
|
}
|
|
25900
26027
|
return value;
|
|
25901
26028
|
};
|
|
25902
|
-
var
|
|
26029
|
+
var __disposeResources11 = /* @__PURE__ */ function(SuppressedError2) {
|
|
25903
26030
|
return function(env) {
|
|
25904
26031
|
function fail2(e9) {
|
|
25905
26032
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -25926,13 +26053,23 @@
|
|
|
25926
26053
|
var e9 = new Error(message);
|
|
25927
26054
|
return e9.name = "SuppressedError", e9.error = error, e9.suppressed = suppressed, e9;
|
|
25928
26055
|
});
|
|
25929
|
-
var ariaQuerySelectorBinding = new Binding(
|
|
25930
|
-
|
|
25931
|
-
|
|
25932
|
-
|
|
25933
|
-
|
|
25934
|
-
|
|
25935
|
-
|
|
26056
|
+
var ariaQuerySelectorBinding = new Binding(
|
|
26057
|
+
"__ariaQuerySelector",
|
|
26058
|
+
ARIAQueryHandler.queryOne,
|
|
26059
|
+
""
|
|
26060
|
+
// custom init
|
|
26061
|
+
);
|
|
26062
|
+
var ariaQuerySelectorAllBinding = new Binding(
|
|
26063
|
+
"__ariaQuerySelectorAll",
|
|
26064
|
+
async (element, selector) => {
|
|
26065
|
+
const results = ARIAQueryHandler.queryAll(element, selector);
|
|
26066
|
+
return await element.realm.evaluateHandle((...elements) => {
|
|
26067
|
+
return elements;
|
|
26068
|
+
}, ...await AsyncIterableUtil.collect(results));
|
|
26069
|
+
},
|
|
26070
|
+
""
|
|
26071
|
+
// custom init
|
|
26072
|
+
);
|
|
25936
26073
|
var ExecutionContext = class extends EventEmitter2 {
|
|
25937
26074
|
#client;
|
|
25938
26075
|
#world;
|
|
@@ -25973,16 +26110,16 @@
|
|
|
25973
26110
|
if (this.#bindings.has(binding.name)) {
|
|
25974
26111
|
return;
|
|
25975
26112
|
}
|
|
25976
|
-
const _4 =
|
|
26113
|
+
const _4 = __addDisposableResource11(env_1, await this.#mutex.acquire(), false);
|
|
25977
26114
|
try {
|
|
25978
26115
|
await this.#client.send("Runtime.addBinding", this.#name ? {
|
|
25979
|
-
name: binding.name,
|
|
26116
|
+
name: CDP_BINDING_PREFIX + binding.name,
|
|
25980
26117
|
executionContextName: this.#name
|
|
25981
26118
|
} : {
|
|
25982
|
-
name: binding.name,
|
|
26119
|
+
name: CDP_BINDING_PREFIX + binding.name,
|
|
25983
26120
|
executionContextId: this.#id
|
|
25984
26121
|
});
|
|
25985
|
-
await this.evaluate(addPageBinding, "internal", binding.name);
|
|
26122
|
+
await this.evaluate(addPageBinding, "internal", binding.name, CDP_BINDING_PREFIX);
|
|
25986
26123
|
this.#bindings.set(binding.name, binding);
|
|
25987
26124
|
} catch (error) {
|
|
25988
26125
|
if (error instanceof Error) {
|
|
@@ -25999,7 +26136,7 @@
|
|
|
25999
26136
|
env_1.error = e_1;
|
|
26000
26137
|
env_1.hasError = true;
|
|
26001
26138
|
} finally {
|
|
26002
|
-
|
|
26139
|
+
__disposeResources11(env_1);
|
|
26003
26140
|
}
|
|
26004
26141
|
}
|
|
26005
26142
|
async #onBindingCalled(event) {
|
|
@@ -26269,6 +26406,7 @@ ${sourceUrlComment}
|
|
|
26269
26406
|
init_dirname();
|
|
26270
26407
|
init_buffer2();
|
|
26271
26408
|
init_Errors();
|
|
26409
|
+
init_util2();
|
|
26272
26410
|
init_Deferred();
|
|
26273
26411
|
init_disposable();
|
|
26274
26412
|
|
|
@@ -27208,6 +27346,9 @@ ${sourceUrlComment}
|
|
|
27208
27346
|
let _goto_decorators;
|
|
27209
27347
|
let _waitForNavigation_decorators;
|
|
27210
27348
|
let _setContent_decorators;
|
|
27349
|
+
let _addPreloadScript_decorators;
|
|
27350
|
+
let _addExposedFunctionBinding_decorators;
|
|
27351
|
+
let _removeExposedFunctionBinding_decorators;
|
|
27211
27352
|
let _waitForDevicePrompt_decorators;
|
|
27212
27353
|
return class CdpFrame extends _classSuper {
|
|
27213
27354
|
static {
|
|
@@ -27215,6 +27356,9 @@ ${sourceUrlComment}
|
|
|
27215
27356
|
__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);
|
|
27216
27357
|
__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);
|
|
27217
27358
|
__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);
|
|
27359
|
+
__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);
|
|
27360
|
+
__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);
|
|
27361
|
+
__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);
|
|
27218
27362
|
__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);
|
|
27219
27363
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
27220
27364
|
}
|
|
@@ -27388,6 +27532,42 @@ ${sourceUrlComment}
|
|
|
27388
27532
|
return rootFrame._frameManager._deviceRequestPromptManager(this.#client);
|
|
27389
27533
|
}
|
|
27390
27534
|
}
|
|
27535
|
+
async addPreloadScript(preloadScript) {
|
|
27536
|
+
if (!this.isOOPFrame() && this !== this._frameManager.mainFrame()) {
|
|
27537
|
+
return;
|
|
27538
|
+
}
|
|
27539
|
+
if (preloadScript.getIdForFrame(this)) {
|
|
27540
|
+
return;
|
|
27541
|
+
}
|
|
27542
|
+
const { identifier } = await this.#client.send("Page.addScriptToEvaluateOnNewDocument", {
|
|
27543
|
+
source: preloadScript.source
|
|
27544
|
+
});
|
|
27545
|
+
preloadScript.setIdForFrame(this, identifier);
|
|
27546
|
+
}
|
|
27547
|
+
async addExposedFunctionBinding(binding) {
|
|
27548
|
+
if (this !== this._frameManager.mainFrame() && !this._hasStartedLoading) {
|
|
27549
|
+
return;
|
|
27550
|
+
}
|
|
27551
|
+
await Promise.all([
|
|
27552
|
+
this.#client.send("Runtime.addBinding", {
|
|
27553
|
+
name: CDP_BINDING_PREFIX + binding.name
|
|
27554
|
+
}),
|
|
27555
|
+
this.evaluate(binding.initSource).catch(debugError)
|
|
27556
|
+
]);
|
|
27557
|
+
}
|
|
27558
|
+
async removeExposedFunctionBinding(binding) {
|
|
27559
|
+
if (this !== this._frameManager.mainFrame() && !this._hasStartedLoading) {
|
|
27560
|
+
return;
|
|
27561
|
+
}
|
|
27562
|
+
await Promise.all([
|
|
27563
|
+
this.#client.send("Runtime.removeBinding", {
|
|
27564
|
+
name: CDP_BINDING_PREFIX + binding.name
|
|
27565
|
+
}),
|
|
27566
|
+
this.evaluate((name2) => {
|
|
27567
|
+
globalThis[name2] = void 0;
|
|
27568
|
+
}, binding.name).catch(debugError)
|
|
27569
|
+
]);
|
|
27570
|
+
}
|
|
27391
27571
|
async waitForDevicePrompt(options = {}) {
|
|
27392
27572
|
return await this.#deviceRequestPromptManager().waitForDevicePrompt(options);
|
|
27393
27573
|
}
|
|
@@ -27415,7 +27595,7 @@ ${sourceUrlComment}
|
|
|
27415
27595
|
get detached() {
|
|
27416
27596
|
return this.#detached;
|
|
27417
27597
|
}
|
|
27418
|
-
[(_goto_decorators = [throwIfDetached], _waitForNavigation_decorators = [throwIfDetached], _setContent_decorators = [throwIfDetached], _waitForDevicePrompt_decorators = [throwIfDetached], disposeSymbol)]() {
|
|
27598
|
+
[(_goto_decorators = [throwIfDetached], _waitForNavigation_decorators = [throwIfDetached], _setContent_decorators = [throwIfDetached], _addPreloadScript_decorators = [throwIfDetached], _addExposedFunctionBinding_decorators = [throwIfDetached], _removeExposedFunctionBinding_decorators = [throwIfDetached], _waitForDevicePrompt_decorators = [throwIfDetached], disposeSymbol)]() {
|
|
27419
27599
|
if (this.#detached) {
|
|
27420
27600
|
return;
|
|
27421
27601
|
}
|
|
@@ -27790,6 +27970,20 @@ ${sourceUrlComment}
|
|
|
27790
27970
|
return;
|
|
27791
27971
|
}
|
|
27792
27972
|
}
|
|
27973
|
+
/**
|
|
27974
|
+
* @internal
|
|
27975
|
+
*/
|
|
27976
|
+
static getResponse(body) {
|
|
27977
|
+
const byteBody = isString3(body) ? new TextEncoder().encode(body) : body;
|
|
27978
|
+
const bytes = [];
|
|
27979
|
+
for (const byte of byteBody) {
|
|
27980
|
+
bytes.push(String.fromCharCode(byte));
|
|
27981
|
+
}
|
|
27982
|
+
return {
|
|
27983
|
+
contentLength: byteBody.byteLength,
|
|
27984
|
+
base64: btoa(bytes.join(""))
|
|
27985
|
+
};
|
|
27986
|
+
}
|
|
27793
27987
|
};
|
|
27794
27988
|
var InterceptResolutionAction;
|
|
27795
27989
|
(function(InterceptResolutionAction2) {
|
|
@@ -27996,7 +28190,7 @@ ${sourceUrlComment}
|
|
|
27996
28190
|
async _continue(overrides = {}) {
|
|
27997
28191
|
const { url, method, postData, headers } = overrides;
|
|
27998
28192
|
this.interception.handled = true;
|
|
27999
|
-
const postDataBinaryBase64 = postData ?
|
|
28193
|
+
const postDataBinaryBase64 = postData ? btoa(postData) : void 0;
|
|
28000
28194
|
if (this._interceptionId === void 0) {
|
|
28001
28195
|
throw new Error("HTTPRequest is missing _interceptionId needed for Fetch.continueRequest");
|
|
28002
28196
|
}
|
|
@@ -28013,7 +28207,10 @@ ${sourceUrlComment}
|
|
|
28013
28207
|
}
|
|
28014
28208
|
async _respond(response) {
|
|
28015
28209
|
this.interception.handled = true;
|
|
28016
|
-
|
|
28210
|
+
let parsedBody;
|
|
28211
|
+
if (response.body) {
|
|
28212
|
+
parsedBody = HTTPRequest.getResponse(response.body);
|
|
28213
|
+
}
|
|
28017
28214
|
const responseHeaders = {};
|
|
28018
28215
|
if (response.headers) {
|
|
28019
28216
|
for (const header of Object.keys(response.headers)) {
|
|
@@ -28026,8 +28223,8 @@ ${sourceUrlComment}
|
|
|
28026
28223
|
if (response.contentType) {
|
|
28027
28224
|
responseHeaders["content-type"] = response.contentType;
|
|
28028
28225
|
}
|
|
28029
|
-
if (
|
|
28030
|
-
responseHeaders["content-length"] = String(
|
|
28226
|
+
if (parsedBody?.contentLength && !("content-length" in responseHeaders)) {
|
|
28227
|
+
responseHeaders["content-length"] = String(parsedBody.contentLength);
|
|
28031
28228
|
}
|
|
28032
28229
|
const status = response.status || 200;
|
|
28033
28230
|
if (this._interceptionId === void 0) {
|
|
@@ -28038,7 +28235,7 @@ ${sourceUrlComment}
|
|
|
28038
28235
|
responseCode: status,
|
|
28039
28236
|
responsePhrase: STATUS_TEXTS[status],
|
|
28040
28237
|
responseHeaders: headersArray(responseHeaders),
|
|
28041
|
-
body:
|
|
28238
|
+
body: parsedBody?.base64
|
|
28042
28239
|
}).catch((error) => {
|
|
28043
28240
|
this.interception.handled = false;
|
|
28044
28241
|
return handleError(error);
|
|
@@ -28809,6 +29006,8 @@ ${sourceUrlComment}
|
|
|
28809
29006
|
#timeoutSettings;
|
|
28810
29007
|
#isolatedWorlds = /* @__PURE__ */ new Set();
|
|
28811
29008
|
#client;
|
|
29009
|
+
#scriptsToEvaluateOnNewDocument = /* @__PURE__ */ new Map();
|
|
29010
|
+
#bindings = /* @__PURE__ */ new Set();
|
|
28812
29011
|
_frameTree = new FrameTree();
|
|
28813
29012
|
/**
|
|
28814
29013
|
* Set of frame IDs stored to indicate if a frame has received a
|
|
@@ -28884,7 +29083,7 @@ ${sourceUrlComment}
|
|
|
28884
29083
|
client.once(CDPSessionEvent.Disconnected, () => {
|
|
28885
29084
|
this.#onClientDisconnect().catch(debugError);
|
|
28886
29085
|
});
|
|
28887
|
-
await this.initialize(client);
|
|
29086
|
+
await this.initialize(client, frame);
|
|
28888
29087
|
await this.#networkManager.addClient(client);
|
|
28889
29088
|
if (frame) {
|
|
28890
29089
|
frame.emit(FrameEvent.FrameSwappedByActivation, void 0);
|
|
@@ -28928,7 +29127,7 @@ ${sourceUrlComment}
|
|
|
28928
29127
|
this.#onLifecycleEvent(event);
|
|
28929
29128
|
});
|
|
28930
29129
|
}
|
|
28931
|
-
async initialize(client) {
|
|
29130
|
+
async initialize(client, frame) {
|
|
28932
29131
|
try {
|
|
28933
29132
|
this.#frameTreeHandled?.resolve();
|
|
28934
29133
|
this.#frameTreeHandled = Deferred.create();
|
|
@@ -28942,6 +29141,12 @@ ${sourceUrlComment}
|
|
|
28942
29141
|
client.send("Page.setLifecycleEventsEnabled", { enabled: true }),
|
|
28943
29142
|
client.send("Runtime.enable").then(() => {
|
|
28944
29143
|
return this.#createIsolatedWorld(client, UTILITY_WORLD_NAME);
|
|
29144
|
+
}),
|
|
29145
|
+
...(frame ? Array.from(this.#scriptsToEvaluateOnNewDocument.values()) : []).map((script) => {
|
|
29146
|
+
return frame?.addPreloadScript(script);
|
|
29147
|
+
}),
|
|
29148
|
+
...(frame ? Array.from(this.#bindings.values()) : []).map((binding) => {
|
|
29149
|
+
return frame?.addExposedFunctionBinding(binding);
|
|
28945
29150
|
})
|
|
28946
29151
|
]);
|
|
28947
29152
|
} catch (error) {
|
|
@@ -28966,6 +29171,45 @@ ${sourceUrlComment}
|
|
|
28966
29171
|
frame(frameId) {
|
|
28967
29172
|
return this._frameTree.getById(frameId) || null;
|
|
28968
29173
|
}
|
|
29174
|
+
async addExposedFunctionBinding(binding) {
|
|
29175
|
+
this.#bindings.add(binding);
|
|
29176
|
+
await Promise.all(this.frames().map(async (frame) => {
|
|
29177
|
+
return await frame.addExposedFunctionBinding(binding);
|
|
29178
|
+
}));
|
|
29179
|
+
}
|
|
29180
|
+
async removeExposedFunctionBinding(binding) {
|
|
29181
|
+
this.#bindings.delete(binding);
|
|
29182
|
+
await Promise.all(this.frames().map(async (frame) => {
|
|
29183
|
+
return await frame.removeExposedFunctionBinding(binding);
|
|
29184
|
+
}));
|
|
29185
|
+
}
|
|
29186
|
+
async evaluateOnNewDocument(source2) {
|
|
29187
|
+
const { identifier } = await this.mainFrame()._client().send("Page.addScriptToEvaluateOnNewDocument", {
|
|
29188
|
+
source: source2
|
|
29189
|
+
});
|
|
29190
|
+
const preloadScript = new CdpPreloadScript(this.mainFrame(), identifier, source2);
|
|
29191
|
+
this.#scriptsToEvaluateOnNewDocument.set(identifier, preloadScript);
|
|
29192
|
+
await Promise.all(this.frames().map(async (frame) => {
|
|
29193
|
+
return await frame.addPreloadScript(preloadScript);
|
|
29194
|
+
}));
|
|
29195
|
+
return { identifier };
|
|
29196
|
+
}
|
|
29197
|
+
async removeScriptToEvaluateOnNewDocument(identifier) {
|
|
29198
|
+
const preloadScript = this.#scriptsToEvaluateOnNewDocument.get(identifier);
|
|
29199
|
+
if (!preloadScript) {
|
|
29200
|
+
throw new Error(`Script to evaluate on new document with id ${identifier} not found`);
|
|
29201
|
+
}
|
|
29202
|
+
this.#scriptsToEvaluateOnNewDocument.delete(identifier);
|
|
29203
|
+
await Promise.all(this.frames().map((frame) => {
|
|
29204
|
+
const identifier2 = preloadScript.getIdForFrame(frame);
|
|
29205
|
+
if (!identifier2) {
|
|
29206
|
+
return;
|
|
29207
|
+
}
|
|
29208
|
+
return frame._client().send("Page.removeScriptToEvaluateOnNewDocument", {
|
|
29209
|
+
identifier: identifier2
|
|
29210
|
+
}).catch(debugError);
|
|
29211
|
+
}));
|
|
29212
|
+
}
|
|
28969
29213
|
onAttachedToTarget(target) {
|
|
28970
29214
|
if (target._getTargetInfo().type !== "iframe") {
|
|
28971
29215
|
return;
|
|
@@ -28975,7 +29219,7 @@ ${sourceUrlComment}
|
|
|
28975
29219
|
frame.updateClient(target._session());
|
|
28976
29220
|
}
|
|
28977
29221
|
this.setupEventListeners(target._session());
|
|
28978
|
-
void this.initialize(target._session());
|
|
29222
|
+
void this.initialize(target._session(), frame);
|
|
28979
29223
|
}
|
|
28980
29224
|
_deviceRequestPromptManager(client) {
|
|
28981
29225
|
let manager = this.#deviceRequestPromptManagerMap.get(client);
|
|
@@ -30249,7 +30493,7 @@ ${sourceUrlComment}
|
|
|
30249
30493
|
};
|
|
30250
30494
|
|
|
30251
30495
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Page.js
|
|
30252
|
-
var
|
|
30496
|
+
var __addDisposableResource12 = function(env, value, async2) {
|
|
30253
30497
|
if (value !== null && value !== void 0) {
|
|
30254
30498
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
30255
30499
|
var dispose;
|
|
@@ -30268,7 +30512,7 @@ ${sourceUrlComment}
|
|
|
30268
30512
|
}
|
|
30269
30513
|
return value;
|
|
30270
30514
|
};
|
|
30271
|
-
var
|
|
30515
|
+
var __disposeResources12 = /* @__PURE__ */ function(SuppressedError2) {
|
|
30272
30516
|
return function(env) {
|
|
30273
30517
|
function fail2(e9) {
|
|
30274
30518
|
env.error = env.hasError ? new SuppressedError2(e9, env.error, "An error was suppressed during disposal.") : e9;
|
|
@@ -30457,6 +30701,25 @@ ${sourceUrlComment}
|
|
|
30457
30701
|
this.#closed = true;
|
|
30458
30702
|
}).catch(debugError);
|
|
30459
30703
|
this.#setupPrimaryTargetListeners();
|
|
30704
|
+
this.#attachExistingTargets();
|
|
30705
|
+
}
|
|
30706
|
+
#attachExistingTargets() {
|
|
30707
|
+
const queue = [];
|
|
30708
|
+
for (const childTarget of this.#targetManager.getChildTargets(this.#primaryTarget)) {
|
|
30709
|
+
queue.push(childTarget);
|
|
30710
|
+
}
|
|
30711
|
+
let idx = 0;
|
|
30712
|
+
while (idx < queue.length) {
|
|
30713
|
+
const next = queue[idx];
|
|
30714
|
+
idx++;
|
|
30715
|
+
const session = next._session();
|
|
30716
|
+
if (session) {
|
|
30717
|
+
this.#onAttachedToTarget(session);
|
|
30718
|
+
}
|
|
30719
|
+
for (const childTarget of this.#targetManager.getChildTargets(next)) {
|
|
30720
|
+
queue.push(childTarget);
|
|
30721
|
+
}
|
|
30722
|
+
}
|
|
30460
30723
|
}
|
|
30461
30724
|
async #onActivation(newSession) {
|
|
30462
30725
|
this.#primaryTargetClient = newSession;
|
|
@@ -30532,7 +30795,7 @@ ${sourceUrlComment}
|
|
|
30532
30795
|
}
|
|
30533
30796
|
const frame = this.#frameManager.frame(event.frameId);
|
|
30534
30797
|
assert(frame, "This should never happen.");
|
|
30535
|
-
const handle =
|
|
30798
|
+
const handle = __addDisposableResource12(env_1, await frame.worlds[MAIN_WORLD].adoptBackendNode(event.backendNodeId), false);
|
|
30536
30799
|
const fileChooser = new FileChooser(handle.move(), event);
|
|
30537
30800
|
for (const promise of this.#fileChooserDeferreds) {
|
|
30538
30801
|
promise.resolve(fileChooser);
|
|
@@ -30542,7 +30805,7 @@ ${sourceUrlComment}
|
|
|
30542
30805
|
env_1.error = e_1;
|
|
30543
30806
|
env_1.hasError = true;
|
|
30544
30807
|
} finally {
|
|
30545
|
-
|
|
30808
|
+
__disposeResources12(env_1);
|
|
30546
30809
|
}
|
|
30547
30810
|
}
|
|
30548
30811
|
_client() {
|
|
@@ -30711,46 +30974,35 @@ ${sourceUrlComment}
|
|
|
30711
30974
|
if (this.#bindings.has(name2)) {
|
|
30712
30975
|
throw new Error(`Failed to add page binding with name ${name2}: window['${name2}'] already exists!`);
|
|
30713
30976
|
}
|
|
30977
|
+
const source2 = pageBindingInitString("exposedFun", name2);
|
|
30714
30978
|
let binding;
|
|
30715
30979
|
switch (typeof pptrFunction) {
|
|
30716
30980
|
case "function":
|
|
30717
|
-
binding = new Binding(name2, pptrFunction);
|
|
30981
|
+
binding = new Binding(name2, pptrFunction, source2);
|
|
30718
30982
|
break;
|
|
30719
30983
|
default:
|
|
30720
|
-
binding = new Binding(name2, pptrFunction.default);
|
|
30984
|
+
binding = new Binding(name2, pptrFunction.default, source2);
|
|
30721
30985
|
break;
|
|
30722
30986
|
}
|
|
30723
30987
|
this.#bindings.set(name2, binding);
|
|
30724
|
-
const
|
|
30725
|
-
|
|
30726
|
-
|
|
30727
|
-
|
|
30728
|
-
});
|
|
30988
|
+
const [{ identifier }] = await Promise.all([
|
|
30989
|
+
this.#frameManager.evaluateOnNewDocument(source2),
|
|
30990
|
+
this.#frameManager.addExposedFunctionBinding(binding)
|
|
30991
|
+
]);
|
|
30729
30992
|
this.#exposedFunctions.set(name2, identifier);
|
|
30730
|
-
await Promise.all(this.frames().map((frame) => {
|
|
30731
|
-
if (frame !== this.mainFrame() && !frame._hasStartedLoading) {
|
|
30732
|
-
return;
|
|
30733
|
-
}
|
|
30734
|
-
return frame.evaluate(expression).catch(debugError);
|
|
30735
|
-
}));
|
|
30736
30993
|
}
|
|
30737
30994
|
async removeExposedFunction(name2) {
|
|
30738
|
-
const
|
|
30739
|
-
if (!
|
|
30740
|
-
throw new Error(`
|
|
30995
|
+
const exposedFunctionId = this.#exposedFunctions.get(name2);
|
|
30996
|
+
if (!exposedFunctionId) {
|
|
30997
|
+
throw new Error(`Function with name "${name2}" does not exist`);
|
|
30741
30998
|
}
|
|
30742
|
-
|
|
30743
|
-
await this.removeScriptToEvaluateOnNewDocument(exposedFun);
|
|
30744
|
-
await Promise.all(this.frames().map((frame) => {
|
|
30745
|
-
if (frame !== this.mainFrame() && !frame._hasStartedLoading) {
|
|
30746
|
-
return;
|
|
30747
|
-
}
|
|
30748
|
-
return frame.evaluate((name3) => {
|
|
30749
|
-
globalThis[name3] = void 0;
|
|
30750
|
-
}, name2).catch(debugError);
|
|
30751
|
-
}));
|
|
30999
|
+
const binding = this.#bindings.get(name2);
|
|
30752
31000
|
this.#exposedFunctions.delete(name2);
|
|
30753
31001
|
this.#bindings.delete(name2);
|
|
31002
|
+
await Promise.all([
|
|
31003
|
+
this.#frameManager.removeScriptToEvaluateOnNewDocument(exposedFunctionId),
|
|
31004
|
+
this.#frameManager.removeExposedFunctionBinding(binding)
|
|
31005
|
+
]);
|
|
30754
31006
|
}
|
|
30755
31007
|
async authenticate(credentials) {
|
|
30756
31008
|
return await this.#frameManager.networkManager.authenticate(credentials);
|
|
@@ -30916,15 +31168,10 @@ ${sourceUrlComment}
|
|
|
30916
31168
|
}
|
|
30917
31169
|
async evaluateOnNewDocument(pageFunction, ...args) {
|
|
30918
31170
|
const source2 = evaluationString(pageFunction, ...args);
|
|
30919
|
-
|
|
30920
|
-
source: source2
|
|
30921
|
-
});
|
|
30922
|
-
return { identifier };
|
|
31171
|
+
return await this.#frameManager.evaluateOnNewDocument(source2);
|
|
30923
31172
|
}
|
|
30924
31173
|
async removeScriptToEvaluateOnNewDocument(identifier) {
|
|
30925
|
-
await this.#
|
|
30926
|
-
identifier
|
|
30927
|
-
});
|
|
31174
|
+
return await this.#frameManager.removeScriptToEvaluateOnNewDocument(identifier);
|
|
30928
31175
|
}
|
|
30929
31176
|
async setCacheEnabled(enabled = true) {
|
|
30930
31177
|
await this.#frameManager.networkManager.setCacheEnabled(enabled);
|
|
@@ -30934,7 +31181,7 @@ ${sourceUrlComment}
|
|
|
30934
31181
|
try {
|
|
30935
31182
|
const { fromSurface, omitBackground, optimizeForSpeed, quality, clip: userClip, type, captureBeyondViewport } = options;
|
|
30936
31183
|
const isFirefox = this.target()._targetManager() instanceof FirefoxTargetManager;
|
|
30937
|
-
const stack =
|
|
31184
|
+
const stack = __addDisposableResource12(env_2, new AsyncDisposableStack(), true);
|
|
30938
31185
|
if (!isFirefox && omitBackground && (type === "png" || type === "webp")) {
|
|
30939
31186
|
await this.#emulationManager.setTransparentBackgroundColor();
|
|
30940
31187
|
stack.defer(async () => {
|
|
@@ -30962,20 +31209,22 @@ ${sourceUrlComment}
|
|
|
30962
31209
|
env_2.error = e_2;
|
|
30963
31210
|
env_2.hasError = true;
|
|
30964
31211
|
} finally {
|
|
30965
|
-
const result_1 =
|
|
31212
|
+
const result_1 = __disposeResources12(env_2);
|
|
30966
31213
|
if (result_1)
|
|
30967
31214
|
await result_1;
|
|
30968
31215
|
}
|
|
30969
31216
|
}
|
|
30970
31217
|
async createPDFStream(options = {}) {
|
|
30971
31218
|
const { timeout: ms = this._timeoutSettings.timeout() } = options;
|
|
30972
|
-
const { landscape, displayHeaderFooter, headerTemplate, footerTemplate, printBackground, scale, width: paperWidth, height: paperHeight, margin, pageRanges, preferCSSPageSize, omitBackground, tagged: generateTaggedPDF, outline: generateDocumentOutline } = parsePDFOptions(options);
|
|
31219
|
+
const { landscape, displayHeaderFooter, headerTemplate, footerTemplate, printBackground, scale, width: paperWidth, height: paperHeight, margin, pageRanges, preferCSSPageSize, omitBackground, tagged: generateTaggedPDF, outline: generateDocumentOutline, waitForFonts } = parsePDFOptions(options);
|
|
30973
31220
|
if (omitBackground) {
|
|
30974
31221
|
await this.#emulationManager.setTransparentBackgroundColor();
|
|
30975
31222
|
}
|
|
30976
|
-
|
|
30977
|
-
|
|
30978
|
-
|
|
31223
|
+
if (waitForFonts) {
|
|
31224
|
+
await firstValueFrom(from(this.mainFrame().isolatedRealm().evaluate(() => {
|
|
31225
|
+
return document.fonts.ready;
|
|
31226
|
+
})).pipe(raceWith(timeout(ms))));
|
|
31227
|
+
}
|
|
30979
31228
|
const printCommandPromise = this.#primaryTargetClient.send("Page.printToPDF", {
|
|
30980
31229
|
transferMode: "ReturnAsStream",
|
|
30981
31230
|
landscape,
|
|
@@ -31010,16 +31259,25 @@ ${sourceUrlComment}
|
|
|
31010
31259
|
return buffer2;
|
|
31011
31260
|
}
|
|
31012
31261
|
async close(options = { runBeforeUnload: void 0 }) {
|
|
31013
|
-
const
|
|
31014
|
-
|
|
31015
|
-
|
|
31016
|
-
|
|
31017
|
-
|
|
31018
|
-
|
|
31019
|
-
|
|
31020
|
-
|
|
31021
|
-
}
|
|
31022
|
-
|
|
31262
|
+
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
31263
|
+
try {
|
|
31264
|
+
const _guard = __addDisposableResource12(env_3, await this.browserContext().waitForScreenshotOperations(), false);
|
|
31265
|
+
const connection = this.#primaryTargetClient.connection();
|
|
31266
|
+
assert(connection, "Protocol error: Connection closed. Most likely the page has been closed.");
|
|
31267
|
+
const runBeforeUnload = !!options.runBeforeUnload;
|
|
31268
|
+
if (runBeforeUnload) {
|
|
31269
|
+
await this.#primaryTargetClient.send("Page.close");
|
|
31270
|
+
} else {
|
|
31271
|
+
await connection.send("Target.closeTarget", {
|
|
31272
|
+
targetId: this.#primaryTarget._targetId
|
|
31273
|
+
});
|
|
31274
|
+
await this.#tabTarget._isClosedDeferred.valueOrThrow();
|
|
31275
|
+
}
|
|
31276
|
+
} catch (e_3) {
|
|
31277
|
+
env_3.error = e_3;
|
|
31278
|
+
env_3.hasError = true;
|
|
31279
|
+
} finally {
|
|
31280
|
+
__disposeResources12(env_3);
|
|
31023
31281
|
}
|
|
31024
31282
|
}
|
|
31025
31283
|
isClosed() {
|
|
@@ -31093,6 +31351,7 @@ ${sourceUrlComment}
|
|
|
31093
31351
|
#targetInfo;
|
|
31094
31352
|
#targetManager;
|
|
31095
31353
|
#sessionFactory;
|
|
31354
|
+
#childTargets = /* @__PURE__ */ new Set();
|
|
31096
31355
|
_initializedDeferred = Deferred.create();
|
|
31097
31356
|
_isClosedDeferred = Deferred.create();
|
|
31098
31357
|
_targetId;
|
|
@@ -31128,6 +31387,15 @@ ${sourceUrlComment}
|
|
|
31128
31387
|
_session() {
|
|
31129
31388
|
return this.#session;
|
|
31130
31389
|
}
|
|
31390
|
+
_addChildTarget(target) {
|
|
31391
|
+
this.#childTargets.add(target);
|
|
31392
|
+
}
|
|
31393
|
+
_removeChildTarget(target) {
|
|
31394
|
+
this.#childTargets.delete(target);
|
|
31395
|
+
}
|
|
31396
|
+
_childTargets() {
|
|
31397
|
+
return this.#childTargets;
|
|
31398
|
+
}
|
|
31131
31399
|
_sessionFactory() {
|
|
31132
31400
|
if (!this.#sessionFactory) {
|
|
31133
31401
|
throw new Error("sessionFactory is not initialized");
|
|
@@ -31380,6 +31648,9 @@ ${sourceUrlComment}
|
|
|
31380
31648
|
this.#finishInitializationIfReady();
|
|
31381
31649
|
await this.#initializeDeferred.valueOrThrow();
|
|
31382
31650
|
}
|
|
31651
|
+
getChildTargets(target) {
|
|
31652
|
+
return target._childTargets();
|
|
31653
|
+
}
|
|
31383
31654
|
dispose() {
|
|
31384
31655
|
this.#connection.off("Target.targetCreated", this.#onTargetCreated);
|
|
31385
31656
|
this.#connection.off("Target.targetDestroyed", this.#onTargetDestroyed);
|
|
@@ -31511,6 +31782,8 @@ ${sourceUrlComment}
|
|
|
31511
31782
|
this.#attachedTargetsByTargetId.set(targetInfo.targetId, target);
|
|
31512
31783
|
this.#attachedTargetsBySessionId.set(session.id(), target);
|
|
31513
31784
|
}
|
|
31785
|
+
const parentTarget = parentSession instanceof CDPSession ? parentSession._target() : null;
|
|
31786
|
+
parentTarget?._addChildTarget(target);
|
|
31514
31787
|
parentSession.emit(CDPSessionEvent.Ready, session);
|
|
31515
31788
|
this.#targetsIdsForInit.delete(target._targetId);
|
|
31516
31789
|
if (!isExistingTarget) {
|
|
@@ -31533,12 +31806,15 @@ ${sourceUrlComment}
|
|
|
31533
31806
|
this.#initializeDeferred.resolve();
|
|
31534
31807
|
}
|
|
31535
31808
|
}
|
|
31536
|
-
#onDetachedFromTarget = (
|
|
31809
|
+
#onDetachedFromTarget = (parentSession, event) => {
|
|
31537
31810
|
const target = this.#attachedTargetsBySessionId.get(event.sessionId);
|
|
31538
31811
|
this.#attachedTargetsBySessionId.delete(event.sessionId);
|
|
31539
31812
|
if (!target) {
|
|
31540
31813
|
return;
|
|
31541
31814
|
}
|
|
31815
|
+
if (parentSession instanceof CDPSession) {
|
|
31816
|
+
parentSession._target()._removeChildTarget(target);
|
|
31817
|
+
}
|
|
31542
31818
|
this.#attachedTargetsByTargetId.delete(target._targetId);
|
|
31543
31819
|
this.emit("targetGone", target);
|
|
31544
31820
|
};
|
|
@@ -32193,6 +32469,13 @@ puppeteer-core/lib/esm/puppeteer/api/Frame.js:
|
|
|
32193
32469
|
* SPDX-License-Identifier: Apache-2.0
|
|
32194
32470
|
*)
|
|
32195
32471
|
|
|
32472
|
+
puppeteer-core/lib/esm/puppeteer/cdp/CdpPreloadScript.js:
|
|
32473
|
+
(**
|
|
32474
|
+
* @license
|
|
32475
|
+
* Copyright 2024 Google Inc.
|
|
32476
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
32477
|
+
*)
|
|
32478
|
+
|
|
32196
32479
|
puppeteer-core/lib/esm/puppeteer/cdp/DeviceRequestPrompt.js:
|
|
32197
32480
|
(**
|
|
32198
32481
|
* @license
|