Bug 16746 - Syntax check 'type' in Blob constructor
Syntax check 'type' in Blob constructor
Status: RESOLVED FIXED
Product: WebAppsWG
Classification: Unclassified
Component: File API
unspecified
PC All
: P2 normal
: ---
Assigned To: Arun
public-webapps-bugzilla
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-16 09:39 UTC by Simon Pieters
Modified: 2012-05-07 05:07 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 :) http://dev.w3.org/2006/webapi/FileAPI/#dfn-Blob