From 6ee9ccdfb46be89057ee9fac96ba42b78c22ab71 Mon Sep 17 00:00:00 2001 From: Aras Abbasi Date: Fri, 16 Aug 2024 22:17:50 +0200 Subject: [PATCH] fix: remove unnecessary parameters in USVString calls (#3467) --- lib/web/eventsource/eventsource.js | 2 +- lib/web/fetch/formdata.js | 20 ++++++++++---------- lib/web/fetch/request.js | 4 ++-- lib/web/websocket/websocket.js | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/web/eventsource/eventsource.js b/lib/web/eventsource/eventsource.js index 51634c1779f..60b4d842951 100644 --- a/lib/web/eventsource/eventsource.js +++ b/lib/web/eventsource/eventsource.js @@ -115,7 +115,7 @@ class EventSource extends EventTarget { }) } - url = webidl.converters.USVString(url, prefix, 'url') + url = webidl.converters.USVString(url) eventSourceInitDict = webidl.converters.EventSourceInitDict(eventSourceInitDict, prefix, 'eventSourceInitDict') this.#dispatcher = eventSourceInitDict.dispatcher diff --git a/lib/web/fetch/formdata.js b/lib/web/fetch/formdata.js index 94a84b03ab3..43e39068d5e 100644 --- a/lib/web/fetch/formdata.js +++ b/lib/web/fetch/formdata.js @@ -39,12 +39,12 @@ class FormData { // 1. Let value be value if given; otherwise blobValue. - name = webidl.converters.USVString(name, prefix, 'name') + name = webidl.converters.USVString(name) value = isBlobLike(value) ? webidl.converters.Blob(value, prefix, 'value', { strict: false }) - : webidl.converters.USVString(value, prefix, 'value') + : webidl.converters.USVString(value) filename = arguments.length === 3 - ? webidl.converters.USVString(filename, prefix, 'filename') + ? webidl.converters.USVString(filename) : undefined // 2. Let entry be the result of creating an entry with @@ -61,7 +61,7 @@ class FormData { const prefix = 'FormData.delete' webidl.argumentLengthCheck(arguments, 1, prefix) - name = webidl.converters.USVString(name, prefix, 'name') + name = webidl.converters.USVString(name) // The delete(name) method steps are to remove all entries whose name // is name from this’s entry list. @@ -74,7 +74,7 @@ class FormData { const prefix = 'FormData.get' webidl.argumentLengthCheck(arguments, 1, prefix) - name = webidl.converters.USVString(name, prefix, 'name') + name = webidl.converters.USVString(name) // 1. If there is no entry whose name is name in this’s entry list, // then return null. @@ -94,7 +94,7 @@ class FormData { const prefix = 'FormData.getAll' webidl.argumentLengthCheck(arguments, 1, prefix) - name = webidl.converters.USVString(name, prefix, 'name') + name = webidl.converters.USVString(name) // 1. If there is no entry whose name is name in this’s entry list, // then return the empty list. @@ -111,7 +111,7 @@ class FormData { const prefix = 'FormData.has' webidl.argumentLengthCheck(arguments, 1, prefix) - name = webidl.converters.USVString(name, prefix, 'name') + name = webidl.converters.USVString(name) // The has(name) method steps are to return true if there is an entry // whose name is name in this’s entry list; otherwise false. @@ -135,12 +135,12 @@ class FormData { // 1. Let value be value if given; otherwise blobValue. - name = webidl.converters.USVString(name, prefix, 'name') + name = webidl.converters.USVString(name) value = isBlobLike(value) ? webidl.converters.Blob(value, prefix, 'name', { strict: false }) - : webidl.converters.USVString(value, prefix, 'name') + : webidl.converters.USVString(value) filename = arguments.length === 3 - ? webidl.converters.USVString(filename, prefix, 'name') + ? webidl.converters.USVString(filename) : undefined // 2. Let entry be the result of creating an entry with name, value, and diff --git a/lib/web/fetch/request.js b/lib/web/fetch/request.js index 42301e26eac..bcd86bc1e96 100644 --- a/lib/web/fetch/request.js +++ b/lib/web/fetch/request.js @@ -933,14 +933,14 @@ webidl.converters.Request = webidl.interfaceConverter( // https://fetch.spec.whatwg.org/#requestinfo webidl.converters.RequestInfo = function (V, prefix, argument) { if (typeof V === 'string') { - return webidl.converters.USVString(V, prefix, argument) + return webidl.converters.USVString(V) } if (V instanceof Request) { return webidl.converters.Request(V, prefix, argument) } - return webidl.converters.USVString(V, prefix, argument) + return webidl.converters.USVString(V) } webidl.converters.AbortSignal = webidl.interfaceConverter( diff --git a/lib/web/websocket/websocket.js b/lib/web/websocket/websocket.js index d8230c36ab3..d8991fe3cf3 100644 --- a/lib/web/websocket/websocket.js +++ b/lib/web/websocket/websocket.js @@ -107,7 +107,7 @@ class WebSocket extends EventTarget { const options = webidl.converters['DOMString or sequence or WebSocketInit'](protocols, prefix, 'options') - url = webidl.converters.USVString(url, prefix, 'url') + url = webidl.converters.USVString(url) protocols = options.protocols // 1. Let baseURL be this's relevant settings object's API base URL. @@ -212,7 +212,7 @@ class WebSocket extends EventTarget { } if (reason !== undefined) { - reason = webidl.converters.USVString(reason, prefix, 'reason') + reason = webidl.converters.USVString(reason) } // 1. If code is present, but is neither an integer equal to 1000 nor an