Added an error catch to all instances of canvas.toDataUrl

This allows the test to fail cleanly on intermittent failures seen in Chrome.