W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2013

Re: File API: Blob.type

From: Glenn Maynard <glenn@zewt.org>
Date: Wed, 6 Mar 2013 18:42:23 -0600
Message-ID: <CABirCh8UAb0rgLR=M18qA1a+sJxnE69u-Z7=bNsQt0=4VWBWpg@mail.gmail.com>
To: Anne van Kesteren <annevk@annevk.nl>
Cc: WebApps WG <public-webapps@w3.org>, Alexey Proskuryakov <ap@webkit.org>, Arun Ranganathan <arun@mozilla.com>, Jonas Sicking <jonas@sicking.cc>
On Wed, Mar 6, 2013 at 8:29 AM, Anne van Kesteren <annevk@annevk.nl> wrote:

> On Wed, Mar 6, 2013 at 2:21 PM, Glenn Maynard <glenn@zewt.org> wrote:
> > Blob.type is a MIME type, not a Content-Type header.  It's a string of
> > codepoints, not a series of bytes.  XHR is a protocol-level API, so
> maybe it
> > makes sense there, but it doesn't make sense for Blob.
>
> It's a Content-Type header value and should have those restrictions.
>

It's not a Content-Type header, it's a MIME type.  That's part of a
Content-Type header, but they're not the same thing.

But String vs. ByteString has nothing to do with the restrictions applied
to it.

Making it a ByteString plus additional restrictions will make it do as
> required.
>

That doesn't make sense.  Blob.type isn't a string of bytes, it's a string
of Unicode codepoints that happens to be restricted to the ASCII range.
Applying WebKit's validity checks (with the addition of disallowing
nonprintable characters) will make it have the restrictions you want;
ByteString has nothing to do with this.


On Wed, Mar 6, 2013 at 11:47 AM, Darin Fisher <darin@chromium.org> wrote:

> So the intent is to allow specifying attributes like "charset"?  That
> sounds useful.
>

I don't think so.  This isn't very well-defined by RFC2046 (it seems vague
about the relationship of parameters to MIME types), but I'm pretty sure
Blob.type is meant to be only a MIME type, not a MIME type plus
content-type parameters.  Also, it would lead to a poor API: you could no
longer simply say 'if(blob.type == "text/plain")'; you'd have to parse it
out yourself (which I expect nobody is actually doing).

Other parameters should have a separate interface, eg.
blob.typeParameters.charset = "UTF-8", if we want that.

-- 
Glenn Maynard
Received on Thursday, 7 March 2013 00:42:50 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:57 GMT