Browse files

Extract length and offset from view before transferring its buffer

In #753 I introduced a change that transfers the view's buffer before querying the view's length and offset. Querying those after the buffer transfer obviously won't work, so this PR extracts the values before the transfer.
  • Loading branch information...
tschneidereit authored and domenic committed Jan 10, 2018
1 parent 8f3e114 commit 98b9be75f89caef7fb273b751050336e0f438f72
Showing with 4 additions and 2 deletions.
  1. +4 −2
@@ -2501,9 +2501,11 @@ nothrow>ReadableByteStreamControllerPullInto ( <var>controller</var>, <var>view<
1. Set _ctor_ to the constructor specified in <a>the typed array constructors table</a> for
1. Let _byteOffset_ be _view_.[[ByteOffset]].
1. Let _byteLength_ be _view_.[[ByteLength]].
1. Let _buffer_ be ! TransferArrayBuffer(_view_.[[ViewedArrayBuffer]]).
1. Let _pullIntoDescriptor_ be Record {[[buffer]]: _buffer_, [[byteOffset]]:
_view_.[[ByteOffset]], [[byteLength]]: _view_.[[ByteLength]], [[bytesFilled]]: *0*, [[elementSize]]: _elementSize_,
1. Let _pullIntoDescriptor_ be Record {[[buffer]]: _buffer_, [[byteOffset]]: _byteOffset_,
[[byteLength]]: _byteLength_, [[bytesFilled]]: *0*, [[elementSize]]: _elementSize_,
[[ctor]]: _ctor_, [[readerType]]: `"byob"`}.
1. If _controller_.[[pendingPullIntos]] is not empty,
1. Append _pullIntoDescriptor_ as the last element of _controller_.[[pendingPullIntos]].

0 comments on commit 98b9be7

Please sign in to comment.