Blob and File serialization steps drop the type attribute (all engines keep it; WPT asserts it)
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 74/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- html, javascript
- Domaine
- web-dev
Piste de recherche
Read the Blob and File serialization and deserialization sections in the File API specification, then inspect WPT's compare_Blob in html/webappapis/structured-clone/structured-clone-battery-of-tests.js. Update the four algorithms to preserve type and verify the structured-clone, postMessage, and IndexedDB cases pass.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
The serialization and deserialization steps for Blob and File don't carry the type attribute, but every engine keeps it and WPT asserts it.
What the spec says
Blob's serialization steps set serialized.[[SnapshotState]] and serialized.[[ByteSequence]], and the deserialization steps restore only those two. File's steps add [[Name]] and [[LastModified]]. None of the four algorithms mentions type, so read literally:
structuredClone(new Blob(["x"], { type: "text/plain" })).type // "" by the spec text
structuredClone(new File(["x"], "a.txt", { type: "text/plain" })).type // "" by the spec text
The same holds for postMessage, history.pushState, and IndexedDB's StructuredSerializeForStorage.
What engines do
All three keep the type ("text/plain" above):
- Blink:
V8ScriptValueSerializer::WriteDOMObjectwrites the blob's uuid, type and size (kBlobTag), and File's type with its other fields. - WebKit:
SerializedScriptValue.cpp:CloneSerializerwritesblob->type()after the URL (BlobTag) andfile.type()(FileTag), andreadFilepasses the type toFile::deserialize. - Gecko:
StructuredCloneHolder.cpp:WriteBlobkeeps a reference to theBlobImpl(which holds the content type), andReadBlobwraps the same impl, so the type carries over.
Tests
WPT's compare_Blob (html/webappapis/structured-clone/structured-clone-battery-of-tests.js) asserts actual.type === input.type for every cloned Blob and File, across the structured-clone, postMessage and IndexedDB variants.
Proposal
- Blob serialization steps: add "Set
serialized.[[Type]]to the value ofvalue'stypeattribute." - Blob deserialization steps: add "Initialize the value of
value'stypeattribute toserialized.[[Type]]." - File serialization and deserialization steps: the same two steps.
Possibly related: #98 (whether a clone copies or references the data), which doesn't cover type.
Found while implementing structured serialization for Blob and File in Crane, a web platform engine, which keeps the type as the engines do.
- Langage dominant
- HTML
- Étoiles
- 118
- Forks
- 52
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de w3c/FileAPI
-
TPAC 2026 Status ReportOuverteTPAC2026
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
-
Broken references in File APIOuverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 62/100
-
Add accessibility sectionOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 30/100
Toutes les issues de w3c/FileAPI
Issues similaires
-
Bug Forever Module - Map / Minimap Needs testing/reproduction
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
Les mainteneurs répondent en général sous 1 jour
-
bug via-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
pingdotgg/t3code#16859 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
Les mainteneurs répondent en général sous 1 jour
-
area/web interface
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
mastodon/mastodon#40924 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug user-priority/P2
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
Les mainteneurs répondent en général sous 1 jour