Skip to content

JSRPC: Implement serialization of Blob.#6815

Open
G4brym wants to merge 2 commits into
cloudflare:mainfrom
G4brym:blob-jsrpc-serialization
Open

JSRPC: Implement serialization of Blob.#6815
G4brym wants to merge 2 commits 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
@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 12.45%

❌ 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_32[TextEncoder][0/0/32] 2.8 ms 3.1 ms -12.45%

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 (adea49b) with main (e98456a)

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
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 56beba5 to 979d93d Compare June 16, 2026 07:26
@G4brym G4brym marked this pull request as draft June 16, 2026 07:26
@G4brym G4brym marked this pull request as ready for review June 16, 2026 07:28
Comment thread src/workerd/api/blob.c++ Outdated
Co-authored-by: James M Snell <jasnell@gmail.com>
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.

2 participants