- From: ikram1201 <notifications@github.com>
- Date: Sat, 21 Nov 2026 08:54:02 -0800
- To: w3c/FileAPI <FileAPI@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/FileAPI/pull/236@github.com>
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 `[[Type]]` field to the serialization steps of both interfaces, and restores it in the deserialization steps, as proposed in #226. 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.
For *normative* changes, the following tasks have been completed:
* [x] Modified Web platform tests (link to pull request): no changes needed. `compare_Blob` in [`html/webappapis/structured-clone/structured-clone-battery-of-tests.js`](https://github.com/web-platform-tests/wpt/blob/master/html/webappapis/structured-clone/structured-clone-battery-of-tests.js) already asserts `actual.type === input.type` for every cloned `Blob` and `File` (structuredClone, MessageChannel and window.postMessage). [`IndexedDB/structured-clone.any.js`](https://github.com/web-platform-tests/wpt/blob/master/IndexedDB/structured-clone.any.js) checks `type` for a `Blob` and a `File` stored in IndexedDB. These pass in Chrome 156 and Firefox 159 locally, and in Safari Technology Preview 256, Chrome 160 and Firefox 162 on wpt.fyi.
Implementation commitment:
* [ ] WebKit (https://bugs.webkit.org/show_bug.cgi?id=): not needed, already keeps `type`
* [ ] Chromium (https://bugs.chromium.org/p/chromium/issues/detail?id=): not needed, already keeps `type`
* [ ] Gecko (https://bugzilla.mozilla.org/show_bug.cgi?id=): not needed, already keeps `type`
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.)
<!--
This comment and the below content is programmatically generated.
You may add a comma-separated list of anchors you'd like a
direct link to below (e.g. #idl-serializers, #idl-sequence):
Don't remove this comment or modify anything below this line.
If you don't want a preview generated for this pull request,
just replace the whole of this comment's content by "no preview"
and remove what's below.
-->
***
<a href="https://pr-preview.w3.org/ikram1201/FileAPI/pull/236.html" title="Last updated on Nov 21, 2026, 4:53 PM UTC (e40381c)">Preview</a> | <a href="https://pr-preview.w3.org/w3c/FileAPI/236/528c64a...ikram1201:e40381c.html" title="Last updated on Nov 21, 2026, 4:53 PM UTC (e40381c)">Diff</a>
You can view, comment on, or merge this pull request online at:
https://github.com/w3c/FileAPI/pull/236
-- Commit Summary --
* Serialize the type of Blob and File objects
-- File Changes --
M index.bs (8)
-- Patch Links --
https://github.com/w3c/FileAPI/pull/236.patch
https://github.com/w3c/FileAPI/pull/236.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/w3c/FileAPI/pull/236
You are receiving this because you are subscribed to this thread.
Message ID: <w3c/FileAPI/pull/236@github.com>
Received on Saturday, 21 November 2026 16:54:07 UTC