Bug 1692305 - Intermittent file removal failure in browser_unknownContentType_extension.js. r=mtigley

Differential Revision: https://phabricator.services.mozilla.com/D126675
This commit is contained in:
Marco Bonardo 2021-09-30 08:30:19 +00:00
Родитель b0b4e0cd28
Коммит 2864b7afb2
2 изменённых файлов: 14 добавлений и 8 удалений

Просмотреть файл

@ -8,9 +8,6 @@ support-files =
[browser_unknownContentType_delayedbutton.js]
[browser_unknownContentType_dialog_layout.js]
[browser_unknownContentType_extension.js]
skip-if =
os == win10_2004 # Bug 1692305
win10_2004 && ccov # Bug 1727943
support-files =
unknownContentType.EXE
unknownContentType.EXE^headers^

Просмотреть файл

@ -63,11 +63,20 @@ add_task(async function test_download_filename_extension() {
dialog.getButton("accept").removeAttribute("disabled");
dialog.acceptDialog();
let download = await downloadFinishedPromise;
let f = new FileUtils.File(download.target.path);
// We cannot assume that the filename is a particular
let extensions = f.leafName.substring(f.leafName.indexOf("."));
is(extensions, ".EXE", "Should not duplicate extension");
// We cannot assume that the filename didn't change.
let filename = PathUtils.filename(download.target.path);
Assert.ok(
filename.indexOf(".") == filename.lastIndexOf("."),
"Should not duplicate extension"
);
Assert.ok(filename.endsWith(".EXE"), "Should not change extension");
await list.remove(download);
f.remove(true);
BrowserTestUtils.removeTab(tab);
try {
await IOUtils.remove(download.target.path);
} catch (ex) {
// Ignore errors in removing the file, the system may keep it locked and
// it's not a critical issue.
info("Failed to remove the file " + ex);
}
});