@vpalmisano/webrtcperf 4.0.4 → 4.0.6
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/app.min.js +1 -1
- package/build/src/session.js +42 -42
- package/build/src/session.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/session.ts +42 -42
package/build/src/session.js
CHANGED
|
@@ -192,7 +192,7 @@ class Session extends events_1.default {
|
|
|
192
192
|
this.chromiumPath = chromiumPath || undefined;
|
|
193
193
|
this.chromiumFieldTrials = chromiumFieldTrials || undefined;
|
|
194
194
|
this.windowWidth = windowWidth || 1920;
|
|
195
|
-
this.windowHeight = windowHeight || 1080;
|
|
195
|
+
this.windowHeight = (windowHeight || 1080) + 140; // Include info bars.
|
|
196
196
|
this.deviceScaleFactor = deviceScaleFactor || 1;
|
|
197
197
|
this.debuggingPort = debuggingPort || 0;
|
|
198
198
|
this.debuggingAddress = debuggingAddress || '';
|
|
@@ -664,47 +664,6 @@ webrtcperf.config.AUDIO_URL = "http${this.serverUseHttps ? 's' : ''}://localhost
|
|
|
664
664
|
log.error(`clearCookies error: ${err.stack}`);
|
|
665
665
|
}
|
|
666
666
|
}
|
|
667
|
-
// Load page script.
|
|
668
|
-
{
|
|
669
|
-
const filePath = (0, utils_1.resolvePackagePath)('node_modules/@vpalmisano/webrtcperf-js/dist/webrtcperf.js');
|
|
670
|
-
if (!fs_1.default.existsSync(filePath)) {
|
|
671
|
-
throw new Error(`@vpalmisano/webrtcperf-js script not found: ${filePath}`);
|
|
672
|
-
}
|
|
673
|
-
log.debug(`loading @vpalmisano/webrtcperf-js script from: ${filePath}`);
|
|
674
|
-
await page.evaluateOnNewDocument(fs_1.default.readFileSync(filePath, 'utf8'));
|
|
675
|
-
}
|
|
676
|
-
// Execute external script(s).
|
|
677
|
-
if (this.scriptPath) {
|
|
678
|
-
if (this.scriptPath.startsWith('base64:gzip:')) {
|
|
679
|
-
const data = Buffer.from(this.scriptPath.replace('base64:gzip:', ''), 'base64');
|
|
680
|
-
const code = (0, zlib_1.gunzipSync)(data).toString();
|
|
681
|
-
log.debug(`loading script from ${code.length} bytes`);
|
|
682
|
-
await page.evaluateOnNewDocument(code);
|
|
683
|
-
}
|
|
684
|
-
else {
|
|
685
|
-
for (const filePath of this.scriptPath.split(',')) {
|
|
686
|
-
if (!filePath.trim()) {
|
|
687
|
-
continue;
|
|
688
|
-
}
|
|
689
|
-
if (filePath.startsWith('http')) {
|
|
690
|
-
log.debug(`loading custom script from url: ${filePath}`);
|
|
691
|
-
const res = await (0, utils_1.downloadUrl)(filePath);
|
|
692
|
-
if (!res?.data) {
|
|
693
|
-
throw new Error(`Failed to download script from: ${filePath}`);
|
|
694
|
-
}
|
|
695
|
-
await page.evaluateOnNewDocument(res.data);
|
|
696
|
-
}
|
|
697
|
-
else {
|
|
698
|
-
if (!fs_1.default.existsSync(filePath)) {
|
|
699
|
-
log.warn(`custom script not found: ${filePath}`);
|
|
700
|
-
continue;
|
|
701
|
-
}
|
|
702
|
-
log.debug(`loading custom script from file: ${filePath}`);
|
|
703
|
-
await page.evaluateOnNewDocument(fs_1.default.readFileSync(filePath, 'utf8'));
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
667
|
page.on('dialog', async (dialog) => {
|
|
709
668
|
log.debug(`page ${index + 1} dialog ${dialog.type()}: ${dialog.message()}`);
|
|
710
669
|
try {
|
|
@@ -1126,6 +1085,47 @@ webrtcperf.config.AUDIO_URL = "http${this.serverUseHttps ? 's' : ''}://localhost
|
|
|
1126
1085
|
const plugin = NavigatorHardwareConcurrency({ hardwareConcurrency: this.hardwareConcurrency });
|
|
1127
1086
|
await plugin.onPageCreated(page);
|
|
1128
1087
|
}
|
|
1088
|
+
// Load page script.
|
|
1089
|
+
{
|
|
1090
|
+
const filePath = (0, utils_1.resolvePackagePath)('node_modules/@vpalmisano/webrtcperf-js/dist/webrtcperf.js');
|
|
1091
|
+
if (!fs_1.default.existsSync(filePath)) {
|
|
1092
|
+
throw new Error(`@vpalmisano/webrtcperf-js script not found: ${filePath}`);
|
|
1093
|
+
}
|
|
1094
|
+
log.debug(`loading @vpalmisano/webrtcperf-js script from: ${filePath}`);
|
|
1095
|
+
await page.evaluateOnNewDocument(fs_1.default.readFileSync(filePath, 'utf8'));
|
|
1096
|
+
}
|
|
1097
|
+
// Execute external script(s).
|
|
1098
|
+
if (this.scriptPath) {
|
|
1099
|
+
if (this.scriptPath.startsWith('base64:gzip:')) {
|
|
1100
|
+
const data = Buffer.from(this.scriptPath.replace('base64:gzip:', ''), 'base64');
|
|
1101
|
+
const code = (0, zlib_1.gunzipSync)(data).toString();
|
|
1102
|
+
log.debug(`loading script from ${code.length} bytes`);
|
|
1103
|
+
await page.evaluateOnNewDocument(code);
|
|
1104
|
+
}
|
|
1105
|
+
else {
|
|
1106
|
+
for (const filePath of this.scriptPath.split(',')) {
|
|
1107
|
+
if (!filePath.trim()) {
|
|
1108
|
+
continue;
|
|
1109
|
+
}
|
|
1110
|
+
if (filePath.startsWith('http')) {
|
|
1111
|
+
log.debug(`loading custom script from url: ${filePath}`);
|
|
1112
|
+
const res = await (0, utils_1.downloadUrl)(filePath);
|
|
1113
|
+
if (!res?.data) {
|
|
1114
|
+
throw new Error(`Failed to download script from: ${filePath}`);
|
|
1115
|
+
}
|
|
1116
|
+
await page.evaluateOnNewDocument(res.data);
|
|
1117
|
+
}
|
|
1118
|
+
else {
|
|
1119
|
+
if (!fs_1.default.existsSync(filePath)) {
|
|
1120
|
+
log.warn(`custom script not found: ${filePath}`);
|
|
1121
|
+
continue;
|
|
1122
|
+
}
|
|
1123
|
+
log.debug(`loading custom script from file: ${filePath}`);
|
|
1124
|
+
await page.evaluateOnNewDocument(fs_1.default.readFileSync(filePath, 'utf8'));
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
1129
|
log.debug(`Page ${index + 1} "${url}" loading`);
|
|
1130
1130
|
const pageLoadTime = Date.now();
|
|
1131
1131
|
// open the page url
|