diff --git a/dom/filesystem/Directory.cpp b/dom/filesystem/Directory.cpp index 3bdacc0017e2..916d243df43d 100644 --- a/dom/filesystem/Directory.cpp +++ b/dom/filesystem/Directory.cpp @@ -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 task = new RemoveTask(mFileSystem, mPath, file, realPath, aRecursive, aRv); if (aRv.Failed()) {