Skip to content

Commit

Permalink
Remove WebTransportError's custom create algorithm in favor of new gu…
Browse files Browse the repository at this point in the history
…idance.
  • Loading branch information
jan-ivar committed Jan 25, 2023
1 parent 3802597 commit 213189c
Showing 1 changed file with 27 additions and 36 deletions.
63 changes: 27 additions & 36 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ urlPrefix: http://www.ecma-international.org/ecma-262/6.0/index.html; spec: ECMA
text: settled; url: sec-promise-objects
urlPrefix: https://heycam.github.io/webidl/; spec: WEBIDL
type: dfn
text: new DOMException(message, name); for:DOMException; url: dom-domexception-domexception
text: created; for:DOMException; url: dfn-create-exception
text: name; for:DOMException; url: domexception-name
text: message; for:DOMException; url: domexception-message
</pre>

# Introduction # {#introduction}
Expand Down Expand Up @@ -730,8 +732,8 @@ To <dfn>initialize WebTransport over HTTP</dfn>, given a {{WebTransport}} object
returns <b>blocked</b>, then abort the remaining steps and [=queue a network task=] with |transport|
to run these steps:
1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`, then abort these steps.
1. Let |error| be the result of [=WebTransportError/creating=] a {{WebTransportError}} with
`"session"`.
1. Let |error| be a newly [=DOMException/created=] {{WebTransportError}} whose
{{WebTransportErrorOptions/source}} is `"session"`.
1. [=Cleanup=] |transport| with |error|.
1. Let |networkPartitionKey| be the result of [=determining the network partition key=] with
|transport|'s [=relevant settings object=].
Expand All @@ -744,17 +746,17 @@ To <dfn>initialize WebTransport over HTTP</dfn>, given a {{WebTransport}} object
1. If |connection| is failure, then abort the remaining steps and [=queue a network task=] with
|transport| to run these steps:
1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`, then abort these steps.
1. Let |error| be the result of [=WebTransportError/creating=] a {{WebTransportError}} with
`"session"`.
1. Let |error| be a newly [=DOMException/created=] {{WebTransportError}} whose
{{WebTransportErrorOptions/source}} is `"session"`.
1. [=Cleanup=] |transport| with |error|.
1. Wait for |connection| to receive the first SETTINGS frame, and let |settings| be a dictionary that
represents the SETTINGS frame.
1. If |settings| doesn't contain SETTINGS_ENABLE_WEBTRANPORT with a value of 1, or it doesn't
contain H3_DATAGRAM with a value of 1, then abort the remaining steps and [=queue a network
task=] with |transport| to run these steps:
1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`, then abort these steps.
1. Let |error| be the result of [=WebTransportError/creating=] a {{WebTransportError}} with
`"session"`.
1. Let |error| be a newly [=DOMException/created=] {{WebTransportError}} whose
{{WebTransportErrorOptions/source}} is `"session"`.
1. [=Cleanup=] |transport| with |error|.
1. [=session/Establish=] a [=WebTransport session=] with |origin| on |connection|.

Expand All @@ -763,8 +765,8 @@ To <dfn>initialize WebTransport over HTTP</dfn>, given a {{WebTransport}} object
1. If the previous step fails, abort the remaining steps and [=queue a network task=] with
|transport| to run these steps:
1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`, then abort these steps.
1. Let |error| be the result of [=WebTransportError/creating=] a {{WebTransportError}} with
`"session"`.
1. Let |error| be a newly [=DOMException/created=] {{WebTransportError}} whose
{{WebTransportErrorOptions/source}} is `"session"`.
1. [=Cleanup=] |transport| with |error|.
1. Let |session| be the established [=WebTransport session=].
1. Assert: |maxDatagramSize| is an integer.
Expand Down Expand Up @@ -866,8 +868,8 @@ these steps.
1. Let |transport| be [=this=].
1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`, then abort these steps.
1. If |transport|.{{[[State]]}} is `"connecting"`:
1. Let |error| be the result of [=WebTransportError/creating=] a {{WebTransportError}} with
`"session"`.
1. Let |error| be a newly [=DOMException/created=] {{WebTransportError}} whose
{{WebTransportErrorOptions/source}} is `"session"`.
1. [=Cleanup=] |transport| with |error|.
1. Abort these steps.
1. Let |session| be |transport|.{{[[Session]]}}.
Expand Down Expand Up @@ -1011,8 +1013,8 @@ Whenever a [=WebTransport session=] which is associated with a {{WebTransport}}
request that initiated |transport|.{{[[Session]]}} is in the "Data Recvd" state. [[!QUIC]]
1. [=Queue a network task=] with |transport| to run these steps:
1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`, abort these steps.
1. Let |error| be the result of [=WebTransportError/creating=] a {{WebTransportError}} with
`"session"`.
1. Let |error| be a newly [=DOMException/created=] {{WebTransportError}} whose
{{WebTransportErrorOptions/source}} is `"session"`.
1. If |cleanly| is false, then [=cleanup=] |transport| with |error|, and abort these steps.
1. Let |closeInfo| be a [=new=] {{WebTransportCloseInfo}}.
1. If |code| is given, set |closeInfo|'s {{WebTransportCloseInfo/closeCode}} to |code|.
Expand All @@ -1028,8 +1030,8 @@ run these steps:

1. [=Queue a network task=] with |transport| to run these steps:
1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`, abort these steps.
1. Let |error| be the result of [=WebTransportError/creating=] a {{WebTransportError}} with
`"session"`.
1. Let |error| be a newly [=DOMException/created=] {{WebTransportError}} whose
{{WebTransportErrorOptions/source}} is `"session"`.
1. [=Cleanup=] |transport| with |error|.

</div>
Expand Down Expand Up @@ -1461,7 +1463,7 @@ To <dfn for="WebTransportSendStream">abort</dfn> a {{WebTransportSendStream}} |s
1. Let |promise| be a new promise.
1. Let |code| be 0.
1. [=set/Remove=] |stream| from |transport|.{{[[SendStreams]]}}.
1. If |reason| is a {{WebTransportError}} and |reasons|.{{WebTransportError/[[StreamErrorCode]]}} is not
1. If |reason| is a {{WebTransportError}} and |reason|.{{WebTransportError/[[StreamErrorCode]]}} is not
null, then set |code| to |reason|.{{WebTransportError/[[StreamErrorCode]]}}.
1. If |code| < 0, then set |code| to 0.
1. If |code| > 255, then set |code| to 255.
Expand Down Expand Up @@ -1490,9 +1492,9 @@ Whenever a [=WebTransport stream=] associated with a {{WebTransportSendStream}}
1. [=Queue a network task=] with |transport| to run these steps:
1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`, abort these steps.
1. [=set/Remove=] |stream| from |transport|.{{[[SendStreams]]}}.
1. Let |error| be the result of [=WebTransportError/creating=] a {{WebTransportError}} with
`"stream"`.
1. Set |error|.{{WebTransportError/[[StreamErrorCode]]}} to |code|.
1. Let |error| be a newly [=DOMException/created=] {{WebTransportError}} whose
{{WebTransportErrorOptions/source}} is `"stream"` and
{{WebTransportErrorOptions/streamErrorCode}} is |code|.
1. [=WritableStream/Error=] |stream| with |error|.

</div>
Expand Down Expand Up @@ -1683,7 +1685,7 @@ steps.
1. Let |internalStream| be |stream|.{{WebTransportReceiveStream/[[InternalStream]]}}.
1. Let |promise| be a new promise.
1. Let |code| be 0.
1. If |reason| is a {{WebTransportError}} and |reasons|.{{WebTransportError/[[StreamErrorCode]]}} is not
1. If |reason| is a {{WebTransportError}} and |reason|.{{WebTransportError/[[StreamErrorCode]]}} is not
null, then set |code| to |reason|.{{WebTransportError/[[StreamErrorCode]]}}.
1. If |code| < 0, then set |code| to 0.
1. If |code| > 255, then set |code| to 255.
Expand Down Expand Up @@ -1719,8 +1721,9 @@ Whenever a [=WebTransport stream=] associated with a {{WebTransportReceiveStream
1. [=Queue a network task=] with |transport| to run these steps:
1. If |transport|.{{[[State]]}} is `"closed"` or `"failed"`, abort these steps.
1. [=set/Remove=] |stream| from |transport|.{{[[ReceiveStreams]]}}.
1. Let |error| be the result of [=WebTransportError/creating=] a {{WebTransportError}} with
`"stream"` and |code|.
1. Let |error| be a newly [=DOMException/created=] {{WebTransportError}} whose
{{WebTransportErrorOptions/source}} is `"stream"` and
{{WebTransportErrorOptions/streamErrorCode}} is |code|.
1. [=ReadableStream/Error=] |stream| with |error|.

</div>
Expand Down Expand Up @@ -1877,29 +1880,17 @@ A {{WebTransportError}} has the following internal slots.

<div algorithm>

To <dfn for="WebTransportError">create</dfn> a {{WebTransportError}} error with a
{{WebTransportErrorSource}} |source| and optionally a |streamErrorCode| defaulting
to `null`, run these steps:

1. Let |message| be an [=implementation-defined=] string.
1. Let |options| be `{source, streamErrorCode}`.
1. Return a new {{WebTransportError/constructor()}} with |message| and |options|.

</div>

<div algorithm>

The <dfn constructor for="WebTransportError"
lt="WebTransportError(message, options)">new WebTransportError(message, options)</dfn>
constructor steps are:

1. Set |this|'s [=DOMException/name=] to `"WebTransportError"`.
1. Set |this|'s [=DOMException/message=] to |message|.
1. Set |this|'s internal slots as follows:
: {{WebTransportError/[[Source]]}}
:: |options|.{{WebTransportErrorOptions/source}}
: {{WebTransportError/[[StreamErrorCode]]}}
:: |options|.{{WebTransportErrorOptions/streamErrorCode}}
1. Run the [=DOMException/new DOMException(message, name)=] constructor steps on
[=this=] with |message| and `"WebTransportError"`.

Note: This name does not have a mapping to a legacy code, so [=this=]'s {{DOMException/code}}
is 0.
Expand Down

0 comments on commit 213189c

Please sign in to comment.