(response)
| 246 | // given response being these substeps: |
| 247 | |
| 248 | const processResponse = (response) => { |
| 249 | // 1. If locallyAborted is true, terminate these substeps. |
| 250 | if (locallyAborted) { |
| 251 | return |
| 252 | } |
| 253 | |
| 254 | // 2. If response’s aborted flag is set, then: |
| 255 | if (response.aborted) { |
| 256 | // 1. Let deserializedError be the result of deserialize a serialized |
| 257 | // abort reason given controller’s serialized abort reason and |
| 258 | // relevantRealm. |
| 259 | |
| 260 | // 2. Abort the fetch() call with p, request, responseObject, and |
| 261 | // deserializedError. |
| 262 | |
| 263 | abortFetch(p, request, responseObject, controller.serializedAbortReason, controller.controller) |
| 264 | cleanupAbortListeners() |
| 265 | return |
| 266 | } |
| 267 | |
| 268 | // 3. If response is a network error, then reject p with a TypeError |
| 269 | // and terminate these substeps. |
| 270 | if (response.type === 'error') { |
| 271 | p.reject(new TypeError('fetch failed', { cause: response.error })) |
| 272 | cleanupAbortListeners() |
| 273 | return |
| 274 | } |
| 275 | |
| 276 | // 4. Set responseObject to the result of creating a Response object, |
| 277 | // given response, "immutable", and relevantRealm. |
| 278 | responseObject = new WeakRef(fromInnerResponse(response, 'immutable')) |
| 279 | |
| 280 | // 5. Resolve p with responseObject. |
| 281 | p.resolve(responseObject.deref()) |
| 282 | p = null |
| 283 | } |
| 284 | |
| 285 | controller = fetching({ |
| 286 | request, |
nothing calls this directly
no test coverage detected