[whatwg/fetch] Task destination can stay null and then lead to undefined behavior (Issue #1673)

https://fetch.spec.whatwg.org/#concept-fetch starts with:

2. Let taskDestination be null.
1. ...
1. If request’s [client](https://fetch.spec.whatwg.org/#concept-request-client) is non-null, then:
    1. Set taskDestination to ...
1. If useParallelQueue is true, then set taskDestination to ...

So if client is null and useParallelQueue is false, taskDestination and so https://fetch.spec.whatwg.org/#fetch-params-task-destination stay null. But I don't see anything that blocks the later steps that call "[Queue a fetch task](https://fetch.spec.whatwg.org/#queue-a-fetch-task) ... with fetchParams’s [task destination](https://fetch.spec.whatwg.org/#fetch-params-task-destination).", and [Queue a fetch task](https://fetch.spec.whatwg.org/#queue-a-fetch-task) assumes its task destination is non-null.

This also isn't mentioned in https://fetch.spec.whatwg.org/#fetch-elsewhere-request, which says "leave [request](https://fetch.spec.whatwg.org/#concept-request)’s [client](https://fetch.spec.whatwg.org/#concept-request-client) as null ... callbacks would be posted on a [parallel queue](https://html.spec.whatwg.org/multipage/infrastructure.html#parallel-queue)" but doesn't tell callers to set useParallelQueue.

Should step 5 also set the taskDestination when client is null? Should there be an assertion that callers set either a client or useParallelQueue?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1673
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/1673@github.com>

Received on Wednesday, 14 June 2023 23:41:44 UTC