Closed Bug 1362318 Opened 4 years ago Closed 4 years ago

Failure in testing/web-platform/tests/XMLHttpRequest/overridemimetype-blob.html

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: shawnjohnjr, Assigned: shawnjohnjr)

Details

Attachments

(2 files, 2 obsolete files)

Use text/xml as fallback MIME type	

assert_equals: expected "text/xml" but got "application/xml"


Use text/xml as fallback MIME type, 2	
assert_equals: expected "text/xml" but got "application/xml"


Bogus MIME type should end up as application/octet-stream	
assert_equals: expected "application/octet-stream" but got "application/x-unknown-content-type"


Bogus MIME type should end up as application/octet-stream, 2	
assert_equals: expected "application/octet-stream" but got "text/xml"
Assignee: nobody → shuang
I'm not sure about this case "Bogus MIME type should end up as application/octet-stream, 2".

Based on the specification, "If mime is a parsable MIME type, then set override MIME type to its MIME type portion.".
The xhr specification doesn't mention invalid mime type.

So I think "text/xml;charset=†" is a parsable MIME type, but it's not a valid MIME type, because the parameter 'dagger' (†) character is invalid token.


https://mimesniff.spec.whatwg.org/#parsable-mime-type
A valid MIME type
is a string that matches the media-type rule defined in section 3.1.1.1 "Media Type" of RFC 7231. In particular, a valid MIME type may include parameters. [RFC7231]


     token          = 1*tchar

     tchar          = "!" / "#" / "$" / "%" / "&" / "'" / "*"
                    / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
                    / DIGIT / ALPHA
                    ; any VCHAR, except delimiters

Maybe I'm wrong. Anne, what do you think?
Flags: needinfo?(annevk)
Since the dagger is outside ASCII it cannot be parsed technically I think.
Flags: needinfo?(annevk)
(In reply to Anne (:annevk) from comment #4)
> Since the dagger is outside ASCII it cannot be parsed technically I think.

https://mimesniff.spec.whatwg.org/#parsable-mime-type
Okay, I wonder why they have to distinguish between a parsable MIME type and a valid MIME type.
Sometimes there are differences between what the parser can return and what is actually valid to write.

  <style>body { color:green</style>

parses as

  <style>body { color:green }</style>

but only the latter is valid.

It might not be worth fixing that particular test for now though since I suspect nobody has done sufficient research yet on how MIME types are actually parsed by various browsers.
Attachment #8866157 - Flags: review?(amarchesini) → review+
Attachment #8866169 - Flags: review?(amarchesini) → review+
Pushed by shuang@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/5dbfb3a8d5cc
Part1: Use text/xml as fallback response MIME type, r=baku
https://hg.mozilla.org/integration/mozilla-inbound/rev/b99e360725c8
Part2: Fallback override MIME type to application/octet-stream, r=baku
https://hg.mozilla.org/mozilla-central/rev/5dbfb3a8d5cc
https://hg.mozilla.org/mozilla-central/rev/b99e360725c8
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.