There is no API yet for screens. You can capture a whole firefox window though using drawWindow
from here: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D#drawWindow()
For the screens I wrote a worker that holds the function. I can hook you up with that, you will have to setup PromiseWorker, then copy paste the worker and its dependencies to your addon. Then you can use it like this:
var promise_shoot = MainWorker.post('shootAllMons', []);
promise_shoot.then(
function(aVal) {
console.log('Fullfilled - promise_shoot - ', aVal);
// aVal is an object, with an entry per screen. each entry holds buffer, which you should put into ImageData then put to canvas OR straight right to file. entry also holds screen widht and height, and some other goodies
},
function(aReason) {
var rejObj = {name:'promise_shoot', aReason:aReason};
console.warn('Rejected - promise_shoot - ', rejObj);
Services.prompt.alert(Services.wm.getMostRecentWindow('navigator:browser'), 'error', 'something went wrong internally, see browser console for details');
}
).catch(
function(aCaught) {
var rejObj = {name:'promise_shoot', aCaught:aCaught};
console.error('Caught - promise_shoot - ', rejObj);
Services.prompt.alert(Services.wm.getMostRecentWindow('navigator:browser'), 'NativeShot - Developer Error', 'Developer did something wrong in the code, see Browser Console.');
}
);
The worker and its dependencies are here: https://github.com/Noitidart/NativeShot/tree/master/modules
It should take 10min to setup and get to using it, if you need help jump on IRC my name is noida, im in extdev and i can help you over teamveiwer.
Heres html5 client to irc: https://client00.chat.mibbit.com/?url=irc%3A%2F%2Firc.mozilla.org%2F%23extdev