playwright-core 1.57.0-alpha-2025-10-06 → 1.57.0-alpha-2025-10-08

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.
@@ -4,7 +4,7 @@ THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
4
4
 
5
5
  This project incorporates components from the projects listed below. The original copyright notices and the licenses under which Microsoft received such components are set forth below. Microsoft reserves all rights not expressly granted herein, whether by implication, estoppel or otherwise.
6
6
 
7
- - agent-base@6.0.2 (https://github.com/TooTallNate/node-agent-base)
7
+ - agent-base@7.1.4 (https://github.com/TooTallNate/proxy-agents)
8
8
  - balanced-match@1.0.2 (https://github.com/juliangruber/balanced-match)
9
9
  - brace-expansion@1.1.12 (https://github.com/juliangruber/brace-expansion)
10
10
  - buffer-crc32@0.2.13 (https://github.com/brianloveswords/buffer-crc32)
@@ -20,7 +20,7 @@ This project incorporates components from the projects listed below. The origina
20
20
  - end-of-stream@1.4.4 (https://github.com/mafintosh/end-of-stream)
21
21
  - get-stream@5.2.0 (https://github.com/sindresorhus/get-stream)
22
22
  - graceful-fs@4.2.10 (https://github.com/isaacs/node-graceful-fs)
23
- - https-proxy-agent@5.0.1 (https://github.com/TooTallNate/node-https-proxy-agent)
23
+ - https-proxy-agent@7.0.6 (https://github.com/TooTallNate/proxy-agents)
24
24
  - ip-address@9.0.5 (https://github.com/beaugunderson/ip-address)
25
25
  - is-docker@2.2.1 (https://github.com/sindresorhus/is-docker)
26
26
  - is-wsl@2.2.0 (https://github.com/sindresorhus/is-wsl)
@@ -40,7 +40,7 @@ This project incorporates components from the projects listed below. The origina
40
40
  - retry@0.12.0 (https://github.com/tim-kos/node-retry)
41
41
  - signal-exit@3.0.7 (https://github.com/tapjs/signal-exit)
42
42
  - smart-buffer@4.2.0 (https://github.com/JoshGlazebrook/smart-buffer)
43
- - socks-proxy-agent@6.1.1 (https://github.com/TooTallNate/node-socks-proxy-agent)
43
+ - socks-proxy-agent@8.0.5 (https://github.com/TooTallNate/proxy-agents)
44
44
  - socks@2.8.3 (https://github.com/JoshGlazebrook/socks)
45
45
  - sprintf-js@1.1.3 (https://github.com/alexei/sprintf.js)
46
46
  - wrappy@1.0.2 (https://github.com/npm/wrappy)
@@ -49,128 +49,11 @@ This project incorporates components from the projects listed below. The origina
49
49
  - yauzl@3.2.0 (https://github.com/thejoshwolfe/yauzl)
50
50
  - yazl@2.5.1 (https://github.com/thejoshwolfe/yazl)
51
51
 
52
- %% agent-base@6.0.2 NOTICES AND INFORMATION BEGIN HERE
52
+ %% agent-base@7.1.4 NOTICES AND INFORMATION BEGIN HERE
53
53
  =========================================
54
- agent-base
55
- ==========
56
- ### Turn a function into an [`http.Agent`][http.Agent] instance
57
- [![Build Status](https://github.com/TooTallNate/node-agent-base/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/node-agent-base/actions?workflow=Node+CI)
58
-
59
- This module provides an `http.Agent` generator. That is, you pass it an async
60
- callback function, and it returns a new `http.Agent` instance that will invoke the
61
- given callback function when sending outbound HTTP requests.
62
-
63
- #### Some subclasses:
64
-
65
- Here's some more interesting uses of `agent-base`.
66
- Send a pull request to list yours!
67
-
68
- * [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints
69
- * [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints
70
- * [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS
71
- * [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS
72
-
73
-
74
- Installation
75
- ------------
76
-
77
- Install with `npm`:
78
-
79
- ``` bash
80
- $ npm install agent-base
81
- ```
82
-
83
-
84
- Example
85
- -------
86
-
87
- Here's a minimal example that creates a new `net.Socket` connection to the server
88
- for every HTTP request (i.e. the equivalent of `agent: false` option):
89
-
90
- ```js
91
- var net = require('net');
92
- var tls = require('tls');
93
- var url = require('url');
94
- var http = require('http');
95
- var agent = require('agent-base');
96
-
97
- var endpoint = 'http://nodejs.org/api/';
98
- var parsed = url.parse(endpoint);
99
-
100
- // This is the important part!
101
- parsed.agent = agent(function (req, opts) {
102
- var socket;
103
- // `secureEndpoint` is true when using the https module
104
- if (opts.secureEndpoint) {
105
- socket = tls.connect(opts);
106
- } else {
107
- socket = net.connect(opts);
108
- }
109
- return socket;
110
- });
111
-
112
- // Everything else works just like normal...
113
- http.get(parsed, function (res) {
114
- console.log('"response" event!', res.headers);
115
- res.pipe(process.stdout);
116
- });
117
- ```
118
-
119
- Returning a Promise or using an `async` function is also supported:
120
-
121
- ```js
122
- agent(async function (req, opts) {
123
- await sleep(1000);
124
- // etc…
125
- });
126
- ```
127
-
128
- Return another `http.Agent` instance to "pass through" the responsibility
129
- for that HTTP request to that agent:
130
-
131
- ```js
132
- agent(function (req, opts) {
133
- return opts.secureEndpoint ? https.globalAgent : http.globalAgent;
134
- });
135
- ```
136
-
137
-
138
- API
139
- ---
140
-
141
- ## Agent(Function callback[, Object options]) → [http.Agent][]
142
-
143
- Creates a base `http.Agent` that will execute the callback function `callback`
144
- for every HTTP request that it is used as the `agent` for. The callback function
145
- is responsible for creating a `stream.Duplex` instance of some kind that will be
146
- used as the underlying socket in the HTTP request.
147
-
148
- The `options` object accepts the following properties:
149
-
150
- * `timeout` - Number - Timeout for the `callback()` function in milliseconds. Defaults to Infinity (optional).
151
-
152
- The callback function should have the following signature:
153
-
154
- ### callback(http.ClientRequest req, Object options, Function cb) → undefined
155
-
156
- The ClientRequest `req` can be accessed to read request headers and
157
- and the path, etc. The `options` object contains the options passed
158
- to the `http.request()`/`https.request()` function call, and is formatted
159
- to be directly passed to `net.connect()`/`tls.connect()`, or however
160
- else you want a Socket to be created. Pass the created socket to
161
- the callback function `cb` once created, and the HTTP request will
162
- continue to proceed.
163
-
164
- If the `https` module is used to invoke the HTTP request, then the
165
- `secureEndpoint` property on `options` _will be set to `true`_.
166
-
167
-
168
- License
169
- -------
170
-
171
54
  (The MIT License)
172
55
 
173
- Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
56
+ Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
174
57
 
175
58
  Permission is hereby granted, free of charge, to any person obtaining
176
59
  a copy of this software and associated documentation files (the
@@ -190,14 +73,8 @@ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
190
73
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
191
74
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
192
75
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
193
-
194
- [http-proxy-agent]: https://github.com/TooTallNate/node-http-proxy-agent
195
- [https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
196
- [pac-proxy-agent]: https://github.com/TooTallNate/node-pac-proxy-agent
197
- [socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
198
- [http.Agent]: https://nodejs.org/api/http.html#http_class_http_agent
199
76
  =========================================
200
- END OF agent-base@6.0.2 AND INFORMATION
77
+ END OF agent-base@7.1.4 AND INFORMATION
201
78
 
202
79
  %% balanced-match@1.0.2 NOTICES AND INFORMATION BEGIN HERE
203
80
  =========================================
@@ -565,124 +442,11 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
565
442
  =========================================
566
443
  END OF graceful-fs@4.2.10 AND INFORMATION
567
444
 
568
- %% https-proxy-agent@5.0.1 NOTICES AND INFORMATION BEGIN HERE
445
+ %% https-proxy-agent@7.0.6 NOTICES AND INFORMATION BEGIN HERE
569
446
  =========================================
570
- https-proxy-agent
571
- ================
572
- ### An HTTP(s) proxy `http.Agent` implementation for HTTPS
573
- [![Build Status](https://github.com/TooTallNate/node-https-proxy-agent/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/node-https-proxy-agent/actions?workflow=Node+CI)
574
-
575
- This module provides an `http.Agent` implementation that connects to a specified
576
- HTTP or HTTPS proxy server, and can be used with the built-in `https` module.
577
-
578
- Specifically, this `Agent` implementation connects to an intermediary "proxy"
579
- server and issues the [CONNECT HTTP method][CONNECT], which tells the proxy to
580
- open a direct TCP connection to the destination server.
581
-
582
- Since this agent implements the CONNECT HTTP method, it also works with other
583
- protocols that use this method when connecting over proxies (i.e. WebSockets).
584
- See the "Examples" section below for more.
585
-
586
-
587
- Installation
588
- ------------
589
-
590
- Install with `npm`:
591
-
592
- ``` bash
593
- $ npm install https-proxy-agent
594
- ```
595
-
596
-
597
- Examples
598
- --------
599
-
600
- #### `https` module example
601
-
602
- ``` js
603
- var url = require('url');
604
- var https = require('https');
605
- var HttpsProxyAgent = require('https-proxy-agent');
606
-
607
- // HTTP/HTTPS proxy to connect to
608
- var proxy = process.env.http_proxy || 'http://168.63.76.32:3128';
609
- console.log('using proxy server %j', proxy);
610
-
611
- // HTTPS endpoint for the proxy to connect to
612
- var endpoint = process.argv[2] || 'https://graph.facebook.com/tootallnate';
613
- console.log('attempting to GET %j', endpoint);
614
- var options = url.parse(endpoint);
615
-
616
- // create an instance of the `HttpsProxyAgent` class with the proxy server information
617
- var agent = new HttpsProxyAgent(proxy);
618
- options.agent = agent;
619
-
620
- https.get(options, function (res) {
621
- console.log('"response" event!', res.headers);
622
- res.pipe(process.stdout);
623
- });
624
- ```
625
-
626
- #### `ws` WebSocket connection example
627
-
628
- ``` js
629
- var url = require('url');
630
- var WebSocket = require('ws');
631
- var HttpsProxyAgent = require('https-proxy-agent');
632
-
633
- // HTTP/HTTPS proxy to connect to
634
- var proxy = process.env.http_proxy || 'http://168.63.76.32:3128';
635
- console.log('using proxy server %j', proxy);
636
-
637
- // WebSocket endpoint for the proxy to connect to
638
- var endpoint = process.argv[2] || 'ws://echo.websocket.org';
639
- var parsed = url.parse(endpoint);
640
- console.log('attempting to connect to WebSocket %j', endpoint);
641
-
642
- // create an instance of the `HttpsProxyAgent` class with the proxy server information
643
- var options = url.parse(proxy);
644
-
645
- var agent = new HttpsProxyAgent(options);
646
-
647
- // finally, initiate the WebSocket connection
648
- var socket = new WebSocket(endpoint, { agent: agent });
649
-
650
- socket.on('open', function () {
651
- console.log('"open" event!');
652
- socket.send('hello world');
653
- });
654
-
655
- socket.on('message', function (data, flags) {
656
- console.log('"message" event! %j %j', data, flags);
657
- socket.close();
658
- });
659
- ```
660
-
661
- API
662
- ---
663
-
664
- ### new HttpsProxyAgent(Object options)
665
-
666
- The `HttpsProxyAgent` class implements an `http.Agent` subclass that connects
667
- to the specified "HTTP(s) proxy server" in order to proxy HTTPS and/or WebSocket
668
- requests. This is achieved by using the [HTTP `CONNECT` method][CONNECT].
669
-
670
- The `options` argument may either be a string URI of the proxy server to use, or an
671
- "options" object with more specific properties:
672
-
673
- * `host` - String - Proxy host to connect to (may use `hostname` as well). Required.
674
- * `port` - Number - Proxy port to connect to. Required.
675
- * `protocol` - String - If `https:`, then use TLS to connect to the proxy.
676
- * `headers` - Object - Additional HTTP headers to be sent on the HTTP CONNECT method.
677
- * Any other options given are passed to the `net.connect()`/`tls.connect()` functions.
678
-
679
-
680
- License
681
- -------
682
-
683
447
  (The MIT License)
684
448
 
685
- Copyright (c) 2013 Nathan Rajlich &lt;nathan@tootallnate.net&gt;
449
+ Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
686
450
 
687
451
  Permission is hereby granted, free of charge, to any person obtaining
688
452
  a copy of this software and associated documentation files (the
@@ -702,10 +466,8 @@ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
702
466
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
703
467
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
704
468
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
705
-
706
- [CONNECT]: http://en.wikipedia.org/wiki/HTTP_tunnel#HTTP_CONNECT_Tunneling
707
469
  =========================================
708
- END OF https-proxy-agent@5.0.1 AND INFORMATION
470
+ END OF https-proxy-agent@7.0.6 AND INFORMATION
709
471
 
710
472
  %% ip-address@9.0.5 NOTICES AND INFORMATION BEGIN HERE
711
473
  =========================================
@@ -1169,141 +931,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1169
931
  =========================================
1170
932
  END OF smart-buffer@4.2.0 AND INFORMATION
1171
933
 
1172
- %% socks-proxy-agent@6.1.1 NOTICES AND INFORMATION BEGIN HERE
934
+ %% socks-proxy-agent@8.0.5 NOTICES AND INFORMATION BEGIN HERE
1173
935
  =========================================
1174
- socks-proxy-agent
1175
- ================
1176
- ### A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS
1177
- [![Build Status](https://github.com/TooTallNate/node-socks-proxy-agent/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/node-socks-proxy-agent/actions?workflow=Node+CI)
1178
-
1179
- This module provides an `http.Agent` implementation that connects to a
1180
- specified SOCKS proxy server, and can be used with the built-in `http`
1181
- and `https` modules.
1182
-
1183
- It can also be used in conjunction with the `ws` module to establish a WebSocket
1184
- connection over a SOCKS proxy. See the "Examples" section below.
1185
-
1186
- Installation
1187
- ------------
1188
-
1189
- Install with `npm`:
1190
-
1191
- ``` bash
1192
- $ npm install socks-proxy-agent
1193
- ```
1194
-
1195
-
1196
- Examples
1197
- --------
1198
-
1199
- #### TypeScript example
1200
-
1201
- ```ts
1202
- import https from 'https';
1203
- import { SocksProxyAgent } from 'socks-proxy-agent';
1204
-
1205
- const info = {
1206
- host: 'br41.nordvpn.com',
1207
- userId: 'your-name@gmail.com',
1208
- password: 'abcdef12345124'
1209
- };
1210
- const agent = new SocksProxyAgent(info);
1211
-
1212
- https.get('https://jsonip.org', { agent }, (res) => {
1213
- console.log(res.headers);
1214
- res.pipe(process.stdout);
1215
- });
1216
- ```
1217
-
1218
- #### `http` module example
1219
-
1220
- ```js
1221
- var url = require('url');
1222
- var http = require('http');
1223
- var SocksProxyAgent = require('socks-proxy-agent');
1224
-
1225
- // SOCKS proxy to connect to
1226
- var proxy = process.env.socks_proxy || 'socks://127.0.0.1:1080';
1227
- console.log('using proxy server %j', proxy);
1228
-
1229
- // HTTP endpoint for the proxy to connect to
1230
- var endpoint = process.argv[2] || 'http://nodejs.org/api/';
1231
- console.log('attempting to GET %j', endpoint);
1232
- var opts = url.parse(endpoint);
1233
-
1234
- // create an instance of the `SocksProxyAgent` class with the proxy server information
1235
- var agent = new SocksProxyAgent(proxy);
1236
- opts.agent = agent;
1237
-
1238
- http.get(opts, function (res) {
1239
- console.log('"response" event!', res.headers);
1240
- res.pipe(process.stdout);
1241
- });
1242
- ```
1243
-
1244
- #### `https` module example
1245
-
1246
- ```js
1247
- var url = require('url');
1248
- var https = require('https');
1249
- var SocksProxyAgent = require('socks-proxy-agent');
1250
-
1251
- // SOCKS proxy to connect to
1252
- var proxy = process.env.socks_proxy || 'socks://127.0.0.1:1080';
1253
- console.log('using proxy server %j', proxy);
1254
-
1255
- // HTTP endpoint for the proxy to connect to
1256
- var endpoint = process.argv[2] || 'https://encrypted.google.com/';
1257
- console.log('attempting to GET %j', endpoint);
1258
- var opts = url.parse(endpoint);
1259
-
1260
- // create an instance of the `SocksProxyAgent` class with the proxy server information
1261
- var agent = new SocksProxyAgent(proxy);
1262
- opts.agent = agent;
1263
-
1264
- https.get(opts, function (res) {
1265
- console.log('"response" event!', res.headers);
1266
- res.pipe(process.stdout);
1267
- });
1268
- ```
1269
-
1270
- #### `ws` WebSocket connection example
1271
-
1272
- ``` js
1273
- var WebSocket = require('ws');
1274
- var SocksProxyAgent = require('socks-proxy-agent');
1275
-
1276
- // SOCKS proxy to connect to
1277
- var proxy = process.env.socks_proxy || 'socks://127.0.0.1:1080';
1278
- console.log('using proxy server %j', proxy);
1279
-
1280
- // WebSocket endpoint for the proxy to connect to
1281
- var endpoint = process.argv[2] || 'ws://echo.websocket.org';
1282
- console.log('attempting to connect to WebSocket %j', endpoint);
1283
-
1284
- // create an instance of the `SocksProxyAgent` class with the proxy server information
1285
- var agent = new SocksProxyAgent(proxy);
1286
-
1287
- // initiate the WebSocket connection
1288
- var socket = new WebSocket(endpoint, { agent: agent });
1289
-
1290
- socket.on('open', function () {
1291
- console.log('"open" event!');
1292
- socket.send('hello world');
1293
- });
1294
-
1295
- socket.on('message', function (data, flags) {
1296
- console.log('"message" event! %j %j', data, flags);
1297
- socket.close();
1298
- });
1299
- ```
1300
-
1301
- License
1302
- -------
1303
-
1304
936
  (The MIT License)
1305
937
 
1306
- Copyright (c) 2013 Nathan Rajlich &lt;nathan@tootallnate.net&gt;
938
+ Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
1307
939
 
1308
940
  Permission is hereby granted, free of charge, to any person obtaining
1309
941
  a copy of this software and associated documentation files (the
@@ -1324,7 +956,7 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
1324
956
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
1325
957
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1326
958
  =========================================
1327
- END OF socks-proxy-agent@6.1.1 AND INFORMATION
959
+ END OF socks-proxy-agent@8.0.5 AND INFORMATION
1328
960
 
1329
961
  %% socks@2.8.3 NOTICES AND INFORMATION BEGIN HERE
1330
962
  =========================================
@@ -319,7 +319,7 @@ import_utilsBundle.program.command("print-api-json", { hidden: true }).action(fu
319
319
  import_utilsBundle.program.command("launch-server", { hidden: true }).requiredOption("--browser <browserName>", 'Browser name, one of "chromium", "firefox" or "webkit"').option("--config <path-to-config-file>", "JSON file with launchServer options").action(function(options) {
320
320
  (0, import_driver.launchBrowserServer)(options.browser, options.config);
321
321
  });
322
- import_utilsBundle.program.command("show-trace [trace...]").option("-b, --browser <browserType>", "browser to use, one of cr, chromium, ff, firefox, wk, webkit", "chromium").option("-h, --host <host>", "Host to serve trace on; specifying this option opens trace in a browser tab").option("-p, --port <port>", "Port to serve trace on, 0 for any free port; specifying this option opens trace in a browser tab").option("--stdin", "Accept trace URLs over stdin to update the viewer").description("show trace viewer").action(function(traces, options) {
322
+ import_utilsBundle.program.command("show-trace [trace]").option("-b, --browser <browserType>", "browser to use, one of cr, chromium, ff, firefox, wk, webkit", "chromium").option("-h, --host <host>", "Host to serve trace on; specifying this option opens trace in a browser tab").option("-p, --port <port>", "Port to serve trace on, 0 for any free port; specifying this option opens trace in a browser tab").option("--stdin", "Accept trace URLs over stdin to update the viewer").description("show trace viewer").action(function(trace, options) {
323
323
  if (options.browser === "cr")
324
324
  options.browser = "chromium";
325
325
  if (options.browser === "ff")
@@ -332,12 +332,13 @@ import_utilsBundle.program.command("show-trace [trace...]").option("-b, --browse
332
332
  isServer: !!options.stdin
333
333
  };
334
334
  if (options.port !== void 0 || options.host !== void 0)
335
- (0, import_traceViewer.runTraceInBrowser)(traces, openOptions).catch(logErrorAndExit);
335
+ (0, import_traceViewer.runTraceInBrowser)(trace, openOptions).catch(logErrorAndExit);
336
336
  else
337
- (0, import_traceViewer.runTraceViewerApp)(traces, options.browser, openOptions, true).catch(logErrorAndExit);
337
+ (0, import_traceViewer.runTraceViewerApp)(trace, options.browser, openOptions, true).catch(logErrorAndExit);
338
338
  }).addHelpText("afterAll", `
339
339
  Examples:
340
340
 
341
+ $ show-trace
341
342
  $ show-trace https://example.com/trace.zip`);
342
343
  async function launchContext(options, extraOptions) {
343
344
  validateOptions(options);
@@ -69,7 +69,6 @@ class BrowserContext extends import_instrumentation.SdkObject {
69
69
  this._creatingStorageStatePage = false;
70
70
  this.initScripts = [];
71
71
  this._routesInFlight = /* @__PURE__ */ new Set();
72
- this._playwrightBindingExposed = false;
73
72
  this.attribution.context = this;
74
73
  this._browser = browser;
75
74
  this._options = options;
@@ -231,17 +230,17 @@ if (navigator.serviceWorker) navigator.serviceWorker.register = async () => { co
231
230
  return this._pageBindings.get(name)?.forClient;
232
231
  }
233
232
  async exposePlaywrightBindingIfNeeded() {
234
- if (this._playwrightBindingExposed)
235
- return;
236
- this._playwrightBindingExposed = true;
237
- await this.doExposePlaywrightBinding();
238
- this.bindingsInitScript = import_page2.PageBinding.createInitScript();
239
- this.initScripts.push(this.bindingsInitScript);
240
- await this.doAddInitScript(this.bindingsInitScript);
241
- await this.safeNonStallingEvaluateInAllFrames(this.bindingsInitScript.source, "main");
233
+ this._playwrightBindingExposed ??= (async () => {
234
+ await this.doExposePlaywrightBinding();
235
+ this.bindingsInitScript = import_page2.PageBinding.createInitScript();
236
+ this.initScripts.push(this.bindingsInitScript);
237
+ await this.doAddInitScript(this.bindingsInitScript);
238
+ await this.safeNonStallingEvaluateInAllFrames(this.bindingsInitScript.source, "main");
239
+ })();
240
+ return await this._playwrightBindingExposed;
242
241
  }
243
242
  needsPlaywrightBinding() {
244
- return this._playwrightBindingExposed;
243
+ return this._playwrightBindingExposed !== void 0;
245
244
  }
246
245
  async exposeBinding(progress, name, needsHandle, playwrightBinding, forClient) {
247
246
  if (this._pageBindings.has(name))
@@ -44,6 +44,8 @@ const disabledFeatures = (assistantMode) => [
44
44
  "Translate",
45
45
  // See https://issues.chromium.org/u/1/issues/435410220
46
46
  "AutoDeElevate",
47
+ // See https://github.com/microsoft/playwright/issues/37714
48
+ "RenderDocument",
47
49
  assistantMode ? "AutomationControlled" : ""
48
50
  ].filter(Boolean);
49
51
  const chromiumSwitches = (assistantMode, channel) => [
@@ -82,7 +82,7 @@ class SocksProxyConnection {
82
82
  async connect() {
83
83
  const proxyAgent = this.socksProxy.getProxyAgent(this.host, this.port);
84
84
  if (proxyAgent)
85
- this._serverEncrypted = await proxyAgent.callback(new import_events.EventEmitter(), { host: rewriteToLocalhostIfNeeded(this.host), port: this.port, secureEndpoint: false });
85
+ this._serverEncrypted = await proxyAgent.connect(new import_events.EventEmitter(), { host: rewriteToLocalhostIfNeeded(this.host), port: this.port, secureEndpoint: false });
86
86
  else
87
87
  this._serverEncrypted = await (0, import_happyEyeballs.createSocket)(rewriteToLocalhostIfNeeded(this.host), this.port);
88
88
  this._serverEncrypted.once("close", this._serverCloseEventListener);
@@ -46,14 +46,14 @@ var import_launchApp = require("../../launchApp");
46
46
  var import_launchApp2 = require("../../launchApp");
47
47
  var import_playwright = require("../../playwright");
48
48
  var import_progress = require("../../progress");
49
- function validateTraceUrls(traceUrls) {
50
- for (const traceUrl of traceUrls) {
51
- let traceFile = traceUrl;
52
- if (traceUrl.endsWith(".json"))
53
- traceFile = traceUrl.substring(0, traceUrl.length - ".json".length);
54
- if (!traceUrl.startsWith("http://") && !traceUrl.startsWith("https://") && !import_fs.default.existsSync(traceFile) && !import_fs.default.existsSync(traceFile + ".trace"))
55
- throw new Error(`Trace file ${traceUrl} does not exist!`);
56
- }
49
+ function validateTraceUrl(traceUrl) {
50
+ if (!traceUrl)
51
+ return;
52
+ let traceFile = traceUrl;
53
+ if (traceUrl.endsWith(".json"))
54
+ traceFile = traceUrl.substring(0, traceUrl.length - ".json".length);
55
+ if (!traceUrl.startsWith("http://") && !traceUrl.startsWith("https://") && !import_fs.default.existsSync(traceFile) && !import_fs.default.existsSync(traceFile + ".trace"))
56
+ throw new Error(`Trace file ${traceUrl} does not exist!`);
57
57
  }
58
58
  async function startTraceViewerServer(options) {
59
59
  const server = new import_httpServer.HttpServer();
@@ -93,11 +93,11 @@ async function startTraceViewerServer(options) {
93
93
  await server.start({ preferredPort: port, host });
94
94
  return server;
95
95
  }
96
- async function installRootRedirect(server, traceUrls, options) {
96
+ async function installRootRedirect(server, traceUrl, options) {
97
97
  const params = new URLSearchParams();
98
98
  if (import_path.default.sep !== import_path.default.posix.sep)
99
99
  params.set("pathSeparator", import_path.default.sep);
100
- for (const traceUrl of traceUrls)
100
+ if (traceUrl)
101
101
  params.append("trace", traceUrl);
102
102
  if (server.wsGuid())
103
103
  params.append("ws", server.wsGuid());
@@ -128,19 +128,19 @@ async function installRootRedirect(server, traceUrls, options) {
128
128
  return true;
129
129
  });
130
130
  }
131
- async function runTraceViewerApp(traceUrls, browserName, options, exitOnClose) {
132
- validateTraceUrls(traceUrls);
131
+ async function runTraceViewerApp(traceUrl, browserName, options, exitOnClose) {
132
+ validateTraceUrl(traceUrl);
133
133
  const server = await startTraceViewerServer(options);
134
- await installRootRedirect(server, traceUrls, options);
134
+ await installRootRedirect(server, traceUrl, options);
135
135
  const page = await openTraceViewerApp(server.urlPrefix("precise"), browserName, options);
136
136
  if (exitOnClose)
137
137
  page.on("close", () => (0, import_utils.gracefullyProcessExitDoNotHang)(0));
138
138
  return page;
139
139
  }
140
- async function runTraceInBrowser(traceUrls, options) {
141
- validateTraceUrls(traceUrls);
140
+ async function runTraceInBrowser(traceUrl, options) {
141
+ validateTraceUrl(traceUrl);
142
142
  const server = await startTraceViewerServer(options);
143
- await installRootRedirect(server, traceUrls, options);
143
+ await installRootRedirect(server, traceUrl, options);
144
144
  await openTraceInBrowser(server.urlPrefix("human-readable"));
145
145
  }
146
146
  async function openTraceViewerApp(url, browserName, options) {
@@ -64,12 +64,12 @@ function httpRequest(params, onResponse, onError) {
64
64
  path: parsedUrl.href,
65
65
  host: parsedProxyURL.hostname,
66
66
  port: parsedProxyURL.port,
67
+ protocol: parsedProxyURL.protocol || "http:",
67
68
  headers: options.headers,
68
69
  method: options.method
69
70
  };
70
71
  } else {
71
- parsedProxyURL.secureProxy = parsedProxyURL.protocol === "https:";
72
- options.agent = new import_utilsBundle.HttpsProxyAgent(parsedProxyURL);
72
+ options.agent = new import_utilsBundle.HttpsProxyAgent(import_url.default.format(parsedProxyURL));
73
73
  options.rejectUnauthorized = false;
74
74
  }
75
75
  }
@@ -144,17 +144,19 @@ function createProxyAgent(proxy, forUrl) {
144
144
  proxyServer = "http://" + proxyServer;
145
145
  const proxyOpts = import_url.default.parse(proxyServer);
146
146
  if (proxyOpts.protocol?.startsWith("socks")) {
147
- return new import_utilsBundle.SocksProxyAgent({
148
- host: proxyOpts.hostname,
149
- port: proxyOpts.port || void 0
150
- });
147
+ const socksProxyURL = new URL(proxyServer);
148
+ if (proxyOpts.protocol === "socks5:")
149
+ socksProxyURL.protocol = "socks5h:";
150
+ else if (proxyOpts.protocol === "socks4:")
151
+ socksProxyURL.protocol = "socks4a:";
152
+ return new import_utilsBundle.SocksProxyAgent(socksProxyURL);
151
153
  }
152
154
  if (proxy.username)
153
155
  proxyOpts.auth = `${proxy.username}:${proxy.password || ""}`;
154
156
  if (forUrl && ["ws:", "wss:"].includes(forUrl.protocol)) {
155
- return new import_utilsBundle.HttpsProxyAgent(proxyOpts);
157
+ return new import_utilsBundle.HttpsProxyAgent(import_url.default.format(proxyOpts));
156
158
  }
157
- return new import_utilsBundle.HttpsProxyAgent(proxyOpts);
159
+ return new import_utilsBundle.HttpsProxyAgent(import_url.default.format(proxyOpts));
158
160
  }
159
161
  function createHttpServer(...args) {
160
162
  const server = import_http.default.createServer(...args);