Skip to content
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

Use mimesniff's "parse a MIME type" to parse the contentType member #69

Open
foolip opened this issue Feb 27, 2018 · 7 comments · May be fixed by #222
Open

Use mimesniff's "parse a MIME type" to parse the contentType member #69

foolip opened this issue Feb 27, 2018 · 7 comments · May be fixed by #222
Assignees
Milestone

Comments

@foolip
Copy link
Member

foolip commented Feb 27, 2018

https://wicg.github.io/media-capabilities/#dom-videoconfiguration-contenttype says "If configuration’s contentType is not a valid video MIME type, return false and abort these steps."

Since this was written, @annevk defined https://mimesniff.spec.whatwg.org/#parse-a-mime-type which, if followed, should lead to more interoperable MIME type parsing.

The structure would be something like invoking "parse a MIME type", and then handling the failure case.

@annevk
Copy link
Member

annevk commented Feb 27, 2018

(In general it would be good to build more on the MIME Sniffing infrastructure here.)

@chcunningham
Copy link
Contributor

@foolip @annevk questions as I'm taking a look at this.

I see the mimesniff spec defines both #valid-mime-type and the algorithm #parsing-a-mime-type.

Why doesn't #valid-mime-type reference #parsing-a-mime-type? Then we could take a reference on #valid-mime-type and transitively reference the parsing algo.

As I write the steps to define a valid mime type from MC perspective its counter intuitive to reference #parsing-a-mime-type rather than #valid-mime-type. Especially since #valid-mime-type seems to be more strict.

@annevk
Copy link
Member

annevk commented Oct 26, 2018

One is for web developers and the other for user agents. User agents have historically been somewhat forgiving, so we cannot really make them stricter, but it makes sense for web developers to be recommended to use a subset if you will for maximum interoperability (and in case we ever need to make some breaking change outside of that subset for extensions or some such).

@chcunningham
Copy link
Contributor

Thanks, makes sense. I think I missed the note:
"A valid MIME type string is supposed to be used for conformance checkers only."

@chrisn
Copy link
Member

chrisn commented Jul 4, 2024

Related: w3c/encrypted-media#511

@marcoscaceres
Copy link
Member

marcoscaceres commented Jul 4, 2024

Ok, we have some interop issues here:

Given:

await navigator.mediaCapabilities.decodingInfo({ type: "file", audio: {contentType: "audio/mp3;" }})

Chrome rejects. Firefox and WebKit don't. The spec (although not using MIME Sniff) says that it should reject.

@marcoscaceres marcoscaceres linked a pull request Jul 4, 2024 that will close this issue
@annevk
Copy link
Member

annevk commented Jul 4, 2024

I think you probably want to make that work. And it would probably make sense to run a bunch of the MIME type parser tests through that API (they're in mimesniff/ in WPT somewhere).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants