On Wed May 28 16:48:30 2025 +0000, Jacek Caban wrote:
Sorry for the delay. In general, setting the charset for all data here is questionable, it would also apply to binary data, which doesn't make much sense. I checked the Gecko source, and it seems that the CSS parser does rely on the protocol handler to detect the charset. This means it likely wouldn’t work for the file protocol. Did you confirm this behavior in Firefox? It should be easy to convert this test to JS and run it in stock Firefox 47 to verify that it’s not an issue with our nsio replacement. If it turns out that we do need this behavior, perhaps we should apply it only to selected MIME types?
I tested stock Firefox 47, and it has the same behavior (wrong compared to IE).
Interesting, I hadn't considered binary data, but does the charset even make a difference if the content type is not text? Note that setting it based on MIME can be wrong. I've added tests now to exemplify this; files beginning with ".snd" are detected as `audio/basic` (this is also on native), and that's completely valid CSS even if probably not in practice.
I also renamed the resource files to _css instead of .css to avoid detection based on file extension (if Windows even does that sort of thing), just to make sure.
That said, considering it's wrong in at least one case, and complicates the code, does it even matter if the charset is set on binary data?