Bug 1486311 - convert remaining nsIFile::GetDirectoryEntries() callers to pass in a nsIDirectoryEnumerator. r=kmag
authoraceman <acelists@atlas.sk>
Sun, 26 Aug 2018 14:15:00 +0300
changeset 488807 d40ab2ee60232d20ee38d3601ef15a85fa8c6d86
parent 488806 55f933e0609f69d6518de5d98ede9d46c73b42fc
child 488808 7edee7974317eae6ce129eadf99833a58b6f543a
push id9734
push usershindli@mozilla.com
push dateThu, 30 Aug 2018 12:18:07 +0000
treeherdermozilla-beta@71c71ab3afae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1486311
milestone63.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 1486311 - convert remaining nsIFile::GetDirectoryEntries() callers to pass in a nsIDirectoryEnumerator. r=kmag
dom/simpledb/ActorsParent.cpp
gfx/thebes/gfxMacPlatformFontList.mm
storage/FileSystemModule.cpp
xpcom/io/nsIFile.idl
xpcom/io/nsLocalFileWin.cpp
xpcom/tests/gtest/TestFilePreferencesUnix.cpp
--- a/dom/simpledb/ActorsParent.cpp
+++ b/dom/simpledb/ActorsParent.cpp
@@ -13,17 +13,17 @@
 #include "mozilla/dom/quota/FileStreams.h"
 #include "mozilla/dom/quota/MemoryOutputStream.h"
 #include "mozilla/dom/quota/QuotaManager.h"
 #include "mozilla/dom/quota/UsageInfo.h"
 #include "mozilla/ipc/BackgroundParent.h"
 #include "mozilla/ipc/PBackgroundParent.h"
 #include "mozilla/ipc/PBackgroundSharedTypes.h"
 #include "nsIFileStreams.h"
-#include "nsISimpleEnumerator.h"
+#include "nsIDirectoryEnumerator.h"
 #include "nsStringStream.h"
 #include "prio.h"
 #include "SimpleDBCommon.h"
 
 #define DISABLE_ASSERTS_FOR_FUZZING 0
 
 #if DISABLE_ASSERTS_FOR_FUZZING
 #define ASSERT_UNLESS_FUZZING(...) do { } while (0)
@@ -1904,17 +1904,17 @@ QuotaClient::GetUsageForOrigin(Persisten
   rv = directory->Append(NS_LITERAL_STRING(SDB_DIRECTORY_NAME));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   DebugOnly<bool> exists;
   MOZ_ASSERT(NS_SUCCEEDED(directory->Exists(&exists)) && exists);
 
-  nsCOMPtr<nsISimpleEnumerator> entries;
+  nsCOMPtr<nsIDirectoryEnumerator> entries;
   rv = directory->GetDirectoryEntries(getter_AddRefs(entries));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   bool hasMore;
   while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) &&
          hasMore && !aCanceled) {
--- a/gfx/thebes/gfxMacPlatformFontList.mm
+++ b/gfx/thebes/gfxMacPlatformFontList.mm
@@ -52,17 +52,17 @@
 
 #include "MainThreadUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsTArray.h"
 
 #include "nsDirectoryServiceUtils.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsAppDirectoryServiceDefs.h"
-#include "nsISimpleEnumerator.h"
+#include "nsIDirectoryEnumerator.h"
 #include "nsCharTraits.h"
 #include "nsCocoaFeatures.h"
 #include "nsCocoaUtils.h"
 #include "gfxFontConstants.h"
 
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/ContentParent.h"
 #include "mozilla/FontPropertyTypes.h"
@@ -1872,17 +1872,17 @@ gfxMacPlatformFontList::CreateFontFamily
 void
 gfxMacPlatformFontList::ActivateFontsFromDir(nsIFile* aDir)
 {
     bool isDir;
     if (NS_FAILED(aDir->IsDirectory(&isDir)) || !isDir) {
         return;
     }
 
-    nsCOMPtr<nsISimpleEnumerator> e;
+    nsCOMPtr<nsIDirectoryEnumerator> e;
     if (NS_FAILED(aDir->GetDirectoryEntries(getter_AddRefs(e)))) {
         return;
     }
 
     CFMutableArrayRef urls =
         ::CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
 
     bool hasMore;
--- a/storage/FileSystemModule.cpp
+++ b/storage/FileSystemModule.cpp
@@ -3,17 +3,17 @@
  * 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 "FileSystemModule.h"
 
 #include "sqlite3.h"
 #include "nsString.h"
-#include "nsISimpleEnumerator.h"
+#include "nsIDirectoryEnumerator.h"
 #include "nsIFile.h"
 
 namespace {
 
 struct VirtualTableCursorBase
 {
   VirtualTableCursorBase()
   {
@@ -46,17 +46,17 @@ public:
   {
     return mRowId;
   }
 
   nsresult Init(const nsAString& aPath);
   nsresult NextFile();
 
 private:
-  nsCOMPtr<nsISimpleEnumerator> mEntries;
+  nsCOMPtr<nsIDirectoryEnumerator> mEntries;
 
   nsString mDirectoryPath;
   nsString mCurrentFileName;
 
   int64_t mRowId;
 };
 
 nsresult
--- a/xpcom/io/nsIFile.idl
+++ b/xpcom/io/nsIFile.idl
@@ -345,24 +345,16 @@ interface nsIFile : nsISupports
      *
      *   @throws NS_ERROR_FILE_NOT_DIRECTORY if the current nsIFile does
      *           not specify a directory.
      */
     [binaryname(DirectoryEntriesImpl)]
     readonly attribute nsIDirectoryEnumerator directoryEntries;
 
     %{C++
-    nsresult GetDirectoryEntries(nsISimpleEnumerator** aOut)
-    {
-      nsCOMPtr<nsIDirectoryEnumerator> dirEnum;
-      nsresult rv = GetDirectoryEntries(getter_AddRefs(dirEnum));
-      dirEnum.forget(aOut);
-      return rv;
-    };
-
     nsresult GetDirectoryEntries(nsIDirectoryEnumerator** aOut)
     {
       return GetDirectoryEntriesImpl(aOut);
     };
     %}
 
     /**
      *  initWith[Native]Path
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -2039,17 +2039,17 @@ nsLocalFile::CopyMove(nsIFile* aParentDi
         return rv;
       }
 
 
       if (!isWritable) {
         return NS_ERROR_FILE_ACCESS_DENIED;
       }
 
-      nsCOMPtr<nsISimpleEnumerator> targetIterator;
+      nsCOMPtr<nsIDirectoryEnumerator> targetIterator;
       rv = target->GetDirectoryEntries(getter_AddRefs(targetIterator));
       if (NS_FAILED(rv)) {
         return rv;
       }
 
       bool more;
       targetIterator->HasMoreElements(&more);
       // return error if target directory is not empty
--- a/xpcom/tests/gtest/TestFilePreferencesUnix.cpp
+++ b/xpcom/tests/gtest/TestFilePreferencesUnix.cpp
@@ -1,17 +1,17 @@
 #include "gtest/gtest.h"
 
 #include "mozilla/FilePreferences.h"
 
 #include "nsDirectoryServiceDefs.h"
 #include "nsDirectoryServiceUtils.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ScopeExit.h"
-#include "nsISimpleEnumerator.h"
+#include "nsIDirectoryEnumerator.h"
 
 using namespace mozilla;
 
 TEST(TestFilePreferencesUnix, Parsing)
 {
   #define kBlacklisted "/tmp/blacklisted"
   #define kBlacklistedDir "/tmp/blacklisted/"
   #define kBlacklistedFile "/tmp/blacklisted/file"
@@ -104,17 +104,17 @@ TEST(TestFilePreferencesUnix, Simple)
   rv = blacklistedFile->GetFileSize(&size);
   ASSERT_EQ(rv, NS_ERROR_FILE_ACCESS_DENIED);
 
   bool exists;
   rv = blacklistedFile->Exists(&exists);
   ASSERT_EQ(rv, NS_ERROR_FILE_ACCESS_DENIED);
 
   // Check that we can't enumerate the directory
-  nsCOMPtr<nsISimpleEnumerator> dirEnumerator;
+  nsCOMPtr<nsIDirectoryEnumerator> dirEnumerator;
   rv = blacklistedDir->GetDirectoryEntries(getter_AddRefs(dirEnumerator));
   ASSERT_EQ(rv, NS_ERROR_FILE_ACCESS_DENIED);
 
   nsCOMPtr<nsIFile> newPath;
   rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(newPath));
   ASSERT_EQ(rv, NS_OK);
   rv = newPath->AppendNative(NS_LITERAL_CSTRING("."));
   ASSERT_EQ(rv, NS_OK);