-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Are interfaces inheriting from [Seralizable]
/[Transferable]
interfaces required to have their own steps?
#9269
Comments
Yes, each interface needs its own extended attribute and steps. See https://w3c.github.io/FileAPI/ for an example and #5036 for context. Has the time come to revisit this design or do we |
Sounds like a new IDL validation rule in webidl2.js can help at least to force the extended attribute. |
We probably first have to decide what we want to enforce? There are no guidelines around this currently, except that without the attribute the interface cannot be serialized or transferred. |
Oh, my question was about that, whether subinterfaces are enforced to have the steps/attribute or not. |
A bit more context: Gecko has a bug that transfers FileSystemWritableFileStream as a WritableStream: https://bugzilla.mozilla.org/show_bug.cgi?id=1832166 const directory = await navigator.storage.getDirectory();
const handle = await directory.getFileHandle("handle", { create: true });
const writable = await handle.createWritable({});
structuredClone([writable], { transfer: [writable] }); // becomes [WritableStream], oops. But perhaps that can be useful? Marking FileSystemWritableFileStream itself as |
The current contract is that anything not annotated will throw. If you want Then, if we have a lot of interface subclasses that also need to be annotated with steps that are identical or match up well with their super, we could consider making changes to the HTML Standard to make the overall setup less involved. |
I guess you are right, filed whatwg/fs#119 |
https://html.spec.whatwg.org/multipage/structured-data.html#serializable-objects
https://html.spec.whatwg.org/multipage/structured-data.html#transferable-objects
Does this mean any inheriting interfaces must always define their own steps? Should they also explicitly have the extended attribute too?
For now not all sub-interfaces follow the superclasses' extended attribute; for example FileSystemWritableFileStream does not have
[Transferable]
, does not have the transfer steps, and Blink does not support the transfer of them while it does for WritableStream.The text was updated successfully, but these errors were encountered: