diff --git a/lib/fetch/formdata.js b/lib/fetch/formdata.js index a0c9e2f9373..a957a80e02a 100644 --- a/lib/fetch/formdata.js +++ b/lib/fetch/formdata.js @@ -259,7 +259,7 @@ function makeEntry (name, value, filename) { lastModified: value.lastModified } - value = value instanceof File + value = (NativeFile && value instanceof NativeFile) || value instanceof UndiciFile ? new File([value], filename, options) : new FileLike(value, filename, options) } diff --git a/test/wpt/runner/runner/worker.mjs b/test/wpt/runner/runner/worker.mjs index bf50dca4396..6be596c3b69 100644 --- a/test/wpt/runner/runner/worker.mjs +++ b/test/wpt/runner/runner/worker.mjs @@ -2,6 +2,7 @@ import { join } from 'node:path' import { runInThisContext } from 'node:vm' import { parentPort, workerData } from 'node:worker_threads' import { readFileSync } from 'node:fs' +import buffer from 'node:buffer' import { setGlobalOrigin, Response, @@ -34,7 +35,7 @@ Object.defineProperties(globalThis, { }, File: { ...globalPropertyDescriptors, - value: File + value: buffer.File ?? File }, FormData: { ...globalPropertyDescriptors, diff --git a/test/wpt/status/FileAPI.status.json b/test/wpt/status/FileAPI.status.json index d0d9825c6ef..844608acd9a 100644 --- a/test/wpt/status/FileAPI.status.json +++ b/test/wpt/status/FileAPI.status.json @@ -1,6 +1,6 @@ { "File-constructor.any.js": { - "fail": [ + "flaky": [ "Using type in File constructor: nonparsable" ] },