Skip to content

runtime: new Blob(x) where x is an Array subclass stringifies the constructor instead of iterating elements #6232

Description

@proggeramlug

Summary

new Blob(x) where x is an instance of a subclass of Array (e.g. class MyArray extends Array {}) does not iterate the elements — it treats the instance as a single non-array part and stringifies its constructor. A plain array of the same values works. Wrong result, no error.

Repro

class MyArray extends Array {}
const arr = MyArray.from(["hello", " ", "derived"]);
const blob = new Blob(arr as any);
console.log(blob.size, await blob.text());
// perry:    36  "function MyArray() { [native code] }"
// expected: 13  "hello derived"

Likely cause

The BlobPart-array detection appears to check for the exact Array and misses Array subclasses. It should use the iterable/Symbol.iterator path (the constructor takes any iterable of parts).

Related: #2959 (Blob/File constructor input coercion).

Environment

perry release binary dated 2026-07-05, PERRY_NO_AUTO_OPTIMIZE=1, with libperry_stdlib.a. Found via secret-tests/bun-suite; from Bun's web/fetch/blob-array-fast-path.test.ts ("DerivedArray").

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed defect or regressionparityCompatibility gap with Node.js, ECMAScript, or the supported ecosystem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions