SSL GetDirectoryListingTask.cpp
Interaktion und PortierbarkeitC
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
// this is the real path.
nsAutoString path;
aRv = mTargetPath->GetPath(path); if (NS_WARN_IF(aRv.Failed())) { return FileSystemGetDirectoryListingParams();
}
// this is the dom path.
nsAutoString directoryPath;
mDirectory->GetPath(directoryPath, aRv); if (NS_WARN_IF(aRv.Failed())) { return FileSystemGetDirectoryListingParams();
}
FileSystemDirectoryListingResponse r = aValue; for (uint32_t i = 0; i < r.data().Length(); ++i) { const FileSystemDirectoryListingResponseData& data = r.data()[i];
OwningFileOrDirectory* ofd = mTargetData.AppendElement(fallible); if (!ofd) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY); return;
}
if (data.type() == FileSystemDirectoryListingResponseData::
TFileSystemDirectoryListingResponseFile) { const FileSystemDirectoryListingResponseFile& d =
data.get_FileSystemDirectoryListingResponseFile();
// This is specific for unix root filesystem. if (!mDOMPath.EqualsLiteral(FILESYSTEM_DOM_PATH_SEPARATOR_LITERAL)) {
filePath.AppendLiteral(FILESYSTEM_DOM_PATH_SEPARATOR_LITERAL);
}
for (;;) {
nsCOMPtr<nsIFile> currFile; if (NS_WARN_IF(NS_FAILED(entries->GetNextFile(getter_AddRefs(currFile)))) ||
!currFile) { break;
} bool isLink, isSpecial, isFile; if (NS_WARN_IF(NS_FAILED(currFile->IsSymlink(&isLink)) ||
NS_FAILED(currFile->IsSpecial(&isSpecial))) || // Although we allow explicit individual selection of symlinks via the // file picker, we do not process symlinks in directory traversal. Our // specific policy decision is documented at // https://bugzilla.mozilla.org/show_bug.cgi?id=1813299#c20
isLink || isSpecial) { continue;
} if (NS_WARN_IF(NS_FAILED(currFile->IsFile(&isFile)) ||
NS_FAILED(currFile->IsDirectory(&isDir))) ||
!(isFile || isDir)) { continue;
}
if (filterOutSensitive) { bool isHidden; if (NS_WARN_IF(NS_FAILED(currFile->IsHidden(&isHidden))) || isHidden) { continue;
}
nsAutoString leafName; if (NS_WARN_IF(NS_FAILED(currFile->GetLeafName(leafName)))) { continue;
} if (leafName[0] == char16_t('.')) { continue;
}
}
nsAutoString path; if (NS_WARN_IF(NS_FAILED(currFile->GetPath(path)))) { continue;
}
bool GetDirectoryListingTaskParent::MainThreadNeeded() const {
MOZ_ASSERT(XRE_IsParentProcess(), "Only call from parent process!");
// We need to go to the main-thread only if we have files in the list of // target. for (const FileOrDirectoryPath& data : mTargetData) { if (data.mType == FileOrDirectoryPath::eFilePath) { returntrue;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.