@@ -97,10 +97,9 @@ const PageLogColors = {
97
97
98
98
type PageLogColorsKey = 'error' | 'warn' | 'info' | 'log' | 'debug' | 'requestfailed'
99
99
100
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
101
100
type SessionStats = Record < string , number | Record < string , number > >
102
101
103
- export type SessionParams = {
102
+ export interface SessionParams {
104
103
/** The chromium running instance url. */
105
104
chromiumUrl : string
106
105
/** The chromium executable path. */
@@ -224,9 +223,9 @@ export class Session extends EventEmitter {
224
223
private readonly pageLogPath : string
225
224
private readonly userAgent : string
226
225
private readonly evaluateAfter : {
227
- // eslint-disable-next-line @typescript-eslint/ban-types
226
+ // eslint-disable-next-line
228
227
pageFunction : Function
229
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
228
+ // eslint-disable-next-line
230
229
args : any
231
230
} [ ]
232
231
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -392,7 +391,7 @@ export class Session extends EventEmitter {
392
391
/* this.audioRedForOpus = !!audioRedForOpus */
393
392
this . url = url
394
393
this . urlQuery = urlQuery
395
- if ( ! this . urlQuery && url . indexOf ( '?' ) !== - 1 ) {
394
+ if ( ! this . urlQuery && url . includes ( '?' ) ) {
396
395
const parts = url . split ( '?' , 2 )
397
396
this . url = parts [ 0 ]
398
397
this . urlQuery = parts [ 1 ]
@@ -492,15 +491,7 @@ export class Session extends EventEmitter {
492
491
493
492
if ( responseModifiers ) {
494
493
try {
495
- const parsed = JSON5 . parse ( responseModifiers ) as Record <
496
- string ,
497
- {
498
- search ?: string
499
- replace ?: string
500
- file ?: string
501
- headers ?: Record < string , string >
502
- } [ ]
503
- >
494
+ const parsed = JSON5 . parse ( responseModifiers )
504
495
Object . entries ( parsed ) . forEach ( ( [ url , replacements ] ) => {
505
496
if ( ! Array . isArray ( replacements ) ) {
506
497
throw new Error (
@@ -521,7 +512,7 @@ export class Session extends EventEmitter {
521
512
522
513
if ( downloadResponses ) {
523
514
try {
524
- const parsed = JSON5 . parse ( downloadResponses ) as { urlPattern : string ; output : string ; append ?: boolean } [ ]
515
+ const parsed = JSON5 . parse ( downloadResponses )
525
516
if ( ! Array . isArray ( parsed ) ) throw new Error ( `downloadResponses should be an array: ${ downloadResponses } ` )
526
517
parsed . forEach ( ( { urlPattern, output, append } ) => {
527
518
this . downloadResponses . push ( { urlPattern : getUrlPatternRegExp ( urlPattern ) , output, append } )
@@ -535,7 +526,7 @@ export class Session extends EventEmitter {
535
526
536
527
if ( cookies ) {
537
528
try {
538
- this . cookies = JSON5 . parse ( cookies ) as CookieParam [ ]
529
+ this . cookies = JSON5 . parse ( cookies )
539
530
} catch ( err ) {
540
531
log . error ( `error parsing cookies: ${ ( err as Error ) . stack } ` )
541
532
}
@@ -833,8 +824,7 @@ export class Session extends EventEmitter {
833
824
await Promise . all (
834
825
Object . keys ( this . exposedFunctions ) . map (
835
826
async ( name : string ) =>
836
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
837
- await page . exposeFunction ( name , ( ...args : any [ ] ) => this . exposedFunctions [ name ] ( ...args ) ) ,
827
+ await page . exposeFunction ( name , ( ...args : unknown [ ] ) => this . exposedFunctions [ name ] ( ...args ) ) ,
838
828
) ,
839
829
)
840
830
@@ -1275,14 +1265,12 @@ window.SERVER_USE_HTTPS = ${this.serverUseHttps};
1275
1265
try {
1276
1266
await page . evaluateOnNewDocument (
1277
1267
( css : string ) => {
1278
- // eslint-disable-next-line no-undef
1279
1268
document . addEventListener ( 'DOMContentLoaded' , ( ) => {
1280
- // eslint-disable-next-line no-undef
1281
1269
const style = document . createElement ( 'style' )
1282
1270
style . setAttribute ( 'id' , 'webrtcperf-extra-style' )
1283
1271
style . setAttribute ( 'type' , 'text/css' )
1284
1272
style . innerHTML = css
1285
- // eslint-disable-next-line no-undef
1273
+
1286
1274
document . head . appendChild ( style )
1287
1275
} )
1288
1276
} ,
@@ -1410,7 +1398,8 @@ window.SERVER_USE_HTTPS = ${this.serverUseHttps};
1410
1398
}
1411
1399
}
1412
1400
1413
- private async getNewPage ( _tabIndex : number ) : Promise < Page > {
1401
+ private async getNewPage ( tabIndex : number ) : Promise < Page > {
1402
+ log . debug ( `getNewPage ${ tabIndex } ` )
1414
1403
assert ( this . context , 'NoBrowserContextCreated' )
1415
1404
return await this . context . newPage ( )
1416
1405
}
@@ -1458,7 +1447,7 @@ window.SERVER_USE_HTTPS = ${this.serverUseHttps};
1458
1447
/**
1459
1448
* updateStats
1460
1449
*/
1461
- async updateStats ( _now : number ) : Promise < SessionStats > {
1450
+ async updateStats ( ) : Promise < SessionStats > {
1462
1451
if ( ! this . browser ) {
1463
1452
this . stats = { }
1464
1453
return this . stats
@@ -1618,7 +1607,7 @@ window.SERVER_USE_HTTPS = ${this.serverUseHttps};
1618
1607
collectedStats as RtcStats ,
1619
1608
pageIndex ,
1620
1609
trackId ,
1621
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1610
+
1622
1611
value ,
1623
1612
signalingHost ,
1624
1613
participantName ,
0 commit comments