[html5] toDataURL calling itself causes security error

chris at martinilab.com chris at martinilab.com
Thu Jun 18 11:34:45 PDT 2009


On Thu, Jun 18, 2009 at 6:53 PM, <chris at martinilab.com> wrote:
> It's a bug according to the security rules in HTML 5 (or at least it
> was when I last checked), and was broken in all implementations (when
> I last checked, ages ago). Sounds like
> https://bugzilla.mozilla.org/show_bug.cgi?id=417836 fixes it,
> presumably for Firefox 3.5, but I haven't tested that.

Good to know!  

> Do you have to use toDataURL? e.g. could you construct a new temporary
> canvas element, then draw from the current canvas onto it, then draw
> back, instead of using an Image? i.e. something like
> 
>   var tmp = document.createElement('canvas');
>   tmp.width = canvas.width;
>   tmp.height = canvas.height;
>   ctx.drawImage(tmp, 0, 0);
>   tmp.getContext('2d').drawImage(canvas, 0, 0);

That works great actually. Thanks so much!

Chris Williams
http://www.martinilab.com




More information about the Help mailing list