Skip to content

Commit bc750fd

Browse files
committed
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.
1 parent 34b6ed2 commit bc750fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

index.src.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,7 +2516,7 @@
25162516
### Serialization ###{#encodedaudiochunk-serialization}
25172517
: The {{EncodedAudioChunk}} [=serialization steps=] (with |value|, |serialized|,
25182518
and |forStorage|) are:
2519-
:: 1. If |forStorage| is `true`, throw a {{TypeError}}.
2519+
:: 1. If |forStorage| is `true`, throw a {{DataCloneError}}.
25202520
2. For each {{EncodedAudioChunk}} internal slot in |value|, assign the value
25212521
of each internal slot to a field in |serialized| with the same name as
25222522
the internal slot.
@@ -2608,7 +2608,7 @@
26082608
### Serialization ###{#encodedvideochunk-serialization}
26092609
: The {{EncodedVideoChunk}} [=serialization steps=] (with |value|, |serialized|,
26102610
and |forStorage|) are:
2611-
:: 1. If |forStorage| is `true`, throw a {{TypeError}}.
2611+
:: 1. If |forStorage| is `true`, throw a {{DataCloneError}}.
26122612
2. For each {{EncodedVideoChunk}} internal slot in |value|, assign the value
26132613
of each internal slot to a field in |serialized| with the same name as
26142614
the internal slot.
@@ -2974,7 +2974,7 @@
29742974
|forStorage|) are:
29752975
:: 1. If |value|'s {{platform object/[[Detached]]}} is `true`, throw a
29762976
{{DataCloneError}} {{DOMException}}.
2977-
2. If |forStorage| is `true`, throw a {{TypeError}}.
2977+
2. If |forStorage| is `true`, throw a {{DataCloneError}}.
29782978
3. Let |resource| be the [=media resource=] referenced by
29792979
|value|'s {{AudioData/[[resource reference]]}}.
29802980
4. Let |newReference| be a new reference to |resource|.
@@ -4064,7 +4064,7 @@
40644064
|forStorage|) are:
40654065
:: 1. If |value|'s {{platform object/[[Detached]]}} is `true`, throw a
40664066
{{DataCloneError}} {{DOMException}}.
4067-
2. If |forStorage| is `true`, throw a {{TypeError}}.
4067+
2. If |forStorage| is `true`, throw a {{DataCloneError}}.
40684068
3. Let |resource| be the [=media resource=] referenced by
40694069
|value|'s {{VideoFrame/[[resource reference]]}}.
40704070
4. Let |newReference| be a new reference to |resource|.

0 commit comments

Comments
 (0)