@@ -43,7 +43,6 @@ const {
43
43
const {
44
44
getConstructorOf,
45
45
removeColors,
46
- toUSVString,
47
46
kEnumerableProperty,
48
47
SideEffectFreeRegExpPrototypeSymbolReplace,
49
48
} = require ( 'internal/util' ) ;
@@ -181,7 +180,7 @@ class URLSearchParams {
181
180
}
182
181
const convertedPair = [ ] ;
183
182
for ( const element of pair )
184
- ArrayPrototypePush ( convertedPair , toUSVString ( element ) ) ;
183
+ ArrayPrototypePush ( convertedPair , ` ${ element } ` . toWellFormed ( ) ) ;
185
184
ArrayPrototypePush ( pairs , convertedPair ) ;
186
185
}
187
186
@@ -202,10 +201,10 @@ class URLSearchParams {
202
201
const key = keys [ i ] ;
203
202
const desc = ReflectGetOwnPropertyDescriptor ( init , key ) ;
204
203
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 ( ) ;
207
206
208
- // Two different key may result same after `toUSVString() `, we only
207
+ // Two different key may result same after `String.prototype.toWellFormed `, we only
209
208
// leave the later one. Refers to WPT.
210
209
if ( visited [ typedKey ] !== undefined ) {
211
210
this [ searchParams ] [ visited [ typedKey ] ] = typedValue ;
@@ -219,7 +218,7 @@ class URLSearchParams {
219
218
}
220
219
} else {
221
220
// USVString
222
- init = toUSVString ( init ) ;
221
+ init = ` ${ init } ` . toWellFormed ( ) ;
223
222
this [ searchParams ] = init ? parseParams ( init ) : [ ] ;
224
223
}
225
224
@@ -277,8 +276,8 @@ class URLSearchParams {
277
276
throw new ERR_MISSING_ARGS ( 'name' , 'value' ) ;
278
277
}
279
278
280
- name = toUSVString ( name ) ;
281
- value = toUSVString ( value ) ;
279
+ name = ` ${ name } ` . toWellFormed ( ) ;
280
+ value = ` ${ value } ` . toWellFormed ( ) ;
282
281
ArrayPrototypePush ( this [ searchParams ] , name , value ) ;
283
282
if ( this [ context ] ) {
284
283
this [ context ] . search = this . toString ( ) ;
@@ -294,7 +293,7 @@ class URLSearchParams {
294
293
}
295
294
296
295
const list = this [ searchParams ] ;
297
- name = toUSVString ( name ) ;
296
+ name = ` ${ name } ` . toWellFormed ( ) ;
298
297
for ( let i = 0 ; i < list . length ; ) {
299
298
const cur = list [ i ] ;
300
299
if ( cur === name ) {
@@ -317,7 +316,7 @@ class URLSearchParams {
317
316
}
318
317
319
318
const list = this [ searchParams ] ;
320
- name = toUSVString ( name ) ;
319
+ name = ` ${ name } ` . toWellFormed ( ) ;
321
320
for ( let i = 0 ; i < list . length ; i += 2 ) {
322
321
if ( list [ i ] === name ) {
323
322
return list [ i + 1 ] ;
@@ -336,7 +335,7 @@ class URLSearchParams {
336
335
337
336
const list = this [ searchParams ] ;
338
337
const values = [ ] ;
339
- name = toUSVString ( name ) ;
338
+ name = ` ${ name } ` . toWellFormed ( ) ;
340
339
for ( let i = 0 ; i < list . length ; i += 2 ) {
341
340
if ( list [ i ] === name ) {
342
341
values . push ( list [ i + 1 ] ) ;
@@ -354,7 +353,7 @@ class URLSearchParams {
354
353
}
355
354
356
355
const list = this [ searchParams ] ;
357
- name = toUSVString ( name ) ;
356
+ name = ` ${ name } ` . toWellFormed ( ) ;
358
357
for ( let i = 0 ; i < list . length ; i += 2 ) {
359
358
if ( list [ i ] === name ) {
360
359
return true ;
@@ -372,8 +371,8 @@ class URLSearchParams {
372
371
}
373
372
374
373
const list = this [ searchParams ] ;
375
- name = toUSVString ( name ) ;
376
- value = toUSVString ( value ) ;
374
+ name = ` ${ name } ` . toWellFormed ( ) ;
375
+ value = ` ${ value } ` . toWellFormed ( ) ;
377
376
378
377
// If there are any name-value pairs whose name is `name`, in `list`, set
379
378
// the value of the first such name-value pair to `value` and remove the
@@ -549,7 +548,7 @@ class URL {
549
548
#searchParams;
550
549
551
550
constructor ( input , base = undefined ) {
552
- // toUSVString is not needed.
551
+ // String.prototype.toWellFormed is not needed.
553
552
input = `${ input } ` ;
554
553
555
554
if ( base !== undefined ) {
@@ -690,7 +689,7 @@ class URL {
690
689
}
691
690
692
691
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) ;
694
693
}
695
694
696
695
// readonly
@@ -1106,15 +1105,15 @@ function domainToASCII(domain) {
1106
1105
if ( arguments . length < 1 )
1107
1106
throw new ERR_MISSING_ARGS ( 'domain' ) ;
1108
1107
1109
- // toUSVString is not needed.
1108
+ // String.prototype.toWellFormed is not needed.
1110
1109
return _domainToASCII ( `${ domain } ` ) ;
1111
1110
}
1112
1111
1113
1112
function domainToUnicode ( domain ) {
1114
1113
if ( arguments . length < 1 )
1115
1114
throw new ERR_MISSING_ARGS ( 'domain' ) ;
1116
1115
1117
- // toUSVString is not needed.
1116
+ // String.prototype.toWellFormed is not needed.
1118
1117
return _domainToUnicode ( `${ domain } ` ) ;
1119
1118
}
1120
1119
@@ -1287,7 +1286,6 @@ function toPathIfFileURL(fileURLOrPath) {
1287
1286
}
1288
1287
1289
1288
module . exports = {
1290
- toUSVString,
1291
1289
fileURLToPath,
1292
1290
pathToFileURL,
1293
1291
toPathIfFileURL,
0 commit comments