screenshots
screenshots copied to clipboard
With Ask where to save, Save As dialog starts in default folder not lastDir
The Download button triggers a Save As file browser dialog instead of displaying the Download (Open/Save/Cancel) dialog. By contrast, the Save Screenshot extension integrates with the Download dialog by default. That latter behavior has the benefit of leveraging browser.download.lastDir
which is very convenient (it's faster to click OK a few times than to navigate the Save As dialog to a different folder over and over).
I have tried very hard to figure out why the calls to browser.downloads.download()
have such different results but I just can't see a problem in the code. Could it be related to using an iframe?
https://github.com/mozilla-services/screenshots/blob/master/webextension/background/main.js#L268
return browser.windows.getLastFocused().then(windowInfo => {
return browser.downloads.download({
url,
incognito: windowInfo.incognito,
filename: info.filename,
}).catch((error) => {
// We are not logging error message when user cancels download
if (error && error.message && !error.message.includes("canceled")) {
log.error(error.message);
}
}).then((id) => {
downloadId = id;
});
https://github.com/M-Reimer/savescreenshot/blob/master/background.js#L86
const method = prefs.savemethod || "open";
browser.downloads.download({
filename: aMessage.filename,
url: bloburi,
saveAs: (method == "saveas") ? true : false
});