Skip to content

Commit 5bcc30d

Browse files
authored
Abort with fetch controller's error in Handle Fetch (#1655)
1 parent adb4ef0 commit 5bcc30d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

docs/index.bs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3057,7 +3057,10 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
30573057
1. If |navigationPreloadResponse|'s [=response/type=] is "`error`", reject |preloadResponse| with a `TypeError` and terminate these substeps.
30583058
1. Associate |preloadResponseObject| with |navigationPreloadResponse|.
30593059
1. Resolve |preloadResponse| with |preloadResponseObject|.
3060-
1. [=If aborted=], then [=fetch controller/abort=] |preloadFetchController|.
3060+
1. [=If aborted=], then:
3061+
1. Let |deserializedError| be a "{{AbortError}}" {{DOMException}}.
3062+
1. If |controller|'s [=fetch controller/serialized abort reason=] is non-null, set |deserializedError| to the result of calling [$StructuredDeserialize$] with |controller|'s [=fetch controller/serialized abort reason=] and |workerRealm|. If that threw an exception or returns undefined, then set |deserializedError| to a "{{AbortError}}" {{DOMException}}.
3063+
1. [=Fetch controller/abort=] |preloadFetchController| with |deserializedError|.
30613064
1. Else, resolve |preloadResponse| with undefined.
30623065

30633066
Note: From this point, the [=/service worker client=] starts to <a>use</a> its <a>active service worker</a>'s <a>containing service worker registration</a>.
@@ -3081,7 +3084,7 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
30813084
1. Set |eventHandled| to [=a new promise=] in |workerRealm|.
30823085
1. [=Queue a task=] |task| to run the following substeps:
30833086
1. Let |e| be the result of <a>creating an event</a> with {{FetchEvent}}.
3084-
1. Let |requestObject| be a new {{Request}} object associated with |request| and a new associated {{Headers}} object whose [=guard=] is "`immutable`".
3087+
1. Let |requestObject| be the result of [=Request/creating=] a {{Request}} object, given |request|, a new {{Headers}} object's [=guard=] which is "`immutable`", and |workerRealm|.
30853088
1. Initialize |e|’s {{Event/type}} attribute to {{fetch!!event}}.
30863089
1. Initialize |e|’s {{Event/cancelable}} attribute to true.
30873090
1. Initialize |e|’s {{FetchEvent/request}} attribute to |requestObject|.
@@ -3103,7 +3106,10 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
31033106
1. Else, [=ReadableStream/cancel=] |request|'s [=request/body=] with undefined.
31043107
1. If |response| is not null, then set |response|'s [=response/service worker timing info=] to |timingInfo|.
31053108
1. If |e|'s <a>canceled flag</a> is set, set |eventCanceled| to true.
3106-
1. If |controller| [=fetch controller/state=] is "<code>terminated</code>" or "<code>aborted</code>", then [=queue a task=] to [=AbortSignal/signal abort=] on |requestObject|'s {{Request/signal}}.
3109+
1. If |controller| [=fetch controller/state=] is "<code>terminated</code>" or "<code>aborted</code>", then:
3110+
1. Let |deserializedError| be a "{{AbortError}}" {{DOMException}}.
3111+
1. If |controller|'s [=fetch controller/serialized abort reason=] is non-null, set |deserializedError| to the result of calling [$StructuredDeserialize$] with |controller|'s [=fetch controller/serialized abort reason=] and |workerRealm|. If that threw an exception or returns undefined, then set |deserializedError| to a "{{AbortError}}" {{DOMException}}.
3112+
1. [=Queue a task=] to [=AbortSignal/signal abort=] on |requestObject|'s {{Request/signal}} with |deserializedError|.
31073113

31083114
If |task| is discarded, set |handleFetchFailed| to true.
31093115

0 commit comments

Comments
 (0)