2015-06-23 02:31:32 +03:00
|
|
|
/* -*- 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/. */
|
|
|
|
|
|
|
|
#include "GetDirectoryListingTask.h"
|
|
|
|
|
2015-10-09 17:59:40 +03:00
|
|
|
#include "HTMLSplitOnSpacesTokenizer.h"
|
2015-06-23 02:31:32 +03:00
|
|
|
#include "js/Value.h"
|
2017-02-16 20:26:38 +03:00
|
|
|
#include "mozilla/dom/FileBlobImpl.h"
|
2015-06-23 02:31:32 +03:00
|
|
|
#include "mozilla/dom/FileSystemBase.h"
|
|
|
|
#include "mozilla/dom/FileSystemUtils.h"
|
2017-04-24 13:16:49 +03:00
|
|
|
#include "mozilla/dom/IPCBlobUtils.h"
|
2016-04-09 21:17:02 +03:00
|
|
|
#include "mozilla/dom/PFileSystemParams.h"
|
2015-06-23 02:31:32 +03:00
|
|
|
#include "mozilla/dom/Promise.h"
|
2017-03-08 22:15:45 +03:00
|
|
|
#include "mozilla/dom/UnionTypes.h"
|
2015-06-23 02:31:32 +03:00
|
|
|
#include "nsIFile.h"
|
2017-03-08 22:15:45 +03:00
|
|
|
#include "nsISimpleEnumerator.h"
|
2017-12-07 03:52:51 +03:00
|
|
|
#include "nsString.h"
|
2015-06-23 02:31:32 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
2016-04-09 21:17:02 +03:00
|
|
|
/**
|
2016-04-09 21:17:28 +03:00
|
|
|
* GetDirectoryListingTaskChild
|
2016-04-09 21:17:02 +03:00
|
|
|
*/
|
|
|
|
|
2016-04-09 21:17:28 +03:00
|
|
|
/* static */ already_AddRefed<GetDirectoryListingTaskChild>
|
|
|
|
GetDirectoryListingTaskChild::Create(FileSystemBase* aFileSystem,
|
2016-05-13 14:11:38 +03:00
|
|
|
Directory* aDirectory,
|
2016-04-09 21:17:28 +03:00
|
|
|
nsIFile* aTargetPath,
|
|
|
|
const nsAString& aFilters,
|
|
|
|
ErrorResult& aRv)
|
2016-03-20 00:29:46 +03:00
|
|
|
{
|
|
|
|
MOZ_ASSERT(aFileSystem);
|
2016-05-13 14:11:38 +03:00
|
|
|
MOZ_ASSERT(aDirectory);
|
2016-04-12 15:50:38 +03:00
|
|
|
aFileSystem->AssertIsOnOwningThread();
|
2016-03-20 13:56:10 +03:00
|
|
|
|
2016-03-20 05:44:22 +03:00
|
|
|
nsCOMPtr<nsIGlobalObject> globalObject =
|
2016-03-20 13:56:10 +03:00
|
|
|
do_QueryInterface(aFileSystem->GetParentObject());
|
2016-03-20 13:56:10 +03:00
|
|
|
if (NS_WARN_IF(!globalObject)) {
|
|
|
|
aRv.Throw(NS_ERROR_FAILURE);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2017-04-05 10:47:56 +03:00
|
|
|
RefPtr<GetDirectoryListingTaskChild> task =
|
|
|
|
new GetDirectoryListingTaskChild(globalObject, aFileSystem, aDirectory,
|
|
|
|
aTargetPath, aFilters);
|
|
|
|
|
|
|
|
// aTargetPath can be null. In this case SetError will be called.
|
|
|
|
|
2016-03-20 13:56:10 +03:00
|
|
|
task->mPromise = Promise::Create(globalObject, aRv);
|
|
|
|
if (NS_WARN_IF(aRv.Failed())) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return task.forget();
|
|
|
|
}
|
|
|
|
|
2017-04-05 10:47:56 +03:00
|
|
|
GetDirectoryListingTaskChild::GetDirectoryListingTaskChild(nsIGlobalObject* aGlobalObject,
|
|
|
|
FileSystemBase* aFileSystem,
|
2016-05-13 14:11:38 +03:00
|
|
|
Directory* aDirectory,
|
2016-04-09 21:17:28 +03:00
|
|
|
nsIFile* aTargetPath,
|
|
|
|
const nsAString& aFilters)
|
2017-04-05 10:47:56 +03:00
|
|
|
: FileSystemTaskChildBase(aGlobalObject, aFileSystem)
|
2016-05-13 14:11:38 +03:00
|
|
|
, mDirectory(aDirectory)
|
2016-03-20 13:56:10 +03:00
|
|
|
, mTargetPath(aTargetPath)
|
|
|
|
, mFilters(aFilters)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aFileSystem);
|
2016-04-12 15:50:38 +03:00
|
|
|
aFileSystem->AssertIsOnOwningThread();
|
2015-06-23 02:31:32 +03:00
|
|
|
}
|
|
|
|
|
2016-04-09 21:17:28 +03:00
|
|
|
GetDirectoryListingTaskChild::~GetDirectoryListingTaskChild()
|
2015-06-23 02:31:32 +03:00
|
|
|
{
|
2016-04-12 15:50:38 +03:00
|
|
|
mFileSystem->AssertIsOnOwningThread();
|
2015-06-23 02:31:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<Promise>
|
2016-04-09 21:17:28 +03:00
|
|
|
GetDirectoryListingTaskChild::GetPromise()
|
2015-06-23 02:31:32 +03:00
|
|
|
{
|
2016-04-12 15:50:38 +03:00
|
|
|
mFileSystem->AssertIsOnOwningThread();
|
2015-10-18 08:24:48 +03:00
|
|
|
return RefPtr<Promise>(mPromise).forget();
|
2015-06-23 02:31:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
FileSystemParams
|
2016-04-09 21:17:28 +03:00
|
|
|
GetDirectoryListingTaskChild::GetRequestParams(const nsString& aSerializedDOMPath,
|
|
|
|
ErrorResult& aRv) const
|
2015-06-23 02:31:32 +03:00
|
|
|
{
|
2016-04-12 15:50:38 +03:00
|
|
|
mFileSystem->AssertIsOnOwningThread();
|
2016-03-20 13:56:10 +03:00
|
|
|
|
2017-02-01 09:33:18 +03:00
|
|
|
// this is the real path.
|
2016-03-20 13:56:10 +03:00
|
|
|
nsAutoString path;
|
|
|
|
aRv = mTargetPath->GetPath(path);
|
|
|
|
if (NS_WARN_IF(aRv.Failed())) {
|
|
|
|
return FileSystemGetDirectoryListingParams();
|
|
|
|
}
|
|
|
|
|
2017-02-01 09:33:18 +03:00
|
|
|
// this is the dom path.
|
|
|
|
nsAutoString directoryPath;
|
|
|
|
mDirectory->GetPath(directoryPath, aRv);
|
|
|
|
if (NS_WARN_IF(aRv.Failed())) {
|
|
|
|
return FileSystemGetDirectoryListingParams();
|
|
|
|
}
|
|
|
|
|
2016-03-20 13:56:10 +03:00
|
|
|
return FileSystemGetDirectoryListingParams(aSerializedDOMPath, path,
|
2017-02-01 09:33:18 +03:00
|
|
|
directoryPath, mFilters);
|
2015-06-23 02:31:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2016-04-09 21:17:28 +03:00
|
|
|
GetDirectoryListingTaskChild::SetSuccessRequestResult(const FileSystemResponseValue& aValue,
|
|
|
|
ErrorResult& aRv)
|
2015-06-23 02:31:32 +03:00
|
|
|
{
|
2016-04-12 15:50:38 +03:00
|
|
|
mFileSystem->AssertIsOnOwningThread();
|
2015-06-23 02:31:32 +03:00
|
|
|
MOZ_ASSERT(aValue.type() ==
|
|
|
|
FileSystemResponseValue::TFileSystemDirectoryListingResponse);
|
|
|
|
|
|
|
|
FileSystemDirectoryListingResponse r = aValue;
|
2016-03-20 13:56:10 +03:00
|
|
|
for (uint32_t i = 0; i < r.data().Length(); ++i) {
|
|
|
|
const FileSystemDirectoryListingResponseData& data = r.data()[i];
|
2015-06-23 02:31:32 +03:00
|
|
|
|
2017-02-01 09:33:18 +03:00
|
|
|
OwningFileOrDirectory* ofd = mTargetData.AppendElement(fallible);
|
|
|
|
if (!ofd) {
|
|
|
|
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
return;
|
|
|
|
}
|
2016-03-30 09:18:32 +03:00
|
|
|
|
2016-04-09 21:15:50 +03:00
|
|
|
if (data.type() == FileSystemDirectoryListingResponseData::TFileSystemDirectoryListingResponseFile) {
|
2017-02-01 09:33:18 +03:00
|
|
|
const FileSystemDirectoryListingResponseFile& d =
|
|
|
|
data.get_FileSystemDirectoryListingResponseFile();
|
|
|
|
|
2017-04-24 13:16:49 +03:00
|
|
|
RefPtr<BlobImpl> blobImpl = IPCBlobUtils::Deserialize(d.blob());
|
2017-02-01 09:33:18 +03:00
|
|
|
MOZ_ASSERT(blobImpl);
|
|
|
|
|
|
|
|
RefPtr<File> file = File::Create(mFileSystem->GetParentObject(), blobImpl);
|
|
|
|
MOZ_ASSERT(file);
|
|
|
|
|
|
|
|
ofd->SetAsFile() = file;
|
2016-03-20 13:56:10 +03:00
|
|
|
} else {
|
|
|
|
MOZ_ASSERT(data.type() == FileSystemDirectoryListingResponseData::TFileSystemDirectoryListingResponseDirectory);
|
2017-02-01 09:33:18 +03:00
|
|
|
const FileSystemDirectoryListingResponseDirectory& d =
|
|
|
|
data.get_FileSystemDirectoryListingResponseDirectory();
|
2016-03-20 13:56:10 +03:00
|
|
|
|
2017-02-01 09:33:18 +03:00
|
|
|
nsCOMPtr<nsIFile> path;
|
|
|
|
aRv = NS_NewLocalFile(d.directoryRealPath(), true, getter_AddRefs(path));
|
|
|
|
if (NS_WARN_IF(aRv.Failed())) {
|
|
|
|
return;
|
|
|
|
}
|
2016-03-30 09:18:32 +03:00
|
|
|
|
2017-02-01 09:33:18 +03:00
|
|
|
RefPtr<Directory> directory =
|
|
|
|
Directory::Create(mFileSystem->GetParentObject(), path, mFileSystem);
|
|
|
|
MOZ_ASSERT(directory);
|
|
|
|
|
|
|
|
ofd->SetAsDirectory() = directory;
|
2016-03-20 13:56:10 +03:00
|
|
|
}
|
2015-06-23 02:31:32 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-09 21:17:02 +03:00
|
|
|
void
|
2016-04-09 21:17:28 +03:00
|
|
|
GetDirectoryListingTaskChild::HandlerCallback()
|
2016-04-09 21:17:02 +03:00
|
|
|
{
|
2016-04-12 15:50:38 +03:00
|
|
|
mFileSystem->AssertIsOnOwningThread();
|
|
|
|
|
2016-04-09 21:17:02 +03:00
|
|
|
if (mFileSystem->IsShutdown()) {
|
|
|
|
mPromise = nullptr;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (HasError()) {
|
|
|
|
mPromise->MaybeReject(mErrorValue);
|
|
|
|
mPromise = nullptr;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-02-01 09:33:18 +03:00
|
|
|
mPromise->MaybeResolve(mTargetData);
|
2016-04-09 21:17:02 +03:00
|
|
|
mPromise = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GetDirectoryListingTaskParent
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* static */ already_AddRefed<GetDirectoryListingTaskParent>
|
|
|
|
GetDirectoryListingTaskParent::Create(FileSystemBase* aFileSystem,
|
|
|
|
const FileSystemGetDirectoryListingParams& aParam,
|
|
|
|
FileSystemRequestParent* aParent,
|
|
|
|
ErrorResult& aRv)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(XRE_IsParentProcess(), "Only call from parent process!");
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aFileSystem);
|
|
|
|
|
|
|
|
RefPtr<GetDirectoryListingTaskParent> task =
|
|
|
|
new GetDirectoryListingTaskParent(aFileSystem, aParam, aParent);
|
|
|
|
|
2017-01-18 06:48:29 +03:00
|
|
|
aRv = NS_NewLocalFile(aParam.realPath(), true,
|
|
|
|
getter_AddRefs(task->mTargetPath));
|
2016-04-09 21:17:02 +03:00
|
|
|
if (NS_WARN_IF(aRv.Failed())) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return task.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
GetDirectoryListingTaskParent::GetDirectoryListingTaskParent(FileSystemBase* aFileSystem,
|
|
|
|
const FileSystemGetDirectoryListingParams& aParam,
|
|
|
|
FileSystemRequestParent* aParent)
|
|
|
|
: FileSystemTaskParentBase(aFileSystem, aParam, aParent)
|
2017-02-01 09:33:18 +03:00
|
|
|
, mDOMPath(aParam.domPath())
|
2016-04-09 21:17:02 +03:00
|
|
|
, mFilters(aParam.filters())
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(XRE_IsParentProcess(), "Only call from parent process!");
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
MOZ_ASSERT(aFileSystem);
|
|
|
|
}
|
|
|
|
|
|
|
|
FileSystemResponseValue
|
|
|
|
GetDirectoryListingTaskParent::GetSuccessRequestResult(ErrorResult& aRv) const
|
|
|
|
{
|
|
|
|
AssertIsOnBackgroundThread();
|
|
|
|
|
|
|
|
nsTArray<FileSystemDirectoryListingResponseData> inputs;
|
|
|
|
|
|
|
|
for (unsigned i = 0; i < mTargetData.Length(); i++) {
|
2017-02-01 09:33:18 +03:00
|
|
|
if (mTargetData[i].mType == FileOrDirectoryPath::eFilePath) {
|
|
|
|
nsCOMPtr<nsIFile> path;
|
|
|
|
nsresult rv = NS_NewLocalFile(mTargetData[i].mPath, true,
|
|
|
|
getter_AddRefs(path));
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
2017-07-04 06:39:43 +03:00
|
|
|
continue;
|
2017-02-01 09:33:18 +03:00
|
|
|
}
|
|
|
|
|
2016-04-09 21:17:02 +03:00
|
|
|
FileSystemDirectoryListingResponseFile fileData;
|
2017-02-16 20:26:38 +03:00
|
|
|
RefPtr<BlobImpl> blobImpl = new FileBlobImpl(path);
|
2017-02-01 09:33:18 +03:00
|
|
|
|
|
|
|
nsAutoString filePath;
|
|
|
|
filePath.Assign(mDOMPath);
|
|
|
|
|
|
|
|
// This is specific for unix root filesystem.
|
|
|
|
if (!mDOMPath.EqualsLiteral(FILESYSTEM_DOM_PATH_SEPARATOR_LITERAL)) {
|
|
|
|
filePath.AppendLiteral(FILESYSTEM_DOM_PATH_SEPARATOR_LITERAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAutoString name;
|
|
|
|
blobImpl->GetName(name);
|
|
|
|
filePath.Append(name);
|
2017-02-06 13:07:54 +03:00
|
|
|
blobImpl->SetDOMPath(filePath);
|
2017-02-01 09:33:18 +03:00
|
|
|
|
2017-04-24 13:16:49 +03:00
|
|
|
IPCBlob ipcBlob;
|
|
|
|
rv =
|
|
|
|
IPCBlobUtils::Serialize(blobImpl, mRequestParent->Manager(), ipcBlob);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
2017-07-04 06:39:43 +03:00
|
|
|
continue;
|
2017-04-24 13:16:49 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fileData.blob() = ipcBlob;
|
2016-04-09 21:17:02 +03:00
|
|
|
inputs.AppendElement(fileData);
|
|
|
|
} else {
|
2017-02-01 09:33:18 +03:00
|
|
|
MOZ_ASSERT(mTargetData[i].mType == FileOrDirectoryPath::eDirectoryPath);
|
2016-04-09 21:17:02 +03:00
|
|
|
FileSystemDirectoryListingResponseDirectory directoryData;
|
|
|
|
directoryData.directoryRealPath() = mTargetData[i].mPath;
|
|
|
|
inputs.AppendElement(directoryData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FileSystemDirectoryListingResponse response;
|
|
|
|
response.data().SwapElements(inputs);
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
|
2015-06-23 02:31:32 +03:00
|
|
|
nsresult
|
2016-04-09 21:17:02 +03:00
|
|
|
GetDirectoryListingTaskParent::IOWork()
|
2015-06-23 02:31:32 +03:00
|
|
|
{
|
2015-07-04 04:29:00 +03:00
|
|
|
MOZ_ASSERT(XRE_IsParentProcess(),
|
2015-06-23 02:31:32 +03:00
|
|
|
"Only call from parent process!");
|
|
|
|
MOZ_ASSERT(!NS_IsMainThread(), "Only call on worker thread!");
|
|
|
|
|
|
|
|
if (mFileSystem->IsShutdown()) {
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool exists;
|
2016-03-20 13:56:10 +03:00
|
|
|
nsresult rv = mTargetPath->Exists(&exists);
|
2015-06-23 02:31:32 +03:00
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!exists) {
|
2016-04-18 10:32:59 +03:00
|
|
|
if (!mFileSystem->ShouldCreateDirectory()) {
|
|
|
|
return NS_ERROR_DOM_FILE_NOT_FOUND_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = mTargetPath->Create(nsIFile::DIRECTORY_TYPE, 0777);
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
2015-06-23 02:31:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Get isDirectory.
|
|
|
|
bool isDir;
|
2016-03-20 13:56:10 +03:00
|
|
|
rv = mTargetPath->IsDirectory(&isDir);
|
2015-06-23 02:31:32 +03:00
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isDir) {
|
|
|
|
return NS_ERROR_DOM_FILESYSTEM_TYPE_MISMATCH_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsISimpleEnumerator> entries;
|
2016-03-20 13:56:10 +03:00
|
|
|
rv = mTargetPath->GetDirectoryEntries(getter_AddRefs(entries));
|
2015-06-23 02:31:32 +03:00
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2015-10-09 17:59:40 +03:00
|
|
|
bool filterOutSensitive = false;
|
|
|
|
{
|
|
|
|
HTMLSplitOnSpacesTokenizer tokenizer(mFilters, ';');
|
|
|
|
nsAutoString token;
|
|
|
|
while (tokenizer.hasMoreTokens()) {
|
|
|
|
token = tokenizer.nextToken();
|
|
|
|
if (token.EqualsLiteral("filter-out-sensitive")) {
|
|
|
|
filterOutSensitive = true;
|
|
|
|
} else {
|
|
|
|
MOZ_CRASH("Unrecognized filter");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-23 02:31:32 +03:00
|
|
|
for (;;) {
|
|
|
|
bool hasMore = false;
|
|
|
|
if (NS_WARN_IF(NS_FAILED(entries->HasMoreElements(&hasMore))) || !hasMore) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
nsCOMPtr<nsISupports> supp;
|
|
|
|
if (NS_WARN_IF(NS_FAILED(entries->GetNext(getter_AddRefs(supp))))) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIFile> currFile = do_QueryInterface(supp);
|
|
|
|
MOZ_ASSERT(currFile);
|
2016-03-20 13:56:10 +03:00
|
|
|
|
2016-07-23 11:34:43 +03:00
|
|
|
bool isSpecial, isFile;
|
|
|
|
if (NS_WARN_IF(NS_FAILED(currFile->IsSpecial(&isSpecial))) ||
|
|
|
|
isSpecial) {
|
2015-06-23 02:31:32 +03:00
|
|
|
continue;
|
2016-01-22 18:58:49 +03:00
|
|
|
}
|
2015-06-23 02:31:32 +03:00
|
|
|
if (NS_WARN_IF(NS_FAILED(currFile->IsFile(&isFile)) ||
|
|
|
|
NS_FAILED(currFile->IsDirectory(&isDir))) ||
|
|
|
|
!(isFile || isDir)) {
|
|
|
|
continue;
|
|
|
|
}
|
2015-10-09 17:59:40 +03:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-04-09 21:15:50 +03:00
|
|
|
nsAutoString path;
|
|
|
|
if (NS_WARN_IF(NS_FAILED(currFile->GetPath(path)))) {
|
|
|
|
continue;
|
2016-03-30 09:18:32 +03:00
|
|
|
}
|
|
|
|
|
2017-02-01 09:33:18 +03:00
|
|
|
FileOrDirectoryPath element;
|
2016-04-09 21:15:50 +03:00
|
|
|
element.mPath = path;
|
2017-02-01 09:33:18 +03:00
|
|
|
element.mType = isDir ? FileOrDirectoryPath::eDirectoryPath
|
|
|
|
: FileOrDirectoryPath::eFilePath;
|
2016-04-09 21:15:50 +03:00
|
|
|
|
2016-03-30 09:18:32 +03:00
|
|
|
if (!mTargetData.AppendElement(element, fallible)) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2016-03-20 13:56:10 +03:00
|
|
|
}
|
2015-06-23 02:31:32 +03:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2017-03-16 10:53:49 +03:00
|
|
|
nsresult
|
|
|
|
GetDirectoryListingTaskParent::GetTargetPath(nsAString& aPath) const
|
|
|
|
{
|
|
|
|
return mTargetPath->GetPath(aPath);
|
|
|
|
}
|
|
|
|
|
2015-06-23 02:31:32 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|