12:08
<jgraham>

So I'm trying to integrate WebDriver BiDi network events into fetch, and I'm struggling to work out where to call the various lifecycle update algorithms.

The BiDi model is basically that you get the following events: beforeRequest, responseStarted, responseCompleted, fetchError. The invariants are that every request (including redirects etc.) gets a beforeRequest event and either responseStarted/responseCompleted or fetchError (and maybe responseStarted if the error happens after the response headers are received).

I think the end-of-lifecycle events can be handled in the "fetch response handover"? But what I'm less sure about is guaranteeing that there's always a matching beforeRequest event with the headers as-sent (or as seen by whatever prevents the request going over the wire e.g. serviceworker or cache). I think the headers requirement means that in the case where the request isn't blocked we need to emit it right before sending. But because the request may be blocked at various points before that, we can end up in "fetch response handover" without having emitted a beforeRequest event. But there can also be an error which occurs after it's sent, so we can end up there when we have already emitted that event.

Is there something simpler to do here than add extra state to the request, indicating whether we already emitted such an event? Obviously I'd prefer not to add more state if possible because state is complexity, but I'm not seeing an obvious alternative.

12:44
<smaug>
Domenic is so optimistic with https://github.com/whatwg/html/pull/6315#pullrequestreview-1158013824 🙂 no regressions with session history stuff?
12:44
<smaug>
Session history is the one component where regressions are pretty much guaranteed whenever anything changes.
12:47
smaug
just fixed yet another issue he caused 2 years ago. Some site did effectively: location.reload(); location.href = "newpage"; and that right after there were something like 5 http redirects
23:37
<dlrobertson>
Is it preferred to have more small algorithms or fewer larger algorithms?
23:38
<dlrobertson>
context: I've been looking into splitting out https://w3c.github.io/FileAPI/#slice-method-algo into a algorithm so range requests can use it, and I'm uncertain if i should have slice-bytes and normalize-range or just a slice-blob algorithm