I'm working on a firefox 2.0+ extension that creates and then saves the
contents of a canvas. It works fine, but I can't seem to get it save
the image (via the internalSave function in contentAreaUtils.js)
without popping up the save file picker dialog. Shouldn't setting the
AutoChosen file prevent the dialog from appearing? I've spent all day
trying to get this to work, so any suggestions would be really
appreciated. Here's the relevant code:
var localfile = Components.classes["@mozilla.org/file/local;1"].
createInstance(Components.interfaces.nsILocalFile)
localfile.initWithPath("c:\\image.jpg");
var localuri = makeFileURI(localfile);
internalSave(canvas.toDataURL('image/jpeg','quality=100'), null,
'image.jpg', null, 'image/jpeg', true, null, AutoChosen(localfile,
localuri), null);
Thanks,
Dan