playwright-core 1.57.0-alpha-2025-10-07 → 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.
- package/ThirdPartyNotices.txt +5 -286
- package/lib/cli/program.js +4 -3
- package/lib/server/socksClientCertificatesInterceptor.js +3 -7
- package/lib/server/trace/viewer/traceViewer.js +16 -16
- package/lib/server/utils/network.js +7 -4
- package/lib/utilsBundleImpl/index.js +116 -117
- package/lib/vite/traceViewer/assets/{codeMirrorModule-eyVcHN77.js → codeMirrorModule-Bhnc5o2x.js} +1 -1
- package/lib/vite/traceViewer/assets/{defaultSettingsView-w0zYjHsW.js → defaultSettingsView-ClwvkA2N.js} +82 -82
- package/lib/vite/traceViewer/index.DFO9NNF5.js +2 -0
- package/lib/vite/traceViewer/index.html +4 -4
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/{uiMode.DRQ310U5.js → uiMode.Shu3QS-1.js} +2 -2
- package/lib/vite/traceViewer/uiMode.html +2 -2
- package/package.json +1 -1
- package/lib/vite/traceViewer/index.Bx16ehp1.js +0 -2
package/ThirdPartyNotices.txt
CHANGED
|
@@ -4,7 +4,6 @@ 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)
|
|
8
7
|
- agent-base@7.1.4 (https://github.com/TooTallNate/proxy-agents)
|
|
9
8
|
- balanced-match@1.0.2 (https://github.com/juliangruber/balanced-match)
|
|
10
9
|
- brace-expansion@1.1.12 (https://github.com/juliangruber/brace-expansion)
|
|
@@ -41,7 +40,7 @@ This project incorporates components from the projects listed below. The origina
|
|
|
41
40
|
- retry@0.12.0 (https://github.com/tim-kos/node-retry)
|
|
42
41
|
- signal-exit@3.0.7 (https://github.com/tapjs/signal-exit)
|
|
43
42
|
- smart-buffer@4.2.0 (https://github.com/JoshGlazebrook/smart-buffer)
|
|
44
|
-
- socks-proxy-agent@
|
|
43
|
+
- socks-proxy-agent@8.0.5 (https://github.com/TooTallNate/proxy-agents)
|
|
45
44
|
- socks@2.8.3 (https://github.com/JoshGlazebrook/socks)
|
|
46
45
|
- sprintf-js@1.1.3 (https://github.com/alexei/sprintf.js)
|
|
47
46
|
- wrappy@1.0.2 (https://github.com/npm/wrappy)
|
|
@@ -50,156 +49,6 @@ This project incorporates components from the projects listed below. The origina
|
|
|
50
49
|
- yauzl@3.2.0 (https://github.com/thejoshwolfe/yauzl)
|
|
51
50
|
- yazl@2.5.1 (https://github.com/thejoshwolfe/yazl)
|
|
52
51
|
|
|
53
|
-
%% agent-base@6.0.2 NOTICES AND INFORMATION BEGIN HERE
|
|
54
|
-
=========================================
|
|
55
|
-
agent-base
|
|
56
|
-
==========
|
|
57
|
-
### Turn a function into an [`http.Agent`][http.Agent] instance
|
|
58
|
-
[](https://github.com/TooTallNate/node-agent-base/actions?workflow=Node+CI)
|
|
59
|
-
|
|
60
|
-
This module provides an `http.Agent` generator. That is, you pass it an async
|
|
61
|
-
callback function, and it returns a new `http.Agent` instance that will invoke the
|
|
62
|
-
given callback function when sending outbound HTTP requests.
|
|
63
|
-
|
|
64
|
-
#### Some subclasses:
|
|
65
|
-
|
|
66
|
-
Here's some more interesting uses of `agent-base`.
|
|
67
|
-
Send a pull request to list yours!
|
|
68
|
-
|
|
69
|
-
* [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints
|
|
70
|
-
* [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints
|
|
71
|
-
* [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS
|
|
72
|
-
* [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
Installation
|
|
76
|
-
------------
|
|
77
|
-
|
|
78
|
-
Install with `npm`:
|
|
79
|
-
|
|
80
|
-
``` bash
|
|
81
|
-
$ npm install agent-base
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
Example
|
|
86
|
-
-------
|
|
87
|
-
|
|
88
|
-
Here's a minimal example that creates a new `net.Socket` connection to the server
|
|
89
|
-
for every HTTP request (i.e. the equivalent of `agent: false` option):
|
|
90
|
-
|
|
91
|
-
```js
|
|
92
|
-
var net = require('net');
|
|
93
|
-
var tls = require('tls');
|
|
94
|
-
var url = require('url');
|
|
95
|
-
var http = require('http');
|
|
96
|
-
var agent = require('agent-base');
|
|
97
|
-
|
|
98
|
-
var endpoint = 'http://nodejs.org/api/';
|
|
99
|
-
var parsed = url.parse(endpoint);
|
|
100
|
-
|
|
101
|
-
// This is the important part!
|
|
102
|
-
parsed.agent = agent(function (req, opts) {
|
|
103
|
-
var socket;
|
|
104
|
-
// `secureEndpoint` is true when using the https module
|
|
105
|
-
if (opts.secureEndpoint) {
|
|
106
|
-
socket = tls.connect(opts);
|
|
107
|
-
} else {
|
|
108
|
-
socket = net.connect(opts);
|
|
109
|
-
}
|
|
110
|
-
return socket;
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// Everything else works just like normal...
|
|
114
|
-
http.get(parsed, function (res) {
|
|
115
|
-
console.log('"response" event!', res.headers);
|
|
116
|
-
res.pipe(process.stdout);
|
|
117
|
-
});
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Returning a Promise or using an `async` function is also supported:
|
|
121
|
-
|
|
122
|
-
```js
|
|
123
|
-
agent(async function (req, opts) {
|
|
124
|
-
await sleep(1000);
|
|
125
|
-
// etc…
|
|
126
|
-
});
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
Return another `http.Agent` instance to "pass through" the responsibility
|
|
130
|
-
for that HTTP request to that agent:
|
|
131
|
-
|
|
132
|
-
```js
|
|
133
|
-
agent(function (req, opts) {
|
|
134
|
-
return opts.secureEndpoint ? https.globalAgent : http.globalAgent;
|
|
135
|
-
});
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
API
|
|
140
|
-
---
|
|
141
|
-
|
|
142
|
-
## Agent(Function callback[, Object options]) → [http.Agent][]
|
|
143
|
-
|
|
144
|
-
Creates a base `http.Agent` that will execute the callback function `callback`
|
|
145
|
-
for every HTTP request that it is used as the `agent` for. The callback function
|
|
146
|
-
is responsible for creating a `stream.Duplex` instance of some kind that will be
|
|
147
|
-
used as the underlying socket in the HTTP request.
|
|
148
|
-
|
|
149
|
-
The `options` object accepts the following properties:
|
|
150
|
-
|
|
151
|
-
* `timeout` - Number - Timeout for the `callback()` function in milliseconds. Defaults to Infinity (optional).
|
|
152
|
-
|
|
153
|
-
The callback function should have the following signature:
|
|
154
|
-
|
|
155
|
-
### callback(http.ClientRequest req, Object options, Function cb) → undefined
|
|
156
|
-
|
|
157
|
-
The ClientRequest `req` can be accessed to read request headers and
|
|
158
|
-
and the path, etc. The `options` object contains the options passed
|
|
159
|
-
to the `http.request()`/`https.request()` function call, and is formatted
|
|
160
|
-
to be directly passed to `net.connect()`/`tls.connect()`, or however
|
|
161
|
-
else you want a Socket to be created. Pass the created socket to
|
|
162
|
-
the callback function `cb` once created, and the HTTP request will
|
|
163
|
-
continue to proceed.
|
|
164
|
-
|
|
165
|
-
If the `https` module is used to invoke the HTTP request, then the
|
|
166
|
-
`secureEndpoint` property on `options` _will be set to `true`_.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
License
|
|
170
|
-
-------
|
|
171
|
-
|
|
172
|
-
(The MIT License)
|
|
173
|
-
|
|
174
|
-
Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
|
175
|
-
|
|
176
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
177
|
-
a copy of this software and associated documentation files (the
|
|
178
|
-
'Software'), to deal in the Software without restriction, including
|
|
179
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
180
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
181
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
182
|
-
the following conditions:
|
|
183
|
-
|
|
184
|
-
The above copyright notice and this permission notice shall be
|
|
185
|
-
included in all copies or substantial portions of the Software.
|
|
186
|
-
|
|
187
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
188
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
189
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
190
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
191
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
192
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
193
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
194
|
-
|
|
195
|
-
[http-proxy-agent]: https://github.com/TooTallNate/node-http-proxy-agent
|
|
196
|
-
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
|
197
|
-
[pac-proxy-agent]: https://github.com/TooTallNate/node-pac-proxy-agent
|
|
198
|
-
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
|
|
199
|
-
[http.Agent]: https://nodejs.org/api/http.html#http_class_http_agent
|
|
200
|
-
=========================================
|
|
201
|
-
END OF agent-base@6.0.2 AND INFORMATION
|
|
202
|
-
|
|
203
52
|
%% agent-base@7.1.4 NOTICES AND INFORMATION BEGIN HERE
|
|
204
53
|
=========================================
|
|
205
54
|
(The MIT License)
|
|
@@ -1082,141 +931,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
1082
931
|
=========================================
|
|
1083
932
|
END OF smart-buffer@4.2.0 AND INFORMATION
|
|
1084
933
|
|
|
1085
|
-
%% socks-proxy-agent@
|
|
934
|
+
%% socks-proxy-agent@8.0.5 NOTICES AND INFORMATION BEGIN HERE
|
|
1086
935
|
=========================================
|
|
1087
|
-
socks-proxy-agent
|
|
1088
|
-
================
|
|
1089
|
-
### A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS
|
|
1090
|
-
[](https://github.com/TooTallNate/node-socks-proxy-agent/actions?workflow=Node+CI)
|
|
1091
|
-
|
|
1092
|
-
This module provides an `http.Agent` implementation that connects to a
|
|
1093
|
-
specified SOCKS proxy server, and can be used with the built-in `http`
|
|
1094
|
-
and `https` modules.
|
|
1095
|
-
|
|
1096
|
-
It can also be used in conjunction with the `ws` module to establish a WebSocket
|
|
1097
|
-
connection over a SOCKS proxy. See the "Examples" section below.
|
|
1098
|
-
|
|
1099
|
-
Installation
|
|
1100
|
-
------------
|
|
1101
|
-
|
|
1102
|
-
Install with `npm`:
|
|
1103
|
-
|
|
1104
|
-
``` bash
|
|
1105
|
-
$ npm install socks-proxy-agent
|
|
1106
|
-
```
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
Examples
|
|
1110
|
-
--------
|
|
1111
|
-
|
|
1112
|
-
#### TypeScript example
|
|
1113
|
-
|
|
1114
|
-
```ts
|
|
1115
|
-
import https from 'https';
|
|
1116
|
-
import { SocksProxyAgent } from 'socks-proxy-agent';
|
|
1117
|
-
|
|
1118
|
-
const info = {
|
|
1119
|
-
host: 'br41.nordvpn.com',
|
|
1120
|
-
userId: 'your-name@gmail.com',
|
|
1121
|
-
password: 'abcdef12345124'
|
|
1122
|
-
};
|
|
1123
|
-
const agent = new SocksProxyAgent(info);
|
|
1124
|
-
|
|
1125
|
-
https.get('https://jsonip.org', { agent }, (res) => {
|
|
1126
|
-
console.log(res.headers);
|
|
1127
|
-
res.pipe(process.stdout);
|
|
1128
|
-
});
|
|
1129
|
-
```
|
|
1130
|
-
|
|
1131
|
-
#### `http` module example
|
|
1132
|
-
|
|
1133
|
-
```js
|
|
1134
|
-
var url = require('url');
|
|
1135
|
-
var http = require('http');
|
|
1136
|
-
var SocksProxyAgent = require('socks-proxy-agent');
|
|
1137
|
-
|
|
1138
|
-
// SOCKS proxy to connect to
|
|
1139
|
-
var proxy = process.env.socks_proxy || 'socks://127.0.0.1:1080';
|
|
1140
|
-
console.log('using proxy server %j', proxy);
|
|
1141
|
-
|
|
1142
|
-
// HTTP endpoint for the proxy to connect to
|
|
1143
|
-
var endpoint = process.argv[2] || 'http://nodejs.org/api/';
|
|
1144
|
-
console.log('attempting to GET %j', endpoint);
|
|
1145
|
-
var opts = url.parse(endpoint);
|
|
1146
|
-
|
|
1147
|
-
// create an instance of the `SocksProxyAgent` class with the proxy server information
|
|
1148
|
-
var agent = new SocksProxyAgent(proxy);
|
|
1149
|
-
opts.agent = agent;
|
|
1150
|
-
|
|
1151
|
-
http.get(opts, function (res) {
|
|
1152
|
-
console.log('"response" event!', res.headers);
|
|
1153
|
-
res.pipe(process.stdout);
|
|
1154
|
-
});
|
|
1155
|
-
```
|
|
1156
|
-
|
|
1157
|
-
#### `https` module example
|
|
1158
|
-
|
|
1159
|
-
```js
|
|
1160
|
-
var url = require('url');
|
|
1161
|
-
var https = require('https');
|
|
1162
|
-
var SocksProxyAgent = require('socks-proxy-agent');
|
|
1163
|
-
|
|
1164
|
-
// SOCKS proxy to connect to
|
|
1165
|
-
var proxy = process.env.socks_proxy || 'socks://127.0.0.1:1080';
|
|
1166
|
-
console.log('using proxy server %j', proxy);
|
|
1167
|
-
|
|
1168
|
-
// HTTP endpoint for the proxy to connect to
|
|
1169
|
-
var endpoint = process.argv[2] || 'https://encrypted.google.com/';
|
|
1170
|
-
console.log('attempting to GET %j', endpoint);
|
|
1171
|
-
var opts = url.parse(endpoint);
|
|
1172
|
-
|
|
1173
|
-
// create an instance of the `SocksProxyAgent` class with the proxy server information
|
|
1174
|
-
var agent = new SocksProxyAgent(proxy);
|
|
1175
|
-
opts.agent = agent;
|
|
1176
|
-
|
|
1177
|
-
https.get(opts, function (res) {
|
|
1178
|
-
console.log('"response" event!', res.headers);
|
|
1179
|
-
res.pipe(process.stdout);
|
|
1180
|
-
});
|
|
1181
|
-
```
|
|
1182
|
-
|
|
1183
|
-
#### `ws` WebSocket connection example
|
|
1184
|
-
|
|
1185
|
-
``` js
|
|
1186
|
-
var WebSocket = require('ws');
|
|
1187
|
-
var SocksProxyAgent = require('socks-proxy-agent');
|
|
1188
|
-
|
|
1189
|
-
// SOCKS proxy to connect to
|
|
1190
|
-
var proxy = process.env.socks_proxy || 'socks://127.0.0.1:1080';
|
|
1191
|
-
console.log('using proxy server %j', proxy);
|
|
1192
|
-
|
|
1193
|
-
// WebSocket endpoint for the proxy to connect to
|
|
1194
|
-
var endpoint = process.argv[2] || 'ws://echo.websocket.org';
|
|
1195
|
-
console.log('attempting to connect to WebSocket %j', endpoint);
|
|
1196
|
-
|
|
1197
|
-
// create an instance of the `SocksProxyAgent` class with the proxy server information
|
|
1198
|
-
var agent = new SocksProxyAgent(proxy);
|
|
1199
|
-
|
|
1200
|
-
// initiate the WebSocket connection
|
|
1201
|
-
var socket = new WebSocket(endpoint, { agent: agent });
|
|
1202
|
-
|
|
1203
|
-
socket.on('open', function () {
|
|
1204
|
-
console.log('"open" event!');
|
|
1205
|
-
socket.send('hello world');
|
|
1206
|
-
});
|
|
1207
|
-
|
|
1208
|
-
socket.on('message', function (data, flags) {
|
|
1209
|
-
console.log('"message" event! %j %j', data, flags);
|
|
1210
|
-
socket.close();
|
|
1211
|
-
});
|
|
1212
|
-
```
|
|
1213
|
-
|
|
1214
|
-
License
|
|
1215
|
-
-------
|
|
1216
|
-
|
|
1217
936
|
(The MIT License)
|
|
1218
937
|
|
|
1219
|
-
Copyright (c) 2013 Nathan Rajlich
|
|
938
|
+
Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
|
1220
939
|
|
|
1221
940
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
1222
941
|
a copy of this software and associated documentation files (the
|
|
@@ -1237,7 +956,7 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
1237
956
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
1238
957
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1239
958
|
=========================================
|
|
1240
|
-
END OF socks-proxy-agent@
|
|
959
|
+
END OF socks-proxy-agent@8.0.5 AND INFORMATION
|
|
1241
960
|
|
|
1242
961
|
%% socks@2.8.3 NOTICES AND INFORMATION BEGIN HERE
|
|
1243
962
|
=========================================
|
|
@@ -1410,6 +1129,6 @@ END OF yazl@2.5.1 AND INFORMATION
|
|
|
1410
1129
|
|
|
1411
1130
|
SUMMARY BEGIN HERE
|
|
1412
1131
|
=========================================
|
|
1413
|
-
Total Packages:
|
|
1132
|
+
Total Packages: 44
|
|
1414
1133
|
=========================================
|
|
1415
1134
|
END OF SUMMARY
|
package/lib/cli/program.js
CHANGED
|
@@ -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
|
|
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)(
|
|
335
|
+
(0, import_traceViewer.runTraceInBrowser)(trace, openOptions).catch(logErrorAndExit);
|
|
336
336
|
else
|
|
337
|
-
(0, import_traceViewer.runTraceViewerApp)(
|
|
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);
|
|
@@ -81,14 +81,10 @@ class SocksProxyConnection {
|
|
|
81
81
|
}
|
|
82
82
|
async connect() {
|
|
83
83
|
const proxyAgent = this.socksProxy.getProxyAgent(this.host, this.port);
|
|
84
|
-
if (proxyAgent)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
else
|
|
88
|
-
this._serverEncrypted = await proxyAgent.connect(new import_events.EventEmitter(), { host: rewriteToLocalhostIfNeeded(this.host), port: this.port, secureEndpoint: false });
|
|
89
|
-
} else {
|
|
84
|
+
if (proxyAgent)
|
|
85
|
+
this._serverEncrypted = await proxyAgent.connect(new import_events.EventEmitter(), { host: rewriteToLocalhostIfNeeded(this.host), port: this.port, secureEndpoint: false });
|
|
86
|
+
else
|
|
90
87
|
this._serverEncrypted = await (0, import_happyEyeballs.createSocket)(rewriteToLocalhostIfNeeded(this.host), this.port);
|
|
91
|
-
}
|
|
92
88
|
this._serverEncrypted.once("close", this._serverCloseEventListener);
|
|
93
89
|
this._serverEncrypted.once("error", (error) => this._browserEncrypted.destroy(error));
|
|
94
90
|
if (this._closed) {
|
|
@@ -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
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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,
|
|
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
|
-
|
|
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(
|
|
132
|
-
|
|
131
|
+
async function runTraceViewerApp(traceUrl, browserName, options, exitOnClose) {
|
|
132
|
+
validateTraceUrl(traceUrl);
|
|
133
133
|
const server = await startTraceViewerServer(options);
|
|
134
|
-
await installRootRedirect(server,
|
|
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(
|
|
141
|
-
|
|
140
|
+
async function runTraceInBrowser(traceUrl, options) {
|
|
141
|
+
validateTraceUrl(traceUrl);
|
|
142
142
|
const server = await startTraceViewerServer(options);
|
|
143
|
-
await installRootRedirect(server,
|
|
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,6 +64,7 @@ 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
|
};
|
|
@@ -143,10 +144,12 @@ function createProxyAgent(proxy, forUrl) {
|
|
|
143
144
|
proxyServer = "http://" + proxyServer;
|
|
144
145
|
const proxyOpts = import_url.default.parse(proxyServer);
|
|
145
146
|
if (proxyOpts.protocol?.startsWith("socks")) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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);
|
|
150
153
|
}
|
|
151
154
|
if (proxy.username)
|
|
152
155
|
proxyOpts.auth = `${proxy.username}:${proxy.password || ""}`;
|