Using canvas drawImage in chrome extension content script -


i'm trying use drawimage on canvas context in injected content script chrome extension.

  testcanvas = document.createelement('canvas');   testcontext = testcanvas.getcontext('2d');   var image = new image();   testcontext.drawimage(image, 0, 0); 

in chrome 26 works ok, in dev channel (chrome 28) seams broken got message:

uncaught typeerror: type error 

when move same script directly background page, works without problem.

i think can related security related change failed find relevant information.

this bug, should report it. more testing reveals in chrome 28.0.1498.0, image constructor not create valid htmlimageelement instance (as seen in screenshot below).
code run in context of content script. same code works fine on regular pages , in extension's process (background page).

to work around problem, use document.createelement('img') instead of new image().

.appendchild(new image()) error: notfounderror: dom exception 8

and don't forget report bug @ https://code.google.com/p/chromium/issues/list.


Comments

Popular posts from this blog

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -