title: Manipulating <canvas> image data in Firefox extension
body: <p>In my extension I'd like to manipulate some images. So I'm trying to read their raw pixels using canvas. 
  The problem is that if, in chrome code, I execute (<code>img</code> is an image in a content document):</p>
  
  <pre><code>var src = document.createElement("canvas");
  src.width = img.naturalWidth;
  src.height = img.naturalHeight;
  var srcCtx = src.getContext("2d");
  </code></pre>
  
  <p>on the last line it says that <code>getContext</code> is not a function.
  On the other hand if I run (notice that the first line is different!):</p>
  
  <pre><code>var src = img.ownerDocument.createElement("canvas");
  src.width = img.naturalWidth;
  src.height = img.naturalHeight;
  var srcCtx = src.getContext("2d");
  srcCtx.drawImage(img, 0, 0);
  var src_data = srcCtx.getImageData(0, 0, src.width, src.height);
  </code></pre>
  
  <p>no error is returned, but <code>src_data</code> comes out empty. I suppose it may have something to do with accessing web content from chrome code. Any suggestion?</p>