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 ;
@@ -328,14 +328,15 @@ class Manifest {
328
328
* @returns {string }
329
329
*/
330
330
const protocolOrResolve = ( resourceHREF ) => {
331
- if ( resourceHREF . endsWith ( ':' ) ) {
331
+ if ( StringPrototypeEndsWith ( resourceHREF , ':' ) ) {
332
332
// URL parse will trim these anyway, save the compute
333
- resourceHREF = resourceHREF . replace (
333
+ resourceHREF = StringPrototypeReplace (
334
+ resourceHREF ,
334
335
// eslint-disable-next-line
335
336
/ ^ [ \x00 - \x1F \x20 ] | \x09 \x0A \x0D | [ \x00 - \x1F \x20 ] $ / g,
336
337
''
337
338
) ;
338
- if ( / ^ [ a - z A - Z ] [ a - z A - Z + \- . ] * : $ / . test ( resourceHREF ) ) {
339
+ if ( RegExpPrototypeTest ( / ^ [ a - z A - Z ] [ a - z A - Z + \- . ] * : $ / , resourceHREF ) ) {
339
340
return resourceHREF ;
340
341
}
341
342
}
@@ -418,7 +419,7 @@ class Manifest {
418
419
// Only a few schemes are hierarchical
419
420
if ( SPECIAL_SCHEMES . has ( currentURL . protocol ) ) {
420
421
// Make first '..' act like '.'
421
- if ( currentURL . pathname . slice ( - 1 ) !== '/' ) {
422
+ if ( ! StringPrototypeEndsWith ( currentURL . pathname , '/' ) ) {
422
423
currentURL . pathname += '/' ;
423
424
}
424
425
let lastHREF ;
@@ -470,7 +471,7 @@ class Manifest {
470
471
assertIntegrity ( url , content ) {
471
472
const href = `${ url } ` ;
472
473
debug ( 'Checking integrity of %s' , href ) ;
473
- const realIntegrities = new Map ( ) ;
474
+ const realIntegrities = new SafeMap ( ) ;
474
475
const integrities = this . #resourceIntegrities;
475
476
function processEntry ( href ) {
476
477
let integrityEntries = integrities . get ( href ) ;
@@ -499,8 +500,7 @@ class Manifest {
499
500
timingSafeEqual ( digest , expected ) ) {
500
501
return true ;
501
502
}
502
- MapPrototypeSet (
503
- realIntegrities ,
503
+ realIntegrities . set (
504
504
algorithm ,
505
505
BufferToString ( digest , 'base64' )
506
506
) ;
0 commit comments