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 16746 - Syntax check 'type' in Blob constructor
Summary: Syntax check 'type' in Blob constructor
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:
Reported: 2012-04-16 09:39 UTC by Simon Pieters
Modified: 2012-05-07 05:07 UTC (History)
3 users (show)

See Also:


Description Simon Pieters 2012-04-16 09:39:58 UTC
new Blob([], {type:'Foobar\u00E5\uD801\uDC7E  '});

I think we should throw a SyntaxError exception if type is not a valid media type. (Not sure what to do about leading/trailing whitespace; it could throw, trim or leave as is. Also not sure whether we'd want to convert to lowercase.)
Comment 1 Arun 2012-04-17 21:19:21 UTC
(Bug 16728 is similar).

I think we should:

1. Throw on invalid media types, e.g. if any illegal chars are used or it violates the ABNF for MIME type strings.

2. Case convert to lowercase.

3. Throw on leading/trailing whitespace.  It's hard for me to conclude that we should offer syntax convenience for such an error.
Comment 2 Anne 2012-04-18 06:13:34 UTC
Sounds good to me.
Comment 3 Simon Pieters 2012-04-18 07:03:51 UTC
Also do this for Blob.slice()
Comment 4 Arun 2012-05-07 05:07:45 UTC
Marking this fixed.  Check to see it's done right :)