@browserless.io/browserless 2.24.0 → 2.24.1
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 +6 -1
- package/build/routes/chrome/http/content.post.body.json +8 -8
- package/build/routes/chrome/http/pdf.post.body.json +8 -8
- 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 +8 -8
- package/build/routes/chromium/http/scrape.post.body.json +8 -8
- package/build/routes/chromium/http/screenshot.post.body.json +8 -8
- package/build/shared/utils/performance/main.js +2 -1
- package/package.json +11 -11
- package/src/shared/utils/performance/main.ts +2 -8
- package/static/docs/swagger.json +10 -10
- package/static/docs/swagger.min.json +9 -9
- package/static/function/client.js +119 -18
- package/static/function/index.html +119 -18
|
@@ -280,14 +280,14 @@
|
|
|
280
280
|
"length": {
|
|
281
281
|
"type": "number"
|
|
282
282
|
},
|
|
283
|
-
"__@toStringTag@
|
|
283
|
+
"__@toStringTag@14591": {
|
|
284
284
|
"type": "string",
|
|
285
285
|
"const": "Uint8Array"
|
|
286
286
|
}
|
|
287
287
|
},
|
|
288
288
|
"required": [
|
|
289
289
|
"BYTES_PER_ELEMENT",
|
|
290
|
-
"__@toStringTag@
|
|
290
|
+
"__@toStringTag@14591",
|
|
291
291
|
"buffer",
|
|
292
292
|
"byteLength",
|
|
293
293
|
"byteOffset",
|
|
@@ -322,13 +322,13 @@
|
|
|
322
322
|
"byteLength": {
|
|
323
323
|
"type": "number"
|
|
324
324
|
},
|
|
325
|
-
"__@toStringTag@
|
|
325
|
+
"__@toStringTag@14591": {
|
|
326
326
|
"type": "string"
|
|
327
327
|
}
|
|
328
328
|
},
|
|
329
329
|
"additionalProperties": false,
|
|
330
330
|
"required": [
|
|
331
|
-
"__@toStringTag@
|
|
331
|
+
"__@toStringTag@14591",
|
|
332
332
|
"byteLength"
|
|
333
333
|
]
|
|
334
334
|
},
|
|
@@ -338,18 +338,18 @@
|
|
|
338
338
|
"byteLength": {
|
|
339
339
|
"type": "number"
|
|
340
340
|
},
|
|
341
|
-
"__@species@
|
|
341
|
+
"__@species@14629": {
|
|
342
342
|
"$ref": "#/definitions/SharedArrayBuffer"
|
|
343
343
|
},
|
|
344
|
-
"__@toStringTag@
|
|
344
|
+
"__@toStringTag@14591": {
|
|
345
345
|
"type": "string",
|
|
346
346
|
"const": "SharedArrayBuffer"
|
|
347
347
|
}
|
|
348
348
|
},
|
|
349
349
|
"additionalProperties": false,
|
|
350
350
|
"required": [
|
|
351
|
-
"__@species@
|
|
352
|
-
"__@toStringTag@
|
|
351
|
+
"__@species@14629",
|
|
352
|
+
"__@toStringTag@14591",
|
|
353
353
|
"byteLength"
|
|
354
354
|
]
|
|
355
355
|
},
|
|
@@ -1001,7 +1001,7 @@
|
|
|
1001
1001
|
},
|
|
1002
1002
|
"info": {
|
|
1003
1003
|
"title": "Browserless",
|
|
1004
|
-
"version": "2.24.
|
|
1004
|
+
"version": "2.24.1",
|
|
1005
1005
|
"x-logo": {
|
|
1006
1006
|
"altText": "browserless logo",
|
|
1007
1007
|
"url": "./docs/browserless-logo-inline.svg"
|
|
@@ -4393,7 +4393,7 @@
|
|
|
4393
4393
|
// node_modules/puppeteer-core/lib/esm/puppeteer/generated/version.js
|
|
4394
4394
|
init_dirname();
|
|
4395
4395
|
init_buffer2();
|
|
4396
|
-
var packageVersion = "23.
|
|
4396
|
+
var packageVersion = "23.11.1";
|
|
4397
4397
|
|
|
4398
4398
|
// node_modules/puppeteer-core/lib/esm/puppeteer/util/assert.js
|
|
4399
4399
|
init_dirname();
|
|
@@ -9526,6 +9526,7 @@
|
|
|
9526
9526
|
"blurredVision",
|
|
9527
9527
|
"deuteranopia",
|
|
9528
9528
|
"protanopia",
|
|
9529
|
+
"reducedContrast",
|
|
9529
9530
|
"tritanopia"
|
|
9530
9531
|
]);
|
|
9531
9532
|
assert(!type || visionDeficiencies.has(type), `Unsupported vision deficiency: ${type}`);
|
|
@@ -13875,13 +13876,73 @@ ${sourceUrlComment}
|
|
|
13875
13876
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Accessibility.js
|
|
13876
13877
|
init_dirname();
|
|
13877
13878
|
init_buffer2();
|
|
13879
|
+
var __addDisposableResource11 = function(env, value, async2) {
|
|
13880
|
+
if (value !== null && value !== void 0) {
|
|
13881
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
13882
|
+
var dispose, inner;
|
|
13883
|
+
if (async2) {
|
|
13884
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
13885
|
+
dispose = value[Symbol.asyncDispose];
|
|
13886
|
+
}
|
|
13887
|
+
if (dispose === void 0) {
|
|
13888
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
13889
|
+
dispose = value[Symbol.dispose];
|
|
13890
|
+
if (async2) inner = dispose;
|
|
13891
|
+
}
|
|
13892
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
13893
|
+
if (inner) dispose = function() {
|
|
13894
|
+
try {
|
|
13895
|
+
inner.call(this);
|
|
13896
|
+
} catch (e) {
|
|
13897
|
+
return Promise.reject(e);
|
|
13898
|
+
}
|
|
13899
|
+
};
|
|
13900
|
+
env.stack.push({ value, dispose, async: async2 });
|
|
13901
|
+
} else if (async2) {
|
|
13902
|
+
env.stack.push({ async: true });
|
|
13903
|
+
}
|
|
13904
|
+
return value;
|
|
13905
|
+
};
|
|
13906
|
+
var __disposeResources11 = /* @__PURE__ */ function(SuppressedError2) {
|
|
13907
|
+
return function(env) {
|
|
13908
|
+
function fail(e) {
|
|
13909
|
+
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
13910
|
+
env.hasError = true;
|
|
13911
|
+
}
|
|
13912
|
+
var r, s = 0;
|
|
13913
|
+
function next() {
|
|
13914
|
+
while (r = env.stack.pop()) {
|
|
13915
|
+
try {
|
|
13916
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
13917
|
+
if (r.dispose) {
|
|
13918
|
+
var result = r.dispose.call(r.value);
|
|
13919
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
|
|
13920
|
+
fail(e);
|
|
13921
|
+
return next();
|
|
13922
|
+
});
|
|
13923
|
+
} else s |= 1;
|
|
13924
|
+
} catch (e) {
|
|
13925
|
+
fail(e);
|
|
13926
|
+
}
|
|
13927
|
+
}
|
|
13928
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
13929
|
+
if (env.hasError) throw env.error;
|
|
13930
|
+
}
|
|
13931
|
+
return next();
|
|
13932
|
+
};
|
|
13933
|
+
}(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
13934
|
+
var e = new Error(message);
|
|
13935
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
13936
|
+
});
|
|
13878
13937
|
var Accessibility = class {
|
|
13879
13938
|
#realm;
|
|
13939
|
+
#frameId;
|
|
13880
13940
|
/**
|
|
13881
13941
|
* @internal
|
|
13882
13942
|
*/
|
|
13883
|
-
constructor(realm) {
|
|
13943
|
+
constructor(realm, frameId = "") {
|
|
13884
13944
|
this.#realm = realm;
|
|
13945
|
+
this.#frameId = frameId;
|
|
13885
13946
|
}
|
|
13886
13947
|
/**
|
|
13887
13948
|
* Captures the current state of the accessibility tree.
|
|
@@ -13923,8 +13984,10 @@ ${sourceUrlComment}
|
|
|
13923
13984
|
* @returns An AXNode object representing the snapshot.
|
|
13924
13985
|
*/
|
|
13925
13986
|
async snapshot(options = {}) {
|
|
13926
|
-
const { interestingOnly = true, root = null } = options;
|
|
13927
|
-
const { nodes } = await this.#realm.environment.client.send("Accessibility.getFullAXTree"
|
|
13987
|
+
const { interestingOnly = true, root = null, includeIframes = false } = options;
|
|
13988
|
+
const { nodes } = await this.#realm.environment.client.send("Accessibility.getFullAXTree", {
|
|
13989
|
+
frameId: this.#frameId
|
|
13990
|
+
});
|
|
13928
13991
|
let backendNodeId;
|
|
13929
13992
|
if (root) {
|
|
13930
13993
|
const { node } = await this.#realm.environment.client.send("DOM.describeNode", {
|
|
@@ -13933,10 +13996,41 @@ ${sourceUrlComment}
|
|
|
13933
13996
|
backendNodeId = node.backendNodeId;
|
|
13934
13997
|
}
|
|
13935
13998
|
const defaultRoot = AXNode.createTree(this.#realm, nodes);
|
|
13999
|
+
const populateIframes = async (root2) => {
|
|
14000
|
+
if (root2.payload.role?.value === "Iframe") {
|
|
14001
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
14002
|
+
try {
|
|
14003
|
+
if (!root2.payload.backendDOMNodeId) {
|
|
14004
|
+
return;
|
|
14005
|
+
}
|
|
14006
|
+
const handle = __addDisposableResource11(env_1, await this.#realm.adoptBackendNode(root2.payload.backendDOMNodeId), false);
|
|
14007
|
+
if (!handle || !("contentFrame" in handle)) {
|
|
14008
|
+
return;
|
|
14009
|
+
}
|
|
14010
|
+
const frame = await handle.contentFrame();
|
|
14011
|
+
if (!frame) {
|
|
14012
|
+
return;
|
|
14013
|
+
}
|
|
14014
|
+
const iframeSnapshot = await frame.accessibility.snapshot(options);
|
|
14015
|
+
root2.iframeSnapshot = iframeSnapshot ?? void 0;
|
|
14016
|
+
} catch (e_1) {
|
|
14017
|
+
env_1.error = e_1;
|
|
14018
|
+
env_1.hasError = true;
|
|
14019
|
+
} finally {
|
|
14020
|
+
__disposeResources11(env_1);
|
|
14021
|
+
}
|
|
14022
|
+
}
|
|
14023
|
+
for (const child of root2.children) {
|
|
14024
|
+
await populateIframes(child);
|
|
14025
|
+
}
|
|
14026
|
+
};
|
|
13936
14027
|
let needle = defaultRoot;
|
|
13937
14028
|
if (!defaultRoot) {
|
|
13938
14029
|
return null;
|
|
13939
14030
|
}
|
|
14031
|
+
if (includeIframes) {
|
|
14032
|
+
await populateIframes(defaultRoot);
|
|
14033
|
+
}
|
|
13940
14034
|
if (backendNodeId) {
|
|
13941
14035
|
needle = defaultRoot.find((node) => {
|
|
13942
14036
|
return node.payload.backendDOMNodeId === backendNodeId;
|
|
@@ -13967,10 +14061,16 @@ ${sourceUrlComment}
|
|
|
13967
14061
|
if (children.length) {
|
|
13968
14062
|
serializedNode.children = children;
|
|
13969
14063
|
}
|
|
14064
|
+
if (node.iframeSnapshot) {
|
|
14065
|
+
if (!serializedNode.children) {
|
|
14066
|
+
serializedNode.children = [];
|
|
14067
|
+
}
|
|
14068
|
+
serializedNode.children.push(node.iframeSnapshot);
|
|
14069
|
+
}
|
|
13970
14070
|
return [serializedNode];
|
|
13971
14071
|
}
|
|
13972
14072
|
collectInterestingNodes(collection, node, insideControl) {
|
|
13973
|
-
if (node.isInteresting(insideControl)) {
|
|
14073
|
+
if (node.isInteresting(insideControl) || node.iframeSnapshot) {
|
|
13974
14074
|
collection.add(node);
|
|
13975
14075
|
}
|
|
13976
14076
|
if (node.isLeafNode()) {
|
|
@@ -13985,6 +14085,7 @@ ${sourceUrlComment}
|
|
|
13985
14085
|
var AXNode = class _AXNode {
|
|
13986
14086
|
payload;
|
|
13987
14087
|
children = [];
|
|
14088
|
+
iframeSnapshot;
|
|
13988
14089
|
#richlyEditable = false;
|
|
13989
14090
|
#editable = false;
|
|
13990
14091
|
#focusable = false;
|
|
@@ -14845,7 +14946,7 @@ ${sourceUrlComment}
|
|
|
14845
14946
|
[MAIN_WORLD]: new IsolatedWorld(this, this._frameManager.timeoutSettings),
|
|
14846
14947
|
[PUPPETEER_WORLD]: new IsolatedWorld(this, this._frameManager.timeoutSettings)
|
|
14847
14948
|
};
|
|
14848
|
-
this.accessibility = new Accessibility(this.worlds[MAIN_WORLD]);
|
|
14949
|
+
this.accessibility = new Accessibility(this.worlds[MAIN_WORLD], frameId);
|
|
14849
14950
|
this.on(FrameEvent.FrameSwappedByActivation, () => {
|
|
14850
14951
|
this._onLoadingStarted();
|
|
14851
14952
|
this._onLoadingStopped();
|
|
@@ -18095,7 +18196,7 @@ ${sourceUrlComment}
|
|
|
18095
18196
|
};
|
|
18096
18197
|
|
|
18097
18198
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Page.js
|
|
18098
|
-
var
|
|
18199
|
+
var __addDisposableResource12 = function(env, value, async2) {
|
|
18099
18200
|
if (value !== null && value !== void 0) {
|
|
18100
18201
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
18101
18202
|
var dispose, inner;
|
|
@@ -18122,7 +18223,7 @@ ${sourceUrlComment}
|
|
|
18122
18223
|
}
|
|
18123
18224
|
return value;
|
|
18124
18225
|
};
|
|
18125
|
-
var
|
|
18226
|
+
var __disposeResources12 = /* @__PURE__ */ function(SuppressedError2) {
|
|
18126
18227
|
return function(env) {
|
|
18127
18228
|
function fail(e) {
|
|
18128
18229
|
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
@@ -18364,7 +18465,7 @@ ${sourceUrlComment}
|
|
|
18364
18465
|
}
|
|
18365
18466
|
const frame = this.#frameManager.frame(event.frameId);
|
|
18366
18467
|
assert(frame, "This should never happen.");
|
|
18367
|
-
const handle =
|
|
18468
|
+
const handle = __addDisposableResource12(env_1, await frame.worlds[MAIN_WORLD].adoptBackendNode(event.backendNodeId), false);
|
|
18368
18469
|
const fileChooser = new FileChooser(handle.move(), event);
|
|
18369
18470
|
for (const promise of this.#fileChooserDeferreds) {
|
|
18370
18471
|
promise.resolve(fileChooser);
|
|
@@ -18374,7 +18475,7 @@ ${sourceUrlComment}
|
|
|
18374
18475
|
env_1.error = e_1;
|
|
18375
18476
|
env_1.hasError = true;
|
|
18376
18477
|
} finally {
|
|
18377
|
-
|
|
18478
|
+
__disposeResources12(env_1);
|
|
18378
18479
|
}
|
|
18379
18480
|
}
|
|
18380
18481
|
_client() {
|
|
@@ -18783,7 +18884,7 @@ ${sourceUrlComment}
|
|
|
18783
18884
|
try {
|
|
18784
18885
|
const { fromSurface, omitBackground, optimizeForSpeed, quality, clip: userClip, type, captureBeyondViewport } = options;
|
|
18785
18886
|
const isFirefox = this.target()._targetManager() instanceof FirefoxTargetManager;
|
|
18786
|
-
const stack =
|
|
18887
|
+
const stack = __addDisposableResource12(env_2, new AsyncDisposableStack(), true);
|
|
18787
18888
|
if (!isFirefox && omitBackground && (type === "png" || type === "webp")) {
|
|
18788
18889
|
await this.#emulationManager.setTransparentBackgroundColor();
|
|
18789
18890
|
stack.defer(async () => {
|
|
@@ -18811,7 +18912,7 @@ ${sourceUrlComment}
|
|
|
18811
18912
|
env_2.error = e_2;
|
|
18812
18913
|
env_2.hasError = true;
|
|
18813
18914
|
} finally {
|
|
18814
|
-
const result_1 =
|
|
18915
|
+
const result_1 = __disposeResources12(env_2);
|
|
18815
18916
|
if (result_1)
|
|
18816
18917
|
await result_1;
|
|
18817
18918
|
}
|
|
@@ -18863,7 +18964,7 @@ ${sourceUrlComment}
|
|
|
18863
18964
|
async close(options = { runBeforeUnload: void 0 }) {
|
|
18864
18965
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
18865
18966
|
try {
|
|
18866
|
-
const _guard =
|
|
18967
|
+
const _guard = __addDisposableResource12(env_3, await this.browserContext().waitForScreenshotOperations(), false);
|
|
18867
18968
|
const connection = this.#primaryTargetClient.connection();
|
|
18868
18969
|
assert(connection, "Protocol error: Connection closed. Most likely the page has been closed.");
|
|
18869
18970
|
const runBeforeUnload = !!options.runBeforeUnload;
|
|
@@ -18879,7 +18980,7 @@ ${sourceUrlComment}
|
|
|
18879
18980
|
env_3.error = e_3;
|
|
18880
18981
|
env_3.hasError = true;
|
|
18881
18982
|
} finally {
|
|
18882
|
-
|
|
18983
|
+
__disposeResources12(env_3);
|
|
18883
18984
|
}
|
|
18884
18985
|
}
|
|
18885
18986
|
isClosed() {
|
|
@@ -18957,7 +19058,7 @@ ${sourceUrlComment}
|
|
|
18957
19058
|
}
|
|
18958
19059
|
|
|
18959
19060
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/BrowserContext.js
|
|
18960
|
-
var
|
|
19061
|
+
var __addDisposableResource13 = function(env, value, async2) {
|
|
18961
19062
|
if (value !== null && value !== void 0) {
|
|
18962
19063
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
18963
19064
|
var dispose, inner;
|
|
@@ -18984,7 +19085,7 @@ ${sourceUrlComment}
|
|
|
18984
19085
|
}
|
|
18985
19086
|
return value;
|
|
18986
19087
|
};
|
|
18987
|
-
var
|
|
19088
|
+
var __disposeResources13 = /* @__PURE__ */ function(SuppressedError2) {
|
|
18988
19089
|
return function(env) {
|
|
18989
19090
|
function fail(e) {
|
|
18990
19091
|
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
@@ -19065,13 +19166,13 @@ ${sourceUrlComment}
|
|
|
19065
19166
|
async newPage() {
|
|
19066
19167
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
19067
19168
|
try {
|
|
19068
|
-
const _guard =
|
|
19169
|
+
const _guard = __addDisposableResource13(env_1, await this.waitForScreenshotOperations(), false);
|
|
19069
19170
|
return await this.#browser._createPageInContext(this.#id);
|
|
19070
19171
|
} catch (e_1) {
|
|
19071
19172
|
env_1.error = e_1;
|
|
19072
19173
|
env_1.hasError = true;
|
|
19073
19174
|
} finally {
|
|
19074
|
-
|
|
19175
|
+
__disposeResources13(env_1);
|
|
19075
19176
|
}
|
|
19076
19177
|
}
|
|
19077
19178
|
browser() {
|
|
@@ -4401,7 +4401,7 @@
|
|
|
4401
4401
|
// node_modules/puppeteer-core/lib/esm/puppeteer/generated/version.js
|
|
4402
4402
|
init_dirname();
|
|
4403
4403
|
init_buffer2();
|
|
4404
|
-
var packageVersion = "23.
|
|
4404
|
+
var packageVersion = "23.11.1";
|
|
4405
4405
|
|
|
4406
4406
|
// node_modules/puppeteer-core/lib/esm/puppeteer/util/assert.js
|
|
4407
4407
|
init_dirname();
|
|
@@ -9534,6 +9534,7 @@
|
|
|
9534
9534
|
"blurredVision",
|
|
9535
9535
|
"deuteranopia",
|
|
9536
9536
|
"protanopia",
|
|
9537
|
+
"reducedContrast",
|
|
9537
9538
|
"tritanopia"
|
|
9538
9539
|
]);
|
|
9539
9540
|
assert(!type || visionDeficiencies.has(type), `Unsupported vision deficiency: ${type}`);
|
|
@@ -13883,13 +13884,73 @@ ${sourceUrlComment}
|
|
|
13883
13884
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Accessibility.js
|
|
13884
13885
|
init_dirname();
|
|
13885
13886
|
init_buffer2();
|
|
13887
|
+
var __addDisposableResource11 = function(env, value, async2) {
|
|
13888
|
+
if (value !== null && value !== void 0) {
|
|
13889
|
+
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
13890
|
+
var dispose, inner;
|
|
13891
|
+
if (async2) {
|
|
13892
|
+
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
13893
|
+
dispose = value[Symbol.asyncDispose];
|
|
13894
|
+
}
|
|
13895
|
+
if (dispose === void 0) {
|
|
13896
|
+
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
13897
|
+
dispose = value[Symbol.dispose];
|
|
13898
|
+
if (async2) inner = dispose;
|
|
13899
|
+
}
|
|
13900
|
+
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
13901
|
+
if (inner) dispose = function() {
|
|
13902
|
+
try {
|
|
13903
|
+
inner.call(this);
|
|
13904
|
+
} catch (e) {
|
|
13905
|
+
return Promise.reject(e);
|
|
13906
|
+
}
|
|
13907
|
+
};
|
|
13908
|
+
env.stack.push({ value, dispose, async: async2 });
|
|
13909
|
+
} else if (async2) {
|
|
13910
|
+
env.stack.push({ async: true });
|
|
13911
|
+
}
|
|
13912
|
+
return value;
|
|
13913
|
+
};
|
|
13914
|
+
var __disposeResources11 = /* @__PURE__ */ function(SuppressedError2) {
|
|
13915
|
+
return function(env) {
|
|
13916
|
+
function fail(e) {
|
|
13917
|
+
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
13918
|
+
env.hasError = true;
|
|
13919
|
+
}
|
|
13920
|
+
var r, s = 0;
|
|
13921
|
+
function next() {
|
|
13922
|
+
while (r = env.stack.pop()) {
|
|
13923
|
+
try {
|
|
13924
|
+
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
13925
|
+
if (r.dispose) {
|
|
13926
|
+
var result = r.dispose.call(r.value);
|
|
13927
|
+
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
|
|
13928
|
+
fail(e);
|
|
13929
|
+
return next();
|
|
13930
|
+
});
|
|
13931
|
+
} else s |= 1;
|
|
13932
|
+
} catch (e) {
|
|
13933
|
+
fail(e);
|
|
13934
|
+
}
|
|
13935
|
+
}
|
|
13936
|
+
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
13937
|
+
if (env.hasError) throw env.error;
|
|
13938
|
+
}
|
|
13939
|
+
return next();
|
|
13940
|
+
};
|
|
13941
|
+
}(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
|
|
13942
|
+
var e = new Error(message);
|
|
13943
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
13944
|
+
});
|
|
13886
13945
|
var Accessibility = class {
|
|
13887
13946
|
#realm;
|
|
13947
|
+
#frameId;
|
|
13888
13948
|
/**
|
|
13889
13949
|
* @internal
|
|
13890
13950
|
*/
|
|
13891
|
-
constructor(realm) {
|
|
13951
|
+
constructor(realm, frameId = "") {
|
|
13892
13952
|
this.#realm = realm;
|
|
13953
|
+
this.#frameId = frameId;
|
|
13893
13954
|
}
|
|
13894
13955
|
/**
|
|
13895
13956
|
* Captures the current state of the accessibility tree.
|
|
@@ -13931,8 +13992,10 @@ ${sourceUrlComment}
|
|
|
13931
13992
|
* @returns An AXNode object representing the snapshot.
|
|
13932
13993
|
*/
|
|
13933
13994
|
async snapshot(options = {}) {
|
|
13934
|
-
const { interestingOnly = true, root = null } = options;
|
|
13935
|
-
const { nodes } = await this.#realm.environment.client.send("Accessibility.getFullAXTree"
|
|
13995
|
+
const { interestingOnly = true, root = null, includeIframes = false } = options;
|
|
13996
|
+
const { nodes } = await this.#realm.environment.client.send("Accessibility.getFullAXTree", {
|
|
13997
|
+
frameId: this.#frameId
|
|
13998
|
+
});
|
|
13936
13999
|
let backendNodeId;
|
|
13937
14000
|
if (root) {
|
|
13938
14001
|
const { node } = await this.#realm.environment.client.send("DOM.describeNode", {
|
|
@@ -13941,10 +14004,41 @@ ${sourceUrlComment}
|
|
|
13941
14004
|
backendNodeId = node.backendNodeId;
|
|
13942
14005
|
}
|
|
13943
14006
|
const defaultRoot = AXNode.createTree(this.#realm, nodes);
|
|
14007
|
+
const populateIframes = async (root2) => {
|
|
14008
|
+
if (root2.payload.role?.value === "Iframe") {
|
|
14009
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
14010
|
+
try {
|
|
14011
|
+
if (!root2.payload.backendDOMNodeId) {
|
|
14012
|
+
return;
|
|
14013
|
+
}
|
|
14014
|
+
const handle = __addDisposableResource11(env_1, await this.#realm.adoptBackendNode(root2.payload.backendDOMNodeId), false);
|
|
14015
|
+
if (!handle || !("contentFrame" in handle)) {
|
|
14016
|
+
return;
|
|
14017
|
+
}
|
|
14018
|
+
const frame = await handle.contentFrame();
|
|
14019
|
+
if (!frame) {
|
|
14020
|
+
return;
|
|
14021
|
+
}
|
|
14022
|
+
const iframeSnapshot = await frame.accessibility.snapshot(options);
|
|
14023
|
+
root2.iframeSnapshot = iframeSnapshot ?? void 0;
|
|
14024
|
+
} catch (e_1) {
|
|
14025
|
+
env_1.error = e_1;
|
|
14026
|
+
env_1.hasError = true;
|
|
14027
|
+
} finally {
|
|
14028
|
+
__disposeResources11(env_1);
|
|
14029
|
+
}
|
|
14030
|
+
}
|
|
14031
|
+
for (const child of root2.children) {
|
|
14032
|
+
await populateIframes(child);
|
|
14033
|
+
}
|
|
14034
|
+
};
|
|
13944
14035
|
let needle = defaultRoot;
|
|
13945
14036
|
if (!defaultRoot) {
|
|
13946
14037
|
return null;
|
|
13947
14038
|
}
|
|
14039
|
+
if (includeIframes) {
|
|
14040
|
+
await populateIframes(defaultRoot);
|
|
14041
|
+
}
|
|
13948
14042
|
if (backendNodeId) {
|
|
13949
14043
|
needle = defaultRoot.find((node) => {
|
|
13950
14044
|
return node.payload.backendDOMNodeId === backendNodeId;
|
|
@@ -13975,10 +14069,16 @@ ${sourceUrlComment}
|
|
|
13975
14069
|
if (children.length) {
|
|
13976
14070
|
serializedNode.children = children;
|
|
13977
14071
|
}
|
|
14072
|
+
if (node.iframeSnapshot) {
|
|
14073
|
+
if (!serializedNode.children) {
|
|
14074
|
+
serializedNode.children = [];
|
|
14075
|
+
}
|
|
14076
|
+
serializedNode.children.push(node.iframeSnapshot);
|
|
14077
|
+
}
|
|
13978
14078
|
return [serializedNode];
|
|
13979
14079
|
}
|
|
13980
14080
|
collectInterestingNodes(collection, node, insideControl) {
|
|
13981
|
-
if (node.isInteresting(insideControl)) {
|
|
14081
|
+
if (node.isInteresting(insideControl) || node.iframeSnapshot) {
|
|
13982
14082
|
collection.add(node);
|
|
13983
14083
|
}
|
|
13984
14084
|
if (node.isLeafNode()) {
|
|
@@ -13993,6 +14093,7 @@ ${sourceUrlComment}
|
|
|
13993
14093
|
var AXNode = class _AXNode {
|
|
13994
14094
|
payload;
|
|
13995
14095
|
children = [];
|
|
14096
|
+
iframeSnapshot;
|
|
13996
14097
|
#richlyEditable = false;
|
|
13997
14098
|
#editable = false;
|
|
13998
14099
|
#focusable = false;
|
|
@@ -14853,7 +14954,7 @@ ${sourceUrlComment}
|
|
|
14853
14954
|
[MAIN_WORLD]: new IsolatedWorld(this, this._frameManager.timeoutSettings),
|
|
14854
14955
|
[PUPPETEER_WORLD]: new IsolatedWorld(this, this._frameManager.timeoutSettings)
|
|
14855
14956
|
};
|
|
14856
|
-
this.accessibility = new Accessibility(this.worlds[MAIN_WORLD]);
|
|
14957
|
+
this.accessibility = new Accessibility(this.worlds[MAIN_WORLD], frameId);
|
|
14857
14958
|
this.on(FrameEvent.FrameSwappedByActivation, () => {
|
|
14858
14959
|
this._onLoadingStarted();
|
|
14859
14960
|
this._onLoadingStopped();
|
|
@@ -18103,7 +18204,7 @@ ${sourceUrlComment}
|
|
|
18103
18204
|
};
|
|
18104
18205
|
|
|
18105
18206
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/Page.js
|
|
18106
|
-
var
|
|
18207
|
+
var __addDisposableResource12 = function(env, value, async2) {
|
|
18107
18208
|
if (value !== null && value !== void 0) {
|
|
18108
18209
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
18109
18210
|
var dispose, inner;
|
|
@@ -18130,7 +18231,7 @@ ${sourceUrlComment}
|
|
|
18130
18231
|
}
|
|
18131
18232
|
return value;
|
|
18132
18233
|
};
|
|
18133
|
-
var
|
|
18234
|
+
var __disposeResources12 = /* @__PURE__ */ function(SuppressedError2) {
|
|
18134
18235
|
return function(env) {
|
|
18135
18236
|
function fail(e) {
|
|
18136
18237
|
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
@@ -18372,7 +18473,7 @@ ${sourceUrlComment}
|
|
|
18372
18473
|
}
|
|
18373
18474
|
const frame = this.#frameManager.frame(event.frameId);
|
|
18374
18475
|
assert(frame, "This should never happen.");
|
|
18375
|
-
const handle =
|
|
18476
|
+
const handle = __addDisposableResource12(env_1, await frame.worlds[MAIN_WORLD].adoptBackendNode(event.backendNodeId), false);
|
|
18376
18477
|
const fileChooser = new FileChooser(handle.move(), event);
|
|
18377
18478
|
for (const promise of this.#fileChooserDeferreds) {
|
|
18378
18479
|
promise.resolve(fileChooser);
|
|
@@ -18382,7 +18483,7 @@ ${sourceUrlComment}
|
|
|
18382
18483
|
env_1.error = e_1;
|
|
18383
18484
|
env_1.hasError = true;
|
|
18384
18485
|
} finally {
|
|
18385
|
-
|
|
18486
|
+
__disposeResources12(env_1);
|
|
18386
18487
|
}
|
|
18387
18488
|
}
|
|
18388
18489
|
_client() {
|
|
@@ -18791,7 +18892,7 @@ ${sourceUrlComment}
|
|
|
18791
18892
|
try {
|
|
18792
18893
|
const { fromSurface, omitBackground, optimizeForSpeed, quality, clip: userClip, type, captureBeyondViewport } = options;
|
|
18793
18894
|
const isFirefox = this.target()._targetManager() instanceof FirefoxTargetManager;
|
|
18794
|
-
const stack =
|
|
18895
|
+
const stack = __addDisposableResource12(env_2, new AsyncDisposableStack(), true);
|
|
18795
18896
|
if (!isFirefox && omitBackground && (type === "png" || type === "webp")) {
|
|
18796
18897
|
await this.#emulationManager.setTransparentBackgroundColor();
|
|
18797
18898
|
stack.defer(async () => {
|
|
@@ -18819,7 +18920,7 @@ ${sourceUrlComment}
|
|
|
18819
18920
|
env_2.error = e_2;
|
|
18820
18921
|
env_2.hasError = true;
|
|
18821
18922
|
} finally {
|
|
18822
|
-
const result_1 =
|
|
18923
|
+
const result_1 = __disposeResources12(env_2);
|
|
18823
18924
|
if (result_1)
|
|
18824
18925
|
await result_1;
|
|
18825
18926
|
}
|
|
@@ -18871,7 +18972,7 @@ ${sourceUrlComment}
|
|
|
18871
18972
|
async close(options = { runBeforeUnload: void 0 }) {
|
|
18872
18973
|
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
18873
18974
|
try {
|
|
18874
|
-
const _guard =
|
|
18975
|
+
const _guard = __addDisposableResource12(env_3, await this.browserContext().waitForScreenshotOperations(), false);
|
|
18875
18976
|
const connection = this.#primaryTargetClient.connection();
|
|
18876
18977
|
assert(connection, "Protocol error: Connection closed. Most likely the page has been closed.");
|
|
18877
18978
|
const runBeforeUnload = !!options.runBeforeUnload;
|
|
@@ -18887,7 +18988,7 @@ ${sourceUrlComment}
|
|
|
18887
18988
|
env_3.error = e_3;
|
|
18888
18989
|
env_3.hasError = true;
|
|
18889
18990
|
} finally {
|
|
18890
|
-
|
|
18991
|
+
__disposeResources12(env_3);
|
|
18891
18992
|
}
|
|
18892
18993
|
}
|
|
18893
18994
|
isClosed() {
|
|
@@ -18965,7 +19066,7 @@ ${sourceUrlComment}
|
|
|
18965
19066
|
}
|
|
18966
19067
|
|
|
18967
19068
|
// node_modules/puppeteer-core/lib/esm/puppeteer/cdp/BrowserContext.js
|
|
18968
|
-
var
|
|
19069
|
+
var __addDisposableResource13 = function(env, value, async2) {
|
|
18969
19070
|
if (value !== null && value !== void 0) {
|
|
18970
19071
|
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
18971
19072
|
var dispose, inner;
|
|
@@ -18992,7 +19093,7 @@ ${sourceUrlComment}
|
|
|
18992
19093
|
}
|
|
18993
19094
|
return value;
|
|
18994
19095
|
};
|
|
18995
|
-
var
|
|
19096
|
+
var __disposeResources13 = /* @__PURE__ */ function(SuppressedError2) {
|
|
18996
19097
|
return function(env) {
|
|
18997
19098
|
function fail(e) {
|
|
18998
19099
|
env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
|
|
@@ -19073,13 +19174,13 @@ ${sourceUrlComment}
|
|
|
19073
19174
|
async newPage() {
|
|
19074
19175
|
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
19075
19176
|
try {
|
|
19076
|
-
const _guard =
|
|
19177
|
+
const _guard = __addDisposableResource13(env_1, await this.waitForScreenshotOperations(), false);
|
|
19077
19178
|
return await this.#browser._createPageInContext(this.#id);
|
|
19078
19179
|
} catch (e_1) {
|
|
19079
19180
|
env_1.error = e_1;
|
|
19080
19181
|
env_1.hasError = true;
|
|
19081
19182
|
} finally {
|
|
19082
|
-
|
|
19183
|
+
__disposeResources13(env_1);
|
|
19083
19184
|
}
|
|
19084
19185
|
}
|
|
19085
19186
|
browser() {
|