tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 336c2a0143bc649a814716fb2a085b1f82bbd395
parent d60d3bab462877768bc419845971a275f1df03bb
Author: Josh Aas <jaas@kflag.net>
Date:   Wed, 22 Oct 2025 14:10:05 +0000

Bug 1995670 - Simplify logic in  nsLocalFileUnix.cpp nsLocalFile::InitWithNativePath. r=xpcom-reviewers,mccr8

Differential Revision: https://phabricator.services.mozilla.com/D269532

Diffstat:
Mxpcom/io/nsLocalFileUnix.cpp | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp @@ -324,7 +324,11 @@ nsLocalFile::Clone(nsIFile** aFile) { NS_IMETHODIMP nsLocalFile::InitWithNativePath(const nsACString& aFilePath) { - if (!aFilePath.IsEmpty() && aFilePath.First() == '~') { + if (aFilePath.IsEmpty()) { + return NS_ERROR_FILE_UNRECOGNIZED_PATH; + } + + if (aFilePath.First() == '~') { if (aFilePath.Length() == 1 || aFilePath.CharAt(1) == '/') { // Home dir for the current user @@ -355,7 +359,7 @@ nsLocalFile::InitWithNativePath(const nsACString& aFilePath) { + Substring(aFilePath, 1); } } else { - if (aFilePath.IsEmpty() || aFilePath.First() != '/') { + if (aFilePath.First() != '/') { return NS_ERROR_FILE_UNRECOGNIZED_PATH; } mPath = aFilePath;