-
Notifications
You must be signed in to change notification settings - Fork 65
structuredClone parity questions #159
Copy link
Copy link
Open
Description
While looking through Web Platform Tests's test suite for structured clones, I noticed a few more differences between msgpackr's implementation and the specs:
-0:-0is separate from0. We can easily add a check, but maybe we also don't want to unnecessarily bloat it to 5 bytes?__proto__keys:msgpackrsilently replaces them with__proto_, presumably to avoid prototype pollution. I wonder if it might be better to useObject.definePropertyto set it instead?JSON.stringifyandJSON.parseis able to handle these keys without issues, so I thinkmsgpackrshould try to do the same.- sparse array: Currently entirely unsupported by msgpackr.
- sliced
TypedArrays: If multipleTypedArrays reference the same buffer, the buffer is only used once. More strangely,structuredClone(new Uint8Array(1000000).subarray(0, 100)).buffer.byteLength === 1000000.
Do you think it makes sense to try to match structuredClone in each of these areas? Maybe put them behind an option?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels