Re: [whatwg/fetch] Move `finalize and report timing` to controller (PR #1413)

> > I suspect you've already discussed this, but I'm not very comfortable with allowing / asking external users (xhr, html, etc) to control controller's state ([abort](https://fetch.spec.whatwg.org/#fetch-controller-abort) is an exception). Is it possible / desirable to call "conclude" in the fetch spec and allow external users to set parameters (to fetch params, for example)?
> 
> Yes it's been discussed months ago... Also terminating is something that external specs can do. In most cases it's possible for fetch to report timing on its own, but in some cases the caller decides to avoid reporting or to report a network error based on the response. For example, script fetching checks for particular content-types, and style subresources are not reported when fetched from a cross-origin imported stylesheet.
> 
> We chose to do it this way because then it's clear when the reporting happens relative to other observable behaviors such as element load/error events. This is actually not new in this PR, before that the concluded state was [request's "done" flag ](https://fetch.spec.whatwg.org/#done-flag) which is set from outside in [finalize and report timing](https://fetch.spec.whatwg.org/#finalize-and-report-timing) - here I'm attempting to make this more readable and explicit.

One thing I'm open to is to separate timing-reporting from the state change - allow fetch to set the "concluded" state on error/EOF but leave the reporting to the caller, which can only happen post-conclude. @annevk WDYT?




-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1413#issuecomment-1129621828
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1413/c1129621828@github.com>

Received on Wednesday, 18 May 2022 06:28:44 UTC