--- a/b2g/app/nsBrowserApp.cpp
+++ b/b2g/app/nsBrowserApp.cpp
@@ -13,17 +13,17 @@
#include <sys/time.h>
#include <sys/resource.h>
#endif
#include <stdio.h>
#include <stdarg.h>
#include "nsCOMPtr.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsStringGlue.h"
#ifdef XP_WIN
// we want a wmain entry point
#include "nsWindowsWMain.cpp"
#define snprintf _snprintf
#define strcasecmp _stricmp
#endif
@@ -97,17 +97,17 @@ static const nsDynamicFunctionLoad kXULF
#endif
{ "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
{ "XRE_main", (NSFuncPtr*) &XRE_main },
{ nsnull, nsnull }
};
static int do_main(int argc, char* argv[])
{
- nsCOMPtr<nsILocalFile> appini;
+ nsCOMPtr<nsIFile> appini;
nsresult rv;
// Allow firefox.exe to launch XULRunner apps via -app <application.ini>
// Note that -app must be the *first* argument.
const char *appDataFile = getenv("XUL_APP_FILE");
if (appDataFile && *appDataFile) {
rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini));
if (NS_FAILED(rv)) {
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -17,17 +17,17 @@
#ifdef XP_MACOSX
#include "MacQuirks.h"
#endif
#include <stdio.h>
#include <stdarg.h>
#include "nsCOMPtr.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsStringGlue.h"
#ifdef XP_WIN
// we want a wmain entry point
#include "nsWindowsWMain.cpp"
#define snprintf _snprintf
#define strcasecmp _stricmp
#endif
@@ -101,17 +101,17 @@ static const nsDynamicFunctionLoad kXULF
#endif
{ "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
{ "XRE_main", (NSFuncPtr*) &XRE_main },
{ nsnull, nsnull }
};
static int do_main(int argc, char* argv[])
{
- nsCOMPtr<nsILocalFile> appini;
+ nsCOMPtr<nsIFile> appini;
nsresult rv;
// Allow firefox.exe to launch XULRunner apps via -app <application.ini>
// Note that -app must be the *first* argument.
const char *appDataFile = getenv("XUL_APP_FILE");
if (appDataFile && *appDataFile) {
rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini));
if (NS_FAILED(rv)) {
--- a/browser/components/dirprovider/DirectoryProvider.cpp
+++ b/browser/components/dirprovider/DirectoryProvider.cpp
@@ -49,17 +49,17 @@ DirectoryProvider::GetFile(const char *a
if (!strcmp(aKey, NS_APP_BOOKMARKS_50_FILE)) {
leafName = "bookmarks.html";
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
nsCString path;
rv = prefs->GetCharPref("browser.bookmarks.file", getter_Copies(path));
if (NS_SUCCEEDED(rv)) {
- NS_NewNativeLocalFile(path, true, (nsILocalFile**)(nsIFile**) getter_AddRefs(file));
+ NS_NewNativeLocalFile(path, true, getter_AddRefs(file));
}
}
}
else if (!strcmp(aKey, NS_APP_EXISTING_PREF_OVERRIDE)) {
rv = NS_GetSpecialDirectory(NS_APP_DEFAULTS_50_DIR,
getter_AddRefs(file));
NS_ENSURE_SUCCESS(rv, rv);
--- a/browser/components/shell/public/nsIShellService.idl
+++ b/browser/components/shell/public/nsIShellService.idl
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsISupports.idl"
interface nsIDOMElement;
-interface nsILocalFile;
+interface nsIFile;
[scriptable, uuid(bb477da4-dddf-4106-a562-f06c85c7f9a8)]
interface nsIShellService : nsISupports
{
/**
* Determines whether or not Firefox is the "Default Browser."
* This is simply whether or not Firefox is registered to handle
* http links.
@@ -94,15 +94,15 @@ interface nsIShellService : nsISupports
/**
* Opens an application with a specific URI to load.
* @param application
* The application file (or bundle directory, on OS X)
* @param uri
* The uri to be loaded by the application
*/
- void openApplicationWithURI(in nsILocalFile aApplication, in ACString aURI);
+ void openApplicationWithURI(in nsIFile aApplication, in ACString aURI);
/**
* The default system handler for web feeds
*/
- readonly attribute nsILocalFile defaultFeedReader;
+ readonly attribute nsIFile defaultFeedReader;
};
--- a/browser/components/shell/src/nsGNOMEShellService.cpp
+++ b/browser/components/shell/src/nsGNOMEShellService.cpp
@@ -4,17 +4,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/Util.h"
#include "nsCOMPtr.h"
#include "nsGNOMEShellService.h"
#include "nsShellService.h"
#include "nsIServiceManager.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIProperties.h"
#include "nsDirectoryServiceDefs.h"
#include "nsIPrefService.h"
#include "prenv.h"
#include "nsStringAPI.h"
#include "nsIGConfService.h"
#include "nsIGIOService.h"
#include "nsIGSettingsService.h"
@@ -102,18 +102,18 @@ nsGNOMEShellService::Init()
if (GetAppPathFromLauncher())
return NS_OK;
nsCOMPtr<nsIProperties> dirSvc
(do_GetService("@mozilla.org/file/directory_service;1"));
NS_ENSURE_TRUE(dirSvc, NS_ERROR_NOT_AVAILABLE);
- nsCOMPtr<nsILocalFile> appPath;
- rv = dirSvc->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsILocalFile),
+ nsCOMPtr<nsIFile> appPath;
+ rv = dirSvc->Get(NS_XPCOM_CURRENT_PROCESS_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(appPath));
NS_ENSURE_SUCCESS(rv, rv);
rv = appPath->AppendNative(NS_LITERAL_CSTRING(MOZ_APP_NAME));
NS_ENSURE_SUCCESS(rv, rv);
return appPath->GetNativePath(mAppPath);
}
@@ -636,17 +636,17 @@ nsGNOMEShellService::OpenApplication(PRI
g_strfreev(argv);
delete[] newArgv;
return err ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
-nsGNOMEShellService::OpenApplicationWithURI(nsILocalFile* aApplication, const nsACString& aURI)
+nsGNOMEShellService::OpenApplicationWithURI(nsIFile* aApplication, const nsACString& aURI)
{
nsresult rv;
nsCOMPtr<nsIProcess> process =
do_CreateInstance("@mozilla.org/process/util;1", &rv);
if (NS_FAILED(rv))
return rv;
rv = process->Init(aApplication);
@@ -654,12 +654,12 @@ nsGNOMEShellService::OpenApplicationWith
return rv;
const nsCString spec(aURI);
const char* specStr = spec.get();
return process->Run(false, &specStr, 1);
}
NS_IMETHODIMP
-nsGNOMEShellService::GetDefaultFeedReader(nsILocalFile** _retval)
+nsGNOMEShellService::GetDefaultFeedReader(nsIFile** _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
--- a/browser/components/shell/src/nsMacShellService.cpp
+++ b/browser/components/shell/src/nsMacShellService.cpp
@@ -162,17 +162,17 @@ nsMacShellService::SetDesktopBackground(
nsCAutoString fileName;
imageURL->GetFileName(fileName);
nsCOMPtr<nsIProperties> fileLocator
(do_GetService("@mozilla.org/file/directory_service;1", &rv));
NS_ENSURE_SUCCESS(rv, rv);
// Get the current user's "Pictures" folder (That's ~/Pictures):
- fileLocator->Get(NS_OSX_PICTURE_DOCUMENTS_DIR, NS_GET_IID(nsILocalFile),
+ fileLocator->Get(NS_OSX_PICTURE_DOCUMENTS_DIR, NS_GET_IID(nsIFile),
getter_AddRefs(mBackgroundFile));
if (!mBackgroundFile)
return NS_ERROR_OUT_OF_MEMORY;
nsAutoString fileNameUnicode;
CopyUTF8toUTF16(fileName, fileNameUnicode);
// and add the imgage file name itself:
@@ -324,29 +324,29 @@ nsMacShellService::OpenApplication(PRInt
}
break;
case nsIMacShellService::APPLICATION_KEYCHAIN_ACCESS:
err = ::LSGetApplicationForInfo('APPL', 'kcmr', NULL, kLSRolesAll, NULL,
&appURL);
break;
case nsIMacShellService::APPLICATION_NETWORK:
{
- nsCOMPtr<nsILocalFile> lf;
+ nsCOMPtr<nsIFile> lf;
rv = NS_NewNativeLocalFile(NETWORK_PREFPANE, true, getter_AddRefs(lf));
NS_ENSURE_SUCCESS(rv, rv);
bool exists;
lf->Exists(&exists);
if (!exists)
return NS_ERROR_FILE_NOT_FOUND;
return lf->Launch();
}
break;
case nsIMacShellService::APPLICATION_DESKTOP:
{
- nsCOMPtr<nsILocalFile> lf;
+ nsCOMPtr<nsIFile> lf;
rv = NS_NewNativeLocalFile(DESKTOP_PREFPANE, true, getter_AddRefs(lf));
NS_ENSURE_SUCCESS(rv, rv);
bool exists;
lf->Exists(&exists);
if (!exists)
return NS_ERROR_FILE_NOT_FOUND;
return lf->Launch();
}
@@ -377,17 +377,17 @@ nsMacShellService::SetDesktopBackgroundC
{
// This method and |GetDesktopBackgroundColor| has no meaning on Mac OS X.
// The mac desktop preferences UI uses pictures for the few solid colors it
// supports.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-nsMacShellService::OpenApplicationWithURI(nsILocalFile* aApplication, const nsACString& aURI)
+nsMacShellService::OpenApplicationWithURI(nsIFile* aApplication, const nsACString& aURI)
{
nsCOMPtr<nsILocalFileMac> lfm(do_QueryInterface(aApplication));
CFURLRef appURL;
nsresult rv = lfm->GetCFURL(&appURL);
if (NS_FAILED(rv))
return rv;
const nsCString spec(aURI);
@@ -414,17 +414,17 @@ nsMacShellService::OpenApplicationWithUR
::CFRelease(uris);
::CFRelease(uri);
return err != noErr ? NS_ERROR_FAILURE : NS_OK;
}
NS_IMETHODIMP
-nsMacShellService::GetDefaultFeedReader(nsILocalFile** _retval)
+nsMacShellService::GetDefaultFeedReader(nsIFile** _retval)
{
nsresult rv = NS_ERROR_FAILURE;
*_retval = nsnull;
CFStringRef defaultHandlerID = ::LSCopyDefaultHandlerForURLScheme(CFSTR("feed"));
if (!defaultHandlerID) {
defaultHandlerID = ::CFStringCreateWithCString(kCFAllocatorDefault,
SAFARI_BUNDLE_IDENTIFIER,
--- a/browser/components/shell/src/nsMacShellService.h
+++ b/browser/components/shell/src/nsMacShellService.h
@@ -3,17 +3,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/. */
#ifndef nsmacshellservice_h____
#define nsmacshellservice_h____
#include "nsIMacShellService.h"
#include "nsIWebProgressListener.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsCOMPtr.h"
class nsMacShellService : public nsIMacShellService,
public nsIWebProgressListener
{
public:
nsMacShellService() : mCheckedThisSession(false) {};
virtual ~nsMacShellService() {};
@@ -21,14 +21,14 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSISHELLSERVICE
NS_DECL_NSIMACSHELLSERVICE
NS_DECL_NSIWEBPROGRESSLISTENER
protected:
private:
- nsCOMPtr<nsILocalFile> mBackgroundFile;
+ nsCOMPtr<nsIFile> mBackgroundFile;
bool mCheckedThisSession;
};
#endif // nsmacshellservice_h____
--- a/browser/components/shell/src/nsWindowsShellService.cpp
+++ b/browser/components/shell/src/nsWindowsShellService.cpp
@@ -208,19 +208,19 @@ static nsCOMPtr<nsIThread> sThread;
nsresult
GetHelperPath(nsAutoString& aPath)
{
nsresult rv;
nsCOMPtr<nsIProperties> directoryService =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> appHelper;
+ nsCOMPtr<nsIFile> appHelper;
rv = directoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(appHelper));
NS_ENSURE_SUCCESS(rv, rv);
rv = appHelper->AppendNative(NS_LITERAL_CSTRING("uninstall"));
NS_ENSURE_SUCCESS(rv, rv);
rv = appHelper->AppendNative(NS_LITERAL_CSTRING("helper.exe"));
NS_ENSURE_SUCCESS(rv, rv);
@@ -1037,17 +1037,17 @@ nsWindowsShellService::LaunchPrefetchCle
if (sThread) {
nsCOMPtr<nsIRunnable> prefetchEvent = new ClearPrefetchEvent();
sThread->Dispatch(prefetchEvent, NS_DISPATCH_NORMAL);
}
}
#endif
NS_IMETHODIMP
-nsWindowsShellService::OpenApplicationWithURI(nsILocalFile* aApplication,
+nsWindowsShellService::OpenApplicationWithURI(nsIFile* aApplication,
const nsACString& aURI)
{
nsresult rv;
nsCOMPtr<nsIProcess> process =
do_CreateInstance("@mozilla.org/process/util;1", &rv);
if (NS_FAILED(rv))
return rv;
@@ -1056,17 +1056,17 @@ nsWindowsShellService::OpenApplicationWi
return rv;
const nsCString spec(aURI);
const char* specStr = spec.get();
return process->Run(false, &specStr, 1);
}
NS_IMETHODIMP
-nsWindowsShellService::GetDefaultFeedReader(nsILocalFile** _retval)
+nsWindowsShellService::GetDefaultFeedReader(nsIFile** _retval)
{
*_retval = nsnull;
nsresult rv;
nsCOMPtr<nsIWindowsRegKey> regKey =
do_CreateInstance("@mozilla.org/windows-registry-key;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
@@ -1085,17 +1085,17 @@ nsWindowsShellService::GetDefaultFeedRea
// Everything inside the quotes
path = Substring(path, 1, path.FindChar('"', 1) - 1);
}
else {
// Everything up to the first space
path = Substring(path, 0, path.FindChar(' '));
}
- nsCOMPtr<nsILocalFile> defaultReader =
+ nsCOMPtr<nsIFile> defaultReader =
do_CreateInstance("@mozilla.org/file/local;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = defaultReader->InitWithPath(path);
NS_ENSURE_SUCCESS(rv, rv);
bool exists;
rv = defaultReader->Exists(&exists);
--- a/chrome/src/nsChromeRegistryChrome.cpp
+++ b/chrome/src/nsChromeRegistryChrome.cpp
@@ -27,17 +27,17 @@
#include "nsUnicharUtils.h"
#include "nsXPCOMCIDInternal.h"
#include "nsZipArchive.h"
#include "mozilla/LookAndFeel.h"
#include "nsICommandLine.h"
#include "nsILocaleService.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIObserverService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIResProtocolHandler.h"
#include "nsIScriptError.h"
#include "nsIVersionComparator.h"
#include "nsIXPConnect.h"
#include "nsIXULAppInfo.h"
--- a/content/base/src/nsContentAreaDragDrop.cpp
+++ b/content/base/src/nsContentAreaDragDrop.cpp
@@ -162,17 +162,17 @@ nsContentAreaDragDropDataProvider::SaveU
// This is our nsIFlavorDataProvider callback. There are several
// assumptions here that make this work:
//
// 1. Someone put a kFilePromiseURLMime flavor into the transferable
// with the source URI of the file to save (as a string). We did
// that in AddStringsToDataTransfer.
//
// 2. Someone put a kFilePromiseDirectoryMime flavor into the
-// transferable with an nsILocalFile for the directory we are to
+// transferable with an nsIFile for the directory we are to
// save in. That has to be done by platform-specific code (in
// widget), which gets the destination directory from
// OS-specific drag information.
//
NS_IMETHODIMP
nsContentAreaDragDropDataProvider::GetFlavorData(nsITransferable *aTransferable,
const char *aFlavor,
nsISupports **aData,
@@ -213,28 +213,28 @@ nsContentAreaDragDropDataProvider::GetFl
return NS_ERROR_FAILURE;
// get the target directory from the kFilePromiseDirectoryMime
// flavor
nsCOMPtr<nsISupports> dirPrimitive;
dataSize = 0;
aTransferable->GetTransferData(kFilePromiseDirectoryMime,
getter_AddRefs(dirPrimitive), &dataSize);
- nsCOMPtr<nsILocalFile> destDirectory = do_QueryInterface(dirPrimitive);
+ nsCOMPtr<nsIFile> destDirectory = do_QueryInterface(dirPrimitive);
if (!destDirectory)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIFile> file;
rv = destDirectory->Clone(getter_AddRefs(file));
NS_ENSURE_SUCCESS(rv, rv);
file->Append(targetFilename);
rv = SaveURIToFile(sourceURLString, file);
- // send back an nsILocalFile
+ // send back an nsIFile
if (NS_SUCCEEDED(rv)) {
CallQueryInterface(file, aData);
*aDataLen = sizeof(nsIFile*);
}
}
return rv;
}
--- a/content/base/src/nsDOMFile.cpp
+++ b/content/base/src/nsDOMFile.cpp
@@ -594,22 +594,18 @@ nsDOMFileFile::Initialize(nsISupports* a
JSString* str = JS_ValueToString(aCx, aArgv[0]);
NS_ENSURE_TRUE(str, NS_ERROR_XPC_BAD_CONVERT_JS);
nsDependentJSString xpcomStr;
if (!xpcomStr.init(aCx, str)) {
return NS_ERROR_XPC_BAD_CONVERT_JS;
}
- nsCOMPtr<nsILocalFile> localFile;
- rv = NS_NewLocalFile(xpcomStr, false, getter_AddRefs(localFile));
+ rv = NS_NewLocalFile(xpcomStr, false, getter_AddRefs(file));
NS_ENSURE_SUCCESS(rv, rv);
-
- file = do_QueryInterface(localFile);
- NS_ASSERTION(file, "This should never happen");
}
bool exists;
rv = file->Exists(&exists);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(exists, NS_ERROR_FILE_NOT_FOUND);
bool isDir;
--- a/content/events/src/nsDOMDataTransfer.h
+++ b/content/events/src/nsDOMDataTransfer.h
@@ -12,17 +12,16 @@
#include "nsIPrincipal.h"
#include "nsIDOMDataTransfer.h"
#include "nsIDragService.h"
#include "nsIDOMElement.h"
#include "nsCycleCollectionParticipant.h"
#include "nsAutoPtr.h"
#include "nsIFile.h"
-#include "nsILocalFile.h"
#include "nsDOMFile.h"
class nsITransferable;
/**
* TransferItem is used to hold data for a particular format. Each piece of
* data has a principal set from the caller which added it. This allows a
* caller that wishes to retrieve the data to only be able to access the data
--- a/content/html/content/src/nsHTMLInputElement.cpp
+++ b/content/html/content/src/nsHTMLInputElement.cpp
@@ -61,17 +61,17 @@
#include "nsEventListenerManager.h"
#include "nsRuleData.h"
// input type=radio
#include "nsIRadioGroupContainer.h"
// input type=file
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsNetUtil.h"
#include "nsDOMFile.h"
#include "nsIFilePicker.h"
#include "nsDirectoryServiceDefs.h"
#include "nsIContentPrefService.h"
#include "nsIObserverService.h"
#include "nsIPopupWindowManager.h"
#include "nsGlobalWindow.h"
@@ -292,43 +292,40 @@ AsyncClickHandler::Run()
const nsCOMArray<nsIDOMFile>& oldFiles = mInput->GetFiles();
if (oldFiles.Count()) {
nsString path;
oldFiles[0]->GetMozFullPathInternal(path);
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
rv = NS_NewLocalFile(path, false, getter_AddRefs(localFile));
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIFile> parentFile;
rv = localFile->GetParent(getter_AddRefs(parentFile));
if (NS_SUCCEEDED(rv)) {
- nsCOMPtr<nsILocalFile> parentLocalFile = do_QueryInterface(parentFile, &rv);
- if (parentLocalFile) {
- filePicker->SetDisplayDirectory(parentLocalFile);
- }
+ filePicker->SetDisplayDirectory(parentFile);
}
}
// Unfortunately nsIFilePicker doesn't allow multiple files to be
// default-selected, so only select something by default if exactly
// one file was selected before.
if (oldFiles.Count() == 1) {
nsAutoString leafName;
oldFiles[0]->GetName(leafName);
if (!leafName.IsEmpty()) {
filePicker->SetDefaultString(leafName);
}
}
} else {
// Attempt to retrieve the last used directory from the content pref service
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
nsHTMLInputElement::gUploadLastDir->FetchLastUsedDirectory(doc->GetDocumentURI(),
getter_AddRefs(localFile));
if (!localFile) {
// Default to "desktop" directory for each platform
nsCOMPtr<nsIFile> homeDir;
NS_GetSpecialDirectory(NS_OS_DESKTOP_DIR, getter_AddRefs(homeDir));
localFile = do_QueryInterface(homeDir);
}
@@ -353,17 +350,17 @@ AsyncClickHandler::Run()
rv = filePicker->GetFiles(getter_AddRefs(iter));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISupports> tmp;
bool prefSaved = false;
bool loop = true;
while (NS_SUCCEEDED(iter->HasMoreElements(&loop)) && loop) {
iter->GetNext(getter_AddRefs(tmp));
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(tmp);
+ nsCOMPtr<nsIFile> localFile = do_QueryInterface(tmp);
if (localFile) {
nsString unicodePath;
rv = localFile->GetPath(unicodePath);
if (!unicodePath.IsEmpty()) {
nsCOMPtr<nsIDOMFile> domFile =
do_QueryObject(new nsDOMFileFile(localFile));
newFiles.AppendObject(domFile);
}
@@ -372,17 +369,17 @@ AsyncClickHandler::Run()
nsHTMLInputElement::gUploadLastDir->StoreLastUsedDirectory(doc->GetDocumentURI(),
localFile);
prefSaved = true;
}
}
}
}
else {
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
rv = filePicker->GetFile(getter_AddRefs(localFile));
if (localFile) {
nsString unicodePath;
rv = localFile->GetPath(unicodePath);
if (!unicodePath.IsEmpty()) {
nsCOMPtr<nsIDOMFile> domFile=
do_QueryObject(new nsDOMFileFile(localFile));
newFiles.AppendObject(domFile);
@@ -425,17 +422,17 @@ nsHTMLInputElement::InitUploadLastDir()
}
void
nsHTMLInputElement::DestroyUploadLastDir() {
NS_IF_RELEASE(gUploadLastDir);
}
nsresult
-UploadLastDir::FetchLastUsedDirectory(nsIURI* aURI, nsILocalFile** aFile)
+UploadLastDir::FetchLastUsedDirectory(nsIURI* aURI, nsIFile** aFile)
{
NS_PRECONDITION(aURI, "aURI is null");
NS_PRECONDITION(aFile, "aFile is null");
// Attempt to get the CPS, if it's not present we'll just return
nsCOMPtr<nsIContentPrefService> contentPrefService =
do_GetService(NS_CONTENT_PREF_SERVICE_CONTRACTID);
if (!contentPrefService)
return NS_ERROR_NOT_AVAILABLE;
@@ -447,36 +444,35 @@ UploadLastDir::FetchLastUsedDirectory(ns
// Get the last used directory, if it is stored
bool hasPref;
if (NS_SUCCEEDED(contentPrefService->HasPref(uri, CPS_PREF_NAME, &hasPref)) && hasPref) {
nsCOMPtr<nsIVariant> pref;
contentPrefService->GetPref(uri, CPS_PREF_NAME, nsnull, getter_AddRefs(pref));
nsString prefStr;
pref->GetAsAString(prefStr);
- nsCOMPtr<nsILocalFile> localFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
+ nsCOMPtr<nsIFile> localFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
if (!localFile)
return NS_ERROR_OUT_OF_MEMORY;
localFile->InitWithPath(prefStr);
localFile.forget(aFile);
}
return NS_OK;
}
nsresult
-UploadLastDir::StoreLastUsedDirectory(nsIURI* aURI, nsILocalFile* aFile)
+UploadLastDir::StoreLastUsedDirectory(nsIURI* aURI, nsIFile* aFile)
{
NS_PRECONDITION(aURI, "aURI is null");
NS_PRECONDITION(aFile, "aFile is null");
nsCOMPtr<nsIFile> parentFile;
aFile->GetParent(getter_AddRefs(parentFile));
if (!parentFile) {
return NS_OK;
}
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(parentFile);
// Attempt to get the CPS, if it's not present we'll just return
nsCOMPtr<nsIContentPrefService> contentPrefService =
do_GetService(NS_CONTENT_PREF_SERVICE_CONTRACTID);
if (!contentPrefService)
return NS_ERROR_NOT_AVAILABLE;
nsCOMPtr<nsIWritableVariant> uri = do_CreateInstance(NS_VARIANT_CONTRACTID);
if (!uri)
@@ -1060,20 +1056,18 @@ nsHTMLInputElement::MozSetFileNameArray(
// Converts the URL string into the corresponding nsIFile if possible
// A local file will be created if the URL string begins with file://
NS_GetFileFromURLSpec(NS_ConvertUTF16toUTF8(aFileNames[i]),
getter_AddRefs(file));
}
if (!file) {
// this is no "file://", try as local file
- nsCOMPtr<nsILocalFile> localFile;
NS_NewLocalFile(nsDependentString(aFileNames[i]),
- false, getter_AddRefs(localFile));
- file = do_QueryInterface(localFile);
+ false, getter_AddRefs(file));
}
if (file) {
nsCOMPtr<nsIDOMFile> domFile = new nsDOMFileFile(file);
files.AppendObject(domFile);
} else {
continue; // Not much we can do if the file doesn't exist
}
--- a/content/html/content/src/nsHTMLInputElement.h
+++ b/content/html/content/src/nsHTMLInputElement.h
@@ -31,26 +31,26 @@ public:
/**
* Fetch the last used directory for this location from the content
* pref service, if it is available.
*
* @param aURI URI of the current page
* @param aFile path to the last used directory
*/
- nsresult FetchLastUsedDirectory(nsIURI* aURI, nsILocalFile** aFile);
+ nsresult FetchLastUsedDirectory(nsIURI* aURI, nsIFile** aFile);
/**
* Store the last used directory for this location using the
* content pref service, if it is available
* @param aURI URI of the current page
* @param aFile file chosen by the user - the path to the parent of this
* file will be stored
*/
- nsresult StoreLastUsedDirectory(nsIURI* aURI, nsILocalFile* aFile);
+ nsresult StoreLastUsedDirectory(nsIURI* aURI, nsIFile* aFile);
};
class nsHTMLInputElement : public nsGenericHTMLFormElement,
public nsImageLoadingContent,
public nsIDOMHTMLInputElement,
public nsITextControlElement,
public nsIPhonetic,
public nsIDOMNSEditableElement,
--- a/content/media/nsMediaCache.cpp
+++ b/content/media/nsMediaCache.cpp
@@ -518,25 +518,22 @@ nsMediaCache::Init()
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
NS_ASSERTION(!mFileCache, "Cache file already open?");
// In single process Gecko, store the media cache in the profile directory
// so that multiple users can use separate media caches concurrently.
// In multi-process Gecko, there is no profile dir, so just store it in the
// system temp directory instead.
nsresult rv;
- nsCOMPtr<nsIFile> tmp;
+ nsCOMPtr<nsIFile> tmpFile;
const char* dir = (XRE_GetProcessType() == GeckoProcessType_Content) ?
NS_OS_TEMP_DIR : NS_APP_USER_PROFILE_LOCAL_50_DIR;
- rv = NS_GetSpecialDirectory(dir, getter_AddRefs(tmp));
+ rv = NS_GetSpecialDirectory(dir, getter_AddRefs(tmpFile));
NS_ENSURE_SUCCESS(rv,rv);
- nsCOMPtr<nsILocalFile> tmpFile = do_QueryInterface(tmp);
- NS_ENSURE_TRUE(tmpFile != nsnull, NS_ERROR_FAILURE);
-
// We put the media cache file in
// ${TempDir}/mozilla-media-cache/media_cache
rv = tmpFile->AppendNative(nsDependentCString("mozilla-media-cache"));
NS_ENSURE_SUCCESS(rv,rv);
rv = tmpFile->Create(nsIFile::DIRECTORY_TYPE, 0700);
if (rv == NS_ERROR_FILE_ALREADY_EXISTS) {
// Ensure the permissions are 0700. If not, we won't be able to create,
@@ -555,17 +552,17 @@ nsMediaCache::Init()
rv = tmpFile->AppendNative(nsDependentCString("media_cache"));
NS_ENSURE_SUCCESS(rv,rv);
rv = tmpFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0700);
NS_ENSURE_SUCCESS(rv,rv);
PRFileDesc* fileDesc = nsnull;
- rv = tmpFile->OpenNSPRFileDesc(PR_RDWR | nsILocalFile::DELETE_ON_CLOSE,
+ rv = tmpFile->OpenNSPRFileDesc(PR_RDWR | nsIFile::DELETE_ON_CLOSE,
PR_IRWXU, &fileDesc);
NS_ENSURE_SUCCESS(rv,rv);
mFileCache = new FileBlockCache();
rv = mFileCache->Open(fileDesc);
NS_ENSURE_SUCCESS(rv,rv);
#ifdef PR_LOGGING
--- a/docshell/base/nsDefaultURIFixup.cpp
+++ b/docshell/base/nsDefaultURIFixup.cpp
@@ -6,17 +6,17 @@
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsNetUtil.h"
#include "nsEscape.h"
#include "nsCRT.h"
#include "nsIPlatformCharset.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#ifdef MOZ_TOOLKIT_SEARCH
#include "nsIBrowserSearchService.h"
#endif
#include "nsIURIFixup.h"
#include "nsDefaultURIFixup.h"
#include "mozilla/Preferences.h"
@@ -569,17 +569,17 @@ nsresult nsDefaultURIFixup::ConvertFileT
{
// Test if this is a valid path by trying to create a local file
// object. The URL of that is returned if successful.
// NOTE: Please be sure to check that the call to NS_NewLocalFile
// rejects bad file paths when using this code on a new
// platform.
- nsCOMPtr<nsILocalFile> filePath;
+ nsCOMPtr<nsIFile> filePath;
nsresult rv;
// this is not the real fix but a temporary fix
// in order to really fix the problem, we need to change the
// nsICmdLineService interface to use wstring to pass paramenters
// instead of string since path name and other argument could be
// in non ascii.(see bug 87127) Since it is too risky to make interface change right
// now, we decide not to do so now.
--- a/dom/devicestorage/nsDeviceStorage.cpp
+++ b/dom/devicestorage/nsDeviceStorage.cpp
@@ -1,16 +1,16 @@
/* 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 "nsDeviceStorage.h"
#include "DOMRequest.h"
#include "nsServiceManagerUtils.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIDirectoryEnumerator.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsIDOMFile.h"
#include "nsDOMBlobBuilder.h"
#include "nsNetUtil.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIContentPermissionPrompt.h"
#include "nsIPrincipal.h"
@@ -128,94 +128,94 @@ NS_IMPL_THREADSAFE_ISUPPORTS0(DeviceStor
// TODO - eventually, we will want to factor this method
// out into different system specific subclasses (or
// something)
PRInt32
nsDOMDeviceStorage::SetRootFileForType(const nsAString& aType, const PRInt32 aIndex)
{
PRInt32 typeResult = DEVICE_STORAGE_TYPE_DEFAULT;
- nsCOMPtr<nsILocalFile> f;
+ nsCOMPtr<nsIFile> f;
nsCOMPtr<nsIProperties> dirService = do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
NS_ASSERTION(dirService, "Must have directory service");
// Picture directory
if (aType.Equals(NS_LITERAL_STRING("pictures"))) {
#ifdef MOZ_WIDGET_GONK
if (aIndex == 0) {
NS_NewLocalFile(NS_LITERAL_STRING("/data/pictures"), false, getter_AddRefs(f));
}
else if (aIndex == 1) {
NS_NewLocalFile(NS_LITERAL_STRING("/sdcard/DCIM"), false, getter_AddRefs(f));
typeResult = DEVICE_STORAGE_TYPE_EXTERNAL;
}
#elif defined (MOZ_WIDGET_COCOA)
if (aIndex == 0) {
- dirService->Get(NS_OSX_PICTURE_DOCUMENTS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f));
+ dirService->Get(NS_OSX_PICTURE_DOCUMENTS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
}
#elif defined (XP_UNIX)
if (aIndex == 0) {
- dirService->Get(NS_UNIX_XDG_PICTURES_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f));
+ dirService->Get(NS_UNIX_XDG_PICTURES_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
}
#endif
}
// Video directory
if (aType.Equals(NS_LITERAL_STRING("videos"))) {
#ifdef MOZ_WIDGET_GONK
if (aIndex == 0) {
NS_NewLocalFile(NS_LITERAL_STRING("/data/videos"), false, getter_AddRefs(f));
}
else if (aIndex == 1) {
NS_NewLocalFile(NS_LITERAL_STRING("/sdcard/videos"), false, getter_AddRefs(f));
typeResult = DEVICE_STORAGE_TYPE_EXTERNAL;
}
#elif defined (MOZ_WIDGET_COCOA)
if (aIndex == 0) {
- dirService->Get(NS_OSX_MOVIE_DOCUMENTS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f));
+ dirService->Get(NS_OSX_MOVIE_DOCUMENTS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
}
#elif defined (XP_UNIX)
if (aIndex == 0) {
- dirService->Get(NS_UNIX_XDG_VIDEOS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f));
+ dirService->Get(NS_UNIX_XDG_VIDEOS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
}
#endif
}
// Music directory
if (aType.Equals(NS_LITERAL_STRING("music"))) {
#ifdef MOZ_WIDGET_GONK
if (aIndex == 0) {
NS_NewLocalFile(NS_LITERAL_STRING("/data/music"), false, getter_AddRefs(f));
}
else if (aIndex == 1) {
NS_NewLocalFile(NS_LITERAL_STRING("/sdcard/music"), false, getter_AddRefs(f));
typeResult = DEVICE_STORAGE_TYPE_EXTERNAL;
}
#elif defined (MOZ_WIDGET_COCOA)
if (aIndex == 0) {
- dirService->Get(NS_OSX_MUSIC_DOCUMENTS_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f));
+ dirService->Get(NS_OSX_MUSIC_DOCUMENTS_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
}
#elif defined (XP_UNIX)
if (aIndex == 0) {
- dirService->Get(NS_UNIX_XDG_MUSIC_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f));
+ dirService->Get(NS_UNIX_XDG_MUSIC_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
}
#endif
}
// in testing, we have access to a few more directory locations
if (mozilla::Preferences::GetBool("device.storage.testing", false)) {
// Temp directory
if (aType.Equals(NS_LITERAL_STRING("temp")) && aIndex == 0) {
- dirService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f));
+ dirService->Get(NS_OS_TEMP_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
}
// Profile directory
else if (aType.Equals(NS_LITERAL_STRING("profile")) && aIndex == 0) {
- dirService->Get(NS_APP_USER_PROFILE_50_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(f));
+ dirService->Get(NS_APP_USER_PROFILE_50_DIR, NS_GET_IID(nsIFile), getter_AddRefs(f));
}
}
mFile = f;
return typeResult;
}
static jsval nsIFileToJsval(nsPIDOMWindow* aWindow, DeviceStorageFile* aFile, bool aEditable)
--- a/dom/indexedDB/FileManager.cpp
+++ b/dom/indexedDB/FileManager.cpp
@@ -189,17 +189,17 @@ FileManager::Invalidate()
}
return NS_OK;
}
already_AddRefed<nsIFile>
FileManager::GetDirectory()
{
- nsCOMPtr<nsILocalFile> directory =
+ nsCOMPtr<nsIFile> directory =
do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
NS_ENSURE_TRUE(directory, nsnull);
nsresult rv = directory->InitWithPath(mDirectoryPath);
NS_ENSURE_SUCCESS(rv, nsnull);
return directory.forget();
}
--- a/dom/indexedDB/FileManager.h
+++ b/dom/indexedDB/FileManager.h
@@ -4,17 +4,16 @@
* 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 mozilla_dom_indexeddb_filemanager_h__
#define mozilla_dom_indexeddb_filemanager_h__
#include "IndexedDatabase.h"
#include "nsIFile.h"
-#include "nsILocalFile.h"
#include "nsIDOMFile.h"
#include "nsDataHashtable.h"
class mozIStorageConnection;
BEGIN_INDEXEDDB_NAMESPACE
class FileInfo;
--- a/dom/indexedDB/IDBFactory.cpp
+++ b/dom/indexedDB/IDBFactory.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 "base/basictypes.h"
#include "IDBFactory.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIPrincipal.h"
#include "nsIScriptContext.h"
#include "mozilla/storage.h"
#include "nsComponentManagerUtils.h"
#include "nsIScriptSecurityManager.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsContentUtils.h"
@@ -159,17 +159,17 @@ IDBFactory::Create(JSContext* aCx,
// static
already_AddRefed<mozIStorageConnection>
IDBFactory::GetConnection(const nsAString& aDatabaseFilePath)
{
NS_ASSERTION(IndexedDatabaseManager::IsMainProcess(), "Wrong process!");
NS_ASSERTION(StringEndsWith(aDatabaseFilePath, NS_LITERAL_STRING(".sqlite")),
"Bad file path!");
- nsCOMPtr<nsILocalFile> dbFile(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
+ nsCOMPtr<nsIFile> dbFile(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
NS_ENSURE_TRUE(dbFile, nsnull);
nsresult rv = dbFile->InitWithPath(aDatabaseFilePath);
NS_ENSURE_SUCCESS(rv, nsnull);
bool exists;
rv = dbFile->Exists(&exists);
NS_ENSURE_SUCCESS(rv, nsnull);
--- a/dom/indexedDB/IndexedDatabaseManager.cpp
+++ b/dom/indexedDB/IndexedDatabaseManager.cpp
@@ -5,17 +5,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "IndexedDatabaseManager.h"
#include "DatabaseInfo.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsIFile.h"
#include "nsIFileStorage.h"
-#include "nsILocalFile.h"
#include "nsIObserverService.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIScriptSecurityManager.h"
#include "nsISHEntry.h"
#include "nsISimpleEnumerator.h"
#include "nsITimer.h"
#include "mozilla/dom/file/FileService.h"
@@ -273,30 +272,30 @@ IndexedDatabaseManager::FactoryCreate()
return GetOrCreate().get();
}
nsresult
IndexedDatabaseManager::GetDirectoryForOrigin(const nsACString& aASCIIOrigin,
nsIFile** aDirectory) const
{
nsresult rv;
- nsCOMPtr<nsILocalFile> directory =
+ nsCOMPtr<nsIFile> directory =
do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = directory->InitWithPath(GetBaseDirectory());
NS_ENSURE_SUCCESS(rv, rv);
NS_ConvertASCIItoUTF16 originSanitized(aASCIIOrigin);
originSanitized.ReplaceChar(":/", '+');
rv = directory->Append(originSanitized);
NS_ENSURE_SUCCESS(rv, rv);
- directory.forget(reinterpret_cast<nsILocalFile**>(aDirectory));
+ directory.forget(aDirectory);
return NS_OK;
}
// static
already_AddRefed<nsIAtom>
IndexedDatabaseManager::GetDatabaseId(const nsACString& aOrigin,
const nsAString& aName)
{
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1009,29 +1009,29 @@ ContentParent::RecvShowFilePicker(const
*result = filePicker->Show(retValue);
if (NS_FAILED(*result))
return true;
if (mode == nsIFilePicker::modeOpenMultiple) {
nsCOMPtr<nsISimpleEnumerator> fileIter;
*result = filePicker->GetFiles(getter_AddRefs(fileIter));
- nsCOMPtr<nsILocalFile> singleFile;
+ nsCOMPtr<nsIFile> singleFile;
bool loop = true;
while (NS_SUCCEEDED(fileIter->HasMoreElements(&loop)) && loop) {
fileIter->GetNext(getter_AddRefs(singleFile));
if (singleFile) {
nsAutoString filePath;
singleFile->GetPath(filePath);
files->AppendElement(filePath);
}
}
return true;
}
- nsCOMPtr<nsILocalFile> file;
+ nsCOMPtr<nsIFile> file;
filePicker->GetFile(getter_AddRefs(file));
// even with NS_OK file can be null if nothing was selected
if (file) {
nsAutoString filePath;
file->GetPath(filePath);
files->AppendElement(filePath);
}
--- a/dom/ipc/CrashReporterParent.h
+++ b/dom/ipc/CrashReporterParent.h
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: set sw=4 ts=8 et tw=80 :
* 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/PCrashReporterParent.h"
#include "mozilla/dom/TabMessageUtils.h"
#include "nsXULAppAPI.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
namespace mozilla {
namespace dom {
class ProcessReporter;
@@ -110,18 +110,18 @@ inline bool
CrashReporterParent::GeneratePairedMinidump(Toplevel* t)
{
CrashReporter::ProcessHandle child;
#ifdef XP_MACOSX
child = t->Process()->GetChildTask();
#else
child = t->OtherProcess();
#endif
- nsCOMPtr<nsILocalFile> childDump;
- nsCOMPtr<nsILocalFile> parentDump;
+ nsCOMPtr<nsIFile> childDump;
+ nsCOMPtr<nsIFile> parentDump;
if (CrashReporter::CreatePairedMinidumps(child,
mMainThread,
&mHangID,
getter_AddRefs(childDump),
getter_AddRefs(parentDump)) &&
CrashReporter::GetIDFromMinidump(childDump, mChildDumpID) &&
CrashReporter::GetIDFromMinidump(parentDump, mParentDumpID)) {
return true;
@@ -129,17 +129,17 @@ CrashReporterParent::GeneratePairedMinid
return false;
}
template<class Toplevel>
inline bool
CrashReporterParent::GenerateCrashReport(Toplevel* t,
const AnnotationTable* processNotes)
{
- nsCOMPtr<nsILocalFile> crashDump;
+ nsCOMPtr<nsIFile> crashDump;
if (t->TakeMinidump(getter_AddRefs(crashDump)) &&
CrashReporter::GetIDFromMinidump(crashDump, mChildDumpID)) {
return GenerateChildData(processNotes);
}
return false;
}
template<class Toplevel>
--- a/dom/plugins/base/nsNPAPIPluginStreamListener.cpp
+++ b/dom/plugins/base/nsNPAPIPluginStreamListener.cpp
@@ -3,17 +3,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 "nsNPAPIPluginStreamListener.h"
#include "plstr.h"
#include "prmem.h"
#include "nsDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsNetUtil.h"
#include "nsPluginHost.h"
#include "nsNPAPIPlugin.h"
#include "nsPluginSafety.h"
#include "nsPluginLogging.h"
#include "nsPluginStreamListenerPeer.h"
#include "mozilla/StandardInteger.h"
--- a/dom/plugins/base/nsNPAPIPluginStreamListener.h
+++ b/dom/plugins/base/nsNPAPIPluginStreamListener.h
@@ -109,17 +109,17 @@ public:
nsPluginStreamToFile(const char* target, nsIPluginInstanceOwner* owner);
virtual ~nsPluginStreamToFile();
NS_DECL_ISUPPORTS
NS_DECL_NSIOUTPUTSTREAM
protected:
char* mTarget;
nsCString mFileURL;
- nsCOMPtr<nsILocalFile> mTempFile;
+ nsCOMPtr<nsIFile> mTempFile;
nsCOMPtr<nsIOutputStream> mOutputStream;
nsIPluginInstanceOwner* mOwner;
};
class nsNPAPIPluginStreamListener : public nsITimerCallback,
public nsIHTTPHeaderListener
{
private:
--- a/dom/plugins/base/nsPluginDirServiceProvider.cpp
+++ b/dom/plugins/base/nsPluginDirServiceProvider.cpp
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsPluginDirServiceProvider.h"
#include "nsCRT.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsDependentString.h"
#include "prmem.h"
#include "nsArrayEnumerator.h"
#include "mozilla/Preferences.h"
#include <windows.h>
#include "nsIWindowsRegKey.h"
@@ -184,17 +184,17 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsPluginDi
//*****************************************************************************
// nsPluginDirServiceProvider::nsIDirectoryServiceProvider
//*****************************************************************************
NS_IMETHODIMP
nsPluginDirServiceProvider::GetFile(const char *charProp, bool *persistant,
nsIFile **_retval)
{
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
nsresult rv = NS_ERROR_FAILURE;
NS_ENSURE_ARG(charProp);
*_retval = nsnull;
*persistant = false;
nsCOMPtr<nsIWindowsRegKey> regKey =
@@ -446,26 +446,26 @@ nsPluginDirServiceProvider::GetFile(cons
}
nsresult
nsPluginDirServiceProvider::GetPLIDDirectories(nsISimpleEnumerator **aEnumerator)
{
NS_ENSURE_ARG_POINTER(aEnumerator);
*aEnumerator = nsnull;
- nsCOMArray<nsILocalFile> dirs;
+ nsCOMArray<nsIFile> dirs;
GetPLIDDirectoriesWithRootKey(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER, dirs);
GetPLIDDirectoriesWithRootKey(nsIWindowsRegKey::ROOT_KEY_LOCAL_MACHINE, dirs);
return NS_NewArrayEnumerator(aEnumerator, dirs);
}
nsresult
-nsPluginDirServiceProvider::GetPLIDDirectoriesWithRootKey(PRUint32 aKey, nsCOMArray<nsILocalFile> &aDirs)
+nsPluginDirServiceProvider::GetPLIDDirectoriesWithRootKey(PRUint32 aKey, nsCOMArray<nsIFile> &aDirs)
{
nsCOMPtr<nsIWindowsRegKey> regKey =
do_CreateInstance("@mozilla.org/windows-registry-key;1");
NS_ENSURE_TRUE(regKey, NS_ERROR_FAILURE);
nsresult rv = regKey->Open(aKey,
NS_LITERAL_STRING("Software\\MozillaPlugins"),
nsIWindowsRegKey::ACCESS_READ);
@@ -480,28 +480,28 @@ nsPluginDirServiceProvider::GetPLIDDirec
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIWindowsRegKey> childKey;
rv = regKey->OpenChild(childName, nsIWindowsRegKey::ACCESS_QUERY_VALUE,
getter_AddRefs(childKey));
if (NS_SUCCEEDED(rv) && childKey) {
nsAutoString path;
rv = childKey->ReadStringValue(NS_LITERAL_STRING("Path"), path);
if (NS_SUCCEEDED(rv)) {
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
if (NS_SUCCEEDED(NS_NewLocalFile(path, true,
getter_AddRefs(localFile))) &&
localFile) {
// Some vendors use a path directly to the DLL so chop off
// the filename
bool isDir = false;
if (NS_SUCCEEDED(localFile->IsDirectory(&isDir)) && !isDir) {
nsCOMPtr<nsIFile> temp;
localFile->GetParent(getter_AddRefs(temp));
if (temp)
- localFile = do_QueryInterface(temp);
+ localFile = temp;
}
// Now we check to make sure it's actually on disk and
// To see if we already have this directory in the array
bool isFileThere = false;
bool isDupEntry = false;
if (NS_SUCCEEDED(localFile->Exists(&isFileThere)) && isFileThere) {
PRInt32 c = aDirs.Count();
--- a/dom/plugins/base/nsPluginDirServiceProvider.h
+++ b/dom/plugins/base/nsPluginDirServiceProvider.h
@@ -32,16 +32,16 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
#ifdef XP_WIN
static nsresult GetPLIDDirectories(nsISimpleEnumerator **aEnumerator);
private:
static nsresult GetPLIDDirectoriesWithRootKey(PRUint32 aKey,
- nsCOMArray<nsILocalFile> &aDirs);
+ nsCOMArray<nsIFile> &aDirs);
#endif
protected:
virtual ~nsPluginDirServiceProvider();
};
#endif // nsPluginDirServiceProvider_h_
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -79,29 +79,27 @@
#include "prprf.h"
#include "nsThreadUtils.h"
#include "nsIInputStreamTee.h"
#include "nsIInterfaceInfoManager.h"
#include "xptinfo.h"
#include "nsIMIMEService.h"
#include "nsCExternalHandlerService.h"
-#include "nsILocalFile.h"
#include "nsIFileChannel.h"
#include "nsPluginSafety.h"
#include "nsICharsetConverterManager.h"
#include "nsIPlatformCharset.h"
#include "nsIDirectoryService.h"
#include "nsDirectoryServiceDefs.h"
#include "nsXULAppAPI.h"
#include "nsAppDirectoryServiceDefs.h"
-#include "nsIFile.h"
#include "nsPluginDirServiceProvider.h"
#include "nsPluginError.h"
#include "nsUnicharUtils.h"
#include "nsPluginManifestLineReader.h"
#include "nsIWeakReferenceUtils.h"
#include "nsIDOMElement.h"
@@ -1541,17 +1539,17 @@ nsPluginHost::FindPluginEnabledForExtens
static nsresult CreateNPAPIPlugin(nsPluginTag *aPluginTag,
nsNPAPIPlugin **aOutNPAPIPlugin)
{
// If this is an in-process plugin we'll need to load it here if we haven't already.
if (!nsNPAPIPlugin::RunPluginOOP(aPluginTag)) {
if (aPluginTag->mFullPath.IsEmpty())
return NS_ERROR_FAILURE;
- nsCOMPtr<nsILocalFile> file = do_CreateInstance("@mozilla.org/file/local;1");
+ nsCOMPtr<nsIFile> file = do_CreateInstance("@mozilla.org/file/local;1");
file->InitWithPath(NS_ConvertUTF8toUTF16(aPluginTag->mFullPath));
nsPluginFile pluginFile(file);
PRLibrary* pluginLibrary = NULL;
if (NS_FAILED(pluginFile.LoadPlugin(&pluginLibrary)) || !pluginLibrary)
return NS_ERROR_FAILURE;
aPluginTag->mLibrary = pluginLibrary;
@@ -1891,41 +1889,41 @@ nsresult nsPluginHost::ScanPluginsDirect
("nsPluginHost::ScanPluginsDirectory dir=%s\n", dirPath.get()));
#endif
nsCOMPtr<nsISimpleEnumerator> iter;
rv = pluginsDir->GetDirectoryEntries(getter_AddRefs(iter));
if (NS_FAILED(rv))
return rv;
- nsAutoTArray<nsCOMPtr<nsILocalFile>, 6> pluginFiles;
+ nsAutoTArray<nsCOMPtr<nsIFile>, 6> pluginFiles;
bool hasMore;
while (NS_SUCCEEDED(iter->HasMoreElements(&hasMore)) && hasMore) {
nsCOMPtr<nsISupports> supports;
rv = iter->GetNext(getter_AddRefs(supports));
if (NS_FAILED(rv))
continue;
- nsCOMPtr<nsILocalFile> dirEntry(do_QueryInterface(supports, &rv));
+ nsCOMPtr<nsIFile> dirEntry(do_QueryInterface(supports, &rv));
if (NS_FAILED(rv))
continue;
// Sun's JRE 1.3.1 plugin must have symbolic links resolved or else it'll crash.
// See bug 197855.
dirEntry->Normalize();
if (nsPluginsDir::IsPluginFile(dirEntry)) {
pluginFiles.AppendElement(dirEntry);
}
}
bool warnOutdated = false;
for (PRUint32 i = 0; i < pluginFiles.Length(); i++) {
- nsCOMPtr<nsILocalFile>& localfile = pluginFiles[i];
+ nsCOMPtr<nsIFile>& localfile = pluginFiles[i];
nsString utf16FilePath;
rv = localfile->GetPath(utf16FilePath);
if (NS_FAILED(rv))
continue;
PRInt64 fileModTime = LL_ZERO;
#if defined(XP_MACOSX)
@@ -2440,21 +2438,17 @@ nsPluginHost::WritePluginInfo()
return rv;
nsCAutoString filename(kPluginRegistryFilename);
filename.Append(".tmp");
rv = pluginReg->AppendNative(filename);
if (NS_FAILED(rv))
return rv;
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(pluginReg, &rv);
- if (NS_FAILED(rv))
- return rv;
-
- rv = localFile->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0600, &fd);
+ rv = pluginReg->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0600, &fd);
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIXULRuntime> runtime = do_GetService("@mozilla.org/xre/runtime;1");
if (!runtime) {
return NS_ERROR_FAILURE;
}
@@ -2550,19 +2544,19 @@ nsPluginHost::WritePluginInfo()
PLUGIN_REGISTRY_FIELD_DELIMITER,
PLUGIN_REGISTRY_END_OF_LINE_MARKER);
invalidPlugins = invalidPlugins->mNext;
}
PR_Close(fd);
nsCOMPtr<nsIFile> parent;
- rv = localFile->GetParent(getter_AddRefs(parent));
+ rv = pluginReg->GetParent(getter_AddRefs(parent));
NS_ENSURE_SUCCESS(rv, rv);
- rv = localFile->MoveToNative(parent, kPluginRegistryFilename);
+ rv = pluginReg->MoveToNative(parent, kPluginRegistryFilename);
return rv;
}
#define PLUGIN_REG_MIMETYPES_ARRAY_SIZE 12
nsresult
nsPluginHost::ReadPluginInfo()
{
nsresult rv;
@@ -2592,37 +2586,33 @@ nsPluginHost::ReadPluginInfo()
rv = mPluginRegFile->Clone(getter_AddRefs(pluginReg));
if (NS_FAILED(rv))
return rv;
rv = pluginReg->AppendNative(kPluginRegistryFilename);
if (NS_FAILED(rv))
return rv;
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(pluginReg, &rv);
- if (NS_FAILED(rv))
- return rv;
-
PRInt64 fileSize;
- rv = localFile->GetFileSize(&fileSize);
+ rv = pluginReg->GetFileSize(&fileSize);
if (NS_FAILED(rv))
return rv;
PRInt32 flen = PRInt64(fileSize);
if (flen == 0) {
NS_WARNING("Plugins Registry Empty!");
return NS_OK; // ERROR CONDITION
}
nsPluginManifestLineReader reader;
char* registry = reader.Init(flen);
if (!registry)
return NS_ERROR_OUT_OF_MEMORY;
- rv = localFile->OpenNSPRFileDesc(PR_RDONLY, 0444, &fd);
+ rv = pluginReg->OpenNSPRFileDesc(PR_RDONLY, 0444, &fd);
if (NS_FAILED(rv))
return rv;
// set rv to return an error on goto out
rv = NS_ERROR_FAILURE;
PRInt32 bread = PR_Read(fd, registry, flen);
PR_Close(fd);
@@ -2715,17 +2705,17 @@ nsPluginHost::ReadPluginInfo()
}
if (hasFullPathInFileNameField) {
fullpath = reader.LinePtr();
if (!reader.NextLine())
return rv;
// try to derive a file name from the full path
if (fullpath) {
- nsCOMPtr<nsILocalFile> file = do_CreateInstance("@mozilla.org/file/local;1");
+ nsCOMPtr<nsIFile> file = do_CreateInstance("@mozilla.org/file/local;1");
file->InitWithNativePath(nsDependentCString(fullpath));
file->GetNativeLeafName(derivedFileName);
filename = derivedFileName.get();
} else {
filename = NULL;
}
// skip the next line, useless in this version
@@ -3527,17 +3517,17 @@ nsPluginHost::CreateTempFileToPost(const
PRInt64 fileSize;
nsCAutoString filename;
// stat file == get size & convert file:///c:/ to c: if needed
nsCOMPtr<nsIFile> inFile;
rv = NS_GetFileFromURLSpec(nsDependentCString(aPostDataURL),
getter_AddRefs(inFile));
if (NS_FAILED(rv)) {
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
rv = NS_NewNativeLocalFile(nsDependentCString(aPostDataURL), false,
getter_AddRefs(localFile));
if (NS_FAILED(rv)) return rv;
inFile = localFile;
}
rv = inFile->GetFileSize(&fileSize);
if (NS_FAILED(rv)) return rv;
rv = inFile->GetNativePath(filename);
--- a/dom/plugins/base/nsPluginsDirUnix.cpp
+++ b/dom/plugins/base/nsPluginsDirUnix.cpp
@@ -8,17 +8,17 @@
#include "nsIMemory.h"
#include "nsPluginsDir.h"
#include "nsPluginsDirUtils.h"
#include "prmem.h"
#include "prenv.h"
#include "prerror.h"
#include <sys/stat.h>
#include "nsString.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#define LOCAL_PLUGIN_DLL_SUFFIX ".so"
#if defined(__hpux)
#define DEFAULT_X11_PATH "/usr/lib/X11R6/"
#undef LOCAL_PLUGIN_DLL_SUFFIX
#define LOCAL_PLUGIN_DLL_SUFFIX ".sl"
--- a/dom/plugins/base/nsPluginsDirWin.cpp
+++ b/dom/plugins/base/nsPluginsDirWin.cpp
@@ -18,17 +18,17 @@
#include "plstr.h"
#include "prmem.h"
#include "prprf.h"
#include "windows.h"
#include "winbase.h"
#include "nsString.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsUnicharUtils.h"
using namespace mozilla;
/* Local helper functions */
static char* GetKeyValue(void* verbuf, const WCHAR* key,
UINT language, UINT codepage)
@@ -234,25 +234,23 @@ nsPluginFile::~nsPluginFile()
}
/**
* Loads the plugin into memory using NSPR's shared-library loading
* mechanism. Handles platform differences in loading shared libraries.
*/
nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
{
- nsCOMPtr<nsILocalFile> plugin = do_QueryInterface(mPlugin);
-
- if (!plugin)
+ if (!mPlugin)
return NS_ERROR_NULL_POINTER;
bool protectCurrentDirectory = true;
nsAutoString pluginFolderPath;
- plugin->GetPath(pluginFolderPath);
+ mPlugin->GetPath(pluginFolderPath);
PRInt32 idx = pluginFolderPath.RFindChar('\\');
if (kNotFound == idx)
return NS_ERROR_FILE_INVALID_PATH;
if (Substring(pluginFolderPath, idx).LowerCaseEqualsLiteral("\\np32dsw.dll")) {
protectCurrentDirectory = false;
}
@@ -268,17 +266,17 @@ nsresult nsPluginFile::LoadPlugin(PRLibr
restoreOrigDir = SetCurrentDirectoryW(pluginFolderPath.get());
NS_ASSERTION(restoreOrigDir, "Error in Loading plugin");
}
if (protectCurrentDirectory) {
SetDllDirectory(NULL);
}
- nsresult rv = plugin->Load(outLibrary);
+ nsresult rv = mPlugin->Load(outLibrary);
if (NS_FAILED(rv))
*outLibrary = NULL;
if (protectCurrentDirectory) {
SetDllDirectory(L"");
}
if (restoreOrigDir) {
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -16,17 +16,17 @@
#include "mozilla/Util.h"
#include "mozilla/ipc/SyncChannel.h"
#ifdef MOZ_WIDGET_GTK2
#include <gtk/gtk.h>
#endif
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "pratom.h"
#include "nsDebug.h"
#include "nsCOMPtr.h"
#include "nsPluginsDir.h"
#include "nsXULAppAPI.h"
#ifdef MOZ_X11
@@ -147,17 +147,17 @@ PluginModuleChild::Init(const std::strin
mObjectMap.Init();
mStringIdentifiers.Init();
mIntIdentifiers.Init();
if (!InitGraphics())
return false;
mPluginFilename = aPluginFilename.c_str();
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
NS_NewLocalFile(NS_ConvertUTF8toUTF16(mPluginFilename),
true,
getter_AddRefs(localFile));
bool exists;
localFile->Exists(&exists);
NS_ASSERTION(exists, "plugin file ain't there");
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -26,17 +26,17 @@
#include "PluginIdentifierParent.h"
#include "nsAutoPtr.h"
#include "nsCRT.h"
#ifdef MOZ_CRASHREPORTER
#include "mozilla/dom/CrashReporterParent.h"
#endif
#include "nsNPAPIPlugin.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#ifdef XP_WIN
#include "mozilla/widget/AudioSession.h"
#endif
#include "sampler.h"
using base::KillProcess;
--- a/embedding/components/webbrowserpersist/public/nsIWebBrowserPersist.idl
+++ b/embedding/components/webbrowserpersist/public/nsIWebBrowserPersist.idl
@@ -5,17 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsICancelable.idl"
interface nsIURI;
interface nsIInputStream;
interface nsIDOMDocument;
interface nsIWebProgressListener;
-interface nsILocalFile;
+interface nsIFile;
interface nsIChannel;
/**
* Interface for persisting DOM documents and URIs to local or remote storage.
*/
[scriptable, uuid(dd4e0a6a-210f-419a-ad85-40e8543b9465)]
interface nsIWebBrowserPersist : nsICancelable
{
@@ -122,21 +122,21 @@ interface nsIWebBrowserPersist : nsICanc
* an nsIWebPageDescriptor, or the currentDescriptor of an
* nsIWebPageDescriptor.
* @param aReferrer The referrer URI to pass with an HTTP request or
* <CODE>nsnull</CODE>.
* @param aPostData Post data to pass with an HTTP request or
* <CODE>nsnull</CODE>.
* @param aExtraHeaders Additional headers to supply with an HTTP request
* or <CODE>nsnull</CODE>.
- * @param aFile Target file. This may be a nsILocalFile object or an
+ * @param aFile Target file. This may be a nsIFile object or an
* nsIURI object with a file scheme or a scheme that
* supports uploading (e.g. ftp).
*
- * @see nsILocalFile
+ * @see nsIFile
* @see nsIURI
* @see nsIInputStream
*
* @return NS_OK Operation has been started.
* @return NS_ERROR_INVALID_ARG One or more arguments was invalid.
*/
void saveURI(in nsIURI aURI, in nsISupports aCacheKey,
in nsIURI aReferrer, in nsIInputStream aPostData,
@@ -222,32 +222,32 @@ interface nsIWebBrowserPersist : nsICanc
/**
* Save the specified DOM document to file and optionally all linked files
* (e.g. images, CSS, JS & subframes). Do not call this method until the
* document has finished loading!
*
* @param aDocument Document to save to file. Some implementations of
* this interface may also support <CODE>nsnull</CODE>
* to imply the currently loaded document.
- * @param aFile Target local file. This may be a nsILocalFile object or an
+ * @param aFile Target local file. This may be a nsIFile object or an
* nsIURI object with a file scheme or a scheme that
* supports uploading (e.g. ftp).
* @param aDataPath Path to directory where URIs linked to the document
* are saved or nsnull if no linked URIs should be saved.
- * This may be a nsILocalFile object or an nsIURI object
+ * This may be a nsIFile object or an nsIURI object
* with a file scheme.
* @param aOutputContentType The desired MIME type format to save the
* document and all subdocuments into or nsnull to use
* the default behaviour.
* @param aEncodingFlags Flags to pass to the encoder.
* @param aWrapColumn For text documents, indicates the desired width to
* wrap text at. Parameter is ignored if wrapping is not
* specified by the encoding flags.
*
- * @see nsILocalFile
+ * @see nsIFile
* @see nsIURI
*
* @return NS_OK Operation has been started.
* @return NS_ERROR_INVALID_ARG One or more arguments was invalid.
*/
void saveDocument(in nsIDOMDocument aDocument,
in nsISupports aFile, in nsISupports aDataPath,
in string aOutputContentType, in unsigned long aEncodingFlags,
--- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
@@ -163,17 +163,17 @@ struct UploadData
mSelfProgress(0),
mSelfProgressMax(10000)
{
}
};
struct CleanupData
{
- nsCOMPtr<nsILocalFile> mFile;
+ nsCOMPtr<nsIFile> mFile;
// Snapshot of what the file actually is at the time of creation so that if
// it transmutes into something else later on it can be ignored. For example,
// catch files that turn into dirs or vice versa.
bool mIsDirectory;
};
// Maximum file length constant. The max file name length is
// volume / server dependent but it is difficult to obtain
@@ -693,17 +693,17 @@ NS_IMETHODIMP nsWebBrowserPersist::OnSto
{
if (NS_SUCCEEDED(mPersistResult) && NS_FAILED(status))
SendErrorStatusChange(true, status, request, data->mFile);
#if defined(XP_OS2)
// delete 'data'; this will close the stream and let
// us tag the file it created with its source URI
nsCOMPtr<nsIURI> uriSource = data->mOriginalLocation;
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
GetLocalFileFromURI(data->mFile, getter_AddRefs(localFile));
delete data;
mOutputMap.Remove(&key);
if (localFile)
{
nsCOMPtr<nsILocalFileOS2> localFileOS2 = do_QueryInterface(localFile);
if (localFileOS2)
{
@@ -1030,17 +1030,17 @@ nsresult nsWebBrowserPersist::SendErrorS
if (!mProgressListener)
{
// Do nothing
return NS_OK;
}
// Get the file path or spec from the supplied URI
- nsCOMPtr<nsILocalFile> file;
+ nsCOMPtr<nsIFile> file;
GetLocalFileFromURI(aURI, getter_AddRefs(file));
nsAutoString path;
if (file)
{
file->GetPath(path);
}
else
{
@@ -1120,17 +1120,17 @@ nsresult nsWebBrowserPersist::GetValidUR
*aURI = objAsURI;
NS_ADDREF(*aURI);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
-nsresult nsWebBrowserPersist::GetLocalFileFromURI(nsIURI *aURI, nsILocalFile **aLocalFile) const
+nsresult nsWebBrowserPersist::GetLocalFileFromURI(nsIURI *aURI, nsIFile **aLocalFile) const
{
nsresult rv;
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(aURI, &rv);
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIFile> file;
@@ -1480,20 +1480,20 @@ nsWebBrowserPersist::GetDocEncoderConten
nsresult nsWebBrowserPersist::SaveDocumentInternal(
nsIDOMDocument *aDocument, nsIURI *aFile, nsIURI *aDataPath)
{
NS_ENSURE_ARG_POINTER(aDocument);
NS_ENSURE_ARG_POINTER(aFile);
// See if we can get the local file representation of this URI
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
nsresult rv = GetLocalFileFromURI(aFile, getter_AddRefs(localFile));
- nsCOMPtr<nsILocalFile> localDataPath;
+ nsCOMPtr<nsIFile> localDataPath;
if (NS_SUCCEEDED(rv) && aDataPath)
{
// See if we can get the local file representation of this URI
rv = GetLocalFileFromURI(aDataPath, getter_AddRefs(localDataPath));
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
}
nsCOMPtr<nsIDOMNode> docAsNode = do_QueryInterface(aDocument);
@@ -1629,17 +1629,17 @@ nsresult nsWebBrowserPersist::SaveDocume
localDataPath->Exists(&exists);
if (exists)
{
localDataPath->IsDirectory(&haveDir);
}
if (!haveDir)
{
- rv = localDataPath->Create(nsILocalFile::DIRECTORY_TYPE, 0755);
+ rv = localDataPath->Create(nsIFile::DIRECTORY_TYPE, 0755);
if (NS_SUCCEEDED(rv))
haveDir = true;
else
SendErrorStatusChange(false, rv, nsnull, aFile);
}
if (!haveDir)
{
EndDownload(NS_ERROR_FAILURE);
@@ -1814,17 +1814,17 @@ void nsWebBrowserPersist::CleanupLocalFi
// and are not deleted.
int pass;
for (pass = 0; pass < 2; pass++)
{
PRUint32 i;
for (i = 0; i < mCleanupList.Length(); i++)
{
CleanupData *cleanupData = mCleanupList.ElementAt(i);
- nsCOMPtr<nsILocalFile> file = cleanupData->mFile;
+ nsCOMPtr<nsIFile> file = cleanupData->mFile;
// Test if the dir / file exists (something in an earlier loop
// may have already removed it)
bool exists = false;
file->Exists(&exists);
if (!exists)
continue;
@@ -1875,17 +1875,17 @@ void nsWebBrowserPersist::CleanupLocalFi
// Child files automatically make this code drop out,
// while child dirs keep the loop going.
nsCOMPtr<nsISupports> child;
curPos->GetNext(getter_AddRefs(child));
NS_ASSERTION(child, "No child element, but hasMoreElements says otherwise");
if (!child)
continue;
- nsCOMPtr<nsILocalFile> childAsFile = do_QueryInterface(child);
+ nsCOMPtr<nsIFile> childAsFile = do_QueryInterface(child);
NS_ASSERTION(childAsFile, "This should be a file but isn't");
bool childIsSymlink = false;
childAsFile->IsSymlink(&childIsSymlink);
bool childIsDir = false;
childAsFile->IsDirectory(&childIsDir);
if (!childIsDir || childIsSymlink)
{
@@ -2046,17 +2046,17 @@ nsWebBrowserPersist::CalculateUniqueFile
{
// Final sanity test
if (filename.Length() > kDefaultMaxFilenameLength)
{
NS_WARNING("Filename wasn't truncated less than the max file length - how can that be?");
return NS_ERROR_FAILURE;
}
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
GetLocalFileFromURI(aURI, getter_AddRefs(localFile));
if (localFile)
{
nsAutoString filenameAsUnichar;
filenameAsUnichar.AssignWithConversion(filename.get());
localFile->SetLeafName(filenameAsUnichar);
@@ -2109,17 +2109,17 @@ nsWebBrowserPersist::MakeFilenameFromURI
{
fileName.Append(PRUnichar(*p));
if (++nameLength == kDefaultMaxFilenameLength)
{
// Note:
// There is no point going any further since it will be
// truncated in CalculateUniqueFilename anyway.
// More importantly, certain implementations of
- // nsILocalFile (e.g. the Mac impl) might truncate
+ // nsIFile (e.g. the Mac impl) might truncate
// names in undesirable ways, such as truncating from
// the middle, inserting ellipsis and so on.
break;
}
}
}
}
}
@@ -2165,17 +2165,17 @@ nsWebBrowserPersist::CalculateAndAppendF
// Append the extension onto the file
if (!contentType.IsEmpty())
{
nsCOMPtr<nsIMIMEInfo> mimeInfo;
mMIMEService->GetFromTypeAndExtension(
contentType, EmptyCString(), getter_AddRefs(mimeInfo));
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
GetLocalFileFromURI(aURI, getter_AddRefs(localFile));
if (mimeInfo)
{
nsCOMPtr<nsIURL> url(do_QueryInterface(aURI));
NS_ENSURE_TRUE(url, NS_ERROR_FAILURE);
nsCAutoString newFileName;
@@ -2242,29 +2242,29 @@ nsWebBrowserPersist::CalculateAndAppendF
}
nsresult
nsWebBrowserPersist::MakeOutputStream(
nsIURI *aURI, nsIOutputStream **aOutputStream)
{
nsresult rv;
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
GetLocalFileFromURI(aURI, getter_AddRefs(localFile));
if (localFile)
rv = MakeOutputStreamFromFile(localFile, aOutputStream);
else
rv = MakeOutputStreamFromURI(aURI, aOutputStream);
return rv;
}
nsresult
nsWebBrowserPersist::MakeOutputStreamFromFile(
- nsILocalFile *aFile, nsIOutputStream **aOutputStream)
+ nsIFile *aFile, nsIOutputStream **aOutputStream)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIFileOutputStream> fileOutputStream =
do_CreateInstance(NS_LOCALFILEOUTPUTSTREAM_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
// XXX brade: get the right flags here!
@@ -3686,17 +3686,17 @@ nsresult
nsWebBrowserPersist::SaveDocumentWithFixup(
nsIDOMDocument *aDocument, nsIDocumentEncoderNodeFixup *aNodeFixup,
nsIURI *aFile, bool aReplaceExisting, const nsACString &aFormatType,
const nsCString &aSaveCharset, PRUint32 aFlags)
{
NS_ENSURE_ARG_POINTER(aFile);
nsresult rv = NS_OK;
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
GetLocalFileFromURI(aFile, getter_AddRefs(localFile));
if (localFile)
{
// if we're not replacing an existing file but the file
// exists, something is wrong
bool fileExists = false;
rv = localFile->Exists(&fileExists);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
--- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h
+++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.h
@@ -15,17 +15,17 @@
#include "nsIStreamListener.h"
#include "nsIOutputStream.h"
#include "nsIInputStream.h"
#include "nsIChannel.h"
#include "nsIStyleSheet.h"
#include "nsIDocumentEncoder.h"
#include "nsITransport.h"
#include "nsIProgressEventSink.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIWebProgressListener2.h"
#include "nsHashtable.h"
#include "nsTArray.h"
#include "nsCWebBrowserPersist.h"
class nsEncoderNodeFixup;
@@ -76,24 +76,24 @@ protected:
const PRUnichar *aContentType, PRUnichar **aExt);
nsresult GetDocumentExtension(nsIDOMDocument *aDocument, PRUnichar **aExt);
// Private members
private:
void Cleanup();
void CleanupLocalFiles();
nsresult GetValidURIFromObject(nsISupports *aObject, nsIURI **aURI) const;
- nsresult GetLocalFileFromURI(nsIURI *aURI, nsILocalFile **aLocalFile) const;
+ nsresult GetLocalFileFromURI(nsIURI *aURI, nsIFile **aLocalFile) const;
nsresult AppendPathToURI(nsIURI *aURI, const nsAString & aPath) const;
nsresult MakeAndStoreLocalFilenameInURIMap(
nsIURI *aURI, bool aNeedsPersisting, URIData **aData);
nsresult MakeOutputStream(
nsIURI *aFile, nsIOutputStream **aOutputStream);
nsresult MakeOutputStreamFromFile(
- nsILocalFile *aFile, nsIOutputStream **aOutputStream);
+ nsIFile *aFile, nsIOutputStream **aOutputStream);
nsresult MakeOutputStreamFromURI(nsIURI *aURI, nsIOutputStream **aOutStream);
nsresult CreateChannelFromURI(nsIURI *aURI, nsIChannel **aChannel);
nsresult StartUpload(nsIStorageStream *aOutStream, nsIURI *aDestinationURI,
const nsACString &aContentType);
nsresult StartUpload(nsIInputStream *aInputStream, nsIURI *aDestinationURI,
const nsACString &aContentType);
nsresult CalculateAndAppendFileExt(nsIURI *aURI, nsIChannel *aChannel,
nsIURI *aOriginalURIWithExtension);
--- a/embedding/tests/winEmbed/winEmbed.cpp
+++ b/embedding/tests/winEmbed/winEmbed.cpp
@@ -197,25 +197,25 @@ int main(int argc, char *argv[])
fprintf(stderr, "Error: %i\n", GetLastError());
return 5;
}
// Scope all the XPCOM stuff
{
strcpy(lastslash, "\\xulrunner");
- nsCOMPtr<nsILocalFile> xuldir;
+ nsCOMPtr<nsIFile> xuldir;
rv = NS_NewNativeLocalFile(nsCString(path), false,
getter_AddRefs(xuldir));
if (NS_FAILED(rv))
return 6;
*lastslash = '\0';
- nsCOMPtr<nsILocalFile> appdir;
+ nsCOMPtr<nsIFile> appdir;
rv = NS_NewNativeLocalFile(nsCString(path), false,
getter_AddRefs(appdir));
if (NS_FAILED(rv))
return 8;
rv = XRE_InitEmbedding2(xuldir, appdir, nsnull);
if (NS_FAILED(rv))
return 9;
@@ -741,28 +741,27 @@ nsresult StartupProfile()
{
nsCOMPtr<nsIFile> appDataDir;
nsresult rv = NS_GetSpecialDirectory(NS_APP_APPLICATION_REGISTRY_DIR, getter_AddRefs(appDataDir));
if (NS_FAILED(rv))
return rv;
appDataDir->AppendNative(nsCString("winembed"));
- nsCOMPtr<nsILocalFile> localAppDataDir(do_QueryInterface(appDataDir));
nsCOMPtr<nsProfileDirServiceProvider> locProvider;
NS_NewProfileDirServiceProvider(true, getter_AddRefs(locProvider));
if (!locProvider)
return NS_ERROR_FAILURE;
rv = locProvider->Register();
if (NS_FAILED(rv))
return rv;
- return locProvider->SetProfileDir(localAppDataDir);
+ return locProvider->SetProfileDir(appDataDir);
}
///////////////////////////////////////////////////////////////////////////////
// WebBrowserChromeUI
//
--- a/extensions/spellcheck/hunspell/src/mozHunspell.cpp
+++ b/extensions/spellcheck/hunspell/src/mozHunspell.cpp
@@ -183,17 +183,17 @@ NS_IMETHODIMP mozHunspell::SetDictionary
nsIFile* affFile = mDictionaries.GetWeak(nsDependentString(aDictionary));
if (!affFile)
return NS_ERROR_FILE_NOT_FOUND;
nsCAutoString dictFileName, affFileName;
// XXX This isn't really good. nsIFile->NativePath isn't safe for all
// character sets on Windows.
- // A better way would be to QI to nsILocalFile, and get a filehandle
+ // A better way would be to QI to nsIFile, and get a filehandle
// from there. Only problem is that hunspell wants a path
nsresult rv = affFile->GetNativePath(affFileName);
NS_ENSURE_SUCCESS(rv, rv);
if (mAffixFileName.Equals(affFileName.get()))
return NS_OK;
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -36,17 +36,17 @@
#include <android/log.h>
#endif
#define GLES2_LIB "libGLESv2.so"
#define GLES2_LIB2 "libGLESv2.so.2"
#elif defined(XP_WIN)
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#define GLES2_LIB "libGLESv2.dll"
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <windows.h>
--- a/gfx/gl/GLLibraryEGL.h
+++ b/gfx/gl/GLLibraryEGL.h
@@ -7,17 +7,17 @@
#if defined(MOZ_X11)
#include "mozilla/X11Util.h"
#endif
#include "GLContext.h"
#include "GLLibraryLoader.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
typedef int EGLint;
typedef unsigned int EGLBoolean;
typedef unsigned int EGLenum;
typedef void *EGLConfig;
typedef void *EGLContext;
typedef void *EGLDisplay;
typedef void *EGLSurface;
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -12,17 +12,17 @@
#include "nsUnicharUtils.h"
#include "mozilla/Preferences.h"
#include "nsServiceManagerUtils.h"
#include "nsTArray.h"
#include "nsIWindowsRegKey.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "plbase64.h"
#include "nsIXULRuntime.h"
#include "nsIGfxInfo.h"
#include "gfxCrashReporterUtils.h"
#include "gfxGDIFontList.h"
--- a/image/decoders/icon/mac/nsIconChannelCocoa.mm
+++ b/image/decoders/icon/mac/nsIconChannelCocoa.mm
@@ -205,24 +205,22 @@ nsresult nsIconChannel::MakeInputStream(
nsXPIDLCString contentType;
nsCAutoString fileExt;
nsCOMPtr<nsIFile> fileloc; // file we want an icon for
PRUint32 desiredImageSize;
nsresult rv = ExtractIconInfoFromUrl(getter_AddRefs(fileloc), &desiredImageSize, contentType, fileExt);
NS_ENSURE_SUCCESS(rv, rv);
- // ensure that we DO NOT resolve aliases, very important for file views
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(fileloc);
- if (localFile)
- localFile->SetFollowLinks(false);
-
bool fileExists = false;
- if (fileloc)
- localFile->Exists(&fileExists);
+ if (fileloc) {
+ // ensure that we DO NOT resolve aliases, very important for file views
+ fileloc->SetFollowLinks(false);
+ fileloc->Exists(&fileExists);
+ }
NSImage* iconImage = nil;
// first try to get the icon from the file if it exists
if (fileExists) {
nsCOMPtr<nsILocalFileMac> localFileMac(do_QueryInterface(fileloc, &rv));
NS_ENSURE_SUCCESS(rv, rv);
--- a/image/decoders/icon/os2/nsIconChannel.cpp
+++ b/image/decoders/icon/os2/nsIconChannel.cpp
@@ -6,17 +6,17 @@
//------------------------------------------------------------------------
#include "nsIconChannel.h"
#include "nsIIconURI.h"
#include "nsReadableUtils.h"
#include "nsMemory.h"
#include "nsNetUtil.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIFileURL.h"
#include "nsDirectoryServiceDefs.h"
#include "nsIRwsService.h"
#define INCL_PM
#include <os2.h>
//------------------------------------------------------------------------
--- a/ipc/glue/GeckoChildProcessHost.cpp
+++ b/ipc/glue/GeckoChildProcessHost.cpp
@@ -22,17 +22,16 @@
#if defined(OS_LINUX)
# define XP_LINUX 1
#endif
#include "nsExceptionHandler.h"
#include "nsDirectoryServiceDefs.h"
#include "nsIFile.h"
-#include "nsILocalFile.h"
#include "mozilla/ipc/BrowserProcessSubThread.h"
#include "mozilla/Omnijar.h"
#include <sys/stat.h>
#ifdef XP_WIN
#include "nsIWinTaskbar.h"
#define NS_TASKBAR_CONTRACTID "@mozilla.org/windows-taskbar;1"
--- a/ipc/glue/ScopedXREEmbed.cpp
+++ b/ipc/glue/ScopedXREEmbed.cpp
@@ -3,17 +3,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ScopedXREEmbed.h"
#include "base/command_line.h"
#include "base/string_util.h"
#include "nsIFile.h"
-#include "nsILocalFile.h"
#include "nsCOMPtr.h"
#include "nsServiceManagerUtils.h"
#include "nsStringGlue.h"
#include "nsXULAppAPI.h"
using mozilla::ipc::ScopedXREEmbed;
@@ -36,17 +35,17 @@ ScopedXREEmbed::Start()
#if defined(OS_WIN)
path = WideToUTF8(CommandLine::ForCurrentProcess()->program());
#elif defined(OS_POSIX)
path = CommandLine::ForCurrentProcess()->argv()[0];
#else
# error Sorry
#endif
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
nsresult rv = XRE_GetBinaryPath(path.c_str(), getter_AddRefs(localFile));
if (NS_FAILED(rv))
return;
nsCOMPtr<nsIFile> parent;
rv = localFile->GetParent(getter_AddRefs(parent));
if (NS_FAILED(rv))
return;
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -3035,17 +3035,17 @@ class _GenerateProtocolActorCode(ipdl.as
StmtReturn(ExprCall(
ExprVar('base::GetProcId'),
args=[ p.otherProcessVar() ])),
])
dumpvar = ExprVar('aDump')
getdump = MethodDefn(MethodDecl(
'TakeMinidump',
- params=[ Decl(Type('nsILocalFile', ptrptr=1), dumpvar.name) ],
+ params=[ Decl(Type('nsIFile', ptrptr=1), dumpvar.name) ],
ret=Type.BOOL,
const=1))
getdump.addstmts([
CppDirective('ifdef', 'MOZ_CRASHREPORTER'),
StmtReturn(ExprCall(
ExprVar('XRE_TakeMinidumpForChild'),
args=[ ExprCall(otherpidvar), dumpvar ])),
CppDirective('else'),
--- a/ipc/testshell/XPCShellEnvironment.cpp
+++ b/ipc/testshell/XPCShellEnvironment.cpp
@@ -79,17 +79,17 @@ public:
XPCShellDirProvider() { }
~XPCShellDirProvider() { }
bool SetGREDir(const char *dir);
void ClearGREDir() { mGREDir = nsnull; }
private:
- nsCOMPtr<nsILocalFile> mGREDir;
+ nsCOMPtr<nsIFile> mGREDir;
};
inline XPCShellEnvironment*
Environment(JSContext* cx)
{
XPCShellEnvironment* env =
static_cast<XPCShellEnvironment*>(JS_GetContextPrivate(cx));
NS_ASSERTION(env, "Should never be null!");
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -17,17 +17,17 @@
#include <android/log.h>
#endif
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsICategoryManager.h"
#include "nsIComponentManager.h"
#include "mozilla/Module.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIServiceManager.h"
#include "nsISupports.h"
#include "mozJSComponentLoader.h"
#include "mozJSLoaderUtils.h"
#include "nsIJSRuntimeService.h"
#include "nsIJSContextStack.h"
#include "nsIXPConnect.h"
#include "nsCRT.h"
@@ -437,17 +437,17 @@ mozJSComponentLoader::ReallyInit()
mInitialized = true;
return NS_OK;
}
const mozilla::Module*
mozJSComponentLoader::LoadModule(FileLocation &aFile)
{
- nsCOMPtr<nsILocalFile> file = aFile.GetBaseFile();
+ nsCOMPtr<nsIFile> file = aFile.GetBaseFile();
nsCString spec;
aFile.GetURIString(spec);
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), spec);
if (NS_FAILED(rv))
return NULL;
@@ -603,17 +603,17 @@ class ANSIFileAutoCloser
explicit ANSIFileAutoCloser(FILE *file) : mFile(file) {}
~ANSIFileAutoCloser() { fclose(mFile); }
private:
FILE *mFile;
};
#endif
nsresult
-mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
+mozJSComponentLoader::GlobalForLocation(nsIFile *aComponentFile,
nsIURI *aURI,
JSObject **aGlobal,
char **aLocation,
jsval *exception)
{
nsresult rv;
JSCLContextHelper cx(this);
@@ -661,17 +661,17 @@ mozJSComponentLoader::GlobalForLocation(
fileURL->GetFile(getter_AddRefs(testFile));
}
if (testFile) {
realFile = true;
nsCOMPtr<nsIXPConnectJSObjectHolder> locationHolder;
rv = xpc->WrapNative(cx, global, aComponentFile,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(locationHolder));
NS_ENSURE_SUCCESS(rv, rv);
JSObject *locationObj;
rv = locationHolder->GetJSObject(&locationObj);
NS_ENSURE_SUCCESS(rv, rv);
if (!JS_DefineProperty(cx, global, "__LOCATION__",
@@ -1087,17 +1087,17 @@ mozJSComponentLoader::ImportInto(const n
baseFileURL = do_QueryInterface(resolvedURI, &rv);
NS_ENSURE_SUCCESS(rv, rv);
}
nsCOMPtr<nsIFile> sourceFile;
rv = baseFileURL->GetFile(getter_AddRefs(sourceFile));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> sourceLocalFile;
+ nsCOMPtr<nsIFile> sourceLocalFile;
sourceLocalFile = do_QueryInterface(sourceFile, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString key;
rv = resolvedURI->GetSpec(key);
NS_ENSURE_SUCCESS(rv, rv);
ModuleEntry* mod;
--- a/js/xpconnect/loader/mozJSComponentLoader.h
+++ b/js/xpconnect/loader/mozJSComponentLoader.h
@@ -49,17 +49,17 @@ class mozJSComponentLoader : public mozi
const mozilla::Module* LoadModule(mozilla::FileLocation &aFile);
protected:
static mozJSComponentLoader* sSelf;
nsresult ReallyInit();
void UnloadModules();
- nsresult GlobalForLocation(nsILocalFile* aComponentFile,
+ nsresult GlobalForLocation(nsIFile* aComponentFile,
nsIURI *aComponent,
JSObject **aGlobal,
char **location,
jsval *exception);
nsresult ImportInto(const nsACString & aLocation,
JSObject * targetObj,
JSContext * callercx,
--- a/js/xpconnect/shell/xpcshell.cpp
+++ b/js/xpconnect/shell/xpcshell.cpp
@@ -22,20 +22,19 @@
#include "nsIXPConnect.h"
#include "nsIXPCScriptable.h"
#include "nsIInterfaceInfo.h"
#include "nsIInterfaceInfoManager.h"
#include "nsIXPCScriptable.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsIComponentRegistrar.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsStringAPI.h"
#include "nsIDirectoryService.h"
-#include "nsILocalFile.h"
#include "nsDirectoryServiceDefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nscore.h"
#include "nsArrayEnumerator.h"
#include "nsCOMArray.h"
#include "nsDirectoryServiceUtils.h"
#include "nsMemory.h"
#include "nsISupportsImpl.h"
@@ -86,22 +85,22 @@ public:
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
XPCShellDirProvider() { }
~XPCShellDirProvider() { }
bool SetGREDir(const char *dir);
void ClearGREDir() { mGREDir = nsnull; }
- void SetAppFile(nsILocalFile *appFile);
+ void SetAppFile(nsIFile *appFile);
void ClearAppFile() { mAppFile = nsnull; }
private:
- nsCOMPtr<nsILocalFile> mGREDir;
- nsCOMPtr<nsILocalFile> mAppFile;
+ nsCOMPtr<nsIFile> mGREDir;
+ nsCOMPtr<nsIFile> mAppFile;
};
/***************************************************************************/
#ifdef JS_THREADSAFE
#define DoBeginRequest(cx) JS_BeginRequest((cx))
#define DoEndRequest(cx) JS_EndRequest((cx))
#else
@@ -166,17 +165,17 @@ GetLocationProperty(JSContext *cx, JSHan
if (*start == L'/')
*start = L'\\';
start++;
}
#elif defined(XP_UNIX)
NS_ConvertUTF8toUTF16 filenameString(filename);
#endif
- nsCOMPtr<nsILocalFile> location;
+ nsCOMPtr<nsIFile> location;
if (NS_SUCCEEDED(rv)) {
rv = NS_NewLocalFile(filenameString,
false, getter_AddRefs(location));
}
if (!location && gWorkingDirectory) {
// could be a relative path, try appending it to the cwd
// and then normalize
@@ -192,17 +191,17 @@ GetLocationProperty(JSContext *cx, JSHan
JSObject *locationObj = NULL;
bool symlink;
// don't normalize symlinks, because that's kind of confusing
if (NS_SUCCEEDED(location->IsSymlink(&symlink)) &&
!symlink)
location->Normalize();
rv = xpc->WrapNative(cx, obj, location,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(locationHolder));
if (NS_SUCCEEDED(rv) &&
NS_SUCCEEDED(locationHolder->GetJSObject(&locationObj))) {
*vp = OBJECT_TO_JSVAL(locationObj);
}
}
}
@@ -1700,17 +1699,17 @@ main(int argc, char **argv, char **envp)
#endif
gErrFile = stderr;
gOutFile = stdout;
gInFile = stdin;
NS_LogInit();
- nsCOMPtr<nsILocalFile> appFile;
+ nsCOMPtr<nsIFile> appFile;
rv = XRE_GetBinaryPath(argv[0], getter_AddRefs(appFile));
if (NS_FAILED(rv)) {
printf("Couldn't find application file.\n");
return 1;
}
nsCOMPtr<nsIFile> appDir;
rv = appFile->GetParent(getter_AddRefs(appDir));
if (NS_FAILED(rv)) {
@@ -1733,49 +1732,49 @@ main(int argc, char **argv, char **envp)
argc -= 2;
argv += 2;
}
if (argc > 1 && !strcmp(argv[1], "-a")) {
if (argc < 3)
return usage();
- nsCOMPtr<nsILocalFile> dir;
+ nsCOMPtr<nsIFile> dir;
rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(dir));
if (NS_SUCCEEDED(rv)) {
appDir = do_QueryInterface(dir, &rv);
}
if (NS_FAILED(rv)) {
printf("Couldn't use given appdir.\n");
return 1;
}
argc -= 2;
argv += 2;
}
while (argc > 1 && !strcmp(argv[1], "-r")) {
if (argc < 3)
return usage();
- nsCOMPtr<nsILocalFile> lf;
+ nsCOMPtr<nsIFile> lf;
rv = XRE_GetFileFromPath(argv[2], getter_AddRefs(lf));
if (NS_FAILED(rv)) {
printf("Couldn't get manifest file.\n");
return 1;
}
XRE_AddManifestLocation(NS_COMPONENT_LOCATION, lf);
argc -= 2;
argv += 2;
}
{
if (argc > 1 && !strcmp(argv[1], "--greomni")) {
- nsCOMPtr<nsILocalFile> greOmni;
- nsCOMPtr<nsILocalFile> appOmni;
+ nsCOMPtr<nsIFile> greOmni;
+ nsCOMPtr<nsIFile> appOmni;
XRE_GetFileFromPath(argv[2], getter_AddRefs(greOmni));
if (argc > 3 && !strcmp(argv[3], "--appomni")) {
XRE_GetFileFromPath(argv[4], getter_AddRefs(appOmni));
argc-=2;
argv+=2;
} else {
appOmni = greOmni;
}
@@ -2003,17 +2002,17 @@ main(int argc, char **argv, char **envp)
bool
XPCShellDirProvider::SetGREDir(const char *dir)
{
nsresult rv = XRE_GetFileFromPath(dir, getter_AddRefs(mGREDir));
return NS_SUCCEEDED(rv);
}
void
-XPCShellDirProvider::SetAppFile(nsILocalFile* appFile)
+XPCShellDirProvider::SetAppFile(nsIFile* appFile)
{
mAppFile = appFile;
}
NS_IMETHODIMP_(nsrefcnt)
XPCShellDirProvider::AddRef()
{
return 2;
@@ -2063,17 +2062,17 @@ XPCShellDirProvider::GetFile(const char
}
#ifdef MOZ_APP_PROFILE
sprintf(path, "%s\\%s", appData, MOZ_APP_PROFILE);
#else
sprintf(path, "%s\\%s\\%s\\%s", appData, MOZ_APP_VENDOR, MOZ_APP_BASENAME, MOZ_APP_NAME);
#endif
nsAutoString pathName;
pathName.AssignASCII(path);
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
nsresult rv = NS_NewLocalFile(pathName, true, getter_AddRefs(localFile));
if (NS_FAILED(rv)) {
return rv;
}
return localFile->Clone(result);
#else
// Fail on non-Windows platforms, the caller is supposed to fal back on
// the app dir.
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -8031,17 +8031,17 @@ DumpToPNG(nsIPresShell* shell, nsAString
nsCOMPtr<imgIEncoder> encoder = do_CreateInstance("@mozilla.org/image/encoder;2?type=image/png");
NS_ENSURE_TRUE(encoder, NS_ERROR_FAILURE);
encoder->InitFromData(imgSurface->Data(), imgSurface->Stride() * height,
width, height, imgSurface->Stride(),
imgIEncoder::INPUT_FORMAT_HOSTARGB, EmptyString());
// XXX not sure if this is the right way to write to a file
- nsCOMPtr<nsILocalFile> file = do_CreateInstance("@mozilla.org/file/local;1");
+ nsCOMPtr<nsIFile> file = do_CreateInstance("@mozilla.org/file/local;1");
NS_ENSURE_TRUE(file, NS_ERROR_FAILURE);
rv = file->InitWithPath(name);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 length;
encoder->Available(&length);
nsCOMPtr<nsIOutputStream> outputStream;
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -23,17 +23,17 @@
#include "nsIPresShell.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsPIDOMWindow.h"
#include "nsIFilePicker.h"
#include "nsIDOMMouseEvent.h"
#include "nsINodeInfo.h"
#include "nsIDOMEventTarget.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsHTMLInputElement.h"
#include "nsNodeInfoManager.h"
#include "nsContentCreatorFunctions.h"
#include "nsContentUtils.h"
#include "nsDisplayList.h"
#include "nsIDOMNSEvent.h"
#include "nsEventListenerManager.h"
#ifdef ACCESSIBILITY
--- a/layout/style/nsFontFaceLoader.cpp
+++ b/layout/style/nsFontFaceLoader.cpp
@@ -10,17 +10,16 @@
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif /* MOZ_LOGGING */
#include "prlog.h"
#include "nsFontFaceLoader.h"
#include "nsError.h"
#include "nsIFile.h"
-#include "nsILocalFile.h"
#include "nsIStreamListener.h"
#include "nsNetUtil.h"
#include "nsIChannelEventSink.h"
#include "nsIInterfaceRequestor.h"
#include "nsContentUtils.h"
#include "mozilla/Preferences.h"
#include "nsPresContext.h"
--- a/layout/style/test/ParseCSS.cpp
+++ b/layout/style/test/ParseCSS.cpp
@@ -10,27 +10,27 @@
* |#ifdef DEBUG| block in nsCSSScanner::OutputError (in
* nsCSSScanner.cpp in the same directory) used (even if not a debug
* build).
*/
#include "nsXPCOM.h"
#include "nsCOMPtr.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsNetUtil.h"
#include "nsContentCID.h"
#include "mozilla/css/Loader.h"
#include "nsCSSStyleSheet.h"
static already_AddRefed<nsIURI>
FileToURI(const char *aFilename, nsresult *aRv = 0)
{
- nsCOMPtr<nsILocalFile> lf(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, aRv));
+ nsCOMPtr<nsIFile> lf(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, aRv));
NS_ENSURE_TRUE(lf, nsnull);
// XXX Handle relative paths somehow.
lf->InitWithNativePath(nsDependentCString(aFilename));
nsIURI *uri = nsnull;
nsresult rv = NS_NewFileURI(&uri, lf);
if (aRv)
*aRv = rv;
--- a/layout/tools/layout-debug/src/nsILayoutRegressionTester.idl
+++ b/layout/tools/layout-debug/src/nsILayoutRegressionTester.idl
@@ -1,17 +1,17 @@
/* -*- 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 "nsISupports.idl"
interface nsIDOMWindow;
-interface nsILocalFile;
+interface nsIFile;
[scriptable, uuid(B249B2C0-EE11-11DA-8AD9-0800200C9A66)]
interface nsILayoutRegressionTester : nsISupports
{
/**
* Dumps the content of a window
* @param aWindowToDump the window to dump (may be an iframe etc)
* @param aFile the file to dump to. It will be created if necessary, otherwise
@@ -23,22 +23,22 @@ interface nsILayoutRegressionTester : ns
*/
const short DUMP_FLAGS_MASK_DEFAULT = 0;
const short DUMP_FLAGS_MASK_PRINT_MODE = 1;
const long DUMP_RESULT_COMPLETED = 0; // loaded OK
const long DUMP_RESULT_LOADING = 1; // still loading
const long DUMP_RESULT_ERROR = 2; // an error occurred
- long dumpFrameModel(in nsIDOMWindow aWindowToDump, in nsILocalFile aFile, in unsigned long aFlagsMask);
+ long dumpFrameModel(in nsIDOMWindow aWindowToDump, in nsIFile aFile, in unsigned long aFlagsMask);
/**
* Compares the contents of frame model files
* @param aBaseFile the baseline file, opened with read permissions
* @param aVerFile file containing the results to verify, opened with read permissions
* @param aFlags flags specifying output verbosity
* @param aResult result of the comparison: zero if the files are same, non-zero if different
*/
const short COMPARE_FLAGS_VERBOSE = 0;
const short COMPARE_FLAGS_BRIEF = 1;
- long compareFrameModels(in nsILocalFile aBaseFile, in nsILocalFile aVerFile, in unsigned long aFlags);
+ long compareFrameModels(in nsIFile aBaseFile, in nsIFile aVerFile, in unsigned long aFlags);
};
--- a/layout/tools/layout-debug/src/nsRegressionTester.cpp
+++ b/layout/tools/layout-debug/src/nsRegressionTester.cpp
@@ -23,17 +23,17 @@
#include "nsIDocShell.h"
#include "nsIContentViewer.h"
#include "nsIContentViewerFile.h"
#include "nsIFrame.h"
#include "nsStyleStruct.h"
#include "nsIFrameUtil.h"
#include "nsLayoutCID.h"
#include "nsNetUtil.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIViewManager.h"
#include "nsIView.h"
static NS_DEFINE_CID(kFrameUtilCID, NS_FRAME_UTIL_CID);
@@ -44,17 +44,17 @@ nsRegressionTester::nsRegressionTester()
nsRegressionTester::~nsRegressionTester()
{
}
NS_IMPL_ISUPPORTS1(nsRegressionTester, nsILayoutRegressionTester)
NS_IMETHODIMP
nsRegressionTester::DumpFrameModel(nsIDOMWindow *aWindowToDump,
- nsILocalFile *aDestFile,
+ nsIFile *aDestFile,
PRUint32 aFlagsMask, PRInt32 *aResult)
{
NS_ENSURE_ARG(aWindowToDump);
NS_ENSURE_ARG_POINTER(aResult);
*aResult = DUMP_RESULT_ERROR;
#ifndef DEBUG
@@ -105,17 +105,17 @@ nsRegressionTester::DumpFrameModel(nsIDO
if (fp != stdout)
fclose(fp);
*aResult = DUMP_RESULT_COMPLETED;
return NS_OK;
#endif
}
NS_IMETHODIMP
-nsRegressionTester::CompareFrameModels(nsILocalFile *aBaseFile, nsILocalFile *aVerFile, PRUint32 aFlags, PRInt32 *aResult)
+nsRegressionTester::CompareFrameModels(nsIFile *aBaseFile, nsIFile *aVerFile, PRUint32 aFlags, PRInt32 *aResult)
{
NS_ENSURE_ARG(aBaseFile);
NS_ENSURE_ARG(aVerFile);
NS_ENSURE_ARG_POINTER(aResult);
*aResult = NS_OK;
nsresult rv;
--- a/mobile/xul/app/nsBrowserApp.cpp
+++ b/mobile/xul/app/nsBrowserApp.cpp
@@ -13,17 +13,17 @@
#include <sys/time.h>
#include <sys/resource.h>
#endif
#include <stdio.h>
#include <stdarg.h>
#include "nsCOMPtr.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsStringGlue.h"
#ifdef XP_WIN
// we want a wmain entry point
#include "nsWindowsWMain.cpp"
#define snprintf _snprintf
#define strcasecmp _stricmp
#endif
@@ -104,17 +104,17 @@ static const nsDynamicFunctionLoad kXULF
#endif
{ "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
{ "XRE_main", (NSFuncPtr*) &XRE_main },
{ nsnull, nsnull }
};
static int do_main(int argc, char* argv[])
{
- nsCOMPtr<nsILocalFile> appini;
+ nsCOMPtr<nsIFile> appini;
nsresult rv;
// Allow firefox.exe to launch XULRunner apps via -app <application.ini>
// Note that -app must be the *first* argument.
const char *appDataFile = getenv("XUL_APP_FILE");
if (appDataFile && *appDataFile) {
rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appini));
if (NS_FAILED(rv)) {
--- a/modules/libjar/nsJAR.cpp
+++ b/modules/libjar/nsJAR.cpp
@@ -1,16 +1,16 @@
/* -*- Mode: C++; tab-width: 2; 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 <string.h>
#include "nsJARInputStream.h"
#include "nsJAR.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIConsoleService.h"
#include "nsICryptoHash.h"
#include "prprf.h"
#include "mozilla/Omnijar.h"
#ifdef XP_UNIX
#include <sys/stat.h>
#elif defined (XP_WIN) || defined(XP_OS2)
@@ -211,48 +211,44 @@ nsJAR::Test(const nsACString &aEntryName
NS_IMETHODIMP
nsJAR::Extract(const nsACString &aEntryName, nsIFile* outFile)
{
// nsZipArchive and zlib are not thread safe
// we need to use a lock to prevent bug #51267
MutexAutoLock lock(mLock);
- nsresult rv;
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(outFile, &rv);
- if (NS_FAILED(rv)) return rv;
-
nsZipItem *item = mZip->GetItem(PromiseFlatCString(aEntryName).get());
NS_ENSURE_TRUE(item, NS_ERROR_FILE_TARGET_DOES_NOT_EXIST);
// Remove existing file or directory so we set permissions correctly.
// If it's a directory that already exists and contains files, throw
// an exception and return.
//XXX Bug 332139:
//XXX If we guarantee that rv in the case of a non-empty directory
//XXX is always FILE_DIR_NOT_EMPTY, we can remove
//XXX |rv == NS_ERROR_FAILURE| - bug 322183 needs to be completely
//XXX fixed before that can happen
- rv = localFile->Remove(false);
+ nsresult rv = outFile->Remove(false);
if (rv == NS_ERROR_FILE_DIR_NOT_EMPTY ||
rv == NS_ERROR_FAILURE)
return rv;
if (item->IsDirectory())
{
- rv = localFile->Create(nsIFile::DIRECTORY_TYPE, item->Mode());
+ rv = outFile->Create(nsIFile::DIRECTORY_TYPE, item->Mode());
//XXX Do this in nsZipArchive? It would be nice to keep extraction
//XXX code completely there, but that would require a way to get a
- //XXX PRDir from localFile.
+ //XXX PRDir from outFile.
}
else
{
PRFileDesc* fd;
- rv = localFile->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE, item->Mode(), &fd);
+ rv = outFile->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE, item->Mode(), &fd);
if (NS_FAILED(rv)) return rv;
// ExtractFile also closes the fd handle and resolves the symlink if needed
nsCAutoString path;
rv = outFile->GetNativePath(path);
if (NS_FAILED(rv)) return rv;
rv = mZip->ExtractFile(item, path.get(), fd);
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -93,17 +93,17 @@ nsZipHandle::nsZipHandle()
, mRefCnt(0)
{
MOZ_COUNT_CTOR(nsZipHandle);
}
NS_IMPL_THREADSAFE_ADDREF(nsZipHandle)
NS_IMPL_THREADSAFE_RELEASE(nsZipHandle)
-nsresult nsZipHandle::Init(nsILocalFile *file, nsZipHandle **ret)
+nsresult nsZipHandle::Init(nsIFile *file, nsZipHandle **ret)
{
mozilla::AutoFDClose fd;
nsresult rv = file->OpenNSPRFileDesc(PR_RDONLY, 0000, &fd.rwget());
if (NS_FAILED(rv))
return rv;
PRInt64 size = PR_Available64(fd);
if (size >= PR_INT32_MAX)
@@ -187,47 +187,43 @@ nsresult nsZipArchive::OpenArchive(nsZip
// Initialize our arena
PL_INIT_ARENA_POOL(&mArena, "ZipArena", ZIP_ARENABLOCKSIZE);
//-- get table of contents for archive
nsresult rv = BuildFileList();
char *env = PR_GetEnv("MOZ_JAR_LOG_DIR");
if (env && NS_SUCCEEDED(rv) && aZipHandle->mFile) {
- nsCOMPtr<nsILocalFile> logFile;
+ nsCOMPtr<nsIFile> logFile;
nsresult rv2 = NS_NewLocalFile(NS_ConvertUTF8toUTF16(env), false, getter_AddRefs(logFile));
if (!NS_SUCCEEDED(rv2))
return rv;
// Create a directory for the log (in case it doesn't exist)
logFile->Create(nsIFile::DIRECTORY_TYPE, 0700);
nsAutoString name;
- nsCOMPtr<nsILocalFile> file = aZipHandle->mFile.GetBaseFile();
+ nsCOMPtr<nsIFile> file = aZipHandle->mFile.GetBaseFile();
file->GetLeafName(name);
name.Append(NS_LITERAL_STRING(".log"));
logFile->Append(name);
PRFileDesc* fd;
rv2 = logFile->OpenNSPRFileDesc(PR_WRONLY|PR_CREATE_FILE|PR_APPEND, 0644, &fd);
if (NS_SUCCEEDED(rv2))
mLog = fd;
}
return rv;
}
nsresult nsZipArchive::OpenArchive(nsIFile *aFile)
{
- nsresult rv;
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(aFile, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
-
nsRefPtr<nsZipHandle> handle;
- rv = nsZipHandle::Init(localFile, getter_AddRefs(handle));
+ nsresult rv = nsZipHandle::Init(aFile, getter_AddRefs(handle));
if (NS_FAILED(rv))
return rv;
return OpenArchive(handle);
}
//---------------------------------------------
// nsZipArchive::Test
--- a/modules/libjar/nsZipArchive.h
+++ b/modules/libjar/nsZipArchive.h
@@ -14,17 +14,17 @@
#ifndef PL_ARENA_CONST_ALIGN_MASK
#define PL_ARENA_CONST_ALIGN_MASK (sizeof(void*)-1)
#endif
#include "plarena.h"
#include "zlib.h"
#include "zipstruct.h"
#include "nsAutoPtr.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "mozilla/FileUtils.h"
#include "mozilla/FileLocation.h"
#if defined(XP_WIN) && defined(_MSC_VER)
#define MOZ_WIN_MEM_TRY_BEGIN __try {
#define MOZ_WIN_MEM_TRY_CATCH(cmd) } \
__except(GetExceptionCode()==EXCEPTION_IN_PAGE_ERROR ? \
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) \
@@ -370,17 +370,17 @@ public:
return ret;
}
};
class nsZipHandle {
friend class nsZipArchive;
friend class mozilla::FileLocation;
public:
- static nsresult Init(nsILocalFile *file, nsZipHandle **ret NS_OUTPARAM);
+ static nsresult Init(nsIFile *file, nsZipHandle **ret NS_OUTPARAM);
static nsresult Init(nsZipArchive *zip, const char *entry,
nsZipHandle **ret NS_OUTPARAM);
NS_METHOD_(nsrefcnt) AddRef(void);
NS_METHOD_(nsrefcnt) Release(void);
PRInt64 SizeOfMapping();
--- a/modules/libpref/public/nsIPrefBranch.idl
+++ b/modules/libpref/public/nsIPrefBranch.idl
@@ -128,17 +128,17 @@ interface nsIPrefBranch : nsISupports
/**
* Called to get the state of an individual complex preference. A complex
* preference is a preference which represents an XPCOM object that can not
* be easily represented using a standard boolean, integer or string value.
*
* @param aPrefName The complex preference to get the value of.
* @param aType The XPCOM interface that this complex preference
* represents. Interfaces currently supported are:
- * - nsILocalFile
+ * - nsIFile
* - nsISupportsString (UniChar)
* - nsIPrefLocalizedString (Localized UniChar)
* @param aValue The XPCOM object into which to the complex preference
* value should be retrieved.
*
* @return NS_OK The value was successfully retrieved.
* @return Other The value does not exist or is the wrong type.
*
@@ -150,17 +150,17 @@ interface nsIPrefBranch : nsISupports
/**
* Called to set the state of an individual complex preference. A complex
* preference is a preference which represents an XPCOM object that can not
* be easily represented using a standard boolean, integer or string value.
*
* @param aPrefName The complex preference to set the value of.
* @param aType The XPCOM interface that this complex preference
* represents. Interfaces currently supported are:
- * - nsILocalFile
+ * - nsIFile
* - nsISupportsString (UniChar)
* - nsIPrefLocalizedString (Localized UniChar)
* @param aValue The XPCOM object from which to set the complex preference
* value.
*
* @return NS_OK The value was successfully set.
* @return Other The value was not set or is the wrong type.
*
--- a/modules/libpref/public/nsIPrefService.idl
+++ b/modules/libpref/public/nsIPrefService.idl
@@ -12,17 +12,16 @@ template<class E, class A> class nsTArra
struct nsTArrayInfallibleAllocator;
%}
[ptr] native nsPreferencesArrayPtr(nsTArray<PrefTuple, nsTArrayInfallibleAllocator>);
[ptr] native nsPreferencePtr(PrefTuple);
[ptr] native nsPreferencePtrConst(const PrefTuple);
interface nsIFile;
-interface nsILocalFile;
/**
* The nsIPrefService interface is the main entry point into the back end
* preferences management library. The preference service is directly
* responsible for the management of the preferences files and also facilitates
* access to the preference branch object which allows the direct manipulation
* of the preferences themselves.
*
--- a/modules/libpref/public/nsIRelativeFilePref.idl
+++ b/modules/libpref/public/nsIRelativeFilePref.idl
@@ -1,18 +1,18 @@
/* -*- 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 "nsISupports.idl"
-interface nsILocalFile;
+interface nsIFile;
/**
- * The nsIRelativeFilePref interface is a wrapper for an nsILocalFile and
+ * The nsIRelativeFilePref interface is a wrapper for an nsIFile and
* and a directory service key. When used as a pref value, it stores a
* relative path to the file from the location pointed to by the directory
* service key. The path has the same syntax across all platforms.
*
* @see nsIPrefBranch::getComplexValue
* @see nsIPrefBranch::setComplexValue
*
*/
@@ -20,17 +20,17 @@ interface nsILocalFile;
[scriptable, uuid(2f977d4e-5485-11d4-87e2-0010a4e75ef2)]
interface nsIRelativeFilePref : nsISupports
{
/**
* file
*
* The file whose location is stored or retrieved.
*/
- attribute nsILocalFile file;
+ attribute nsIFile file;
/**
* relativeToKey
*
* A directory service key for the directory
* from which the file path is relative.
*/
attribute ACString relativeToKey;
@@ -48,17 +48,17 @@ interface nsIRelativeFilePref : nsISuppo
}
#define NS_RELATIVEFILEPREF_CONTRACTID "@mozilla.org/pref-relativefile;1"
#define NS_RELATIVEFILEPREF_CLASSNAME "Relative File Pref"
#include "nsComponentManagerUtils.h"
inline nsresult
-NS_NewRelativeFilePref(nsILocalFile* aFile, const nsACString& relativeToKey, nsIRelativeFilePref** result)
+NS_NewRelativeFilePref(nsIFile* aFile, const nsACString& relativeToKey, nsIRelativeFilePref** result)
{
nsresult rv;
nsCOMPtr<nsIRelativeFilePref> local(do_CreateInstance(NS_RELATIVEFILEPREF_CONTRACTID, &rv));
if (NS_FAILED(rv)) return rv;
(void)local->SetFile(aFile);
(void)local->SetRelativeToKey(relativeToKey);
--- a/modules/libpref/src/Preferences.cpp
+++ b/modules/libpref/src/Preferences.cpp
@@ -13,17 +13,16 @@
#include "mozilla/Preferences.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceDefs.h"
#include "nsICategoryManager.h"
#include "nsCategoryManagerUtils.h"
#include "nsNetUtil.h"
#include "nsIFile.h"
#include "nsIInputStream.h"
-#include "nsILocalFile.h"
#include "nsIObserverService.h"
#include "nsIStringEnumerator.h"
#include "nsIZipReader.h"
#include "nsPrefBranch.h"
#include "nsXPIDLString.h"
#include "nsCRT.h"
#include "nsCOMArray.h"
#include "nsXPCOMCID.h"
--- a/modules/libpref/src/nsPrefBranch.cpp
+++ b/modules/libpref/src/nsPrefBranch.cpp
@@ -2,17 +2,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"
+#include "nsILocalFile.h" // nsILocalFile used for backwards compatibility
#include "nsIObserverService.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIDirectoryService.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsXPIDLString.h"
#include "nsIStringBundle.h"
@@ -227,28 +227,29 @@ 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;
}
- if (aType.Equals(NS_GET_IID(nsILocalFile))) {
+ // also check nsILocalFile, for backwards compatibility
+ if (aType.Equals(NS_GET_IID(nsIFile)) || aType.Equals(NS_GET_IID(nsILocalFile))) {
if (GetContentChild()) {
- NS_ERROR("cannot get nsILocalFile pref from content process");
+ NS_ERROR("cannot get nsIFile pref from content process");
return NS_ERROR_NOT_AVAILABLE;
}
- nsCOMPtr<nsILocalFile> file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
+ nsCOMPtr<nsIFile> file(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv)) {
rv = file->SetPersistentDescriptor(utf8String);
if (NS_SUCCEEDED(rv)) {
- file.forget(reinterpret_cast<nsILocalFile**>(_retval));
+ file.forget(reinterpret_cast<nsIFile**>(_retval));
return NS_OK;
}
}
return rv;
}
if (aType.Equals(NS_GET_IID(nsIRelativeFilePref))) {
if (GetContentChild()) {
@@ -263,25 +264,25 @@ NS_IMETHODIMP nsPrefBranch::GetComplexVa
// The pref has the format: [fromKey]a/b/c
if (*keyBegin++ != '[')
return NS_ERROR_FAILURE;
nsACString::const_iterator keyEnd(keyBegin);
if (!FindCharInReadable(']', keyEnd, strEnd))
return NS_ERROR_FAILURE;
nsCAutoString key(Substring(keyBegin, keyEnd));
- nsCOMPtr<nsILocalFile> fromFile;
+ nsCOMPtr<nsIFile> fromFile;
nsCOMPtr<nsIProperties> directoryService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
- rv = directoryService->Get(key.get(), NS_GET_IID(nsILocalFile), getter_AddRefs(fromFile));
+ rv = directoryService->Get(key.get(), NS_GET_IID(nsIFile), getter_AddRefs(fromFile));
if (NS_FAILED(rv))
return rv;
- nsCOMPtr<nsILocalFile> theFile;
+ nsCOMPtr<nsIFile> theFile;
rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(theFile));
if (NS_FAILED(rv))
return rv;
rv = theFile->SetRelativeDescriptor(fromFile, Substring(++keyEnd, strEnd));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIRelativeFilePref> relativePref;
rv = NS_NewRelativeFilePref(theFile, key, getter_AddRefs(relativePref));
@@ -312,46 +313,47 @@ NS_IMETHODIMP nsPrefBranch::SetComplexVa
NS_ERROR("cannot set pref from content process");
return NS_ERROR_NOT_AVAILABLE;
}
NS_ENSURE_ARG(aPrefName);
nsresult rv = NS_NOINTERFACE;
- if (aType.Equals(NS_GET_IID(nsILocalFile))) {
- nsCOMPtr<nsILocalFile> file = do_QueryInterface(aValue);
+ // also check nsILocalFile, for backwards compatibility
+ if (aType.Equals(NS_GET_IID(nsIFile)) || aType.Equals(NS_GET_IID(nsILocalFile))) {
+ nsCOMPtr<nsIFile> file = do_QueryInterface(aValue);
if (!file)
return NS_NOINTERFACE;
nsCAutoString descriptorString;
rv = file->GetPersistentDescriptor(descriptorString);
if (NS_SUCCEEDED(rv)) {
rv = SetCharPref(aPrefName, descriptorString.get());
}
return rv;
}
if (aType.Equals(NS_GET_IID(nsIRelativeFilePref))) {
nsCOMPtr<nsIRelativeFilePref> relFilePref = do_QueryInterface(aValue);
if (!relFilePref)
return NS_NOINTERFACE;
- nsCOMPtr<nsILocalFile> file;
+ nsCOMPtr<nsIFile> file;
relFilePref->GetFile(getter_AddRefs(file));
if (!file)
return NS_NOINTERFACE;
nsCAutoString relativeToKey;
(void) relFilePref->GetRelativeToKey(relativeToKey);
- nsCOMPtr<nsILocalFile> relativeToFile;
+ nsCOMPtr<nsIFile> relativeToFile;
nsCOMPtr<nsIProperties> directoryService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
if (NS_FAILED(rv))
return rv;
- rv = directoryService->Get(relativeToKey.get(), NS_GET_IID(nsILocalFile), getter_AddRefs(relativeToFile));
+ rv = directoryService->Get(relativeToKey.get(), NS_GET_IID(nsIFile), getter_AddRefs(relativeToFile));
if (NS_FAILED(rv))
return rv;
nsCAutoString relDescriptor;
rv = file->GetRelativeDescriptor(relativeToFile, relDescriptor);
if (NS_FAILED(rv))
return rv;
@@ -797,25 +799,25 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsRelative
nsRelativeFilePref::nsRelativeFilePref()
{
}
nsRelativeFilePref::~nsRelativeFilePref()
{
}
-NS_IMETHODIMP nsRelativeFilePref::GetFile(nsILocalFile **aFile)
+NS_IMETHODIMP nsRelativeFilePref::GetFile(nsIFile **aFile)
{
NS_ENSURE_ARG_POINTER(aFile);
*aFile = mFile;
NS_IF_ADDREF(*aFile);
return NS_OK;
}
-NS_IMETHODIMP nsRelativeFilePref::SetFile(nsILocalFile *aFile)
+NS_IMETHODIMP nsRelativeFilePref::SetFile(nsIFile *aFile)
{
mFile = aFile;
return NS_OK;
}
NS_IMETHODIMP nsRelativeFilePref::GetRelativeToKey(nsACString& aRelativeToKey)
{
aRelativeToKey.Assign(mRelativeToKey);
--- a/modules/libpref/src/nsPrefBranch.h
+++ b/modules/libpref/src/nsPrefBranch.h
@@ -6,17 +6,17 @@
#include "nsCOMPtr.h"
#include "nsIObserver.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranchInternal.h"
#include "nsIPrefLocalizedString.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIRelativeFilePref.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsString.h"
#include "nsVoidArray.h"
#include "nsTArray.h"
#include "nsWeakReference.h"
#include "nsClassHashtable.h"
#include "nsCRT.h"
#include "prbit.h"
#include "nsTraceRefcnt.h"
@@ -238,11 +238,11 @@ class nsRelativeFilePref : public nsIRel
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIRELATIVEFILEPREF
nsRelativeFilePref();
virtual ~nsRelativeFilePref();
private:
- nsCOMPtr<nsILocalFile> mFile;
+ nsCOMPtr<nsIFile> mFile;
nsCString mRelativeToKey;
};
--- a/netwerk/base/public/nsIApplicationCache.idl
+++ b/netwerk/base/public/nsIApplicationCache.idl
@@ -2,17 +2,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 "nsISupports.idl"
interface nsIArray;
-interface nsILocalFile;
+interface nsIFile;
/**
* Application caches can store a set of namespace entries that affect
* loads from the application cache. If a load from the cache fails
* to match an exact cache entry, namespaces entries will be searched
* for a substring match, and should be applied appropriately.
*/
[scriptable, uuid(96e4c264-2065-4ce9-93bb-43734c62c4eb)]
@@ -190,10 +190,10 @@ interface nsIApplicationCache : nsISuppo
* Get the most specific namespace matching a given key.
*/
nsIApplicationCacheNamespace getMatchingNamespace(in ACString key);
/**
* If set, this offline cache is placed in a different directory
* than the current application profile.
*/
- readonly attribute nsILocalFile cacheDirectory;
+ readonly attribute nsIFile cacheDirectory;
};
--- a/netwerk/base/public/nsIApplicationCacheService.idl
+++ b/netwerk/base/public/nsIApplicationCacheService.idl
@@ -2,17 +2,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 "nsISupports.idl"
interface nsIApplicationCache;
-interface nsILocalFile;
+interface nsIFile;
/**
* The application cache service manages the set of application cache
* groups.
*/
[scriptable, uuid(28adfdc7-6718-4b3e-bdb2-ecfefa3c8910)]
interface nsIApplicationCacheService : nsISupports
{
@@ -30,17 +30,17 @@ interface nsIApplicationCacheService : n
* URL of the manifest
* @param directory
* Actually a reference to a profile directory where to
* create the OfflineCache sub-dir.
* @param quota
* Optional override of the default quota.
*/
nsIApplicationCache createCustomApplicationCache(in ACString group,
- in nsILocalFile profileDir,
+ in nsIFile profileDir,
in PRInt32 quota);
/**
* Get an application cache object for the given client ID.
*/
nsIApplicationCache getApplicationCache(in ACString clientID);
/**
--- a/netwerk/base/public/nsICachingChannel.idl
+++ b/netwerk/base/public/nsICachingChannel.idl
@@ -1,17 +1,16 @@
/* -*- 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 "nsICacheInfoChannel.idl"
interface nsIFile;
-interface nsILocalFile;
/**
* A channel may optionally implement this interface to allow clients
* to affect its behavior with respect to how it uses the cache service.
*
* This interface provides:
* 1) Support for "stream as file" semantics (for JAR and plugins).
* 2) Support for "pinning" cached data in the cache (for printing and save-as).
@@ -87,17 +86,17 @@ interface nsICachingChannel : nsICacheIn
* data will be placed in "HTTP-offline"
*/
attribute ACString offlineCacheClientID;
/**
* Override base (profile) directory to work with when accessing the cache.
* When not specified, the current process' profile directory will be used.
*/
- attribute nsILocalFile profileDirectory;
+ attribute nsIFile profileDirectory;
/**
* Get the "file" where the cached data can be found. This is valid for
* as long as a reference to the cache token is held. This may return
* an error if cacheAsFile is false.
*/
readonly attribute nsIFile cacheFile;
--- a/netwerk/base/public/nsIFileStreams.idl
+++ b/netwerk/base/public/nsIFileStreams.idl
@@ -10,17 +10,17 @@ interface nsIFile;
/**
* An input stream that allows you to read from a file.
*/
[scriptable, uuid(e3d56a20-c7ec-11d3-8cda-0060b0fc14a3)]
interface nsIFileInputStream : nsIInputStream
{
/**
- * @param file file to read from (must QI to nsILocalFile)
+ * @param file file to read from
* @param ioFlags file open flags listed in prio.h (see
* PR_Open documentation) or -1 to open the
* file in default mode (PR_RDONLY).
* @param perm file mode bits listed in prio.h or -1 to
* use the default value (0)
* @param behaviorFlags flags specifying various behaviors of the class
* (see enumerations in the class)
*/
@@ -76,17 +76,17 @@ interface nsIFileInputStream : nsIInputS
/**
* An output stream that lets you stream to a file.
*/
[scriptable, uuid(e6f68040-c7ec-11d3-8cda-0060b0fc14a3)]
interface nsIFileOutputStream : nsIOutputStream
{
/**
- * @param file file to write to (must QI to nsILocalFile)
+ * @param file file to write to
* @param ioFlags file open flags listed in prio.h (see
* PR_Open documentation) or -1 to open the
* file in default mode (PR_WRONLY |
* PR_CREATE_FILE | PR_TRUNCATE)
* @param perm file mode bits listed in prio.h or -1 to
* use the default permissions (0664)
* @param behaviorFlags flags specifying various behaviors of the class
* (currently none supported)
@@ -120,17 +120,17 @@ interface nsIPartialFileInputStream : ns
{
/**
* Initialize with a file and new start/end positions. Both start and
* start+length must be smaller than the size of the file. Not doing so
* will lead to undefined behavior.
* You must initialize the stream, and only initialize it once, before it
* can be used.
*
- * @param file file to read from (must QI to nsILocalFile)
+ * @param file file to read from
* @param start start offset of slice to read. Must be smaller
* than the size of the file.
* @param length length of slice to read. Must be small enough that
* start+length is smaller than the size of the file.
* @param ioFlags file open flags listed in prio.h (see
* PR_Open documentation) or -1 to open the
* file in default mode (PR_RDONLY).
* @param perm file mode bits listed in prio.h or -1 to
@@ -145,18 +145,17 @@ interface nsIPartialFileInputStream : ns
/**
* A stream that allows you to read from a file or stream to a file.
*/
[scriptable, uuid(82cf605a-8393-4550-83ab-43cd5578e006)]
interface nsIFileStream : nsISupports
{
/**
- * @param file file to read from or stream to (must QI to
- * nsILocalFile)
+ * @param file file to read from or stream to
* @param ioFlags file open flags listed in prio.h (see
* PR_Open documentation) or -1 to open the
* file in default mode (PR_RDWR).
* @param perm file mode bits listed in prio.h or -1 to
* use the default value (0)
* @param behaviorFlags flags specifying various behaviors of the class
* (see enumerations in the class)
*/
--- a/netwerk/base/public/nsNetUtil.h
+++ b/netwerk/base/public/nsNetUtil.h
@@ -39,17 +39,17 @@
#include "nsIHttpChannel.h"
#include "nsIDownloader.h"
#include "nsIStreamLoader.h"
#include "nsIUnicharStreamLoader.h"
#include "nsIPipe.h"
#include "nsIProtocolHandler.h"
#include "nsIFileProtocolHandler.h"
#include "nsIStringStream.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIFileStreams.h"
#include "nsIFileURL.h"
#include "nsIProtocolProxyService.h"
#include "nsIProxyInfo.h"
#include "nsIFileStreams.h"
#include "nsIBufferedStreams.h"
#include "nsIInputStreamPump.h"
#include "nsIAsyncStreamCopier.h"
@@ -1114,17 +1114,17 @@ NS_NewPostDataStream(nsIInputStream **r
bool isFile,
const nsACString &data,
PRUint32 encodeFlags,
nsIIOService *unused = nsnull)
{
nsresult rv;
if (isFile) {
- nsCOMPtr<nsILocalFile> file;
+ nsCOMPtr<nsIFile> file;
nsCOMPtr<nsIInputStream> fileStream;
rv = NS_NewNativeLocalFile(data, false, getter_AddRefs(file));
if (NS_SUCCEEDED(rv)) {
rv = NS_NewLocalFileInputStream(getter_AddRefs(fileStream), file);
if (NS_SUCCEEDED(rv)) {
// wrap the file stream with a buffered input stream
rv = NS_NewBufferedInputStream(result, fileStream, 8192);
--- a/netwerk/base/src/nsFileStreams.cpp
+++ b/netwerk/base/src/nsFileStreams.cpp
@@ -14,17 +14,16 @@
#include <os2.h>
#else
// XXX add necessary include file for ftruncate (or equivalent)
#endif
#include "private/pprio.h"
#include "nsFileStreams.h"
-#include "nsILocalFile.h"
#include "nsXPIDLString.h"
#include "prerror.h"
#include "nsCRT.h"
#include "nsIFile.h"
#include "nsDirectoryIndexStream.h"
#include "nsMimeTypes.h"
#include "nsReadLine.h"
#include "nsNetUtil.h"
@@ -246,17 +245,17 @@ nsFileStreamBase::WriteSegments(nsReadSe
{
return NS_ERROR_NOT_IMPLEMENTED;
// File streams intentionally do not support this method.
// If you need something like this, then you should wrap
// the file stream using nsIBufferedOutputStream
}
nsresult
-nsFileStreamBase::MaybeOpen(nsILocalFile* aFile, PRInt32 aIoFlags,
+nsFileStreamBase::MaybeOpen(nsIFile* aFile, PRInt32 aIoFlags,
PRInt32 aPerm, bool aDeferred)
{
mOpenParams.ioFlags = aIoFlags;
mOpenParams.perm = aPerm;
if (aDeferred) {
// Clone the file, as it may change between now and the deferred open
nsCOMPtr<nsIFile> file;
@@ -351,24 +350,22 @@ nsFileInputStream::Open(nsIFile* aFile,
// If the previous file is open, close it
if (mFD) {
rv = Close();
if (NS_FAILED(rv)) return rv;
}
// Open the file
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(aFile, &rv);
- if (NS_FAILED(rv)) return rv;
if (aIOFlags == -1)
aIOFlags = PR_RDONLY;
if (aPerm == -1)
aPerm = 0;
- rv = MaybeOpen(localFile, aIOFlags, aPerm,
+ rv = MaybeOpen(aFile, aIOFlags, aPerm,
mBehaviorFlags & nsIFileInputStream::DEFER_OPEN);
if (NS_FAILED(rv)) return rv;
if (mBehaviorFlags & DELETE_ON_CLOSE) {
// POSIX compatible filesystems allow a file to be unlinked while a
// file descriptor is still referencing the file. since we've already
// opened the file descriptor, we'll try to remove the file. if that
// fails, then we'll just remember the nsIFile and remove it after we
@@ -473,17 +470,17 @@ nsFileInputStream::Read(const IPC::Messa
nsCString path;
bool followLinks;
PRInt32 flags;
if (!ReadParam(aMsg, aIter, &path) ||
!ReadParam(aMsg, aIter, &followLinks) ||
!ReadParam(aMsg, aIter, &flags))
return false;
- nsCOMPtr<nsILocalFile> file;
+ nsCOMPtr<nsIFile> file;
nsresult rv = NS_NewNativeLocalFile(path, followLinks, getter_AddRefs(file));
if (NS_FAILED(rv))
return false;
// IO flags = -1 means readonly, and
// permissions are unimportant since we're reading
rv = Init(file, -1, -1, flags);
if (NS_FAILED(rv))
@@ -495,19 +492,18 @@ nsFileInputStream::Read(const IPC::Messa
void
nsFileInputStream::Write(IPC::Message *aMsg)
{
using IPC::WriteParam;
nsCString path;
mFile->GetNativePath(path);
WriteParam(aMsg, path);
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(mFile);
bool followLinks;
- localFile->GetFollowLinks(&followLinks);
+ mFile->GetFollowLinks(&followLinks);
WriteParam(aMsg, followLinks);
WriteParam(aMsg, mBehaviorFlags);
}
////////////////////////////////////////////////////////////////////////////////
// nsPartialFileInputStream
// Don't forward to nsFileInputStream as we don't want to QI to
@@ -642,25 +638,22 @@ NS_IMETHODIMP
nsFileOutputStream::Init(nsIFile* file, PRInt32 ioFlags, PRInt32 perm,
PRInt32 behaviorFlags)
{
NS_ENSURE_TRUE(mFD == nsnull, NS_ERROR_ALREADY_INITIALIZED);
NS_ENSURE_TRUE(!mDeferredOpen, NS_ERROR_ALREADY_INITIALIZED);
mBehaviorFlags = behaviorFlags;
- nsresult rv;
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(file, &rv);
- if (NS_FAILED(rv)) return rv;
if (ioFlags == -1)
ioFlags = PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE;
if (perm <= 0)
perm = 0664;
- return MaybeOpen(localFile, ioFlags, perm,
+ return MaybeOpen(file, ioFlags, perm,
mBehaviorFlags & nsIFileOutputStream::DEFER_OPEN);
}
////////////////////////////////////////////////////////////////////////////////
// nsSafeFileOutputStream
NS_IMPL_ISUPPORTS_INHERITED3(nsSafeFileOutputStream,
nsFileOutputStream,
@@ -675,35 +668,33 @@ nsSafeFileOutputStream::Init(nsIFile* fi
return nsFileOutputStream::Init(file, ioFlags, perm, behaviorFlags);
}
nsresult
nsSafeFileOutputStream::DoOpen()
{
// Make sure mOpenParams.localFile will be empty if we bail somewhere in
// this function
- nsCOMPtr<nsILocalFile> file;
+ nsCOMPtr<nsIFile> file;
file.swap(mOpenParams.localFile);
nsresult rv = file->Exists(&mTargetFileExists);
if (NS_FAILED(rv)) {
NS_ERROR("Can't tell if target file exists");
mTargetFileExists = true; // Safer to assume it exists - we just do more work.
}
// follow symlinks, for two reasons:
// 1) if a user has deliberately set up a profile file as a symlink, we honor it
// 2) to make the MoveToNative() in Finish() an atomic operation (which may not
// be the case if moving across directories on different filesystems).
nsCOMPtr<nsIFile> tempResult;
rv = file->Clone(getter_AddRefs(tempResult));
if (NS_SUCCEEDED(rv)) {
- nsCOMPtr<nsILocalFile> tempLocal = do_QueryInterface(tempResult);
- if (tempLocal)
- tempLocal->SetFollowLinks(true);
+ tempResult->SetFollowLinks(true);
// XP_UNIX ignores SetFollowLinks(), so we have to normalize.
tempResult->Normalize();
}
if (NS_SUCCEEDED(rv) && mTargetFileExists) {
PRUint32 origPerm;
if (NS_FAILED(file->GetPermissions(&origPerm))) {
@@ -712,19 +703,17 @@ nsSafeFileOutputStream::DoOpen()
}
// XXX What if |perm| is more restrictive then |origPerm|?
// This leaves the user supplied permissions as they were.
rv = tempResult->CreateUnique(nsIFile::NORMAL_FILE_TYPE, origPerm);
}
if (NS_SUCCEEDED(rv)) {
// nsFileOutputStream::DoOpen will work on the temporary file, so we
// prepare it and place it in mOpenParams.localFile.
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(tempResult, &rv);
- NS_ENSURE_SUCCESS(rv, rv);
- mOpenParams.localFile = localFile;
+ mOpenParams.localFile = tempResult;
mTempFile = tempResult;
mTargetFile = file;
rv = nsFileOutputStream::DoOpen();
}
return rv;
}
NS_IMETHODIMP
@@ -821,24 +810,23 @@ nsFileStream::Init(nsIFile* file, PRInt3
PRInt32 behaviorFlags)
{
NS_ENSURE_TRUE(mFD == nsnull, NS_ERROR_ALREADY_INITIALIZED);
NS_ENSURE_TRUE(!mDeferredOpen, NS_ERROR_ALREADY_INITIALIZED);
mBehaviorFlags = behaviorFlags;
nsresult rv;
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(file, &rv);
if (NS_FAILED(rv)) return rv;
if (ioFlags == -1)
ioFlags = PR_RDWR;
if (perm <= 0)
perm = 0;
- return MaybeOpen(localFile, ioFlags, perm,
+ return MaybeOpen(file, ioFlags, perm,
mBehaviorFlags & nsIFileStream::DEFER_OPEN);
}
NS_IMETHODIMP
nsFileStream::GetSize(PRInt64* _retval)
{
nsresult rv = DoPendingOpen();
NS_ENSURE_SUCCESS(rv, rv);
--- a/netwerk/base/src/nsFileStreams.h
+++ b/netwerk/base/src/nsFileStreams.h
@@ -54,32 +54,32 @@ protected:
PRInt32 mBehaviorFlags;
/**
* Whether we have a pending open (see DEFER_OPEN in the IDL file).
*/
bool mDeferredOpen;
struct OpenParams {
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
PRInt32 ioFlags;
PRInt32 perm;
};
/**
* Data we need to do an open.
*/
OpenParams mOpenParams;
/**
* Prepares the data we need to open the file, and either does the open now
* by calling DoOpen(), or leaves it to be opened later by a call to
* DoPendingOpen().
*/
- nsresult MaybeOpen(nsILocalFile* aFile, PRInt32 aIoFlags, PRInt32 aPerm,
+ nsresult MaybeOpen(nsIFile* aFile, PRInt32 aIoFlags, PRInt32 aPerm,
bool aDeferred);
/**
* Cleans up data prepared in MaybeOpen.
*/
void CleanUpOpen();
/**
--- a/netwerk/base/src/nsIncrementalDownload.cpp
+++ b/netwerk/base/src/nsIncrementalDownload.cpp
@@ -11,17 +11,17 @@
#include "nsIProgressEventSink.h"
#include "nsIChannelEventSink.h"
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsIInterfaceRequestor.h"
#include "nsIObserverService.h"
#include "nsIObserver.h"
#include "nsIPropertyBag2.h"
#include "nsIServiceManager.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsITimer.h"
#include "nsNetUtil.h"
#include "nsAutoPtr.h"
#include "nsWeakReference.h"
#include "nsChannelProperties.h"
#include "prio.h"
#include "prprf.h"
@@ -42,32 +42,32 @@
#define UPDATE_PROGRESS_INTERVAL PRTime(500 * PR_USEC_PER_MSEC) // 500ms
// Number of times to retry a failed byte-range request.
#define MAX_RETRY_COUNT 20
//-----------------------------------------------------------------------------
static nsresult
-WriteToFile(nsILocalFile *lf, const char *data, PRUint32 len, PRInt32 flags)
+WriteToFile(nsIFile *lf, const char *data, PRUint32 len, PRInt32 flags)
{
PRFileDesc *fd;
nsresult rv = lf->OpenNSPRFileDesc(flags, 0600, &fd);
if (NS_FAILED(rv))
return rv;
if (len)
rv = PR_Write(fd, data, len) == PRInt32(len) ? NS_OK : NS_ERROR_FAILURE;
PR_Close(fd);
return rv;
}
static nsresult
-AppendToFile(nsILocalFile *lf, const char *data, PRUint32 len)
+AppendToFile(nsIFile *lf, const char *data, PRUint32 len)
{
PRInt32 flags = PR_WRONLY | PR_CREATE_FILE | PR_APPEND;
return WriteToFile(lf, data, len, flags);
}
// maxSize may be -1 if unknown
static void
MakeRangeSpec(const PRInt64 &size, const PRInt64 &maxSize, PRInt32 chunkSize,
@@ -123,17 +123,17 @@ private:
nsresult ReadCurrentSize();
nsresult ClearRequestHeader(nsIHttpChannel *channel);
nsCOMPtr<nsIRequestObserver> mObserver;
nsCOMPtr<nsISupports> mObserverContext;
nsCOMPtr<nsIProgressEventSink> mProgressSink;
nsCOMPtr<nsIURI> mURI;
nsCOMPtr<nsIURI> mFinalURI;
- nsCOMPtr<nsILocalFile> mDest;
+ nsCOMPtr<nsIFile> mDest;
nsCOMPtr<nsIChannel> mChannel;
nsCOMPtr<nsITimer> mTimer;
nsAutoArrayPtr<char> mChunk;
PRInt32 mChunkLen;
PRInt32 mChunkSize;
PRInt32 mInterval;
PRInt64 mTotalSize;
PRInt64 mCurrentSize;
--- a/netwerk/base/src/nsStandardURL.cpp
+++ b/netwerk/base/src/nsStandardURL.cpp
@@ -6,17 +6,17 @@
#include "IPCMessageUtils.h"
#include "nsStandardURL.h"
#include "nsDependentSubstring.h"
#include "nsReadableUtils.h"
#include "nsCRT.h"
#include "nsEscape.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIObjectInputStream.h"
#include "nsIObjectOutputStream.h"
#include "nsICharsetConverterManager.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIIDNService.h"
#include "nsNetUtil.h"
#include "prlog.h"
--- a/netwerk/base/src/nsURLHelper.cpp
+++ b/netwerk/base/src/nsURLHelper.cpp
@@ -5,17 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/RangedPtr.h"
#include "nsURLHelper.h"
#include "nsReadableUtils.h"
#include "nsIServiceManager.h"
#include "nsIIOService.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIURLParser.h"
#include "nsIURI.h"
#include "nsMemory.h"
#include "nsEscape.h"
#include "nsCOMPtr.h"
#include "nsCRT.h"
#include "nsNetCID.h"
#include "netCore.h"
--- a/netwerk/base/src/nsURLHelperOS2.cpp
+++ b/netwerk/base/src/nsURLHelperOS2.cpp
@@ -5,17 +5,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* OS/2-specific local file uri parsing */
#define INCL_DOSERRORS
#define INCL_DOS
#include <os2.h>
#include "nsURLHelper.h"
#include "nsEscape.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
nsresult
net_GetURLSpecFromActualFile(nsIFile *aFile, nsACString &result)
{
nsresult rv;
nsAutoString path;
// construct URL spec from file path
@@ -44,20 +44,20 @@ net_GetURLSpecFromActualFile(nsIFile *aF
return NS_OK;
}
nsresult
net_GetFileFromURLSpec(const nsACString &aURL, nsIFile **result)
{
nsresult rv;
- nsCOMPtr<nsILocalFile> localFile(
+ nsCOMPtr<nsIFile> localFile(
do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
if (NS_FAILED(rv)) {
- NS_ERROR("Only nsILocalFile supported right now");
+ NS_ERROR("Only nsIFile supported right now");
return rv;
}
const nsACString *specPtr;
nsCAutoString buf;
if (net_NormalizeFileURL(aURL, buf))
specPtr = &buf;
--- a/netwerk/base/src/nsURLHelperOSX.cpp
+++ b/netwerk/base/src/nsURLHelperOSX.cpp
@@ -2,17 +2,17 @@
/* vim:set ts=2 sw=2 et cindent: */
/* 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/. */
/* Mac OS X-specific local file uri parsing */
#include "nsURLHelper.h"
#include "nsEscape.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsTArray.h"
#include "nsReadableUtils.h"
#include <Carbon/Carbon.h>
static nsTArray<nsCString> *gVolumeList = nsnull;
static bool pathBeginsWithVolName(const nsACString& path, nsACString& firstPathComponent)
{
@@ -143,17 +143,17 @@ net_GetURLSpecFromActualFile(nsIFile *aF
nsresult
net_GetFileFromURLSpec(const nsACString &aURL, nsIFile **result)
{
// NOTE: See also the implementation in nsURLHelperUnix.cpp
// This matches it except for the HFS path handling.
nsresult rv;
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(localFile));
if (NS_FAILED(rv))
return rv;
nsCAutoString directory, fileBaseName, fileExtension, path;
bool bHFSPath = false;
rv = net_ParseFileURL(aURL, directory, fileBaseName, fileExtension);
--- a/netwerk/base/src/nsURLHelperUnix.cpp
+++ b/netwerk/base/src/nsURLHelperUnix.cpp
@@ -2,17 +2,17 @@
/* vim:set ts=4 sw=4 et cindent: */
/* 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/. */
/* Unix-specific local file uri parsing */
#include "nsURLHelper.h"
#include "nsEscape.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsNativeCharsetUtils.h"
nsresult
net_GetURLSpecFromActualFile(nsIFile *aFile, nsACString &result)
{
nsresult rv;
nsCAutoString nativePath, ePath;
nsAutoString path;
@@ -50,17 +50,17 @@ net_GetURLSpecFromActualFile(nsIFile *aF
nsresult
net_GetFileFromURLSpec(const nsACString &aURL, nsIFile **result)
{
// NOTE: See also the implementation in nsURLHelperOSX.cpp,
// which is based on this.
nsresult rv;
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(localFile));
if (NS_FAILED(rv))
return rv;
nsCAutoString directory, fileBaseName, fileExtension, path;
rv = net_ParseFileURL(aURL, directory, fileBaseName, fileExtension);
if (NS_FAILED(rv)) return rv;
--- a/netwerk/base/src/nsURLHelperWin.cpp
+++ b/netwerk/base/src/nsURLHelperWin.cpp
@@ -2,17 +2,17 @@
/* vim:set ts=4 sw=4 et cindent: */
/* 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/. */
/* Windows-specific local file uri parsing */
#include "nsURLHelper.h"
#include "nsEscape.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include <windows.h>
nsresult
net_GetURLSpecFromActualFile(nsIFile *aFile, nsACString &result)
{
nsresult rv;
nsAutoString path;
@@ -46,20 +46,20 @@ net_GetURLSpecFromActualFile(nsIFile *aF
return NS_OK;
}
nsresult
net_GetFileFromURLSpec(const nsACString &aURL, nsIFile **result)
{
nsresult rv;
- nsCOMPtr<nsILocalFile> localFile(
+ nsCOMPtr<nsIFile> localFile(
do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
if (NS_FAILED(rv)) {
- NS_ERROR("Only nsILocalFile supported right now");
+ NS_ERROR("Only nsIFile supported right now");
return rv;
}
localFile->SetFollowLinks(true);
const nsACString *specPtr;
nsCAutoString buf;
--- a/netwerk/cache/nsApplicationCacheService.cpp
+++ b/netwerk/cache/nsApplicationCacheService.cpp
@@ -31,17 +31,17 @@ nsApplicationCacheService::CreateApplica
nsRefPtr<nsOfflineCacheDevice> device;
nsresult rv = mCacheService->GetOfflineDevice(getter_AddRefs(device));
NS_ENSURE_SUCCESS(rv, rv);
return device->CreateApplicationCache(group, out);
}
NS_IMETHODIMP
nsApplicationCacheService::CreateCustomApplicationCache(const nsACString & group,
- nsILocalFile *profileDir,
+ nsIFile *profileDir,
PRInt32 quota,
nsIApplicationCache **out)
{
if (!mCacheService)
return NS_ERROR_UNEXPECTED;
nsRefPtr<nsOfflineCacheDevice> device;
nsresult rv = mCacheService->GetCustomOfflineDevice(profileDir,
--- a/netwerk/cache/nsCacheRequest.h
+++ b/netwerk/cache/nsCacheRequest.h
@@ -148,12 +148,12 @@ private:
* Data members
*/
nsCString * mKey;
PRUint32 mInfo;
nsICacheListener * mListener; // strong ref
nsCOMPtr<nsIThread> mThread;
Mutex mLock;
CondVar mCondVar;
- nsCOMPtr<nsILocalFile> mProfileDir;
+ nsCOMPtr<nsIFile> mProfileDir;
};
#endif // _nsCacheRequest_h_
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -18,17 +18,17 @@
#include "nsICacheVisitor.h"
#include "nsDiskCacheDevice.h"
#include "nsDiskCacheDeviceSQL.h"
#include "nsIMemoryReporter.h"
#include "nsIObserverService.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIOService.h"
#include "nsDirectoryServiceDefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsThreadUtils.h"
#include "nsProxyRelease.h"
#include "nsVoidArray.h"
#include "nsDeleteDir.h"
#include "nsNetCID.h"
@@ -135,22 +135,22 @@ public:
nsresult Install();
void Remove();
nsresult ReadPrefs(nsIPrefBranch* branch);
bool DiskCacheEnabled();
PRInt32 DiskCacheCapacity() { return mDiskCacheCapacity; }
void SetDiskCacheCapacity(PRInt32);
PRInt32 DiskCacheMaxEntrySize() { return mDiskCacheMaxEntrySize; }
- nsILocalFile * DiskCacheParentDirectory() { return mDiskCacheParentDirectory; }
+ nsIFile * DiskCacheParentDirectory() { return mDiskCacheParentDirectory; }
bool SmartSizeEnabled() { return mSmartSizeEnabled; }
bool OfflineCacheEnabled();
PRInt32 OfflineCacheCapacity() { return mOfflineCacheCapacity; }
- nsILocalFile * OfflineCacheParentDirectory() { return mOfflineCacheParentDirectory; }
+ nsIFile * OfflineCacheParentDirectory() { return mOfflineCacheParentDirectory; }
bool MemoryCacheEnabled();
PRInt32 MemoryCacheCapacity();
PRInt32 MemoryCacheMaxEntrySize() { return mMemoryCacheMaxEntrySize; }
PRInt32 CacheCompressionLevel();
bool SanitizeAtShutdown() { return mSanitizeOnShutdown && mClearCacheOnShutdown; }
@@ -160,22 +160,22 @@ public:
private:
bool PermittedToSmartSize(nsIPrefBranch*, bool firstRun);
bool mHaveProfile;
bool mDiskCacheEnabled;
PRInt32 mDiskCacheCapacity; // in kilobytes
PRInt32 mDiskCacheMaxEntrySize; // in kilobytes
- nsCOMPtr<nsILocalFile> mDiskCacheParentDirectory;
+ nsCOMPtr<nsIFile> mDiskCacheParentDirectory;
bool mSmartSizeEnabled;
bool mOfflineCacheEnabled;
PRInt32 mOfflineCacheCapacity; // in kilobytes
- nsCOMPtr<nsILocalFile> mOfflineCacheParentDirectory;
+ nsCOMPtr<nsIFile> mOfflineCacheParentDirectory;
bool mMemoryCacheEnabled;
PRInt32 mMemoryCacheCapacity; // in kilobytes
PRInt32 mMemoryCacheMaxEntrySize; // in kilobytes
PRInt32 mCacheCompressionLevel;
bool mSanitizeOnShutdown;
@@ -579,17 +579,17 @@ SmartCacheSize(const PRUint32 availKB)
*@return: The size that the user's disk cache should default to, in kBytes.
*/
PRUint32
nsCacheProfilePrefObserver::GetSmartCacheSize(const nsAString& cachePath,
PRUint32 currentSize)
{
// Check for free space on device where cache directory lives
nsresult rv;
- nsCOMPtr<nsILocalFile>
+ nsCOMPtr<nsIFile>
cacheDirectory (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
if (NS_FAILED(rv) || !cacheDirectory)
return DEFAULT_CACHE_SIZE;
rv = cacheDirectory->InitWithPath(cachePath);
if (NS_FAILED(rv))
return DEFAULT_CACHE_SIZE;
PRInt64 bytesAvailable;
rv = cacheDirectory->GetDiskSpaceAvailable(&bytesAvailable);
@@ -651,17 +651,17 @@ nsCacheProfilePrefObserver::ReadPrefs(ns
(void)branch->GetIntPref(DISK_CACHE_CAPACITY_PREF, &mDiskCacheCapacity);
mDiskCacheCapacity = NS_MAX(0, mDiskCacheCapacity);
(void) branch->GetIntPref(DISK_CACHE_MAX_ENTRY_SIZE_PREF,
&mDiskCacheMaxEntrySize);
mDiskCacheMaxEntrySize = NS_MAX(-1, mDiskCacheMaxEntrySize);
(void) branch->GetComplexValue(DISK_CACHE_DIR_PREF, // ignore error
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(mDiskCacheParentDirectory));
if (!mDiskCacheParentDirectory) {
nsCOMPtr<nsIFile> directory;
// try to get the disk cache parent directory
rv = NS_GetSpecialDirectory(NS_APP_CACHE_PARENT_DIR,
getter_AddRefs(directory));
@@ -728,17 +728,17 @@ nsCacheProfilePrefObserver::ReadPrefs(ns
&mOfflineCacheEnabled);
mOfflineCacheCapacity = OFFLINE_CACHE_CAPACITY;
(void)branch->GetIntPref(OFFLINE_CACHE_CAPACITY_PREF,
&mOfflineCacheCapacity);
mOfflineCacheCapacity = NS_MAX(0, mOfflineCacheCapacity);
(void) branch->GetComplexValue(OFFLINE_CACHE_DIR_PREF, // ignore error
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(mOfflineCacheParentDirectory));
if (!mOfflineCacheParentDirectory) {
nsCOMPtr<nsIFile> directory;
// try to get the offline cache parent directory
rv = NS_GetSpecialDirectory(NS_APP_CACHE_PARENT_DIR,
getter_AddRefs(directory));
@@ -1156,17 +1156,17 @@ nsCacheService::ShutdownCustomCacheDevic
void
nsCacheService::Shutdown()
{
nsCOMPtr<nsIThread> cacheIOThread;
Telemetry::AutoTimer<Telemetry::NETWORK_DISK_CACHE_SHUTDOWN> totalTimer;
bool shouldSanitize = false;
- nsCOMPtr<nsILocalFile> parentDir;
+ nsCOMPtr<nsIFile> parentDir;
{
nsCacheServiceAutoLock lock;
NS_ASSERTION(mInitialized,
"can't shutdown nsCacheService unless it has been initialized.");
if (mInitialized) {
@@ -1540,17 +1540,17 @@ nsCacheService::GetOfflineDevice(nsOffli
NS_ENSURE_SUCCESS(rv, rv);
}
NS_ADDREF(*aDevice = mOfflineDevice);
return NS_OK;
}
nsresult
-nsCacheService::GetCustomOfflineDevice(nsILocalFile *aProfileDir,
+nsCacheService::GetCustomOfflineDevice(nsIFile *aProfileDir,
PRInt32 aQuota,
nsOfflineCacheDevice **aDevice)
{
nsresult rv;
nsAutoString profilePath;
rv = aProfileDir->GetPath(profilePath);
NS_ENSURE_SUCCESS(rv, rv);
@@ -1578,17 +1578,17 @@ nsCacheService::CreateOfflineDevice()
mObserver->OfflineCacheCapacity(),
&mOfflineDevice);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
nsresult
-nsCacheService::CreateCustomOfflineDevice(nsILocalFile *aProfileDir,
+nsCacheService::CreateCustomOfflineDevice(nsIFile *aProfileDir,
PRInt32 aQuota,
nsOfflineCacheDevice **aDevice)
{
NS_ENSURE_ARG(aProfileDir);
#if defined(PR_LOGGING)
nsCAutoString profilePath;
aProfileDir->GetNativePath(profilePath);
--- a/netwerk/cache/nsCacheService.h
+++ b/netwerk/cache/nsCacheService.h
@@ -113,17 +113,17 @@ public:
nsresult GetOfflineDevice(nsOfflineCacheDevice ** aDevice);
/**
* Creates an offline cache device that works over a specific profile directory.
* A tool to preload offline cache for profiles different from the current
* application's profile directory.
*/
- nsresult GetCustomOfflineDevice(nsILocalFile *aProfileDir,
+ nsresult GetCustomOfflineDevice(nsIFile *aProfileDir,
PRInt32 aQuota,
nsOfflineCacheDevice **aDevice);
// This method may be called to release an object while the cache service
// lock is being held. If a non-null target is specified and the target
// does not correspond to the current thread, then the release will be
// proxied to the specified target. Otherwise, the object will be added to
// the list of objects to be released when the cache service is unlocked.
@@ -188,17 +188,17 @@ private:
* Internal Methods
*/
static void Lock();
static void Unlock();
nsresult CreateDiskDevice();
nsresult CreateOfflineDevice();
- nsresult CreateCustomOfflineDevice(nsILocalFile *aProfileDir,
+ nsresult CreateCustomOfflineDevice(nsIFile *aProfileDir,
PRInt32 aQuota,
nsOfflineCacheDevice **aDevice);
nsresult CreateMemoryDevice();
nsresult CreateRequest(nsCacheSession * session,
const nsACString & clientKey,
nsCacheAccessMode accessRequested,
bool blockingMode,
--- a/netwerk/cache/nsCacheSession.cpp
+++ b/netwerk/cache/nsCacheSession.cpp
@@ -36,31 +36,31 @@ nsCacheSession::~nsCacheSession()
NS_IMETHODIMP nsCacheSession::GetDoomEntriesIfExpired(bool *result)
{
NS_ENSURE_ARG_POINTER(result);
*result = WillDoomEntriesIfExpired();
return NS_OK;
}
-NS_IMETHODIMP nsCacheSession::SetProfileDirectory(nsILocalFile *profileDir)
+NS_IMETHODIMP nsCacheSession::SetProfileDirectory(nsIFile *profileDir)
{
if (StoragePolicy() != nsICache::STORE_OFFLINE && profileDir) {
// Profile directory override is currently implemented only for
// offline cache. This is an early failure to prevent the request
// being processed before it would fail later because of inability
// to assign a cache base dir.
return NS_ERROR_UNEXPECTED;
}
mProfileDir = profileDir;
return NS_OK;
}
-NS_IMETHODIMP nsCacheSession::GetProfileDirectory(nsILocalFile **profileDir)
+NS_IMETHODIMP nsCacheSession::GetProfileDirectory(nsIFile **profileDir)
{
if (mProfileDir)
NS_ADDREF(*profileDir = mProfileDir);
else
*profileDir = nsnull;
return NS_OK;
}
--- a/netwerk/cache/nsCacheSession.h
+++ b/netwerk/cache/nsCacheSession.h
@@ -6,17 +6,17 @@
#ifndef _nsCacheSession_h_
#define _nsCacheSession_h_
#include "nspr.h"
#include "nsError.h"
#include "nsCOMPtr.h"
#include "nsICacheSession.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsString.h"
class nsCacheSession : public nsICacheSession
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSICACHESESSION
@@ -50,17 +50,17 @@ public:
void SetStoragePolicy(nsCacheStoragePolicy policy)
{
NS_ASSERTION(policy <= 0xFF, "too many bits in nsCacheStoragePolicy");
mInfo &= ~eStoragePolicyMask; // clear storage policy bits
mInfo |= policy;
}
- nsILocalFile* ProfileDir() { return mProfileDir; }
+ nsIFile* ProfileDir() { return mProfileDir; }
private:
nsCString mClientID;
PRUint32 mInfo;
- nsCOMPtr<nsILocalFile> mProfileDir;
+ nsCOMPtr<nsIFile> mProfileDir;
};
#endif // _nsCacheSession_h_
--- a/netwerk/cache/nsDiskCacheBlockFile.cpp
+++ b/netwerk/cache/nsDiskCacheBlockFile.cpp
@@ -14,19 +14,19 @@ using namespace mozilla;
/******************************************************************************
* nsDiskCacheBlockFile -
*****************************************************************************/
/******************************************************************************
* Open
*****************************************************************************/
nsresult
-nsDiskCacheBlockFile::Open(nsILocalFile * blockFile,
- PRUint32 blockSize,
- PRUint32 bitMapSize)
+nsDiskCacheBlockFile::Open(nsIFile * blockFile,
+ PRUint32 blockSize,
+ PRUint32 bitMapSize)
{
if (bitMapSize % 32)
return NS_ERROR_INVALID_ARG;
mBlockSize = blockSize;
mBitMapWords = bitMapSize / 32;
PRUint32 bitMapBytes = mBitMapWords * 4;
--- a/netwerk/cache/nsDiskCacheBlockFile.h
+++ b/netwerk/cache/nsDiskCacheBlockFile.h
@@ -2,17 +2,17 @@
/* vim: set sw=4 ts=8 et tw=80 : */
/* 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 _nsDiskCacheBlockFile_h_
#define _nsDiskCacheBlockFile_h_
-#include "nsILocalFile.h"
+#include "nsIFile.h"
/******************************************************************************
* nsDiskCacheBlockFile
*
* The structure of a cache block file is a 4096 bytes bit map, followed by
* some number of blocks of mBlockSize. The creator of a
* nsDiskCacheBlockFile object must provide the block size for a given file.
*
@@ -24,17 +24,17 @@ public:
, mBitMap(nsnull)
, mBlockSize(0)
, mBitMapWords(0)
, mFileSize(0)
, mBitMapDirty(false)
{}
~nsDiskCacheBlockFile() { (void) Close(true); }
- nsresult Open( nsILocalFile * blockFile, PRUint32 blockSize,
+ nsresult Open( nsIFile * blockFile, PRUint32 blockSize,
PRUint32 bitMapSize);
nsresult Close(bool flush);
/*
* Trim
* Truncates the block file to the end of the last allocated block.
*/
nsresult Trim() { return nsDiskCache::Truncate(mFD, CalcBlockFileSize()); }
--- a/netwerk/cache/nsDiskCacheDevice.cpp
+++ b/netwerk/cache/nsDiskCacheDevice.cpp
@@ -208,18 +208,18 @@ NS_IMETHODIMP nsDiskCacheDeviceInfo::Get
NS_IMETHODIMP nsDiskCacheDeviceInfo::GetUsageReport(char ** usageReport)
{
NS_ENSURE_ARG_POINTER(usageReport);
nsCString buffer;
buffer.AssignLiteral(" <tr>\n"
" <th>Cache Directory:</th>\n"
" <td>");
- nsCOMPtr<nsILocalFile> cacheDir;
- nsAutoString path;
+ nsCOMPtr<nsIFile> cacheDir;
+ nsAutoString path;
mDevice->getCacheDirectory(getter_AddRefs(cacheDir));
nsresult rv = cacheDir->GetPath(path);
if (NS_SUCCEEDED(rv)) {
AppendUTF16toUTF8(path, buffer);
} else {
buffer.AppendLiteral("directory unavailable");
}
buffer.AppendLiteral("</td>\n"
@@ -1063,17 +1063,17 @@ nsDiskCacheDevice::EvictDiskCacheEntries
}
/**
* methods for prefs
*/
void
-nsDiskCacheDevice::SetCacheParentDirectory(nsILocalFile * parentDir)
+nsDiskCacheDevice::SetCacheParentDirectory(nsIFile * parentDir)
{
nsresult rv;
bool exists;
if (Initialized()) {
NS_ASSERTION(false, "Cannot switch cache directory when initialized");
return;
}
@@ -1097,17 +1097,17 @@ nsDiskCacheDevice::SetCacheParentDirecto
rv = directory->AppendNative(NS_LITERAL_CSTRING("Cache"));
if (NS_FAILED(rv)) return;
mCacheDirectory = do_QueryInterface(directory);
}
void
-nsDiskCacheDevice::getCacheDirectory(nsILocalFile ** result)
+nsDiskCacheDevice::getCacheDirectory(nsIFile ** result)
{
*result = mCacheDirectory;
NS_IF_ADDREF(*result);
}
/**
* NOTE: called while holding the cache service lock
--- a/netwerk/cache/nsDiskCacheDevice.h
+++ b/netwerk/cache/nsDiskCacheDevice.h
@@ -7,17 +7,17 @@
#ifndef _nsDiskCacheDevice_h_
#define _nsDiskCacheDevice_h_
#include "nsCacheDevice.h"
#include "nsDiskCacheBinding.h"
#include "nsDiskCacheBlockFile.h"
#include "nsDiskCacheEntry.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIObserver.h"
#include "nsCOMArray.h"
class nsDiskCacheMap;
class nsDiskCacheDevice : public nsCacheDevice {
public:
@@ -52,23 +52,23 @@ public:
virtual nsresult EvictEntries(const char * clientID);
bool EntryIsTooBig(PRInt64 entrySize);
/**
* Preference accessors
*/
- void SetCacheParentDirectory(nsILocalFile * parentDir);
+ void SetCacheParentDirectory(nsIFile * parentDir);
void SetCapacity(PRUint32 capacity);
void SetMaxEntrySize(PRInt32 maxSizeInKilobytes);
/* private: */
- void getCacheDirectory(nsILocalFile ** result);
+ void getCacheDirectory(nsIFile ** result);
PRUint32 getCacheCapacity();
PRUint32 getCacheSize();
PRUint32 getEntryCount();
nsDiskCacheMap * CacheMap() { return &mCacheMap; }
private:
friend class nsDiskCacheDeviceDeactivateEntryEvent;
@@ -94,17 +94,17 @@ private:
nsresult OpenDiskCache();
nsresult ClearDiskCache();
nsresult EvictDiskCacheEntries(PRUint32 targetCapacity);
/**
* Member variables
*/
- nsCOMPtr<nsILocalFile> mCacheDirectory;
+ nsCOMPtr<nsIFile> mCacheDirectory;
nsDiskCacheBindery mBindery;
PRUint32 mCacheCapacity; // Unit is KiB's
PRInt32 mMaxEntrySize; // Unit is bytes internally
// XXX need soft/hard limits, currentTotal
nsDiskCacheMap mCacheMap;
bool mInitialized;
bool mClearingDiskCache;
};
--- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp
@@ -248,17 +248,17 @@ nsOfflineCacheDeviceInfo::GetDescription
NS_IMETHODIMP
nsOfflineCacheDeviceInfo::GetUsageReport(char ** usageReport)
{
nsCAutoString buffer;
buffer.AssignLiteral(" <tr>\n"
" <th>Cache Directory:</th>\n"
" <td>");
- nsILocalFile *cacheDir = mDevice->CacheDirectory();
+ nsIFile *cacheDir = mDevice->CacheDirectory();
if (!cacheDir)
return NS_OK;
nsAutoString path;
nsresult rv = cacheDir->GetPath(path);
if (NS_SUCCEEDED(rv))
AppendUTF16toUTF8(path, buffer);
else
@@ -625,17 +625,17 @@ nsApplicationCache::GetGroupID(nsACStrin
NS_IMETHODIMP
nsApplicationCache::GetClientID(nsACString &out)
{
out = mClientID;
return NS_OK;
}
NS_IMETHODIMP
-nsApplicationCache::GetCacheDirectory(nsILocalFile **out)
+nsApplicationCache::GetCacheDirectory(nsIFile **out)
{
if (mDevice->BaseDirectory())
NS_ADDREF(*out = mDevice->BaseDirectory());
else
*out = nsnull;
return NS_OK;
}
@@ -2345,17 +2345,17 @@ nsOfflineCacheDevice::GetGroupForCache(c
return NS_OK;
}
/**
* Preference accessors
*/
void
-nsOfflineCacheDevice::SetCacheParentDirectory(nsILocalFile *parentDir)
+nsOfflineCacheDevice::SetCacheParentDirectory(nsIFile *parentDir)
{
if (Initialized())
{
NS_ERROR("cannot switch cache directory once initialized");
return;
}
if (!parentDir)
--- a/netwerk/cache/nsDiskCacheDeviceSQL.h
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.h
@@ -4,17 +4,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsOfflineCacheDevice_h__
#define nsOfflineCacheDevice_h__
#include "nsCacheDevice.h"
#include "nsIApplicationCache.h"
#include "nsIApplicationCacheService.h"
-#include "nsILocalFile.h"
#include "nsIObserver.h"
#include "mozIStorageConnection.h"
#include "mozIStorageFunction.h"
#include "nsIFile.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsCOMArray.h"
#include "nsInterfaceHashtable.h"
@@ -160,21 +159,21 @@ public:
nsresult GetGroupsTimeOrdered(PRUint32 *count,
char ***keys);
/**
* Preference accessors
*/
- void SetCacheParentDirectory(nsILocalFile * parentDir);
+ void SetCacheParentDirectory(nsIFile * parentDir);
void SetCapacity(PRUint32 capacity);
- nsILocalFile * BaseDirectory() { return mBaseDirectory; }
- nsILocalFile * CacheDirectory() { return mCacheDirectory; }
+ nsIFile * BaseDirectory() { return mBaseDirectory; }
+ nsIFile * CacheDirectory() { return mCacheDirectory; }
PRUint32 CacheCapacity() { return mCacheCapacity; }
PRUint32 CacheSize();
PRUint32 EntryCount();
private:
friend class nsApplicationCache;
static PLDHashOperator ShutdownApplicationCache(const nsACString &key,
@@ -248,18 +247,18 @@ private:
nsCOMPtr<mozIStorageStatement> mStatement_GatherEntries;
nsCOMPtr<mozIStorageStatement> mStatement_ActivateClient;
nsCOMPtr<mozIStorageStatement> mStatement_DeactivateGroup;
nsCOMPtr<mozIStorageStatement> mStatement_FindClient;
nsCOMPtr<mozIStorageStatement> mStatement_FindClientByNamespace;
nsCOMPtr<mozIStorageStatement> mStatement_EnumerateGroups;
nsCOMPtr<mozIStorageStatement> mStatement_EnumerateGroupsTimeOrder;
- nsCOMPtr<nsILocalFile> mBaseDirectory;
- nsCOMPtr<nsILocalFile> mCacheDirectory;
+ nsCOMPtr<nsIFile> mBaseDirectory;
+ nsCOMPtr<nsIFile> mCacheDirectory;
PRUint32 mCacheCapacity; // in bytes
PRInt32 mDeltaCounter;
nsInterfaceHashtable<nsCStringHashKey, nsIWeakReference> mCaches;
nsClassHashtable<nsCStringHashKey, nsCString> mActiveCachesByGroup;
nsTHashtable<nsCStringHashKey> mActiveCaches;
nsCOMPtr<nsIThread> mInitThread;
--- a/netwerk/cache/nsDiskCacheMap.cpp
+++ b/netwerk/cache/nsDiskCacheMap.cpp
@@ -22,34 +22,32 @@
* nsDiskCacheMap
*****************************************************************************/
/**
* File operations
*/
nsresult
-nsDiskCacheMap::Open(nsILocalFile * cacheDirectory)
+nsDiskCacheMap::Open(nsIFile * cacheDirectory)
{
NS_ENSURE_ARG_POINTER(cacheDirectory);
if (mMapFD) return NS_ERROR_ALREADY_INITIALIZED;
mCacheDirectory = cacheDirectory; // save a reference for ourselves
- // create nsILocalFile for _CACHE_MAP_
+ // create nsIFile for _CACHE_MAP_
nsresult rv;
nsCOMPtr<nsIFile> file;
rv = cacheDirectory->Clone(getter_AddRefs(file));
- nsCOMPtr<nsILocalFile> localFile(do_QueryInterface(file, &rv));
- NS_ENSURE_SUCCESS(rv, rv);
- rv = localFile->AppendNative(NS_LITERAL_CSTRING("_CACHE_MAP_"));
+ rv = file->AppendNative(NS_LITERAL_CSTRING("_CACHE_MAP_"));
NS_ENSURE_SUCCESS(rv, rv);
// open the file - restricted to user, the data could be confidential
- rv = localFile->OpenNSPRFileDesc(PR_RDWR | PR_CREATE_FILE, 00600, &mMapFD);
+ rv = file->OpenNSPRFileDesc(PR_RDWR | PR_CREATE_FILE, 00600, &mMapFD);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FILE_CORRUPTED);
bool cacheFilesExist = CacheFilesExist();
rv = NS_ERROR_FILE_CORRUPTED; // presume the worst
// check size of map file
PRUint32 mapSize = PR_Available(mMapFD);
if (mapSize == 0) { // creating a new _CACHE_MAP_
@@ -584,18 +582,18 @@ nsDiskCacheMap::EvictRecords( nsDiskCach
return NS_OK;
}
nsresult
nsDiskCacheMap::OpenBlockFiles()
{
- // create nsILocalFile for block file
- nsCOMPtr<nsILocalFile> blockFile;
+ // create nsIFile for block file
+ nsCOMPtr<nsIFile> blockFile;
nsresult rv = NS_OK;
for (int i = 0; i < kNumBlockFiles; ++i) {
rv = GetBlockFileForIndex(i, getter_AddRefs(blockFile));
if (NS_FAILED(rv)) break;
PRUint32 blockSize = GetBlockSizeForIndex(i+1); // +1 to match file selectors 1,2,3
PRUint32 bitMapSize = GetBitMapSizeForIndex(i+1);
@@ -620,17 +618,17 @@ nsDiskCacheMap::CloseBlockFiles(bool flu
}
return rv2;
}
bool
nsDiskCacheMap::CacheFilesExist()
{
- nsCOMPtr<nsILocalFile> blockFile;
+ nsCOMPtr<nsIFile> blockFile;
nsresult rv;
for (int i = 0; i < kNumBlockFiles; ++i) {
bool exists;
rv = GetBlockFileForIndex(i, getter_AddRefs(blockFile));
if (NS_FAILED(rv)) return false;
rv = blockFile->Exists(&exists);
@@ -652,18 +650,17 @@ nsDiskCacheMap::CreateCacheSubDirectorie
nsresult rv = mCacheDirectory->Clone(getter_AddRefs(file));
if (NS_FAILED(rv))
return rv;
rv = file->AppendNative(nsPrintfCString("%X", index));
if (NS_FAILED(rv))
return rv;
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(file, &rv);
- rv = localFile->Create(nsIFile::DIRECTORY_TYPE, 0700);
+ rv = file->Create(nsIFile::DIRECTORY_TYPE, 0700);
if (NS_FAILED(rv))
return rv;
}
return NS_OK;
}
@@ -676,17 +673,17 @@ nsDiskCacheMap::ReadDiskCacheEntry(nsDis
nsDiskCacheEntry * diskEntry = nsnull;
PRUint32 metaFile = record->MetaFile();
PRInt32 bytesRead = 0;
if (!record->MetaLocationInitialized()) return nsnull;
if (metaFile == 0) { // entry/metadata stored in separate file
// open and read the file
- nsCOMPtr<nsILocalFile> file;
+ nsCOMPtr<nsIFile> file;
rv = GetLocalFileForDiskCacheRecord(record,
nsDiskCache::kMetaData,
false,
getter_AddRefs(file));
NS_ENSURE_SUCCESS(rv, nsnull);
CACHE_LOG_DEBUG(("CACHE: nsDiskCacheMap::ReadDiskCacheEntry"
"[this=%p] reading disk cache entry", this));
@@ -866,17 +863,17 @@ nsDiskCacheMap::WriteDiskCacheEntry(nsDi
if (metaFileSizeK > kMaxDataSizeK)
metaFileSizeK = kMaxDataSizeK;
binding->mRecord.SetMetaFileGeneration(binding->mGeneration);
binding->mRecord.SetMetaFileSize(metaFileSizeK);
rv = UpdateRecord(&binding->mRecord);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
rv = GetLocalFileForDiskCacheRecord(&binding->mRecord,
nsDiskCache::kMetaData,
true,
getter_AddRefs(localFile));
NS_ENSURE_SUCCESS(rv, rv);
// open the file
PRFileDesc * fd;
@@ -1024,18 +1021,17 @@ nsDiskCacheMap::GetFileForDiskCacheRecor
// 0x01234567 -> 0/12/
rv = file->AppendNative(nsPrintfCString("%X", hash >> 28));
if (NS_FAILED(rv)) return rv;
rv = file->AppendNative(nsPrintfCString("%02X", (hash >> 20) & 0xFF));
if (NS_FAILED(rv)) return rv;
bool exists;
if (createPath && (NS_FAILED(file->Exists(&exists)) || !exists)) {
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(file, &rv);
- rv = localFile->Create(nsIFile::DIRECTORY_TYPE, 0700);
+ rv = file->Create(nsIFile::DIRECTORY_TYPE, 0700);
if (NS_FAILED(rv)) return rv;
}
PRInt16 generation = record->Generation();
char name[32];
// Cut the beginning of the hash that was used in the path
::sprintf(name, "%05X%c%02X", hash & 0xFFFFF, (meta ? 'm' : 'd'),
generation);
@@ -1046,49 +1042,45 @@ nsDiskCacheMap::GetFileForDiskCacheRecor
return rv;
}
nsresult
nsDiskCacheMap::GetLocalFileForDiskCacheRecord(nsDiskCacheRecord * record,
bool meta,
bool createPath,
- nsILocalFile ** result)
+ nsIFile ** result)
{
nsCOMPtr<nsIFile> file;
nsresult rv = GetFileForDiskCacheRecord(record,
meta,
createPath,
getter_AddRefs(file));
if (NS_FAILED(rv)) return rv;
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(file, &rv);
- if (NS_FAILED(rv)) return rv;
-
- NS_IF_ADDREF(*result = localFile);
+ NS_IF_ADDREF(*result = file);
return rv;
}
nsresult
-nsDiskCacheMap::GetBlockFileForIndex(PRUint32 index, nsILocalFile ** result)
+nsDiskCacheMap::GetBlockFileForIndex(PRUint32 index, nsIFile ** result)
{
if (!mCacheDirectory) return NS_ERROR_NOT_AVAILABLE;
nsCOMPtr<nsIFile> file;
nsresult rv = mCacheDirectory->Clone(getter_AddRefs(file));
if (NS_FAILED(rv)) return rv;
char name[32];
::sprintf(name, "_CACHE_%03d_", index + 1);
rv = file->AppendNative(nsDependentCString(name));
if (NS_FAILED(rv)) return rv;
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(file, &rv);
- NS_IF_ADDREF(*result = localFile);
+ NS_IF_ADDREF(*result = file);
return rv;
}
PRUint32
nsDiskCacheMap::CalculateFileIndex(PRUint32 size)
{
--- a/netwerk/cache/nsDiskCacheMap.h
+++ b/netwerk/cache/nsDiskCacheMap.h
@@ -8,17 +8,17 @@
#define _nsDiskCacheMap_h_
#include <limits.h>
#include "prtypes.h"
#include "prnetdb.h"
#include "nsDebug.h"
#include "nsError.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsDiskCache.h"
#include "nsDiskCacheBlockFile.h"
class nsDiskCacheBinding;
struct nsDiskCacheEntry;
@@ -391,17 +391,17 @@ public:
/**
* File Operations
*
* Open
*
* Creates a new cache map file if one doesn't exist.
* Returns error if it detects change in format or cache wasn't closed.
*/
- nsresult Open( nsILocalFile * cacheDirectory);
+ nsresult Open( nsIFile * cacheDirectory);
nsresult Close(bool flush);
nsresult Trim();
nsresult FlushHeader();
nsresult FlushRecords( bool unswap);
void NotifyCapacityChange(PRUint32 capacity);
@@ -423,17 +423,17 @@ public:
nsresult GetFileForDiskCacheRecord( nsDiskCacheRecord * record,
bool meta,
bool createPath,
nsIFile ** result);
nsresult GetLocalFileForDiskCacheRecord( nsDiskCacheRecord * record,
bool meta,
bool createPath,
- nsILocalFile ** result);
+ nsIFile ** result);
// On success, this returns the buffer owned by nsDiskCacheMap,
// so it must not be deleted by the caller.
nsDiskCacheEntry * ReadDiskCacheEntry( nsDiskCacheRecord * record);
nsresult WriteDiskCacheEntry( nsDiskCacheBinding * binding);
nsresult ReadDataCacheBlocks(nsDiskCacheBinding * binding, char * buffer, PRUint32 size);
@@ -481,17 +481,17 @@ private:
nsresult OpenBlockFiles();
nsresult CloseBlockFiles(bool flush);
bool CacheFilesExist();
nsresult CreateCacheSubDirectories();
PRUint32 CalculateFileIndex(PRUint32 size);
- nsresult GetBlockFileForIndex( PRUint32 index, nsILocalFile ** result);
+ nsresult GetBlockFileForIndex( PRUint32 index, nsIFile ** result);
PRUint32 GetBlockSizeForIndex( PRUint32 index) const {
return BLOCK_SIZE_FOR_INDEX(index);
}
PRUint32 GetBitMapSizeForIndex( PRUint32 index) const {
return BITMAP_SIZE_FOR_INDEX(index);
}
// returns the bucket number
@@ -524,17 +524,17 @@ private:
// so it must not be deleted by the caller.
nsDiskCacheEntry * CreateDiskCacheEntry(nsDiskCacheBinding * binding,
PRUint32 * size);
/**
* data members
*/
private:
- nsCOMPtr<nsILocalFile> mCacheDirectory;
+ nsCOMPtr<nsIFile> mCacheDirectory;
PRFileDesc * mMapFD;
nsDiskCacheRecord * mRecordArray;
nsDiskCacheBlockFile mBlockFile[kNumBlockFiles];
PRUint32 mBufferSize;
char * mBuffer;
nsDiskCacheHeader mHeader;
PRInt32 mMaxRecordCount;
};
--- a/netwerk/cache/nsDiskCacheStreams.h
+++ b/netwerk/cache/nsDiskCacheStreams.h
@@ -65,17 +65,17 @@ private:
void DeleteBuffer();
nsresult Flush();
nsDiskCacheBinding * mBinding; // not an owning reference
nsDiskCacheDevice * mDevice;
nsDiskCacheOutputStream * mOutStream; // not an owning reference
PRInt32 mInStreamCount;
- nsCOMPtr<nsILocalFile> mLocalFile;
+ nsCOMPtr<nsIFile> mLocalFile;
PRFileDesc * mFD;
PRUint32 mStreamPos; // for Output Streams
PRUint32 mStreamEnd;
PRUint32 mBufPos; // current mark in buffer
PRUint32 mBufEnd; // current end of data in buffer
PRUint32 mBufSize; // current end of buffer
bool mBufDirty;
--- a/netwerk/cache/nsICacheSession.idl
+++ b/netwerk/cache/nsICacheSession.idl
@@ -4,17 +4,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 "nsISupports.idl"
#include "nsICache.idl"
interface nsICacheEntryDescriptor;
interface nsICacheListener;
-interface nsILocalFile;
+interface nsIFile;
[scriptable, uuid(1dd7708c-de48-4ffe-b5aa-cd218c762887)]
interface nsICacheSession : nsISupports
{
/**
* Expired entries will be doomed or evicted if this attribute is set to
* true. If false, expired entries will be returned (useful for offline-
* mode and clients, such as HTTP, that can update the valid lifetime of
@@ -23,17 +23,17 @@ interface nsICacheSession : nsISupports
attribute boolean doomEntriesIfExpired;
/**
* When set, entries created with this session will be placed to a cache
* based at this directory. Use when storing entries to a different
* profile than the active profile of the the current running application
* process.
*/
- attribute nsILocalFile profileDirectory;
+ attribute nsIFile profileDirectory;
/**
* A cache session can only give out one descriptor with WRITE access
* to a given cache entry at a time. Until the client calls MarkValid on
* its descriptor, other attempts to open the same cache entry will block.
*/
/**
--- a/netwerk/protocol/about/nsAboutBloat.cpp
+++ b/netwerk/protocol/about/nsAboutBloat.cpp
@@ -14,17 +14,17 @@
#include "nsStringStream.h"
#include "nsXPIDLString.h"
#include "nsIURI.h"
#include "prtime.h"
#include "nsCOMPtr.h"
#include "nsIFileStreams.h"
#include "nsNetUtil.h"
#include "nsDirectoryServiceDefs.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
static void GC_gcollect() {}
NS_IMPL_ISUPPORTS1(nsAboutBloat, nsIAboutModule)
NS_IMETHODIMP
nsAboutBloat::NewChannel(nsIURI *aURI, nsIChannel **result)
{
@@ -96,20 +96,17 @@ nsAboutBloat::NewChannel(nsIURI *aURI, n
PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &expTime);
char time[128];
PR_FormatTimeUSEnglish(time, 128, "%Y-%m-%d-%H%M%S.txt", &expTime);
dumpFileName += time;
rv = file->AppendNative(dumpFileName);
if (NS_FAILED(rv)) return rv;
FILE* out;
- nsCOMPtr<nsILocalFile> lfile = do_QueryInterface(file);
- if (lfile == nsnull)
- return NS_ERROR_FAILURE;
- rv = lfile->OpenANSIFileDesc("w", &out);
+ rv = file->OpenANSIFileDesc("w", &out);
if (NS_FAILED(rv)) return rv;
rv = nsTraceRefcntImpl::DumpStatistics(statType, out);
::fclose(out);
if (NS_FAILED(rv)) return rv;
rv = NS_NewLocalFileInputStream(getter_AddRefs(inStr), file);
if (NS_FAILED(rv)) return rv;
--- a/netwerk/protocol/file/nsFileChannel.cpp
+++ b/netwerk/protocol/file/nsFileChannel.cpp
@@ -243,17 +243,17 @@ nsFileUploadContentStream::OnCopyComplet
nsFileChannel::nsFileChannel(nsIURI *uri)
{
// If we have a link file, we should resolve its target right away.
// This is to protect against a same origin attack where the same link file
// can point to different resources right after the first resource is loaded.
nsCOMPtr<nsIFile> file;
nsCOMPtr <nsIURI> targetURI;
nsCAutoString fileTarget;
- nsCOMPtr<nsILocalFile> resolvedFile;
+ nsCOMPtr<nsIFile> resolvedFile;
bool symLink;
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(uri);
if (fileURL &&
NS_SUCCEEDED(fileURL->GetFile(getter_AddRefs(file))) &&
NS_SUCCEEDED(file->IsSymlink(&symLink)) &&
symLink &&
NS_SUCCEEDED(file->GetNativeTarget(fileTarget)) &&
NS_SUCCEEDED(NS_NewNativeLocalFile(fileTarget, PR_TRUE,
--- a/netwerk/protocol/file/nsFileProtocolHandler.cpp
+++ b/netwerk/protocol/file/nsFileProtocolHandler.cpp
@@ -155,22 +155,18 @@ nsFileProtocolHandler::ReadURLFile(nsIFi
// We only support desktop files that end in ".desktop" like the spec says:
// http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html
nsCAutoString leafName;
nsresult rv = aFile->GetNativeLeafName(leafName);
if (NS_FAILED(rv) ||
!StringEndsWith(leafName, NS_LITERAL_CSTRING(".desktop")))
return NS_ERROR_NOT_AVAILABLE;
- nsCOMPtr<nsILocalFile> file(do_QueryInterface(aFile, &rv));
- if (NS_FAILED(rv))
- return rv;
-
nsINIParser parser;
- rv = parser.Init(file);
+ rv = parser.Init(aFile);
if (NS_FAILED(rv))
return rv;
nsCAutoString type;
parser.GetString(DESKTOP_ENTRY_SECTION, "Type", type);
if (!type.EqualsLiteral("Link"))
return NS_ERROR_NOT_AVAILABLE;
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -5363,26 +5363,26 @@ nsHttpChannel::SetOfflineCacheClientID(c
ENSURE_CALLED_BEFORE_ASYNC_OPEN();
mOfflineCacheClientID = value;
return NS_OK;
}
NS_IMETHODIMP
-nsHttpChannel::GetProfileDirectory(nsILocalFile **_result)
+nsHttpChannel::GetProfileDirectory(nsIFile **_result)
{
NS_ENSURE_ARG(_result);
NS_ADDREF(*_result = mProfileDirectory);
return NS_OK;
}
NS_IMETHODIMP
-nsHttpChannel::SetProfileDirectory(nsILocalFile *value)
+nsHttpChannel::SetProfileDirectory(nsIFile *value)
{
mProfileDirectory = value;
return NS_OK;
}
NS_IMETHODIMP
nsHttpChannel::GetCacheFile(nsIFile **cacheFile)
{
--- a/netwerk/protocol/http/nsHttpChannel.h
+++ b/netwerk/protocol/http/nsHttpChannel.h
@@ -22,17 +22,17 @@
#include "nsIPrompt.h"
#include "nsIResumableChannel.h"
#include "nsIProtocolProxyCallback.h"
#include "nsICancelable.h"
#include "nsIHttpAuthenticableChannel.h"
#include "nsIHttpChannelAuthProvider.h"
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsITimedChannel.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsDNSPrefetch.h"
#include "TimingStruct.h"
#include "AutoClose.h"
#include "mozilla/Telemetry.h"
class nsAHttpConnection;
namespace mozilla { namespace net {
@@ -300,17 +300,17 @@ private:
typedef nsresult (nsHttpChannel:: *nsOnCacheEntryAvailableCallback)(
nsICacheEntryDescriptor *, nsCacheAccessMode, nsresult);
nsOnCacheEntryAvailableCallback mOnCacheEntryAvailableCallback;
nsCOMPtr<nsICacheEntryDescriptor> mOfflineCacheEntry;
nsCacheAccessMode mOfflineCacheAccess;
nsCString mOfflineCacheClientID;
- nsCOMPtr<nsILocalFile> mProfileDirectory;
+ nsCOMPtr<nsIFile> mProfileDirectory;
// auth specific data
nsCOMPtr<nsIHttpChannelAuthProvider> mAuthProvider;
// Proxy info to replace with
nsCOMPtr<nsIProxyInfo> mTargetProxyInfo;
// If the channel is associated with a cache, and the URI matched
--- a/netwerk/protocol/res/nsResProtocolHandler.cpp
+++ b/netwerk/protocol/res/nsResProtocolHandler.cpp
@@ -4,17 +4,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/chrome/RegistryMessageUtils.h"
#include "nsResProtocolHandler.h"
#include "nsIURL.h"
#include "nsIIOService.h"
#include "nsIServiceManager.h"
-#include "nsILocalFile.h"
#include "prenv.h"
#include "prmem.h"
#include "prprf.h"
#include "nsXPIDLString.h"
#include "nsIFile.h"
#include "nsDirectoryServiceDefs.h"
#include "nsNetUtil.h"
#include "nsURLHelper.h"
--- a/netwerk/streamconv/converters/nsIndexedToHTML.cpp
+++ b/netwerk/streamconv/converters/nsIndexedToHTML.cpp
@@ -200,19 +200,17 @@ nsIndexedToHTML::DoOnStartRequest(nsIReq
rv = uri->Resolve(NS_LITERAL_CSTRING(".."),parentStr);
if (NS_FAILED(rv)) return rv;
}
} else if (NS_SUCCEEDED(uri->SchemeIs("file", &isSchemeFile)) && isSchemeFile) {
nsCOMPtr<nsIFileURL> fileUrl = do_QueryInterface(uri);
nsCOMPtr<nsIFile> file;
rv = fileUrl->GetFile(getter_AddRefs(file));
if (NS_FAILED(rv)) return rv;
- nsCOMPtr<nsILocalFile> lfile = do_QueryInterface(file, &rv);
- if (NS_FAILED(rv)) return rv;
- lfile->SetFollowLinks(true);
+ file->SetFollowLinks(true);
nsCAutoString url;
rv = net_GetURLSpecFromFile(file, url);
if (NS_FAILED(rv)) return rv;
baseUri.Assign(url);
nsCOMPtr<nsIFile> parent;
rv = file->GetParent(getter_AddRefs(parent));
--- a/netwerk/test/TestBlockingSocket.cpp
+++ b/netwerk/test/TestBlockingSocket.cpp
@@ -5,17 +5,17 @@
#include "TestCommon.h"
#include "nsIComponentRegistrar.h"
#include "nsISocketTransportService.h"
#include "nsISocketTransport.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsCOMPtr.h"
#include "nsStringAPI.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsNetUtil.h"
#include "prlog.h"
#include "prenv.h"
#include "prthread.h"
#include <stdlib.h>
////////////////////////////////////////////////////////////////////////////////
@@ -103,17 +103,17 @@ main(int argc, char* argv[])
{
nsCOMPtr<nsIServiceManager> servMan;
NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull);
#if defined(PR_LOGGING)
gTestLog = PR_NewLogModule("Test");
#endif
- nsCOMPtr<nsILocalFile> file;
+ nsCOMPtr<nsIFile> file;
rv = NS_NewNativeLocalFile(nsDependentCString(fileName), false, getter_AddRefs(file));
if (NS_FAILED(rv)) return rv;
rv = RunBlockingTest(nsDependentCString(hostName), port, file);
#if defined(PR_LOGGING)
if (NS_FAILED(rv))
LOG(("RunBlockingTest failed [rv=%x]\n", rv));
#endif
--- a/netwerk/test/TestCacheBlockFiles.cpp
+++ b/netwerk/test/TestCacheBlockFiles.cpp
@@ -15,17 +15,16 @@
#include "nsCOMPtr.h"
#include "nsCRT.h"
#include "nsDirectoryServiceDefs.h"
#include "nsError.h"
#include "nsIComponentManager.h"
#include "nsIComponentRegistrar.h"
#include "nsIFile.h"
-#include "nsILocalFile.h"
#include "nsIFileStreams.h"
#include "nsMemory.h"
#include "nsIComponentRegistrar.h"
#include "nsANSIFileStreams.h"
#include "nsDiskCacheBlockFile.h"
#include "prclist.h"
@@ -34,17 +33,17 @@
*/
typedef struct Allocation {
PRInt32 start;
PRInt32 count;
} Allocation;
nsresult
-StressTest(nsILocalFile * localFile, PRInt32 testNumber, bool readWrite)
+StressTest(nsIFile * localFile, PRInt32 testNumber, bool readWrite)
{
nsresult rv = NS_OK;
#define ITERATIONS 1024
#define MAX_ALLOCATIONS 256
Allocation block[MAX_ALLOCATIONS];
PRInt32 currentAllocations = 0;
PRInt32 i;
@@ -186,17 +185,17 @@ main(void)
{
// OSErr err;
printf("hello world\n");
unsigned long now = time(0);
srand(now);
nsCOMPtr<nsIFile> file;
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
nsresult rv = NS_OK;
{
// Start up XPCOM
nsCOMPtr<nsIServiceManager> servMan;
NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull);
nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan);
NS_ASSERTION(registrar, "Null nsIComponentRegistrar");
if (registrar)
@@ -222,17 +221,17 @@ main(void)
// Generate name for cache block file
rv = file->Append("_CACHE_001_");
if (NS_FAILED(rv)) goto exit;
// Delete existing file
rv = file->Delete(false);
if (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND) goto exit;
- // Need nsILocalFile to open
+ // Need nsIFile to open
localFile = do_QueryInterface(file, &rv);
if (NS_FAILED(rv)) {
printf("do_QueryInterface(file) failed : 0x%.8x\n", rv);
goto exit;
}
nsDiskCacheBlockFile * blockFile = new nsDiskCacheBlockFile;
if (!blockFile) {
--- a/netwerk/test/TestFileInput2.cpp
+++ b/netwerk/test/TestFileInput2.cpp
@@ -9,17 +9,17 @@
#include "nsIOutputStream.h"
#include "nsIRunnable.h"
#include "nsIThread.h"
#include "nsCOMArray.h"
#include "nsISimpleEnumerator.h"
#include "prinrval.h"
#include "nsIFileStreams.h"
#include "nsIFileChannel.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsNetUtil.h"
#include <stdio.h>
////////////////////////////////////////////////////////////////////////////////
#include <math.h>
#include "prprf.h"
#include "nsAutoLock.h"
@@ -419,21 +419,21 @@ main(int argc, char* argv[])
{
nsCOMPtr<nsIServiceManager> servMan;
NS_InitXPCOM2(getter_AddRefs(servMan), nsnull, nsnull);
nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan);
NS_ASSERTION(registrar, "Null nsIComponentRegistrar");
if (registrar)
registrar->AutoRegister(nsnull);
- nsCOMPtr<nsILocalFile> inDirFile;
+ nsCOMPtr<nsIFile> inDirFile;
rv = NS_NewNativeLocalFile(nsDependentCString(inDir), false, getter_AddRefs(inDirFile));
if (NS_FAILED(rv)) return rv;
- nsCOMPtr<nsILocalFile> outDirFile;
+ nsCOMPtr<nsIFile> outDirFile;
rv = NS_NewNativeLocalFile(nsDependentCString(outDir), false, getter_AddRefs(outDirFile));
if (NS_FAILED(rv)) return rv;
CreateFun create = FileChannelWorker::Create;
Test(create, 1, inDirFile, outDirFile, 16 * 1024);
#if 1
printf("FileChannelWorker *****************************\n");
Test(create, 20, inDirFile, outDirFile, 16 * 1024);
--- a/netwerk/test/TestIncrementalDownload.cpp
+++ b/netwerk/test/TestIncrementalDownload.cpp
@@ -63,17 +63,17 @@ FetchObserver::OnStopRequest(nsIRequest
}
//-----------------------------------------------------------------------------
static nsresult
DoIncrementalFetch(const char *uriSpec, const char *resultPath, PRInt32 chunkSize,
PRInt32 interval)
{
- nsCOMPtr<nsILocalFile> resultFile;
+ nsCOMPtr<nsIFile> resultFile;
nsresult rv = NS_NewNativeLocalFile(nsDependentCString(resultPath),
false, getter_AddRefs(resultFile));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), uriSpec);
if (NS_FAILED(rv))
--- a/netwerk/test/TestSocketTransport.cpp
+++ b/netwerk/test/TestSocketTransport.cpp
@@ -15,17 +15,17 @@
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsCOMPtr.h"
#include "nsMemory.h"
#include "nsStringAPI.h"
#include "nsIDNSService.h"
#include "nsIFileStreams.h"
#include "nsIStreamListener.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsNetUtil.h"
#include "nsAutoLock.h"
#include "prlog.h"
////////////////////////////////////////////////////////////////////////////////
#if defined(PR_LOGGING)
//
--- a/netwerk/test/TestStreamChannel.cpp
+++ b/netwerk/test/TestStreamChannel.cpp
@@ -12,17 +12,17 @@
#include "nsIRequest.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsCOMPtr.h"
#include "nsMemory.h"
#include "nsStringAPI.h"
#include "nsIFileStreams.h"
#include "nsIStreamListener.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsNetUtil.h"
#include "nsAutoLock.h"
#include "prlog.h"
////////////////////////////////////////////////////////////////////////////////
#if defined(PR_LOGGING)
//
@@ -182,17 +182,17 @@ main(int argc, char* argv[])
NS_ASSERTION(registrar, "Null nsIComponentRegistrar");
if (registrar)
registrar->AutoRegister(nsnull);
#if defined(PR_LOGGING)
gTestLog = PR_NewLogModule("Test");
#endif
- nsCOMPtr<nsILocalFile> file;
+ nsCOMPtr<nsIFile> file;
rv = NS_NewNativeLocalFile(nsDependentCString(fileName), false, getter_AddRefs(file));
if (NS_FAILED(rv)) return rv;
rv = RunTest(file);
NS_ASSERTION(NS_SUCCEEDED(rv), "RunTest failed");
// give background threads a chance to finish whatever work they may
// be doing.
--- a/netwerk/test/TestStreamPump.cpp
+++ b/netwerk/test/TestStreamPump.cpp
@@ -13,17 +13,17 @@
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsISeekableStream.h"
#include "nsCOMPtr.h"
#include "nsMemory.h"
#include "nsStringAPI.h"
#include "nsIFileStreams.h"
#include "nsIStreamListener.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsNetUtil.h"
#include "nsAutoLock.h"
#include "prlog.h"
#include "prprf.h"
////////////////////////////////////////////////////////////////////////////////
#if defined(PR_LOGGING)
@@ -153,17 +153,17 @@ main(int argc, char* argv[])
NS_ASSERTION(registrar, "Null nsIComponentRegistrar");
if (registrar)
registrar->AutoRegister(nsnull);
#if defined(PR_LOGGING)
gTestLog = PR_NewLogModule("Test");
#endif
- nsCOMPtr<nsILocalFile> file;
+ nsCOMPtr<nsIFile> file;
rv = NS_NewNativeLocalFile(nsDependentCString(fileName), false, getter_AddRefs(file));
if (NS_FAILED(rv)) return rv;
rv = RunTest(file, offset, length);
NS_ASSERTION(NS_SUCCEEDED(rv), "RunTest failed");
// give background threads a chance to finish whatever work they may
// be doing.
--- a/netwerk/test/TestStreamTransport.cpp
+++ b/netwerk/test/TestStreamTransport.cpp
@@ -12,17 +12,17 @@
#include "nsIRequest.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include "nsCOMPtr.h"
#include "nsMemory.h"
#include "nsStringAPI.h"
#include "nsIFileStreams.h"
#include "nsIStreamListener.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsNetUtil.h"
#include "nsAutoLock.h"
#include "prlog.h"
#include "prenv.h"
////////////////////////////////////////////////////////////////////////////////
#if defined(PR_LOGGING)
@@ -279,17 +279,17 @@ main(int argc, char* argv[])
NS_ASSERTION(registrar, "Null nsIComponentRegistrar");
if (registrar)
registrar->AutoRegister(nsnull);
#if defined(PR_LOGGING)
gTestLog = PR_NewLogModule("Test");
#endif
- nsCOMPtr<nsILocalFile> srcFile;
+ nsCOMPtr<nsIFile> srcFile;
rv = NS_NewNativeLocalFile(nsDependentCString(fileName), false, getter_AddRefs(srcFile));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIFile> destFile;
rv = srcFile->Clone(getter_AddRefs(destFile));
if (NS_FAILED(rv)) return rv;
nsCAutoString leafName;
--- a/netwerk/test/httpserver/nsIHttpServer.idl
+++ b/netwerk/test/httpserver/nsIHttpServer.idl
@@ -1,16 +1,16 @@
/* 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 "nsISupports.idl"
interface nsIInputStream;
-interface nsILocalFile;
+interface nsIFile;
interface nsIOutputStream;
interface nsISimpleEnumerator;
interface nsIHttpServer;
interface nsIHttpServerStoppedCallback;
interface nsIHttpRequestHandler;
interface nsIHttpRequest;
interface nsIHttpResponse;
@@ -61,17 +61,17 @@ interface nsIHttpServer : nsISupports
*
* @param path
* the path which is to be mapped to the given file; must begin with "/" and
* be a valid URI path (i.e., no query string, hash reference, etc.)
* @param file
* the file to serve for the given path, or null to remove any mapping that
* might exist; this file must exist for the lifetime of the server
*/
- void registerFile(in string path, in nsILocalFile file);
+ void registerFile(in string path, in nsIFile file);
/**
* Registers a custom path handler.
*
* @param path
* the path on the server (beginning with a "/") which is to be handled by
* handler; this path must not include a query string or hash component; it
* also should usually be canonicalized, since most browsers will do so
@@ -135,17 +135,17 @@ interface nsIHttpServer : nsISupports
* the directory to be used to serve all requests for paths underneath path
* (except those further overridden by another, deeper path registered with
* another directory); if null, any current mapping for the given path is
* removed
* @throws NS_ERROR_INVALID_ARG
* if dir is non-null and does not exist or is not a directory, or if path
* does not begin with and end with a forward slash
*/
- void registerDirectory(in string path, in nsILocalFile dir);
+ void registerDirectory(in string path, in nsIFile dir);
/**
* Associates files with the given extension with the given Content-Type when
* served by this server, in the absence of any file-specific information
* about the desired Content-Type. If type is empty, removes any extant
* mapping, if one is present.
*
* @throws NS_ERROR_INVALID_ARG
--- a/parser/htmlparser/src/nsScanner.cpp
+++ b/parser/htmlparser/src/nsScanner.cpp
@@ -8,17 +8,17 @@
#include "nsScanner.h"
#include "nsDebug.h"
#include "nsIServiceManager.h"
#include "nsICharsetConverterManager.h"
#include "nsCharsetAlias.h"
#include "nsReadableUtils.h"
#include "nsIInputStream.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsNetUtil.h"
#include "nsUTF8Utils.h" // for LossyConvertEncoding
#include "nsCRT.h"
#include "nsParser.h"
#include "nsCharsetSource.h"
// We replace NUL characters with this character.
static PRUnichar sInvalid = UCS2_REPLACEMENT_CHAR;
--- a/profile/dirserviceprovider/public/nsProfileDirServiceProvider.h
+++ b/profile/dirserviceprovider/public/nsProfileDirServiceProvider.h
@@ -1,16 +1,16 @@
/* -*- 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/. */
// Interfaces Needed
#include "nsIDirectoryService.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsCOMPtr.h"
#include "nsDirectoryServiceUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsServiceManagerUtils.h"
#ifdef MOZILLA_INTERNAL_API
#include "nsString.h"
--- a/profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp
+++ b/profile/dirserviceprovider/src/nsProfileDirServiceProvider.cpp
@@ -1,17 +1,17 @@
/* -*- Mode: C++; tab-width: 2; 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 "nsProfileDirServiceProvider.h"
#include "nsProfileStringTypes.h"
#include "nsProfileLock.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsDirectoryServiceDefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsISupportsUtils.h"
#include "nsISimpleEnumerator.h"
#include "nsIObserverService.h"
// File Name Defines
@@ -76,21 +76,21 @@ nsProfileDirServiceProvider::SetProfileD
// Make sure that the local profile dir exists
// we just try to create it - if it exists already, that'll fail; ignore
// errors
mLocalProfileDir->Create(nsIFile::DIRECTORY_TYPE, 0700);
#ifdef MOZ_PROFILELOCKING
// Lock the non-shared sub-dir if we are sharing,
// the whole profile dir if we are not.
- nsCOMPtr<nsILocalFile> dirToLock;
+ nsCOMPtr<nsIFile> dirToLock;
if (mSharingEnabled)
- dirToLock = do_QueryInterface(mNonSharedProfileDir);
+ dirToLock = mNonSharedProfileDir;
else
- dirToLock = do_QueryInterface(mProfileDir);
+ dirToLock = mProfileDir;
rv = mProfileDirLock->Lock(dirToLock, nsnull);
if (NS_FAILED(rv))
return rv;
#endif
if (mNotifyObservers) {
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1");
--- a/profile/dirserviceprovider/src/nsProfileLock.cpp
+++ b/profile/dirserviceprovider/src/nsProfileLock.cpp
@@ -190,17 +190,17 @@ void nsProfileLock::FatalSignalHandler(i
oldact->sa_handler(signo);
}
}
// Backstop exit call, just in case.
_exit(signo);
}
-nsresult nsProfileLock::LockWithFcntl(nsILocalFile *aLockFile)
+nsresult nsProfileLock::LockWithFcntl(nsIFile *aLockFile)
{
nsresult rv = NS_OK;
nsCAutoString lockFilePath;
rv = aLockFile->GetNativePath(lockFilePath);
if (NS_FAILED(rv)) {
NS_ERROR("Could not get native path");
return rv;
@@ -300,17 +300,17 @@ static bool IsSymlinkStaleLock(struct in
}
}
}
}
}
return true;
}
-nsresult nsProfileLock::LockWithSymlink(nsILocalFile *aLockFile, bool aHaveFcntlLock)
+nsresult nsProfileLock::LockWithSymlink(nsIFile *aLockFile, bool aHaveFcntlLock)
{
nsresult rv;
nsCAutoString lockFilePath;
rv = aLockFile->GetNativePath(lockFilePath);
if (NS_FAILED(rv)) {
NS_ERROR("Could not get native path");
return rv;
}
@@ -426,17 +426,17 @@ PR_BEGIN_MACRO
}
#endif /* XP_UNIX */
nsresult nsProfileLock::GetReplacedLockTime(PRInt64 *aResult) {
*aResult = mReplacedLockTime;
return NS_OK;
}
-nsresult nsProfileLock::Lock(nsILocalFile* aProfileDir,
+nsresult nsProfileLock::Lock(nsIFile* aProfileDir,
nsIProfileUnlocker* *aUnlocker)
{
#if defined (XP_MACOSX)
NS_NAMED_LITERAL_STRING(LOCKFILE_NAME, ".parentlock");
NS_NAMED_LITERAL_STRING(OLD_LOCKFILE_NAME, "parent.lock");
#elif defined (XP_UNIX)
NS_NAMED_LITERAL_STRING(OLD_LOCKFILE_NAME, "lock");
NS_NAMED_LITERAL_STRING(LOCKFILE_NAME, ".parentlock");
@@ -452,18 +452,18 @@ nsresult nsProfileLock::Lock(nsILocalFil
bool isDir;
rv = aProfileDir->IsDirectory(&isDir);
if (NS_FAILED(rv))
return rv;
if (!isDir)
return NS_ERROR_FILE_NOT_DIRECTORY;
- nsCOMPtr<nsILocalFile> lockFile;
- rv = aProfileDir->Clone((nsIFile **)((void **)getter_AddRefs(lockFile)));
+ nsCOMPtr<nsIFile> lockFile;
+ rv = aProfileDir->Clone(getter_AddRefs(lockFile));
if (NS_FAILED(rv))
return rv;
rv = lockFile->Append(LOCKFILE_NAME);
if (NS_FAILED(rv))
return rv;
#if defined(XP_MACOSX)
@@ -523,18 +523,18 @@ nsresult nsProfileLock::Lock(nsILocalFil
{
NS_WARNING("Could not read lock file - ignoring lock");
}
}
rv = NS_OK; // Don't propagate error from OpenNSPRFileDesc.
}
#elif defined(XP_UNIX)
// Get the old lockfile name
- nsCOMPtr<nsILocalFile> oldLockFile;
- rv = aProfileDir->Clone((nsIFile **)((void **)getter_AddRefs(oldLockFile)));
+ nsCOMPtr<nsIFile> oldLockFile;
+ rv = aProfileDir->Clone(getter_AddRefs(oldLockFile));
if (NS_FAILED(rv))
return rv;
rv = oldLockFile->Append(OLD_LOCKFILE_NAME);
if (NS_FAILED(rv))
return rv;
// First, try locking using fcntl. It is more reliable on
// a local machine, but may not be supported by an NFS server.
--- a/profile/dirserviceprovider/src/nsProfileLock.h
+++ b/profile/dirserviceprovider/src/nsProfileLock.h
@@ -1,17 +1,17 @@
/* -*- 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/. */
#ifndef __nsProfileLock_h___
#define __nsProfileLock_h___
-#include "nsILocalFile.h"
+#include "nsIFile.h"
class nsIProfileUnlocker;
#if defined (XP_WIN)
#include <windows.h>
#endif
#if defined (XP_OS2)
@@ -42,17 +42,17 @@ public:
* Attempt to lock a profile directory.
*
* @param aProfileDir [in] The profile directory to lock.
* @param aUnlocker [out] Optional. This is only returned when locking
* fails with NS_ERROR_FILE_ACCESS_DENIED, and may not
* be returned at all.
* @throws NS_ERROR_FILE_ACCESS_DENIED if the profile is locked.
*/
- nsresult Lock(nsILocalFile* aProfileDir, nsIProfileUnlocker* *aUnlocker);
+ nsresult Lock(nsIFile* aProfileDir, nsIProfileUnlocker* *aUnlocker);
/**
* Unlock a profile directory. If you're unlocking the directory because
* the application is in the process of shutting down because of a fatal
* signal, set aFatalSignal to true.
*/
nsresult Unlock(bool aFatalSignal = false);
@@ -81,23 +81,23 @@ private:
static void RemovePidLockFiles(bool aFatalSignal);
static void FatalSignalHandler(int signo
#ifdef SA_SIGINFO
, siginfo_t *info, void *context
#endif
);
static PRCList mPidLockList;
- nsresult LockWithFcntl(nsILocalFile *aLockFile);
+ nsresult LockWithFcntl(nsIFile *aLockFile);
/**
* @param aHaveFcntlLock if true, we've already acquired an fcntl lock so this
* lock is merely an "obsolete" lock to keep out old Firefoxes
*/
- nsresult LockWithSymlink(nsILocalFile *aLockFile, bool aHaveFcntlLock);
+ nsresult LockWithSymlink(nsIFile *aLockFile, bool aHaveFcntlLock);
char* mPidLockFileName;
int mLockFileDesc;
#endif
};
#endif /* __nsProfileLock_h___ */
--- a/rdf/datasource/src/nsFileSystemDataSource.cpp
+++ b/rdf/datasource/src/nsFileSystemDataSource.cpp
@@ -977,19 +977,17 @@ FileSystemDataSource::GetFolderList(nsIR
if (!fileURL)
return(false);
nsCOMPtr<nsIFile> aDir;
if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aDir))))
return(rv);
// ensure that we DO NOT resolve aliases
- nsCOMPtr<nsILocalFile> aDirLocal = do_QueryInterface(aDir);
- if (aDirLocal)
- aDirLocal->SetFollowLinks(false);
+ aDir->SetFollowLinks(false);
nsCOMPtr<nsISimpleEnumerator> dirContents;
if (NS_FAILED(rv = aDir->GetDirectoryEntries(getter_AddRefs(dirContents))))
return(rv);
if (!dirContents)
return(NS_ERROR_UNEXPECTED);
bool hasMore;
@@ -1089,19 +1087,17 @@ FileSystemDataSource::GetLastMod(nsIRDFR
nsCOMPtr<nsIFile> aFile;
if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile))))
return(rv);
if (!aFile)
return(NS_ERROR_UNEXPECTED);
// ensure that we DO NOT resolve aliases
- nsCOMPtr<nsILocalFile> aFileLocal = do_QueryInterface(aFile);
- if (aFileLocal)
- aFileLocal->SetFollowLinks(false);
+ aFile->SetFollowLinks(false);
PRInt64 lastModDate;
if (NS_FAILED(rv = aFile->GetLastModifiedTime(&lastModDate)))
return(rv);
// convert from milliseconds to seconds
PRTime temp64, thousand;
LL_I2L(thousand, PR_MSEC_PER_SEC);
@@ -1138,19 +1134,17 @@ FileSystemDataSource::GetFileSize(nsIRDF
nsCOMPtr<nsIFile> aFile;
if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile))))
return(rv);
if (!aFile)
return(NS_ERROR_UNEXPECTED);
// ensure that we DO NOT resolve aliases
- nsCOMPtr<nsILocalFile> aFileLocal = do_QueryInterface(aFile);
- if (aFileLocal)
- aFileLocal->SetFollowLinks(false);
+ aFile->SetFollowLinks(false);
// don't do anything with directories
bool isDir = false;
if (NS_FAILED(rv = aFile->IsDirectory(&isDir)))
return(rv);
if (isDir)
return(NS_RDF_NO_VALUE);
@@ -1191,19 +1185,17 @@ FileSystemDataSource::GetName(nsIRDFReso
nsCOMPtr<nsIFile> aFile;
if (NS_FAILED(rv = fileURL->GetFile(getter_AddRefs(aFile))))
return(rv);
if (!aFile)
return(NS_ERROR_UNEXPECTED);
// ensure that we DO NOT resolve aliases
- nsCOMPtr<nsILocalFile> aFileLocal = do_QueryInterface(aFile);
- if (aFileLocal)
- aFileLocal->SetFollowLinks(false);
+ aFile->SetFollowLinks(false);
nsAutoString name;
if (NS_FAILED(rv = aFile->GetLeafName(name)))
return(rv);
if (name.IsEmpty())
return(NS_ERROR_UNEXPECTED);
#ifdef XP_WIN
--- a/security/manager/ssl/public/nsIX509CertDB.idl
+++ b/security/manager/ssl/public/nsIX509CertDB.idl
@@ -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 "nsISupports.idl"
interface nsIArray;
interface nsIX509Cert;
-interface nsILocalFile;
+interface nsIFile;
interface nsIInterfaceRequestor;
%{C++
#define NS_X509CERTDB_CONTRACTID "@mozilla.org/security/x509certdb;1"
%}
/**
* This represents a service to access and manipulate
@@ -204,44 +204,44 @@ interface nsIX509CertDB : nsISupports {
* this function to a token device.
* Can be null to mean any token.
* @param aFile Identifies a file that contains the certificate
* to be imported.
* @param aType Describes the type of certificate that is going to
* be imported. See type constants in nsIX509Cert.
*/
void importCertsFromFile(in nsISupports aToken,
- in nsILocalFile aFile,
+ in nsIFile aFile,
in unsigned long aType);
/**
* Import a PKCS#12 file containing cert(s) and key(s) into the database.
*
* @param aToken Optionally limits the scope of
* this function to a token device.
* Can be null to mean any token.
* @param aFile Identifies a file that contains the data
* to be imported.
*/
void importPKCS12File(in nsISupports aToken,
- in nsILocalFile aFile);
+ in nsIFile aFile);
/**
* Export a set of certs and keys from the database to a PKCS#12 file.
*
* @param aToken Optionally limits the scope of
* this function to a token device.
* Can be null to mean any token.
* @param aFile Identifies a file that will be filled with the data
* to be exported.
* @param count The number of certificates to be exported.
* @param aCerts The array of all certificates to be exported.
*/
void exportPKCS12File(in nsISupports aToken,
- in nsILocalFile aFile,
+ in nsIFile aFile,
in unsigned long count,
[array, size_is(count)] in nsIX509Cert aCerts);
/**
* An array of all known OCSP responders within the scope of the
* certificate database.
*
* @return Array of OCSP responders, entries are QIable to nsIOCSPResponder.
--- a/security/manager/ssl/src/nsCrypto.cpp
+++ b/security/manager/ssl/src/nsCrypto.cpp
@@ -2154,17 +2154,17 @@ nsP12Runnable::Run()
filePicker->AppendFilters(nsIFilePicker::filterAll);
PRInt16 dialogReturn;
filePicker->Show(&dialogReturn);
if (dialogReturn == nsIFilePicker::returnCancel)
return NS_OK; //User canceled. It'd be nice if they couldn't,
//but oh well.
- nsCOMPtr<nsILocalFile> localFile;
+ nsCOMPtr<nsIFile> localFile;
rv = filePicker->GetFile(getter_AddRefs(localFile));
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
nsPKCS12Blob p12Cxt;
p12Cxt.SetToken(mToken);
p12Cxt.ExportToFile(localFile, mCertArr, mNumCerts);
--- a/security/manager/ssl/src/nsNSSCertificateDB.cpp
+++ b/security/manager/ssl/src/nsNSSCertificateDB.cpp
@@ -7,17 +7,17 @@
#include "nsCOMPtr.h"
#include "nsNSSCertificate.h"
#include "nsNSSHelper.h"
#include "nsNSSCertHelper.h"
#include "nsNSSCertCache.h"
#include "nsCRT.h"
#include "nsICertificateDialogs.h"
#include "nsNSSCertTrust.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsPKCS12Blob.h"
#include "nsPK11TokenDB.h"
#include "nsOCSPResponder.h"
#include "nsReadableUtils.h"
#include "nsIMutableArray.h"
#include "nsArrayUtils.h"
#include "nsNSSShutDown.h"
#include "nsIPrefService.h"
@@ -1098,17 +1098,17 @@ nsNSSCertificateDB::IsCertTrusted(nsIX50
}
} /* user: ignore */
return NS_OK;
}
NS_IMETHODIMP
nsNSSCertificateDB::ImportCertsFromFile(nsISupports *aToken,
- nsILocalFile *aFile,
+ nsIFile *aFile,
PRUint32 aType)
{
NS_ENSURE_ARG(aFile);
switch (aType) {
case nsIX509Cert::CA_CERT:
case nsIX509Cert::EMAIL_CERT:
case nsIX509Cert::SERVER_CERT:
// good
@@ -1165,30 +1165,30 @@ nsNSSCertificateDB::ImportCertsFromFile(
}
delete [] buf;
return rv;
}
NS_IMETHODIMP
nsNSSCertificateDB::ImportPKCS12File(nsISupports *aToken,
- nsILocalFile *aFile)
+ nsIFile *aFile)
{
NS_ENSURE_ARG(aFile);
nsPKCS12Blob blob;
nsCOMPtr<nsIPK11Token> token = do_QueryInterface(aToken);
if (token) {
blob.SetToken(token);
}
return blob.ImportFromFile(aFile);
}
NS_IMETHODIMP
nsNSSCertificateDB::ExportPKCS12File(nsISupports *aToken,
- nsILocalFile *aFile,
+ nsIFile *aFile,
PRUint32 count,
nsIX509Cert **certs)
//const PRUnichar **aCertNames)
{
nsNSSShutDownPreventionLock locker;
NS_ENSURE_ARG(aFile);
nsPKCS12Blob blob;
if (count == 0) return NS_OK;
--- a/security/manager/ssl/src/nsNSSComponent.cpp
+++ b/security/manager/ssl/src/nsNSSComponent.cpp
@@ -45,17 +45,17 @@
#include "nsIPrompt.h"
#include "nsIPrincipal.h"
#include "nsReadableUtils.h"
#include "nsIDateTimeFormat.h"
#include "prtypes.h"
#include "nsIEntropyCollector.h"
#include "nsIBufEntropyCollector.h"
#include "nsIServiceManager.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsITokenPasswordDialogs.h"
#include "nsICRLManager.h"
#include "nsNSSShutDown.h"
#include "nsSmartCardEvent.h"
#include "nsIKeyModule.h"
#include "nss.h"
#include "pk11func.h"
@@ -796,47 +796,47 @@ nsNSSComponent::InstallLoadableRoots()
NS_XPCOM_CURRENT_PROCESS_DIR,
NS_GRE_DIR,
0 // This special value means:
// search for ckbi in the directories on the shared
// library/DLL search path
};
for (size_t il = 0; il < sizeof(possible_ckbi_locations)/sizeof(const char*); ++il) {
- nsCOMPtr<nsILocalFile> mozFile;
+ nsCOMPtr<nsIFile> mozFile;
char *fullLibraryPath = nsnull;
if (!possible_ckbi_locations[il])
{
fullLibraryPath = PR_GetLibraryName(nsnull, "nssckbi");
}
else
{
if (possible_ckbi_locations[il] == nss_lib) {
// Get the location of the nss3 library.
char *nss_path = PR_GetLibraryFilePathname(DLL_PREFIX "nss3" DLL_SUFFIX,
(PRFuncPtr) NSS_Initialize);
if (!nss_path) {
continue;
}
// Get the directory containing the nss3 library.
- nsCOMPtr<nsILocalFile> nssLib(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
+ nsCOMPtr<nsIFile> nssLib(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
if (NS_SUCCEEDED(rv)) {
rv = nssLib->InitWithNativePath(nsDependentCString(nss_path));
}
PR_Free(nss_path);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIFile> file;
if (NS_SUCCEEDED(nssLib->GetParent(getter_AddRefs(file)))) {
mozFile = do_QueryInterface(file);
}
}
} else {
directoryService->Get( possible_ckbi_locations[il],
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(mozFile));
}
if (!mozFile) {
continue;
}
nsCAutoString processDir;
--- a/security/manager/ssl/src/nsPKCS12Blob.cpp
+++ b/security/manager/ssl/src/nsPKCS12Blob.cpp
@@ -4,17 +4,16 @@
/* $Id: nsPKCS12Blob.cpp,v 1.49 2007/09/05 07:13:46 jwalden%mit.edu Exp $ */
#include "prmem.h"
#include "prprf.h"
#include "nsISupportsArray.h"
#include "nsIFile.h"
#include "nsNetUtil.h"
-#include "nsILocalFile.h"
#include "nsIDirectoryService.h"
#include "nsThreadUtils.h"
#include "nsNSSComponent.h"
#include "nsNSSHelper.h"
#include "nsPKCS12Blob.h"
#include "nsString.h"
#include "nsReadableUtils.h"
@@ -91,17 +90,17 @@ nsPKCS12Blob::SetToken(nsIPK11Token *tok
return rv;
}
// nsPKCS12Blob::ImportFromFile
//
// Given a file handle, read a PKCS#12 blob from that file, decode it,
// and import the results into the token.
nsresult
-nsPKCS12Blob::ImportFromFile(nsILocalFile *file)
+nsPKCS12Blob::ImportFromFile(nsIFile *file)
{
nsNSSShutDownPreventionLock locker;
nsresult rv = NS_OK;
if (!mToken) {
if (!mTokenSet) {
rv = SetToken(NULL); // Ask the user to pick a slot
if (NS_FAILED(rv)) {
@@ -131,17 +130,17 @@ nsPKCS12Blob::ImportFromFile(nsILocalFil
}
}
while (NS_SUCCEEDED(rv) && (wantRetry != rr_do_not_retry));
return rv;
}
nsresult
-nsPKCS12Blob::ImportFromFileHelper(nsILocalFile *file,
+nsPKCS12Blob::ImportFromFileHelper(nsIFile *file,
nsPKCS12Blob::ImportMode aImportMode,
nsPKCS12Blob::RetryReason &aWantRetry)
{
nsNSSShutDownPreventionLock locker;
nsresult rv;
SECStatus srv = SECSuccess;
SEC_PKCS12DecoderContext *dcx = NULL;
SECItem unicodePw;
@@ -304,28 +303,28 @@ isExtractable(SECKEYPrivateKey *privKey)
// also), encode the blob, and stuff it into the file.
//
// TODO: handle slots correctly
// mirror "slotToUse" behavior from PSM 1.x
// verify the cert array to start off with?
// open output file as nsIFileStream object?
// set appropriate error codes
nsresult
-nsPKCS12Blob::ExportToFile(nsILocalFile *file,
+nsPKCS12Blob::ExportToFile(nsIFile *file,
nsIX509Cert **certs, int numCerts)
{
nsNSSShutDownPreventionLock locker;
nsresult rv;
SECStatus srv = SECSuccess;
SEC_PKCS12ExportContext *ecx = NULL;
SEC_PKCS12SafeInfo *certSafe = NULL, *keySafe = NULL;
SECItem unicodePw;
nsAutoString filePath;
int i;
- nsCOMPtr<nsILocalFile> localFileRef;
+ nsCOMPtr<nsIFile> localFileRef;
NS_ASSERTION(mToken, "Need to set the token before exporting");
// init slot
bool InformedUserNoSmartcardBackup = false;
int numCertsExported = 0;
rv = mToken->Login(true);
if (NS_FAILED(rv)) goto finish;
@@ -418,21 +417,21 @@ nsPKCS12Blob::ExportToFile(nsILocalFile
}
if (!numCertsExported) goto finish;
// prepare the instance to write to an export file
this->mTmpFile = NULL;
file->GetPath(filePath);
// Use the nsCOMPtr var localFileRef so that
- // the reference to the nsILocalFile we create gets released as soon as
+ // the reference to the nsIFile we create gets released as soon as
// we're out of scope, ie when this function exits.
if (filePath.RFind(".p12", true, -1, 4) < 0) {
// We're going to add the .p12 extension to the file name just like
- // Communicator used to. We create a new nsILocalFile and initialize
+ // Communicator used to. We create a new nsIFile and initialize
// it with the new patch.
filePath.AppendLiteral(".p12");
localFileRef = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
if (NS_FAILED(rv)) goto finish;
localFileRef->InitWithPath(filePath);
file = localFileRef;
}
rv = file->OpenNSPRFileDesc(PR_RDWR|PR_CREATE_FILE|PR_TRUNCATE, 0664,
@@ -541,17 +540,17 @@ nsPKCS12Blob::getPKCS12FilePassword(SECI
unicodeToItem(password.get(), unicodePw);
return NS_OK;
}
// inputToDecoder
//
// Given a decoder, read bytes from file and input them to the decoder.
nsresult
-nsPKCS12Blob::inputToDecoder(SEC_PKCS12DecoderContext *dcx, nsILocalFile *file)
+nsPKCS12Blob::inputToDecoder(SEC_PKCS12DecoderContext *dcx, nsIFile *file)
{
nsNSSShutDownPreventionLock locker;
nsresult rv;
SECStatus srv;
PRUint32 amount;
char buf[PIP_PKCS12_BUFFER_SIZE];
nsCOMPtr<nsIInputStream> fileStream;
--- a/security/manager/ssl/src/nsPKCS12Blob.h
+++ b/security/manager/ssl/src/nsPKCS12Blob.h
@@ -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/. */
/* $Id: nsPKCS12Blob.h,v 1.16 2006/04/12 15:43:32 benjamin%smedbergs.us Exp $ */
#ifndef _NS_PKCS12BLOB_H_
#define _NS_PKCS12BLOB_H_
#include "nsCOMPtr.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIPK11TokenDB.h"
#include "nsNSSHelper.h"
#include "nsIPK11Token.h"
#include "nsIMutableArray.h"
#include "nss.h"
extern "C" {
@@ -32,35 +32,35 @@ class nsPKCS12Blob
public:
nsPKCS12Blob();
virtual ~nsPKCS12Blob();
// Set the token to use (default is internal)
nsresult SetToken(nsIPK11Token *token);
// PKCS#12 Import
- nsresult ImportFromFile(nsILocalFile *file);
+ nsresult ImportFromFile(nsIFile *file);
// PKCS#12 Export
#if 0
//nsresult LoadCerts(const PRUnichar **certNames, int numCerts);
nsresult LoadCerts(nsIX509Cert **certs, int numCerts);
#endif
- nsresult ExportToFile(nsILocalFile *file, nsIX509Cert **certs, int numCerts);
+ nsresult ExportToFile(nsIFile *file, nsIX509Cert **certs, int numCerts);
private:
nsCOMPtr<nsIPK11Token> mToken;
nsCOMPtr<nsIMutableArray> mCertArray;
nsCOMPtr<nsIInterfaceRequestor> mUIContext;
// local helper functions
nsresult getPKCS12FilePassword(SECItem *);
nsresult newPKCS12FilePassword(SECItem *);
- nsresult inputToDecoder(SEC_PKCS12DecoderContext *, nsILocalFile *);
+ nsresult inputToDecoder(SEC_PKCS12DecoderContext *, nsIFile *);
void unicodeToItem(const PRUnichar *, SECItem *);
void handleError(int myerr = 0);
// RetryReason and ImportMode are used when importing a PKCS12 file.
// There are two reasons that cause us to retry:
// - When the password entered by the user is incorrect.
// The user will be prompted to try again.
// - When the user entered a zero length password.
@@ -69,17 +69,17 @@ private:
// NULL UTF16 character), but some applications use a
// zero length SECItem.
// We try both variations, zero length item and empty string,
// without giving a user prompt when trying the different empty password flavors.
enum RetryReason { rr_do_not_retry, rr_bad_password, rr_auto_retry_empty_password_flavors };
enum ImportMode { im_standard_prompt, im_try_zero_length_secitem };
- nsresult ImportFromFileHelper(nsILocalFile *file, ImportMode aImportMode, RetryReason &aWantRetry);
+ nsresult ImportFromFileHelper(nsIFile *file, ImportMode aImportMode, RetryReason &aWantRetry);
// NSPR file I/O for export file
PRFileDesc *mTmpFile;
char *mTmpFilePath;
// simulated file I/O for "in memory" temporary digest data
nsCString *mDigest;
nsCString::const_iterator *mDigestIterator;
--- a/startupcache/StartupCache.cpp
+++ b/startupcache/StartupCache.cpp
@@ -10,17 +10,16 @@
#include "mozilla/scache/StartupCache.h"
#include "nsAutoPtr.h"
#include "nsClassHashtable.h"
#include "nsComponentManagerUtils.h"
#include "nsDirectoryServiceUtils.h"
#include "nsIClassInfo.h"
#include "nsIFile.h"
-#include "nsILocalFile.h"
#include "nsIMemoryReporter.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsIOutputStream.h"
#include "nsIStartupCache.h"
#include "nsIStorageStream.h"
#include "nsIStreamBufferAccess.h"
#include "nsIStringStream.h"
--- a/startupcache/StartupCache.h
+++ b/startupcache/StartupCache.h
@@ -151,17 +151,17 @@ private:
static size_t SizeOfEntryExcludingThis(const nsACString& key,
const nsAutoPtr<CacheEntry>& data,
nsMallocSizeOfFun mallocSizeOf,
void *);
nsClassHashtable<nsCStringHashKey, CacheEntry> mTable;
nsRefPtr<nsZipArchive> mArchive;
- nsCOMPtr<nsILocalFile> mFile;
+ nsCOMPtr<nsIFile> mFile;
nsCOMPtr<nsIObserverService> mObserverService;
nsRefPtr<StartupCacheListener> mListener;
nsCOMPtr<nsITimer> mTimer;
bool mStartupWriteInitiated;
static StartupCache *gStartupCache;
--- a/storage/src/FileSystemModule.cpp
+++ b/storage/src/FileSystemModule.cpp
@@ -5,17 +5,16 @@
* 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 "nsIFile.h"
-#include "nsILocalFile.h"
namespace {
struct VirtualTableCursorBase
{
VirtualTableCursorBase()
{
memset(&mBase, 0, sizeof(mBase));
@@ -58,17 +57,17 @@ private:
nsString mCurrentFileName;
PRInt64 mRowId;
};
nsresult
VirtualTableCursor::Init(const nsAString& aPath)
{
- nsCOMPtr<nsILocalFile> directory =
+ nsCOMPtr<nsIFile> directory =
do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
NS_ENSURE_TRUE(directory, NS_ERROR_FAILURE);
nsresult rv = directory->InitWithPath(aPath);
NS_ENSURE_SUCCESS(rv, rv);
rv = directory->GetPath(mDirectoryPath);
NS_ENSURE_SUCCESS(rv, rv);
--- a/storage/src/mozStorageConnection.cpp
+++ b/storage/src/mozStorageConnection.cpp
@@ -6,17 +6,17 @@
#include <stdio.h>
#include "nsError.h"
#include "nsIMutableArray.h"
#include "nsAutoPtr.h"
#include "nsIMemoryReporter.h"
#include "nsThreadUtils.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "mozilla/Telemetry.h"
#include "mozilla/Mutex.h"
#include "mozilla/CondVar.h"
#include "mozIStorageAggregateFunction.h"
#include "mozIStorageCompletionCallback.h"
#include "mozIStorageFunction.h"
@@ -1489,20 +1489,18 @@ Connection::RemoveProgressHandler(mozISt
NS_IMETHODIMP
Connection::SetGrowthIncrement(PRInt32 aChunkSize, const nsACString &aDatabaseName)
{
// Bug 597215: Disk space is extremely limited on Android
// so don't preallocate space. This is also not effective
// on log structured file systems used by Android devices
#if !defined(ANDROID) && !defined(MOZ_PLATFORM_MAEMO)
// Don't preallocate if less than 500MiB is available.
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(mDatabaseFile);
- NS_ENSURE_STATE(localFile);
PRInt64 bytesAvailable;
- nsresult rv = localFile->GetDiskSpaceAvailable(&bytesAvailable);
+ nsresult rv = mDatabaseFile->GetDiskSpaceAvailable(&bytesAvailable);
NS_ENSURE_SUCCESS(rv, rv);
if (bytesAvailable < MIN_AVAILABLE_BYTES_PER_CHUNKED_GROWTH) {
return NS_ERROR_FILE_TOO_BIG;
}
(void)::sqlite3_file_control(mDBConn,
aDatabaseName.Length() ? nsPromiseFlatCString(aDatabaseName).get() : NULL,
SQLITE_FCNTL_CHUNK_SIZE,
--- a/storage/test/test_file_perms.cpp
+++ b/storage/test/test_file_perms.cpp
@@ -1,34 +1,31 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=2 et lcs=trail\:.,tab\:>~ :
* 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 "storage_test_harness.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
/**
* This file tests that the file permissions of the sqlite files match what
* we request they be
*/
void
test_file_perms()
{
nsCOMPtr<mozIStorageConnection> db(getDatabase());
nsCOMPtr<nsIFile> dbFile;
do_check_success(db->GetDatabaseFile(getter_AddRefs(dbFile)));
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(dbFile);
- do_check_true(localFile);
-
PRUint32 perms = 0;
- do_check_success(localFile->GetPermissions(&perms));
+ do_check_success(dbFile->GetPermissions(&perms));
// This reflexts the permissions defined by SQLITE_DEFAULT_FILE_PERMISSIONS in
// db/sqlite3/src/Makefile.in and must be kept in sync with that
#ifdef ANDROID
do_check_true(perms == (PR_IRUSR | PR_IWUSR));
#elif defined(XP_WIN)
do_check_true(perms == (PR_IRUSR | PR_IWUSR | PR_IRGRP | PR_IWGRP | PR_IROTH | PR_IWOTH));
#else
--- a/toolkit/components/commandlines/nsCommandLine.cpp
+++ b/toolkit/components/commandlines/nsCommandLine.cpp
@@ -59,17 +59,17 @@ protected:
typedef nsresult (*EnumerateHandlersCallback)(nsICommandLineHandler* aHandler,
nsICommandLine* aThis,
void *aClosure);
typedef nsresult (*EnumerateValidatorsCallback)(nsICommandLineValidator* aValidator,
nsICommandLine* aThis,
void *aClosure);
void appendArg(const char* arg);
- void resolveShortcutURL(nsILocalFile* aFile, nsACString& outURL);
+ void resolveShortcutURL(nsIFile* aFile, nsACString& outURL);
nsresult EnumerateHandlers(EnumerateHandlersCallback aCallback, void *aClosure);
nsresult EnumerateValidators(EnumerateValidatorsCallback aCallback, void *aClosure);
nsTArray<nsString> mArgs;
PRUint32 mState;
nsCOMPtr<nsIFile> mWorkingDir;
nsCOMPtr<nsIDOMWindow> mWindowContext;
bool mPreventDefault;
@@ -240,17 +240,17 @@ nsCommandLine::SetWindowContext(nsIDOMWi
return NS_OK;
}
NS_IMETHODIMP
nsCommandLine::ResolveFile(const nsAString& aArgument, nsIFile* *aResult)
{
NS_ENSURE_TRUE(mWorkingDir, NS_ERROR_NOT_INITIALIZED);
- // This is some seriously screwed-up code. nsILocalFile.appendRelativeNativePath
+ // This is some seriously screwed-up code. nsIFile.appendRelativeNativePath
// explicitly does not accept .. or . path parts, but that is exactly what we
// need here. So we hack around it.
nsresult rv;
#if defined(MOZ_WIDGET_COCOA)
nsCOMPtr<nsILocalFileMac> lfm (do_QueryInterface(mWorkingDir));
NS_ENSURE_TRUE(lfm, NS_ERROR_NO_INTERFACE);
@@ -275,17 +275,17 @@ nsCommandLine::ResolveFile(const nsAStri
rv = newfile->InitWithCFURL(newurl);
CFRelease(newurl);
if (NS_FAILED(rv)) return rv;
NS_ADDREF(*aResult = newfile);
return NS_OK;
#elif defined(XP_UNIX)
- nsCOMPtr<nsILocalFile> lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
+ nsCOMPtr<nsIFile> lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
NS_ENSURE_TRUE(lf, NS_ERROR_OUT_OF_MEMORY);
if (aArgument.First() == '/') {
// absolute path
rv = lf->InitWithPath(aArgument);
if (NS_FAILED(rv)) return rv;
NS_ADDREF(*aResult = lf);
@@ -306,17 +306,17 @@ nsCommandLine::ResolveFile(const nsAStri
rv = lf->Normalize();
if (NS_FAILED(rv)) return rv;
NS_ADDREF(*aResult = lf);
return NS_OK;
#elif defined(XP_WIN32)
- nsCOMPtr<nsILocalFile> lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
+ nsCOMPtr<nsIFile> lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
NS_ENSURE_TRUE(lf, NS_ERROR_OUT_OF_MEMORY);
rv = lf->InitWithPath(aArgument);
if (NS_FAILED(rv)) {
// If it's a relative path, the Init is *going* to fail. We use string magic and
// win32 _fullpath. Note that paths of the form "\Relative\To\CurDrive" are
// going to fail, and I haven't figured out a way to work around this without
// the PathCombine() function, which is not available in plain win95/nt4
@@ -333,17 +333,17 @@ nsCommandLine::ResolveFile(const nsAStri
rv = lf->InitWithPath(nsDependentString(pathBuf));
if (NS_FAILED(rv)) return rv;
}
NS_ADDREF(*aResult = lf);
return NS_OK;
#elif defined(XP_OS2)
- nsCOMPtr<nsILocalFile> lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
+ nsCOMPtr<nsIFile> lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
NS_ENSURE_TRUE(lf, NS_ERROR_OUT_OF_MEMORY);
rv = lf->InitWithPath(aArgument);
if (NS_FAILED(rv)) {
nsCAutoString fullPath;
mWorkingDir->GetNativePath(fullPath);
@@ -379,17 +379,17 @@ nsCommandLine::ResolveURI(const nsAStrin
nsCOMPtr<nsIIOService> io = do_GetIOService();
NS_ENSURE_TRUE(io, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsIURI> workingDirURI;
if (mWorkingDir) {
io->NewFileURI(mWorkingDir, getter_AddRefs(workingDirURI));
}
- nsCOMPtr<nsILocalFile> lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
+ nsCOMPtr<nsIFile> lf (do_CreateInstance(NS_LOCAL_FILE_CONTRACTID));
rv = lf->InitWithPath(aArgument);
if (NS_SUCCEEDED(rv)) {
lf->Normalize();
nsCAutoString url;
// Try to resolve the url for .url files.
resolveShortcutURL(lf, url);
if (!url.IsEmpty()) {
return io->NewURI(url,
@@ -420,17 +420,17 @@ nsCommandLine::appendArg(const char* arg
#else
NS_CopyNativeToUnicode(nsDependentCString(arg), warg);
#endif
mArgs.AppendElement(warg);
}
void
-nsCommandLine::resolveShortcutURL(nsILocalFile* aFile, nsACString& outURL)
+nsCommandLine::resolveShortcutURL(nsIFile* aFile, nsACString& outURL)
{
nsCOMPtr<nsIFileProtocolHandler> fph;
nsresult rv = NS_GetFileProtocolHandler(getter_AddRefs(fph));
if (NS_FAILED(rv))
return;
nsCOMPtr<nsIURI> uri;
rv = fph->ReadURLFile(aFile, getter_AddRefs(uri));
--- a/toolkit/components/downloads/nsDownloadManager.cpp
+++ b/toolkit/components/downloads/nsDownloadManager.cpp
@@ -1035,17 +1035,17 @@ nsDownloadManager::GetDownloadFromDB(PRU
rv = stmt->GetUTF8String(i++, persistentDescriptor);
NS_ENSURE_SUCCESS(rv, rv);
if (!persistentDescriptor.IsEmpty()) {
nsCOMPtr<nsILocalHandlerApp> handler =
do_CreateInstance(NS_LOCALHANDLERAPP_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> localExecutable;
+ nsCOMPtr<nsIFile> localExecutable;
rv = NS_NewNativeLocalFile(EmptyCString(), false,
getter_AddRefs(localExecutable));
NS_ENSURE_SUCCESS(rv, rv);
rv = localExecutable->SetPersistentDescriptor(persistentDescriptor);
NS_ENSURE_SUCCESS(rv, rv);
rv = handler->SetExecutable(localExecutable);
@@ -1100,19 +1100,19 @@ nsDownloadManager::GetActiveDownloads(ns
return NS_NewArrayEnumerator(aResult, mCurrentDownloads);
}
/**
* For platforms where helper apps use the downloads directory (i.e. mobile),
* this should be kept in sync with nsExternalHelperAppService.cpp
*/
NS_IMETHODIMP
-nsDownloadManager::GetDefaultDownloadsDirectory(nsILocalFile **aResult)
+nsDownloadManager::GetDefaultDownloadsDirectory(nsIFile **aResult)
{
- nsCOMPtr<nsILocalFile> downloadDir;
+ nsCOMPtr<nsIFile> downloadDir;
nsresult rv;
nsCOMPtr<nsIProperties> dirService =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
// OSX 10.4:
// Desktop
@@ -1126,38 +1126,38 @@ nsDownloadManager::GetDefaultDownloadsDi
// XDG user dir spec, with a fallback to Home/Downloads
nsXPIDLString folderName;
mBundle->GetStringFromName(NS_LITERAL_STRING("downloadsFolder").get(),
getter_Copies(folderName));
#if defined (XP_MACOSX)
rv = dirService->Get(NS_OSX_DEFAULT_DOWNLOAD_DIR,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(downloadDir));
NS_ENSURE_SUCCESS(rv, rv);
#elif defined(XP_WIN)
rv = dirService->Get(NS_WIN_DEFAULT_DOWNLOAD_DIR,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(downloadDir));
NS_ENSURE_SUCCESS(rv, rv);
// Check the os version
nsCOMPtr<nsIPropertyBag2> infoService =
do_GetService(NS_SYSTEMINFO_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 version;
NS_NAMED_LITERAL_STRING(osVersion, "version");
rv = infoService->GetPropertyAsInt32(osVersion, &version);
NS_ENSURE_SUCCESS(rv, rv);
if (version < 6) { // XP/2K
// First get "My Documents"
rv = dirService->Get(NS_WIN_PERSONAL_DIR,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(downloadDir));
NS_ENSURE_SUCCESS(rv, rv);
rv = downloadDir->Append(folderName);
NS_ENSURE_SUCCESS(rv, rv);
// This could be the first time we are creating the downloads folder in My
// Documents, so make sure it exists.
@@ -1172,64 +1172,64 @@ nsDownloadManager::GetDefaultDownloadsDi
#elif defined(XP_UNIX)
#if defined(MOZ_PLATFORM_MAEMO)
// As maemo does not follow the XDG "standard" (as usually desktop
// Linux distros do) neither has a working $HOME/Desktop folder
// for us to fallback into, "$HOME/MyDocs/.documents/" is the folder
// we found most apropriate to be the default target folder for downloads
// on the platform.
rv = dirService->Get(NS_UNIX_XDG_DOCUMENTS_DIR,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(downloadDir));
#elif defined(MOZ_WIDGET_ANDROID)
// Android doesn't have a $HOME directory, and by default we only have
// write access to /data/data/org.mozilla.{$APP} and /sdcard
char* downloadDirPath = getenv("DOWNLOADS_DIRECTORY");
if (downloadDirPath) {
rv = NS_NewNativeLocalFile(nsDependentCString(downloadDirPath),
true, getter_AddRefs(downloadDir));
NS_ENSURE_SUCCESS(rv, rv);
}
else {
rv = NS_ERROR_FAILURE;
}
#else
rv = dirService->Get(NS_UNIX_DEFAULT_DOWNLOAD_DIR,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(downloadDir));
// fallback to Home/Downloads
if (NS_FAILED(rv)) {
rv = dirService->Get(NS_UNIX_HOME_DIR,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(downloadDir));
NS_ENSURE_SUCCESS(rv, rv);
rv = downloadDir->Append(folderName);
NS_ENSURE_SUCCESS(rv, rv);
}
#endif
#else
rv = dirService->Get(NS_OS_HOME_DIR,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(downloadDir));
NS_ENSURE_SUCCESS(rv, rv);
rv = downloadDir->Append(folderName);
NS_ENSURE_SUCCESS(rv, rv);
#endif
downloadDir.forget(aResult);
return NS_OK;
}
#define NS_BRANCH_DOWNLOAD "browser.download."
#define NS_PREF_FOLDERLIST "folderList"
#define NS_PREF_DIR "dir"
NS_IMETHODIMP
-nsDownloadManager::GetUserDownloadsDirectory(nsILocalFile **aResult)
+nsDownloadManager::GetUserDownloadsDirectory(nsIFile **aResult)
{
nsresult rv;
nsCOMPtr<nsIProperties> dirService =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrefService> prefService =
do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
@@ -1243,35 +1243,35 @@ nsDownloadManager::GetUserDownloadsDirec
PRInt32 val;
rv = prefBranch->GetIntPref(NS_PREF_FOLDERLIST,
&val);
NS_ENSURE_SUCCESS(rv, rv);
switch(val) {
case 0: // Desktop
{
- nsCOMPtr<nsILocalFile> downloadDir;
+ nsCOMPtr<nsIFile> downloadDir;
nsCOMPtr<nsIProperties> dirService =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = dirService->Get(NS_OS_DESKTOP_DIR,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(downloadDir));
NS_ENSURE_SUCCESS(rv, rv);
downloadDir.forget(aResult);
return NS_OK;
}
break;
case 1: // Downloads
return GetDefaultDownloadsDirectory(aResult);
case 2: // Custom
{
- nsCOMPtr<nsILocalFile> customDirectory;
+ nsCOMPtr<nsIFile> customDirectory;
prefBranch->GetComplexValue(NS_PREF_DIR,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(customDirectory));
if (customDirectory) {
bool exists = false;
(void)customDirectory->Exists(&exists);
if (!exists) {
rv = customDirectory->Create(nsIFile::DIRECTORY_TYPE, 0755);
if (NS_SUCCEEDED(rv)) {
@@ -1291,34 +1291,34 @@ nsDownloadManager::GetUserDownloadsDirec
if (exists && writable && directory) {
customDirectory.forget(aResult);
return NS_OK;
}
}
rv = GetDefaultDownloadsDirectory(aResult);
if (NS_SUCCEEDED(rv)) {
(void)prefBranch->SetComplexValue(NS_PREF_DIR,
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
*aResult);
}
return rv;
}
break;
}
return NS_ERROR_INVALID_ARG;
}
NS_IMETHODIMP
nsDownloadManager::AddDownload(DownloadType aDownloadType,
nsIURI *aSource,
nsIURI *aTarget,
const nsAString& aDisplayName,
nsIMIMEInfo *aMIMEInfo,
PRTime aStartTime,
- nsILocalFile *aTempFile,
+ nsIFile *aTempFile,
nsICancelable *aCancelable,
nsIDownload **aDownload)
{
NS_ENSURE_ARG_POINTER(aSource);
NS_ENSURE_ARG_POINTER(aTarget);
NS_ENSURE_ARG_POINTER(aDownload);
nsresult rv;
@@ -1369,20 +1369,17 @@ nsDownloadManager::AddDownload(DownloadT
nsCOMPtr<nsIHandlerApp> handlerApp;
(void)aMIMEInfo->GetPreferredApplicationHandler(getter_AddRefs(handlerApp));
nsCOMPtr<nsILocalHandlerApp> locHandlerApp = do_QueryInterface(handlerApp);
if (locHandlerApp) {
nsCOMPtr<nsIFile> executable;
(void)locHandlerApp->GetExecutable(getter_AddRefs(executable));
- nsCOMPtr<nsILocalFile> locExecutable = do_QueryInterface(executable);
-
- if (locExecutable)
- (void)locExecutable->GetPersistentDescriptor(persistentDescriptor);
+ (void)executable->GetPersistentDescriptor(persistentDescriptor);
}
(void)aMIMEInfo->GetPreferredAction(&action);
}
DownloadState startState = nsIDownloadManager::DOWNLOAD_QUEUED;
PRInt64 id = AddDownloadToDB(dl->mDisplayName, source, target, tempPath,
@@ -1508,17 +1505,17 @@ nsDownloadManager::CancelDownload(PRUint
// cancel.
if (dl->mTempFile) {
bool exists;
dl->mTempFile->Exists(&exists);
if (exists)
dl->mTempFile->Remove(false);
}
- nsCOMPtr<nsILocalFile> file;
+ nsCOMPtr<nsIFile> file;
if (NS_SUCCEEDED(dl->GetTargetFile(getter_AddRefs(file))))
{
bool exists;
file->Exists(&exists);
if (exists)
file->Remove(false);
}
@@ -2552,17 +2549,17 @@ nsDownload::OnStateChange(nsIWebProgress
// We got both STOP and NETWORK so that means the whole request is done
// (and not just a single file if there are multiple files)
if (NS_SUCCEEDED(aStatus)) {
// We can't completely trust the bytes we've added up because we might be
// missing on some/all of the progress updates (especially from cache).
// Our best bet is the file itself, but if for some reason it's gone or
// if we have multiple files, the next best is what we've calculated.
PRInt64 fileSize;
- nsCOMPtr<nsILocalFile> file;
+ nsCOMPtr<nsIFile> file;
// We need a nsIFile clone to deal with file size caching issues. :(
nsCOMPtr<nsIFile> clone;
if (!mHasMultipleFiles &&
NS_SUCCEEDED(GetTargetFile(getter_AddRefs(file))) &&
NS_SUCCEEDED(file->Clone(getter_AddRefs(clone))) &&
NS_SUCCEEDED(clone->GetFileSize(&fileSize)) && fileSize > 0) {
mCurrBytes = mMaxBytes = fileSize;
@@ -2613,17 +2610,17 @@ nsDownload::OnSecurityChange(nsIWebProgr
//// nsIDownload
NS_IMETHODIMP
nsDownload::Init(nsIURI *aSource,
nsIURI *aTarget,
const nsAString& aDisplayName,
nsIMIMEInfo *aMIMEInfo,
PRTime aStartTime,
- nsILocalFile *aTempFile,
+ nsIFile *aTempFile,
nsICancelable *aCancelable)
{
NS_WARNING("Huh...how did we get here?!");
return NS_OK;
}
NS_IMETHODIMP
nsDownload::GetState(PRInt16 *aState)
@@ -2695,17 +2692,17 @@ NS_IMETHODIMP
nsDownload::GetMIMEInfo(nsIMIMEInfo **aMIMEInfo)
{
*aMIMEInfo = mMIMEInfo;
NS_IF_ADDREF(*aMIMEInfo);
return NS_OK;
}
NS_IMETHODIMP
-nsDownload::GetTargetFile(nsILocalFile **aTargetFile)
+nsDownload::GetTargetFile(nsIFile **aTargetFile)
{
nsresult rv;
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(mTarget, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIFile> file;
rv = fileURL->GetFile(getter_AddRefs(file));
@@ -2799,17 +2796,17 @@ nsDownload::ExecuteDesiredAction()
}
return retVal;
}
nsresult
nsDownload::MoveTempToTarget()
{
- nsCOMPtr<nsILocalFile> target;
+ nsCOMPtr<nsIFile> target;
nsresult rv = GetTargetFile(getter_AddRefs(target));
NS_ENSURE_SUCCESS(rv, rv);
// MoveTo will fail if the file already exists, but we've already obtained
// confirmation from the user that this is OK, so remove it if it exists.
bool fileExists;
if (NS_SUCCEEDED(target->Exists(&fileExists)) && fileExists) {
rv = target->Remove(false);
@@ -2828,17 +2825,17 @@ nsDownload::MoveTempToTarget()
return NS_OK;
}
nsresult
nsDownload::OpenWithApplication()
{
// First move the temporary file to the target location
- nsCOMPtr<nsILocalFile> target;
+ nsCOMPtr<nsIFile> target;
nsresult rv = GetTargetFile(getter_AddRefs(target));
NS_ENSURE_SUCCESS(rv, rv);
// Move the temporary file to the target location
rv = MoveTempToTarget();
NS_ENSURE_SUCCESS(rv, rv);
// We do not verify the return value here because, irrespective of success
@@ -2949,17 +2946,17 @@ nsDownload::Resume()
// Create a new channel for the source URI
nsCOMPtr<nsIChannel> channel;
nsCOMPtr<nsIInterfaceRequestor> ir(do_QueryInterface(wbp));
rv = NS_NewChannel(getter_AddRefs(channel), mSource, nsnull, nsnull, ir);
NS_ENSURE_SUCCESS(rv, rv);
// Make sure we can get a file, either the temporary or the real target, for
// both purposes of file size and a target to write to
- nsCOMPtr<nsILocalFile> targetLocalFile(mTempFile);
+ nsCOMPtr<nsIFile> targetLocalFile(mTempFile);
if (!targetLocalFile) {
rv = GetTargetFile(getter_AddRefs(targetLocalFile));
NS_ENSURE_SUCCESS(rv, rv);
}
// Get the file size to be used as an offset, but if anything goes wrong
// along the way, we'll silently restart at 0.
PRInt64 fileSize;
--- a/toolkit/components/downloads/nsDownloadManager.h
+++ b/toolkit/components/downloads/nsDownloadManager.h
@@ -8,17 +8,17 @@
#if defined(XP_WIN)
#define DOWNLOAD_SCANNER
#endif
#include "nsIDownload.h"
#include "nsIDownloadManager.h"
#include "nsIDownloadProgressListener.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIMIMEInfo.h"
#include "nsINavHistoryService.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsIStringBundle.h"
#include "nsISupportsPrimitives.h"
#include "nsWeakReference.h"
#include "nsITimer.h"
@@ -373,17 +373,17 @@ protected:
private:
nsString mDisplayName;
nsCString mEntityID;
nsCOMPtr<nsIURI> mSource;
nsCOMPtr<nsIURI> mReferrer;
nsCOMPtr<nsICancelable> mCancelable;
nsCOMPtr<nsIRequest> mRequest;
- nsCOMPtr<nsILocalFile> mTempFile;
+ nsCOMPtr<nsIFile> mTempFile;
nsCOMPtr<nsIMIMEInfo> mMIMEInfo;
DownloadState mDownloadState;
DownloadType mDownloadType;
PRUint32 mID;
PRInt32 mPercentComplete;
--- a/toolkit/components/downloads/nsDownloadProxy.h
+++ b/toolkit/components/downloads/nsDownloadProxy.h
@@ -25,17 +25,17 @@ public:
NS_DECL_ISUPPORTS
NS_IMETHODIMP Init(nsIURI* aSource,
nsIURI* aTarget,
const nsAString& aDisplayName,
nsIMIMEInfo *aMIMEInfo,
PRTime aStartTime,
- nsILocalFile* aTempFile,
+ nsIFile* aTempFile,
nsICancelable* aCancelable) {
nsresult rv;
nsCOMPtr<nsIDownloadManager> dm = do_GetService("@mozilla.org/download-manager;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = dm->AddDownload(nsIDownloadManager::DOWNLOAD_TYPE_DOWNLOAD, aSource,
aTarget, aDisplayName, aMIMEInfo, aStartTime,
aTempFile, aCancelable, getter_AddRefs(mInner));
--- a/toolkit/components/downloads/nsDownloadScanner.cpp
+++ b/toolkit/components/downloads/nsDownloadScanner.cpp
@@ -324,17 +324,17 @@ nsDownloadScanner::Scan::Start()
mThread = (HANDLE)_beginthreadex(NULL, 0, ScannerThreadFunction,
this, CREATE_SUSPENDED, NULL);
if (!mThread)
return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = NS_OK;
// Get the path to the file on disk
- nsCOMPtr<nsILocalFile> file;
+ nsCOMPtr<nsIFile> file;
rv = mDownload->GetTargetFile(getter_AddRefs(file));
NS_ENSURE_SUCCESS(rv, rv);
rv = file->GetPath(mPath);
NS_ENSURE_SUCCESS(rv, rv);
// Grab the app name
nsCOMPtr<nsIXULAppInfo> appinfo =
do_GetService(XULAPPINFO_SERVICE_CONTRACTID, &rv);
--- a/toolkit/components/downloads/nsIDownload.idl
+++ b/toolkit/components/downloads/nsIDownload.idl
@@ -1,17 +1,17 @@
/* -*- 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 "nsITransfer.idl"
interface nsIURI;
-interface nsILocalFile;
+interface nsIFile;
interface nsIObserver;
interface nsICancelable;
interface nsIWebProgressListener;
interface nsIMIMEInfo;
/**
* Represents a download object.
*
@@ -25,17 +25,17 @@ interface nsIMIMEInfo;
* nsIDownloadManager::DOWNLOAD_BLOCKED_POLICY
*/
[scriptable, uuid(c891111e-92a6-47b8-bc46-874ebb61ac9d)]
interface nsIDownload : nsITransfer {
/**
* The target of a download is always a file on the local file system.
*/
- readonly attribute nsILocalFile targetFile;
+ readonly attribute nsIFile targetFile;
/**
* The percentage of transfer completed.
* If the file size is unknown it'll be -1 here.
*/
readonly attribute long percentComplete;
/**
--- a/toolkit/components/downloads/nsIDownloadManager.idl
+++ b/toolkit/components/downloads/nsIDownloadManager.idl
@@ -3,17 +3,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/. */
// Keeps track of ongoing downloads, in the form of nsIDownload's.
#include "nsISupports.idl"
interface nsIURI;
-interface nsILocalFile;
+interface nsIFile;
interface nsIDownload;
interface nsICancelable;
interface nsIMIMEInfo;
interface nsIDownloadProgressListener;
interface nsISimpleEnumerator;
interface mozIStorageConnection;
[scriptable, uuid(bacca1ac-1b01-4a6f-9e91-c2ead1f7d2c0)]
@@ -115,17 +115,17 @@ interface nsIDownloadManager : nsISuppor
* as the returned download object, then call saveURI.
*/
nsIDownload addDownload(in short aDownloadType,
in nsIURI aSource,
in nsIURI aTarget,
in AString aDisplayName,
in nsIMIMEInfo aMIMEInfo,
in PRTime aStartTime,
- in nsILocalFile aTempFile,
+ in nsIFile aTempFile,
in nsICancelable aCancelable);
/**
* Retrieves a download managed by the download manager. This can be one that
* is in progress, or one that has completed in the past and is stored in the
* database.
*
* @param aID The unique ID of the download.
@@ -234,17 +234,17 @@ interface nsIDownloadManager : nsISuppor
/**
* Removes a listener from the download manager.
*/
void removeListener(in nsIDownloadProgressListener aListener);
/**
* Returns the platform default downloads directory.
*/
- readonly attribute nsILocalFile defaultDownloadsDirectory;
+ readonly attribute nsIFile defaultDownloadsDirectory;
/**
* Returns the user configured downloads directory.
* The path is dependent on two user configurable prefs
* set in preferences:
*
* browser.download.folderList
* Indicates the location users wish to save downloaded
@@ -256,12 +256,12 @@ interface nsIDownloadManager : nsISuppor
* browser.download.dir. If invalid, userDownloadsDirectory
* will fallback on defaultDownloadsDirectory.
*
* browser.download.dir -
* A local path the user may have selected at some point
* where downloaded files are saved. The use of which is
* enabled when folderList equals 2.
*/
- readonly attribute nsILocalFile userDownloadsDirectory;
+ readonly attribute nsIFile userDownloadsDirectory;
};
--- a/toolkit/components/filepicker/nsFileView.cpp
+++ b/toolkit/components/filepicker/nsFileView.cpp
@@ -4,17 +4,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIFileView.h"
#include "nsITreeView.h"
#include "mozilla/ModuleUtils.h"
#include "nsITreeSelection.h"
#include "nsITreeColumns.h"
#include "nsITreeBoxObject.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsCRT.h"
#include "prmem.h"
#include "nsPrintfCString.h"
#include "nsIDateTimeFormat.h"
#include "nsDateTimeFormatCID.h"
#include "nsQuickSort.h"
@@ -55,17 +55,17 @@ nsFileResult::nsFileResult(const nsAStri
const nsAString& aSearchParam):
mSearchString(aSearchString)
{
if (aSearchString.IsEmpty())
mSearchResult = RESULT_IGNORED;
else {
PRInt32 slashPos = mSearchString.RFindChar('/');
mSearchResult = RESULT_FAILURE;
- nsCOMPtr<nsILocalFile> directory;
+ nsCOMPtr<nsIFile> directory;
nsDependentSubstring parent(Substring(mSearchString, 0, slashPos + 1));
if (!parent.IsEmpty() && parent.First() == '/')
NS_NewLocalFile(parent, true, getter_AddRefs(directory));
if (!directory) {
if (NS_FAILED(NS_NewLocalFile(aSearchParam, true, getter_AddRefs(directory))))
return;
if (slashPos > 0)
directory->AppendRelativePath(Substring(mSearchString, 0, slashPos));
@@ -74,17 +74,17 @@ nsFileResult::nsFileResult(const nsAStri
if (NS_FAILED(directory->GetDirectoryEntries(getter_AddRefs(dirEntries))))
return;
mSearchResult = RESULT_NOMATCH;
bool hasMore = false;
nsDependentSubstring prefix(Substring(mSearchString, slashPos + 1));
while (NS_SUCCEEDED(dirEntries->HasMoreElements(&hasMore)) && hasMore) {
nsCOMPtr<nsISupports> nextItem;
dirEntries->GetNext(getter_AddRefs(nextItem));
- nsCOMPtr<nsILocalFile> nextFile(do_QueryInterface(nextItem));
+ nsCOMPtr<nsIFile> nextFile(do_QueryInterface(nextItem));
nsAutoString fileName;
nextFile->GetLeafName(fileName);
if (StringBeginsWith(fileName, prefix)) {
fileName.Insert(parent, 0);
mValues.AppendElement(fileName);
if (mSearchResult == RESULT_NOMATCH && fileName.Equals(mSearchString))
mSearchResult = RESULT_IGNORED;
else
--- a/toolkit/components/places/Database.cpp
+++ b/toolkit/components/places/Database.cpp
@@ -1,17 +1,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 "Database.h"
#include "nsINavBookmarksService.h"
#include "nsIInterfaceRequestorUtils.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsNavHistory.h"
#include "nsPlacesTables.h"
#include "nsPlacesIndexes.h"
#include "nsPlacesTriggers.h"
#include "nsPlacesMacros.h"
#include "SQLFunctions.h"
#include "Helpers.h"
--- a/toolkit/components/places/nsIPlacesImportExportService.idl
+++ b/toolkit/components/places/nsIPlacesImportExportService.idl
@@ -1,30 +1,30 @@
/* -*- Mode: IDL; tab-width: 2; 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 "nsISupports.idl"
-interface nsILocalFile;
+interface nsIFile;
interface nsIURI;
/**
* The PlacesImportExport interface provides methods for exporting Places data.
* The word "Import" is in the name for legacy reasons and was kept to avoid
* disrupting potential extension code using the export part. The new importer
* lives in BookmarkHTMLUtils.jsm.
*/
[scriptable, uuid(47a4a09e-c708-4e68-b2f2-664d982ce026)]
interface nsIPlacesImportExportService: nsISupports
{
/**
* Saves the current bookmarks hierarchy to a bookmarks.html file.
*/
- void exportHTMLToFile(in nsILocalFile aFile);
+ void exportHTMLToFile(in nsIFile aFile);
/**
* Backup the bookmarks.html file.
*/
void backupBookmarksFile();
};
--- a/toolkit/components/places/nsPlacesExportService.cpp
+++ b/toolkit/components/places/nsPlacesExportService.cpp
@@ -941,17 +941,17 @@ nsPlacesExportService::WriteContainerCon
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}
NS_IMETHODIMP
-nsPlacesExportService::ExportHTMLToFile(nsILocalFile* aBookmarksFile)
+nsPlacesExportService::ExportHTMLToFile(nsIFile* aBookmarksFile)
{
NS_ENSURE_ARG(aBookmarksFile);
#ifdef DEBUG_EXPORT
nsAutoString path;
aBookmarksFile->GetPath(path);
printf("\nExporting %s\n", NS_ConvertUTF16toUTF8(path).get());
@@ -1100,28 +1100,26 @@ nsPlacesExportService::BackupBookmarksFi
NS_ENSURE_SUCCESS(rv, rv);
// get bookmarks file
nsCOMPtr<nsIFile> bookmarksFileDir;
rv = NS_GetSpecialDirectory(NS_APP_BOOKMARKS_50_FILE,
getter_AddRefs(bookmarksFileDir));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> bookmarksFile = do_QueryInterface(bookmarksFileDir);
- NS_ENSURE_STATE(bookmarksFile);
// Create the file if it doesn't exist.
bool exists;
- rv = bookmarksFile->Exists(&exists);
+ rv = bookmarksFileDir->Exists(&exists);
if (NS_FAILED(rv) || !exists) {
- rv = bookmarksFile->Create(nsIFile::NORMAL_FILE_TYPE, 0600);
+ rv = bookmarksFileDir->Create(nsIFile::NORMAL_FILE_TYPE, 0600);
if (NS_FAILED(rv)) {
NS_WARNING("Unable to create bookmarks.html!");
return rv;
}
}
// export bookmarks.html
- rv = ExportHTMLToFile(bookmarksFile);
+ rv = ExportHTMLToFile(bookmarksFileDir);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
--- a/toolkit/components/places/nsPlacesExportService.h
+++ b/toolkit/components/places/nsPlacesExportService.h
@@ -3,17 +3,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsPlacesExportService_h_
#define nsPlacesExportService_h_
#include "nsIPlacesImportExportService.h"
#include "nsCOMPtr.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIOutputStream.h"
#include "nsIFaviconService.h"
#include "nsIAnnotationService.h"
#include "mozIAsyncLivemarks.h"
#include "nsINavHistoryService.h"
#include "nsINavBookmarksService.h"
#include "nsIChannel.h"
--- a/toolkit/components/remote/nsXRemoteService.cpp
+++ b/toolkit/components/remote/nsXRemoteService.cpp
@@ -11,17 +11,17 @@
#include "nsIObserverService.h"
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
#include "nsICommandLineRunner.h"
#include "nsICommandLine.h"
#include "nsIBaseWindow.h"
#include "nsIDocShell.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIServiceManager.h"
#include "nsIWeakReference.h"
#include "nsIWidget.h"
#include "nsIAppShellService.h"
#include "nsAppShellCID.h"
#include "nsPIDOMWindow.h"
#include "mozilla/X11Util.h"
@@ -313,17 +313,17 @@ nsXRemoteService::HandleCommandLine(char
// followed by a series of null-terminated strings:
//
// [argc][offsetargv0][offsetargv1...]<workingdir>\0<argv[0]>\0argv[1]...\0
// (offset is from the beginning of the buffer)
PRInt32 argc = TO_LITTLE_ENDIAN32(*reinterpret_cast<PRInt32*>(aBuffer));
char *wd = aBuffer + ((argc + 1) * sizeof(PRInt32));
- nsCOMPtr<nsILocalFile> lf;
+ nsCOMPtr<nsIFile> lf;
rv = NS_NewNativeLocalFile(nsDependentCString(wd), true,
getter_AddRefs(lf));
if (NS_FAILED(rv))
return "509 internal error";
nsCAutoString desktopStartupID;
char **argv = (char**) malloc(sizeof(char*) * argc);
--- a/toolkit/components/startup/nsAppStartup.cpp
+++ b/toolkit/components/startup/nsAppStartup.cpp
@@ -3,17 +3,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 "nsAppStartup.h"
#include "nsIAppShellService.h"
#include "nsPIDOMWindow.h"
#include "nsIInterfaceRequestor.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIObserverService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIProfileChangeStatus.h"
#include "nsIPromptService.h"
#include "nsIStringBundle.h"
#include "nsISupportsPrimitives.h"
#include "nsIWebBrowserChrome.h"
--- a/toolkit/components/telemetry/Telemetry.cpp
+++ b/toolkit/components/telemetry/Telemetry.cpp
@@ -10,17 +10,16 @@
#include "nsCOMPtr.h"
#include "mozilla/ModuleUtils.h"
#include "nsIXPConnect.h"
#include "mozilla/Services.h"
#include "jsapi.h"
#include "nsStringGlue.h"
#include "nsITelemetry.h"
#include "nsIFile.h"
-#include "nsILocalFile.h"
#include "Telemetry.h"
#include "nsTHashtable.h"
#include "nsHashKeys.h"
#include "nsBaseHashtable.h"
#include "nsXULAppAPI.h"
#include "nsThreadUtils.h"
#include "mozilla/Mutex.h"
#include "mozilla/FileUtils.h"
@@ -1335,23 +1334,19 @@ TelemetrySessionData::DeserializeHistogr
return true;
}
nsresult
TelemetrySessionData::LoadFromDisk(nsIFile *file, TelemetrySessionData **ptr)
{
*ptr = nsnull;
nsresult rv;
- nsCOMPtr<nsILocalFile> f(do_QueryInterface(file, &rv));
- if (NS_FAILED(rv)) {
- return rv;
- }
AutoFDClose fd;
- rv = f->OpenNSPRFileDesc(PR_RDONLY, 0, &fd.rwget());
+ rv = file->OpenNSPRFileDesc(PR_RDONLY, 0, &fd.rwget());
if (NS_FAILED(rv)) {
return NS_ERROR_FAILURE;
}
// If there's not even enough data to read the header for the pickle,
// don't bother. Conveniently, this handles the error case as well.
int32_t size = PR_Available(fd);
if (size < static_cast<int32_t>(sizeof(Pickle::Header))) {
@@ -1427,23 +1422,19 @@ TelemetrySessionData::SerializeHistogram
return true;
}
nsresult
TelemetrySessionData::SaveToDisk(nsIFile *file, const nsACString &uuid)
{
nsresult rv;
- nsCOMPtr<nsILocalFile> f(do_QueryInterface(file, &rv));
- if (NS_FAILED(rv)) {
- return rv;
- }
AutoFDClose fd;
- rv = f->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0600, &fd.rwget());
+ rv = file->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0600, &fd.rwget());
if (NS_FAILED(rv)) {
return rv;
}
Pickle pickle;
if (!pickle.WriteUInt32(sVersion)) {
return NS_ERROR_FAILURE;
}
--- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
@@ -8,17 +8,16 @@
#include "nsCOMPtr.h"
#include "nsDebug.h"
#include "nsTArray.h"
#include "nsString.h"
#include "nsUrlClassifierPrefixSet.h"
#include "nsIUrlClassifierPrefixSet.h"
#include "nsIRandomGenerator.h"
#include "nsIFile.h"
-#include "nsILocalFile.h"
#include "nsToolkitCompsCID.h"
#include "nsTArray.h"
#include "nsThreadUtils.h"
#include "mozilla/Mutex.h"
#include "mozilla/Telemetry.h"
#include "mozilla/FileUtils.h"
#include "prlog.h"
@@ -445,22 +444,19 @@ nsUrlClassifierPrefixSet::LoadFromFd(Aut
return NS_OK;
}
NS_IMETHODIMP
nsUrlClassifierPrefixSet::LoadFromFile(nsIFile * aFile)
{
nsresult rv;
- nsCOMPtr<nsILocalFile> file(do_QueryInterface(aFile, &rv));
- NS_ENSURE_SUCCESS(rv, rv);
-
AutoFDClose fileFd;
- rv = file->OpenNSPRFileDesc(PR_RDONLY | nsILocalFile::OS_READAHEAD,
- 0, &fileFd.rwget());
+ rv = aFile->OpenNSPRFileDesc(PR_RDONLY | nsIFile::OS_READAHEAD,
+ 0, &fileFd.rwget());
NS_ENSURE_SUCCESS(rv, rv);
return LoadFromFd(fileFd);
}
nsresult
nsUrlClassifierPrefixSet::StoreToFd(AutoFDClose & fileFd)
{
@@ -506,20 +502,18 @@ NS_IMETHODIMP
nsUrlClassifierPrefixSet::StoreToFile(nsIFile * aFile)
{
if (!mHasPrefixes) {
LOG(("Attempt to serialize empty PrefixSet"));
return NS_ERROR_FAILURE;
}
nsresult rv;
- nsCOMPtr<nsILocalFile> file(do_QueryInterface(aFile, &rv));
- NS_ENSURE_SUCCESS(rv, rv);
AutoFDClose fileFd;
- rv = file->OpenNSPRFileDesc(PR_RDWR | PR_TRUNCATE | PR_CREATE_FILE,
- 0644, &fileFd.rwget());
+ rv = aFile->OpenNSPRFileDesc(PR_RDWR | PR_TRUNCATE | PR_CREATE_FILE,
+ 0644, &fileFd.rwget());
NS_ENSURE_SUCCESS(rv, rv);
MutexAutoLock lock(mPrefixSetLock);
return StoreToFd(fileFd);
}
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -65,17 +65,17 @@
#include <stdlib.h>
#include <time.h>
#include <prenv.h>
#include <prio.h>
#include <prmem.h>
#include "mozilla/Mutex.h"
#include "nsDebug.h"
#include "nsCRT.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsIFileStreams.h"
#include "nsInterfaceHashtable.h"
#include "prprf.h"
#include "nsIXULAppInfo.h"
#include <map>
#include <vector>
#include "mozilla/mozalloc_oom.h"
@@ -210,17 +210,17 @@ static char* childCrashNotifyPipe;
static int serverSocketFd = -1;
static int clientSocketFd = -1;
static const int kMagicChildCrashReportFd = 4;
# endif
// |dumpMapLock| must protect all access to |pidToMinidump|.
static Mutex* dumpMapLock;
-typedef nsInterfaceHashtable<nsUint32HashKey, nsILocalFile> ChildMinidumpMap;
+typedef nsInterfaceHashtable<nsUint32HashKey, nsIFile> ChildMinidumpMap;
static ChildMinidumpMap* pidToMinidump;
// Crashreporter annotations that we don't send along in subprocess
// reports
static const char* kSubprocessBlacklist[] = {
"FramePoisonBase",
"FramePoisonSize",
"StartupTime",
@@ -310,23 +310,23 @@ my_inttostring(intmax_t t, char* buffer,
{
my_memset(buffer, 0, buffer_length);
my_itos(buffer, t, my_int_len(t));
}
#endif
#ifdef XP_WIN
static void
-CreateFileFromPath(const xpstring& path, nsILocalFile** file)
+CreateFileFromPath(const xpstring& path, nsIFile** file)
{
NS_NewLocalFile(nsDependentString(path.c_str()), false, file);
}
#else
static void
-CreateFileFromPath(const xpstring& path, nsILocalFile** file)
+CreateFileFromPath(const xpstring& path, nsIFile** file)
{
NS_NewNativeLocalFile(nsDependentCString(path.c_str()), false, file);
}
#endif
static XP_CHAR*
Concat(XP_CHAR* str, const XP_CHAR* toAppend, int* size)
{
@@ -629,17 +629,17 @@ static bool FPEFilter(void* context, EXC
static bool ShouldReport()
{
// this environment variable prevents us from launching
// the crash reporter client
const char *envvar = PR_GetEnv("MOZ_CRASHREPORTER_NO_REPORT");
return !(envvar && *envvar);
}
-nsresult SetExceptionHandler(nsILocalFile* aXREDirectory,
+nsresult SetExceptionHandler(nsIFile* aXREDirectory,
bool force/*=false*/)
{
nsresult rv;
if (gExceptionHandler)
return NS_ERROR_ALREADY_INITIALIZED;
const char *envvar = PR_GetEnv("MOZ_CRASHREPORTER_DISABLE");
@@ -885,40 +885,33 @@ nsresult SetMinidumpPath(const nsAString
gExceptionHandler->set_dump_path(CONVERT_UTF16_TO_XP_CHAR(aPath).BeginReading());
return NS_OK;
}
static nsresult
WriteDataToFile(nsIFile* aFile, const nsACString& data)
{
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(aFile);
- NS_ENSURE_TRUE(localFile, NS_ERROR_FAILURE);
-
PRFileDesc* fd;
- nsresult rv = localFile->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE, 00600,
- &fd);
+ nsresult rv = aFile->OpenNSPRFileDesc(PR_WRONLY | PR_CREATE_FILE, 00600, &fd);
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_OK;
if (PR_Write(fd, data.Data(), data.Length()) == -1) {
rv = NS_ERROR_FAILURE;
}
PR_Close(fd);
return rv;
}
static nsresult
GetFileContents(nsIFile* aFile, nsACString& data)
{
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(aFile);
- NS_ENSURE_TRUE(localFile, NS_ERROR_FAILURE);
-
PRFileDesc* fd;
- nsresult rv = localFile->OpenNSPRFileDesc(PR_RDONLY, 0, &fd);
+ nsresult rv = aFile->OpenNSPRFileDesc(PR_RDONLY, 0, &fd);
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_OK;
PRInt32 filesize = PR_Available(fd);
if (filesize <= 0) {
rv = NS_ERROR_FILE_NOT_FOUND;
}
else {
@@ -987,17 +980,17 @@ InitInstallTime(nsACString& aInstallTime
return NS_OK;
}
// Annotate the crash report with a Unique User ID and time
// since install. Also do some prep work for recording
// time since last crash, which must be calculated at
// crash time.
// If any piece of data doesn't exist, initialize it first.
-nsresult SetupExtraData(nsILocalFile* aAppDataDirectory,
+nsresult SetupExtraData(nsIFile* aAppDataDirectory,
const nsACString& aBuildID)
{
nsCOMPtr<nsIFile> dataDirectory;
nsresult rv = aAppDataDirectory->Clone(getter_AddRefs(dataDirectory));
NS_ENSURE_SUCCESS(rv, rv);
rv = dataDirectory->AppendNative(NS_LITERAL_CSTRING("Crash Reports"));
NS_ENSURE_SUCCESS(rv, rv);
@@ -1567,20 +1560,18 @@ static nsresult PrefSubmitReports(bool*
rv = reporterINI->Create(nsIFile::NORMAL_FILE_TYPE, 0600);
NS_ENSURE_SUCCESS(rv, rv);
}
nsCOMPtr<nsIINIParserFactory> iniFactory =
do_GetService("@mozilla.org/xpcom/ini-processor-factory;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFile> localFile = do_QueryInterface(reporterINI);
- NS_ENSURE_TRUE(localFile, NS_ERROR_FAILURE);
nsCOMPtr<nsIINIParser> iniParser;
- rv = iniFactory->CreateINIParser(localFile,
+ rv = iniFactory->CreateINIParser(reporterINI,
getter_AddRefs(iniParser));
NS_ENSURE_SUCCESS(rv, rv);
// If we're writing the pref, just set and we're done.
if (writePref) {
nsCOMPtr<nsIINIParserWriter> iniWriter = do_QueryInterface(iniParser);
NS_ENSURE_TRUE(iniWriter, NS_ERROR_FAILURE);
@@ -1634,112 +1625,108 @@ nsresult SetSubmitReports(bool aSubmitRe
obsServ->NotifyObservers(nsnull, "submit-reports-pref-changed", nsnull);
return NS_OK;
}
// The "pending" dir is Crash Reports/pending, from which minidumps
// can be submitted
static bool
-GetPendingDir(nsILocalFile** dir)
+GetPendingDir(nsIFile** dir)
{
nsCOMPtr<nsIProperties> dirSvc =
do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
if (!dirSvc)
return false;
- nsCOMPtr<nsILocalFile> pendingDir;
+ nsCOMPtr<nsIFile> pendingDir;
if (NS_FAILED(dirSvc->Get("UAppData",
- NS_GET_IID(nsILocalFile),
+ NS_GET_IID(nsIFile),
getter_AddRefs(pendingDir))) ||
NS_FAILED(pendingDir->Append(NS_LITERAL_STRING("Crash Reports"))) ||
NS_FAILED(pendingDir->Append(NS_LITERAL_STRING("pending"))))
return false;
*dir = NULL;
pendingDir.swap(*dir);
return true;
}
// The "limbo" dir is where minidumps go to wait for something else to
// use them. If we're |ShouldReport()|, then the "something else" is
// a minidump submitter, and they're coming from the
// Crash Reports/pending/ dir. Otherwise, we don't know what the
// "somthing else" is, but the minidumps stay in [profile]/minidumps/
// limbo.
static bool
-GetMinidumpLimboDir(nsILocalFile** dir)
+GetMinidumpLimboDir(nsIFile** dir)
{
if (ShouldReport()) {
return GetPendingDir(dir);
}
else {
CreateFileFromPath(gExceptionHandler->dump_path(), dir);
return NULL != *dir;
}
}
bool
-GetMinidumpForID(const nsAString& id, nsILocalFile** minidump)
+GetMinidumpForID(const nsAString& id, nsIFile** minidump)
{
if (!GetMinidumpLimboDir(minidump))
return false;
(*minidump)->Append(id + NS_LITERAL_STRING(".dmp"));
return true;
}
bool
-GetIDFromMinidump(nsILocalFile* minidump, nsAString& id)
+GetIDFromMinidump(nsIFile* minidump, nsAString& id)
{
if (NS_SUCCEEDED(minidump->GetLeafName(id))) {
id.Replace(id.Length() - 4, 4, NS_LITERAL_STRING(""));
return true;
}
return false;
}
bool
-GetExtraFileForID(const nsAString& id, nsILocalFile** extraFile)
+GetExtraFileForID(const nsAString& id, nsIFile** extraFile)
{
if (!GetMinidumpLimboDir(extraFile))
return false;
(*extraFile)->Append(id + NS_LITERAL_STRING(".extra"));
return true;
}
bool
-GetExtraFileForMinidump(nsILocalFile* minidump, nsILocalFile** extraFile)
+GetExtraFileForMinidump(nsIFile* minidump, nsIFile** extraFile)
{
nsAutoString leafName;
nsresult rv = minidump->GetLeafName(leafName);
if (NS_FAILED(rv))
return false;
nsCOMPtr<nsIFile> extraF;
rv = minidump->Clone(getter_AddRefs(extraF));
if (NS_FAILED(rv))
return false;
- nsCOMPtr<nsILocalFile> extra = do_QueryInterface(extraF);
- if (!extra)
- return false;
-
leafName.Replace(leafName.Length() - 3, 3,
NS_LITERAL_STRING("extra"));
- rv = extra->SetLeafName(leafName);
+ rv = extraF->SetLeafName(leafName);
if (NS_FAILED(rv))
return false;
*extraFile = NULL;
- extra.swap(*extraFile);
+ extraF.swap(*extraFile);
return true;
}
bool
AppendExtraData(const nsAString& id, const AnnotationTable& data)
{
- nsCOMPtr<nsILocalFile> extraFile;
+ nsCOMPtr<nsIFile> extraFile;
if (!GetExtraFileForID(id, getter_AddRefs(extraFile)))
return false;
return AppendExtraData(extraFile, data);
}
//-----------------------------------------------------------------------------
// Helpers for AppendExtraData()
//
@@ -1786,17 +1773,17 @@ EnumerateAnnotations(const nsACString& k
return PL_DHASH_NEXT;
WriteAnnotation(ctx->fd, key, entry);
return PL_DHASH_NEXT;
}
static bool
-WriteExtraData(nsILocalFile* extraFile,
+WriteExtraData(nsIFile* extraFile,
const AnnotationTable& data,
const Blacklist& blacklist,
bool writeCrashTime=false,
bool truncate=false)
{
PRFileDesc* fd;
PRIntn truncOrAppend = truncate ? PR_TRUNCATE : PR_APPEND;
nsresult rv =
@@ -1818,28 +1805,28 @@ WriteExtraData(nsILocalFile* extraFile,
nsDependentCString(crashTimeString));
}
PR_Close(fd);
return true;
}
bool
-AppendExtraData(nsILocalFile* extraFile, const AnnotationTable& data)
+AppendExtraData(nsIFile* extraFile, const AnnotationTable& data)
{
return WriteExtraData(extraFile, data, Blacklist());
}
static bool
-WriteExtraForMinidump(nsILocalFile* minidump,
+WriteExtraForMinidump(nsIFile* minidump,
const Blacklist& blacklist,
- nsILocalFile** extraFile)
+ nsIFile** extraFile)
{
- nsCOMPtr<nsILocalFile> extra;
+ nsCOMPtr<nsIFile> extra;
if (!GetExtraFileForMinidump(minidump, getter_AddRefs(extra)))
return false;
if (!WriteExtraData(extra, *crashReporterAPIData_Hash,
blacklist,
true /*write crash time*/,
true /*truncate*/))
return false;
@@ -1850,17 +1837,17 @@ WriteExtraForMinidump(nsILocalFile* mini
return true;
}
// It really only makes sense to call this function when
// ShouldReport() is true.
static bool
MoveToPending(nsIFile* dumpFile, nsIFile* extraFile)
{
- nsCOMPtr<nsILocalFile> pendingDir;
+ nsCOMPtr<nsIFile> pendingDir;
if (!GetPendingDir(getter_AddRefs(pendingDir)))
return false;
return NS_SUCCEEDED(dumpFile->MoveTo(pendingDir, EmptyString())) &&
NS_SUCCEEDED(extraFile->MoveTo(pendingDir, EmptyString()));
}
static void
@@ -1869,18 +1856,18 @@ OnChildProcessDumpRequested(void* aConte
const ClientInfo& aClientInfo,
const xpstring& aFilePath
#else
const ClientInfo* aClientInfo,
const xpstring* aFilePath
#endif
)
{
- nsCOMPtr<nsILocalFile> minidump;
- nsCOMPtr<nsILocalFile> extraFile;
+ nsCOMPtr<nsIFile> minidump;
+ nsCOMPtr<nsIFile> extraFile;
CreateFileFromPath(
#ifdef XP_MACOSX
aFilePath,
#else
*aFilePath,
#endif
getter_AddRefs(minidump));
@@ -2133,56 +2120,56 @@ SetRemoteExceptionHandler(const nsACStri
// we either do remote or nothing, no fallback to regular crash reporting
return gExceptionHandler->IsOutOfProcess();
}
#endif // XP_WIN
bool
-TakeMinidumpForChild(PRUint32 childPid, nsILocalFile** dump)
+TakeMinidumpForChild(PRUint32 childPid, nsIFile** dump)
{
if (!GetEnabled())
return false;
MutexAutoLock lock(*dumpMapLock);
- nsCOMPtr<nsILocalFile> d;
+ nsCOMPtr<nsIFile> d;
bool found = pidToMinidump->Get(childPid, getter_AddRefs(d));
if (found)
pidToMinidump->Remove(childPid);
*dump = NULL;
d.swap(*dump);
return found;
}
//-----------------------------------------------------------------------------
// CreatePairedMinidumps() and helpers
//
struct PairedDumpContext {
- nsCOMPtr<nsILocalFile>* minidump;
- nsCOMPtr<nsILocalFile>* extra;
+ nsCOMPtr<nsIFile>* minidump;
+ nsCOMPtr<nsIFile>* extra;
const Blacklist& blacklist;
};
static bool
PairedDumpCallback(const XP_CHAR* dump_path,
const XP_CHAR* minidump_id,
void* context,
#ifdef XP_WIN32
EXCEPTION_POINTERS* /*unused*/,
MDRawAssertionInfo* /*unused*/,
#endif
bool succeeded)
{
PairedDumpContext* ctx = static_cast<PairedDumpContext*>(context);
- nsCOMPtr<nsILocalFile>& minidump = *ctx->minidump;
- nsCOMPtr<nsILocalFile>& extra = *ctx->extra;
+ nsCOMPtr<nsIFile>& minidump = *ctx->minidump;
+ nsCOMPtr<nsIFile>& extra = *ctx->extra;
const Blacklist& blacklist = ctx->blacklist;
xpstring dump(dump_path);
dump += XP_PATH_SEPARATOR;
dump += minidump_id;
dump += dumpFileExtension;
CreateFileFromPath(dump, getter_AddRefs(minidump));
@@ -2213,18 +2200,18 @@ CurrentThreadId()
# error "Unsupported platform"
#endif
}
bool
CreatePairedMinidumps(ProcessHandle childPid,
ThreadId childBlamedThread,
nsAString* pairGUID,
- nsILocalFile** childDump,
- nsILocalFile** parentDump)
+ nsIFile** childDump,
+ nsIFile** parentDump)
{
if (!GetEnabled())
return false;
// create the UUID for the hang dump as a pair
nsresult rv;
nsCOMPtr<nsIUUIDGenerator> uuidgen =
do_GetService("@mozilla.org/uuid-generator;1", &rv);
@@ -2251,33 +2238,33 @@ CreatePairedMinidumps(ProcessHandle chil
== KERN_SUCCESS && childBlamedThread < thread_count) {
childThread = threads_for_task[childBlamedThread];
}
#else
ThreadId childThread = childBlamedThread;
#endif
// dump the child
- nsCOMPtr<nsILocalFile> childMinidump;
- nsCOMPtr<nsILocalFile> childExtra;
+ nsCOMPtr<nsIFile> childMinidump;
+ nsCOMPtr<nsIFile> childExtra;
Blacklist childBlacklist(kSubprocessBlacklist,
ArrayLength(kSubprocessBlacklist));
PairedDumpContext childCtx =
{ &childMinidump, &childExtra, childBlacklist };
if (!google_breakpad::ExceptionHandler::WriteMinidumpForChild(
childPid,
childThread,
gExceptionHandler->dump_path(),
PairedDumpCallback,
&childCtx))
return false;
// dump the parent
- nsCOMPtr<nsILocalFile> parentMinidump;
- nsCOMPtr<nsILocalFile> parentExtra;
+ nsCOMPtr<nsIFile> parentMinidump;
+ nsCOMPtr<nsIFile> parentExtra;
// nothing's blacklisted for this process
Blacklist parentBlacklist;
PairedDumpContext parentCtx =
{ &parentMinidump, &parentExtra, parentBlacklist };
if (!google_breakpad::ExceptionHandler::WriteMinidump(
gExceptionHandler->dump_path(),
true, // write exception stream
PairedDumpCallback,
--- a/toolkit/crashreporter/nsExceptionHandler.h
+++ b/toolkit/crashreporter/nsExceptionHandler.h
@@ -20,65 +20,65 @@
#include <windows.h>
#endif
#if defined(XP_MACOSX)
#include <mach/mach.h>
#endif
namespace CrashReporter {
-nsresult SetExceptionHandler(nsILocalFile* aXREDirectory, bool force=false);
+nsresult SetExceptionHandler(nsIFile* aXREDirectory, bool force=false);
nsresult UnsetExceptionHandler();
bool GetEnabled();
bool GetServerURL(nsACString& aServerURL);
nsresult SetServerURL(const nsACString& aServerURL);
bool GetMinidumpPath(nsAString& aPath);
nsresult SetMinidumpPath(const nsAString& aPath);
// AnnotateCrashReport and AppendAppNotesToCrashReport may be called from any
// thread in a chrome process, but may only be called from the main thread in
// a content process.
nsresult AnnotateCrashReport(const nsACString& key, const nsACString& data);
nsresult AppendAppNotesToCrashReport(const nsACString& data);
nsresult SetRestartArgs(int argc, char** argv);
-nsresult SetupExtraData(nsILocalFile* aAppDataDirectory,
+nsresult SetupExtraData(nsIFile* aAppDataDirectory,
const nsACString& aBuildID);
// Registers an additional memory region to be included in the minidump
nsresult RegisterAppMemory(void* ptr, size_t length);
nsresult UnregisterAppMemory(void* ptr);
// Functions for working with minidumps and .extras
typedef nsDataHashtable<nsCStringHashKey, nsCString> AnnotationTable;
-bool GetMinidumpForID(const nsAString& id, nsILocalFile** minidump);
-bool GetIDFromMinidump(nsILocalFile* minidump, nsAString& id);
-bool GetExtraFileForID(const nsAString& id, nsILocalFile** extraFile);
-bool GetExtraFileForMinidump(nsILocalFile* minidump, nsILocalFile** extraFile);
+bool GetMinidumpForID(const nsAString& id, nsIFile** minidump);
+bool GetIDFromMinidump(nsIFile* minidump, nsAString& id);
+bool GetExtraFileForID(const nsAString& id, nsIFile** extraFile);
+bool GetExtraFileForMinidump(nsIFile* minidump, nsIFile** extraFile);
bool AppendExtraData(const nsAString& id, const AnnotationTable& data);
-bool AppendExtraData(nsILocalFile* extraFile, const AnnotationTable& data);
+bool AppendExtraData(nsIFile* extraFile, const AnnotationTable& data);
#ifdef XP_WIN32
nsresult WriteMinidumpForException(EXCEPTION_POINTERS* aExceptionInfo);
#endif
#ifdef XP_MACOSX
nsresult AppendObjCExceptionInfoToAppNotes(void *inException);
#endif
nsresult GetSubmitReports(bool* aSubmitReport);
nsresult SetSubmitReports(bool aSubmitReport);
// Out-of-process crash reporter API.
// Return true iff a dump was found for |childPid|, and return the
// path in |dump|. The caller owns the last reference to |dump| if it
// is non-NULL.
bool TakeMinidumpForChild(PRUint32 childPid,
- nsILocalFile** dump NS_OUTPARAM);
+ nsIFile** dump NS_OUTPARAM);
#if defined(XP_WIN)
typedef HANDLE ProcessHandle;
typedef DWORD ThreadId;
#elif defined(XP_MACOSX)
typedef task_t ProcessHandle;
typedef mach_port_t ThreadId;
#else
@@ -99,18 +99,18 @@ ThreadId CurrentThreadId();
// minidumps and a new UUID that can be used to correlate the dumps.
//
// If this function fails, it's the caller's responsibility to clean
// up |childDump| and |parentDump|. Either or both can be created and
// returned non-null on failure.
bool CreatePairedMinidumps(ProcessHandle childPid,
ThreadId childBlamedThread,
nsAString* pairGUID NS_OUTPARAM,
- nsILocalFile** childDump NS_OUTPARAM,
- nsILocalFile** parentDump NS_OUTPARAM);
+ nsIFile** childDump NS_OUTPARAM,
+ nsIFile** parentDump NS_OUTPARAM);
# if defined(XP_WIN32) || defined(XP_MACOSX)
// Parent-side API for children
const char* GetChildNotificationPipe();
// Child-side API
bool SetRemoteExceptionHandler(const nsACString& crashPipe);
--- a/toolkit/crashreporter/test/nsTestCrasher.cpp
+++ b/toolkit/crashreporter/test/nsTestCrasher.cpp
@@ -69,17 +69,17 @@ void Crash(PRInt16 how)
break;
}
default:
break;
}
}
extern "C" NS_EXPORT
-nsISupports* LockDir(nsILocalFile *directory)
+nsISupports* LockDir(nsIFile *directory)
{
nsISupports* lockfile = nsnull;
XRE_LockProfileDirectory(directory, &lockfile);
return lockfile;
}
char testData[32];
--- a/toolkit/profile/nsIToolkitProfile.idl
+++ b/toolkit/profile/nsIToolkitProfile.idl
@@ -1,40 +1,40 @@
/* -*- Mode: IDL; tab-width: 8; 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 "nsISupports.idl"
-interface nsILocalFile;
+interface nsIFile;
interface nsIToolkitProfile;
interface nsIProfileUnlocker;
/**
* Hold on to a profile lock. Once you release the last reference to this
* interface, the profile lock is released.
*/
[scriptable, uuid(7c58c703-d245-4864-8d75-9648ca4a6139)]
interface nsIProfileLock : nsISupports
{
/**
* The main profile directory.
*/
- readonly attribute nsILocalFile directory;
+ readonly attribute nsIFile directory;
/**
* A directory corresponding to the main profile directory that exists for
* the purpose of storing data on the local filesystem, including cache
* files or other data files that may not represent critical user data.
* (e.g., this directory may not be included as part of a backup scheme.)
*
* In some cases, this directory may just be the main profile directory.
*/
- readonly attribute nsILocalFile localDirectory;
+ readonly attribute nsIFile localDirectory;
/**
* The timestamp of an existing profile lock at lock time.
*/
readonly attribute PRInt64 replacedLockTime;
/**
* Unlock the profile.
@@ -48,23 +48,23 @@ interface nsIProfileLock : nsISupports
* EVEN THINK ABOUT IMPLEMENTING THIS IN JAVASCRIPT!
*/
[scriptable, uuid(7422b090-4a86-4407-972e-75468a625388)]
interface nsIToolkitProfile : nsISupports
{
/**
* The location of the profile directory.
*/
- readonly attribute nsILocalFile rootDir;
+ readonly attribute nsIFile rootDir;
/**
* The location of the profile local directory, which may be the same as
* the root directory. See nsIProfileLock::localDirectory.
*/
- readonly attribute nsILocalFile localDir;
+ readonly attribute nsIFile localDir;
/**
* The name of the profile.
*/
attribute AUTF8String name;
/**
* Removes the profile from the registry of profiles.
--- a/toolkit/profile/nsIToolkitProfileService.idl
+++ b/toolkit/profile/nsIToolkitProfileService.idl
@@ -2,17 +2,16 @@
/* 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 "nsISupports.idl"
interface nsISimpleEnumerator;
interface nsIFile;
-interface nsILocalFile;
interface nsIToolkitProfile;
interface nsIProfileLock;
[scriptable, uuid(b619f83d-8317-473c-b342-67905993fdc7)]
interface nsIToolkitProfileService : nsISupports
{
attribute boolean startWithLastProfile;
attribute boolean startOffline;
@@ -28,34 +27,34 @@ interface nsIToolkitProfileService : nsI
* @param aName The profile name to find.
*/
nsIToolkitProfile getProfileByName(in AUTF8String aName);
/**
* Lock an arbitrary path as a profile. If the path does not exist, it
* will be created and the defaults copied from the application directory.
*/
- nsIProfileLock lockProfilePath(in nsILocalFile aDirectory,
- in nsILocalFile aTempDirectory);
+ nsIProfileLock lockProfilePath(in nsIFile aDirectory,
+ in nsIFile aTempDirectory);
/**
* Create a new profile.
*
* @param aRootDir
* The profile directory. May be null, in which case a suitable
* default will be chosen based on the profile name.
* @param aTempDir
* The profile temporary directory. May be null, in which case a
* suitable default will be chosen based either on the profile name
* if aRootDir is null or aRootDir itself.
* @param aName
* The profile name.
*/
- nsIToolkitProfile createProfile(in nsILocalFile aRootDir,
- in nsILocalFile aTempDir,
+ nsIToolkitProfile createProfile(in nsIFile aRootDir,
+ in nsIFile aTempDir,
in AUTF8String aName);
/**
* Create the default profile for an application.
*
* The profile will be typically in
* {Application Data}/.profilename/{salt}.default or
* {Application Data}/.appname/{salt}.default
--- a/toolkit/profile/nsToolkitProfileService.cpp
+++ b/toolkit/profile/nsToolkitProfileService.cpp
@@ -15,17 +15,17 @@
#endif
#ifdef XP_UNIX
#include <unistd.h>
#endif
#include "nsIToolkitProfileService.h"
#include "nsIToolkitProfile.h"
#include "nsIFactory.h"
-#include "nsILocalFile.h"
+#include "nsIFile.h"
#include "nsISimpleEnumerator.h"
#ifdef XP_MACOSX
#include <CoreFoundation/CoreFoundation.h>
#include "nsILocalFileMac.h"
#endif
#include "nsAppDirectoryServiceDefs.h"
@@ -49,47 +49,47 @@ public:
friend class nsToolkitProfileService;
nsCOMPtr<nsToolkitProfile> mNext;
nsToolkitProfile *mPrev;
~nsToolkitProfile() { }
private:
nsToolkitProfile(const nsACString& aName,
- nsILocalFile* aRootDir,
- nsILocalFile* aLocalDir,
+ nsIFile* aRootDir,
+ nsIFile* aLocalDir,
nsToolkitProfile* aPrev,
bool aForExternalApp);
friend class nsToolkitProfileLock;
nsCString mName;
- nsCOMPtr<nsILocalFile> mRootDir;
- nsCOMPtr<nsILocalFile> mLocalDir;
+ nsCOMPtr<nsIFile> mRootDir;
+ nsCOMPtr<nsIFile> mLocalDir;
nsIProfileLock* mLock;
bool mForExternalApp;
};
class nsToolkitProfileLock : public nsIProfileLock
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIPROFILELOCK
nsresult Init(nsToolkitProfile* aProfile, nsIProfileUnlocker* *aUnlocker);
- nsresult Init(nsILocalFile* aDirectory, nsILocalFile* aLocalDirectory,
+ nsresult Init(nsIFile* aDirectory, nsIFile* aLocalDirectory,
nsIProfileUnlocker* *aUnlocker);
nsToolkitProfileLock() { }
~nsToolkitProfileLock();
private:
nsCOMPtr<nsToolkitProfile> mProfile;
- nsCOMPtr<nsILocalFile> mDirectory;
- nsCOMPtr<nsILocalFile> mLocalDirectory;
+ nsCOMPtr<nsIFile> mDirectory;
+ nsCOMPtr<nsIFile> mLocalDirectory;
nsProfileLock mLock;
};
class nsToolkitProfileFactory : public nsIFactory
{
public:
NS_DECL_ISUPPORTS
@@ -116,31 +116,31 @@ private:
}
~nsToolkitProfileService()
{
gService = nsnull;
}
NS_HIDDEN_(nsresult) Init();
- nsresult CreateProfileInternal(nsILocalFile* aRootDir,
- nsILocalFile* aLocalDir,
+ nsresult CreateProfileInternal(nsIFile* aRootDir,
+ nsIFile* aLocalDir,
const nsACString& aName,
const nsACString* aProfileName,
const nsACString* aAppName,
const nsACString* aVendorName,
/*in*/ nsIFile** aProfileDefaultsDir,
bool aForExternalApp,
nsIToolkitProfile** aResult);
nsRefPtr<nsToolkitProfile> mFirst;
nsCOMPtr<nsIToolkitProfile> mChosen;
- nsCOMPtr<nsILocalFile> mAppData;
- nsCOMPtr<nsILocalFile> mTempData;
- nsCOMPtr<nsILocalFile> mListFile;
+ nsCOMPtr<nsIFile> mAppData;
+ nsCOMPtr<nsIFile> mTempData;
+ nsCOMPtr<nsIFile> mListFile;
bool mDirty;
bool mStartWithLast;
bool mStartOffline;
static nsToolkitProfileService *gService;
class ProfileEnumerator : public nsISimpleEnumerator
{
@@ -152,18 +152,18 @@ private:
{ mCurrent = first; }
private:
~ProfileEnumerator() { }
nsCOMPtr<nsToolkitProfile> mCurrent;
};
};
nsToolkitProfile::nsToolkitProfile(const nsACString& aName,
- nsILocalFile* aRootDir,
- nsILocalFile* aLocalDir,
+ nsIFile* aRootDir,
+ nsIFile* aLocalDir,
nsToolkitProfile* aPrev,
bool aForExternalApp) :
mPrev(aPrev),
mName(aName),
mRootDir(aRootDir),
mLocalDir(aLocalDir),
mLock(nsnull),
mForExternalApp(aForExternalApp)
@@ -177,24 +177,24 @@ nsToolkitProfile::nsToolkitProfile(const
nsToolkitProfileService::gService->mFirst = this;
}
}
}
NS_IMPL_ISUPPORTS1(nsToolkitProfile, nsIToolkitProfile)
NS_IMETHODIMP
-nsToolkitProfile::GetRootDir(nsILocalFile* *aResult)
+nsToolkitProfile::GetRootDir(nsIFile* *aResult)
{
NS_ADDREF(*aResult = mRootDir);
return NS_OK;
}
NS_IMETHODIMP
-nsToolkitProfile::GetLocalDir(nsILocalFile* *aResult)
+nsToolkitProfile::GetLocalDir(nsIFile* *aResult)
{
NS_ADDREF(*aResult = mLocalDir);
return NS_OK;
}
NS_IMETHODIMP
nsToolkitProfile::GetName(nsACString& aResult)
{
@@ -286,45 +286,45 @@ nsToolkitProfileLock::Init(nsToolkitProf
rv = Init(aProfile->mRootDir, aProfile->mLocalDir, aUnlocker);
if (NS_SUCCEEDED(rv))
mProfile = aProfile;
return rv;
}
nsresult
-nsToolkitProfileLock::Init(nsILocalFile* aDirectory, nsILocalFile* aLocalDirectory,
+nsToolkitProfileLock::Init(nsIFile* aDirectory, nsIFile* aLocalDirectory,
nsIProfileUnlocker* *aUnlocker)
{
nsresult rv;
rv = mLock.Lock(aDirectory, aUnlocker);
if (NS_SUCCEEDED(rv)) {
mDirectory = aDirectory;
mLocalDirectory = aLocalDirectory;
}
return rv;
}
NS_IMETHODIMP
-nsToolkitProfileLock::GetDirectory(nsILocalFile* *aResult)
+nsToolkitProfileLock::GetDirectory(nsIFile* *aResult)
{
if (!mDirectory) {