Re: Canvas ImageData comments

On Sun, 4 May 2008, Philip Taylor wrote:
> 
> Philip Taylor wrote:
> > "If any of the arguments to createImageData() or getImageData() are infinite
> > or NaN, or if either the sw or sh arguments are zero, the method must
> > instead raise an INDEX_SIZE_ERR exception.", and "If any of the arguments to
> > the method are infinite or NaN, the method must raise an INDEX_SIZE_ERR
> > exception." - shouldn't infinite/NaN be handled with NOT_SUPPORTED_ERR, for
> > consistency with every other method? If so, that case shouldn't need
> > mentioning here, since it's implicitly handled by "Common conformance
> > requirements for APIs exposed to JavaScript".
> 
> Oops, I forgot about the part that says "Unless otherwise stated, for 
> the 2D context interface, any method call with a numeric argument whose 
> value is infinite or a NaN value must be ignored", so the "common 
> conformance requirements" section is not relevant, and the exception 
> behaviour does indeed need to be explicit for (get|create)ImageData.
> 
> But why does putImageData throw an exception? It doesn't have a return 
> value, so the call could just be ignored (to be consistent with almost 
> all other void canvas methods).

It throws an exception because there's no reason to ever get an Infinity 
or NaN value in there. It's not like you'll be doing 3D maths and end up 
dividing by zero or anything with this method call.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Friday, 13 June 2008 03:01:16 UTC