forked from mirrors/gecko-dev
Backed out changeset a03f0155519c (bug 1870426) for causing mochitests failures in test_ioutils_read_write.html. CLOSED TREE
This commit is contained in:
parent
b54de79827
commit
5993e595e1
2 changed files with 0 additions and 31 deletions
|
|
@ -1399,21 +1399,6 @@ Result<uint32_t, IOUtils::IOError> IOUtils::WriteSync(
|
||||||
|
|
||||||
// If backupFile was specified, perform the backup as a move.
|
// If backupFile was specified, perform the backup as a move.
|
||||||
if (exists && backupFile) {
|
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
|
// We copy `destFile` here to a new `nsIFile` because
|
||||||
// `nsIFile::MoveToFollowingLinks` will update the path of the file. If we
|
// `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
|
// did not do this, we would end up having `destFile` point to the same
|
||||||
|
|
|
||||||
|
|
@ -502,22 +502,6 @@
|
||||||
/NotFoundError: Could not write to `.*': failed to open file for writing/
|
/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>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue