[whatwg] Error handling for MIME type parsing (canPlayType)

Philip Jägenstedt philipj at opera.com
Tue Jul 14 05:56:26 PDT 2009


While implementing canPlayType I've found that Firefox/Safari/Chrome (and  
now Opera) all have different error handling in parsing the MIME types.  
RFC 2045[1] gives the BNF form, but it appears that no browser gives much  
weight to this.

Sample of quirks:

(Ignore "no" vs "" here, it's not relevant)

Firefox:

AUDIO/X-WAV: "no"
audio/x-wav codecs: "maybe"
audio/x-wav; codecs=: "probably"
audio/x-wav; codecs=,: "no"

Safari:

AUDIO/X-WAV: "no"
audio/x-wav codecs: "no"
audio/x-wav; codecs=: "probably"
audio/x-wav; codecs=,: "maybe"

Opera internal:

AUDIO/X-WAV: ""
audio/x-wav codecs: ""
audio/x-wav; codecs=: "maybe"
audio/x-wav; codecs=,: "maybe"

Chrome ignores codecs, so I can't get meaningful results.

I believe the correct answers are:

AUDIO/X-WAV: same as for audio/x-wav (by RFC 2045, but we could ignore it  
because it looks ugly)
audio/x-wav codecs: the same as audio/x-unknown-type (i.e. "no" for  
Firefox)
audio/x-wav; codecs=: same as audio/x-wav (unless we want this to mean "no  
codecs", in which case "no" would be more appropriate)
audio/x-wav; codecs=,: same as audio/x-wav (i.e. ignore broken codecs  
parameter)

Has there been any work done on defining error handling for Content-Type  
parsing or the like? It wouldn't be fun to get cross-browser bugs as soon  
as someone forgets a semicolon...

-- 
Philip Jägenstedt
Core Developer
Opera Software



More information about the whatwg mailing list