This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 16728 - Blob.type
Summary: Blob.type
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: File API (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Arun
QA Contact: public-webapps-bugzilla
Depends on:
Blocks: 16950
  Show dependency treegraph
Reported: 2012-04-13 12:00 UTC by Simon Pieters
Modified: 2012-05-07 06:46 UTC (History)
4 users (show)

See Also:


Description Simon Pieters 2012-04-13 12:00:19 UTC
"The ASCII-encoded string in lower case representing the media type of the Blob"

DOMStrings aren't ASCII-encoded. If type was set with the Blob() constructor, it isn't necessarily in lowercase, either.
Comment 1 Glenn Maynard 2012-04-13 13:53:30 UTC
Is the intent for it to be restricted to the ASCII subset, and/or converted to lowercase in the ctor?
Comment 2 Arun 2012-04-17 19:57:29 UTC
I looked at RFC2046 and at the HTML5 specification, which
Comment 3 Arun 2012-04-17 19:59:32 UTC
*sigh Sorry for Comment 2; I submitted too soon.

I looked at RFC2046 and at the HTML5 specification, which defines a valid MIME type string as matching RFC2616's media types section (3.7), to see if MIME type strings themselves are restricted to ASCII.  They aren't as far as I can tell, and so we shouldn't have this requirement.
Comment 4 Boris Zbarsky 2012-04-17 20:14:30 UTC
RFC 2616 section 3.7 says:

       media-type     = type "/" subtype *( ";" parameter )
       type           = token
       subtype        = token

Section 2.2 says:

       token          = 1*<any CHAR except CTLs or separators>

Section 2.2 says:

       CHAR           = <any US-ASCII character (octets 0 - 127)>

So MIME types are in fact restricted to ASCII.  Furthermore, they're restricted to a subset of ASCII: "except CTLs or separators".
Comment 5 Arun 2012-04-17 20:44:39 UTC
So my first reading was right, which is why the requirement was there.  But it's true that DOMStrings aren't ASCII-encoded.  We may as well ignore this, and do what we do for invalid MIME types on the platform in general.  Otherwise maybe we'd have to specify that:

1. Implementations throw if type is set with "invalid" non-ASCII chars
2. Specify that implementations do case conversion, if necessary.

Don't know if we can really do those.
Comment 6 Boris Zbarsky 2012-04-17 21:17:06 UTC
> do what we do for invalid MIME types on the platform in general.

It probably varies.  At least some implementations, in some cases, byte-deflate and ASCII-lowercase.
Comment 7 Simon Pieters 2012-04-18 07:02:55 UTC
We can do that in the Blob constructor and in Blob.slice (and anywhere else where Blobs are created with an author-specified MIME type).
Comment 8 Arun 2012-05-07 05:05:16 UTC
Marking this fixed.