Revert to previous no-parameter (image/png) behavior if an exception is

encountered while calling canvas toDataURL() with parameters.  See this
forum post: http://www.kineticjs.com/forum/viewtopic.php?f=10&t=423
This commit is contained in:
Jason Follas 2012-04-01 11:00:58 -04:00
parent 98917fe644
commit 96659d7299

View File

@ -161,7 +161,15 @@ Kinetic.Stage.prototype = {
addLayer(n);
}
else {
callback(bufferLayer.getCanvas().toDataURL(mimeType, quality));
try {
// If this call fails (due to browser bug, like in Firefox 3.6),
// then revert to previous no-parameter image/png behavior
callback(bufferLayer.getCanvas().toDataURL(mimeType, quality));
}
catch(exception)
{
callback(bufferLayer.getCanvas().toDataURL());
}
}
};
imageObj.src = dataURL;