W3C home > Mailing lists > Public > public-canvas-api@w3.org > July to September 2010

Re: putImageData() exception

From: Philip Taylor <pjt47@cam.ac.uk>
Date: Sat, 17 Jul 2010 12:06:14 +0100
Message-ID: <4C418EA6.9060909@cam.ac.uk>
To: Jatinder Mann <jmann@microsoft.com>
CC: "'public-canvas-api@w3.org' (public-canvas-api@w3.org)" <public-canvas-api@w3.org>
Jatinder Mann wrote:
> The following text from Section 13 Pixel manipulation [1] is not
> clear what exception should be raised when the first argument to the
> putImageData() method is not an ImageData object:
> 
> "If any of the arguments to the method are infinite or NaN, the
> method must raise a NOT_SUPPORTED_ERR exception. If the first
> argument to the method is null or not an ImageData object then the
> putImageData() method must raise a TYPE_MISMATCH_ERR exception."
> 
> If the first argument is infinite or NaN, should a NOT_SUPPORTED_ERR
> or TYPE_MISMATCH_ERR be raised? I feel that the intention of the spec
> was that the first sentence should apply to the numeric arguments to
> this function.

The first argument can never be infinite or NaN - it will be handled by 
the WebIDL layer before the canvas spec gets a chance to look at it. Per 
http://dev.w3.org/2006/webapi/WebIDL/#es-interface it should throw a 
TypeError if you pass a Number as the first argument (though I don't 
know how well WebIDL matches reality).

The infinite/NaN behaviour shouldn't be specified here anyway, since 
HTML5 already says 
(http://dev.w3.org/html5/spec/infrastructure.html#float-nan) "Except 
where otherwise specified, if a method with an argument that is a 
floating point number type (float) is passed an Infinity or Not-a-Number 
(NaN) value, a NOT_SUPPORTED_ERR exception must be raised." - 
http://www.w3.org/Bugs/Public/show_bug.cgi?id=10193 . Hopefully that's 
clearer at applying only to numeric arguments.

-- 
Philip Taylor
pjt47@cam.ac.uk
Received on Saturday, 17 July 2010 11:06:42 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:31:50 UTC