22
33const {
44 ArrayIsArray,
5- Map,
6- MapPrototypeSet,
75 ObjectCreate,
86 ObjectEntries,
97 ObjectFreeze,
@@ -12,6 +10,8 @@ const {
1210 RegExpPrototypeTest,
1311 SafeMap,
1412 SafeSet,
13+ StringPrototypeEndsWith,
14+ StringPrototypeReplace,
1515 Symbol,
1616 uncurryThis,
1717} = primordials ;
@@ -334,14 +334,15 @@ class Manifest {
334334 * @returns {string }
335335 */
336336 const protocolOrResolve = ( resourceHREF ) => {
337- if ( resourceHREF . endsWith ( ':' ) ) {
337+ if ( StringPrototypeEndsWith ( resourceHREF , ':' ) ) {
338338 // URL parse will trim these anyway, save the compute
339- resourceHREF = resourceHREF . replace (
339+ resourceHREF = StringPrototypeReplace (
340+ resourceHREF ,
340341 // eslint-disable-next-line
341342 / ^ [ \x00 - \x1F \x20 ] | \x09 \x0A \x0D | [ \x00 - \x1F \x20 ] $ / g,
342343 ''
343344 ) ;
344- if ( / ^ [ a - z A - Z ] [ a - z A - Z + \- . ] * : $ / . test ( resourceHREF ) ) {
345+ if ( RegExpPrototypeTest ( / ^ [ a - z A - Z ] [ a - z A - Z + \- . ] * : $ / , resourceHREF ) ) {
345346 return resourceHREF ;
346347 }
347348 }
@@ -424,7 +425,7 @@ class Manifest {
424425 // Only a few schemes are hierarchical
425426 if ( kSpecialSchemes . has ( currentURL . protocol ) ) {
426427 // Make first '..' act like '.'
427- if ( currentURL . pathname . slice ( - 1 ) !== '/' ) {
428+ if ( ! StringPrototypeEndsWith ( currentURL . pathname , '/' ) ) {
428429 currentURL . pathname += '/' ;
429430 }
430431 let lastHREF ;
@@ -476,7 +477,7 @@ class Manifest {
476477 assertIntegrity ( url , content ) {
477478 const href = `${ url } ` ;
478479 debug ( 'Checking integrity of %s' , href ) ;
479- const realIntegrities = new Map ( ) ;
480+ const realIntegrities = new SafeMap ( ) ;
480481 const integrities = this . #resourceIntegrities;
481482 function processEntry ( href ) {
482483 let integrityEntries = integrities . get ( href ) ;
@@ -505,8 +506,7 @@ class Manifest {
505506 timingSafeEqual ( digest , expected ) ) {
506507 return true ;
507508 }
508- MapPrototypeSet (
509- realIntegrities ,
509+ realIntegrities . set (
510510 algorithm ,
511511 BufferToString ( digest , 'base64' )
512512 ) ;
0 commit comments