Bug 1333631 - Fix misuse of nsIFile::GetNativeTarget in dom/filesystem. r=baku
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Fri, 27 Jan 2017 00:48:52 +0900
changeset 332351 28bb04d0338d2741bbc951566f156744a50060bc
parent 332350 b3d2a4cdecd15085d59d2d5fc7661392fb771787
child 332396 9f17a6fc04f9540ffe11d7ad4e22db5a37df6e23
child 332400 0252f79c9a2a4ce48a20e6610fd9aa6717a51069
push id31303
push usercbook@mozilla.com
push dateFri, 03 Feb 2017 12:23:51 +0000
treeherdermozilla-central@28bb04d0338d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1333631
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1333631 - Fix misuse of nsIFile::GetNativeTarget in dom/filesystem. r=baku MozReview-Commit-ID: 9VpLg1iNFxs
dom/filesystem/GetFilesHelper.cpp
dom/filesystem/GetFilesHelper.h
--- 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;