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 ;
@@ -328,14 +328,15 @@ class Manifest {
328328 * @returns {string }
329329 */
330330 const protocolOrResolve = ( resourceHREF ) => {
331- if ( resourceHREF . endsWith ( ':' ) ) {
331+ if ( StringPrototypeEndsWith ( resourceHREF , ':' ) ) {
332332 // URL parse will trim these anyway, save the compute
333- resourceHREF = resourceHREF . replace (
333+ resourceHREF = StringPrototypeReplace (
334+ resourceHREF ,
334335 // eslint-disable-next-line
335336 / ^ [ \x00 - \x1F \x20 ] | \x09 \x0A \x0D | [ \x00 - \x1F \x20 ] $ / g,
336337 ''
337338 ) ;
338- if ( / ^ [ a - z A - Z ] [ a - z A - Z + \- . ] * : $ / . test ( resourceHREF ) ) {
339+ if ( RegExpPrototypeTest ( / ^ [ a - z A - Z ] [ a - z A - Z + \- . ] * : $ / , resourceHREF ) ) {
339340 return resourceHREF ;
340341 }
341342 }
@@ -418,7 +419,7 @@ class Manifest {
418419 // Only a few schemes are hierarchical
419420 if ( SPECIAL_SCHEMES . has ( currentURL . protocol ) ) {
420421 // Make first '..' act like '.'
421- if ( currentURL . pathname . slice ( - 1 ) !== '/' ) {
422+ if ( ! StringPrototypeEndsWith ( currentURL . pathname , '/' ) ) {
422423 currentURL . pathname += '/' ;
423424 }
424425 let lastHREF ;
@@ -470,7 +471,7 @@ class Manifest {
470471 assertIntegrity ( url , content ) {
471472 const href = `${ url } ` ;
472473 debug ( 'Checking integrity of %s' , href ) ;
473- const realIntegrities = new Map ( ) ;
474+ const realIntegrities = new SafeMap ( ) ;
474475 const integrities = this . #resourceIntegrities;
475476 function processEntry ( href ) {
476477 let integrityEntries = integrities . get ( href ) ;
@@ -499,8 +500,7 @@ class Manifest {
499500 timingSafeEqual ( digest , expected ) ) {
500501 return true ;
501502 }
502- MapPrototypeSet (
503- realIntegrities ,
503+ realIntegrities . set (
504504 algorithm ,
505505 BufferToString ( digest , 'base64' )
506506 ) ;
0 commit comments