Backed out changeset a03f0155519c (bug 1870426) for causing mochitests failures in test_ioutils_read_write.html. CLOSED TREE

This commit is contained in:
Stanca Serban 2024-02-26 18:18:34 +02:00
parent b54de79827
commit 5993e595e1
2 changed files with 0 additions and 31 deletions

View file

@ -1399,21 +1399,6 @@ Result<uint32_t, IOUtils::IOError> IOUtils::WriteSync(
// If backupFile was specified, perform the backup as a move.
if (exists && backupFile) {
bool isDirectory = false;
IOUTILS_TRY_WITH_CONTEXT(
backupFile->IsDirectory(&isDirectory),
"Could not write to `%s': could not stat backup file `%s'",
aFile->HumanReadablePath().get(),
backupFile->HumanReadablePath().get());
if (isDirectory) {
return Err(
IOError(NS_ERROR_FILE_IS_DIRECTORY,
"Could not write to `%s': backup file `%s' is a directory",
aFile->HumanReadablePath().get(),
backupFile->HumanReadablePath().get()));
}
// We copy `destFile` here to a new `nsIFile` because
// `nsIFile::MoveToFollowingLinks` will update the path of the file. If we
// did not do this, we would end up having `destFile` point to the same

View file

@ -502,22 +502,6 @@
/NotFoundError: Could not write to `.*': failed to open file for writing/
);
});
add_task(async function test_write_backupFile_directory() {
const tempDir = PathUtils.join(PathUtils.tempDir, "test_ioutils_write_backupFile_directory");
await IOUtils.makeDirectory(tempDir);
const subdir = PathUtils.join(tempDir, "subdir");
await IOUtils.makeDirectory(subdir);
const fileName = PathUtils.join(tempDir, "file.txt");
await IOUtils.write(fileName, Uint8Array.of());
await Assert.rejects(
IOUtils.writeUTF8(fileName, Uint8Array.of(), { backupFile: subdir }),
/Could not write to `.*': backup file `.*' is a directory/
);
});
</script>
</head>