@@ -3441,10 +3441,12 @@ The following abstract operations support the implementation of the
3441
3441
queue entry/byte length=] ).
3442
3442
1. Let |destStart| be |pullIntoDescriptor|'s [=pull-into descriptor/byte offset=] +
3443
3443
|pullIntoDescriptor|'s [=pull-into descriptor/bytes filled=] .
3444
- 1. Perform ! [$CopyDataBlockBytes$] (|pullIntoDescriptor|'s [=pull-into
3445
- descriptor/buffer=] .\[[ArrayBufferData]] , |destStart|,
3446
- |headOfQueue|'s [=readable byte stream queue entry/buffer=] .\[[ArrayBufferData]] ,
3447
- |headOfQueue|'s [=readable byte stream queue entry/byte offset=] , |bytesToCopy|).
3444
+ 1. If ! [$SafeCopyDataBlockBytes$] (|pullIntoDescriptor|'s [=pull-into descriptor/buffer=] ,
3445
+ |destStart|, |headOfQueue|'s [=readable byte stream queue entry/buffer=] ,
3446
+ |headOfQueue|'s [=readable byte stream queue entry/byte offset=] , |bytesToCopy|) is false,
3447
+ 1. Let |e| be a {{TypeError}} exception.
3448
+ 1. Perform ! [$ReadableByteStreamControllerError$] (|controller|, |e|).
3449
+ 1. Return false.
3448
3450
1. If |headOfQueue|'s [=readable byte stream queue entry/byte length=] is |bytesToCopy|,
3449
3451
1. [=list/Remove=] |queue|[0] .
3450
3452
1. Otherwise,
@@ -6848,6 +6850,24 @@ The following abstract operations are a grab-bag of utilities.
6848
6850
1. Return ? [$StructuredDeserialize$] (|serialized|, [=the current Realm=] ).
6849
6851
</div>
6850
6852
6853
+ <div algorithm>
6854
+ <dfn abstract-op lt="SafeCopyDataBlockBytes">SafeCopyDataBlockBytes(|toBuffer|, |toIndex|,
6855
+ |fromBuffer|, |fromIndex|, |count|)</dfn> performs the following steps:
6856
+
6857
+ 1. Assert: [$Type$] (|toBuffer|) is Object.
6858
+ 1. Assert: |toBuffer| has an \[[ArrayBufferData]] internal slot.
6859
+ 1. Assert: [$Type$] (|fromBuffer|) is Object.
6860
+ 1. Assert: |fromBuffer| has an \[[ArrayBufferData]] internal slot.
6861
+ 1. If |toBuffer| is |fromBuffer|, return false.
6862
+ 1. If ! [$IsDetachedBuffer$] (|toBuffer|) is true, return false.
6863
+ 1. If ! [$IsDetachedBuffer$] (|fromBuffer|) is true, return false.
6864
+ 1. If |toIndex| + |count| > |toBuffer|.\[[ArrayBufferByteLength]] , return false.
6865
+ 1. If |fromIndex| + |count| > |fromBuffer|.\[[ArrayBufferByteLength]] , return false.
6866
+ 1. Perform ! [$CopyDataBlockBytes$] (|toBuffer|.\[[ArrayBufferData]] , |toIndex|,
6867
+ |fromBuffer|.\[[ArrayBufferData]] , |fromIndex|, |count|).
6868
+ 1. Return true.
6869
+ </div>
6870
+
6851
6871
<h2 id="other-specs">Using streams in other specifications</h2>
6852
6872
6853
6873
Much of this standard concerns itself with the internal machinery of streams. Other specifications
0 commit comments