Bug 1333631 - Fix misuse of nsIFile::GetNativeTarget in dom/filesystem. r=baku
MozReview-Commit-ID: 9VpLg1iNFxs
--- a/dom/filesystem/GetFilesHelper.cpp
+++ b/dom/filesystem/GetFilesHelper.cpp
@@ -424,28 +424,24 @@ GetFilesHelperBase::AddExploredDirectory
#endif
bool isLink;
rv = aDir->IsSymlink(&isLink);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
- nsAutoCString path;
-
+ nsAutoString path;
if (!isLink) {
- nsAutoString path16;
- rv = aDir->GetPath(path16);
+ rv = aDir->GetPath(path);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
-
- path = NS_ConvertUTF16toUTF8(path16);
} else {
- rv = aDir->GetNativeTarget(path);
+ rv = aDir->GetTarget(path);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
mExploredDirectories.PutEntry(path);
return NS_OK;
}
@@ -458,18 +454,18 @@ GetFilesHelperBase::ShouldFollowSymLink(
if (NS_WARN_IF(NS_FAILED(aDir->IsSymlink(&isLink)) ||
NS_FAILED(aDir->IsDirectory(&isDir)))) {
return false;
}
MOZ_ASSERT(isLink && isDir, "Why are we here?");
#endif
- nsAutoCString targetPath;
- if (NS_WARN_IF(NS_FAILED(aDir->GetNativeTarget(targetPath)))) {
+ nsAutoString targetPath;
+ if (NS_WARN_IF(NS_FAILED(aDir->GetTarget(targetPath)))) {
return false;
}
return !mExploredDirectories.Contains(targetPath);
}
void
GetFilesHelper::ResolveOrRejectPromise(Promise* aPromise)
--- a/dom/filesystem/GetFilesHelper.h
+++ b/dom/filesystem/GetFilesHelper.h
@@ -60,17 +60,17 @@ protected:
bool
ShouldFollowSymLink(nsIFile* aDirectory);
bool mRecursiveFlag;
// We populate this array in the I/O thread with the BlobImpl.
FallibleTArray<RefPtr<BlobImpl>> mTargetBlobImplArray;
- nsTHashtable<nsCStringHashKey> mExploredDirectories;
+ nsTHashtable<nsStringHashKey> mExploredDirectories;
};
// Retrieving the list of files can be very time/IO consuming. We use this
// helper class to do it just once.
class GetFilesHelper : public Runnable
, public GetFilesHelperBase
{
friend class GetFilesHelperParent;