04:25
<ljharb>
could use some rapid spam hiding/deleting on https://github.com/whatwg/webidl/pull/1421#pullrequestreview-2184595148 (warning, there's a graphic image)
04:28
<Domenic>
Jeez
07:20
<Domenic>

More than 10 years after the progress promises discussions and we still don't have a great pattern for progress signals...

My choices seem to be either: createX() returns a promise for a not-yet-initialized X object, which fires progress events and has a ready promise for when it's fully usable. Or, createX({ progressCallback }), which only fulfills once the X is fully ready.

The latter is a bit nicer but I can find zero precedent for it on the web platform...

07:29
<annevk>
Domenic: this in light of some of the chatter about people returning to XHR? I thought we had some kind of plan for that, though a general solution for promises also sounds interesting.
07:31
<Domenic>
It's actually reflecting on some feedback on the former pattern which I've used in https://github.com/WICG/translation-api#downloading-new-languages . A general solution for promises is probably not really possible. Or if it is, it'll be like AbortController and be something separate that just often integrates with promises. What plan do you think we have? I vaguely remember some sort of FetchController or FetchSignal or something?
07:32
<Domenic>
https://github.com/whatwg/fetch/issues/607 isn't very enlightening
08:01
<Domenic>
I guess https://github.com/whatwg/fetch/issues/447#issuecomment-281731850 proposes a callback that gives you an object that fires events, that's even more complex, hmm.
08:08
<Noam Rosenthal>
Seems like this should be on the Response rather than the fetch?
08:09
<annevk>
Domenic: yeah, I think that's the plan of record. A callback that reveals a FetchObserver object upon which you can listen for progress, and can potentially monitor things like 1xx responses.
08:09
<annevk>
Noam Rosenthal: no, that would not work for 1xx.
08:10
<annevk>
Might have to be careful about when it starts sending progress though to not give additional timing channels.
08:10
<Domenic>
Hmm, for my case that's more complexity than needed, but maybe for future extensibility it's worth it??
08:11
<annevk>
What would be simpler that gives both download and upload progress? One callback for each?
08:17
<Noam Rosenthal>
What's the meaning of download/upload progress for a 1xx response? didn't see that in the issue
08:35
<Domenic>
What would be simpler that gives both download and upload progress? One callback for each?
My case only needs download progress.
08:36
<Noam Rosenthal>
Wouldn't request.onprogress and response.onprogress be simpler? Sure it doesn't support 1xx responses but isn't this good for the use cases authors care about? (Apologies if I'm missing something basic about this)
10:46
<annevk>
Neither of those objects is stateful today, I'd kinda like to keep it that way
10:59
<annevk>
FetchObserver is still the best idea I've seen for 1xx responses, upload progress, download progress, priority changes (although maybe this one can be covered by signal?), and future esoteric HTTP features (e.g., trailers that appear mid-stream has been suggested as a feature at one point). But it is somewhat clunky and I can already see people complaining about it when compared to XHR.
11:07
<Luke Warlow>
That's very probably a spec bug. The Dom parsing spec has a number of open issues on it which need reviewing and migrating to html or closing.
11:07
<annevk>
fetch("test", {
  method: "POST",
  observer => {
    observer.onprogress = () => {
      console.log("finally");
    }
  }
});

const client = new XMLHttpRequest();
client.open("POST", "test");
client.onprogress = () => {
  console.log("been doing this for a long time");
}
11:10
<annevk>
Maybe interesting to run a Twitter/Mastodon poll on at some point.
11:10
<Luke Warlow>
Am I missing something or is that fetch one not quite valid JS? Should be 'observer: observer => ...' I think
11:11
<annevk>
Luke Warlow: I might well have fumbled it. πŸ˜…
11:12
<annevk>
I guess it has to be observer(x) => x.on... or some such?
11:12
<Luke Warlow>
Fwiw that fetch call seems like a pretty nice API? Though I feel like most developers won't mind the API too much at this point they just want a non XHR way to do it. As in, do what's best from a spec and implementation point of view over purely the "best" API design especially if it allows more use cases
11:15
<annevk>

It's not terrible, I think what people might prefer is an overloaded return promise. But subclassing promises is very much uncharted territory and prolly has its own issues.

As in, naively I would expect this:

const observer = fetch("test", { method: "POST" });
observer.onprogress = () => {
  console.log("finally");
}
11:18
<annevk>
I wonder if Domenic still recalls the thinking around promise subclasses.
11:29
<sideshowbarker>
I vote for whatever we could agree on that gets something in the hands of developers sooner rather than later. It seems like we have plenty of evidence that this remains a major pain point for developers, and addressing it will save developers from a lot of frustration, and save them a lot of time.
11:43
<annevk>
I'll be out for a couple of weeks. If you need me, check back mid-August. (Though I'll show up at WHATNOT today.)
16:57
<smaug>
Luke Warlow: FWIW, Gecko's innerHTML serializer is also like GetMarkup(bool aIncludeSelf, nsAString& aMarkup). I was expecting to see something similar in the spec
16:57
<smaug>
Oh, outerHTML indeed has this weird "fictional node" https://html.spec.whatwg.org/#dom-element-outerhtml
17:02
<Luke Warlow>
In that case I think all 5 engines pass a flag through to the fragment serializing steps
17:03
<Luke Warlow>
So it seems like a no brainer for the spec to match. And then we can do away with finctional nodes.
20:54
<Luke Warlow>
Is https://html.spec.whatwg.org/multipage/xhtml.html#xml-fragment-serialisation-algorithm actually used? Only reference I can find is https://www.w3.org/TR/DOM-Parsing/#:~:text=XML%20fragment%20serialization%20algorithm which (incorrectly) links to it.
21:07
<sideshowbarker>
Yeah, seems so β€” https://github.com/search?q=repo%3Aw3c%2Fwebref%20xml-fragment-serialization-algorithm&type=code
21:07
<sideshowbarker>
only result is tr/links/DOM-Parsing.json file
21:08
<sideshowbarker>
(I thought there was some actual web frontend for doing searches for references in specs β€” but if so, I can’t remember where)
21:10
<sideshowbarker>
I guess just doing https://github.com/search?q=%22xml-fragment-serialization-algorithm%22&type=code works OK β€” since all the spec sources are in GitHub anyway
21:13
<sideshowbarker>
oh, from that I just now found a reference in the XHR spec too
21:13
<sideshowbarker>
in https://xhr.spec.whatwg.org/#dom-xmlhttprequest-send
21:14
<sideshowbarker>

If body is a Document, then set this’s request body to body, serialized, converted, and UTF-8 encoded.

21:14
<sideshowbarker>
ah, sorry not that
21:15
<sideshowbarker>
scratch all that β€” it was from the old W3C XHR spec, I think
21:16
<Luke Warlow>
So that references DOM-Parsing, which now moved to HTML which calls back into DOM-Parsing for the XML Serialization concept. πŸ˜… So probably needs a PR to update the linking to the new place.
21:16
<sideshowbarker>
yeah…
21:16
<Luke Warlow>
I'll chuck that up now while I'm poking around this stuff