forked from mirrors/gecko-dev
Bug 1845037 - [devtools] Revert DevTools screenshots to use the default downloads directory r=devtools-reviewers,ochameau
Revert the DevTools bits from Bug 1072345 to be consistent with the Screenshots feature from Firefox. Differential Revision: https://phabricator.services.mozilla.com/D207413
This commit is contained in:
parent
6ebde68fe8
commit
c23ab24dbd
2 changed files with 8 additions and 20 deletions
|
|
@ -327,9 +327,9 @@ function saveToClipboard(base64URI) {
|
|||
let _outputDirectory = null;
|
||||
|
||||
/**
|
||||
* Returns the default directory for screenshots.
|
||||
* If a specific directory for screenshots is not defined,
|
||||
* it falls back to the system downloads directory.
|
||||
* Returns the default directory for DevTools screenshots.
|
||||
* For consistency with the Firefox Screenshots feature, this will default to
|
||||
* the preferred downloads directory.
|
||||
*
|
||||
* @return {Promise<String>} Resolves the path as a string
|
||||
*/
|
||||
|
|
@ -338,13 +338,7 @@ async function getOutputDirectory() {
|
|||
return _outputDirectory;
|
||||
}
|
||||
|
||||
try {
|
||||
// This will throw if there is not a screenshot directory set for the platform
|
||||
_outputDirectory = Services.dirsvc.get("Scrnshts", Ci.nsIFile).path;
|
||||
} catch (e) {
|
||||
_outputDirectory = await lazy.Downloads.getPreferredDownloadsDirectory();
|
||||
}
|
||||
|
||||
_outputDirectory = await lazy.Downloads.getPreferredDownloadsDirectory();
|
||||
return _outputDirectory;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,16 +97,10 @@ add_task(async function () {
|
|||
const dayString = date.getDate().toString().padStart(2, "0");
|
||||
const expectedDateString = `${date.getFullYear()}-${monthString}-${dayString}`;
|
||||
|
||||
let screenshotDir;
|
||||
try {
|
||||
// This will throw if there is not a screenshot directory set for the platform
|
||||
screenshotDir = Services.dirsvc.get("Scrnshts", Ci.nsIFile).path;
|
||||
} catch (e) {
|
||||
const { Downloads } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Downloads.sys.mjs"
|
||||
);
|
||||
screenshotDir = await Downloads.getPreferredDownloadsDirectory();
|
||||
}
|
||||
const { Downloads } = ChromeUtils.importESModule(
|
||||
"resource://gre/modules/Downloads.sys.mjs"
|
||||
);
|
||||
const screenshotDir = await Downloads.getPreferredDownloadsDirectory();
|
||||
|
||||
const { renderedDate, filePath } =
|
||||
/Saved to (?<filePath>.*Screen Shot (?<renderedDate>\d{4}-\d{2}-\d{2}) at \d{2}.\d{2}.\d{2}\.png)/.exec(
|
||||
|
|
|
|||
Loading…
Reference in a new issue