From 02da57e2759a7521d53e28f7fb3fc0a268406b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 20 Apr 2023 00:58:41 +0200 Subject: refactor(ext/webidl): remove option bags from "makeException" (#18679) Creating these options bags is more costly than passing arguments one-by-one. Especially since `prefix` and `context` are passed to all functions. --- ext/fetch/20_headers.js | 3 ++- ext/fetch/23_request.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'ext/fetch') diff --git a/ext/fetch/20_headers.js b/ext/fetch/20_headers.js index a96d0da3b..29b4540f9 100644 --- a/ext/fetch/20_headers.js +++ b/ext/fetch/20_headers.js @@ -431,7 +431,8 @@ webidl.converters["HeadersInit"] = (V, opts) => { throw webidl.makeException( TypeError, "The provided value is not of type '(sequence> or record)'", - opts, + opts.prefix, + opts.context, ); }; webidl.converters["Headers"] = webidl.createInterfaceConverter( diff --git a/ext/fetch/23_request.js b/ext/fetch/23_request.js index 798346ae6..ae3edffd4 100644 --- a/ext/fetch/23_request.js +++ b/ext/fetch/23_request.js @@ -341,7 +341,8 @@ class Request { throw webidl.makeException( TypeError, "`client` must be a Deno.HttpClient", - { prefix, context: "Argument 2" }, + prefix, + "Argument 2", ); } request.clientRid = init.client?.rid ?? null; -- cgit v1.2.3