I’m developing a plugin that downloads a image from a url and copies it to the clipboard.
Right now, I am able to download it’s Base64 binary, encode it to base64 string and display it in a tag.
However, when I try to copy it to the clipboard, I recieve this error:
JPM [error] Message: Error: Unable to decode data given in a valid image.
Stack:
exports.set@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/clipboard.js:165:15
@resource://gre/modules/commonjs/toolkit/loader.js -> resource://snapit/index.js:285:3
emit@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/event/core.js:97:9
portEmit@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/content/sandbox.js:321:7
emit@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/event/core.js:97:9
onContentEvent/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/content/sandbox.js:362:5
delay/<@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/lang/functional/concurrent.js:38:20
notify@resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/timers.js:40:9
I’ve described and gave an example here: http://stackoverflow.com/questions/32981752/unable-to-copy-image-to-clipboard-in-firefox-addon-development
Any thoughts of what I’m doing wrong?