perf(ext/fetch): skip USVString webidl conv on string constructor
* 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(...)`
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",
});
"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",
