mirror of
https://github.com/denoland/deno.git
synced 2025-07-25 06:04:02 +00:00
refactor(webidl): move prefix & context out of converters options bag (#18931)
This commit is contained in:
parent
d856bfd336
commit
b31cf9fde6
31 changed files with 1042 additions and 964 deletions
|
@ -274,14 +274,12 @@ class Request {
|
|||
constructor(input, init = {}) {
|
||||
const prefix = "Failed to construct 'Request'";
|
||||
webidl.requiredArguments(arguments.length, 1, prefix);
|
||||
input = webidl.converters["RequestInfo_DOMString"](input, {
|
||||
input = webidl.converters["RequestInfo_DOMString"](
|
||||
input,
|
||||
prefix,
|
||||
context: "Argument 1",
|
||||
});
|
||||
init = webidl.converters["RequestInit"](init, {
|
||||
prefix,
|
||||
context: "Argument 2",
|
||||
});
|
||||
"Argument 1",
|
||||
);
|
||||
init = webidl.converters["RequestInit"](init, prefix, "Argument 2");
|
||||
|
||||
this[webidl.brand] = webidl.brand;
|
||||
|
||||
|
@ -501,15 +499,15 @@ webidl.converters["Request"] = webidl.createInterfaceConverter(
|
|||
"Request",
|
||||
RequestPrototype,
|
||||
);
|
||||
webidl.converters["RequestInfo_DOMString"] = (V, opts) => {
|
||||
webidl.converters["RequestInfo_DOMString"] = (V, prefix, context, opts) => {
|
||||
// Union for (Request or USVString)
|
||||
if (typeof V == "object") {
|
||||
if (ObjectPrototypeIsPrototypeOf(RequestPrototype, V)) {
|
||||
return webidl.converters["Request"](V, opts);
|
||||
return webidl.converters["Request"](V, prefix, context, opts);
|
||||
}
|
||||
}
|
||||
// Passed to new URL(...) which implicitly converts DOMString -> USVString
|
||||
return webidl.converters["DOMString"](V, opts);
|
||||
return webidl.converters["DOMString"](V, prefix, context, opts);
|
||||
};
|
||||
webidl.converters["RequestRedirect"] = webidl.createEnumConverter(
|
||||
"RequestRedirect",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue