-
Notifications
You must be signed in to change notification settings - Fork 330
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
Use tasks to manipulate streams #1270
Draft
annevk
wants to merge
1
commit into
main
Choose a base branch
from
annevk/more-tasks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4199,9 +4199,7 @@ steps: | |
<p><a>If aborted</a>, then: | ||
|
||
<ol> | ||
<li><p>Let <var>aborted</var> be the termination's aborted flag. | ||
|
||
<li><p>If <var>aborted</var> is set, then return an <a>aborted network error</a>. | ||
<li><p>If the termination's aborted flag is set, then return an <a>aborted network error</a>. | ||
|
||
<li><p>Return a <a>network error</a>. | ||
</ol> | ||
|
@@ -4937,9 +4935,7 @@ steps. They return a <a for=/>response</a>. | |
<p><a>If aborted</a>, then: | ||
|
||
<ol> | ||
<li><p>Let <var>aborted</var> be the termination's aborted flag. | ||
|
||
<li><p>If <var>aborted</var> is set, then return an <a>aborted network error</a>. | ||
<li><p>If the termination's aborted flag is set, then return an <a>aborted network error</a>. | ||
|
||
<li><p>Return a <a>network error</a>. | ||
</ol> | ||
|
@@ -5039,9 +5035,7 @@ steps. They return a <a for=/>response</a>. | |
<p>If the ongoing fetch is <a for=fetch>terminated</a>, then: | ||
|
||
<ol> | ||
<li><p>Let <var>aborted</var> be the termination's aborted flag. | ||
|
||
<li><p>If <var>aborted</var> is set, then return an <a>aborted network error</a>. | ||
<li><p>If the termination's aborted flag is set, then return an <a>aborted network error</a>. | ||
|
||
<li><p>Return a <a>network error</a>. | ||
</ol> | ||
|
@@ -5075,9 +5069,7 @@ steps. They return a <a for=/>response</a>. | |
<p>If the ongoing fetch is <a for=fetch>terminated</a>, then: | ||
|
||
<ol> | ||
<li><p>Let <var>aborted</var> be the termination's aborted flag. | ||
|
||
<li><p>If <var>aborted</var> is set, then return an <a>aborted network error</a>. | ||
<li><p>If the termination's aborted flag is set, then return an <a>aborted network error</a>. | ||
|
||
<li><p>Return a <a>network error</a>. | ||
</ol> | ||
|
@@ -5113,9 +5105,7 @@ steps. They return a <a for=/>response</a>. | |
<p>If the ongoing fetch is <a for=fetch>terminated</a>, then: | ||
|
||
<ol> | ||
<li><p>Let <var>aborted</var> be the termination's aborted flag. | ||
|
||
<li><p>If <var>aborted</var> is set, then return an <a>aborted network error</a>. | ||
<li><p>If the termination's aborted flag is set, then return an <a>aborted network error</a>. | ||
|
||
<li><p>Return a <a>network error</a>. | ||
</ol> | ||
|
@@ -5320,11 +5310,9 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps: | |
<p><a>If aborted</a>, then: | ||
|
||
<ol> | ||
<li><p>Let <var>aborted</var> be the termination's aborted flag. | ||
|
||
<li><p>If <var>connection</var> uses HTTP/2, then transmit an <code>RST_STREAM</code> frame. | ||
|
||
<li><p>If <var>aborted</var> is set, then return an <a>aborted network error</a>. | ||
<li><p>If the termination's aborted flag is set, then return an <a>aborted network error</a>. | ||
|
||
<li><p>Return a <a>network error</a>. | ||
</ol> | ||
|
@@ -5378,9 +5366,7 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps: | |
<p><a>If aborted</a>, then: | ||
|
||
<ol> | ||
<li><p>Let <var>aborted</var> be the termination's aborted flag. | ||
|
||
<li><p>If <var>aborted</var> is set, then set <var>response</var>'s | ||
<li><p>If the termination's aborted flag is set, then set <var>response</var>'s | ||
<a for=response>aborted flag</a>. | ||
|
||
<li><p>Return <var>response</var>. | ||
|
@@ -5423,20 +5409,28 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps: | |
<li><p>If <var>bytes</var> is failure, then <a lt=terminated for=fetch>terminate</a> the | ||
ongoing fetch. | ||
|
||
<li><p><a for=ReadableStream>Enqueue</a> a {{Uint8Array}} wrapping an {{ArrayBuffer}} | ||
containing <var>bytes</var> into <var>stream</var>. | ||
<li> | ||
<p>Let <var>handleResponseBytes</var> be these steps: | ||
|
||
<li><p>If <var>stream</var> is <a for=ReadableStream>errored</a>, then | ||
<a lt=terminated for=fetch>terminate</a> the ongoing fetch. | ||
<ol> | ||
<li><p><a for=ReadableStream>Enqueue</a> a {{Uint8Array}} wrapping an {{ArrayBuffer}} | ||
containing <var>bytes</var> into <var>stream</var>. | ||
|
||
<li><p>If <var>stream</var> doesn't <a for=ReadableStream>need more data</a> ask the user | ||
agent to <a for=fetch>suspend</a> the ongoing fetch. | ||
<li><p>If <var>stream</var> is <a for=ReadableStream>errored</a>, then | ||
<a lt=terminated for=fetch>terminate</a> the ongoing fetch. | ||
|
||
<li><p>If <var>stream</var> doesn't <a for=ReadableStream>need more data</a> ask the user | ||
agent to <a for=fetch>suspend</a> the ongoing fetch. | ||
</ol> | ||
|
||
<li><p>Otherwise, if the bytes transmission for <var>response</var>'s message body is done | ||
normally and <var>stream</var> is <a for=ReadableStream>readable</a>, then | ||
<a for=ReadableStream>close</a> <var>stream</var>, <a for=/>finalize response</a> for | ||
<var>fetchParams</var> and <var>response</var>. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Closing should also be done in a task right? |
||
</ol> | ||
|
||
<li><p>Otherwise, if the bytes transmission for <var>response</var>'s message body is done | ||
normally and <var>stream</var> is <a for=ReadableStream>readable</a>, then | ||
<a for=ReadableStream>close</a> <var>stream</var>, <a for=/>finalize response</a> for | ||
<var>fetchParams</var> and <var>response</var>, and abort these in-parallel steps. | ||
<li><p><a>Queue a fetch task</a> given <var>handleResponseBytes</var> and | ||
<var>fetchParams</var>'s <a for="fetch params">task destination</a>. | ||
</ol> | ||
</ol> | ||
|
||
|
@@ -5446,22 +5440,6 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps: | |
<ol> | ||
<li><a for=/>Finalize response</a> for <var>fetchParams</var> and <var>response</var>. | ||
|
||
<li><p>Let <var>aborted</var> be the termination's aborted flag. | ||
|
||
<li> | ||
<p>If <var>aborted</var> is set, then: | ||
|
||
<ol> | ||
<li><p>Set <var>response</var>'s <a for=response>aborted flag</a>. | ||
|
||
<li><p>If <var>stream</var> is <a for=ReadableStream>readable</a>, | ||
<a for=ReadableStream>error</a> <var>stream</var> with an | ||
"<code><a exception>AbortError</a></code>" {{DOMException}}. | ||
</ol> | ||
|
||
<li><p>Otherwise, if <var>stream</var> is <a for=ReadableStream>readable</a>, | ||
<a for=ReadableStream>error</a> <var>stream</var> with a {{TypeError}}. | ||
|
||
<li><p>If <var>connection</var> uses HTTP/2, then transmit an <code>RST_STREAM</code> frame. | ||
|
||
<li> | ||
|
@@ -5471,6 +5449,28 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps: | |
<p class=note>For instance, the user agent could keep the connection open if it knows there's | ||
only a few bytes of transfer remaining on a reusable connection. In this case it could be | ||
worse to close the connection and go through the handshake process again for the next fetch. | ||
|
||
<li> | ||
<p>Let <var>handleResponseError</var> be these steps: | ||
|
||
<ol> | ||
<li> | ||
<p>If the termination's aborted flag is set, then: | ||
|
||
<ol> | ||
<li><p>Set <var>response</var>'s <a for=response>aborted flag</a>. | ||
|
||
<li><p>If <var>stream</var> is <a for=ReadableStream>readable</a>, | ||
<a for=ReadableStream>error</a> <var>stream</var> with an | ||
"<code><a exception>AbortError</a></code>" {{DOMException}}. | ||
</ol> | ||
|
||
<li><p>Otherwise, if <var>stream</var> is <a for=ReadableStream>readable</a>, | ||
<a for=ReadableStream>error</a> <var>stream</var> with a {{TypeError}}. | ||
</ol> | ||
|
||
<li><p><a>Queue a fetch task</a> given <var>handleResponseError</var> and | ||
<var>fetchParams</var>'s <a for="fetch params">task destination</a>. | ||
</ol> | ||
</ol> | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW this can be made rigorous these days with https://heycam.github.io/webidl/#arraybufferview-create (
[=ArrayBufferView/new=] {{Uint8Array}} given |bytes| in some realm
).