[RequestAnimationFrame]: thrown exceptions and user experience

When implementing / contributing to a requestAnimationFrame polyfill I
found this part of the specification.

> If calling the operation resulted in an exception being thrown, then
catch that exception and ignore it.

The way I use `requestAnimationFrame` is to invoke my rendering engine
every frame. (specifically it's a React-like virtual-dom rendering engine).

I spend a few hours debugging why there was a rendering artifact on my web
page and released there was a bug in my rendering engine that was being
swallowed by the `requestAnimationFrame` polyfill I was using.

My first gut reaction was to remove the painpoint that hid a useful
exception from my code ( https://github.com/chrisdickinson/raf/pull/20 ).

It seems incredibly unintuitive for a core timing primitive to swallow and
ignore exceptions, this makes debugging incredibly difficult and painful.

For reference point, reading the `setTimeout` specification (
http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html )
it sounds like it doesn't do any special exception handling.

Received on Monday, 23 June 2014 17:22:47 UTC