From 5ba8f3ae8389437116f16731d7cb5c3e41cfcde3 Mon Sep 17 00:00:00 2001 From: tsctx <91457664+tsctx@users.noreply.github.com> Date: Wed, 13 Aug 2025 13:01:28 +0000 Subject: [PATCH 1/3] fix formdata constructor args mark optional --- lib/web/fetch/formdata.js | 2 +- test/fetch/formdata.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/web/fetch/formdata.js b/lib/web/fetch/formdata.js index e21ee3f553e..c21fb06a3ee 100644 --- a/lib/web/fetch/formdata.js +++ b/lib/web/fetch/formdata.js @@ -9,7 +9,7 @@ const nodeUtil = require('node:util') class FormData { #state = [] - constructor (form) { + constructor (form = undefined) { webidl.util.markAsUncloneable(this) if (form !== undefined) { diff --git a/test/fetch/formdata.js b/test/fetch/formdata.js index 66d62a33f8c..bd4cc1f9882 100644 --- a/test/fetch/formdata.js +++ b/test/fetch/formdata.js @@ -341,7 +341,7 @@ test('FormData should be compatible with third-party libraries', (t) => { }) test('arguments', () => { - assert.strictEqual(FormData.constructor.length, 1) + assert.strictEqual(FormData.constructor.length, 0) assert.strictEqual(FormData.prototype.append.length, 2) assert.strictEqual(FormData.prototype.delete.length, 1) assert.strictEqual(FormData.prototype.get.length, 1) From 0d245e39817f34f9e2a550acaf19d400d4c92aee Mon Sep 17 00:00:00 2001 From: tsctx <91457664+tsctx@users.noreply.github.com> Date: Wed, 13 Aug 2025 13:15:44 +0000 Subject: [PATCH 2/3] fixup --- test/fetch/formdata.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fetch/formdata.js b/test/fetch/formdata.js index bd4cc1f9882..c7743b33c41 100644 --- a/test/fetch/formdata.js +++ b/test/fetch/formdata.js @@ -341,7 +341,7 @@ test('FormData should be compatible with third-party libraries', (t) => { }) test('arguments', () => { - assert.strictEqual(FormData.constructor.length, 0) + assert.strictEqual(FormData.prototype.constructor.length, 0) assert.strictEqual(FormData.prototype.append.length, 2) assert.strictEqual(FormData.prototype.delete.length, 1) assert.strictEqual(FormData.prototype.get.length, 1) From f02cbdc2ee0a2e80df85ace21fa6bcc3c015749b Mon Sep 17 00:00:00 2001 From: tsctx <91457664+tsctx@users.noreply.github.com> Date: Thu, 14 Aug 2025 00:33:43 +0900 Subject: [PATCH 3/3] Update test/fetch/formdata.js Co-authored-by: Khafra --- test/fetch/formdata.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fetch/formdata.js b/test/fetch/formdata.js index c7743b33c41..97f91ca0b10 100644 --- a/test/fetch/formdata.js +++ b/test/fetch/formdata.js @@ -341,7 +341,7 @@ test('FormData should be compatible with third-party libraries', (t) => { }) test('arguments', () => { - assert.strictEqual(FormData.prototype.constructor.length, 0) + assert.strictEqual(FormData.length, 0) assert.strictEqual(FormData.prototype.append.length, 2) assert.strictEqual(FormData.prototype.delete.length, 1) assert.strictEqual(FormData.prototype.get.length, 1)