-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web platform tests disagree on how to handle blob content-type validation #189
Comments
Thank you for raising this. I think we should align those tests as per the discussion in w3c/FileAPI#43. We should really also change the File API specification. I think you are correct though that there is a risk here. I hope it's small enough that this is a change we can successfully make as the current File API specification is rather broken (lowercasing MIME type parameter values is just flat out wrong for instance). |
That sounds fine to me, but how do you feel we should coordinate this? Should we change the spec, then the WPTs, then the implementations? Are there any other folks we should ping to get their input first? Or would it be best to have an implementation try changing to pass 100% of the parsing.any tests first, before we do any of that? |
If you're prepared to work on this, I think at any point we can align the WPTs with the agreement reached in w3c/FileAPI#43 (comment) and mimesniff/mime-types/parsing.any.html which are based on that agreement. The specification and implementations should be updated as well of course. I don't think the order particularly matters. Hope that helps! |
Just FYI, I've managed to make a patch which would get Firefox passing the
Since this would of course mean that Chrome and Safari will suddenly start failing all of those WPTs if I land this patch, I thought I would mention it here before I try to do so. If we feel this is a change better delayed to interop2025 (for instance), then I'm alright with that. I think in the meantime I could change Firefox to basically match Chrome and Safari's behavior on the pass/fails on the test, to at least have something relatively close to interop for now, until other vendors are ready to deal with this. |
I'm not really involved in Interop, but it seems good to have those tests match the actual requirements and it seems like there's still quite a bit of time left for 2024. |
@annevk , I've just uncovered a possible issue with using Extract-a-MimeType on a Blob's content-type. Consider https://fetch.spec.whatwg.org/#ref-for-mime-type-essence What if we try to But if we Extract-a-MimeType, the content-type becomes So should we allow that blob to be sent in our brave new world? (the warning on the spec page would imply no). Assuming we should not, how else should we process the content-type of blobs? (Or am I overthinking this?) Note that WPTs like resource-timing/content-type-parsing.html expect Extract-a-MimeType to be used to handle commas (which browsers are of course not passing at the moment). |
@annevk, wait... if I use Extract-a-Mime-Type on the blob's content-type, then I start failing tests in parsing.any.html as well..
|
Can you give a more complete scenario? Extract a MIME type should only be used where it is defined to be used. Note that for For the |
Ah, ok, so the Blob constructor/slice should just use the MIME parser and serialize, that makes sense. In that case the tests will just need to adjust for that expectation (if they create a blob with type Thanks, glad to hear I was overthinking it. |
My understanding of this issue and the history is as follows:
To move this issue forward, I think we need a clear multi-implementer decision on which path to take:
It would help to get a full list of impacted APIs. We know If someone else is willing to get a full list of APIs, ideally each with small 1-2 line code examples of before/after the change, then I can try to get an official Chromium position. I guess relevant people from WebKit and Mozilla are already on this thread :). |
@domenic the test situation for Blob was discussed in w3c/FileAPI#43 (comment) with agreement from Chromium engineers at the time. Of course, that's a long time ago now, but that general plan still seems good. |
Yeah, that engineer no longer works on Chromium, so I think re-affirming the position (with the additional data that 7 years have passed with no change) would be good. |
@domenic , I'm afraid that all I can realistically commit to on my time-budget is:
If it seems web-compatible to do this, then I would hope it's a compelling enough argument for others to help move the needle here as well. And if it's not web-compatible then "no normalization" would seem to be the default path we'll have to take. |
Understood. I guess we'll leave it with no Chromium position / promise to change then, but maybe WebKit and Gecko can ship the change and pave the way for Chromium to eventually follow! |
What is the issue with the MIME Sniffing Standard?
While trying to pass all of mimesniff/mime-types/parsing.any.html in Firefox, I've noticed that as I start passing more of the tests there by sending the content-type through our standards-compliant MIME type parser, other tests suddenly fail in FileAPI/file/File-constructor.any.html, such as:
Furthermore, the current File API specs 1 2 3 don't mention passing the content type through a MIME validator, meaning that a lot of the tests in parsing.any.html are invalid, because they necessarily construct Blobs or Files (also the tests for Request/Response use
blob()
as well).I'm not sure how to rectify this. The most obvious alternatives are of course to either:
@annevk , what do you think? I recall conversations about this in the past, but don't remember if option 1 is feasible. Would #2 be the way to go in that case, or should we defer this for now? (I'm open to just having Firefox match Chrome and Safari as closely as possible for now, if we're not ready to tackle this anytime soon).
The text was updated successfully, but these errors were encountered: