From bc750fd2d27a90686dcf219e7610d11980777e2c Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Thu, 20 Oct 2022 09:06:46 +0200 Subject: [PATCH] When serializing some WebCodecs objects with forStorage=true, throw DataCloneError instead of TypeError This applies to EncodedVideoChunk, EncodedAudioChunk, AudioData and VideoFrame, and fixes issue #589. --- index.src.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.src.html b/index.src.html index ea387602..6664b7c9 100644 --- a/index.src.html +++ b/index.src.html @@ -2516,7 +2516,7 @@ ### Serialization ###{#encodedaudiochunk-serialization} : The {{EncodedAudioChunk}} [=serialization steps=] (with |value|, |serialized|, and |forStorage|) are: -:: 1. If |forStorage| is `true`, throw a {{TypeError}}. +:: 1. If |forStorage| is `true`, throw a {{DataCloneError}}. 2. For each {{EncodedAudioChunk}} internal slot in |value|, assign the value of each internal slot to a field in |serialized| with the same name as the internal slot. @@ -2608,7 +2608,7 @@ ### Serialization ###{#encodedvideochunk-serialization} : The {{EncodedVideoChunk}} [=serialization steps=] (with |value|, |serialized|, and |forStorage|) are: -:: 1. If |forStorage| is `true`, throw a {{TypeError}}. +:: 1. If |forStorage| is `true`, throw a {{DataCloneError}}. 2. For each {{EncodedVideoChunk}} internal slot in |value|, assign the value of each internal slot to a field in |serialized| with the same name as the internal slot. @@ -2974,7 +2974,7 @@ |forStorage|) are: :: 1. If |value|'s {{platform object/[[Detached]]}} is `true`, throw a {{DataCloneError}} {{DOMException}}. - 2. If |forStorage| is `true`, throw a {{TypeError}}. + 2. If |forStorage| is `true`, throw a {{DataCloneError}}. 3. Let |resource| be the [=media resource=] referenced by |value|'s {{AudioData/[[resource reference]]}}. 4. Let |newReference| be a new reference to |resource|. @@ -4064,7 +4064,7 @@ |forStorage|) are: :: 1. If |value|'s {{platform object/[[Detached]]}} is `true`, throw a {{DataCloneError}} {{DOMException}}. - 2. If |forStorage| is `true`, throw a {{TypeError}}. + 2. If |forStorage| is `true`, throw a {{DataCloneError}}. 3. Let |resource| be the [=media resource=] referenced by |value|'s {{VideoFrame/[[resource reference]]}}. 4. Let |newReference| be a new reference to |resource|.