summaryrefslogtreecommitdiff
path: root/ext/fetch/23_request.js
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@gmail.com>2021-09-23 11:40:58 +0200
committerGitHub <noreply@github.com>2021-09-23 11:40:58 +0200
commite0c858fa27af07f163f5d18bb0401d0f0069dd3c (patch)
tree7ffe8fa9522b077579b4a321f1cd02f5f9696921 /ext/fetch/23_request.js
parent830586d242216e64fcd16e65cc83db9d54d63dc0 (diff)
perf(ext/fetch): skip USVString webidl conv on string constructor (#12168)
* perf(ext/fetch): skip USVString webidl conv on string constructor * Rename webidl convert to RequestInfo_DOMString To disambiguate and hint that it normalizes to DOMString instead of USVString since DOMString => USVString is handled by `op_url_parse` when calling `new URL(...)`
Diffstat (limited to 'ext/fetch/23_request.js')
-rw-r--r--ext/fetch/23_request.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/fetch/23_request.js b/ext/fetch/23_request.js
index 36c63db2a..51ea9b3bc 100644
--- a/ext/fetch/23_request.js
+++ b/ext/fetch/23_request.js
@@ -220,7 +220,7 @@
constructor(input, init = {}) {
const prefix = "Failed to construct 'Request'";
webidl.requiredArguments(arguments.length, 1, { prefix });
- input = webidl.converters["RequestInfo"](input, {
+ input = webidl.converters["RequestInfo_DOMString"](input, {
prefix,
context: "Argument 1",
});
@@ -424,14 +424,15 @@
"Request",
Request,
);
- webidl.converters["RequestInfo"] = (V, opts) => {
+ webidl.converters["RequestInfo_DOMString"] = (V, opts) => {
// Union for (Request or USVString)
if (typeof V == "object") {
if (V instanceof Request) {
return webidl.converters["Request"](V, opts);
}
}
- return webidl.converters["USVString"](V, opts);
+ // Passed to new URL(...) which implictly converts DOMString -> USVString
+ return webidl.converters["DOMString"](V, opts);
};
webidl.converters["RequestRedirect"] = webidl.createEnumConverter(
"RequestRedirect",