Visitar URL original
Serialize the type of Blob and File objects by ikram1201 · Pull Request #236 · w3c/FileAPI · GitHub
Skip to content

Serialize the type of Blob and File objects - #236

Merged
annevk merged 2 commits into
w3c:mainfrom
ikram1201:serialize-blob-type-226
Nov 22, 2026
Merged

annevk merged 2 commits into
w3c:mainfrom
ikram1201:serialize-blob-type-226

Conversation

@ikram1201

@ikram1201 ikram1201 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Closes #226

The serialization steps for Blob and File store the snapshot state and the byte sequence (and, for File, the name and last modified date), but not the type. Read literally, structuredClone(new Blob(["x"], {type: "text/plain"})).type is "", and the same goes for postMessage(), history.pushState() and IndexedDB storage.

This adds a [[LowercaseTypeInput]] field to the serialization steps of both interfaces, and restores it in the deserialization steps, as proposed in #226. The name leaves [[Type]] free for the actual MIME type discussed in #43. As @mkruisselbrink noted in the TPAC 2026 status report (#224), this is spec text catching up with what implementations and WPT already do. The new steps follow the wording of the existing [[Name]] and [[LastModified]] steps. I added them as the last step of each algorithm so the existing steps keep their numbers. Thanks to @bcardarella for the report and the implementation references, and to @annevk for the naming catch.

For normative changes, the following tasks have been completed:

Implementation commitment:

Bikeshed 7.2.1 builds with the same 17 existing link warnings before and after this change, and no new ones. (#231 fixes most of the existing ones.)


Preview | Diff

@annevk

annevk commented Nov 22, 2026

Copy link
Copy Markdown
Member

Given the discussion in #43 I think we should give this a less attractive name, such as [[LowercaseTypeInput]] so we can use [[Type]] for the actual MIME type as proposed in the last set of comments there.

Modulo that this looks good to me.

@ikram1201

Copy link
Copy Markdown
Contributor Author

Thanks @annevk, that makes sense. I'll rename the serialized field to [[LowercaseTypeInput]] in the serialization and deserialization steps and update the description, leaving [[Type]] free for the actual MIME type per #43. Will push shortly.

Per review feedback, leave [[Type]] free for the actual MIME type discussed in w3c#43.
@annevk
annevk merged commit d733e1b into w3c:main Nov 22, 2026
2 checks passed
@annevk

annevk commented Nov 22, 2026

Copy link
Copy Markdown
Member

Thank you!

@ikram1201

Copy link
Copy Markdown
Contributor Author

Thanks @annevk for the review and merge!

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.

Blob and File serialization steps drop the type attribute (all engines keep it; WPT asserts it)

2 participants