Skip to content

JSRPC: Implement serialization of Blob.#6815

Open
G4brym wants to merge 1 commit into
cloudflare:mainfrom
G4brym:blob-jsrpc-serialization
Open

JSRPC: Implement serialization of Blob.#6815
G4brym wants to merge 1 commit into
cloudflare:mainfrom
G4brym:blob-jsrpc-serialization

Conversation

@G4brym

@G4brym G4brym commented Jun 15, 2026

Copy link
Copy Markdown
Member

Makes Blob serializable so it round-trips through JSRPC, structuredClone(), and postMessage(), per the structured-clone spec. Serialized as MIME type + raw bytes.

No new compat flag: this is net-new behavior (Blob previously threw), not a breaking change, so it doesn't seem to warrant one, happy to add one if reviewers think otherwise.

@G4brym G4brym marked this pull request as ready for review June 15, 2026 19:01
@G4brym G4brym requested review from a team as code owners June 15, 2026 19:01
@G4brym G4brym force-pushed the blob-jsrpc-serialization branch from 03ec182 to d8d741e Compare June 15, 2026 19:11
@G4brym G4brym marked this pull request as draft June 15, 2026 19:11
Registers Blob as a serializable host type (new `blob` SerializationTag), so
it can be passed over built-in JSRPC and cloned via structuredClone() /
postMessage(), matching the spec which lists Blob as a serializable object. It
is serialized as its MIME type followed by its raw bytes.

The File subclass is intentionally left non-serializable.
@G4brym G4brym force-pushed the blob-jsrpc-serialization branch from d8d741e to 56beba5 Compare June 15, 2026 20:56
@codspeed-hq

codspeed-hq Bot commented Jun 15, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 10.37%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 71 untouched benchmarks
⏩ 129 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
Encode_ASCII_1024[TextEncoder][0/0/1024] 3.3 ms 3.7 ms -10.37%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing G4brym:blob-jsrpc-serialization (56beba5) with main (5be9cba)

Open in CodSpeed

Footnotes

  1. 129 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@G4brym G4brym marked this pull request as ready for review June 15, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant