summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2022-04-09 16:55:10 -0500
committerMatt A. Tobin <email@mattatobin.com>2022-04-09 16:55:10 -0500
commit38fcfe29e034abf1e30b38519b6d903dc9dfa96f (patch)
treeae7424bf0cefa040838dcb32a9c11cd984c001d5 /components
parent78a837219cb0f28bd48637b1faa2851bb95df92a (diff)
downloadaura-central-38fcfe29e034abf1e30b38519b6d903dc9dfa96f.tar.gz
Revert "Issue %3057 - Part 2: Stop using GetNativePath in JAR reader."
This reverts commit e076c6facb81f8e6f8e5f20e1000cc9c36ed118c.
Diffstat (limited to 'components')
-rw-r--r--components/jar/src/nsJAR.cpp18
-rw-r--r--components/jar/src/nsZipArchive.cpp15
-rw-r--r--components/jar/src/nsZipArchive.h2
3 files changed, 17 insertions, 18 deletions
diff --git a/components/jar/src/nsJAR.cpp b/components/jar/src/nsJAR.cpp
index 205649e8d..96e18e1d3 100644
--- a/components/jar/src/nsJAR.cpp
+++ b/components/jar/src/nsJAR.cpp
@@ -271,7 +271,11 @@ nsJAR::Extract(const nsACString &aEntryName, nsIFile* outFile)
if (NS_FAILED(rv)) return rv;
// ExtractFile also closes the fd handle and resolves the symlink if needed
- rv = mZip->ExtractFile(item, outFile, fd);
+ nsAutoCString path;
+ rv = outFile->GetNativePath(path);
+ if (NS_FAILED(rv)) return rv;
+
+ rv = mZip->ExtractFile(item, path.get(), fd);
}
if (NS_FAILED(rv)) return rv;
@@ -418,7 +422,7 @@ nsJAR::GetJarPath(nsACString& aResult)
{
NS_ENSURE_ARG_POINTER(mZipFile);
- return mZipFile->GetPersistentDescriptor(aResult);
+ return mZipFile->GetNativePath(aResult);
}
nsresult
@@ -1120,7 +1124,7 @@ nsZipReaderCache::IsCached(nsIFile* zipFile, bool* aResult)
MutexAutoLock lock(mLock);
nsAutoCString uri;
- rv = zipFile->GetPersistentDescriptor(uri);
+ rv = zipFile->GetNativePath(uri);
if (NS_FAILED(rv))
return rv;
@@ -1142,7 +1146,7 @@ nsZipReaderCache::GetZip(nsIFile* zipFile, nsIZipReader* *result)
#endif
nsAutoCString uri;
- rv = zipFile->GetPersistentDescriptor(uri);
+ rv = zipFile->GetNativePath(uri);
if (NS_FAILED(rv)) return rv;
uri.Insert(NS_LITERAL_CSTRING("file:"), 0);
@@ -1186,7 +1190,7 @@ nsZipReaderCache::GetInnerZip(nsIFile* zipFile, const nsACString &entry,
#endif
nsAutoCString uri;
- rv = zipFile->GetPersistentDescriptor(uri);
+ rv = zipFile->GetNativePath(uri);
if (NS_FAILED(rv)) return rv;
uri.Insert(NS_LITERAL_CSTRING("jar:"), 0);
@@ -1229,7 +1233,7 @@ nsZipReaderCache::GetFd(nsIFile* zipFile, PRFileDesc** aRetVal)
nsresult rv;
nsAutoCString uri;
- rv = zipFile->GetPersistentDescriptor(uri);
+ rv = zipFile->GetNativePath(uri);
if (NS_FAILED(rv)) {
return rv;
}
@@ -1370,7 +1374,7 @@ nsZipReaderCache::Observe(nsISupports *aSubject,
return NS_OK;
nsAutoCString uri;
- if (NS_FAILED(file->GetPersistentDescriptor(uri)))
+ if (NS_FAILED(file->GetNativePath(uri)))
return NS_OK;
uri.Insert(NS_LITERAL_CSTRING("file:"), 0);
diff --git a/components/jar/src/nsZipArchive.cpp b/components/jar/src/nsZipArchive.cpp
index 8006ee56c..b28fddc18 100644
--- a/components/jar/src/nsZipArchive.cpp
+++ b/components/jar/src/nsZipArchive.cpp
@@ -486,7 +486,7 @@ MOZ_WIN_MEM_TRY_CATCH(return nullptr)
// On extraction error(s) it removes the file.
// When needed, it also resolves the symlink.
//---------------------------------------------
-nsresult nsZipArchive::ExtractFile(nsZipItem *item, nsIFile* outFile,
+nsresult nsZipArchive::ExtractFile(nsZipItem *item, const char *outname,
PRFileDesc* aFd)
{
if (!item)
@@ -524,16 +524,11 @@ nsresult nsZipArchive::ExtractFile(nsZipItem *item, nsIFile* outFile,
//-- delete the file on errors, or resolve symlink if needed
if (aFd) {
PR_Close(aFd);
- if (NS_FAILED(rv) && outFile) {
- outFile->Remove(false);
- }
+ if (rv != NS_OK)
+ PR_Delete(outname);
#ifdef XP_UNIX
- else if (item->IsSymlink()) {
- nsAutoCString path;
- rv = outFile->GetNativePath(path);
- if (NS_FAILED(rv)) return rv;
- rv = ResolveSymlink(path.get());
- }
+ else if (item->IsSymlink())
+ rv = ResolveSymlink(outname);
#endif
}
diff --git a/components/jar/src/nsZipArchive.h b/components/jar/src/nsZipArchive.h
index 278f41c5f..6b758c9fd 100644
--- a/components/jar/src/nsZipArchive.h
+++ b/components/jar/src/nsZipArchive.h
@@ -162,7 +162,7 @@ public:
* @param outname Name of file to write to
* @return status code
*/
- nsresult ExtractFile(nsZipItem * zipEntry, nsIFile* outFile, PRFileDesc * outFD);
+ nsresult ExtractFile(nsZipItem * zipEntry, const char *outname, PRFileDesc * outFD);
/**
* FindInit