W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

Re: [FileAPI] FileReader.readAsXXX when pased null

From: Cameron McCormack <cam@mcc.id.au>
Date: Thu, 7 Jul 2011 17:13:25 +1200
To: Arun Ranganathan <arun@mozilla.com>
Cc: Adrian Bateman <adrianba@microsoft.com>, "Web Applications Working Group WG (public-webapps@w3.org)" <public-webapps@w3.org>, "Jonas Sicking (jonas@sicking.cc)" <jonas@sicking.cc>
Message-ID: <20110707051325.GG21787@wok.mcc.id.au>
Hi Arun,

Adrian Bateman:
> > The spec doesn't seem to state this explicitly and I can't tell if
> > there is supposed to be an implicit requirement from WebIDL. Perhaps
> > the expectation is that this falls into the error condition and
> > should set readyState to DONE, result to null, and process the error
> > steps? Any thoughts?

Arun Ranganathan:
> My thoughts are that this should be an OperationNotAllowedException,
> and that this should be better defined.
> 
> IMHO WebIDL doesn't touch on what happens when a method within a
> given API is called with null, so I think you're right to point this
> issue out (thanks!).

There was a recent change in Web IDL which made interface types (like
the readAsXXX argument types) not include null by default, and if you
want to allow null, to write it as “Type?”.  If you don’t change the
type in the File API spec to include the question mark, then Web IDL
defines it so that passing null means a TypeError will be thrown.

If you want to do some additional processing beyond throwing an
exception (e.g. setting readyState), then you would need to allow null
by using “Blob?” as the type and then say what happens when null is
passed in.

-- 
Cameron McCormack ≝ http://mcc.id.au/
Received on Thursday, 7 July 2011 05:13:57 GMT

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