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

Sort out MIME type tests #42

Closed
4 tasks done
annevk opened this issue Oct 13, 2017 · 11 comments
Closed
4 tasks done

Sort out MIME type tests #42

annevk opened this issue Oct 13, 2017 · 11 comments

Comments

@annevk
Copy link
Member

annevk commented Oct 13, 2017

Tests:

Proposed processing model:

TODO:

@annevk
Copy link
Member Author

annevk commented Nov 21, 2017

Here's a start with an overview of the endpoints. Review and additions appreciated:

Endpoint Parsing Serializing "Supports" "String"
media.canPlayType()/MediaSource.isTypeSupported()/MediaRecorder.isTypeSupported() DOMString
XMLHttpRequest's Content-Type's charset manipulation ByteString
XMLHttpRequest's overrideMimeType() DOMString
Navigation (hard to test) ByteString
data: URLs ❌/✅ ❌/✅ ByteString
Blob's type ? ? ?
Response and Request ✅ (not implemented) ✅ (not implemented) ByteString
DataTransfer ? ? DOMString

@annevk
Copy link
Member Author

annevk commented Nov 23, 2017

Thoughts:

  • canPlayType() has adequate parsing tests. Those in charge of the isTypeSupported() methods should borrow from there.
  • XMLHttpRequest's Content-Type's charset manipulation has some tests. It's worth noting that we only need to serialize the parsed value here if the given value can be successfully parsed and has a charset parameter.
  • XMLHttpRequest's overrideMimeType() could use more tests. The problem here is that the serialization depends on Blob's type which is a mess (and doesn't always include parameters).
  • Navigation: most of the encoding tests used to tease out parameter parsing are navigation tests of sorts.
  • data: URLs: I created lots of tests for these.
  • Blob's type: it would really help to get some agreement on what to do here.
  • Response and Request: depend on Blob's type again...
  • DataTransfer: fairly limited MIME type exposure.

My takeaway is that we need agreement on Blob's type to make lots more progress, but we can make some progress around XMLHttpRequest charset manipulation.

@annevk
Copy link
Member Author

annevk commented Nov 24, 2017

web-platform-tests/wpt#8422 has the XMLHttpRequest Content-Type tests and web-platform-tests/wpt#6890 has them for data: URLs.

Until Blob is sorted that'll have to do, unless someone has further suggestions.

@annevk
Copy link
Member Author

annevk commented Nov 29, 2017

This is basically done, but leaving it open for now as it's a rather nice collection of data I might have to reference a few more times before all the patches have landed.

annevk added a commit that referenced this issue Dec 7, 2017
This addresses all open inline issues with respect to the parser and serializer, aligns both closer with implementations, except where those stood in the way of an improved model.

This also updates all of it to make extensive use of the Infra Standard.

See #42 for the testing story (included all linked issues) and web-platform-tests/wpt#7764 for the majority of tests.
@snuggs
Copy link
Member

snuggs commented Mar 14, 2018

WOW @annevk this is really great work. I have been perusing mimesniff as of late and definitely a space i'm interested in. I do realize you are keeping this open for "novelty"'s sake 😄. Is there anywhere here I can either help out? At minimum can contribute documentation.

I'll start understanding with the WPT tests in the description. I think I just answered my own question. 👍

@annevk
Copy link
Member Author

annevk commented Mar 14, 2018

The only bits I still need to finish are with respect to XMLHttpRequest. Implementations still have to align too unfortunately.

@snuggs
Copy link
Member

snuggs commented Mar 15, 2018

@annevk been wondering this but didn't know how/where to ask. preload seems to send */* for everything that's not style,font,etc.sinceas=document` is broken ATM in chrome. I am versed at the "why?" this is happening as the browser only needs to know if resource is an image or not if not mistaken.

Wanted to know where do I bring up I think as=document should send the same mimetype as using the address bar (or a frame for that matter)?

For example Chrome sends text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8.

I didn't know if this was a discussion for W3C/preload, mime sniff, HTML, WPT. Still getting the hang of wrangling kittens in open source (with your help of course).

Thanks in advance and I can delete comment after you respond if you like.

@annevk
Copy link
Member Author

annevk commented Mar 15, 2018

That's part of Fetch if you're talking about the Accept request header.

@snuggs
Copy link
Member

snuggs commented Mar 15, 2018

@annevk copy that. Thanks a ton!

@snuggs
Copy link
Member

snuggs commented Mar 15, 2018

@annevk was going to submit an issue as didn't know where to ask questions. As you taught me, check existing issues/prs first before creating another. Even found the source in chrome. :-) Looks like there is a discussion going on to follow. Thanks again.

whatwg/fetch#274

annevk added a commit to web-platform-tests/wpt that referenced this issue Apr 10, 2018
annevk added a commit to web-platform-tests/wpt that referenced this issue Apr 10, 2018
annevk added a commit to web-platform-tests/wpt that referenced this issue Apr 17, 2018
@annevk
Copy link
Member Author

annevk commented Apr 17, 2018

All the tests discussed here have landed.

@annevk annevk closed this as completed Apr 17, 2018
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Apr 26, 2018
…) tests, a=testonly

Automatic update from web-platform-testsAdd more XMLHttpRequest overrideMimeType() tests

For whatwg/xhr#157, whatwg/xhr#174, and whatwg/mimesniff#42.
--

wpt-commits: ae41496630ba35cff974877498383f1280ca07c2
wpt-pr: 8449
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 2, 2019
…) tests, a=testonly

Automatic update from web-platform-testsAdd more XMLHttpRequest overrideMimeType() tests

For whatwg/xhr#157, whatwg/xhr#174, and whatwg/mimesniff#42.
--

wpt-commits: ae41496630ba35cff974877498383f1280ca07c2
wpt-pr: 8449

UltraBlame original commit: a743786f569a9e77f8c86a2882abee702f58f981
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 3, 2019
…) tests, a=testonly

Automatic update from web-platform-testsAdd more XMLHttpRequest overrideMimeType() tests

For whatwg/xhr#157, whatwg/xhr#174, and whatwg/mimesniff#42.
--

wpt-commits: ae41496630ba35cff974877498383f1280ca07c2
wpt-pr: 8449

UltraBlame original commit: a743786f569a9e77f8c86a2882abee702f58f981
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 3, 2019
…) tests, a=testonly

Automatic update from web-platform-testsAdd more XMLHttpRequest overrideMimeType() tests

For whatwg/xhr#157, whatwg/xhr#174, and whatwg/mimesniff#42.
--

wpt-commits: ae41496630ba35cff974877498383f1280ca07c2
wpt-pr: 8449

UltraBlame original commit: a743786f569a9e77f8c86a2882abee702f58f981
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants