whatwg / html

HTML Standard
https://html.spec.whatwg.org/multipage/
Other
8.19k stars 2.72k forks source link

RawJSON objects should be structured serializable/deserializable #10424

Open hotsphink opened 5 months ago

hotsphink commented 5 months ago

What problem are you trying to solve?

It looks to me like currently these would throw a DataCloneError DOMException according to the whatwg spec: https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal because they have a new [[IsRawJSON]] internal slot. I don't know for sure if whatwg internal slots are the same as tc39 internal slots, but at any rate I don't see any particular reason why these should not be supported for structured serialization/deserialization.

What solutions exist today?

Don't clone them, or rely on engines to clone them in defiance of the current spec text.

How would you solve it?

Add a clause to the StructuredSerializeInternal operation that supports them.

Anything else?

No response

domenic commented 5 months ago

What is a RawJSON object?

hotsphink commented 5 months ago

Oh, sorry. It's part of a stage 3 proposal at tc39. Perhaps there's a process where things get communicated from there?

domenic commented 5 months ago

I think opening an issue like this one is the process :)

If the champions think that making these structured serializable is a good idea, and they can get implementer interest (probably via talking to the implementer representatives in TC39), then a pull request adding them to the spec would be welcome.