Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reject pending reads when releasing reader #1168

Merged
merged 33 commits into from
Jan 13, 2022
Merged
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8cbe621
Assert there are no pending reads when releasing lock
MattiasBuelens Oct 1, 2021
74dba1e
Update spec text
MattiasBuelens Oct 1, 2021
b20b238
Allow releasing the lock in the middle of close/error steps
MattiasBuelens Oct 2, 2021
1aa5542
Reject all pending reads when releasing lock
MattiasBuelens Oct 14, 2021
a2dc7eb
Unexport ReadableStreamReaderGenericRelease
MattiasBuelens Dec 13, 2021
86d4ca6
Handle pending pull-into descriptors when releasing a reader
MattiasBuelens Dec 15, 2021
c7b72e2
Roll WPT
MattiasBuelens Dec 15, 2021
d69b63a
Assert there are no pending reads when releasing lock in tee()
MattiasBuelens Dec 15, 2021
33fbd3a
Reject closed promise before running error steps
MattiasBuelens Dec 15, 2021
8daae1a
Fix typo
MattiasBuelens Dec 15, 2021
698d82f
Copy chunk before enqueuing
MattiasBuelens Dec 15, 2021
c9cc2fd
Roll WPT
MattiasBuelens Dec 15, 2021
526d6eb
Call GenericRelease() first when releasing a default/BYOB reader
MattiasBuelens Jan 5, 2022
6dce52f
Add ErrorReadRequests helpers
MattiasBuelens Jan 5, 2022
829dc1a
Fix typo
MattiasBuelens Jan 5, 2022
d17b13c
Spec text: add ReadableByteStreamControllerFillReadRequestFromQueue
MattiasBuelens Jan 5, 2022
df361e0
Spec text: extract stream variable in ReadableStreamReaderGenericRelease
MattiasBuelens Jan 5, 2022
27d858d
Spec text: add [[ReleaseSteps]]
MattiasBuelens Jan 5, 2022
fa4a84b
Spec text: add ErrorReadRequests helpers
MattiasBuelens Jan 5, 2022
c11ce88
Tweak
MattiasBuelens Jan 5, 2022
e15d647
Spec text: allow releasing reader with pending reads
MattiasBuelens Jan 5, 2022
ad8b431
Spec text: restore removed asserts
MattiasBuelens Jan 5, 2022
4266d1d
Spec text: update documentation for web developers
MattiasBuelens Jan 5, 2022
052eeba
Remove manual IDs for new abstract ops
MattiasBuelens Jan 7, 2022
1e99d54
Put ifs with single step on one line
MattiasBuelens Jan 7, 2022
696cafd
Sort new abstract ops alphabetically
MattiasBuelens Jan 7, 2022
e4f614c
Fix EnqueueDetachedPullIntoToQueue() call
MattiasBuelens Jan 7, 2022
1e6abd7
Add ReadableByteStreamControllerEnqueueClonedChunkToQueue helper
MattiasBuelens Jan 7, 2022
a18d2c2
Fix variable name
MattiasBuelens Jan 7, 2022
e86aae8
Simplify ReadableByteStreamControllerEnqueue
MattiasBuelens Jan 7, 2022
510ebfd
Wrap some lines
MattiasBuelens Jan 11, 2022
46b29e0
Roll WPT
MattiasBuelens Jan 11, 2022
e9e78fe
Roll WPT
MattiasBuelens Jan 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update spec text
  • Loading branch information
MattiasBuelens committed Jan 5, 2022
commit 74dba1eaeb122d994eebf52ccb01eb67df49d578
40 changes: 28 additions & 12 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1011,11 +1011,11 @@ default-reader-asynciterator-prototype-internal-slots">Asynchronous iteration</h
1. [=Resolve=] |promise| with |chunk|.
: [=read request/close steps=]
::
1. Perform ! [$ReadableStreamReaderGenericRelease$](|reader|).
1. Perform ! [$ReadableStreamDefaultReaderRelease$](|reader|).
1. [=Resolve=] |promise| with [=end of iteration=].
: [=read request/error steps=], given |e|
::
1. Perform ! [$ReadableStreamReaderGenericRelease$](|reader|).
1. Perform ! [$ReadableStreamDefaultReaderRelease$](|reader|).
1. [=Reject=] |promise| with |e|.
1. Perform ! [$ReadableStreamDefaultReaderRead$]([=this=], |readRequest|).
1. Return |promise|.
Expand All @@ -1033,9 +1033,9 @@ default-reader-asynciterator-prototype-internal-slots">Asynchronous iteration</h
before this is called.
1. If |iterator|'s [=ReadableStream async iterator/prevent cancel=] is false:
1. Let |result| be ! [$ReadableStreamReaderGenericCancel$](|reader|, |arg|).
1. Perform ! [$ReadableStreamReaderGenericRelease$](|reader|).
1. Perform ! [$ReadableStreamDefaultReaderRelease$](|reader|).
1. Return |result|.
1. Perform ! [$ReadableStreamReaderGenericRelease$](|reader|).
1. Perform ! [$ReadableStreamDefaultReaderRelease$](|reader|).
1. Return [=a promise resolved with=] undefined.
</div>

Expand Down Expand Up @@ -1274,7 +1274,7 @@ to filling the [=readable stream=]'s [=internal queue=] or changing its state. I
1. If [=this=].[=ReadableStreamGenericReader/[[stream]]=] is undefined, return.
1. If [=this=].[=ReadableStreamDefaultReader/[[readRequests]]=] is not [=list/is empty|empty=],
throw a {{TypeError}} exception.
1. Perform ! [$ReadableStreamReaderGenericRelease$]([=this=]).
1. Perform ! [$ReadableStreamDefaultReaderRelease$]([=this=]).
</div>

<h3 id="byob-reader-class">The {{ReadableStreamBYOBReader}} class</h3>
Expand Down Expand Up @@ -1440,7 +1440,7 @@ value: newViewOnSameMemory, done: true }</code> for closed streams. If the strea
1. If [=this=].[=ReadableStreamGenericReader/[[stream]]=] is undefined, return.
1. If [=this=].[=ReadableStreamBYOBReader/[[readIntoRequests]]=] is not [=list/is empty|empty=],
throw a {{TypeError}} exception.
1. Perform ! [$ReadableStreamReaderGenericRelease$]([=this=]).
1. Perform ! [$ReadableStreamBYOBReaderRelease$]([=this=]).
</div>

<h3 id="rs-default-controller-class">The {{ReadableStreamDefaultController}} class</h3>
Expand Down Expand Up @@ -2197,7 +2197,7 @@ The following abstract operations operate on {{ReadableStream}} instances at a h
* <dfn id="rs-pipeTo-finalize"><i>Finalize</i></dfn>: both forms of shutdown will eventually ask
to finalize, optionally with an error |error|, which means to perform the following steps:
1. Perform ! [$WritableStreamDefaultWriterRelease$](|writer|).
1. Perform ! [$ReadableStreamReaderGenericRelease$](|reader|).
1. Perform ! [$ReadableStreamDefaultReaderRelease$](|reader|).
1. If |signal| is not undefined, [=AbortSignal/remove=] |abortAlgorithm| from |signal|.
1. If |error| was given, [=reject=] |promise| with |error|.
1. Otherwise, [=resolve=] |promise| with undefined.
Expand Down Expand Up @@ -2358,8 +2358,7 @@ create them does not matter.
1. If |canceled1| is false or |canceled2| is false, [=resolve=] |cancelPromise| with undefined.
1. Let |pullWithDefaultReader| be the following steps:
1. If |reader| [=implements=] {{ReadableStreamBYOBReader}},
1. Assert: |reader|.[=ReadableStreamBYOBReader/[[readIntoRequests]]=] is [=list/is empty|empty=].
1. Perform ! [$ReadableStreamReaderGenericRelease$](|reader|).
1. Perform ! [$ReadableStreamBYOBReaderRelease$](|reader|).
1. Set |reader| to ! [$AcquireReadableStreamDefaultReader$](|stream|).
1. Perform |forwardReaderError|, given |reader|.
1. Let |readRequest| be a [=read request=] with the following [=struct/items=]:
Expand Down Expand Up @@ -2413,8 +2412,7 @@ create them does not matter.
1. Perform ! [$ReadableStreamDefaultReaderRead$](|reader|, |readRequest|).
1. Let |pullWithBYOBReader| be the following steps, given |view| and |forBranch2|:
1. If |reader| [=implements=] {{ReadableStreamDefaultReader}},
1. Assert: |reader|.[=ReadableStreamDefaultReader/[[readRequests]]=] is [=list/is empty|empty=].
1. Perform ! [$ReadableStreamReaderGenericRelease$](|reader|).
1. Perform ! [$ReadableStreamDefaultReaderRelease$](|reader|).
1. Set |reader| to ! [$AcquireReadableStreamBYOBReader$](|stream|).
1. Perform |forwardReaderError|, given |reader|.
1. Let |byobBranch| be |branch2| if |forBranch2| is true, and |branch1| otherwise.
Expand Down Expand Up @@ -2776,6 +2774,15 @@ The following abstract operations support the implementation and manipulation of
|view|, |readIntoRequest|).
</div>

<div algorithm>
<dfn abstract-op lt="ReadableStreamBYOBReaderRelease"
id="readable-stream-byob-reader-release">ReadableStreamBYOBReaderRelease(|reader|)</dfn>
MattiasBuelens marked this conversation as resolved.
Show resolved Hide resolved
performs the following steps:

1. Assert: |reader|.[=ReadableStreamBYOBReader/[[readIntoRequests]]=] is [=list/is empty|empty=].
1. Perform ! [$ReadableStreamReaderGenericRelease$](|reader|).
</div>
MattiasBuelens marked this conversation as resolved.
Show resolved Hide resolved

<div algorithm>
<dfn abstract-op lt="ReadableStreamDefaultReaderRead"
id="readable-stream-default-reader-read">ReadableStreamDefaultReaderRead(|reader|,
Expand All @@ -2794,6 +2801,15 @@ The following abstract operations support the implementation and manipulation of
|stream|.[=ReadableStream/[[controller]]=].[$ReadableStreamController/[[PullSteps]]$](|readRequest|).
</div>

<div algorithm>
<dfn abstract-op lt="ReadableStreamDefaultReaderRelease"
id="readable-stream-default-reader-release">ReadableStreamDefaultReaderRelease(|reader|)</dfn>
performs the following steps:

1. Assert: |reader|.[=ReadableStreamDefaultReader/[[readRequests]]=] is [=list/is empty|empty=].
MattiasBuelens marked this conversation as resolved.
Show resolved Hide resolved
1. Perform ! [$ReadableStreamReaderGenericRelease$](|reader|).
</div>

<div algorithm>
<dfn abstract-op lt="SetUpReadableStreamBYOBReader"
id="set-up-readable-stream-byob-reader">SetUpReadableStreamBYOBReader(|reader|, |stream|)</dfn>
Expand Down Expand Up @@ -6710,7 +6726,7 @@ a chunk</dfn> from a {{ReadableStreamDefaultReader}} |reader|, given a [=read re

<p algorithm>To <dfn export for="ReadableStreamDefaultReader">release</dfn> a
{{ReadableStreamDefaultReader}} |reader|, perform !
[$ReadableStreamReaderGenericRelease$](|reader|).
[$ReadableStreamDefaultReaderRelease$](|reader|).

<p algorithm>To <dfn export for="ReadableStreamDefaultReader">cancel</dfn> a
{{ReadableStreamDefaultReader}} |reader| with |reason|, perform !
Expand Down