Skip to content

Commit

Permalink
fixup! lib,src: replace toUSVString with toWellFormed()
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Nov 24, 2023
1 parent db1c688 commit f69ddee
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/internal/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class File extends Blob {
lastModified = DateNow();
}

this.#name = StringPrototypeToWellFormed(fileName);
this.#name = StringPrototypeToWellFormed(`${fileName}`);
this.#lastModified = lastModified;
}

Expand Down
32 changes: 16 additions & 16 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ class URLSearchParams {
// Append (innerSequence[0], innerSequence[1]) to querys list.
ArrayPrototypePush(
this.#searchParams,
StringPrototypeToWellFormed(pair[0]),
StringPrototypeToWellFormed(pair[1]),
StringPrototypeToWellFormed(`${pair[0]}`),
StringPrototypeToWellFormed(`${pair[1]}`),
);
} else {
if (((typeof pair !== 'object' && typeof pair !== 'function') ||
Expand All @@ -381,7 +381,7 @@ class URLSearchParams {

for (const element of pair) {
length++;
ArrayPrototypePush(this.#searchParams, StringPrototypeToWellFormed(element));
ArrayPrototypePush(this.#searchParams, StringPrototypeToWellFormed(`${element}`));
}

// If innerSequence's size is not 2, then throw a TypeError.
Expand All @@ -400,7 +400,7 @@ class URLSearchParams {
const desc = ReflectGetOwnPropertyDescriptor(init, key);
if (desc !== undefined && desc.enumerable) {
const typedKey = StringPrototypeToWellFormed(key);
const typedValue = StringPrototypeToWellFormed(init[key]);
const typedValue = StringPrototypeToWellFormed(`${init[key]}`);

// Two different keys may become the same USVString after normalization.
// In that case, we retain the later one. Refer to WPT.
Expand All @@ -417,7 +417,7 @@ class URLSearchParams {
}
} else {
// https://url.spec.whatwg.org/#dom-urlsearchparams-urlsearchparams
init = StringPrototypeToWellFormed(init);
init = StringPrototypeToWellFormed(`${init}`);
this.#searchParams = init ? parseParams(init) : [];
}
}
Expand Down Expand Up @@ -472,8 +472,8 @@ class URLSearchParams {
throw new ERR_MISSING_ARGS('name', 'value');
}

name = StringPrototypeToWellFormed(name);
value = StringPrototypeToWellFormed(value);
name = StringPrototypeToWellFormed(`${name}`);
value = StringPrototypeToWellFormed(`${value}`);
ArrayPrototypePush(this.#searchParams, name, value);
if (this.#context) {
this.#context.search = this.toString();
Expand All @@ -489,10 +489,10 @@ class URLSearchParams {
}

const list = this.#searchParams;
name = StringPrototypeToWellFormed(name);
name = StringPrototypeToWellFormed(`${name}`);

if (value !== undefined) {
value = StringPrototypeToWellFormed(value);
value = StringPrototypeToWellFormed(`${value}`);
for (let i = 0; i < list.length;) {
if (list[i] === name && list[i + 1] === value) {
list.splice(i, 2);
Expand Down Expand Up @@ -523,7 +523,7 @@ class URLSearchParams {
}

const list = this.#searchParams;
name = StringPrototypeToWellFormed(name);
name = StringPrototypeToWellFormed(`${name}`);
for (let i = 0; i < list.length; i += 2) {
if (list[i] === name) {
return list[i + 1];
Expand All @@ -542,7 +542,7 @@ class URLSearchParams {

const list = this.#searchParams;
const values = [];
name = StringPrototypeToWellFormed(name);
name = StringPrototypeToWellFormed(`${name}`);
for (let i = 0; i < list.length; i += 2) {
if (list[i] === name) {
values.push(list[i + 1]);
Expand All @@ -560,10 +560,10 @@ class URLSearchParams {
}

const list = this.#searchParams;
name = StringPrototypeToWellFormed(name);
name = StringPrototypeToWellFormed(`${name}`);

if (value !== undefined) {
value = StringPrototypeToWellFormed(value);
value = StringPrototypeToWellFormed(`${value}`);
}

for (let i = 0; i < list.length; i += 2) {
Expand All @@ -586,8 +586,8 @@ class URLSearchParams {
}

const list = this.#searchParams;
name = StringPrototypeToWellFormed(name);
value = StringPrototypeToWellFormed(value);
name = StringPrototypeToWellFormed(`${name}`);
value = StringPrototypeToWellFormed(`${value}`);

// If there are any name-value pairs whose name is `name`, in `list`, set
// the value of the first such name-value pair to `value` and remove the
Expand Down Expand Up @@ -1010,7 +1010,7 @@ class URL {
}

set search(value) {
const href = bindingUrl.update(this.#context.href, updateActions.kSearch, StringPrototypeToWellFormed(value));
const href = bindingUrl.update(this.#context.href, updateActions.kSearch, StringPrototypeToWellFormed(`${value}`));
if (href) {
this.#updateContext(href);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ module.exports = {
promisify,
stripVTControlCharacters,
toUSVString(input) {
return StringPrototypeToWellFormed(input);
return StringPrototypeToWellFormed(`${input}`);
},
get transferableAbortSignal() {
return lazyAbortController().transferableAbortSignal;
Expand Down

0 comments on commit f69ddee

Please sign in to comment.