On Fri Sep 12 09:24:44 2025 +0000, Jacek Caban wrote:
This looks like a hack. urlmon already does that earlier, using the right encoding and response headers as a hint and that's what's propagated to Gecko. Can we use that here somehow?
I'm not sure. XDR only accepts text/plain responses, but this method seems to detect it from the content (not from headers, else it would be pointless).
urlmon reports its sniffing via `BINDSTATUS_MIMETYPEAVAILABLE`, but that's on the channel, how do I obtain the channel from the XHR or associate it with it? (so I can access its `content_type` field)
From what I see, Gecko creates the channel internally during open() and there's no way to directly obtain it from the XHR.
An ugly solution would be some sort of thread-local hack wrapping open() (and read it in `nsIOServiceHook_NewChannel` to give it a pointer to it), but that's not very pretty either. Any better ideas?