There are several places in the code where we could be using our new MIMEType parser to behave much closer to what the Mime Sniffing spec and related WPTs expect. Drop-in use of the newer parser these spots would get us passing a lot of the WPTs: - https://searchfox.org/mozilla-central/source/netwerk/protocol/http/nsHttpResponseHead.cpp#625 - https://searchfox.org/mozilla-central/source/dom/file/Blob.cpp#53 - https://searchfox.org/mozilla-central/source/dom/fetch/InternalHeaders.cpp#102 I have a patch almost ready which gates doing each behind prefs, and I feel it's worth trying it out to progress the status quo here. The bulk of the tests we will still fail after this patch will be related to the fact that the File spec expects us to lowercase and drop non-ASCII characters from the media type of blobs, while the Mime Sniffing WPTs do not (my patch will not reconcile this, but will merely split the difference, following the File spec but also normalizing the media type with the Mime Sniffing parsing/serializing algorithms).
Bug 1847659 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
There are several places in the code where we could be using our new MIMEType parser to behave much closer to what the Mime Sniffing spec and related WPTs expect. Drop-in use of the newer parser these two spots would get us passing a lot of the WPTs: - https://searchfox.org/mozilla-central/source/netwerk/protocol/http/nsHttpResponseHead.cpp#625 - https://searchfox.org/mozilla-central/source/dom/fetch/InternalHeaders.cpp#102 I have a patch almost ready which gates doing each behind prefs, and I feel it's worth trying it out to progress the status quo here. Unfortunately, we can't really do much about the remaining MimeSniffing WPT failures, because those WPTs directly conflict with the File WPTs' expectations for blob types (because the File spec expects blobs to only be lowercased and rejected if they have non-ASCII characters, while the MimeSniffing spec seems to expect them to be normalized, as if parsed and then serialized).
We should be able to pass the mimesniff/mime-types/charset-parameter.window.html WPTs if we use our new MIMEType parser here: - https://searchfox.org/mozilla-central/source/netwerk/protocol/http/nsHttpResponseHead.cpp#625 We could also pass a lot of the other MimeSniff tests by using it for blob content types, but unfortunately those tests conflict with the File spec (because the File spec expects blobs to only be lowercased and rejected if they have non-ASCII characters, while the MimeSniffing spec seems to expect them to be normalized, as if parsed and then serialized).