RE: [FileAPI] FileReader.readAsXXX when pased null

2011-07-08 Thread Adrian Bateman
On Thursday, July 07, 2011 10:21 PM, Arun Ranganathan wrote:
> On 7/6/11 10:13 PM, Cameron McCormack wrote:
> > 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.
> 
> Wow, not only do I stand corrected, but I'm also gladdened :)  This
> change to WebIDL is a good one, and I'm sorry I missed it when it came
> out.
> 
> Adrian: this should answer your original question, although I still
> think that in general, user agents differ pretty substantially over the
> type of exceptions that are being thrown (and this is yet another
> example).  Hopefully this is something we can fix with updates.

Yes, thanks. I think this is probably a good change although I'm worried that
there might be specs that allow null and don't realise they need to update to
Type?. Hopefully, if there are any, they'll be found when their dependency on
WebIDL is reviewed.

Adrian.


Re: [FileAPI] FileReader.readAsXXX when pased null

2011-07-07 Thread Arun Ranganathan

On 7/6/11 10:13 PM, Cameron McCormack wrote:

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.


Wow, not only do I stand corrected, but I'm also gladdened :)  This 
change to WebIDL is a good one, and I'm sorry I missed it when it came out.


Adrian: this should answer your original question, although I still 
think that in general, user agents differ pretty substantially over the 
type of exceptions that are being thrown (and this is yet another 
example).  Hopefully this is something we can fix with updates.


-- A*




Re: [FileAPI] FileReader.readAsXXX when pased null

2011-07-06 Thread Cameron McCormack
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/



Re: [FileAPI] FileReader.readAsXXX when pased null

2011-07-06 Thread Arun Ranganathan

On 7/6/11 7:54 PM, Adrian Bateman wrote:

http://dev.w3.org/2006/webapi/FileAPI/#reading-a-file

What is the expected behaviour for FileReader.readAsXXX(null)? Currently
I think both IE10 and Chrome fail silently and there are no events fired
whereas Firefox appears to throw an internal NS_ERROR_INVALID_POINTER
exception.

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?


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!).


-- A*