[whatwg] Canvas API: What should happen if non-finite floats are used

On 9/8/10 2:22 PM, Oliver Hunt wrote:
> I can see a number of canvas discussions in late 2007/early 2008 on the whatwg list, so i presume that covers some of it.

OK.  All versions of Firefox threw at that point.

> It also only leads to incorrect rendering if the behaviour if it's unexpected.

Well... I guess that depends on how you define "correct rendering".  The 
case where I ran into was graphing a function; due to Webkit ignoring 
the calls that use NaN the graph is completely wrong (the actual 
function has a singularity at 0 which entirely disappears, with a smooth 
interpolation between two points pretty far away from zero shown instead).

> One old case that failed in the presence of exceptions was the old canvex demo at http://canvex.lazyilluminati.com/83/play.xhtml - this was one of the first cases i saw after trying to make webkit's implementation conform to the (older) spec by throwing exceptions on non-finite values we had many canvas using sites break so had to stop throwing.

OK.  I can believe that this was the case at the time, but it certainly 
wasn't due to Firefox not throwing.  I can see how given people's 
penchant to create browser-specific content changing the webkit behavior 
could cause issues with sites that were targeting only webkit and didn't 
bother testing in anything else.

> It seems to work these days but a quick scan of the minified source seemed to indicate that they now put try/catch around every use of canvas is now wrapped in try/catch

Right.  Which raises the question of whether this would be an issue 
nowadays.  With the exception of that one graphing demo (which was on a 
"Chrome demos" site, iirc so again is targeting webkit), we have had no 
reports of this being an issue in Gecko.

-Boris

Received on Wednesday, 8 September 2010 13:02:06 UTC