browsertime 22.5.4 → 22.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Browsertime changelog (we do [semantic versioning](https://semver.org))
|
|
2
2
|
|
|
3
|
+
## 22.6.0 - 2024-07-15
|
|
4
|
+
### Added
|
|
5
|
+
* Updated to Firefox 128 and Edge 126 in the Docker container [#2158](https://github.com/sitespeedio/browsertime/pull/2158).
|
|
6
|
+
* Add request header using Bidi for Firefox (needs Firefox 128 or later) [#2108](https://github.com/sitespeedio/browsertime/pull/2108).
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
* Updated to Chrome HAR 0.13.5 [#2157](https://github.com/sitespeedio/browsertime/pull/2157)
|
|
10
|
+
|
|
11
|
+
## 22.5.5 - 2024-07-07
|
|
12
|
+
### Fixed
|
|
13
|
+
* Fix stopping --tcpdump [#2155](https://github.com/sitespeedio/browsertime/pull/2155).
|
|
14
|
+
|
|
3
15
|
## 22.5.4 - 2024-07-06
|
|
4
16
|
### Fixed
|
|
5
17
|
* Update to Chrome-HAR 0.13.3 [#2148](https://github.com/sitespeedio/browsertime/pull/2148).
|
|
@@ -78,6 +78,7 @@ export class FirefoxBidi {
|
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
+
|
|
81
82
|
async setBasicAuth(basicAuth) {
|
|
82
83
|
const parts = basicAuth.split('@');
|
|
83
84
|
const bidi = new Bidi(this.driver, this.options.browser);
|
|
@@ -146,4 +147,52 @@ export class FirefoxBidi {
|
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
149
|
}
|
|
150
|
+
|
|
151
|
+
async setRequestHeaders(requestHeaders) {
|
|
152
|
+
const headersArray = toArray(requestHeaders);
|
|
153
|
+
const headers = [];
|
|
154
|
+
for (let header of headersArray) {
|
|
155
|
+
if (header.indexOf && header.includes(':')) {
|
|
156
|
+
const parts = header.split(':');
|
|
157
|
+
headers.push({
|
|
158
|
+
name: parts[0],
|
|
159
|
+
value: {
|
|
160
|
+
type: 'string',
|
|
161
|
+
value: parts[1]
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
} else {
|
|
165
|
+
log.error(
|
|
166
|
+
'Request headers need to be of the format key:value not ' + header
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const command = {
|
|
172
|
+
method: 'network.addIntercept',
|
|
173
|
+
params: {
|
|
174
|
+
phases: ['beforeRequestSent']
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const bidi = new Bidi(this.driver, this.options.browser);
|
|
178
|
+
|
|
179
|
+
await bidi.send(command);
|
|
180
|
+
await bidi.subscribe('network.beforeRequestSent');
|
|
181
|
+
await bidi.onMessage(async function (event) {
|
|
182
|
+
const parsedEvent = JSON.parse(Buffer.from(event.toString()));
|
|
183
|
+
if (parsedEvent.method === 'network.beforeRequestSent') {
|
|
184
|
+
const continueRequest = {
|
|
185
|
+
method: 'network.continueRequest',
|
|
186
|
+
params: {
|
|
187
|
+
request: parsedEvent.params.request.request,
|
|
188
|
+
headers: [...parsedEvent.params.request.headers, ...headers]
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const result = await bidi.send(continueRequest);
|
|
192
|
+
if (result.type != 'success') {
|
|
193
|
+
log.error(result);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
149
198
|
}
|
|
@@ -102,22 +102,25 @@ export class Firefox {
|
|
|
102
102
|
await this.browsertimeBidi.setBasicAuth(this.options.basicAuth);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
if (this.options.
|
|
106
|
-
await this.browsertimeBidi.
|
|
107
|
-
|
|
105
|
+
if (this.options.requestheader) {
|
|
106
|
+
await this.browsertimeBidi.setRequestHeaders(this.options.requestheader);
|
|
107
|
+
if (this.options.block) {
|
|
108
|
+
await this.browsertimeBidi.blockUrls(this.options.block);
|
|
109
|
+
}
|
|
108
110
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
if (
|
|
112
|
+
this.firefoxConfig.appendToUserAgent ||
|
|
113
|
+
this.options.appendToUserAgent
|
|
114
|
+
) {
|
|
115
|
+
const currentUserAgent = await runner.runScript(
|
|
116
|
+
'return navigator.userAgent;',
|
|
117
|
+
'GET_USER_AGENT'
|
|
118
|
+
);
|
|
119
|
+
let script = `Services.prefs.setStringPref('general.useragent.override', '${currentUserAgent} ${
|
|
120
|
+
this.firefoxConfig.appendToUserAgent || this.options.appendToUserAgent
|
|
121
|
+
}');`;
|
|
122
|
+
return runner.runPrivilegedScript(script, 'SET_USER_AGENT');
|
|
123
|
+
}
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
126
|
|
package/lib/support/tcpdump.js
CHANGED
|
@@ -32,7 +32,10 @@ export class TCPDump {
|
|
|
32
32
|
this.tcpdumpProcess = execa('sudo', parameters);
|
|
33
33
|
}
|
|
34
34
|
async stop() {
|
|
35
|
-
|
|
35
|
+
if (this.tcpdumpProcess) {
|
|
36
|
+
await this.tcpdumpProcess.kill('SIGINT');
|
|
37
|
+
this.tcpdumpProcess = undefined;
|
|
38
|
+
}
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
async mv(url, iteration) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browsertime",
|
|
3
3
|
"description": "Get performance metrics from your web page using Browsertime.",
|
|
4
|
-
"version": "22.
|
|
4
|
+
"version": "22.6.0",
|
|
5
5
|
"bin": "./bin/browsertime.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./types/scripting.d.ts",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"@sitespeed.io/throttle": "5.0.0",
|
|
15
15
|
"@sitespeed.io/tracium": "0.3.3",
|
|
16
16
|
"btoa": "1.2.1",
|
|
17
|
-
"chrome-har": "0.13.
|
|
17
|
+
"chrome-har": "0.13.5",
|
|
18
18
|
"chrome-remote-interface": "0.33.2",
|
|
19
19
|
"dayjs": "1.11.11",
|
|
20
20
|
"execa": "9.3.0",
|
|
@@ -4,9 +4,7 @@ export class TCPDump {
|
|
|
4
4
|
options: any;
|
|
5
5
|
start(iteration: any): Promise<void>;
|
|
6
6
|
tcpdumpProcess: import("execa").ResultPromise<{}>;
|
|
7
|
-
stop(): Promise<
|
|
8
|
-
reject: false;
|
|
9
|
-
}>>;
|
|
7
|
+
stop(): Promise<void>;
|
|
10
8
|
mv(url: any, iteration: any): Promise<void>;
|
|
11
9
|
}
|
|
12
10
|
//# sourceMappingURL=tcpdump.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tcpdump.d.ts","sourceRoot":"","sources":["../../lib/support/tcpdump.js"],"names":[],"mappings":"AAKA;IACE,0CAGC;IAFC,aAAwB;IACxB,aAAsB;IAExB,qCAsBC;IADC,kDAA+C;IAEjD
|
|
1
|
+
{"version":3,"file":"tcpdump.d.ts","sourceRoot":"","sources":["../../lib/support/tcpdump.js"],"names":[],"mappings":"AAKA;IACE,0CAGC;IAFC,aAAwB;IACxB,aAAsB;IAExB,qCAsBC;IADC,kDAA+C;IAEjD,sBAKC;IAED,4CAQC;CACF"}
|