brave-real-puppeteer-core 24.24.0 → 24.26.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/README.md +5 -5
- package/advanced-stealth.js +1 -1
- package/lib/cjs/puppeteer/api/ElementHandle.js +1 -1
- package/lib/cjs/puppeteer/api/ElementHandle.js.map +1 -1
- package/lib/cjs/puppeteer/api/Frame.js +4 -4
- package/lib/cjs/puppeteer/api/Frame.js.map +1 -1
- package/lib/cjs/puppeteer/api/HTTPRequest.d.ts +1 -1
- package/lib/cjs/puppeteer/api/Page.d.ts +2 -2
- package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/Browser.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/Browser.js +20 -14
- package/lib/cjs/puppeteer/bidi/Browser.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/Connection.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/Connection.js +16 -0
- package/lib/cjs/puppeteer/bidi/Connection.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/HTTPRequest.js +2 -4
- package/lib/cjs/puppeteer/bidi/HTTPRequest.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +2 -2
- package/lib/cjs/puppeteer/bidi/core/Request.d.ts +1 -0
- package/lib/cjs/puppeteer/bidi/core/Request.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/core/Request.js +30 -4
- package/lib/cjs/puppeteer/bidi/core/Request.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/Accessibility.d.ts +4 -0
- package/lib/cjs/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/Accessibility.js +35 -0
- package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/ExecutionContext.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/ExecutionContext.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/HTTPRequest.js +2 -1
- package/lib/cjs/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/HTTPResponse.js +1 -1
- package/lib/cjs/puppeteer/cdp/HTTPResponse.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/JSHandle.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/Page.js +1 -1
- package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/utils.d.ts +2 -2
- package/lib/cjs/puppeteer/cdp/utils.d.ts.map +1 -1
- package/lib/cjs/puppeteer/common/util.js +1 -1
- package/lib/cjs/puppeteer/common/util.js.map +1 -1
- package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/lib/cjs/puppeteer/node/BrowserLauncher.js +10 -3
- package/lib/cjs/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/lib/cjs/puppeteer/node/NodeWebSocketTransport.js +1 -1
- package/lib/cjs/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
- package/lib/cjs/puppeteer/revisions.d.ts +3 -3
- package/lib/cjs/puppeteer/revisions.js +3 -3
- package/lib/cjs/puppeteer/revisions.js.map +1 -1
- package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/lib/cjs/puppeteer/util/version.d.ts +7 -0
- package/lib/cjs/puppeteer/util/version.d.ts.map +1 -0
- package/lib/cjs/puppeteer/util/version.js +13 -0
- package/lib/cjs/puppeteer/util/version.js.map +1 -0
- package/lib/es5-iife/puppeteer-core-browser.d.ts +7 -3
- package/lib/es5-iife/puppeteer-core-browser.js +58 -17
- package/lib/esm/puppeteer/api/ElementHandle.js +1 -1
- package/lib/esm/puppeteer/api/ElementHandle.js.map +1 -1
- package/lib/esm/puppeteer/api/Frame.js +4 -4
- package/lib/esm/puppeteer/api/Frame.js.map +1 -1
- package/lib/esm/puppeteer/api/HTTPRequest.d.ts +1 -1
- package/lib/esm/puppeteer/api/Page.d.ts +2 -2
- package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/Browser.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/Browser.js +20 -14
- package/lib/esm/puppeteer/bidi/Browser.js.map +1 -1
- package/lib/esm/puppeteer/bidi/Connection.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/Connection.js +16 -0
- package/lib/esm/puppeteer/bidi/Connection.js.map +1 -1
- package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/HTTPRequest.js +2 -4
- package/lib/esm/puppeteer/bidi/HTTPRequest.js.map +1 -1
- package/lib/esm/puppeteer/bidi/core/Request.d.ts +1 -0
- package/lib/esm/puppeteer/bidi/core/Request.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/core/Request.js +31 -5
- package/lib/esm/puppeteer/bidi/core/Request.js.map +1 -1
- package/lib/esm/puppeteer/cdp/Accessibility.d.ts +4 -0
- package/lib/esm/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/Accessibility.js +35 -0
- package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
- package/lib/esm/puppeteer/cdp/ExecutionContext.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/ExecutionContext.js.map +1 -1
- package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/HTTPRequest.js +2 -1
- package/lib/esm/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/lib/esm/puppeteer/cdp/HTTPResponse.js +1 -1
- package/lib/esm/puppeteer/cdp/HTTPResponse.js.map +1 -1
- package/lib/esm/puppeteer/cdp/JSHandle.js.map +1 -1
- package/lib/esm/puppeteer/cdp/Page.js +1 -1
- package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
- package/lib/esm/puppeteer/cdp/utils.d.ts +2 -2
- package/lib/esm/puppeteer/cdp/utils.d.ts.map +1 -1
- package/lib/esm/puppeteer/common/util.js +1 -1
- package/lib/esm/puppeteer/common/util.js.map +1 -1
- package/lib/esm/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/lib/esm/puppeteer/node/BrowserLauncher.js +10 -3
- package/lib/esm/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/lib/esm/puppeteer/node/NodeWebSocketTransport.js +1 -1
- package/lib/esm/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
- package/lib/esm/puppeteer/revisions.d.ts +3 -3
- package/lib/esm/puppeteer/revisions.js +3 -3
- package/lib/esm/puppeteer/revisions.js.map +1 -1
- package/lib/esm/puppeteer/util/version.d.ts +7 -0
- package/lib/esm/puppeteer/util/version.d.ts.map +1 -0
- package/lib/esm/puppeteer/util/version.js +10 -0
- package/lib/esm/puppeteer/util/version.js.map +1 -0
- package/lib/types.d.ts +7 -3
- package/package.json +14 -14
- package/src/api/ElementHandle.ts +1 -1
- package/src/api/Frame.ts +4 -4
- package/src/api/HTTPRequest.ts +1 -1
- package/src/api/Page.ts +2 -2
- package/src/bidi/Browser.ts +24 -14
- package/src/bidi/Connection.ts +16 -0
- package/src/bidi/HTTPRequest.ts +2 -4
- package/src/bidi/core/Request.ts +35 -5
- package/src/cdp/Accessibility.ts +46 -1
- package/src/cdp/ExecutionContext.ts +6 -2
- package/src/cdp/HTTPRequest.ts +2 -1
- package/src/cdp/HTTPResponse.ts +1 -1
- package/src/cdp/JSHandle.ts +1 -1
- package/src/cdp/Page.ts +1 -1
- package/src/cdp/utils.ts +2 -2
- package/src/common/util.ts +1 -1
- package/src/node/BrowserLauncher.ts +14 -5
- package/src/node/NodeWebSocketTransport.ts +1 -1
- package/src/revisions.ts +3 -3
- package/src/util/version.ts +10 -0
- package/lib/cjs/puppeteer/generated/version.d.ts +0 -5
- package/lib/cjs/puppeteer/generated/version.d.ts.map +0 -1
- package/lib/cjs/puppeteer/generated/version.js +0 -8
- package/lib/cjs/puppeteer/generated/version.js.map +0 -1
- package/lib/esm/puppeteer/generated/version.d.ts +0 -5
- package/lib/esm/puppeteer/generated/version.d.ts.map +0 -1
- package/lib/esm/puppeteer/generated/version.js +0 -5
- package/lib/esm/puppeteer/generated/version.js.map +0 -1
- package/src/generated/version.ts +0 -4
package/src/bidi/Browser.ts
CHANGED
|
@@ -89,6 +89,8 @@ export class BidiBrowser extends Browser {
|
|
|
89
89
|
// yet because WebDriver BiDi behavior is not specified. See
|
|
90
90
|
// https://github.com/w3c/webdriver-bidi/issues/321.
|
|
91
91
|
'goog:prerenderingDisabled': true,
|
|
92
|
+
// TODO: remove after Puppeteer rolled Chrome to 142 after Oct 28, 2025.
|
|
93
|
+
'goog:disableNetworkDurableMessages': true,
|
|
92
94
|
},
|
|
93
95
|
});
|
|
94
96
|
|
|
@@ -109,20 +111,28 @@ export class BidiBrowser extends Browser {
|
|
|
109
111
|
}) as [string, ...string[]],
|
|
110
112
|
);
|
|
111
113
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
114
|
+
await Promise.all(
|
|
115
|
+
[Bidi.Network.DataType.Request, Bidi.Network.DataType.Response].map(
|
|
116
|
+
// Data collectors might be not implemented for specific data type, so create them
|
|
117
|
+
// separately and ignore protocol errors.
|
|
118
|
+
async dataType => {
|
|
119
|
+
try {
|
|
120
|
+
await session.send('network.addDataCollector', {
|
|
121
|
+
dataTypes: [dataType],
|
|
122
|
+
// Buffer size of 20 MB is equivalent to the CDP:
|
|
123
|
+
maxEncodedDataSize: 20_000_000,
|
|
124
|
+
});
|
|
125
|
+
} catch (err) {
|
|
126
|
+
if (err instanceof ProtocolError) {
|
|
127
|
+
debugError(err);
|
|
128
|
+
} else {
|
|
129
|
+
throw err;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
),
|
|
134
|
+
);
|
|
135
|
+
|
|
126
136
|
const browser = new BidiBrowser(session.browser, opts);
|
|
127
137
|
browser.#initialize();
|
|
128
138
|
return browser;
|
package/src/bidi/Connection.ts
CHANGED
|
@@ -88,10 +88,26 @@ export class BidiConnection
|
|
|
88
88
|
this.#emitters.push(emitter);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
#toWebDriverOnlyEvent(event: Record<string, any>) {
|
|
92
|
+
for (const key in event) {
|
|
93
|
+
if (key.startsWith('goog:')) {
|
|
94
|
+
delete event[key];
|
|
95
|
+
} else {
|
|
96
|
+
if (typeof event[key] === 'object' && event[key] !== null) {
|
|
97
|
+
this.#toWebDriverOnlyEvent(event[key]);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
91
103
|
override emit<Key extends keyof EventsWithWildcard<BidiEvents>>(
|
|
92
104
|
type: Key,
|
|
93
105
|
event: EventsWithWildcard<BidiEvents>[Key],
|
|
94
106
|
): boolean {
|
|
107
|
+
if (process.env['PUPPETEER_WEBDRIVER_BIDI_ONLY'] === 'true') {
|
|
108
|
+
// Required for WebDriver-only testing.
|
|
109
|
+
this.#toWebDriverOnlyEvent(event);
|
|
110
|
+
}
|
|
95
111
|
for (const emitter of this.#emitters) {
|
|
96
112
|
emitter.emit(type, event);
|
|
97
113
|
}
|
package/src/bidi/HTTPRequest.ts
CHANGED
|
@@ -158,14 +158,11 @@ export class BidiHTTPRequest extends HTTPRequest {
|
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
override hasPostData(): boolean {
|
|
161
|
-
if (!this.#frame.page().browser().cdpSupported) {
|
|
162
|
-
throw new UnsupportedOperation();
|
|
163
|
-
}
|
|
164
161
|
return this.#request.hasPostData;
|
|
165
162
|
}
|
|
166
163
|
|
|
167
164
|
override async fetchPostData(): Promise<string | undefined> {
|
|
168
|
-
|
|
165
|
+
return await this.#request.fetchPostData();
|
|
169
166
|
}
|
|
170
167
|
|
|
171
168
|
get #hasInternalHeaderOverwrite(): boolean {
|
|
@@ -184,6 +181,7 @@ export class BidiHTTPRequest extends HTTPRequest {
|
|
|
184
181
|
}
|
|
185
182
|
|
|
186
183
|
override headers(): Record<string, string> {
|
|
184
|
+
// Callers should not be allowed to mutate internal structure.
|
|
187
185
|
const headers: Record<string, string> = {};
|
|
188
186
|
for (const header of this.#request.headers) {
|
|
189
187
|
headers[header.name.toLowerCase()] = header.value.value;
|
package/src/bidi/core/Request.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as Bidi from 'webdriver-bidi-protocol';
|
|
8
8
|
|
|
9
|
-
import {ProtocolError} from '../../common/Errors.js';
|
|
9
|
+
import {ProtocolError, UnsupportedOperation} from '../../common/Errors.js';
|
|
10
10
|
import {EventEmitter} from '../../common/EventEmitter.js';
|
|
11
11
|
import {inertIfDisposed} from '../../util/decorators.js';
|
|
12
12
|
import {DisposableStack, disposeSymbol} from '../../util/disposable.js';
|
|
@@ -37,6 +37,7 @@ export class Request extends EventEmitter<{
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
#responseContentPromise: Promise<Uint8Array<ArrayBufferLike>> | null = null;
|
|
40
|
+
#requestBodyPromise: Promise<string> | null = null;
|
|
40
41
|
#error?: string;
|
|
41
42
|
#redirect?: Request;
|
|
42
43
|
#response?: Bidi.Network.ResponseData;
|
|
@@ -153,7 +154,14 @@ export class Request extends EventEmitter<{
|
|
|
153
154
|
return this.#event.request.request;
|
|
154
155
|
}
|
|
155
156
|
get initiator(): Bidi.Network.Initiator | undefined {
|
|
156
|
-
return
|
|
157
|
+
return {
|
|
158
|
+
...this.#event.initiator,
|
|
159
|
+
// Initiator URL is not specified in BiDi.
|
|
160
|
+
// @ts-expect-error non-standard property.
|
|
161
|
+
url: this.#event.request['goog:resourceInitiator']?.url,
|
|
162
|
+
// @ts-expect-error non-standard property.
|
|
163
|
+
stack: this.#event.request['goog:resourceInitiator']?.stack,
|
|
164
|
+
};
|
|
157
165
|
}
|
|
158
166
|
get method(): string {
|
|
159
167
|
return this.#event.request.method;
|
|
@@ -195,8 +203,7 @@ export class Request extends EventEmitter<{
|
|
|
195
203
|
}
|
|
196
204
|
|
|
197
205
|
get hasPostData(): boolean {
|
|
198
|
-
|
|
199
|
-
return this.#event.request['goog:hasPostData'] ?? false;
|
|
206
|
+
return (this.#event.request.bodySize ?? 0) > 0;
|
|
200
207
|
}
|
|
201
208
|
|
|
202
209
|
async continueRequest({
|
|
@@ -237,6 +244,29 @@ export class Request extends EventEmitter<{
|
|
|
237
244
|
});
|
|
238
245
|
}
|
|
239
246
|
|
|
247
|
+
async fetchPostData(): Promise<string | undefined> {
|
|
248
|
+
if (!this.hasPostData) {
|
|
249
|
+
return undefined;
|
|
250
|
+
}
|
|
251
|
+
if (!this.#requestBodyPromise) {
|
|
252
|
+
this.#requestBodyPromise = (async () => {
|
|
253
|
+
const data = await this.#session.send('network.getData', {
|
|
254
|
+
dataType: Bidi.Network.DataType.Request,
|
|
255
|
+
request: this.id,
|
|
256
|
+
});
|
|
257
|
+
if (data.result.bytes.type === 'string') {
|
|
258
|
+
return data.result.bytes.value;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// TODO: support base64 response.
|
|
262
|
+
throw new UnsupportedOperation(
|
|
263
|
+
`Collected request body data of type ${data.result.bytes.type} is not supported`,
|
|
264
|
+
);
|
|
265
|
+
})();
|
|
266
|
+
}
|
|
267
|
+
return await this.#requestBodyPromise;
|
|
268
|
+
}
|
|
269
|
+
|
|
240
270
|
async getResponseContent(): Promise<Uint8Array> {
|
|
241
271
|
if (!this.#responseContentPromise) {
|
|
242
272
|
this.#responseContentPromise = (async () => {
|
|
@@ -258,7 +288,7 @@ export class Request extends EventEmitter<{
|
|
|
258
288
|
)
|
|
259
289
|
) {
|
|
260
290
|
throw new ProtocolError(
|
|
261
|
-
'Could not load body for this request. This might happen if the request is a preflight request.',
|
|
291
|
+
'Could not load response body for this request. This might happen if the request is a preflight request.',
|
|
262
292
|
);
|
|
263
293
|
}
|
|
264
294
|
|
package/src/cdp/Accessibility.ts
CHANGED
|
@@ -76,6 +76,11 @@ export interface SerializedAXNode {
|
|
|
76
76
|
*/
|
|
77
77
|
invalid?: string;
|
|
78
78
|
orientation?: string;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Url for link elements.
|
|
82
|
+
*/
|
|
83
|
+
url?: string;
|
|
79
84
|
/**
|
|
80
85
|
* Children of this node, if there are any.
|
|
81
86
|
*/
|
|
@@ -319,6 +324,7 @@ class AXNode {
|
|
|
319
324
|
#name: string;
|
|
320
325
|
#role: string;
|
|
321
326
|
#ignored: boolean;
|
|
327
|
+
#cachedHasFocusableChild?: boolean;
|
|
322
328
|
#realm: Realm;
|
|
323
329
|
|
|
324
330
|
constructor(realm: Realm, payload: Protocol.Accessibility.AXNode) {
|
|
@@ -361,6 +367,19 @@ class AXNode {
|
|
|
361
367
|
);
|
|
362
368
|
}
|
|
363
369
|
|
|
370
|
+
#hasFocusableChild(): boolean {
|
|
371
|
+
if (this.#cachedHasFocusableChild === undefined) {
|
|
372
|
+
this.#cachedHasFocusableChild = false;
|
|
373
|
+
for (const child of this.children) {
|
|
374
|
+
if (child.#focusable || child.#hasFocusableChild()) {
|
|
375
|
+
this.#cachedHasFocusableChild = true;
|
|
376
|
+
break;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
return this.#cachedHasFocusableChild;
|
|
381
|
+
}
|
|
382
|
+
|
|
364
383
|
public find(predicate: (x: AXNode) => boolean): AXNode | null {
|
|
365
384
|
if (predicate(this)) {
|
|
366
385
|
return this;
|
|
@@ -406,6 +425,10 @@ class AXNode {
|
|
|
406
425
|
break;
|
|
407
426
|
}
|
|
408
427
|
|
|
428
|
+
if (this.#hasFocusableChild()) {
|
|
429
|
+
return false;
|
|
430
|
+
}
|
|
431
|
+
|
|
409
432
|
if (this.#role === 'heading' && this.#name) {
|
|
410
433
|
return true;
|
|
411
434
|
}
|
|
@@ -442,12 +465,32 @@ class AXNode {
|
|
|
442
465
|
}
|
|
443
466
|
}
|
|
444
467
|
|
|
468
|
+
public isLandmark(): boolean {
|
|
469
|
+
switch (this.#role) {
|
|
470
|
+
case 'banner':
|
|
471
|
+
case 'complementary':
|
|
472
|
+
case 'contentinfo':
|
|
473
|
+
case 'form':
|
|
474
|
+
case 'main':
|
|
475
|
+
case 'navigation':
|
|
476
|
+
case 'region':
|
|
477
|
+
case 'search':
|
|
478
|
+
return true;
|
|
479
|
+
default:
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
|
|
445
484
|
public isInteresting(insideControl: boolean): boolean {
|
|
446
485
|
const role = this.#role;
|
|
447
486
|
if (role === 'Ignored' || this.#hidden || this.#ignored) {
|
|
448
487
|
return false;
|
|
449
488
|
}
|
|
450
489
|
|
|
490
|
+
if (this.isLandmark()) {
|
|
491
|
+
return true;
|
|
492
|
+
}
|
|
493
|
+
|
|
451
494
|
if (this.#focusable || this.#richlyEditable) {
|
|
452
495
|
return true;
|
|
453
496
|
}
|
|
@@ -504,7 +547,8 @@ class AXNode {
|
|
|
504
547
|
| 'description'
|
|
505
548
|
| 'keyshortcuts'
|
|
506
549
|
| 'roledescription'
|
|
507
|
-
| 'valuetext'
|
|
550
|
+
| 'valuetext'
|
|
551
|
+
| 'url';
|
|
508
552
|
|
|
509
553
|
const userStringProperties: UserStringProperty[] = [
|
|
510
554
|
'name',
|
|
@@ -513,6 +557,7 @@ class AXNode {
|
|
|
513
557
|
'keyshortcuts',
|
|
514
558
|
'roledescription',
|
|
515
559
|
'valuetext',
|
|
560
|
+
'url',
|
|
516
561
|
];
|
|
517
562
|
const getUserStringPropertyValue = (key: UserStringProperty): string => {
|
|
518
563
|
return properties.get(key) as string;
|
|
@@ -597,7 +597,9 @@ export class ExecutionContext
|
|
|
597
597
|
}
|
|
598
598
|
|
|
599
599
|
if (returnByValue) {
|
|
600
|
-
return valueFromRemoteObject(remoteObject)
|
|
600
|
+
return valueFromRemoteObject(remoteObject) as HandleFor<
|
|
601
|
+
Awaited<ReturnType<Func>>
|
|
602
|
+
>;
|
|
601
603
|
}
|
|
602
604
|
|
|
603
605
|
return this.#world.createCdpHandle(remoteObject) as HandleFor<
|
|
@@ -649,7 +651,9 @@ export class ExecutionContext
|
|
|
649
651
|
}
|
|
650
652
|
|
|
651
653
|
if (returnByValue) {
|
|
652
|
-
return valueFromRemoteObject(remoteObject)
|
|
654
|
+
return valueFromRemoteObject(remoteObject) as unknown as HandleFor<
|
|
655
|
+
Awaited<ReturnType<Func>>
|
|
656
|
+
>;
|
|
653
657
|
}
|
|
654
658
|
|
|
655
659
|
return this.#world.createCdpHandle(remoteObject) as HandleFor<
|
package/src/cdp/HTTPRequest.ts
CHANGED
|
@@ -138,7 +138,8 @@ export class CdpHTTPRequest extends HTTPRequest {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
override headers(): Record<string, string> {
|
|
141
|
-
|
|
141
|
+
// Callers should not be allowed to mutate internal structure.
|
|
142
|
+
return structuredClone(this.#headers);
|
|
142
143
|
}
|
|
143
144
|
|
|
144
145
|
override response(): CdpHTTPResponse | null {
|
package/src/cdp/HTTPResponse.ts
CHANGED
|
@@ -139,7 +139,7 @@ export class CdpHTTPResponse extends HTTPResponse {
|
|
|
139
139
|
'No resource with given identifier found'
|
|
140
140
|
) {
|
|
141
141
|
throw new ProtocolError(
|
|
142
|
-
'Could not load body for this request. This might happen if the request is a preflight request.',
|
|
142
|
+
'Could not load response body for this request. This might happen if the request is a preflight request.',
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
145
|
|
package/src/cdp/JSHandle.ts
CHANGED
|
@@ -45,7 +45,7 @@ export class CdpJSHandle<T = unknown> extends JSHandle<T> {
|
|
|
45
45
|
|
|
46
46
|
override async jsonValue(): Promise<T> {
|
|
47
47
|
if (!this.#remoteObject.objectId) {
|
|
48
|
-
return valueFromRemoteObject(this.#remoteObject);
|
|
48
|
+
return valueFromRemoteObject(this.#remoteObject) as T;
|
|
49
49
|
}
|
|
50
50
|
const value = await this.evaluate(object => {
|
|
51
51
|
return object;
|
package/src/cdp/Page.ts
CHANGED
|
@@ -859,7 +859,7 @@ export class CdpPage extends Page {
|
|
|
859
859
|
}
|
|
860
860
|
const textTokens = [];
|
|
861
861
|
// eslint-disable-next-line max-len -- The comment is long.
|
|
862
|
-
// eslint-disable-next-line
|
|
862
|
+
// eslint-disable-next-line @puppeteer/use-using -- These are not owned by this function.
|
|
863
863
|
for (const arg of args) {
|
|
864
864
|
const remoteObject = arg.remoteObject();
|
|
865
865
|
if (remoteObject.objectId) {
|
package/src/cdp/utils.ts
CHANGED
|
@@ -94,7 +94,7 @@ const getErrorDetails = (details: Protocol.Runtime.ExceptionDetails) => {
|
|
|
94
94
|
*/
|
|
95
95
|
export function createClientError(
|
|
96
96
|
details: Protocol.Runtime.ExceptionDetails,
|
|
97
|
-
): Error {
|
|
97
|
+
): Error | unknown {
|
|
98
98
|
let name: string;
|
|
99
99
|
let message: string;
|
|
100
100
|
if (!details.exception) {
|
|
@@ -141,7 +141,7 @@ export function createClientError(
|
|
|
141
141
|
*/
|
|
142
142
|
export function valueFromRemoteObject(
|
|
143
143
|
remoteObject: Protocol.Runtime.RemoteObject,
|
|
144
|
-
):
|
|
144
|
+
): unknown {
|
|
145
145
|
assert(!remoteObject.objectId, 'Cannot extract value when objectId is given');
|
|
146
146
|
if (remoteObject.unserializableValue) {
|
|
147
147
|
if (remoteObject.type === 'bigint') {
|
package/src/common/util.ts
CHANGED
|
@@ -17,9 +17,9 @@ import {
|
|
|
17
17
|
} from '../../third_party/rxjs/rxjs.js';
|
|
18
18
|
import type {CDPSession} from '../api/CDPSession.js';
|
|
19
19
|
import {environment} from '../environment.js';
|
|
20
|
-
import {packageVersion} from '../generated/version.js';
|
|
21
20
|
import {assert} from '../util/assert.js';
|
|
22
21
|
import {mergeUint8Arrays, stringToTypedArray} from '../util/encoding.js';
|
|
22
|
+
import {packageVersion} from '../util/version.js';
|
|
23
23
|
|
|
24
24
|
import {debug} from './Debug.js';
|
|
25
25
|
import {TimeoutError} from './Errors.js';
|
|
@@ -213,17 +213,26 @@ export abstract class BrowserLauncher {
|
|
|
213
213
|
}
|
|
214
214
|
} catch (error) {
|
|
215
215
|
void browserCloseCallback();
|
|
216
|
+
const logs = browserProcess.getRecentLogs().join('\n');
|
|
216
217
|
if (
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
218
|
+
logs.includes(
|
|
219
|
+
'Failed to create a ProcessSingleton for your profile directory',
|
|
220
|
+
) ||
|
|
221
|
+
// On Windows we will not get logs due to the singleton process
|
|
222
|
+
// handover. See
|
|
223
|
+
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/process_singleton_win.cc;l=46;drc=fc7952f0422b5073515a205a04ec9c3a1ae81658
|
|
224
|
+
(process.platform === 'win32' &&
|
|
225
|
+
existsSync(join(launchArgs.userDataDir, 'lockfile')))
|
|
222
226
|
) {
|
|
223
227
|
throw new Error(
|
|
224
228
|
`The browser is already running for ${launchArgs.userDataDir}. Use a different \`userDataDir\` or stop the running browser first.`,
|
|
225
229
|
);
|
|
226
230
|
}
|
|
231
|
+
if (logs.includes('Missing X server') && options.headless === false) {
|
|
232
|
+
throw new Error(
|
|
233
|
+
`Missing X server to start the headful browser. Either set headless to true or use xvfb-run to run your Puppeteer script.`,
|
|
234
|
+
);
|
|
235
|
+
}
|
|
227
236
|
if (error instanceof BrowsersTimeoutError) {
|
|
228
237
|
throw new TimeoutError(error.message);
|
|
229
238
|
}
|
package/src/revisions.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
10
|
export const PUPPETEER_REVISIONS = Object.freeze({
|
|
11
|
-
chrome: '141.0.7390.
|
|
12
|
-
'chrome-headless-shell': '141.0.7390.
|
|
13
|
-
firefox: '
|
|
11
|
+
chrome: '141.0.7390.122',
|
|
12
|
+
'chrome-headless-shell': '141.0.7390.122',
|
|
13
|
+
firefox: 'stable_144.0',
|
|
14
14
|
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/generated/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,cAAc,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../src/generated/version.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,cAAc,GAAG,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/generated/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,cAAc,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../src/generated/version.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC"}
|
package/src/generated/version.ts
DELETED