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

Tests for MIME sniffing? #1851

Open
Manishearth opened this issue May 24, 2015 · 4 comments · May be fixed by #30403
Open

Tests for MIME sniffing? #1851

Manishearth opened this issue May 24, 2015 · 4 comments · May be fixed by #30403
Assignees

Comments

@Manishearth
Copy link
Contributor

I couldn't find any tests for MIME sniffing except for fetch/nosniff.

We should add some tests that fetch various resources via an iframe (or XHR if that would work) and check the mime type.

https://mimesniff.spec.whatwg.org

@annevk
Copy link
Member

annevk commented Mar 14, 2017

There should be a lot of tests somewhere for this. I imagine the Gecko and Chrome/WebKit source trees have them.

@annevk
Copy link
Member

annevk commented Jan 6, 2018

Note that I've since landed tests for MIME type parsing. Sniffing algorithm is not yet covered though.

@MattMenke2
Copy link
Member

annevk: I think the MIME parsing tests could still be beefed up, to poke around edges of the spec, where I think it's likely that even browsers that pass all tests may differ in behaviors. Some suggestions:

text/html;charset= "gbk" (I don't think this should be parsed as GBK, since the pseudo code in the spec only looks for quotes immediately after the =)
text/html;charset=();charset=GBK (This should parse as GBK, since "(" and ")" are explicitly excluded as valid characters in parameter values - could do a similar test for the name, but that seems to matter much less)
text/html;charset=';charset=GBK (This should not parse as GBK, since "'" is allowed in names. Could add tests for every non-alpha numeric character, but that may be overkill)
text/html;charset=" gbk" (I think that this should be treated as GBK)
text/html;charset="gbk " (I think that this should be treated as GBK)

@MattMenke2
Copy link
Member

And a couple more:

text/html;charset= ";charset=GBK (Parses as GBK - first parses as space-quote, and quotes aren't allowed in names, so it's skipped in favor of the second one)
text/html;charset=";charset=GBK (Does not parse as GBK)
text/html;charset=";charset=GBK";charset=GBK (Does parse as GBK, since semi-colons aren't allowed)
text/html;charset="";charset=GBK (Parses as GBK, since empty names won't be set)

annevk added a commit that referenced this issue Apr 3, 2018
Tests suggested at #1851 (comment).

Co-Authored-By: Matt Menke <mmenke@google.com>
annevk added a commit that referenced this issue Apr 4, 2018
Tests suggested at #1851 (comment).

Co-Authored-By: Matt Menke <mmenke@google.com>
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Apr 15, 2018
Automatic update from web-platform-testsNew MIME type parsing tests

Tests suggested at web-platform-tests/wpt#1851 (comment).

Co-Authored-By: Matt Menke <mmenke@google.com>

wpt-commits: ef7fe9a35d808528f92f29b70e4b7ee273c75c85
wpt-pr: 10279
wpt-commits: ef7fe9a35d808528f92f29b70e4b7ee273c75c85
wpt-pr: 10279
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 2, 2019
Automatic update from web-platform-testsNew MIME type parsing tests

Tests suggested at web-platform-tests/wpt#1851 (comment).

Co-Authored-By: Matt Menke <mmenkegoogle.com>

wpt-commits: ef7fe9a35d808528f92f29b70e4b7ee273c75c85
wpt-pr: 10279
wpt-commits: ef7fe9a35d808528f92f29b70e4b7ee273c75c85
wpt-pr: 10279

UltraBlame original commit: c35053a6372f9c1c7ef2ccf31adce23c5b4733d3
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 2, 2019
Automatic update from web-platform-testsNew MIME type parsing tests

Tests suggested at web-platform-tests/wpt#1851 (comment).

Co-Authored-By: Matt Menke <mmenkegoogle.com>

wpt-commits: ef7fe9a35d808528f92f29b70e4b7ee273c75c85
wpt-pr: 10279
wpt-commits: ef7fe9a35d808528f92f29b70e4b7ee273c75c85
wpt-pr: 10279

UltraBlame original commit: c35053a6372f9c1c7ef2ccf31adce23c5b4733d3
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 2, 2019
Automatic update from web-platform-testsNew MIME type parsing tests

Tests suggested at web-platform-tests/wpt#1851 (comment).

Co-Authored-By: Matt Menke <mmenkegoogle.com>

wpt-commits: ef7fe9a35d808528f92f29b70e4b7ee273c75c85
wpt-pr: 10279
wpt-commits: ef7fe9a35d808528f92f29b70e4b7ee273c75c85
wpt-pr: 10279

UltraBlame original commit: c35053a6372f9c1c7ef2ccf31adce23c5b4733d3
@GPHemsley GPHemsley self-assigned this Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants