Bug 1144298 - Eliminate gratuitous gotos from Directory::RemoveInternal(). r=baku

--HG--
extra : rebase_source : c9194f875c3cff90649b80e5904812597934968f
This commit is contained in:
Andrew McCreight 2015-04-20 12:48:15 -07:00
Родитель 4b23d60c58
Коммит 291b55ca2c
1 изменённых файлов: 8 добавлений и 17 удалений

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

@ -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()) {