@@ -2341,8 +2341,8 @@ create them does not matter.
2341
2341
1. [=Queue a microtask=] to perform the following steps:
2342
2342
1. Set |reading| to false.
2343
2343
1. Let |chunk1| and |chunk2| be |chunk|.
2344
- 1. If |canceled1| is false and |canceled2| is false, set |chunk2| to !
2345
- [$StructuredDeserialize $] (? [$StructuredSerialize$] ( |chunk|), [=the current Realm=] ).
2344
+ 1. If |canceled1| is false and |canceled2| is false, set |chunk2| to ?
2345
+ [$CloneAsUint8Array $] (|chunk|).
2346
2346
1. If |canceled1| is false, perform !
2347
2347
[$ReadableByteStreamControllerEnqueue$] (|branch1|.[=ReadableStream/[[controller]]=] ,
2348
2348
|chunk1|).
@@ -2387,8 +2387,7 @@ create them does not matter.
2387
2387
1. Set |reading| to false.
2388
2388
1. If |forBranch2| is true,
2389
2389
1. If |canceled1| is false,
2390
- 1. Let |clonedChunk| be ! [$StructuredDeserialize$] (? [$StructuredSerialize$] (|chunk|),
2391
- [=the current Realm=] ).
2390
+ 1. Let |clonedChunk| be ? [$CloneAsUint8Array$] (|chunk|).
2392
2391
1. Perform ! [$ReadableByteStreamControllerEnqueue$] (|branch1|.[=ReadableStream/[[controller]]=] ,
2393
2392
|clonedChunk|).
2394
2393
1. If |canceled2| is true,
@@ -2398,8 +2397,7 @@ create them does not matter.
2398
2397
|chunk|).
2399
2398
1. Otherwise,
2400
2399
1. If |canceled2| is false,
2401
- 1. Let |clonedChunk| be ! [$StructuredDeserialize$] (? [$StructuredSerialize$] (|chunk|),
2402
- [=the current Realm=] ).
2400
+ 1. Let |clonedChunk| be ? [$CloneAsUint8Array$] (|chunk|).
2403
2401
1. Perform ! [$ReadableByteStreamControllerEnqueue$] (|branch2|.[=ReadableStream/[[controller]]=] ,
2404
2402
|clonedChunk|).
2405
2403
1. If |canceled1| is true,
@@ -6324,6 +6322,19 @@ The following abstract operations are a grab-bag of utilities.
6324
6322
\[[ArrayBufferByteLength]] internal slot value is |arrayBufferByteLength|.
6325
6323
</div>
6326
6324
6325
+ <div algorithm>
6326
+ <dfn abstract-op lt="CloneAsUint8Array"
6327
+ id="clone-as-uint8-array"> CloneAsUint8Array(|O|)</dfn> performs the following steps:
6328
+
6329
+ 1. Assert: [$Type$] (|O|) is Object.
6330
+ 1. Assert: |O| has an \[[ViewedArrayBuffer]] internal slot.
6331
+ 1. Assert: ! [$IsDetachedBuffer$] (|O|.\[[ViewedArrayBuffer]] ) is false.
6332
+ 1. Let |buffer| be ? [$CloneArrayBuffer$] (|O|.\[[ViewedArrayBuffer]] , |O|.\[[ByteOffset]] ,
6333
+ |O|.\[[ByteLength]] , {{%ArrayBuffer%}} ).
6334
+ 1. Let |array| be ! [$Construct$] ({{%Uint8Array%}} , « |buffer| »).
6335
+ 1. Return |array|.
6336
+ </div>
6337
+
6327
6338
<h2 id="other-specs">Using streams in other specifications</h2>
6328
6339
6329
6340
Much of this standard concerns itself with the internal machinery of streams. Other specifications
0 commit comments