diff --git a/fetch.bs b/fetch.bs index 7841091d7..3003eff96 100644 --- a/fetch.bs +++ b/fetch.bs @@ -33,6 +33,10 @@ urlPrefix:https://w3c.github.io/hr-time/#;spec:hr-time url:dfn-coarsened-shared-current-time;text:coarsened shared current time url:dfn-unsafe-shared-current-time;text:unsafe shared current time type:typedef;url:dom-domhighrestimestamp;text:DOMHighResTimeStamp + +urlPrefix:https://tc39.es/ecma262/#;type:dfn;spec:ecma-262 + url:realm;text:realm + url:sec-list-and-record-specification-type;text:Record
@@ -231,6 +235,9 @@ lt="authentication entry">authentication entries (for HTTP authentication).
To report timing for a @@ -254,8 +261,37 @@ given a fetch controller controller:
To abort a fetch controller
-controller, set controller's state to
-"aborted
".
+controller with an optional error:
+
+
Set controller's state to "aborted
".
+
+
Let fallbackError be an "{{AbortError}}" {{DOMException}}. + +
Set error to fallbackError if it is not given. + +
Let serializedError be [$StructuredSerialize$](error). + If that threw an exception, catch it, and let serializedError be + [$StructuredSerialize$](fallbackError). + +
Set controller's serialized abort reason to + serializedError. +
To deserialize a serialized abort reason, given null or a Record +abortReason and a realm realm: + +
Let fallbackError be an "{{AbortError}}" {{DOMException}}. + +
Let deserializedError be fallbackError. + +
If abortReason is non-null, then set deserializedError to + [$StructuredDeserialize$](abortReason, realm). If that threw an exception or + returned undefined, then set deserializedError to fallbackError. + +
Return deserializedError. +
To terminate a fetch controller controller, set controller's state to @@ -5668,7 +5704,8 @@ optional boolean forceNewConnection (default false), run these steps: ongoing fetch if it is suspended.
Let cancelAlgorithm be an algorithm that aborts - fetchParams's controller. + fetchParams's controller with reason, given + reason.
Let highWaterMark be a non-negative, non-NaN number, chosen by the user agent. @@ -5788,9 +5825,13 @@ optional boolean forceNewConnection (default false), run these steps:
Set response's aborted flag. -
If stream is readable,
- error stream with an
- "AbortError
" {{DOMException}}.
+
If stream is readable, then + error stream with the result of + deserialize a serialized abort reason given fetchParams's + controller's serialized abort reason + and an implementation-defined realm. +
Otherwise, if stream is readable, @@ -6999,8 +7040,8 @@ object), initially null.
To create a {{Request}} object, given a -request request, headers guard guard, and Realm -realm, run these steps: +request request, headers guard guard, and +realm realm, run these steps:
Let requestObject be a new {{Request}} object with realm. @@ -7558,8 +7599,8 @@ enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredire
To create a {{Response}} object, given a -response response, headers guard guard, and Realm -realm, run these steps: +response response, headers guard guard, and +realm realm, run these steps:
Let responseObject be a new {{Response}} object with @@ -7766,7 +7807,8 @@ method steps are: then:
Abort fetch with p, request, and null. +
Abort the fetch()
call with p, request, null, and
+ requestObject's signal's abort reason.
Return p.
Set locallyAborted to true. -
Abort fetch with p, request, and responseObject. +
Abort the fetch()
call with p, request, responseObject,
+ and requestObject's signal's abort reason.
If controller is not null, then abort - controller. + controller with requestObject's signal's + abort reason.
If locallyAborted is true, terminate these substeps. -
If response's aborted flag is set, then abort fetch - with p, request, and responseObject, and terminate these - substeps. +
If response's aborted flag is set, then: + +
Let deserializedError be the result of + deserialize a serialized abort reason given controller's + serialized abort reason and relevantRealm. + +
Abort the fetch()
call with p, request,
+ responseObject, and deserializedError.
+
If response is a network error, then reject p with a {{TypeError}} and terminate these substeps. @@ -7826,12 +7878,10 @@ method steps are:
Return p.
To abort fetch with a promise, request, and -responseObject, run these steps: +
To abort a fetch()
call with a
+promise, request, responseObject, and an error, run these steps:
Let error be an "AbortError
" {{DOMException}}.
-
Reject promise with error. @@ -8438,6 +8488,7 @@ Moritz Kneilmann, Ms2ger, Nico Schlömer, Nicolás Peña Moreno, +Nidhi Jaju, Nikhil Marathe, Nikki Bee, Nikunj Mehta,