summaryrefslogtreecommitdiff
path: root/ext/fetch
diff options
context:
space:
mode:
authorKenta Moriuchi <moriken@kimamass.com>2022-12-20 11:37:50 +0900
committerGitHub <noreply@github.com>2022-12-20 03:37:50 +0100
commit948f85216a15e4ef489af21bb532a9b201b0364c (patch)
tree35c2bbfa021cf9a4190ab803ed091c5547bfe9f4 /ext/fetch
parent2ac575abfb75dc4533306c80240cb1beeb816b9b (diff)
chore: Update dlint (#17031)
Introduces `SafeSetIterator` and `SafeMapIterator` to primordials
Diffstat (limited to 'ext/fetch')
-rw-r--r--ext/fetch/20_headers.js5
-rw-r--r--ext/fetch/21_formdata.js10
2 files changed, 9 insertions, 6 deletions
diff --git a/ext/fetch/20_headers.js b/ext/fetch/20_headers.js
index ae32aec11..c4a919807 100644
--- a/ext/fetch/20_headers.js
+++ b/ext/fetch/20_headers.js
@@ -68,7 +68,7 @@
*/
function fillHeaders(headers, object) {
if (ArrayIsArray(object)) {
- for (const header of object) {
+ for (const header of new SafeArrayIterator(object)) {
if (header.length !== 2) {
throw new TypeError(
`Invalid header. Length must be 2, but is ${header.length}`,
@@ -205,7 +205,7 @@
// spec but produce the same result.
const headers = {};
const cookies = [];
- for (const entry of list) {
+ for (const entry of new SafeArrayIterator(list)) {
const name = byteLowerCase(entry[0]);
const value = entry[1];
if (value === null) throw new TypeError("Unreachable");
@@ -405,6 +405,7 @@
[SymbolFor("Deno.privateCustomInspect")](inspect) {
const headers = {};
+ // deno-lint-ignore prefer-primordials
for (const header of this) {
headers[header[0]] = header[1];
}
diff --git a/ext/fetch/21_formdata.js b/ext/fetch/21_formdata.js
index 34103858f..e79ceabad 100644
--- a/ext/fetch/21_formdata.js
+++ b/ext/fetch/21_formdata.js
@@ -25,6 +25,7 @@
MathRandom,
ObjectPrototypeIsPrototypeOf,
Symbol,
+ SafeArrayIterator,
StringFromCharCode,
StringPrototypeTrim,
StringPrototypeSlice,
@@ -162,7 +163,7 @@
context: "Argument 1",
});
- for (const entry of this[entryList]) {
+ for (const entry of new SafeArrayIterator(this[entryList])) {
if (entry.name === name) return entry.value;
}
return null;
@@ -183,7 +184,7 @@
});
const returnList = [];
- for (const entry of this[entryList]) {
+ for (const entry of new SafeArrayIterator(this[entryList])) {
if (entry.name === name) ArrayPrototypePush(returnList, entry.value);
}
return returnList;
@@ -203,7 +204,7 @@
context: "Argument 1",
});
- for (const entry of this[entryList]) {
+ for (const entry of new SafeArrayIterator(this[entryList])) {
if (entry.name === name) return true;
}
return false;
@@ -298,6 +299,7 @@
const chunks = [];
const prefix = `--${boundary}\r\nContent-Disposition: form-data; name="`;
+ // deno-lint-ignore prefer-primordials
for (const [name, value] of formData) {
if (typeof value === "string") {
ArrayPrototypePush(
@@ -372,7 +374,7 @@
#parseHeaders(headersText) {
const headers = new Headers();
const rawHeaders = StringPrototypeSplit(headersText, "\r\n");
- for (const rawHeader of rawHeaders) {
+ for (const rawHeader of new SafeArrayIterator(rawHeaders)) {
const sepIndex = StringPrototypeIndexOf(rawHeader, ":");
if (sepIndex < 0) {
continue; // Skip this header