Bug 1375125 - Remove nsILocalFile. r?froydnj draft
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Sat, 05 Aug 2017 09:43:49 +0900
changeset 641144 724dd494ed0558e6b552948b1b97a450354ceb3d
parent 641143 d4c31501a0590bdb4bb840bcdc6583badb7e711f
child 641148 7fe0af75d3c529eeee794c4ae22f4189e7dca619
child 641149 4816a010adcb29ef063f4496909fae9833374a9f
push id72449
push userVYV03354@nifty.ne.jp
push dateSat, 05 Aug 2017 22:48:23 +0000
reviewersfroydnj
bugs1375125
milestone57.0a1
Bug 1375125 - Remove nsILocalFile. r?froydnj MozReview-Commit-ID: 6oU6Ya5UXtC
dom/media/webrtc/MediaEngineDefault.cpp
modules/libpref/nsPrefBranch.cpp
toolkit/components/filewatcher/NativeFileWatcherWin.cpp
toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp
toolkit/components/url-classifier/nsCheckSummedOutputStream.h
xpcom/build/nsXPCOM.h
xpcom/io/moz.build
xpcom/io/nsILocalFile.idl
xpcom/io/nsILocalFileMac.idl
xpcom/io/nsILocalFileWin.idl
xpcom/io/nsLocalFile.h
xpcom/io/nsLocalFileUnix.cpp
xpcom/io/nsLocalFileUnix.h
xpcom/io/nsLocalFileWin.cpp
xpcom/io/nsLocalFileWin.h
--- a/dom/media/webrtc/MediaEngineDefault.cpp
+++ b/dom/media/webrtc/MediaEngineDefault.cpp
@@ -2,17 +2,17 @@
  * 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 "MediaEngineDefault.h"
 
 #include "nsCOMPtr.h"
 #include "mozilla/dom/File.h"
 #include "mozilla/UniquePtr.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
 #include "Layers.h"
 #include "ImageContainer.h"
 #include "ImageTypes.h"
 #include "nsContentUtils.h"
 #include "MediaStreamGraph.h"
 
 #include "nsIFilePicker.h"
 #include "nsIPrefService.h"
--- a/modules/libpref/nsPrefBranch.cpp
+++ b/modules/libpref/nsPrefBranch.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 "mozilla/dom/ContentChild.h"
 #include "nsXULAppAPI.h"
 
 #include "nsPrefBranch.h"
-#include "nsILocalFile.h" // nsILocalFile used for backwards compatibility
+#include "nsIFile.h"
 #include "nsIObserverService.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIDirectoryService.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
 #include "nsXPIDLString.h"
 #include "nsPrintfCString.h"
@@ -343,18 +343,17 @@ NS_IMETHODIMP nsPrefBranch::GetComplexVa
   }
 
   // if we can't get the pref, there's no point in being here
   rv = GetCharPref(aPrefName, getter_Copies(utf8String));
   if (NS_FAILED(rv)) {
     return rv;
   }
 
-  // also check nsILocalFile, for backwards compatibility
-  if (aType.Equals(NS_GET_IID(nsIFile)) || aType.Equals(NS_GET_IID(nsILocalFile))) {
+  if (aType.Equals(NS_GET_IID(nsIFile))) {
     if (GetContentChild()) {
       NS_ERROR("cannot get nsIFile pref from content process");
       return NS_ERROR_NOT_AVAILABLE;
     }
 
     nsCOMPtr<nsIFile> file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
 
     if (NS_SUCCEEDED(rv)) {
@@ -493,18 +492,17 @@ void nsPrefBranch::ReportToConsole(const
 
 NS_IMETHODIMP nsPrefBranch::SetComplexValue(const char *aPrefName, const nsIID & aType, nsISupports *aValue)
 {
   ENSURE_MAIN_PROCESS("Cannot SetComplexValue from content process:", aPrefName);
   NS_ENSURE_ARG(aPrefName);
 
   nsresult   rv = NS_NOINTERFACE;
 
-  // also check nsILocalFile, for backwards compatibility
-  if (aType.Equals(NS_GET_IID(nsIFile)) || aType.Equals(NS_GET_IID(nsILocalFile))) {
+  if (aType.Equals(NS_GET_IID(nsIFile))) {
     nsCOMPtr<nsIFile> file = do_QueryInterface(aValue);
     if (!file)
       return NS_NOINTERFACE;
     nsAutoCString descriptorString;
 
     rv = file->GetPersistentDescriptor(descriptorString);
     if (NS_SUCCEEDED(rv)) {
       rv = SetCharPrefInternal(aPrefName, descriptorString.get());
--- a/toolkit/components/filewatcher/NativeFileWatcherWin.cpp
+++ b/toolkit/components/filewatcher/NativeFileWatcherWin.cpp
@@ -8,17 +8,17 @@
  * Native implementation of Watcher operations.
  */
 #include "NativeFileWatcherWin.h"
 
 #include "mozilla/Services.h"
 #include "mozilla/UniquePtr.h"
 #include "nsClassHashtable.h"
 #include "nsDataHashtable.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
 #include "nsIObserverService.h"
 #include "nsProxyRelease.h"
 #include "nsTArray.h"
 #include "mozilla/Logging.h"
 
 namespace mozilla {
 
 // Enclose everything which is not exported in an anonymous namespace.
@@ -453,17 +453,17 @@ NativeFileWatcherIOTask::RunInternal()
     FILE_NOTIFY_INFORMATION* notificationInfo =
       (FILE_NOTIFY_INFORMATION*)rawNotificationBuffer;
 
     // FileNameLength is in bytes, but we need FileName length
     // in characters, so divide it by sizeof(WCHAR).
     nsAutoString resourceName(notificationInfo->FileName,
                               notificationInfo->FileNameLength / sizeof(WCHAR));
 
-    // Handle path normalisation using nsILocalFile.
+    // Handle path normalisation using nsIFile.
     nsString resourcePath;
     nsresult rv = MakeResourcePath(changedRes, resourceName, resourcePath);
     if (NS_SUCCEEDED(rv)) {
       rv = DispatchChangeCallbacks(changedRes, resourcePath);
       if (NS_FAILED(rv)) {
         // Log that we failed to dispatch the change callbacks.
         FILEWATCHERLOG(
           "NativeFileWatcherIOTask::Run - Failed to dispatch change callbacks (%x).",
@@ -1160,59 +1160,59 @@ NativeFileWatcherIOTask::RemoveCallbacks
     // Remove the error callback.
     errorCallbacksArray->RemoveElement(aOnErrorHandle);
   }
 }
 
 /**
  * Creates a string representing the native path for the changed resource.
  * It appends the resource name to the path of the changed descriptor by
- * using nsILocalFile.
+ * using nsIFile.
  * @param changedDescriptor
  *        The descriptor of the watched resource.
  * @param resourceName
  *        The resource which triggered the change.
  * @param nativeResourcePath
  *        The full path to the changed resource.
- * @return NS_OK if nsILocalFile succeeded in building the path.
+ * @return NS_OK if nsIFile succeeded in building the path.
  */
 nsresult
 NativeFileWatcherIOTask::MakeResourcePath(
   WatchedResourceDescriptor* changedDescriptor,
   const nsAString& resourceName,
   nsAString& nativeResourcePath)
 {
-  nsCOMPtr<nsILocalFile>
+  nsCOMPtr<nsIFile>
     localPath(do_CreateInstance("@mozilla.org/file/local;1"));
   if (!localPath) {
     FILEWATCHERLOG(
-      "NativeFileWatcherIOTask::MakeResourcePath - Failed to create a nsILocalFile instance.");
+      "NativeFileWatcherIOTask::MakeResourcePath - Failed to create a nsIFile instance.");
     return NS_ERROR_FAILURE;
   }
 
   nsresult rv = localPath->InitWithPath(changedDescriptor->mPath);
   if (NS_FAILED(rv)) {
     FILEWATCHERLOG(
-      "NativeFileWatcherIOTask::MakeResourcePath - Failed to init nsILocalFile with %S (%x).",
+      "NativeFileWatcherIOTask::MakeResourcePath - Failed to init nsIFile with %S (%x).",
       changedDescriptor->mPath.get(), rv);
     return rv;
   }
 
   rv = localPath->AppendRelativePath(resourceName);
   if (NS_FAILED(rv)) {
     FILEWATCHERLOG(
       "NativeFileWatcherIOTask::MakeResourcePath - Failed to append to %S (%x).",
       changedDescriptor->mPath.get(), rv);
     return rv;
   }
 
   rv = localPath->GetPath(nativeResourcePath);
   if (NS_FAILED(rv)) {
     FILEWATCHERLOG(
-      "NativeFileWatcherIOTask::MakeResourcePath - Failed to get native path from nsILocalFile (%x).",
+      "NativeFileWatcherIOTask::MakeResourcePath - Failed to get native path from nsIFile (%x).",
       rv);
     return rv;
   }
 
   return NS_OK;
 }
 
 } // namespace
--- a/toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp
+++ b/toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp
@@ -1,14 +1,13 @@
 //* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "nsILocalFile.h"
 #include "nsCRT.h"
 #include "nsIFile.h"
 #include "nsISupportsImpl.h"
 #include "nsCheckSummedOutputStream.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsCheckSummedOutputStream
 
--- a/toolkit/components/url-classifier/nsCheckSummedOutputStream.h
+++ b/toolkit/components/url-classifier/nsCheckSummedOutputStream.h
@@ -1,17 +1,16 @@
 //* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 #ifndef nsCheckSummedOutputStream_h__
 #define nsCheckSummedOutputStream_h__
 
-#include "nsILocalFile.h"
 #include "nsIFile.h"
 #include "nsIOutputStream.h"
 #include "nsICryptoHash.h"
 #include "nsNetCID.h"
 #include "nsString.h"
 #include "nsToolkitCompsCID.h"
 #include "../../../netwerk/base/nsBufferedStreams.h"
 #include "prio.h"
--- a/xpcom/build/nsXPCOM.h
+++ b/xpcom/build/nsXPCOM.h
@@ -22,17 +22,16 @@ DECL_CLASS(nsAString);
 DECL_CLASS(nsACString);
 
 DECL_CLASS(nsISupports);
 DECL_CLASS(nsIModule);
 DECL_CLASS(nsIComponentManager);
 DECL_CLASS(nsIComponentRegistrar);
 DECL_CLASS(nsIServiceManager);
 DECL_CLASS(nsIFile);
-DECL_CLASS(nsILocalFile);
 DECL_CLASS(nsIDirectoryServiceProvider);
 DECL_CLASS(nsIMemory);
 DECL_CLASS(nsIDebug2);
 
 #ifdef __cplusplus
 namespace mozilla {
 struct Module;
 } // namespace mozilla
--- a/xpcom/io/moz.build
+++ b/xpcom/io/moz.build
@@ -14,17 +14,16 @@ XPIDL_SOURCES += [
     'nsIConverterOutputStream.idl',
     'nsIDirectoryEnumerator.idl',
     'nsIDirectoryService.idl',
     'nsIFile.idl',
     'nsIInputStream.idl',
     'nsIInputStreamTee.idl',
     'nsIIOUtil.idl',
     'nsILineInputStream.idl',
-    'nsILocalFile.idl',
     'nsILocalFileWin.idl',
     'nsIMultiplexInputStream.idl',
     'nsIObjectInputStream.idl',
     'nsIObjectOutputStream.idl',
     'nsIOutputStream.idl',
     'nsIPipe.idl',
     'nsISafeOutputStream.idl',
     'nsIScriptableBase64Encoder.idl',
deleted file mode 100644
--- a/xpcom/io/nsILocalFile.idl
+++ /dev/null
@@ -1,17 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* 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 "nsIFile.idl"
-
-/**
- * An empty interface to provide backwards compatibility for existing code.
- *
- * @see nsIFile
- */
-[scriptable, builtinclass, uuid(7ba8c6ba-2ce2-48b1-bd60-4c32aac35f9c)]
-interface nsILocalFile : nsIFile
-{
-};
-
--- a/xpcom/io/nsILocalFileMac.idl
+++ b/xpcom/io/nsILocalFileMac.idl
@@ -1,28 +1,28 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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 "nsILocalFile.idl"
+#include "nsIFile.idl"
 
 %{C++
 #include <Carbon/Carbon.h>
 #include <CoreFoundation/CoreFoundation.h>
 %}
 
       native OSType(OSType);
       native FSSpec(FSSpec);
       native FSRef(FSRef);
 [ptr] native FSRefPtr(FSRef);
       native CFURLRef(CFURLRef);
 
 [scriptable, builtinclass, uuid(623eca5b-c25d-4e27-be5a-789a66c4b2f7)]
-interface nsILocalFileMac : nsILocalFile
+interface nsILocalFileMac : nsIFile
 {
    /**
     * initWithCFURL
     *
     * Init this object with a CFURLRef
     *
     * NOTE: Supported only for XP_MACOSX
     * NOTE: If the path of the CFURL is /a/b/c, at least a/b must exist beforehand.
--- a/xpcom/io/nsILocalFileWin.idl
+++ b/xpcom/io/nsILocalFileWin.idl
@@ -1,24 +1,24 @@
 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * 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 "nsILocalFile.idl"
+#include "nsIFile.idl"
 
 %{C++
 struct PRFileDesc;
 %}
 
 [ptr] native PRFileDescStar(PRFileDesc);
 
 [scriptable, builtinclass, uuid(e7a3a954-384b-4aeb-a5f7-55626b0de9be)]
-interface nsILocalFileWin : nsILocalFile
+interface nsILocalFileWin : nsIFile
 {
     /**
      *  initWithCommandLine
      *
      *  Initialize this object based on the main app path of a commandline
      *  handler.
      *
      *   @param aCommandLine
--- a/xpcom/io/nsLocalFile.h
+++ b/xpcom/io/nsLocalFile.h
@@ -31,17 +31,17 @@
   nsresult InitWithUnicodePath(const char16_t *aPath);                                        \
   nsresult AppendRelativeUnicodePath(const char16_t *aRelativePath);
 
 // XPCOMInit needs to know about how we are implemented,
 // so here we will export it.  Other users should not depend
 // on this.
 
 #include <errno.h>
-#include "nsILocalFile.h"
+#include "nsIFile.h"
 
 #ifdef XP_WIN
 #include "nsLocalFileWin.h"
 #elif defined(XP_UNIX)
 #include "nsLocalFileUnix.h"
 #else
 #error NOT_IMPLEMENTED
 #endif
--- a/xpcom/io/nsLocalFileUnix.cpp
+++ b/xpcom/io/nsLocalFileUnix.cpp
@@ -234,22 +234,20 @@ nsLocalFile::nsLocalFile()
 nsLocalFile::nsLocalFile(const nsLocalFile& aOther)
   : mPath(aOther.mPath)
 {
 }
 
 #ifdef MOZ_WIDGET_COCOA
 NS_IMPL_ISUPPORTS(nsLocalFile,
                   nsILocalFileMac,
-                  nsILocalFile,
                   nsIFile,
                   nsIHashable)
 #else
 NS_IMPL_ISUPPORTS(nsLocalFile,
-                  nsILocalFile,
                   nsIFile,
                   nsIHashable)
 #endif
 
 nsresult
 nsLocalFile::nsLocalFileConstructor(nsISupports* aOuter,
                                     const nsIID& aIID,
                                     void** aInstancePtr)
--- a/xpcom/io/nsLocalFileUnix.h
+++ b/xpcom/io/nsLocalFileUnix.h
@@ -78,32 +78,31 @@
   #define LSTAT lstat
 #endif
 
 
 class nsLocalFile final
 #ifdef MOZ_WIDGET_COCOA
   : public nsILocalFileMac
 #else
-  : public nsILocalFile
+  : public nsIFile
 #endif
   , public nsIHashable
 {
 public:
   NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
 
   nsLocalFile();
 
   static nsresult nsLocalFileConstructor(nsISupports* aOuter,
                                          const nsIID& aIID,
                                          void** aInstancePtr);
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIFILE
-  NS_DECL_NSILOCALFILE
 #ifdef MOZ_WIDGET_COCOA
   NS_DECL_NSILOCALFILEMAC
 #endif
   NS_DECL_NSIHASHABLE
 
 public:
   static void GlobalInit();
   static void GlobalShutdown();
--- a/xpcom/io/nsLocalFileWin.cpp
+++ b/xpcom/io/nsLocalFileWin.cpp
@@ -958,17 +958,16 @@ nsLocalFile::nsLocalFileConstructor(nsIS
 }
 
 
 //-----------------------------------------------------------------------------
 // nsLocalFile::nsISupports
 //-----------------------------------------------------------------------------
 
 NS_IMPL_ISUPPORTS(nsLocalFile,
-                  nsILocalFile,
                   nsIFile,
                   nsILocalFileWin,
                   nsIHashable)
 
 
 //-----------------------------------------------------------------------------
 // nsLocalFile <private>
 //-----------------------------------------------------------------------------
@@ -1110,17 +1109,17 @@ nsLocalFile::Resolve()
     return rv;
   }
 
   mResolveDirty = false;
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
-// nsLocalFile::nsIFile,nsILocalFile
+// nsLocalFile::nsIFile
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsLocalFile::Clone(nsIFile** aFile)
 {
   // Just copy-construct ourselves
   RefPtr<nsLocalFile> file = new nsLocalFile(*this);
   file.forget(aFile);
--- a/xpcom/io/nsLocalFileWin.h
+++ b/xpcom/io/nsLocalFileWin.h
@@ -39,19 +39,16 @@ public:
                                          void** aInstancePtr);
 
   // nsISupports interface
   NS_DECL_THREADSAFE_ISUPPORTS
 
   // nsIFile interface
   NS_DECL_NSIFILE
 
-  // nsILocalFile interface
-  NS_DECL_NSILOCALFILE
-
   // nsILocalFileWin interface
   NS_DECL_NSILOCALFILEWIN
 
   // nsIHashable interface
   NS_DECL_NSIHASHABLE
 
 public:
   static void GlobalInit();