javascript - Problems using HTML Canvas & Greasemonkey not able to drawImage() on 2D context -


in greasemonkey script, when obtain handle on htmlimageelement want use html canvas, following error in firefox's error console (i assume it's because it's enclosed in xpcnativewrapper):

error: component returned failure code: 0x80040111 (ns_error_not_available)         [nsidomcanvasrenderingcontext2d.drawimage] 

putting gm_log() statements throughout code, have traced image object i'm trying use it's initial assignment through until try use html canvas.

it's wrapped in xpcnativewrapper:

[object xpcnativewrapper [object htmlimageelement]] 

i've unwrapped htmlimageelement obtaining reference image.wrappedjsobject.

my canvas code:

var canvas = document.createelement("canvas"); canvas.width = image.width; canvas.height = image.height;  var ctx = canvas.getcontext("2d"); ctx.drawimage(image, 0, 0); 

any ideas why firefox throwing above component failure code?

i should have looked more thoroughly on google.

image.wrappedjsobject; 

works.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -