Bug 1375125 - Remove nsILocalFile. r=froydnj

MozReview-Commit-ID: 6oU6Ya5UXtC
This commit is contained in:
Masatoshi Kimura
2017-08-05 09:43:49 +09:00
parent 2e32b0cc41
commit 012500cff8
15 changed files with 19 additions and 49 deletions

View File

@@ -7,7 +7,7 @@
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "mozilla/dom/File.h" #include "mozilla/dom/File.h"
#include "mozilla/UniquePtr.h" #include "mozilla/UniquePtr.h"
#include "nsILocalFile.h" #include "nsIFile.h"
#include "Layers.h" #include "Layers.h"
#include "ImageContainer.h" #include "ImageContainer.h"
#include "ImageTypes.h" #include "ImageTypes.h"

View File

@@ -8,7 +8,7 @@
#include "nsXULAppAPI.h" #include "nsXULAppAPI.h"
#include "nsPrefBranch.h" #include "nsPrefBranch.h"
#include "nsILocalFile.h" // nsILocalFile used for backwards compatibility #include "nsIFile.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "nsXPCOM.h" #include "nsXPCOM.h"
#include "nsISupportsPrimitives.h" #include "nsISupportsPrimitives.h"
@@ -350,8 +350,7 @@ NS_IMETHODIMP nsPrefBranch::GetComplexValue(const char *aPrefName, const nsIID &
return rv; return rv;
} }
// also check nsILocalFile, for backwards compatibility if (aType.Equals(NS_GET_IID(nsIFile))) {
if (aType.Equals(NS_GET_IID(nsIFile)) || aType.Equals(NS_GET_IID(nsILocalFile))) {
if (GetContentChild()) { if (GetContentChild()) {
NS_ERROR("cannot get nsIFile pref from content process"); NS_ERROR("cannot get nsIFile pref from content process");
return NS_ERROR_NOT_AVAILABLE; return NS_ERROR_NOT_AVAILABLE;
@@ -500,8 +499,7 @@ NS_IMETHODIMP nsPrefBranch::SetComplexValue(const char *aPrefName, const nsIID &
nsresult rv = NS_NOINTERFACE; nsresult rv = NS_NOINTERFACE;
// also check nsILocalFile, for backwards compatibility if (aType.Equals(NS_GET_IID(nsIFile))) {
if (aType.Equals(NS_GET_IID(nsIFile)) || aType.Equals(NS_GET_IID(nsILocalFile))) {
nsCOMPtr<nsIFile> file = do_QueryInterface(aValue); nsCOMPtr<nsIFile> file = do_QueryInterface(aValue);
if (!file) if (!file)
return NS_NOINTERFACE; return NS_NOINTERFACE;

View File

@@ -13,7 +13,7 @@
#include "mozilla/UniquePtr.h" #include "mozilla/UniquePtr.h"
#include "nsClassHashtable.h" #include "nsClassHashtable.h"
#include "nsDataHashtable.h" #include "nsDataHashtable.h"
#include "nsILocalFile.h" #include "nsIFile.h"
#include "nsIObserverService.h" #include "nsIObserverService.h"
#include "nsProxyRelease.h" #include "nsProxyRelease.h"
#include "nsTArray.h" #include "nsTArray.h"
@@ -458,7 +458,7 @@ NativeFileWatcherIOTask::RunInternal()
nsAutoString resourceName(notificationInfo->FileName, nsAutoString resourceName(notificationInfo->FileName,
notificationInfo->FileNameLength / sizeof(WCHAR)); notificationInfo->FileNameLength / sizeof(WCHAR));
// Handle path normalisation using nsILocalFile. // Handle path normalisation using nsIFile.
nsString resourcePath; nsString resourcePath;
nsresult rv = MakeResourcePath(changedRes, resourceName, resourcePath); nsresult rv = MakeResourcePath(changedRes, resourceName, resourcePath);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
@@ -1165,14 +1165,14 @@ NativeFileWatcherIOTask::RemoveCallbacksFromHashtables(
/** /**
* Creates a string representing the native path for the changed resource. * Creates a string representing the native path for the changed resource.
* It appends the resource name to the path of the changed descriptor by * It appends the resource name to the path of the changed descriptor by
* using nsILocalFile. * using nsIFile.
* @param changedDescriptor * @param changedDescriptor
* The descriptor of the watched resource. * The descriptor of the watched resource.
* @param resourceName * @param resourceName
* The resource which triggered the change. * The resource which triggered the change.
* @param nativeResourcePath * @param nativeResourcePath
* The full path to the changed resource. * 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 nsresult
NativeFileWatcherIOTask::MakeResourcePath( NativeFileWatcherIOTask::MakeResourcePath(
@@ -1180,18 +1180,18 @@ NativeFileWatcherIOTask::MakeResourcePath(
const nsAString& resourceName, const nsAString& resourceName,
nsAString& nativeResourcePath) nsAString& nativeResourcePath)
{ {
nsCOMPtr<nsILocalFile> nsCOMPtr<nsIFile>
localPath(do_CreateInstance("@mozilla.org/file/local;1")); localPath(do_CreateInstance("@mozilla.org/file/local;1"));
if (!localPath) { if (!localPath) {
FILEWATCHERLOG( FILEWATCHERLOG(
"NativeFileWatcherIOTask::MakeResourcePath - Failed to create a nsILocalFile instance."); "NativeFileWatcherIOTask::MakeResourcePath - Failed to create a nsIFile instance.");
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
nsresult rv = localPath->InitWithPath(changedDescriptor->mPath); nsresult rv = localPath->InitWithPath(changedDescriptor->mPath);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
FILEWATCHERLOG( FILEWATCHERLOG(
"NativeFileWatcherIOTask::MakeResourcePath - Failed to init nsILocalFile with %S (%x).", "NativeFileWatcherIOTask::MakeResourcePath - Failed to init nsIFile with %S (%x).",
changedDescriptor->mPath.get(), rv); changedDescriptor->mPath.get(), rv);
return rv; return rv;
} }
@@ -1207,7 +1207,7 @@ NativeFileWatcherIOTask::MakeResourcePath(
rv = localPath->GetPath(nativeResourcePath); rv = localPath->GetPath(nativeResourcePath);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
FILEWATCHERLOG( FILEWATCHERLOG(
"NativeFileWatcherIOTask::MakeResourcePath - Failed to get native path from nsILocalFile (%x).", "NativeFileWatcherIOTask::MakeResourcePath - Failed to get native path from nsIFile (%x).",
rv); rv);
return rv; return rv;
} }

View File

@@ -3,7 +3,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsILocalFile.h"
#include "nsCRT.h" #include "nsCRT.h"
#include "nsIFile.h" #include "nsIFile.h"
#include "nsISupportsImpl.h" #include "nsISupportsImpl.h"

View File

@@ -6,7 +6,6 @@
#ifndef nsCheckSummedOutputStream_h__ #ifndef nsCheckSummedOutputStream_h__
#define nsCheckSummedOutputStream_h__ #define nsCheckSummedOutputStream_h__
#include "nsILocalFile.h"
#include "nsIFile.h" #include "nsIFile.h"
#include "nsIOutputStream.h" #include "nsIOutputStream.h"
#include "nsICryptoHash.h" #include "nsICryptoHash.h"

View File

@@ -27,7 +27,6 @@ DECL_CLASS(nsIComponentManager);
DECL_CLASS(nsIComponentRegistrar); DECL_CLASS(nsIComponentRegistrar);
DECL_CLASS(nsIServiceManager); DECL_CLASS(nsIServiceManager);
DECL_CLASS(nsIFile); DECL_CLASS(nsIFile);
DECL_CLASS(nsILocalFile);
DECL_CLASS(nsIDirectoryServiceProvider); DECL_CLASS(nsIDirectoryServiceProvider);
DECL_CLASS(nsIMemory); DECL_CLASS(nsIMemory);
DECL_CLASS(nsIDebug2); DECL_CLASS(nsIDebug2);

View File

@@ -19,7 +19,6 @@ XPIDL_SOURCES += [
'nsIInputStreamTee.idl', 'nsIInputStreamTee.idl',
'nsIIOUtil.idl', 'nsIIOUtil.idl',
'nsILineInputStream.idl', 'nsILineInputStream.idl',
'nsILocalFile.idl',
'nsILocalFileWin.idl', 'nsILocalFileWin.idl',
'nsIMultiplexInputStream.idl', 'nsIMultiplexInputStream.idl',
'nsIObjectInputStream.idl', 'nsIObjectInputStream.idl',

View File

@@ -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
{
};

View File

@@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsILocalFile.idl" #include "nsIFile.idl"
%{C++ %{C++
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
@@ -17,7 +17,7 @@
native CFURLRef(CFURLRef); native CFURLRef(CFURLRef);
[scriptable, builtinclass, uuid(623eca5b-c25d-4e27-be5a-789a66c4b2f7)] [scriptable, builtinclass, uuid(623eca5b-c25d-4e27-be5a-789a66c4b2f7)]
interface nsILocalFileMac : nsILocalFile interface nsILocalFileMac : nsIFile
{ {
/** /**
* initWithCFURL * initWithCFURL

View File

@@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/ */
#include "nsILocalFile.idl" #include "nsIFile.idl"
%{C++ %{C++
struct PRFileDesc; struct PRFileDesc;
@@ -13,7 +13,7 @@ struct PRFileDesc;
[ptr] native PRFileDescStar(PRFileDesc); [ptr] native PRFileDescStar(PRFileDesc);
[scriptable, builtinclass, uuid(e7a3a954-384b-4aeb-a5f7-55626b0de9be)] [scriptable, builtinclass, uuid(e7a3a954-384b-4aeb-a5f7-55626b0de9be)]
interface nsILocalFileWin : nsILocalFile interface nsILocalFileWin : nsIFile
{ {
/** /**
* initWithCommandLine * initWithCommandLine

View File

@@ -36,7 +36,7 @@
// on this. // on this.
#include <errno.h> #include <errno.h>
#include "nsILocalFile.h" #include "nsIFile.h"
#ifdef XP_WIN #ifdef XP_WIN
#include "nsLocalFileWin.h" #include "nsLocalFileWin.h"

View File

@@ -239,12 +239,10 @@ nsLocalFile::nsLocalFile(const nsLocalFile& aOther)
#ifdef MOZ_WIDGET_COCOA #ifdef MOZ_WIDGET_COCOA
NS_IMPL_ISUPPORTS(nsLocalFile, NS_IMPL_ISUPPORTS(nsLocalFile,
nsILocalFileMac, nsILocalFileMac,
nsILocalFile,
nsIFile, nsIFile,
nsIHashable) nsIHashable)
#else #else
NS_IMPL_ISUPPORTS(nsLocalFile, NS_IMPL_ISUPPORTS(nsLocalFile,
nsILocalFile,
nsIFile, nsIFile,
nsIHashable) nsIHashable)
#endif #endif

View File

@@ -83,7 +83,7 @@ class nsLocalFile final
#ifdef MOZ_WIDGET_COCOA #ifdef MOZ_WIDGET_COCOA
: public nsILocalFileMac : public nsILocalFileMac
#else #else
: public nsILocalFile : public nsIFile
#endif #endif
, public nsIHashable , public nsIHashable
{ {
@@ -98,7 +98,6 @@ public:
NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIFILE NS_DECL_NSIFILE
NS_DECL_NSILOCALFILE
#ifdef MOZ_WIDGET_COCOA #ifdef MOZ_WIDGET_COCOA
NS_DECL_NSILOCALFILEMAC NS_DECL_NSILOCALFILEMAC
#endif #endif

View File

@@ -963,7 +963,6 @@ nsLocalFile::nsLocalFileConstructor(nsISupports* aOuter, const nsIID& aIID,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
NS_IMPL_ISUPPORTS(nsLocalFile, NS_IMPL_ISUPPORTS(nsLocalFile,
nsILocalFile,
nsIFile, nsIFile,
nsILocalFileWin, nsILocalFileWin,
nsIHashable) nsIHashable)
@@ -1115,7 +1114,7 @@ nsLocalFile::Resolve()
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// nsLocalFile::nsIFile,nsILocalFile // nsLocalFile::nsIFile
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
NS_IMETHODIMP NS_IMETHODIMP

View File

@@ -44,9 +44,6 @@ public:
// nsIFile interface // nsIFile interface
NS_DECL_NSIFILE NS_DECL_NSIFILE
// nsILocalFile interface
NS_DECL_NSILOCALFILE
// nsILocalFileWin interface // nsILocalFileWin interface
NS_DECL_NSILOCALFILEWIN NS_DECL_NSILOCALFILEWIN