[whatwg] Minor addition/rewording for canvas section

Philip Taylor excors+whatwg at gmail.com
Sun Jan 13 05:33:58 PST 2008

On 13/01/2008, Oliver Hunt <oliver at apple.com> wrote:
> I did wonder about why other origins could read anything myself, so
> you're not
> alone -- it just seemed especially odd to allow images to be written
> safely but not
> ImageData.

As far as I'm aware, different origins can never read and write the
same canvas. Images are given special consideration because scripts
already have access to Image objects where the image has a different
origin to the script, like:

  // on a page on www.example.com
  var img = new Image();
  img.onload = function () { ctx.drawImage(img, 0, 0); }
  img.src = 'http://google.com/images/logo.gif';

The canvas reading/writing all happens in the same origin - it's just
the image itself that is not the same origin.

The same does not apply to ImageData, because scripts don't have
access to ImageData objects from other origins.

Philip Taylor
excors at gmail.com

More information about the whatwg mailing list