mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 1144298 - Eliminate gratuitous gotos from Directory::RemoveInternal(). r=baku
--HG-- extra : rebase_source : c9194f875c3cff90649b80e5904812597934968f
This commit is contained in:
parent
4b23d60c58
commit
291b55ca2c
@ -198,29 +198,20 @@ Directory::RemoveInternal(const StringOrFileOrDirectory& aPath, bool aRecursive,
|
||||
|
||||
if (aPath.IsFile()) {
|
||||
file = aPath.GetAsFile().Impl();
|
||||
goto parameters_check_done;
|
||||
}
|
||||
|
||||
if (aPath.IsString()) {
|
||||
} else if (aPath.IsString()) {
|
||||
if (!DOMPathToRealPath(aPath.GetAsString(), realPath)) {
|
||||
error = NS_ERROR_DOM_FILESYSTEM_INVALID_PATH_ERR;
|
||||
}
|
||||
goto parameters_check_done;
|
||||
}
|
||||
|
||||
if (!mFileSystem->IsSafeDirectory(&aPath.GetAsDirectory())) {
|
||||
} else if (!mFileSystem->IsSafeDirectory(&aPath.GetAsDirectory())) {
|
||||
error = NS_ERROR_DOM_SECURITY_ERR;
|
||||
goto parameters_check_done;
|
||||
} else {
|
||||
realPath = aPath.GetAsDirectory().mPath;
|
||||
// The target must be a descendant of this directory.
|
||||
if (!FileSystemUtils::IsDescendantPath(mPath, realPath)) {
|
||||
error = NS_ERROR_DOM_FILESYSTEM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
realPath = aPath.GetAsDirectory().mPath;
|
||||
// The target must be a descendant of this directory.
|
||||
if (!FileSystemUtils::IsDescendantPath(mPath, realPath)) {
|
||||
error = NS_ERROR_DOM_FILESYSTEM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
|
||||
parameters_check_done:
|
||||
|
||||
nsRefPtr<RemoveTask> task = new RemoveTask(mFileSystem, mPath, file, realPath,
|
||||
aRecursive, aRv);
|
||||
if (aRv.Failed()) {
|
||||
|
Loading…
Reference in New Issue
Block a user