Skip to content

Commit

Permalink
structuredClone() should use StructuredDeserializeWithTransfer
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
Andreu Botella committed Sep 17, 2021
1 parent 6aa8e42 commit 535afc9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion source
Original file line number Diff line number Diff line change
Expand Up @@ -9201,8 +9201,11 @@ o.myself = o;</code></pre>
<span>StructuredSerializeWithTransfer</span>(<var>value</var>, <var>options</var>["<code
data-x="dom-StructuredSerializeOptions-transfer">transfer</code>"]).</p></li>

<li><p>Return ? <span>StructuredDeserialize</span>(<var>serialized</var>, <span>this</span>'s
<li><p>Let <var>deserializeRecord</var> ?
<span>StructuredDeserializeWithTransfer</span>(<var>serialized</var>, <span>this</span>'s
<span data-x="concept-relevant-realm">relevant Realm</span>).</p></li>

<li><p>Return <var>deserializeRecord</var>.[[Deserialized]].</p></li>
</ol>

</div>
Expand Down

0 comments on commit 535afc9

Please sign in to comment.