From b5d2263c26a3f3629f2accc0552c2329956b680a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 22 Oct 2024 09:38:16 +0000 Subject: [PATCH] Bug 1925866 - NS_NewLocalFile's aFollowSymlinks arg is unused. r=xpcom-reviewers,necko-reviewers,valentin,media-playback-reviewers,win-reviewers,karlt,nika,rkraesig Remove it and related functions, and update the callers. Differential Revision: https://phabricator.services.mozilla.com/D226261 --- accessible/windows/msaa/Platform.cpp | 2 +- .../components/shell/nsMacShellService.cpp | 3 +- .../shell/nsWindowsShellService.cpp | 2 +- dom/base/StructuredCloneHolder.cpp | 2 +- dom/events/DataTransferItem.cpp | 3 +- dom/file/File.cpp | 2 +- dom/file/ipc/FileCreatorParent.cpp | 2 +- dom/filesystem/Directory.cpp | 2 +- dom/filesystem/FileSystemBase.cpp | 4 +- dom/filesystem/GetDirectoryListingTask.cpp | 11 ++---- dom/filesystem/GetFileOrDirectoryTask.cpp | 5 +-- dom/filesystem/GetFilesHelper.cpp | 2 +- dom/filesystem/GetFilesTask.cpp | 3 +- dom/html/HTMLInputElement.cpp | 9 ++--- dom/media/gmp/GMPChild.cpp | 7 ++-- dom/media/gmp/GMPProcessParent.cpp | 6 +-- dom/media/gmp/GMPServiceParent.cpp | 4 +- dom/quota/QuotaCommon.cpp | 3 +- .../spellcheck/hunspell/glue/mozHunspell.cpp | 5 +-- ipc/glue/GeckoChildProcessHost.cpp | 2 +- js/xpconnect/loader/URLPreloader.cpp | 4 +- js/xpconnect/src/XPCShellImpl.cpp | 7 ++-- layout/forms/nsFileControlFrame.cpp | 2 +- modules/libjar/nsJAR.cpp | 2 +- modules/libjar/nsZipArchive.cpp | 4 +- modules/libpref/Preferences.cpp | 2 +- netwerk/base/nsURLHelperOSX.cpp | 2 +- netwerk/base/nsURLHelperUnix.cpp | 2 +- netwerk/cache2/CacheFileIOManager.cpp | 2 +- netwerk/protocol/file/nsFileChannel.cpp | 7 ++-- .../protocol/file/nsFileProtocolHandler.cpp | 4 +- netwerk/protocol/http/nsHttpHandler.cpp | 4 +- .../broker/SandboxBrokerPolicyFactory.cpp | 2 +- startupcache/StartupCache.cpp | 3 +- testing/gtest/mozilla/GTestRunner.cpp | 4 +- .../contentanalysis/ContentAnalysis.cpp | 2 +- .../components/remote/WinRemoteMessage.cpp | 4 +- .../components/remote/nsUnixRemoteServer.cpp | 4 +- toolkit/components/startup/nsAppStartup.cpp | 3 +- toolkit/crashreporter/nsExceptionHandler.cpp | 7 ++-- .../extensions/AddonManagerStartup.cpp | 4 +- toolkit/profile/ProfileUnlockerWin.cpp | 3 +- toolkit/profile/nsToolkitProfileService.cpp | 14 +++---- toolkit/xre/CmdLineAndEnvUtils.cpp | 5 +-- toolkit/xre/MultiInstanceLock.cpp | 3 +- .../dllservices/DynamicBlocklistWriter.cpp | 2 +- toolkit/xre/dllservices/ModuleEvaluator.cpp | 2 +- .../xre/dllservices/UntrustedModulesData.cpp | 2 +- .../xre/dllservices/UntrustedModulesData.h | 2 +- toolkit/xre/nsAppRunner.cpp | 16 ++++---- toolkit/xre/nsXREDirProvider.cpp | 20 +++++----- tools/code-coverage/CodeCoverageHandler.cpp | 4 +- .../interface/harness/FuzzerTestHarness.h | 5 +-- .../messagemanager/MessageManagerFuzzer.cpp | 2 +- .../exthandler/nsExternalHelperAppService.cpp | 2 +- uriloader/exthandler/win/nsMIMEInfoWin.cpp | 2 +- widget/android/nsDeviceContextAndroid.cpp | 2 +- widget/cocoa/nsChildView.mm | 2 +- widget/cocoa/nsCocoaUtils.mm | 2 +- widget/cocoa/nsFilePicker.mm | 6 +-- widget/gtk/MPRISServiceHandler.cpp | 2 +- widget/gtk/nsDeviceContextSpecG.cpp | 5 +-- widget/gtk/nsDragService.cpp | 2 +- widget/gtk/nsFilePicker.cpp | 2 +- widget/gtk/nsPrintSettingsGTK.cpp | 2 +- widget/nsFilePickerProxy.cpp | 2 +- widget/windows/JumpListBuilder.cpp | 2 +- widget/windows/nsClipboard.cpp | 5 +-- widget/windows/nsDeviceContextSpecWin.cpp | 2 +- widget/windows/nsFilePicker.cpp | 8 ++-- xpcom/base/nsCycleCollector.cpp | 2 +- xpcom/base/nsDumpUtils.cpp | 5 +-- xpcom/base/nsMacUtilsImpl.cpp | 7 ++-- xpcom/base/nsMemoryInfoDumper.cpp | 2 +- xpcom/build/BinaryPath.h | 5 +-- xpcom/build/nsXPCOM.h | 12 ++---- xpcom/io/SpecialSystemDirectory.cpp | 38 +++++++++---------- xpcom/io/nsAppFileLocationProvider.cpp | 4 +- xpcom/io/nsDirectoryService.cpp | 2 +- xpcom/io/nsILocalFileMac.idl | 4 +- xpcom/io/nsLocalFileUnix.cpp | 14 +++---- xpcom/io/nsLocalFileWin.cpp | 8 ++-- xpcom/tests/RegFactory.cpp | 2 +- xpcom/tests/TestHarness.h | 5 +-- 84 files changed, 178 insertions(+), 214 deletions(-) diff --git a/accessible/windows/msaa/Platform.cpp b/accessible/windows/msaa/Platform.cpp index 146e8d69c419..a47c28b0abdb 100644 --- a/accessible/windows/msaa/Platform.cpp +++ b/accessible/windows/msaa/Platform.cpp @@ -162,7 +162,7 @@ static bool GetInstantiatorExecutable(const DWORD aPid, } nsCOMPtr file; - nsresult rv = NS_NewLocalFile(nsDependentString(buf.get(), bufLen), false, + nsresult rv = NS_NewLocalFile(nsDependentString(buf.get(), bufLen), getter_AddRefs(file)); if (NS_FAILED(rv)) { return false; diff --git a/browser/components/shell/nsMacShellService.cpp b/browser/components/shell/nsMacShellService.cpp index aeced1db8d8d..662d4b12fb63 100644 --- a/browser/components/shell/nsMacShellService.cpp +++ b/browser/components/shell/nsMacShellService.cpp @@ -224,8 +224,7 @@ nsMacShellService::OnStateChange(nsIWebProgress* aWebProgress, NS_IMETHODIMP nsMacShellService::ShowDesktopPreferences() { nsCOMPtr lf; - nsresult rv = - NS_NewNativeLocalFile(DESKTOP_PREFPANE, true, getter_AddRefs(lf)); + nsresult rv = NS_NewNativeLocalFile(DESKTOP_PREFPANE, getter_AddRefs(lf)); NS_ENSURE_SUCCESS(rv, rv); bool exists; lf->Exists(&exists); diff --git a/browser/components/shell/nsWindowsShellService.cpp b/browser/components/shell/nsWindowsShellService.cpp index 24cf842b64a3..9a9a48d32bbc 100644 --- a/browser/components/shell/nsWindowsShellService.cpp +++ b/browser/components/shell/nsWindowsShellService.cpp @@ -1734,7 +1734,7 @@ static nsresult PinCurrentAppToTaskbarImpl( return NS_ERROR_FAILURE; } nsAutoString exeStr(exePath); - nsresult rv = NS_NewLocalFile(exeStr, true, getter_AddRefs(exeFile)); + nsresult rv = NS_NewLocalFile(exeStr, getter_AddRefs(exeFile)); if (!NS_SUCCEEDED(rv)) { return NS_ERROR_FILE_NOT_FOUND; } diff --git a/dom/base/StructuredCloneHolder.cpp b/dom/base/StructuredCloneHolder.cpp index f3e2bea46bb2..463d2cdd5b5e 100644 --- a/dom/base/StructuredCloneHolder.cpp +++ b/dom/base/StructuredCloneHolder.cpp @@ -695,7 +695,7 @@ already_AddRefed ReadDirectoryInternal( } nsCOMPtr file; - nsresult rv = NS_NewLocalFile(path, true, getter_AddRefs(file)); + nsresult rv = NS_NewLocalFile(path, getter_AddRefs(file)); if (NS_WARN_IF(NS_FAILED(rv))) { return nullptr; } diff --git a/dom/events/DataTransferItem.cpp b/dom/events/DataTransferItem.cpp index 7b180b0c98e4..f3191a2d9dfb 100644 --- a/dom/events/DataTransferItem.cpp +++ b/dom/events/DataTransferItem.cpp @@ -392,8 +392,7 @@ already_AddRefed DataTransferItem::GetAsEntry( nsCOMPtr directoryFile; // fullPath is already in unicode, we don't have to use // NS_NewNativeLocalFile. - nsresult rv = - NS_NewLocalFile(fullpath, true, getter_AddRefs(directoryFile)); + nsresult rv = NS_NewLocalFile(fullpath, getter_AddRefs(directoryFile)); if (NS_WARN_IF(NS_FAILED(rv))) { return nullptr; } diff --git a/dom/file/File.cpp b/dom/file/File.cpp index 9995d35c5273..a915371060e2 100644 --- a/dom/file/File.cpp +++ b/dom/file/File.cpp @@ -181,7 +181,7 @@ already_AddRefed File::CreateFromFileName( const ChromeFilePropertyBag& aBag, SystemCallerGuarantee aGuarantee, ErrorResult& aRv) { nsCOMPtr file; - aRv = NS_NewLocalFile(aPath, false, getter_AddRefs(file)); + aRv = NS_NewLocalFile(aPath, getter_AddRefs(file)); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } diff --git a/dom/file/ipc/FileCreatorParent.cpp b/dom/file/ipc/FileCreatorParent.cpp index 77f8efd4832b..c76b37a1dda6 100644 --- a/dom/file/ipc/FileCreatorParent.cpp +++ b/dom/file/ipc/FileCreatorParent.cpp @@ -73,7 +73,7 @@ nsresult FileCreatorParent::CreateBlobImpl( MOZ_ASSERT(!NS_IsMainThread()); nsCOMPtr file; - nsresult rv = NS_NewLocalFile(aPath, true, getter_AddRefs(file)); + nsresult rv = NS_NewLocalFile(aPath, getter_AddRefs(file)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } diff --git a/dom/filesystem/Directory.cpp b/dom/filesystem/Directory.cpp index da5d6e551564..35eaf09ab760 100644 --- a/dom/filesystem/Directory.cpp +++ b/dom/filesystem/Directory.cpp @@ -50,7 +50,7 @@ already_AddRefed Directory::Constructor(const GlobalObject& aGlobal, const nsAString& aRealPath, ErrorResult& aRv) { nsCOMPtr path; - aRv = NS_NewLocalFile(aRealPath, true, getter_AddRefs(path)); + aRv = NS_NewLocalFile(aRealPath, getter_AddRefs(path)); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } diff --git a/dom/filesystem/FileSystemBase.cpp b/dom/filesystem/FileSystemBase.cpp index 776ecc9db529..c4781e698c7a 100644 --- a/dom/filesystem/FileSystemBase.cpp +++ b/dom/filesystem/FileSystemBase.cpp @@ -41,7 +41,7 @@ bool FileSystemBase::GetRealPath(BlobImpl* aFile, nsIFile** aPath) const { return false; } - rv = NS_NewLocalFile(filePath, true, aPath); + rv = NS_NewLocalFile(filePath, aPath); if (NS_WARN_IF(rv.Failed())) { rv.SuppressException(); return false; @@ -77,7 +77,7 @@ void FileSystemBase::GetDOMPath(nsIFile* aFile, nsAString& aRetval, aRetval.Truncate(); nsCOMPtr fileSystemPath; - aRv = NS_NewLocalFile(LocalRootPath(), true, getter_AddRefs(fileSystemPath)); + aRv = NS_NewLocalFile(LocalRootPath(), getter_AddRefs(fileSystemPath)); if (NS_WARN_IF(aRv.Failed())) { return; } diff --git a/dom/filesystem/GetDirectoryListingTask.cpp b/dom/filesystem/GetDirectoryListingTask.cpp index 9ac3dc9bbf2b..08978d955c20 100644 --- a/dom/filesystem/GetDirectoryListingTask.cpp +++ b/dom/filesystem/GetDirectoryListingTask.cpp @@ -135,7 +135,7 @@ void GetDirectoryListingTaskChild::SetSuccessRequestResult( data.get_FileSystemDirectoryListingResponseDirectory(); nsCOMPtr path; - aRv = NS_NewLocalFile(d.directoryRealPath(), true, getter_AddRefs(path)); + aRv = NS_NewLocalFile(d.directoryRealPath(), getter_AddRefs(path)); if (NS_WARN_IF(aRv.Failed())) { return; } @@ -184,8 +184,7 @@ GetDirectoryListingTaskParent::Create( RefPtr task = new GetDirectoryListingTaskParent(aFileSystem, aParam, aParent); - aRv = NS_NewLocalFile(aParam.realPath(), true, - getter_AddRefs(task->mTargetPath)); + aRv = NS_NewLocalFile(aParam.realPath(), getter_AddRefs(task->mTargetPath)); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } @@ -214,8 +213,7 @@ FileSystemResponseValue GetDirectoryListingTaskParent::GetSuccessRequestResult( for (unsigned i = 0; i < mTargetData.Length(); i++) { if (mTargetData[i].mType == FileOrDirectoryPath::eFilePath) { nsCOMPtr path; - nsresult rv = - NS_NewLocalFile(mTargetData[i].mPath, true, getter_AddRefs(path)); + nsresult rv = NS_NewLocalFile(mTargetData[i].mPath, getter_AddRefs(path)); if (NS_WARN_IF(NS_FAILED(rv))) { continue; } @@ -393,8 +391,7 @@ nsresult GetDirectoryListingTaskParent::MainThreadWork() { } nsCOMPtr file; - nsresult rv = - NS_NewLocalFile(mTargetData[i].mPath, true, getter_AddRefs(file)); + nsresult rv = NS_NewLocalFile(mTargetData[i].mPath, getter_AddRefs(file)); if (NS_WARN_IF(NS_FAILED(rv))) { continue; } diff --git a/dom/filesystem/GetFileOrDirectoryTask.cpp b/dom/filesystem/GetFileOrDirectoryTask.cpp index 7f7d1c2816b7..1a69044bf46b 100644 --- a/dom/filesystem/GetFileOrDirectoryTask.cpp +++ b/dom/filesystem/GetFileOrDirectoryTask.cpp @@ -103,7 +103,7 @@ void GetFileOrDirectoryTaskChild::SetSuccessRequestResult( FileSystemDirectoryResponse r = aValue; nsCOMPtr file; - aRv = NS_NewLocalFile(r.realPath(), true, getter_AddRefs(file)); + aRv = NS_NewLocalFile(r.realPath(), getter_AddRefs(file)); if (NS_WARN_IF(aRv.Failed())) { return; } @@ -163,8 +163,7 @@ GetFileOrDirectoryTaskParent::Create( RefPtr task = new GetFileOrDirectoryTaskParent(aFileSystem, aParam, aParent); - aRv = NS_NewLocalFile(aParam.realPath(), true, - getter_AddRefs(task->mTargetPath)); + aRv = NS_NewLocalFile(aParam.realPath(), getter_AddRefs(task->mTargetPath)); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } diff --git a/dom/filesystem/GetFilesHelper.cpp b/dom/filesystem/GetFilesHelper.cpp index 5c91b4cfe59b..c57cd3a96996 100644 --- a/dom/filesystem/GetFilesHelper.cpp +++ b/dom/filesystem/GetFilesHelper.cpp @@ -238,7 +238,7 @@ void GetFilesHelper::RunIO() { MOZ_ASSERT(!mListingCompleted); nsCOMPtr file; - mErrorResult = NS_NewLocalFile(mDirectoryPath, true, getter_AddRefs(file)); + mErrorResult = NS_NewLocalFile(mDirectoryPath, getter_AddRefs(file)); if (NS_WARN_IF(NS_FAILED(mErrorResult))) { return; } diff --git a/dom/filesystem/GetFilesTask.cpp b/dom/filesystem/GetFilesTask.cpp index 280df0b0bcee..dfca1ee83423 100644 --- a/dom/filesystem/GetFilesTask.cpp +++ b/dom/filesystem/GetFilesTask.cpp @@ -155,8 +155,7 @@ already_AddRefed GetFilesTaskParent::Create( RefPtr task = new GetFilesTaskParent(aFileSystem, aParam, aParent); - aRv = NS_NewLocalFile(aParam.realPath(), true, - getter_AddRefs(task->mTargetPath)); + aRv = NS_NewLocalFile(aParam.realPath(), getter_AddRefs(task->mTargetPath)); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index a3f7f0907098..d87551489a8a 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -397,7 +397,7 @@ static already_AddRefed LastUsedDirectory( } nsCOMPtr localFile; - nsresult rv = NS_NewLocalFile(path, true, getter_AddRefs(localFile)); + nsresult rv = NS_NewLocalFile(path, getter_AddRefs(localFile)); if (NS_WARN_IF(NS_FAILED(rv))) { return nullptr; } @@ -2164,7 +2164,7 @@ void HTMLInputElement::MozSetFileNameArray(const Sequence& aFileNames, if (!file) { // this is no "file://", try as local file - NS_NewLocalFile(aFileNames[i], false, getter_AddRefs(file)); + NS_NewLocalFile(aFileNames[i], getter_AddRefs(file)); } if (!file) { @@ -2197,7 +2197,7 @@ void HTMLInputElement::MozSetDirectory(const nsAString& aDirectoryPath, } nsCOMPtr file; - aRv = NS_NewLocalFile(aDirectoryPath, true, getter_AddRefs(file)); + aRv = NS_NewLocalFile(aDirectoryPath, getter_AddRefs(file)); if (NS_WARN_IF(aRv.Failed())) { return; } @@ -6285,8 +6285,7 @@ static nsTArray RestoreFileContentData( } else { MOZ_ASSERT(it.type() == FileContentData::TnsString); nsCOMPtr file; - nsresult rv = - NS_NewLocalFile(it.get_nsString(), true, getter_AddRefs(file)); + nsresult rv = NS_NewLocalFile(it.get_nsString(), getter_AddRefs(file)); if (NS_WARN_IF(NS_FAILED(rv))) { continue; } diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp index 4fc0ce30391e..acd833a11ad6 100644 --- a/dom/media/gmp/GMPChild.cpp +++ b/dom/media/gmp/GMPChild.cpp @@ -253,7 +253,7 @@ bool GMPChild::GetUTF8LibPath(nsACString& aOutLibPath) { MOZ_CRASH(explain); \ } while (false) - nsresult rv = NS_NewLocalFile(mPluginPath, true, getter_AddRefs(libFile)); + nsresult rv = NS_NewLocalFile(mPluginPath, getter_AddRefs(libFile)); if (NS_WARN_IF(NS_FAILED(rv))) { GMP_PATH_CRASH("Failed to create file for plugin path"); return false; @@ -310,7 +310,7 @@ bool GMPChild::GetUTF8LibPath(nsACString& aOutLibPath) { bool GMPChild::GetPluginName(nsACString& aPluginName) const { // Extract the plugin directory name if possible. nsCOMPtr libFile; - nsresult rv = NS_NewLocalFile(mPluginPath, true, getter_AddRefs(libFile)); + nsresult rv = NS_NewLocalFile(mPluginPath, getter_AddRefs(libFile)); NS_ENSURE_SUCCESS(rv, false); nsCOMPtr parent; @@ -463,8 +463,7 @@ GMPChild::MakeCDMHostVerificationPaths(const nsACString& aPluginLibPath) { CopyUTF8toUTF16(nsDependentCString(pluginContainer.c_str()), str); nsCOMPtr path; - if (NS_FAILED(NS_NewLocalFile(str, true, /* aFollowLinks */ - getter_AddRefs(path))) || + if (NS_FAILED(NS_NewLocalFile(str, getter_AddRefs(path))) || !AppendHostPath(path, paths)) { // Without successfully determining plugin-container's path, we can't // determine libxul's or Firefox's. So give up. diff --git a/dom/media/gmp/GMPProcessParent.cpp b/dom/media/gmp/GMPProcessParent.cpp index f02dca8f2375..ac34897abbb3 100644 --- a/dom/media/gmp/GMPProcessParent.cpp +++ b/dom/media/gmp/GMPProcessParent.cpp @@ -277,7 +277,7 @@ bool GMPProcessParent::FillMacSandboxInfo(MacSandboxInfo& aInfo) { "plugin dir path: %s", mGMPPath.c_str()); nsCOMPtr pluginDir; - nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(mGMPPath.c_str()), true, + nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(mGMPPath.c_str()), getter_AddRefs(pluginDir)); if (NS_FAILED(rv)) { GMP_LOG_DEBUG( @@ -347,8 +347,8 @@ bool GMPProcessParent::FillMacSandboxInfo(MacSandboxInfo& aInfo) { nsresult GMPProcessParent::NormalizePath(const char* aPath, PathString& aNormalizedPath) { nsCOMPtr fileOrDir; - nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(aPath), true, - getter_AddRefs(fileOrDir)); + nsresult rv = + NS_NewLocalFile(NS_ConvertUTF8toUTF16(aPath), getter_AddRefs(fileOrDir)); NS_ENSURE_SUCCESS(rv, rv); rv = fileOrDir->Normalize(); diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp index 122f229bba2e..fd6539576666 100644 --- a/dom/media/gmp/GMPServiceParent.cpp +++ b/dom/media/gmp/GMPServiceParent.cpp @@ -1068,7 +1068,7 @@ RefPtr GeckoMediaPluginServiceParent::AddOnGMPThread( GMP_LOG_DEBUG("%s::%s: %s", __CLASS__, __FUNCTION__, dir.get()); nsCOMPtr directory; - nsresult rv = NS_NewLocalFile(aDirectory, false, getter_AddRefs(directory)); + nsresult rv = NS_NewLocalFile(aDirectory, getter_AddRefs(directory)); if (NS_WARN_IF(NS_FAILED(rv))) { GMP_LOG_DEBUG("%s::%s: failed to create nsIFile for dir=%s rv=%" PRIx32, __CLASS__, __FUNCTION__, dir.get(), @@ -1110,7 +1110,7 @@ void GeckoMediaPluginServiceParent::RemoveOnGMPThread( NS_LossyConvertUTF16toASCII(aDirectory).get()); nsCOMPtr directory; - nsresult rv = NS_NewLocalFile(aDirectory, false, getter_AddRefs(directory)); + nsresult rv = NS_NewLocalFile(aDirectory, getter_AddRefs(directory)); if (NS_WARN_IF(NS_FAILED(rv))) { return; } diff --git a/dom/quota/QuotaCommon.cpp b/dom/quota/QuotaCommon.cpp index 5f4883ea3b9e..c91299053a66 100644 --- a/dom/quota/QuotaCommon.cpp +++ b/dom/quota/QuotaCommon.cpp @@ -135,8 +135,7 @@ void CacheUseDOSDevicePathSyntaxPrefValue() { Result, nsresult> QM_NewLocalFile(const nsAString& aPath) { QM_TRY_UNWRAP( auto file, - MOZ_TO_RESULT_INVOKE_TYPED(nsCOMPtr, NS_NewLocalFile, aPath, - /* aFollowLinks */ false), + MOZ_TO_RESULT_INVOKE_TYPED(nsCOMPtr, NS_NewLocalFile, aPath), QM_PROPAGATE, [&aPath](const nsresult rv) { QM_WARNING("Failed to construct a file for path (%s)", NS_ConvertUTF16toUTF8(aPath).get()); diff --git a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp index 1c6a60ae8150..cf2d6ca7f2de 100644 --- a/extensions/spellcheck/hunspell/glue/mozHunspell.cpp +++ b/extensions/spellcheck/hunspell/glue/mozHunspell.cpp @@ -243,7 +243,7 @@ void mozHunspell::LoadDictionaryList(bool aNotifyChildProcesses) { rv = prefs->GetCharPref("spellchecker.dictionary_path", extDictPath); if (NS_SUCCEEDED(rv)) { // set the spellchecker.dictionary_path - rv = NS_NewNativeLocalFile(extDictPath, true, getter_AddRefs(dictDir)); + rv = NS_NewNativeLocalFile(extDictPath, getter_AddRefs(dictDir)); } if (dictDir) { LoadDictionariesFromDir(dictDir); @@ -262,8 +262,7 @@ void mozHunspell::LoadDictionaryList(bool aNotifyChildProcesses) { char* nextPaths = env.BeginWriting(); while ((currPath = NS_strtok(":", &nextPaths))) { nsCOMPtr dir; - rv = - NS_NewNativeLocalFile(nsCString(currPath), true, getter_AddRefs(dir)); + rv = NS_NewNativeLocalFile(nsCString(currPath), getter_AddRefs(dir)); if (NS_SUCCEEDED(rv)) { dirs.AppendElement(dir); } diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp index 9ef59b50237e..9b3e68d3e13b 100644 --- a/ipc/glue/GeckoChildProcessHost.cpp +++ b/ipc/glue/GeckoChildProcessHost.cpp @@ -546,7 +546,7 @@ mozilla::BinPathType BaseProcessLauncher::GetPathToBinary( exePath = FilePath(char16ptr_t(gGREBinPath)); #elif MOZ_WIDGET_COCOA nsCOMPtr childProcPath; - NS_NewLocalFile(nsDependentString(gGREBinPath), false, + NS_NewLocalFile(nsDependentString(gGREBinPath), getter_AddRefs(childProcPath)); // We need to use an App Bundle on OS X so that we can hide diff --git a/js/xpconnect/loader/URLPreloader.cpp b/js/xpconnect/loader/URLPreloader.cpp index ad7354e5a0ff..413ce3cfc1f2 100644 --- a/js/xpconnect/loader/URLPreloader.cpp +++ b/js/xpconnect/loader/URLPreloader.cpp @@ -630,8 +630,8 @@ size_t URLPreloader::ShallowSizeOfIncludingThis( Result URLPreloader::CacheKey::ToFileLocation() { if (mType == TypeFile) { nsCOMPtr file; - MOZ_TRY(NS_NewLocalFile(NS_ConvertUTF8toUTF16(mPath), false, - getter_AddRefs(file))); + MOZ_TRY( + NS_NewLocalFile(NS_ConvertUTF8toUTF16(mPath), getter_AddRefs(file))); return FileLocation(file); } diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp index b601acba8b08..efdb676fe87e 100644 --- a/js/xpconnect/src/XPCShellImpl.cpp +++ b/js/xpconnect/src/XPCShellImpl.cpp @@ -181,8 +181,7 @@ static bool GetLocationProperty(JSContext* cx, unsigned argc, Value* vp) { # endif nsCOMPtr location; - nsresult rv = - NS_NewLocalFile(filenameString, false, getter_AddRefs(location)); + nsresult rv = NS_NewLocalFile(filenameString, getter_AddRefs(location)); if (!location && gWorkingDirectory) { // could be a relative path, try appending it to the cwd @@ -190,7 +189,7 @@ static bool GetLocationProperty(JSContext* cx, unsigned argc, Value* vp) { nsAutoString absolutePath(*gWorkingDirectory); absolutePath.Append(filenameString); - rv = NS_NewLocalFile(absolutePath, false, getter_AddRefs(location)); + rv = NS_NewLocalFile(absolutePath, getter_AddRefs(location)); } if (location) { @@ -1152,7 +1151,7 @@ int XRE_XPCShellMain(int argc, char** argv, char** envp, printf("GetCurrentWorkingDirectory failed.\n"); return 1; } - rv = NS_NewLocalFile(workingDir, true, getter_AddRefs(greDir)); + rv = NS_NewLocalFile(workingDir, getter_AddRefs(greDir)); if (NS_FAILED(rv)) { printf("NS_NewLocalFile failed.\n"); return 1; diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp index 9cf454347200..d3afe464e27f 100644 --- a/layout/forms/nsFileControlFrame.cpp +++ b/layout/forms/nsFileControlFrame.cpp @@ -179,7 +179,7 @@ static void AppendBlobImplAsDirectory(nsTArray& aArray, } nsCOMPtr file; - nsresult rv = NS_NewLocalFile(fullpath, true, getter_AddRefs(file)); + nsresult rv = NS_NewLocalFile(fullpath, getter_AddRefs(file)); if (NS_WARN_IF(NS_FAILED(rv))) { return; } diff --git a/modules/libjar/nsJAR.cpp b/modules/libjar/nsJAR.cpp index 87d93b8268dc..bc4131907059 100644 --- a/modules/libjar/nsJAR.cpp +++ b/modules/libjar/nsJAR.cpp @@ -861,7 +861,7 @@ nsZipReaderCache::Observe(nsISupports* aSubject, const char* aTopic, file = do_QueryInterface(aSubject); } else if (aSomeData) { nsDependentString fileName(aSomeData); - Unused << NS_NewLocalFile(fileName, false, getter_AddRefs(file)); + Unused << NS_NewLocalFile(fileName, getter_AddRefs(file)); } if (!file) return NS_OK; diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index 2d845f25f0a1..cf894dc9d1e6 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -97,8 +97,8 @@ class ZipArchiveLogger { if (!mFd) { nsCOMPtr logFile; - nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(env), false, - getter_AddRefs(logFile)); + nsresult rv = + NS_NewLocalFile(NS_ConvertUTF8toUTF16(env), getter_AddRefs(logFile)); if (NS_FAILED(rv)) return; // Create the log file and its parent directory (in case it doesn't exist) diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp index eb0de8908a0f..cb30b8358453 100644 --- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp @@ -2568,7 +2568,7 @@ nsPrefBranch::GetComplexValue(const char* aPrefName, const nsIID& aType, } nsCOMPtr theFile; - rv = NS_NewNativeLocalFile(""_ns, true, getter_AddRefs(theFile)); + rv = NS_NewNativeLocalFile(""_ns, getter_AddRefs(theFile)); if (NS_FAILED(rv)) { return rv; } diff --git a/netwerk/base/nsURLHelperOSX.cpp b/netwerk/base/nsURLHelperOSX.cpp index 9a8fbad9a241..e8b73ac09b8e 100644 --- a/netwerk/base/nsURLHelperOSX.cpp +++ b/netwerk/base/nsURLHelperOSX.cpp @@ -143,7 +143,7 @@ nsresult net_GetFileFromURLSpec(const nsACString& aURL, nsIFile** result) { nsresult rv; nsCOMPtr localFile; - rv = NS_NewNativeLocalFile(""_ns, true, getter_AddRefs(localFile)); + rv = NS_NewNativeLocalFile(""_ns, getter_AddRefs(localFile)); if (NS_FAILED(rv)) return rv; nsAutoCString directory, fileBaseName, fileExtension, path; diff --git a/netwerk/base/nsURLHelperUnix.cpp b/netwerk/base/nsURLHelperUnix.cpp index abb8b0cfeb54..c1720ba77e50 100644 --- a/netwerk/base/nsURLHelperUnix.cpp +++ b/netwerk/base/nsURLHelperUnix.cpp @@ -57,7 +57,7 @@ nsresult net_GetFileFromURLSpec(const nsACString& aURL, nsIFile** result) { nsresult rv; nsCOMPtr localFile; - rv = NS_NewNativeLocalFile(""_ns, true, getter_AddRefs(localFile)); + rv = NS_NewNativeLocalFile(""_ns, getter_AddRefs(localFile)); if (NS_FAILED(rv)) return rv; nsAutoCString directory, fileBaseName, fileExtension, path; diff --git a/netwerk/cache2/CacheFileIOManager.cpp b/netwerk/cache2/CacheFileIOManager.cpp index c697d015938d..97bac8315102 100644 --- a/netwerk/cache2/CacheFileIOManager.cpp +++ b/netwerk/cache2/CacheFileIOManager.cpp @@ -1311,7 +1311,7 @@ nsresult CacheFileIOManager::OnProfile() { nsCOMPtr profilelessDirectory; char* cachePath = getenv("CACHE_DIRECTORY"); if (!directory && cachePath && *cachePath) { - rv = NS_NewNativeLocalFile(nsDependentCString(cachePath), true, + rv = NS_NewNativeLocalFile(nsDependentCString(cachePath), getter_AddRefs(directory)); if (NS_SUCCEEDED(rv)) { // Save this directory as the profileless path. diff --git a/netwerk/protocol/file/nsFileChannel.cpp b/netwerk/protocol/file/nsFileChannel.cpp index f6a4d0b79d7e..724581911f98 100644 --- a/netwerk/protocol/file/nsFileChannel.cpp +++ b/netwerk/protocol/file/nsFileChannel.cpp @@ -262,12 +262,11 @@ nsresult nsFileChannel::Init() { NS_SUCCEEDED(file->IsSymlink(&symLink)) && symLink && #ifdef XP_WIN NS_SUCCEEDED(file->GetTarget(fileTarget)) && - NS_SUCCEEDED( - NS_NewLocalFile(fileTarget, true, getter_AddRefs(resolvedFile))) && + NS_SUCCEEDED(NS_NewLocalFile(fileTarget, getter_AddRefs(resolvedFile))) && #else NS_SUCCEEDED(file->GetNativeTarget(fileTarget)) && - NS_SUCCEEDED(NS_NewNativeLocalFile(fileTarget, true, - getter_AddRefs(resolvedFile))) && + NS_SUCCEEDED( + NS_NewNativeLocalFile(fileTarget, getter_AddRefs(resolvedFile))) && #endif NS_SUCCEEDED( NS_NewFileURI(getter_AddRefs(targetURI), resolvedFile, nullptr))) { diff --git a/netwerk/protocol/file/nsFileProtocolHandler.cpp b/netwerk/protocol/file/nsFileProtocolHandler.cpp index 10a1b9c0295f..f43e4e8e818d 100644 --- a/netwerk/protocol/file/nsFileProtocolHandler.cpp +++ b/netwerk/protocol/file/nsFileProtocolHandler.cpp @@ -151,8 +151,8 @@ nsFileProtocolHandler::ReadShellLink(nsIFile* aFile, nsIURI** aURI) { return NS_ERROR_FAILURE; } nsCOMPtr linkedFile; - MOZ_TRY(NS_NewLocalFile(nsDependentString(lpTemp), false, - getter_AddRefs(linkedFile))); + MOZ_TRY( + NS_NewLocalFile(nsDependentString(lpTemp), getter_AddRefs(linkedFile))); return NS_NewFileURI(aURI, linkedFile); #else return NS_ERROR_NOT_AVAILABLE; diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index 1249db61d153..5a35fdff6b34 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -1944,8 +1944,8 @@ void nsHttpHandler::PrefsChanged(const char* pref) { nsCOMPtr qlogDir; if (Preferences::GetBool(HTTP_PREF("http3.enable_qlog")) && !mHttp3QlogDir.IsEmpty() && - NS_SUCCEEDED(NS_NewNativeLocalFile(mHttp3QlogDir, false, - getter_AddRefs(qlogDir)))) { + NS_SUCCEEDED( + NS_NewNativeLocalFile(mHttp3QlogDir, getter_AddRefs(qlogDir)))) { // Here we do main thread IO, but since this only happens // when enabling a developer feature it's not a problem for users. rv = qlogDir->Create(nsIFile::DIRECTORY_TYPE, 0755); diff --git a/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp b/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp index dc6b9261b8eb..88f3c9d97a94 100644 --- a/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp +++ b/security/sandbox/linux/broker/SandboxBrokerPolicyFactory.cpp @@ -556,7 +556,7 @@ void SandboxBrokerPolicyFactory::InitContentPolicy() { // GetSpecialSystemDirectory(Unix_XDG_ConfigHome) ? nsCOMPtr confDirOrXDGConfigHomeDir; if (!xdgConfigHome.IsEmpty()) { - rv = NS_NewNativeLocalFile(xdgConfigHome, true, + rv = NS_NewNativeLocalFile(xdgConfigHome, getter_AddRefs(confDirOrXDGConfigHomeDir)); // confDirOrXDGConfigHomeDir = nsIFile($XDG_CONFIG_HOME) } else { diff --git a/startupcache/StartupCache.cpp b/startupcache/StartupCache.cpp index 9c066a195123..c63949b07df4 100644 --- a/startupcache/StartupCache.cpp +++ b/startupcache/StartupCache.cpp @@ -186,8 +186,7 @@ nsresult StartupCache::Init() { // cache in. char* env = PR_GetEnv("MOZ_STARTUP_CACHE"); if (env && *env) { - rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(env), false, - getter_AddRefs(mFile)); + rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(env), getter_AddRefs(mFile)); } else { nsCOMPtr file; rv = NS_GetSpecialDirectory("ProfLDS", getter_AddRefs(file)); diff --git a/testing/gtest/mozilla/GTestRunner.cpp b/testing/gtest/mozilla/GTestRunner.cpp index b899d9348374..bebf0a88efde 100644 --- a/testing/gtest/mozilla/GTestRunner.cpp +++ b/testing/gtest/mozilla/GTestRunner.cpp @@ -138,8 +138,8 @@ int RunGTestFunc(int* argc, char** argv) { char* path = PR_GetEnv("MOZ_GTEST_MINIDUMPS_PATH"); nsCOMPtr file; if (path) { - nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(path), true, - getter_AddRefs(file)); + nsresult rv = + NS_NewLocalFile(NS_ConvertUTF8toUTF16(path), getter_AddRefs(file)); if (NS_FAILED(rv)) { printf_stderr("Ignoring invalid MOZ_GTEST_MINIDUMPS_PATH\n"); } diff --git a/toolkit/components/contentanalysis/ContentAnalysis.cpp b/toolkit/components/contentanalysis/ContentAnalysis.cpp index 50237c442833..e716f66a624c 100644 --- a/toolkit/components/contentanalysis/ContentAnalysis.cpp +++ b/toolkit/components/contentanalysis/ContentAnalysis.cpp @@ -1674,7 +1674,7 @@ ContentAnalysis::MaybeExpandAndAnalyzeFolderContentRequest( #endif RefPtr file; - rv = NS_NewLocalFile(filename, false, getter_AddRefs(file)); + rv = NS_NewLocalFile(filename, getter_AddRefs(file)); NS_ENSURE_SUCCESS(rv, Err(rv)); bool exists; diff --git a/toolkit/components/remote/WinRemoteMessage.cpp b/toolkit/components/remote/WinRemoteMessage.cpp index 456d31c0be27..5f286944a709 100644 --- a/toolkit/components/remote/WinRemoteMessage.cpp +++ b/toolkit/components/remote/WinRemoteMessage.cpp @@ -39,7 +39,7 @@ nsresult WinRemoteMessageReceiver::ParseV2(const nsAString& aBuffer) { nsCOMPtr workingDir; if (cch < aBuffer.Length()) { - NS_NewLocalFile(Substring(aBuffer, cch), false, getter_AddRefs(workingDir)); + NS_NewLocalFile(Substring(aBuffer, cch), getter_AddRefs(workingDir)); } int argc = parser.Argc(); @@ -79,7 +79,7 @@ nsresult WinRemoteMessageReceiver::ParseV3(const nsACString& aBuffer) { } nsresult rv = NS_NewLocalFile( - NS_ConvertUTF8toUTF16(Substring(aBuffer, pos, nextNul - pos)), false, + NS_ConvertUTF8toUTF16(Substring(aBuffer, pos, nextNul - pos)), getter_AddRefs(workingDir)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/toolkit/components/remote/nsUnixRemoteServer.cpp b/toolkit/components/remote/nsUnixRemoteServer.cpp index bf4a018e47ec..aaeb30cb000b 100644 --- a/toolkit/components/remote/nsUnixRemoteServer.cpp +++ b/toolkit/components/remote/nsUnixRemoteServer.cpp @@ -81,8 +81,8 @@ const char* nsUnixRemoteServer::HandleCommandLine( const char* workingDir = aBuffer.data() + offsetFilelist; nsCOMPtr lf; - nsresult rv = NS_NewNativeLocalFile(nsDependentCString(workingDir), true, - getter_AddRefs(lf)); + nsresult rv = + NS_NewNativeLocalFile(nsDependentCString(workingDir), getter_AddRefs(lf)); if (NS_FAILED(rv)) { return "509 internal error"; } diff --git a/toolkit/components/startup/nsAppStartup.cpp b/toolkit/components/startup/nsAppStartup.cpp index 76d85f007ba2..9297e5eacd65 100644 --- a/toolkit/components/startup/nsAppStartup.cpp +++ b/toolkit/components/startup/nsAppStartup.cpp @@ -1070,8 +1070,7 @@ nsAppStartup::CreateInstanceWithProfile(nsIToolkitProfile* aProfile) { } nsCOMPtr execPath; - nsresult rv = - NS_NewLocalFile(gAbsoluteArgv0Path, true, getter_AddRefs(execPath)); + nsresult rv = NS_NewLocalFile(gAbsoluteArgv0Path, getter_AddRefs(execPath)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } diff --git a/toolkit/crashreporter/nsExceptionHandler.cpp b/toolkit/crashreporter/nsExceptionHandler.cpp index 14334dbecc0f..be6106555ba8 100644 --- a/toolkit/crashreporter/nsExceptionHandler.cpp +++ b/toolkit/crashreporter/nsExceptionHandler.cpp @@ -416,7 +416,7 @@ static inline void my_u64tostring(uint64_t aValue, char* aBuffer, #ifdef XP_WIN static void CreateFileFromPath(const xpstring& path, nsIFile** file) { - NS_NewLocalFile(nsDependentString(path.c_str()), false, file); + NS_NewLocalFile(nsDependentString(path.c_str()), file); } static std::optional CreatePathFromFile(nsIFile* file) { @@ -429,7 +429,7 @@ static std::optional CreatePathFromFile(nsIFile* file) { } #else static void CreateFileFromPath(const xpstring& path, nsIFile** file) { - NS_NewNativeLocalFile(nsDependentCString(path.c_str()), false, file); + NS_NewNativeLocalFile(nsDependentCString(path.c_str()), file); } MAYBE_UNUSED static std::optional CreatePathFromFile(nsIFile* file) { @@ -2834,8 +2834,7 @@ static void SetCrashEventsDir(nsIFile* aDir) { const char* env = PR_GetEnv("CRASHES_EVENTS_DIR"); if (env && *env) { - NS_NewNativeLocalFile(nsDependentCString(env), false, - getter_AddRefs(eventsDir)); + NS_NewNativeLocalFile(nsDependentCString(env), getter_AddRefs(eventsDir)); EnsureDirectoryExists(eventsDir); } diff --git a/toolkit/mozapps/extensions/AddonManagerStartup.cpp b/toolkit/mozapps/extensions/AddonManagerStartup.cpp index 8c402a09e56d..a2201cd65656 100644 --- a/toolkit/mozapps/extensions/AddonManagerStartup.cpp +++ b/toolkit/mozapps/extensions/AddonManagerStartup.cpp @@ -428,12 +428,12 @@ Result, nsresult> Addon::FullPath() { // First check for an absolute path, in case we have a proxy file. nsCOMPtr file; - if (NS_SUCCEEDED(NS_NewLocalFile(path, false, getter_AddRefs(file)))) { + if (NS_SUCCEEDED(NS_NewLocalFile(path, getter_AddRefs(file)))) { return std::move(file); } // If not an absolute path, fall back to a relative path from the location. - MOZ_TRY(NS_NewLocalFile(mLocation.Path(), false, getter_AddRefs(file))); + MOZ_TRY(NS_NewLocalFile(mLocation.Path(), getter_AddRefs(file))); MOZ_TRY(file->AppendRelativePath(path)); return std::move(file); diff --git a/toolkit/profile/ProfileUnlockerWin.cpp b/toolkit/profile/ProfileUnlockerWin.cpp index d7ab5e0a307f..238013feebb6 100644 --- a/toolkit/profile/ProfileUnlockerWin.cpp +++ b/toolkit/profile/ProfileUnlockerWin.cpp @@ -200,7 +200,6 @@ nsresult ProfileUnlockerWin::TryToTerminate(RM_UNIQUE_PROCESS& aProcess) { } nsCOMPtr otherProcessImageName; if (NS_FAILED(NS_NewLocalFile(nsDependentString(imageName, imageNameLen), - false, getter_AddRefs(otherProcessImageName)))) { return NS_ERROR_FAILURE; } @@ -216,7 +215,7 @@ nsresult ProfileUnlockerWin::TryToTerminate(RM_UNIQUE_PROCESS& aProcess) { } nsCOMPtr thisProcessImageName; if (NS_FAILED(NS_NewLocalFile(nsDependentString(imageName, imageNameLen), - false, getter_AddRefs(thisProcessImageName)))) { + getter_AddRefs(thisProcessImageName)))) { return NS_ERROR_FAILURE; } nsAutoString thisProcessLeafName; diff --git a/toolkit/profile/nsToolkitProfileService.cpp b/toolkit/profile/nsToolkitProfileService.cpp index a340ccd7c063..4915a2fc886c 100644 --- a/toolkit/profile/nsToolkitProfileService.cpp +++ b/toolkit/profile/nsToolkitProfileService.cpp @@ -753,7 +753,7 @@ bool nsToolkitProfileService::IsProfileForCurrentInstall( } nsCOMPtr lastGreDir; - rv = NS_NewNativeLocalFile(""_ns, false, getter_AddRefs(lastGreDir)); + rv = NS_NewNativeLocalFile(""_ns, getter_AddRefs(lastGreDir)); NS_ENSURE_SUCCESS(rv, false); rv = lastGreDir->SetPersistentDescriptor(lastGreDirStr); @@ -1117,7 +1117,7 @@ nsresult nsToolkitProfileService::Init() { } nsCOMPtr rootDir; - rv = NS_NewNativeLocalFile(""_ns, true, getter_AddRefs(rootDir)); + rv = NS_NewNativeLocalFile(""_ns, getter_AddRefs(rootDir)); NS_ENSURE_SUCCESS(rv, rv); if (isRelative) { @@ -1615,7 +1615,7 @@ nsresult nsToolkitProfileService::SelectStartupProfile( nsCOMPtr profile; if (delim) { nsCOMPtr lf; - rv = NS_NewNativeLocalFile(nsDependentCString(delim + 1), true, + rv = NS_NewNativeLocalFile(nsDependentCString(delim + 1), getter_AddRefs(lf)); if (NS_FAILED(rv)) { PR_fprintf(PR_STDERR, "Error: profile path not valid.\n"); @@ -2678,7 +2678,7 @@ nsresult nsToolkitProfileService::GetLocalDirFromRootDir(nsIFile* aRootDir, nsCOMPtr localDir; if (isRelative) { - rv = NS_NewNativeLocalFile(""_ns, true, getter_AddRefs(localDir)); + rv = NS_NewNativeLocalFile(""_ns, getter_AddRefs(localDir)); NS_ENSURE_SUCCESS(rv, rv); rv = localDir->SetRelativeDescriptor( @@ -2717,7 +2717,7 @@ nsresult XRE_GetFileFromPath(const char* aPath, nsIFile** aResult) { if (!fullPath) return NS_ERROR_FAILURE; nsCOMPtr lf; - nsresult rv = NS_NewNativeLocalFile(""_ns, true, getter_AddRefs(lf)); + nsresult rv = NS_NewNativeLocalFile(""_ns, getter_AddRefs(lf)); if (NS_SUCCEEDED(rv)) { nsCOMPtr lfMac = do_QueryInterface(lf, &rv); if (NS_SUCCEEDED(rv)) { @@ -2735,14 +2735,14 @@ nsresult XRE_GetFileFromPath(const char* aPath, nsIFile** aResult) { if (!realpath(aPath, fullPath)) return NS_ERROR_FAILURE; - return NS_NewNativeLocalFile(nsDependentCString(fullPath), true, aResult); + return NS_NewNativeLocalFile(nsDependentCString(fullPath), aResult); #elif defined(XP_WIN) WCHAR fullPath[MAXPATHLEN]; if (!_wfullpath(fullPath, NS_ConvertUTF8toUTF16(aPath).get(), MAXPATHLEN)) return NS_ERROR_FAILURE; - return NS_NewLocalFile(nsDependentString(fullPath), true, aResult); + return NS_NewLocalFile(nsDependentString(fullPath), aResult); #else # error Platform-specific logic needed here. diff --git a/toolkit/xre/CmdLineAndEnvUtils.cpp b/toolkit/xre/CmdLineAndEnvUtils.cpp index 634071bc9001..2641644b3b06 100644 --- a/toolkit/xre/CmdLineAndEnvUtils.cpp +++ b/toolkit/xre/CmdLineAndEnvUtils.cpp @@ -25,7 +25,7 @@ already_AddRefed GetFileFromEnv(const char* name) { _MAX_PATH)) return nullptr; - rv = NS_NewLocalFile(nsDependentString(path), true, getter_AddRefs(file)); + rv = NS_NewLocalFile(nsDependentString(path), getter_AddRefs(file)); if (NS_FAILED(rv)) return nullptr; return file.forget(); @@ -35,8 +35,7 @@ already_AddRefed GetFileFromEnv(const char* name) { return nullptr; } - rv = NS_NewNativeLocalFile(nsDependentCString(arg), true, - getter_AddRefs(file)); + rv = NS_NewNativeLocalFile(nsDependentCString(arg), getter_AddRefs(file)); if (NS_FAILED(rv)) { return nullptr; } diff --git a/toolkit/xre/MultiInstanceLock.cpp b/toolkit/xre/MultiInstanceLock.cpp index eb4db6367a53..01fc81d31721 100644 --- a/toolkit/xre/MultiInstanceLock.cpp +++ b/toolkit/xre/MultiInstanceLock.cpp @@ -283,8 +283,7 @@ already_AddRefed GetNormalizedAppFile(nsIFile* aAppFile) { FSRef ref; nsCOMPtr macFile = do_QueryInterface(appFile); if (macFile && NS_SUCCEEDED(macFile->GetFSRef(&ref)) && - NS_SUCCEEDED( - NS_NewLocalFileWithFSRef(&ref, true, getter_AddRefs(macFile)))) { + NS_SUCCEEDED(NS_NewLocalFileWithFSRef(&ref, getter_AddRefs(macFile)))) { appFile = static_cast(macFile); } else { NS_WARNING("Failed to resolve install directory."); diff --git a/toolkit/xre/dllservices/DynamicBlocklistWriter.cpp b/toolkit/xre/dllservices/DynamicBlocklistWriter.cpp index 38a9972e94d7..faa2c7ada02d 100644 --- a/toolkit/xre/dllservices/DynamicBlocklistWriter.cpp +++ b/toolkit/xre/dllservices/DynamicBlocklistWriter.cpp @@ -85,7 +85,7 @@ DynamicBlocklistWriter::DynamicBlocklistWriter( nsresult DynamicBlocklistWriter::WriteToFile(const nsAString& aName) const { nsCOMPtr file; - MOZ_TRY(NS_NewLocalFile(aName, true, getter_AddRefs(file))); + MOZ_TRY(NS_NewLocalFile(aName, getter_AddRefs(file))); nsCOMPtr stream; MOZ_TRY(NS_NewSafeLocalFileOutputStream(getter_AddRefs(stream), file)); diff --git a/toolkit/xre/dllservices/ModuleEvaluator.cpp b/toolkit/xre/dllservices/ModuleEvaluator.cpp index a77af2580f84..00e5c2dbfe4d 100644 --- a/toolkit/xre/dllservices/ModuleEvaluator.cpp +++ b/toolkit/xre/dllservices/ModuleEvaluator.cpp @@ -83,7 +83,7 @@ bool ModuleEvaluator::ResolveKnownFolder(REFKNOWNFOLDERID aFolderId, ShellStringUniquePtr path(rawPath); - nsresult rv = NS_NewLocalFile(nsDependentString(path.get()), false, aOutFile); + nsresult rv = NS_NewLocalFile(nsDependentString(path.get()), aOutFile); return NS_SUCCEEDED(rv); } diff --git a/toolkit/xre/dllservices/UntrustedModulesData.cpp b/toolkit/xre/dllservices/UntrustedModulesData.cpp index 2ddec1e96753..0da557e88a5e 100644 --- a/toolkit/xre/dllservices/UntrustedModulesData.cpp +++ b/toolkit/xre/dllservices/UntrustedModulesData.cpp @@ -97,7 +97,7 @@ ModuleRecord::ModuleRecord(const nsAString& aResolvedNtPath) } nsresult rv = - NS_NewLocalFile(resolvedDosPath, false, getter_AddRefs(mResolvedDosName)); + NS_NewLocalFile(resolvedDosPath, getter_AddRefs(mResolvedDosName)); if (NS_FAILED(rv) || !mResolvedDosName) { return; } diff --git a/toolkit/xre/dllservices/UntrustedModulesData.h b/toolkit/xre/dllservices/UntrustedModulesData.h index 9268728aa69b..4691d3033b39 100644 --- a/toolkit/xre/dllservices/UntrustedModulesData.h +++ b/toolkit/xre/dllservices/UntrustedModulesData.h @@ -346,7 +346,7 @@ struct ParamTraits { if (resolvedDosName.IsEmpty()) { aResult->mResolvedDosName = nullptr; } else if (NS_FAILED(NS_NewLocalFile( - resolvedDosName, false, + resolvedDosName, getter_AddRefs(aResult->mResolvedDosName)))) { return false; } diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 3ed12005e4dc..4e256b4ec546 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -1748,14 +1748,16 @@ nsXULAppInfo::SetServerURL(nsIURL* aServerURL) { NS_IMETHODIMP nsXULAppInfo::GetMinidumpPath(nsIFile** aMinidumpPath) { - if (!CrashReporter::GetEnabled()) return NS_ERROR_NOT_INITIALIZED; + if (!CrashReporter::GetEnabled()) { + return NS_ERROR_NOT_INITIALIZED; + } nsAutoString path; - if (!CrashReporter::GetMinidumpPath(path)) return NS_ERROR_FAILURE; + if (!CrashReporter::GetMinidumpPath(path)) { + return NS_ERROR_FAILURE; + } - nsresult rv = NS_NewLocalFile(path, false, aMinidumpPath); - NS_ENSURE_SUCCESS(rv, rv); - return NS_OK; + return NS_NewLocalFile(path, aMinidumpPath); } NS_IMETHODIMP @@ -3447,7 +3449,7 @@ static bool CheckCompatibility(nsIFile* aProfileDir, const nsCString& aVersion, if (NS_FAILED(rv)) return false; nsCOMPtr lf; - rv = NS_NewNativeLocalFile(""_ns, false, getter_AddRefs(lf)); + rv = NS_NewNativeLocalFile(""_ns, getter_AddRefs(lf)); if (NS_FAILED(rv)) return false; rv = lf->SetPersistentDescriptor(buf); @@ -3461,7 +3463,7 @@ static bool CheckCompatibility(nsIFile* aProfileDir, const nsCString& aVersion, rv = parser.GetString("Compatibility", "LastAppDir", buf); if (NS_FAILED(rv)) return false; - rv = NS_NewNativeLocalFile(""_ns, false, getter_AddRefs(lf)); + rv = NS_NewNativeLocalFile(""_ns, getter_AddRefs(lf)); if (NS_FAILED(rv)) return false; rv = lf->SetPersistentDescriptor(buf); diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp index 988da8e20b85..e3be04e70c6d 100644 --- a/toolkit/xre/nsXREDirProvider.cpp +++ b/toolkit/xre/nsXREDirProvider.cpp @@ -296,7 +296,7 @@ static nsresult GetSystemParentDirectory(nsIFile** aFile) { "/usr/lib/mozilla"_ns # endif ; - rv = NS_NewNativeLocalFile(dirname, false, getter_AddRefs(localDir)); + rv = NS_NewNativeLocalFile(dirname, getter_AddRefs(localDir)); # endif if (NS_SUCCEEDED(rv)) { @@ -401,7 +401,7 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent, # else static const char* const sysLExtDir = "/usr/share/mozilla/extensions"; # endif - rv = NS_NewNativeLocalFile(nsDependentCString(sysLExtDir), false, + rv = NS_NewNativeLocalFile(nsDependentCString(sysLExtDir), getter_AddRefs(file)); # endif } @@ -414,7 +414,7 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent, #if defined(XP_UNIX) nsPrintfCString path("/run/user/%d/%s/", getuid(), GetAppName()); ToLowerCase(path); - rv = NS_NewNativeLocalFile(path, false, getter_AddRefs(file)); + rv = NS_NewNativeLocalFile(path, getter_AddRefs(file)); #endif } else if (!strcmp(aProperty, XRE_APP_DISTRIBUTION_DIR)) { bool persistent = false; @@ -825,7 +825,7 @@ nsresult nsXREDirProvider::GetInstallHash(nsAString& aPathHash) { nsCOMPtr macFile = do_QueryInterface(installDir); rv = macFile->GetFSRef(&ref); NS_ENSURE_SUCCESS(rv, rv); - rv = NS_NewLocalFileWithFSRef(&ref, true, getter_AddRefs(macFile)); + rv = NS_NewLocalFileWithFSRef(&ref, getter_AddRefs(macFile)); NS_ENSURE_SUCCESS(rv, rv); installDir = static_cast(macFile); #endif @@ -1053,7 +1053,7 @@ nsresult nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, OSErr err = ::FSFindFolder(kUserDomain, folderType, kCreateFolder, &fsRef); NS_ENSURE_FALSE(err, NS_ERROR_FAILURE); - rv = NS_NewNativeLocalFile(""_ns, true, getter_AddRefs(localDir)); + rv = NS_NewNativeLocalFile(""_ns, getter_AddRefs(localDir)); NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr dirFileMac = do_QueryInterface(localDir); @@ -1066,7 +1066,7 @@ nsresult nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, #elif defined(XP_IOS) nsAutoCString userDir; if (GetUIKitDirectory(aLocal, userDir)) { - rv = NS_NewNativeLocalFile(userDir, true, getter_AddRefs(localDir)); + rv = NS_NewNativeLocalFile(userDir, getter_AddRefs(localDir)); } else { rv = NS_ERROR_FAILURE; } @@ -1085,7 +1085,7 @@ nsresult nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, } NS_ENSURE_SUCCESS(rv, rv); - rv = NS_NewLocalFile(path, true, getter_AddRefs(localDir)); + rv = NS_NewLocalFile(path, getter_AddRefs(localDir)); #elif defined(XP_UNIX) const char* homeDir = getenv("HOME"); if (!homeDir || !*homeDir) return NS_ERROR_FAILURE; @@ -1098,15 +1098,15 @@ nsresult nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, // If $XDG_CACHE_HOME is defined use it, otherwise use $HOME/.cache. const char* cacheHome = getenv("XDG_CACHE_HOME"); if (cacheHome && *cacheHome) { - rv = NS_NewNativeLocalFile(nsDependentCString(cacheHome), true, + rv = NS_NewNativeLocalFile(nsDependentCString(cacheHome), getter_AddRefs(localDir)); } else { - rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), true, + rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), getter_AddRefs(localDir)); if (NS_SUCCEEDED(rv)) rv = localDir->AppendNative(".cache"_ns); } } else { - rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), true, + rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), getter_AddRefs(localDir)); } #else diff --git a/tools/code-coverage/CodeCoverageHandler.cpp b/tools/code-coverage/CodeCoverageHandler.cpp index fbe7494c6b1f..88de82a2099a 100644 --- a/tools/code-coverage/CodeCoverageHandler.cpp +++ b/tools/code-coverage/CodeCoverageHandler.cpp @@ -73,8 +73,8 @@ void CodeCoverageHandler::FlushCounters(const bool initialized) { nsCOMPtr file; - nsresult rv = NS_NewNativeLocalFile(nsDependentCString(outDir), false, - getter_AddRefs(file)); + nsresult rv = + NS_NewNativeLocalFile(nsDependentCString(outDir), getter_AddRefs(file)); MOZ_ASSERT(NS_SUCCEEDED(rv)); rv = file->AppendNative( diff --git a/tools/fuzzing/interface/harness/FuzzerTestHarness.h b/tools/fuzzing/interface/harness/FuzzerTestHarness.h index 6104be543851..20ad6b46e2c5 100644 --- a/tools/fuzzing/interface/harness/FuzzerTestHarness.h +++ b/tools/fuzzing/interface/harness/FuzzerTestHarness.h @@ -141,10 +141,9 @@ class ScopedXPCOM final : public nsIDirectoryServiceProvider2 { return copy.forget(); } - char* env = PR_GetEnv("MOZ_XRE_DIR"); nsCOMPtr greD; - if (env) { - NS_NewLocalFile(NS_ConvertUTF8toUTF16(env), false, getter_AddRefs(greD)); + if (char* env = PR_GetEnv("MOZ_XRE_DIR")) { + NS_NewLocalFile(NS_ConvertUTF8toUTF16(env), getter_AddRefs(greD)); } mGRED = greD; diff --git a/tools/fuzzing/messagemanager/MessageManagerFuzzer.cpp b/tools/fuzzing/messagemanager/MessageManagerFuzzer.cpp index 6a4475641f36..37d6d75e74d4 100644 --- a/tools/fuzzing/messagemanager/MessageManagerFuzzer.cpp +++ b/tools/fuzzing/messagemanager/MessageManagerFuzzer.cpp @@ -52,7 +52,7 @@ void MessageManagerFuzzer::ReadFile(const char* path, nsTArray& aArray) { nsCOMPtr file; nsresult rv = - NS_NewLocalFile(NS_ConvertUTF8toUTF16(path), true, getter_AddRefs(file)); + NS_NewLocalFile(NS_ConvertUTF8toUTF16(path), getter_AddRefs(file)); NS_ENSURE_SUCCESS_VOID(rv); bool exists = false; diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index 2c27ae5c6881..0db5201c3d63 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -869,7 +869,7 @@ nsresult nsExternalHelperAppService::GetFileTokenForPath( nsDependentString platformAppPath(aPlatformAppPath); // First, check if we have an absolute path nsIFile* localFile = nullptr; - nsresult rv = NS_NewLocalFile(platformAppPath, true, &localFile); + nsresult rv = NS_NewLocalFile(platformAppPath, &localFile); if (NS_SUCCEEDED(rv)) { *aFile = localFile; bool exists; diff --git a/uriloader/exthandler/win/nsMIMEInfoWin.cpp b/uriloader/exthandler/win/nsMIMEInfoWin.cpp index 24044c5f2555..38d460ef37ac 100644 --- a/uriloader/exthandler/win/nsMIMEInfoWin.cpp +++ b/uriloader/exthandler/win/nsMIMEInfoWin.cpp @@ -372,7 +372,7 @@ void nsMIMEInfoWin::UpdateDefaultInfoIfStale() { bool nsMIMEInfoWin::GetLocalHandlerApp(const nsAString& aCommandHandler, nsCOMPtr& aApp) { nsCOMPtr locfile; - nsresult rv = NS_NewLocalFile(aCommandHandler, true, getter_AddRefs(locfile)); + nsresult rv = NS_NewLocalFile(aCommandHandler, getter_AddRefs(locfile)); if (NS_FAILED(rv)) return false; aApp = do_CreateInstance("@mozilla.org/uriloader/local-handler-app;1"); diff --git a/widget/android/nsDeviceContextAndroid.cpp b/widget/android/nsDeviceContextAndroid.cpp index e6643ef9b3f3..7db6d5a955fc 100644 --- a/widget/android/nsDeviceContextAndroid.cpp +++ b/widget/android/nsDeviceContextAndroid.cpp @@ -84,7 +84,7 @@ nsDeviceContextSpecAndroid::DoEndDocument() { nsAutoString targetPath; mPrintSettings->GetToFileName(targetPath); nsCOMPtr destFile; - MOZ_TRY(NS_NewLocalFile(targetPath, false, getter_AddRefs(destFile))); + MOZ_TRY(NS_NewLocalFile(targetPath, getter_AddRefs(destFile))); nsAutoString destLeafName; MOZ_TRY(destFile->GetLeafName(destLeafName)); diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 3d9276ad0744..ce8da4e0ef10 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -4493,7 +4493,7 @@ static CFTypeRefPtr GetPasteLocation(NSPasteboard* aPasteboard) { stringFromPboardType: (NSString*)kPasteboardTypeFileURLPromise]]) { nsCOMPtr targFile; - NS_NewLocalFile(u""_ns, true, getter_AddRefs(targFile)); + NS_NewLocalFile(u""_ns, getter_AddRefs(targFile)); nsCOMPtr macLocalFile = do_QueryInterface(targFile); if (!macLocalFile) { NS_ERROR("No Mac local file"); diff --git a/widget/cocoa/nsCocoaUtils.mm b/widget/cocoa/nsCocoaUtils.mm index d29bb93bcff3..342c7ba551a4 100644 --- a/widget/cocoa/nsCocoaUtils.mm +++ b/widget/cocoa/nsCocoaUtils.mm @@ -1726,7 +1726,7 @@ void nsCocoaUtils::SetTransferDataForTypeFromPasteboardItem( clipboardDataPtr[stringLength] = 0; // null terminate nsCOMPtr file; - nsresult rv = NS_NewLocalFile(nsDependentString(clipboardDataPtr), true, + nsresult rv = NS_NewLocalFile(nsDependentString(clipboardDataPtr), getter_AddRefs(file)); free(clipboardDataPtr); if (NS_FAILED(rv)) { diff --git a/widget/cocoa/nsFilePicker.mm b/widget/cocoa/nsFilePicker.mm index 31c64c536774..490c7a07532c 100644 --- a/widget/cocoa/nsFilePicker.mm +++ b/widget/cocoa/nsFilePicker.mm @@ -359,7 +359,7 @@ nsIFilePicker::ResultCode nsFilePicker::GetLocalFiles( } nsCOMPtr localFile; - NS_NewLocalFile(u""_ns, true, getter_AddRefs(localFile)); + NS_NewLocalFile(u""_ns, getter_AddRefs(localFile)); nsCOMPtr macLocalFile = do_QueryInterface(localFile); if (macLocalFile && NS_SUCCEEDED(macLocalFile->InitWithCFURL((CFURLRef)url))) { @@ -414,7 +414,7 @@ nsIFilePicker::ResultCode nsFilePicker::GetLocalFolder(nsIFile** outFile) { NSURL* theURL = [[thePanel URLs] objectAtIndex:0]; if (theURL) { nsCOMPtr localFile; - NS_NewLocalFile(u""_ns, true, getter_AddRefs(localFile)); + NS_NewLocalFile(u""_ns, getter_AddRefs(localFile)); nsCOMPtr macLocalFile = do_QueryInterface(localFile); if (macLocalFile && NS_SUCCEEDED(macLocalFile->InitWithCFURL((CFURLRef)theURL))) { @@ -505,7 +505,7 @@ nsIFilePicker::ResultCode nsFilePicker::PutLocalFile(nsIFile** outFile) { NSURL* fileURL = [thePanel URL]; if (fileURL) { nsCOMPtr localFile; - NS_NewLocalFile(u""_ns, true, getter_AddRefs(localFile)); + NS_NewLocalFile(u""_ns, getter_AddRefs(localFile)); nsCOMPtr macLocalFile = do_QueryInterface(localFile); if (macLocalFile && NS_SUCCEEDED(macLocalFile->InitWithCFURL((CFURLRef)fileURL))) { diff --git a/widget/gtk/MPRISServiceHandler.cpp b/widget/gtk/MPRISServiceHandler.cpp index 1ce4aa519a7e..063adbaab0fc 100644 --- a/widget/gtk/MPRISServiceHandler.cpp +++ b/widget/gtk/MPRISServiceHandler.cpp @@ -756,7 +756,7 @@ bool MPRISServiceHandler::InitLocalImageFolder() { // The XDG_DATA_HOME points to the same location in the host and guest // filesystem. if (const auto* xdgDataHome = g_getenv("XDG_DATA_HOME")) { - rv = NS_NewNativeLocalFile(nsDependentCString(xdgDataHome), true, + rv = NS_NewNativeLocalFile(nsDependentCString(xdgDataHome), getter_AddRefs(mLocalImageFolder)); } } else { diff --git a/widget/gtk/nsDeviceContextSpecG.cpp b/widget/gtk/nsDeviceContextSpecG.cpp index 3dfa816408ae..18ab3f4e3d81 100644 --- a/widget/gtk/nsDeviceContextSpecG.cpp +++ b/widget/gtk/nsDeviceContextSpecG.cpp @@ -96,7 +96,7 @@ already_AddRefed nsDeviceContextSpecGTK::MakePrintTarget() { return nullptr; } close(fd); - if (NS_FAILED(NS_NewNativeLocalFile(nsDependentCString(buf), false, + if (NS_FAILED(NS_NewNativeLocalFile(nsDependentCString(buf), getter_AddRefs(mSpoolFile)))) { unlink(buf); g_free(buf); @@ -380,8 +380,7 @@ RefPtr nsDeviceContextSpecGTK::EndDocument() { nsCOMPtr destFile; mPrintSettings->GetToFileName(targetPath); - nsresult rv = - NS_NewLocalFile(targetPath, false, getter_AddRefs(destFile)); + nsresult rv = NS_NewLocalFile(targetPath, getter_AddRefs(destFile)); if (NS_FAILED(rv)) { return PrintEndDocumentPromise::CreateAndReject(rv, __func__); } diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp index 60de0ded83d7..74ccf585d1e0 100644 --- a/widget/gtk/nsDragService.cpp +++ b/widget/gtk/nsDragService.cpp @@ -2162,7 +2162,7 @@ void nsDragSession::SourceDataGetXDND(nsITransferable* aItem, LOGDRAGSERVICE(" XdndDirectSave filepath is %s", fullpath.get()); nsCOMPtr file; - if (NS_FAILED(NS_NewNativeLocalFile(nsDependentCString(fullpath.get()), false, + if (NS_FAILED(NS_NewNativeLocalFile(nsDependentCString(fullpath.get()), getter_AddRefs(file)))) { LOGDRAGSERVICE(" failed to get local file"); return; diff --git a/widget/gtk/nsFilePicker.cpp b/widget/gtk/nsFilePicker.cpp index 6f5b0ba67b59..cd97fb35a797 100644 --- a/widget/gtk/nsFilePicker.cpp +++ b/widget/gtk/nsFilePicker.cpp @@ -182,7 +182,7 @@ void ReadMultipleFiles(gpointer filename, gpointer array) { nsCOMPtr localfile; nsresult rv = NS_NewNativeLocalFile(nsDependentCString(static_cast(filename)), - false, getter_AddRefs(localfile)); + getter_AddRefs(localfile)); if (NS_SUCCEEDED(rv)) { nsCOMArray& files = *static_cast*>(array); files.AppendObject(localfile); diff --git a/widget/gtk/nsPrintSettingsGTK.cpp b/widget/gtk/nsPrintSettingsGTK.cpp index a101f44fcb78..86629a0cad0b 100644 --- a/widget/gtk/nsPrintSettingsGTK.cpp +++ b/widget/gtk/nsPrintSettingsGTK.cpp @@ -310,7 +310,7 @@ nsPrintSettingsGTK::SetToFileName(const nsAString& aToFileName) { "pdf"); nsCOMPtr file; - nsresult rv = NS_NewLocalFile(aToFileName, true, getter_AddRefs(file)); + nsresult rv = NS_NewLocalFile(aToFileName, getter_AddRefs(file)); NS_ENSURE_SUCCESS(rv, rv); // Convert the nsIFile to a URL diff --git a/widget/nsFilePickerProxy.cpp b/widget/nsFilePickerProxy.cpp index a0be14d97cd1..a8337b245e51 100644 --- a/widget/nsFilePickerProxy.cpp +++ b/widget/nsFilePickerProxy.cpp @@ -177,7 +177,7 @@ mozilla::ipc::IPCResult nsFilePickerProxy::Recv__delete__( } else if (aData.type() == MaybeInputData::TInputDirectory) { nsCOMPtr file; const nsAString& path(aData.get_InputDirectory().directoryPath()); - nsresult rv = NS_NewLocalFile(path, true, getter_AddRefs(file)); + nsresult rv = NS_NewLocalFile(path, getter_AddRefs(file)); if (NS_WARN_IF(NS_FAILED(rv))) { return IPC_OK(); } diff --git a/widget/windows/JumpListBuilder.cpp b/widget/windows/JumpListBuilder.cpp index b6c2b51e97c0..cf9118a424af 100644 --- a/widget/windows/JumpListBuilder.cpp +++ b/widget/windows/JumpListBuilder.cpp @@ -790,7 +790,7 @@ void JumpListBuilder::DeleteIconFromDisk(const nsAString& aPath) { if (StringTail(aPath, 4).LowerCaseEqualsASCII(".ico")) { // Construct the parent path of the passed in path nsCOMPtr icoFile; - nsresult rv = NS_NewLocalFile(aPath, true, getter_AddRefs(icoFile)); + nsresult rv = NS_NewLocalFile(aPath, getter_AddRefs(icoFile)); if (NS_WARN_IF(NS_FAILED(rv))) { return; } diff --git a/widget/windows/nsClipboard.cpp b/widget/windows/nsClipboard.cpp index 262b9e1b0c6b..bc7f755a90d0 100644 --- a/widget/windows/nsClipboard.cpp +++ b/widget/windows/nsClipboard.cpp @@ -960,8 +960,7 @@ nsresult nsClipboard::GetDataFromDataObject(IDataObject* aDataObject, // we have a file path in |data|. Create an nsLocalFile object. nsDependentString filepath(reinterpret_cast(data)); nsCOMPtr file; - if (NS_SUCCEEDED( - NS_NewLocalFile(filepath, false, getter_AddRefs(file)))) { + if (NS_SUCCEEDED(NS_NewLocalFile(filepath, getter_AddRefs(file)))) { genericDataWrapper = do_QueryInterface(file); } free(data); @@ -1159,7 +1158,7 @@ bool nsClipboard ::FindURLFromLocalFile(IDataObject* inDataObject, UINT inIndex, // file? const nsDependentString filepath(static_cast(*outData)); nsCOMPtr file; - nsresult rv = NS_NewLocalFile(filepath, true, getter_AddRefs(file)); + nsresult rv = NS_NewLocalFile(filepath, getter_AddRefs(file)); if (NS_FAILED(rv)) { free(*outData); return dataFound; diff --git a/widget/windows/nsDeviceContextSpecWin.cpp b/widget/windows/nsDeviceContextSpecWin.cpp index 816155081bb7..5a60d9f9ded7 100644 --- a/widget/windows/nsDeviceContextSpecWin.cpp +++ b/widget/windows/nsDeviceContextSpecWin.cpp @@ -361,7 +361,7 @@ RefPtr nsDeviceContextSpecWin::EndDocument() { // We still need to move the file to its actual destination. nsCOMPtr destFile; - auto rv = NS_NewLocalFile(targetPath, false, getter_AddRefs(destFile)); + auto rv = NS_NewLocalFile(targetPath, getter_AddRefs(destFile)); if (NS_FAILED(rv)) { return PrintEndDocumentPromise::CreateAndReject(rv, __func__); } diff --git a/widget/windows/nsFilePicker.cpp b/widget/windows/nsFilePicker.cpp index bc061a4068f2..c24acfad2826 100644 --- a/widget/windows/nsFilePicker.cpp +++ b/widget/windows/nsFilePicker.cpp @@ -762,7 +762,7 @@ nsFilePicker::ShowFilePicker(const nsString& aInitialDir) { // multiple selection for (auto const& str : paths) { nsCOMPtr file; - if (NS_SUCCEEDED(NS_NewLocalFile(str, false, getter_AddRefs(file)))) { + if (NS_SUCCEEDED(NS_NewLocalFile(str, getter_AddRefs(file)))) { self->mFiles.AppendObject(file); } } @@ -908,7 +908,7 @@ nsresult nsFilePicker::Open(nsIFilePickerShownCallback* aCallback) { // file already exists. nsCOMPtr file; nsresult rv = - NS_NewLocalFile(self->mUnicodeFile, false, getter_AddRefs(file)); + NS_NewLocalFile(self->mUnicodeFile, getter_AddRefs(file)); bool flag = false; if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(file->Exists(&flag)) && flag) { @@ -975,7 +975,7 @@ nsFilePicker::GetFile(nsIFile** aFile) { if (mUnicodeFile.IsEmpty()) return NS_OK; nsCOMPtr file; - nsresult rv = NS_NewLocalFile(mUnicodeFile, false, getter_AddRefs(file)); + nsresult rv = NS_NewLocalFile(mUnicodeFile, getter_AddRefs(file)); if (NS_FAILED(rv)) { return rv; } @@ -1097,7 +1097,7 @@ void nsFilePicker::RememberLastUsedDirectory() { } nsCOMPtr file; - if (NS_FAILED(NS_NewLocalFile(mUnicodeFile, false, getter_AddRefs(file)))) { + if (NS_FAILED(NS_NewLocalFile(mUnicodeFile, getter_AddRefs(file)))) { NS_WARNING("RememberLastUsedDirectory failed to init file path."); return; } diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index 72d326a09bba..74c208f1032e 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -1621,7 +1621,7 @@ class nsCycleCollectorLogSinkToFile final : public nsICycleCollectorLogSink { // wouldn't work. nsIFile* logFile = nullptr; if (char* env = PR_GetEnv("MOZ_CC_LOG_DIRECTORY")) { - NS_NewNativeLocalFile(nsCString(env), /* followLinks = */ true, &logFile); + NS_NewNativeLocalFile(nsCString(env), &logFile); } // On Android or B2G, this function will open a file named diff --git a/xpcom/base/nsDumpUtils.cpp b/xpcom/base/nsDumpUtils.cpp index c7bbbf4eb38a..ef31d7b8ef13 100644 --- a/xpcom/base/nsDumpUtils.cpp +++ b/xpcom/base/nsDumpUtils.cpp @@ -409,9 +409,8 @@ nsresult nsDumpUtils::OpenTempFile(const nsACString& aFilename, nsIFile** aFile, // For Android, first try the downloads directory which is world-readable // rather than the temp directory which is not. if (!*aFile) { - char* env = PR_GetEnv("DOWNLOADS_DIRECTORY"); - if (env) { - NS_NewNativeLocalFile(nsCString(env), /* followLinks = */ true, aFile); + if (char* env = PR_GetEnv("DOWNLOADS_DIRECTORY")) { + NS_NewNativeLocalFile(nsCString(env), aFile); } } #endif diff --git a/xpcom/base/nsMacUtilsImpl.cpp b/xpcom/base/nsMacUtilsImpl.cpp index 170e83275ae7..c0dd793c8798 100644 --- a/xpcom/base/nsMacUtilsImpl.cpp +++ b/xpcom/base/nsMacUtilsImpl.cpp @@ -122,8 +122,8 @@ bool nsMacUtilsImpl::GetAppPath(nsCString& aAppPath) { } nsCOMPtr app; - nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(appPath), true, - getter_AddRefs(app)); + nsresult rv = + NS_NewLocalFile(NS_ConvertUTF8toUTF16(appPath), getter_AddRefs(app)); if (NS_FAILED(rv)) { return false; } @@ -326,8 +326,7 @@ static nsresult GetDirFromBundlePlist(const nsAString& aKey, nsIFile** aDir) { NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr dir; - rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(dirPath), false, - getter_AddRefs(dir)); + rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(dirPath), getter_AddRefs(dir)); NS_ENSURE_SUCCESS(rv, rv); rv = dir->Normalize(); diff --git a/xpcom/base/nsMemoryInfoDumper.cpp b/xpcom/base/nsMemoryInfoDumper.cpp index 433919146aa1..43ad94ab096d 100644 --- a/xpcom/base/nsMemoryInfoDumper.cpp +++ b/xpcom/base/nsMemoryInfoDumper.cpp @@ -615,7 +615,7 @@ nsMemoryInfoDumper::DumpMemoryReportsToNamedFile( // Create the file. nsCOMPtr reportsFile; - nsresult rv = NS_NewLocalFile(aFilename, false, getter_AddRefs(reportsFile)); + nsresult rv = NS_NewLocalFile(aFilename, getter_AddRefs(reportsFile)); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } diff --git a/xpcom/build/BinaryPath.h b/xpcom/build/BinaryPath.h index 47bd6940cb71..6aae68a11e45 100644 --- a/xpcom/build/BinaryPath.h +++ b/xpcom/build/BinaryPath.h @@ -302,10 +302,9 @@ class BinaryPath { return rv; } # ifdef XP_WIN - rv = NS_NewLocalFile(nsDependentString(exePath), true, getter_AddRefs(lf)); + rv = NS_NewLocalFile(nsDependentString(exePath), getter_AddRefs(lf)); # else - rv = NS_NewNativeLocalFile(nsDependentCString(exePath), true, - getter_AddRefs(lf)); + rv = NS_NewNativeLocalFile(nsDependentCString(exePath), getter_AddRefs(lf)); # endif if (NS_FAILED(rv)) { return rv; diff --git a/xpcom/build/nsXPCOM.h b/xpcom/build/nsXPCOM.h index 8c3d66fd10f8..0ee69dad31bf 100644 --- a/xpcom/build/nsXPCOM.h +++ b/xpcom/build/nsXPCOM.h @@ -141,11 +141,6 @@ XPCOM_API(nsresult) NS_GetComponentRegistrar(nsIComponentRegistrar** aResult); * error (NS_ERROR_FILE_UNRECOGNIZED_PATH). * |NS_NewNativeLocalFile|'s path must be in the * filesystem charset. - * @param aFollowLinks - * This attribute will determine if the nsLocalFile will auto - * resolve symbolic links. By default, this value will be false - * on all non unix systems. On unix, this attribute is effectively - * a noop. * @param aResult Interface pointer to a new instance of an nsIFile * * @return NS_OK for success; @@ -155,18 +150,17 @@ XPCOM_API(nsresult) NS_GetComponentRegistrar(nsIComponentRegistrar** aResult); #ifdef __cplusplus XPCOM_API(nsresult) -NS_NewLocalFile(const nsAString& aPath, bool aFollowLinks, nsIFile** aResult); +NS_NewLocalFile(const nsAString& aPath, nsIFile** aResult); XPCOM_API(nsresult) -NS_NewNativeLocalFile(const nsACString& aPath, bool aFollowLinks, - nsIFile** aResult); +NS_NewNativeLocalFile(const nsACString& aPath, nsIFile** aResult); // Use NS_NewLocalFile if you already have a UTF-16 string. // Otherwise non-ASCII paths will break on some platforms // including Windows. class NS_ConvertUTF16toUTF8; nsresult NS_NewNativeLocalFile(const NS_ConvertUTF16toUTF8& aPath, - bool aFollowLinks, nsIFile** aResult) = delete; + nsIFile** aResult) = delete; #endif diff --git a/xpcom/io/SpecialSystemDirectory.cpp b/xpcom/io/SpecialSystemDirectory.cpp index 419e783a3176..95c7ac39b7f6 100644 --- a/xpcom/io/SpecialSystemDirectory.cpp +++ b/xpcom/io/SpecialSystemDirectory.cpp @@ -66,7 +66,7 @@ static nsresult GetKnownFolder(GUID* aGuid, nsIFile** aFile) { return NS_ERROR_FAILURE; } - nsresult rv = NS_NewLocalFile(nsDependentString(path), true, aFile); + nsresult rv = NS_NewLocalFile(nsDependentString(path), aFile); CoTaskMemFree(path); return rv; @@ -91,7 +91,7 @@ static nsresult GetWindowsFolder(int aFolder, nsIFile** aFile) { path[++len] = L'\0'; } - return NS_NewLocalFile(nsDependentString(path, len), true, aFile); + return NS_NewLocalFile(nsDependentString(path, len), aFile); } /* @@ -113,7 +113,7 @@ static nsresult GetLibrarySaveToPath(int aFallbackFolderId, nsAutoString path; path.Assign(str); path.Append('\\'); - nsresult rv = NS_NewLocalFile(path, false, aFile); + nsresult rv = NS_NewLocalFile(path, aFile); CoTaskMemFree(str); return rv; } @@ -154,7 +154,7 @@ static nsresult GetRegWindowsAppDataFolder(bool aLocal, nsIFile** aFile) { path[++len] = L'\0'; } - return NS_NewLocalFile(nsDependentString(path, len), true, aFile); + return NS_NewLocalFile(nsDependentString(path, len), aFile); } #endif // XP_WIN @@ -165,8 +165,7 @@ static nsresult GetUnixHomeDir(nsIFile** aFile) { // XXX no home dir on android; maybe we should return the sdcard if present? return NS_ERROR_FAILURE; # else - return NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), true, - aFile); + return NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), aFile); # endif } @@ -199,7 +198,7 @@ static nsresult GetUnixSystemConfigDir(nsIFile** aFile) { if (sysConfigDir.IsEmpty()) { sysConfigDir.Assign(nsLiteralCString("/etc")); } - MOZ_TRY(NS_NewNativeLocalFile(sysConfigDir, true, aFile)); + MOZ_TRY(NS_NewNativeLocalFile(sysConfigDir, aFile)); MOZ_TRY((*aFile)->AppendNative(appName)); return NS_OK; # endif @@ -387,8 +386,7 @@ static nsresult GetUnixXDGUserDirectory(SystemDirectories aSystemDirectory, nsCOMPtr file; bool exists; if (dir) { - rv = NS_NewNativeLocalFile(nsDependentCString(dir), true, - getter_AddRefs(file)); + rv = NS_NewNativeLocalFile(nsDependentCString(dir), getter_AddRefs(file)); free(dir); if (NS_FAILED(rv)) { @@ -460,7 +458,7 @@ nsresult GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, if (!_wgetcwd(path, MAX_PATH)) { return NS_ERROR_FAILURE; } - return NS_NewLocalFile(nsDependentString(path), true, aFile); + return NS_NewLocalFile(nsDependentString(path), aFile); #else if (!getcwd(path, MAXPATHLEN)) { return NS_ERROR_FAILURE; @@ -468,7 +466,7 @@ nsresult GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, #endif #if !defined(XP_WIN) - return NS_NewNativeLocalFile(nsDependentCString(path), true, aFile); + return NS_NewNativeLocalFile(nsDependentCString(path), aFile); #endif case OS_TemporaryDirectory: @@ -478,7 +476,7 @@ nsresult GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, if (len == 0) { break; } - return NS_NewLocalFile(nsDependentString(path, len), true, aFile); + return NS_NewLocalFile(nsDependentString(path, len), aFile); } #elif defined(MOZ_WIDGET_COCOA) { @@ -500,7 +498,7 @@ nsresult GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, } } } - return NS_NewNativeLocalFile(nsDependentCString(tPath), true, aFile); + return NS_NewNativeLocalFile(nsDependentCString(tPath), aFile); } #else break; @@ -554,7 +552,7 @@ nsresult GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, CFRangeMake(0, data.Length()), reinterpret_cast(data.Elements())); - return NS_NewLocalFile(path, true, aFile); + return NS_NewLocalFile(path, aFile); } #elif defined(XP_WIN) case Win_SystemDirectory: { @@ -567,7 +565,7 @@ nsresult GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, path[len] = L'\\'; path[++len] = L'\0'; - return NS_NewLocalFile(nsDependentString(path, len), true, aFile); + return NS_NewLocalFile(nsDependentString(path, len), aFile); } case Win_WindowsDirectory: { @@ -581,7 +579,7 @@ nsresult GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, path[len] = L'\\'; path[++len] = L'\0'; - return NS_NewLocalFile(nsDependentString(path, len), true, aFile); + return NS_NewLocalFile(nsDependentString(path, len), aFile); } case Win_ProgramFiles: { @@ -604,7 +602,7 @@ nsresult GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, path[len] = L'\\'; path[++len] = L'\0'; - rv = NS_NewLocalFile(nsDependentString(path, len), true, aFile); + rv = NS_NewLocalFile(nsDependentString(path, len), aFile); if (NS_SUCCEEDED(rv)) { return rv; } @@ -628,7 +626,7 @@ nsresult GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory, path[len] = L'\\'; path[++len] = L'\0'; - return NS_NewLocalFile(nsDependentString(path, len), true, aFile); + return NS_NewLocalFile(nsDependentString(path, len), aFile); } break; } @@ -706,7 +704,7 @@ nsresult GetOSXFolderType(short aDomain, OSType aFolderType, nsresult rv = NS_ERROR_FAILURE; if (aFolderType == kTemporaryFolderType) { - NS_NewLocalFile(u""_ns, true, aLocalFile); + NS_NewLocalFile(u""_ns, aLocalFile); nsCOMPtr localMacFile(do_QueryInterface(*aLocalFile)); if (localMacFile) { rv = localMacFile->InitWithCFURL( @@ -719,7 +717,7 @@ nsresult GetOSXFolderType(short aDomain, OSType aFolderType, FSRef fsRef; err = ::FSFindFolder(aDomain, aFolderType, kCreateFolder, &fsRef); if (err == noErr) { - NS_NewLocalFile(u""_ns, true, aLocalFile); + NS_NewLocalFile(u""_ns, aLocalFile); nsCOMPtr localMacFile(do_QueryInterface(*aLocalFile)); if (localMacFile) { rv = localMacFile->InitWithFSRef(&fsRef); diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocationProvider.cpp index 189f1efe130f..bb062aa70e5f 100644 --- a/xpcom/io/nsAppFileLocationProvider.cpp +++ b/xpcom/io/nsAppFileLocationProvider.cpp @@ -183,7 +183,7 @@ nsresult nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile, nsCOMPtr localDir; #if defined(MOZ_WIDGET_COCOA) - NS_NewLocalFile(u""_ns, true, getter_AddRefs(localDir)); + NS_NewLocalFile(u""_ns, getter_AddRefs(localDir)); if (!localDir) { return NS_ERROR_FAILURE; } @@ -207,7 +207,7 @@ nsresult nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile, return rv; } #elif defined(XP_UNIX) - rv = NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), true, + rv = NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), getter_AddRefs(localDir)); if (NS_FAILED(rv)) { return rv; diff --git a/xpcom/io/nsDirectoryService.cpp b/xpcom/io/nsDirectoryService.cpp index d5b6c7710ca5..650eb69dd38c 100644 --- a/xpcom/io/nsDirectoryService.cpp +++ b/xpcom/io/nsDirectoryService.cpp @@ -62,7 +62,7 @@ nsresult nsDirectoryService::GetCurrentProcessDirectory(nsIFile** aFile) if (!greHome) { return NS_ERROR_FAILURE; } - nsresult rv = NS_NewNativeLocalFile(nsDependentCString(greHome), true, + nsresult rv = NS_NewNativeLocalFile(nsDependentCString(greHome), getter_AddRefs(mXCurProcD)); if (NS_FAILED(rv)) { return rv; diff --git a/xpcom/io/nsILocalFileMac.idl b/xpcom/io/nsILocalFileMac.idl index a9de769b86c5..86186ca89113 100644 --- a/xpcom/io/nsILocalFileMac.idl +++ b/xpcom/io/nsILocalFileMac.idl @@ -206,7 +206,7 @@ interface nsILocalFileMac : nsIFile %{C++ extern "C" { -NS_EXPORT nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, bool aFollowSymlinks, nsILocalFileMac** result); -NS_EXPORT nsresult NS_NewLocalFileWithCFURL(const CFURLRef aURL, bool aFollowSymlinks, nsILocalFileMac** result); +NS_EXPORT nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, nsILocalFileMac** result); +NS_EXPORT nsresult NS_NewLocalFileWithCFURL(const CFURLRef aURL, nsILocalFileMac** result); } %} diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index eb5e263ff6b3..e46c91b2b7fa 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -1868,7 +1868,7 @@ nsLocalFile::GetParent(nsIFile** aParent) { *slashp = '\0'; nsCOMPtr localFile; - nsresult rv = NS_NewNativeLocalFile(nsDependentCString(buffer), true, + nsresult rv = NS_NewNativeLocalFile(nsDependentCString(buffer), getter_AddRefs(localFile)); // make buffer whole again @@ -2418,8 +2418,7 @@ nsLocalFile::Launch() { #endif } -nsresult NS_NewNativeLocalFile(const nsACString& aPath, bool aFollowSymlinks, - nsIFile** aResult) { +nsresult NS_NewNativeLocalFile(const nsACString& aPath, nsIFile** aResult) { RefPtr file = new nsLocalFile(); if (!aPath.IsEmpty()) { @@ -2537,14 +2536,13 @@ nsresult nsLocalFile::GetTarget(nsAString& aResult) { GET_UCS(GetNativeTarget, aResult); } -nsresult NS_NewLocalFile(const nsAString& aPath, bool aFollowLinks, - nsIFile** aResult) { +nsresult NS_NewLocalFile(const nsAString& aPath, nsIFile** aResult) { nsAutoCString buf; nsresult rv = NS_CopyUnicodeToNative(aPath, buf); if (NS_FAILED(rv)) { return rv; } - return NS_NewNativeLocalFile(buf, aFollowLinks, aResult); + return NS_NewNativeLocalFile(buf, aResult); } // nsILocalFileMac @@ -3066,7 +3064,7 @@ NS_IMETHODIMP nsLocalFile::InitWithFile(nsIFile* aFile) { return InitWithNativePath(nativePath); } -nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, bool aFollowLinks, +nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, nsILocalFileMac** aResult) { RefPtr file = new nsLocalFile(); @@ -3078,7 +3076,7 @@ nsresult NS_NewLocalFileWithFSRef(const FSRef* aFSRef, bool aFollowLinks, return NS_OK; } -nsresult NS_NewLocalFileWithCFURL(const CFURLRef aURL, bool aFollowLinks, +nsresult NS_NewLocalFileWithCFURL(const CFURLRef aURL, nsILocalFileMac** aResult) { RefPtr file = new nsLocalFile(); diff --git a/xpcom/io/nsLocalFileWin.cpp b/xpcom/io/nsLocalFileWin.cpp index 10e4066216aa..7df87d4b430d 100644 --- a/xpcom/io/nsLocalFileWin.cpp +++ b/xpcom/io/nsLocalFileWin.cpp @@ -3448,8 +3448,7 @@ nsLocalFile::Launch() { return NS_OK; } -nsresult NS_NewLocalFile(const nsAString& aPath, bool aFollowLinks, - nsIFile** aResult) { +nsresult NS_NewLocalFile(const nsAString& aPath, nsIFile** aResult) { RefPtr file = new nsLocalFile(); if (!aPath.IsEmpty()) { @@ -3622,15 +3621,14 @@ nsLocalFile::GetNativeTarget(nsACString& aResult) { return rv; } -nsresult NS_NewNativeLocalFile(const nsACString& aPath, bool aFollowLinks, - nsIFile** aResult) { +nsresult NS_NewNativeLocalFile(const nsACString& aPath, nsIFile** aResult) { nsAutoString buf; nsresult rv = NS_CopyNativeToUnicode(aPath, buf); if (NS_FAILED(rv)) { *aResult = nullptr; return rv; } - return NS_NewLocalFile(buf, aFollowLinks, aResult); + return NS_NewLocalFile(buf, aResult); } void nsLocalFile::EnsureShortPath() { diff --git a/xpcom/tests/RegFactory.cpp b/xpcom/tests/RegFactory.cpp index 7130ee5e1cce..d3407e06d6da 100644 --- a/xpcom/tests/RegFactory.cpp +++ b/xpcom/tests/RegFactory.cpp @@ -35,7 +35,7 @@ void print_err(nsresult err) { nsresult Register(nsIComponentRegistrar* registrar, const char* path) { nsCOMPtr file; nsresult rv = - NS_NewLocalFile(NS_ConvertUTF8toUTF16(path), true, getter_AddRefs(file)); + NS_NewLocalFile(NS_ConvertUTF8toUTF16(path), getter_AddRefs(file)); if (NS_FAILED(rv)) return rv; rv = registrar->AutoRegister(file); return rv; diff --git a/xpcom/tests/TestHarness.h b/xpcom/tests/TestHarness.h index 40f90d988eee..6f016c3a918f 100644 --- a/xpcom/tests/TestHarness.h +++ b/xpcom/tests/TestHarness.h @@ -155,10 +155,9 @@ class ScopedXPCOM : public nsIDirectoryServiceProvider2 { return copy.forget(); } - char* env = PR_GetEnv("MOZ_XRE_DIR"); nsCOMPtr greD; - if (env) { - NS_NewLocalFile(NS_ConvertUTF8toUTF16(env), false, getter_AddRefs(greD)); + if (char* env = PR_GetEnv("MOZ_XRE_DIR")) { + NS_NewLocalFile(NS_ConvertUTF8toUTF16(env), getter_AddRefs(greD)); } mGRED = greD;