Skip to content
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

structuredClone() should use StructuredDeserializeWithTransfer #7081

Merged
merged 2 commits into from Sep 17, 2021

Conversation

andreubotella
Copy link
Member

@andreubotella andreubotella commented Sep 17, 2021

StructuredDeserialize expects the first argument to be a record containing the [[Type]] slot, as would be returned by StructuredSerialize and StructuredSerializeForStorage. StructuredSerializeWithTransfer returns instead a record with [[Serialized]] and [[TransferDataHolders]] slots, which must be deserialized using the StructuredDeserializeWithTransfer operation.

It seems like this was an oversight in #3414.

cc @surma

(See WHATWG Working Mode: Changes for more details.)


/structured-data.html ( diff )

`StructuredDeserialize` expects the first argument to be a record
containing the [[Type]] slot, as would be returned by
`StructuredSerialize` and `StructuredSerializeForStorage`.
`StructuredSerializeWithTransfer` returns instead a record with
[[Serialized]] and [[TransferDataHolders]] slots, which must be
deserialized using the `StructuredDeserializeWithTransfer` operation.

It seems like this was an oversight in whatwg#3414.
Copy link
Contributor

@surma surma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to me that you are correct! But gonna wait on one of the HTML folks to weigh in with authority on this one :) Thank you for fixing this!

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, great catch.

source Show resolved Hide resolved
@domenic domenic merged commit 75254d9 into whatwg:main Sep 17, 2021
@andreubotella andreubotella deleted the structured-clone-transfer-mismatch branch September 17, 2021 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants