Skip to content

Commit

Permalink
fix(ext/fetch): resolve TODOs about WebIDL conversions in body init (d…
Browse files Browse the repository at this point in the history
  • Loading branch information
Phosra committed Jul 28, 2022
1 parent 5d263c9 commit 519ed44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 2 additions & 4 deletions ext/fetch/22_body.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,15 +452,13 @@
webidl.converters["BodyInit_DOMString"] = (V, opts) => {
// Union for (ReadableStream or Blob or ArrayBufferView or ArrayBuffer or FormData or URLSearchParams or USVString)
if (ObjectPrototypeIsPrototypeOf(ReadableStreamPrototype, V)) {
// TODO(lucacasonato): ReadableStream is not branded
return V;
return webidl.converters["ReadableStream"](V, opts);
} else if (ObjectPrototypeIsPrototypeOf(BlobPrototype, V)) {
return webidl.converters["Blob"](V, opts);
} else if (ObjectPrototypeIsPrototypeOf(FormDataPrototype, V)) {
return webidl.converters["FormData"](V, opts);
} else if (ObjectPrototypeIsPrototypeOf(URLSearchParamsPrototype, V)) {
// TODO(lucacasonato): URLSearchParams is not branded
return V;
return webidl.converters["URLSearchParams"](V, opts);
}
if (typeof V === "object") {
if (
Expand Down
5 changes: 5 additions & 0 deletions ext/url/00_url.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,11 @@
webidl.configurePrototype(URLSearchParams);
const URLSearchParamsPrototype = URLSearchParams.prototype;

webidl.converters["URLSearchParams"] = webidl.createInterfaceConverter(
"URLSearchParams",
URLSearchParamsPrototype,
);

const _url = Symbol("url");

class URL {
Expand Down

0 comments on commit 519ed44

Please sign in to comment.