On Mon Jul 25 16:32:08 2022 +0000, Gabriel Iv��ncescu wrote:
Well, as mentioned in the comment, it has to be deferred until *after* nsIStreamListener_OnStartRequest is called, because that's when the state is changed on Gecko's XHR (not sure about the others), and that was the most straightforward place for me to add it. If you call it directly in on_progress, the tests fail. The reason is that Gecko's XHR OnProgress checks the state first to see whether it's uploading or downloading, and because OnStartRequest was not called yet to change the state, it assumes it's an upload progress notification. And so the download progress remains 0.
Sure, but that applies only to the first call OnStartRequest(). Actually, looking closer at this, we may need it both in read_data() and on_progress(), so the patch is fine for now.