2
2
3
3
const {
4
4
ArrayIsArray,
5
- Map,
6
- MapPrototypeSet,
7
5
ObjectCreate,
8
6
ObjectEntries,
9
7
ObjectFreeze,
@@ -12,6 +10,8 @@ const {
12
10
RegExpPrototypeTest,
13
11
SafeMap,
14
12
SafeSet,
13
+ StringPrototypeEndsWith,
14
+ StringPrototypeReplace,
15
15
Symbol,
16
16
uncurryThis,
17
17
} = primordials ;
@@ -334,14 +334,15 @@ class Manifest {
334
334
* @returns {string }
335
335
*/
336
336
const protocolOrResolve = ( resourceHREF ) => {
337
- if ( resourceHREF . endsWith ( ':' ) ) {
337
+ if ( StringPrototypeEndsWith ( resourceHREF , ':' ) ) {
338
338
// URL parse will trim these anyway, save the compute
339
- resourceHREF = resourceHREF . replace (
339
+ resourceHREF = StringPrototypeReplace (
340
+ resourceHREF ,
340
341
// eslint-disable-next-line
341
342
/ ^ [ \x00 - \x1F \x20 ] | \x09 \x0A \x0D | [ \x00 - \x1F \x20 ] $ / g,
342
343
''
343
344
) ;
344
- if ( / ^ [ a - z A - Z ] [ a - z A - Z + \- . ] * : $ / . test ( resourceHREF ) ) {
345
+ if ( RegExpPrototypeTest ( / ^ [ a - z A - Z ] [ a - z A - Z + \- . ] * : $ / , resourceHREF ) ) {
345
346
return resourceHREF ;
346
347
}
347
348
}
@@ -424,7 +425,7 @@ class Manifest {
424
425
// Only a few schemes are hierarchical
425
426
if ( kSpecialSchemes . has ( currentURL . protocol ) ) {
426
427
// Make first '..' act like '.'
427
- if ( currentURL . pathname . slice ( - 1 ) !== '/' ) {
428
+ if ( ! StringPrototypeEndsWith ( currentURL . pathname , '/' ) ) {
428
429
currentURL . pathname += '/' ;
429
430
}
430
431
let lastHREF ;
@@ -476,7 +477,7 @@ class Manifest {
476
477
assertIntegrity ( url , content ) {
477
478
const href = `${ url } ` ;
478
479
debug ( 'Checking integrity of %s' , href ) ;
479
- const realIntegrities = new Map ( ) ;
480
+ const realIntegrities = new SafeMap ( ) ;
480
481
const integrities = this . #resourceIntegrities;
481
482
function processEntry ( href ) {
482
483
let integrityEntries = integrities . get ( href ) ;
@@ -505,8 +506,7 @@ class Manifest {
505
506
timingSafeEqual ( digest , expected ) ) {
506
507
return true ;
507
508
}
508
- MapPrototypeSet (
509
- realIntegrities ,
509
+ realIntegrities . set (
510
510
algorithm ,
511
511
BufferToString ( digest , 'base64' )
512
512
) ;
0 commit comments