@@ -43,7 +43,6 @@ const {
4343const {
4444 getConstructorOf,
4545 removeColors,
46- toUSVString,
4746 kEnumerableProperty,
4847 SideEffectFreeRegExpPrototypeSymbolReplace,
4948} = require ( 'internal/util' ) ;
@@ -181,7 +180,7 @@ class URLSearchParams {
181180 }
182181 const convertedPair = [ ] ;
183182 for ( const element of pair )
184- ArrayPrototypePush ( convertedPair , toUSVString ( element ) ) ;
183+ ArrayPrototypePush ( convertedPair , ` ${ element } ` . toWellFormed ( ) ) ;
185184 ArrayPrototypePush ( pairs , convertedPair ) ;
186185 }
187186
@@ -202,10 +201,10 @@ class URLSearchParams {
202201 const key = keys [ i ] ;
203202 const desc = ReflectGetOwnPropertyDescriptor ( init , key ) ;
204203 if ( desc !== undefined && desc . enumerable ) {
205- const typedKey = toUSVString ( key ) ;
206- const typedValue = toUSVString ( init [ key ] ) ;
204+ const typedKey = ` ${ key } ` . toWellFormed ( ) ;
205+ const typedValue = ` ${ init [ key ] } ` . toWellFormed ( ) ;
207206
208- // Two different key may result same after `toUSVString() `, we only
207+ // Two different key may result same after `String.prototype.toWellFormed `, we only
209208 // leave the later one. Refers to WPT.
210209 if ( visited [ typedKey ] !== undefined ) {
211210 this [ searchParams ] [ visited [ typedKey ] ] = typedValue ;
@@ -219,7 +218,7 @@ class URLSearchParams {
219218 }
220219 } else {
221220 // USVString
222- init = toUSVString ( init ) ;
221+ init = ` ${ init } ` . toWellFormed ( ) ;
223222 this [ searchParams ] = init ? parseParams ( init ) : [ ] ;
224223 }
225224
@@ -277,8 +276,8 @@ class URLSearchParams {
277276 throw new ERR_MISSING_ARGS ( 'name' , 'value' ) ;
278277 }
279278
280- name = toUSVString ( name ) ;
281- value = toUSVString ( value ) ;
279+ name = ` ${ name } ` . toWellFormed ( ) ;
280+ value = ` ${ value } ` . toWellFormed ( ) ;
282281 ArrayPrototypePush ( this [ searchParams ] , name , value ) ;
283282 if ( this [ context ] ) {
284283 this [ context ] . search = this . toString ( ) ;
@@ -294,7 +293,7 @@ class URLSearchParams {
294293 }
295294
296295 const list = this [ searchParams ] ;
297- name = toUSVString ( name ) ;
296+ name = ` ${ name } ` . toWellFormed ( ) ;
298297 for ( let i = 0 ; i < list . length ; ) {
299298 const cur = list [ i ] ;
300299 if ( cur === name ) {
@@ -317,7 +316,7 @@ class URLSearchParams {
317316 }
318317
319318 const list = this [ searchParams ] ;
320- name = toUSVString ( name ) ;
319+ name = ` ${ name } ` . toWellFormed ( ) ;
321320 for ( let i = 0 ; i < list . length ; i += 2 ) {
322321 if ( list [ i ] === name ) {
323322 return list [ i + 1 ] ;
@@ -336,7 +335,7 @@ class URLSearchParams {
336335
337336 const list = this [ searchParams ] ;
338337 const values = [ ] ;
339- name = toUSVString ( name ) ;
338+ name = ` ${ name } ` . toWellFormed ( ) ;
340339 for ( let i = 0 ; i < list . length ; i += 2 ) {
341340 if ( list [ i ] === name ) {
342341 values . push ( list [ i + 1 ] ) ;
@@ -354,7 +353,7 @@ class URLSearchParams {
354353 }
355354
356355 const list = this [ searchParams ] ;
357- name = toUSVString ( name ) ;
356+ name = ` ${ name } ` . toWellFormed ( ) ;
358357 for ( let i = 0 ; i < list . length ; i += 2 ) {
359358 if ( list [ i ] === name ) {
360359 return true ;
@@ -372,8 +371,8 @@ class URLSearchParams {
372371 }
373372
374373 const list = this [ searchParams ] ;
375- name = toUSVString ( name ) ;
376- value = toUSVString ( value ) ;
374+ name = ` ${ name } ` . toWellFormed ( ) ;
375+ value = ` ${ value } ` . toWellFormed ( ) ;
377376
378377 // If there are any name-value pairs whose name is `name`, in `list`, set
379378 // the value of the first such name-value pair to `value` and remove the
@@ -549,7 +548,7 @@ class URL {
549548 #searchParams;
550549
551550 constructor ( input , base = undefined ) {
552- // toUSVString is not needed.
551+ // String.prototype.toWellFormed is not needed.
553552 input = `${ input } ` ;
554553
555554 if ( base !== undefined ) {
@@ -690,7 +689,7 @@ class URL {
690689 }
691690
692691 set search ( value ) {
693- updateUrl ( this . #context. href , updateActions . kSearch , toUSVString ( value ) , this . #onParseComplete) ;
692+ updateUrl ( this . #context. href , updateActions . kSearch , ` ${ value } ` . toWellFormed ( ) , this . #onParseComplete) ;
694693 }
695694
696695 // readonly
@@ -1106,15 +1105,15 @@ function domainToASCII(domain) {
11061105 if ( arguments . length < 1 )
11071106 throw new ERR_MISSING_ARGS ( 'domain' ) ;
11081107
1109- // toUSVString is not needed.
1108+ // String.prototype.toWellFormed is not needed.
11101109 return _domainToASCII ( `${ domain } ` ) ;
11111110}
11121111
11131112function domainToUnicode ( domain ) {
11141113 if ( arguments . length < 1 )
11151114 throw new ERR_MISSING_ARGS ( 'domain' ) ;
11161115
1117- // toUSVString is not needed.
1116+ // String.prototype.toWellFormed is not needed.
11181117 return _domainToUnicode ( `${ domain } ` ) ;
11191118}
11201119
@@ -1287,7 +1286,6 @@ function toPathIfFileURL(fileURLOrPath) {
12871286}
12881287
12891288module . exports = {
1290- toUSVString,
12911289 fileURLToPath,
12921290 pathToFileURL,
12931291 toPathIfFileURL,
0 commit comments