Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8760ce023c | ||
|
|
b86e148bb7 | ||
|
|
9e83721e5e | ||
|
|
dc2d6c2e60 | ||
|
|
4ada6f6762 |
No files matched your search
@@ -160,7 +160,7 @@ nsChromeProtocolHandler::NewChannel2(nsIURI* aURI,
|
||||
file->Exists(&exists);
|
||||
if (!exists) {
|
||||
nsAutoCString path;
|
||||
file->GetPersistentDescriptor(path);
|
||||
file->GetNativePath(path);
|
||||
printf("Chrome file doesn't exist: %s\n", path.get());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
# Referenced by milestone.py.
|
||||
#--------------------------------------------------------
|
||||
|
||||
5.1.0+
|
||||
5.1.0
|
||||
@@ -1018,11 +1018,12 @@ GeckoMediaPluginServiceParent::PluginTerminated(const RefPtr<GMPParent>& aPlugin
|
||||
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
|
||||
|
||||
if (aPlugin->IsMarkedForDeletion()) {
|
||||
nsString path;
|
||||
nsCString path8;
|
||||
RefPtr<nsIFile> dir = aPlugin->GetDirectory();
|
||||
nsresult rv = dir->GetPath(path);
|
||||
nsresult rv = dir->GetNativePath(path8);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
nsString path = NS_ConvertUTF8toUTF16(path8);
|
||||
if (mPluginsWaitingForDeletion.Contains(path)) {
|
||||
RemoveOnGMPThread(path, true /* delete */, true /* can defer */);
|
||||
}
|
||||
|
||||
@@ -2037,14 +2037,10 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
|
||||
|
||||
#ifdef PLUGIN_LOGGING
|
||||
nsAutoCString dirPath;
|
||||
#ifdef XP_WIN
|
||||
pluginsDir->GetPersistentDescriptor(dirPath);
|
||||
#else
|
||||
pluginsDir->GetNativePath(dirPath);
|
||||
#endif
|
||||
PLUGIN_LOG(PLUGIN_LOG_BASIC,
|
||||
("nsPluginHost::ScanPluginsDirectory dir=%s\n", dirPath.get()));
|
||||
#endif // PLUGIN_LOGGING
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> iter;
|
||||
rv = pluginsDir->GetDirectoryEntries(getter_AddRefs(iter));
|
||||
@@ -3619,11 +3615,7 @@ nsPluginHost::CreateTempFileToPost(const char *aPostDataURL, nsIFile **aTmpFile)
|
||||
}
|
||||
rv = inFile->GetFileSize(&fileSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
#ifdef XP_WIN
|
||||
rv = inFile->GetPersistentDescriptor(filename);
|
||||
#else
|
||||
rv = inFile->GetNativePath(filename);
|
||||
#endif
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (fileSize != 0) {
|
||||
|
||||
@@ -1265,11 +1265,7 @@ nsPluginStreamListenerPeer::OnFileAvailable(nsIFile* aFile)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
rv = aFile->GetPersistentDescriptor(path);
|
||||
#else
|
||||
rv = aFile->GetNativePath(path);
|
||||
#endif
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (path.IsEmpty()) {
|
||||
|
||||
@@ -239,7 +239,7 @@ static bool CanLoadPlugin(char16ptr_t aBinaryPath)
|
||||
bool nsPluginsDir::IsPluginFile(nsIFile* file)
|
||||
{
|
||||
nsAutoCString path;
|
||||
if (NS_FAILED(file->GetPersistentDescriptor(path)))
|
||||
if (NS_FAILED(file->GetNativePath(path)))
|
||||
return false;
|
||||
|
||||
const char *cPath = path.get();
|
||||
|
||||
@@ -466,11 +466,7 @@ nsXULPrototypeCache::BeginCaching(nsIURI* aURI)
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
nsAutoCString chromePath;
|
||||
#ifdef XP_WIN
|
||||
rv = chromeDir->GetPersistentDescriptor(chromePath);
|
||||
#else
|
||||
rv = chromeDir->GetNativePath(chromePath);
|
||||
#endif
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
||||
@@ -169,20 +169,13 @@ NS_IMETHODIMP mozHunspell::SetDictionary(const char16_t *aDictionary)
|
||||
|
||||
nsAutoCString dictFileName, affFileName;
|
||||
|
||||
#ifdef XP_WIN
|
||||
// nsIFile->NativePath isn't safe for all character sets on Windows.
|
||||
// Use GetPath and pass it as a UTF-8 to the hunspell lib instead.
|
||||
// Hunspell 1.5+ supports UTF-8 file paths on Windows
|
||||
// by prefixing "\\\\?\\".
|
||||
nsAutoString affFileNameU;
|
||||
nsresult rv = affFile->GetPath(affFileNameU);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
affFileName.AssignLiteral("\\\\?\\");
|
||||
AppendUTF16toUTF8(affFileNameU, affFileName);
|
||||
#else
|
||||
// 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 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);
|
||||
#endif
|
||||
|
||||
if (mAffixFileName.Equals(affFileName.get()))
|
||||
return NS_OK;
|
||||
|
||||
@@ -364,11 +364,7 @@ FPSCounter::WriteFrameTimeStamps()
|
||||
PR_Close(fd);
|
||||
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
rv = resultFile->GetPersistentDescriptor(path);
|
||||
#else
|
||||
rv = resultFile->GetNativePath(path);
|
||||
#endif
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
printf_stderr("Wrote FPS data to file: %s\n", path.get());
|
||||
|
||||
@@ -490,7 +490,7 @@ void RecordingPrefChanged(const char *aPrefName, void *aClosure)
|
||||
nsAdoptingString prefFileName = Preferences::GetString("gfx.2d.recordingfile");
|
||||
|
||||
if (prefFileName) {
|
||||
CopyUTF16toUTF8(prefFileName, fileName);
|
||||
fileName.Append(NS_ConvertUTF16toUTF8(prefFileName));
|
||||
} else {
|
||||
nsCOMPtr<nsIFile> tmpFile;
|
||||
if (NS_FAILED(NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tmpFile)))) {
|
||||
@@ -502,12 +502,7 @@ void RecordingPrefChanged(const char *aPrefName, void *aClosure)
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
#ifdef XP_WIN
|
||||
rv = tmpFile->GetPath(prefFileName);
|
||||
CopyUTF16toUTF8(prefFileName, fileName);
|
||||
#else
|
||||
rv = tmpFile->GetNativePath(fileName);
|
||||
#endif
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -666,23 +666,8 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
|
||||
// Make sure that child processes can find the omnijar
|
||||
// See XRE_InitCommandLine in nsAppRunner.cpp
|
||||
newEnvVars["UXP_CUSTOM_OMNI"] = 1;
|
||||
nsCOMPtr<nsIFile> file = Omnijar::GetPath(Omnijar::GRE);
|
||||
#ifdef XP_WIN
|
||||
nsString path;
|
||||
nsAutoCString childPath;
|
||||
if (file && NS_SUCCEEDED(file->GetPath(path))) {
|
||||
CopyUTF16toUTF8(path, childPath);
|
||||
childArgv.push_back("-greomni");
|
||||
childArgv.push_back(childPath.get());
|
||||
}
|
||||
file = Omnijar::GetPath(Omnijar::APP);
|
||||
if (file && NS_SUCCEEDED(file->GetPath(path))) {
|
||||
CopyUTF16toUTF8(path, childPath);
|
||||
childArgv.push_back("-appomni");
|
||||
childArgv.push_back(childPath.get());
|
||||
}
|
||||
#else
|
||||
nsAutoCString path;
|
||||
nsCOMPtr<nsIFile> file = Omnijar::GetPath(Omnijar::GRE);
|
||||
if (file && NS_SUCCEEDED(file->GetNativePath(path))) {
|
||||
childArgv.push_back("-greomni");
|
||||
childArgv.push_back(path.get());
|
||||
@@ -692,7 +677,6 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
|
||||
childArgv.push_back("-appomni");
|
||||
childArgv.push_back(path.get());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Add the application directory path (-appdir path)
|
||||
|
||||
@@ -117,11 +117,7 @@ RemotePrintJobParent::PrintPage(const nsCString& aPageFileName)
|
||||
}
|
||||
|
||||
nsAutoCString recordingPath;
|
||||
#ifdef XP_WIN
|
||||
rv = recordingFile->GetPersistentDescriptor(recordingPath);
|
||||
#else
|
||||
rv = recordingFile->GetNativePath(recordingPath);
|
||||
#endif
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -482,11 +482,7 @@ NS_IMETHODIMP nsAddrDatabase::OpenMDB(nsIFile *dbName, bool create)
|
||||
nsIMdbThumb *thumb = nullptr;
|
||||
nsAutoCString filePath;
|
||||
|
||||
#ifdef XP_WIN
|
||||
ret = dbName->GetPersistentDescriptor(filePath);
|
||||
#else
|
||||
ret = dbName->GetNativePath(filePath);
|
||||
#endif
|
||||
NS_ENSURE_SUCCESS(ret, ret);
|
||||
|
||||
nsIMdbHeap* dbHeap = nullptr;
|
||||
|
||||
@@ -598,11 +598,7 @@ nsMessenger::DetachAttachmentsWOPrompts(nsIFile* aDestFolder,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
rv = attachmentDestination->GetPersistentDescriptor(path);
|
||||
#else
|
||||
rv = attachmentDestination->GetNativePath(path);
|
||||
#endif
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoString unescapedFileName;
|
||||
@@ -864,11 +860,7 @@ nsMessenger::SaveOneAttachment(const char * aContentType, const char * aURL,
|
||||
SetLastSaveDirectory(localFile);
|
||||
|
||||
nsCString dirName;
|
||||
#ifdef XP_WIN
|
||||
rv = localFile->GetPersistentDescriptor(dirName);
|
||||
#else
|
||||
rv = localFile->GetNativePath(dirName);
|
||||
#endif
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsSaveAllAttachmentsState *saveState =
|
||||
@@ -935,11 +927,7 @@ nsMessenger::SaveAllAttachments(uint32_t count,
|
||||
|
||||
nsCString dirName;
|
||||
nsSaveAllAttachmentsState *saveState = nullptr;
|
||||
#ifdef XP_WIN
|
||||
rv = localFile->GetPersistentDescriptor(dirName);
|
||||
#else
|
||||
rv = localFile->GetNativePath(dirName);
|
||||
#endif
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
saveState = new nsSaveAllAttachmentsState(count,
|
||||
|
||||
@@ -236,11 +236,7 @@ NS_IMETHODIMP nsMsgFolderCache::Init(nsIFile *aFile)
|
||||
aFile->Exists(&exists);
|
||||
|
||||
nsAutoCString dbPath;
|
||||
#ifdef XP_WIN
|
||||
aFile->GetPersistentDescriptor(dbPath);
|
||||
#else
|
||||
aFile->GetNativePath(dbPath);
|
||||
#endif
|
||||
// ### evil cast until MDB supports file streams.
|
||||
nsresult rv = OpenMDB(dbPath, exists);
|
||||
// if this fails and panacea.dat exists, try blowing away the db and recreating it
|
||||
|
||||
@@ -118,11 +118,7 @@ nsMsgCreateTempFileName(const char *tFileName)
|
||||
return nullptr;
|
||||
|
||||
nsCString tempString;
|
||||
#ifdef XP_WIN
|
||||
rv = tmpFile->GetPersistentDescriptor(tempString);
|
||||
#else
|
||||
rv = tmpFile->GetNativePath(tempString);
|
||||
#endif
|
||||
if (NS_FAILED(rv))
|
||||
return nullptr;
|
||||
|
||||
|
||||
@@ -4518,11 +4518,7 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, bool aQuoted, nsString
|
||||
{
|
||||
rv = identity->GetSignature(getter_AddRefs(sigFile));
|
||||
if (NS_SUCCEEDED(rv) && sigFile) {
|
||||
#ifdef XP_WIN
|
||||
rv = sigFile->GetPersistentDescriptor(sigNativePath);
|
||||
#else
|
||||
rv = sigFile->GetNativePath(sigNativePath);
|
||||
#endif
|
||||
if (NS_SUCCEEDED(rv) && !sigNativePath.IsEmpty()) {
|
||||
bool exists = false;
|
||||
sigFile->Exists(&exists);
|
||||
|
||||
@@ -939,11 +939,7 @@ NS_IMETHODIMP nsMsgDatabase::NotifyAnnouncerGoingAway(void)
|
||||
bool nsMsgDatabase::MatchDbName(nsIFile *dbName) // returns true if they match
|
||||
{
|
||||
nsCString dbPath;
|
||||
#ifdef XP_WIN
|
||||
dbName->GetPersistentDescriptor(dbPath);
|
||||
#else
|
||||
dbName->GetNativePath(dbPath);
|
||||
#endif
|
||||
return dbPath.Equals(m_dbName);
|
||||
}
|
||||
|
||||
@@ -1201,11 +1197,7 @@ nsresult nsMsgDatabase::OpenInternal(nsMsgDBService *aDBService,
|
||||
bool aLeaveInvalidDB, bool sync)
|
||||
{
|
||||
nsAutoCString summaryFilePath;
|
||||
#ifdef XP_WIN
|
||||
summaryFile->GetPersistentDescriptor(summaryFilePath);
|
||||
#else
|
||||
summaryFile->GetNativePath(summaryFilePath);
|
||||
#endif
|
||||
|
||||
MOZ_LOG(DBLog, LogLevel::Info, ("nsMsgDatabase::Open(%s, %s, %p, %s)\n",
|
||||
(const char*)summaryFilePath.get(), aCreate ? "TRUE":"FALSE",
|
||||
|
||||
@@ -3203,11 +3203,7 @@ NS_IMETHODIMP nsImapMailFolder::BeginCopy(nsIMsgDBHdr *message)
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
nsCString nativePath;
|
||||
#ifdef XP_WIN
|
||||
m_copyState->m_tmpFile->GetPersistentDescriptor(nativePath);
|
||||
#else
|
||||
m_copyState->m_tmpFile->GetNativePath(nativePath);
|
||||
#endif
|
||||
MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("couldn't remove prev temp file %s: %lx\n", nativePath.get(), rv));
|
||||
}
|
||||
m_copyState->m_tmpFile = nullptr;
|
||||
@@ -8887,11 +8883,7 @@ NS_IMETHODIMP nsImapMailFolder::RenameSubFolders(nsIMsgWindow *msgWindow, nsIMsg
|
||||
newParentPathFile->AppendNative(oldLeafName);
|
||||
|
||||
nsCString newPathStr;
|
||||
#ifdef XP_WIN
|
||||
newParentPathFile->GetPersistentDescriptor(newPathStr);
|
||||
#else
|
||||
newParentPathFile->GetNativePath(newPathStr);
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIFile> newPathFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@@ -887,11 +887,7 @@ bool CMapiMessage::CopyBinAttachToFile(LPATTACH lpAttach,
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
nsCString tmpPath;
|
||||
#ifdef XP_WIN
|
||||
_tmp_file->GetPersistentDescriptor(tmpPath);
|
||||
#else
|
||||
_tmp_file->GetNativePath(tmpPath);
|
||||
#endif
|
||||
LPSTREAM lpStreamFile;
|
||||
HRESULT hr = CMapiApi::OpenStreamOnFile(gpMapiAllocateBuffer, gpMapiFreeBuffer, STGM_READWRITE | STGM_CREATE,
|
||||
const_cast<char*>(tmpPath.get()), NULL, &lpStreamFile);
|
||||
|
||||
@@ -150,11 +150,7 @@ nsLocalURI2Path(const char* rootURI, const char* uriStr,
|
||||
|
||||
nsCString localNativePath;
|
||||
|
||||
#ifdef XP_WIN
|
||||
localPath->GetPersistentDescriptor(localNativePath);
|
||||
#else
|
||||
localPath->GetNativePath(localNativePath);
|
||||
#endif
|
||||
nsEscapeNativePath(localNativePath);
|
||||
pathResult = localNativePath.get();
|
||||
const char *curPos = uriStr + PL_strlen(rootURI);
|
||||
|
||||
@@ -52,11 +52,7 @@ nsresult nsMailboxService::ParseMailbox(nsIMsgWindow *aMsgWindow, nsIFile *aMail
|
||||
// okay now generate the url string
|
||||
nsCString mailboxPath;
|
||||
|
||||
#ifdef XP_WIN
|
||||
aMailboxPath->GetPersistentDescriptor(mailboxPath);
|
||||
#else
|
||||
aMailboxPath->GetNativePath(mailboxPath);
|
||||
#endif
|
||||
nsAutoCString buf;
|
||||
MsgEscapeURL(mailboxPath,
|
||||
nsINetUtil::ESCAPE_URL_MINIMAL | nsINetUtil::ESCAPE_URL_FORCED, buf);
|
||||
|
||||
@@ -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,11 +422,7 @@ nsJAR::GetJarPath(nsACString& aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(mZipFile);
|
||||
|
||||
#ifdef XP_WIN
|
||||
return mZipFile->GetPersistentDescriptor(aResult);
|
||||
#else
|
||||
return mZipFile->GetNativePath(aResult);
|
||||
#endif
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -1124,11 +1124,7 @@ nsZipReaderCache::IsCached(nsIFile* zipFile, bool* aResult)
|
||||
MutexAutoLock lock(mLock);
|
||||
|
||||
nsAutoCString uri;
|
||||
#ifdef XP_WIN
|
||||
rv = zipFile->GetPersistentDescriptor(uri);
|
||||
#else
|
||||
rv = zipFile->GetNativePath(uri);
|
||||
#endif
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@@ -1150,14 +1146,8 @@ nsZipReaderCache::GetZip(nsIFile* zipFile, nsIZipReader* *result)
|
||||
#endif
|
||||
|
||||
nsAutoCString uri;
|
||||
#ifdef XP_WIN
|
||||
rv = zipFile->GetPersistentDescriptor(uri);
|
||||
#else
|
||||
rv = zipFile->GetNativePath(uri);
|
||||
#endif
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
uri.Insert(NS_LITERAL_CSTRING("file:"), 0);
|
||||
|
||||
@@ -1200,14 +1190,8 @@ nsZipReaderCache::GetInnerZip(nsIFile* zipFile, const nsACString &entry,
|
||||
#endif
|
||||
|
||||
nsAutoCString uri;
|
||||
#ifdef XP_WIN
|
||||
rv = zipFile->GetPersistentDescriptor(uri);
|
||||
#else
|
||||
rv = zipFile->GetNativePath(uri);
|
||||
#endif
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
uri.Insert(NS_LITERAL_CSTRING("jar:"), 0);
|
||||
uri.AppendLiteral("!/");
|
||||
@@ -1249,11 +1233,7 @@ nsZipReaderCache::GetFd(nsIFile* zipFile, PRFileDesc** aRetVal)
|
||||
|
||||
nsresult rv;
|
||||
nsAutoCString uri;
|
||||
#ifdef XP_WIN
|
||||
rv = zipFile->GetPersistentDescriptor(uri);
|
||||
#else
|
||||
rv = zipFile->GetNativePath(uri);
|
||||
#endif
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@@ -1394,13 +1374,8 @@ nsZipReaderCache::Observe(nsISupports *aSubject,
|
||||
return NS_OK;
|
||||
|
||||
nsAutoCString uri;
|
||||
#ifdef XP_WIN
|
||||
if (NS_FAILED(file->GetPersistentDescriptor(uri)))
|
||||
return NS_OK;
|
||||
#else
|
||||
if (NS_FAILED(file->GetNativePath(uri)))
|
||||
return NS_OK;
|
||||
#endif
|
||||
|
||||
uri.Insert(NS_LITERAL_CSTRING("file:"), 0);
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -159,10 +159,10 @@ public:
|
||||
*
|
||||
* @param zipEntry Name of file in archive to extract
|
||||
* @param outFD Filedescriptor to write contents to
|
||||
* @param outFile Handle of file to write to
|
||||
* @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
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:set sw=4 sts=4 et cin: */
|
||||
/* 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/. */
|
||||
|
||||
|
||||
/*
|
||||
This converts a filesystem directory into an "HTTP index" stream per
|
||||
|
||||
The converts a filesystem directory into an "HTTP index" stream per
|
||||
Lou Montulli's original spec:
|
||||
|
||||
http://www.mozilla.org/projects/netlib/dirindexformat.html
|
||||
|
||||
*/
|
||||
|
||||
#include "nsEscape.h"
|
||||
@@ -88,11 +92,7 @@ nsDirectoryIndexStream::Init(nsIFile* aDir)
|
||||
|
||||
if (MOZ_LOG_TEST(gLog, LogLevel::Debug)) {
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
aDir->GetPersistentDescriptor(path);
|
||||
#else
|
||||
aDir->GetNativePath(path);
|
||||
#endif
|
||||
MOZ_LOG(gLog, LogLevel::Debug,
|
||||
("nsDirectoryIndexStream[%p]: initialized on %s",
|
||||
this, path.get()));
|
||||
@@ -239,11 +239,7 @@ nsDirectoryIndexStream::Read(char* aBuf, uint32_t aCount, uint32_t* aReadCount)
|
||||
|
||||
if (MOZ_LOG_TEST(gLog, LogLevel::Debug)) {
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
current->GetPersistentDescriptor(path);
|
||||
#else
|
||||
current->GetNativePath(path);
|
||||
#endif
|
||||
MOZ_LOG(gLog, LogLevel::Debug,
|
||||
("nsDirectoryIndexStream[%p]: iterated %s",
|
||||
this, path.get()));
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:set ts=4 sw=4 sts=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/. */
|
||||
@@ -3158,11 +3159,7 @@ nsStandardURL::GetFile(nsIFile **result)
|
||||
|
||||
if (LOG_ENABLED()) {
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
mFile->GetPersistentDescriptor(path);
|
||||
#else
|
||||
mFile->GetNativePath(path);
|
||||
#endif
|
||||
LOG(("nsStandardURL::GetFile [this=%p spec=%s resulting_path=%s]\n",
|
||||
this, mSpec.get(), path.get()));
|
||||
}
|
||||
|
||||
Vendored
-8
@@ -20,19 +20,11 @@ void
|
||||
CacheLogPrintPath(mozilla::LogLevel level, const char * format, nsIFile * item)
|
||||
{
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
nsresult rv = item->GetPersistentDescriptor(path);
|
||||
#else
|
||||
nsresult rv = item->GetNativePath(path);
|
||||
#endif
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
MOZ_LOG(gCacheLog, level, (format, path.get()));
|
||||
} else {
|
||||
#ifdef XP_WIN
|
||||
MOZ_LOG(gCacheLog, level, ("GetPersistentDescriptor failed: %x", rv));
|
||||
#else
|
||||
MOZ_LOG(gCacheLog, level, ("GetNativePath failed: %x", rv));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
-12
@@ -1739,11 +1739,7 @@ nsCacheService::CreateCustomOfflineDevice(nsIFile *aProfileDir,
|
||||
|
||||
if (MOZ_LOG_TEST(gCacheLog, LogLevel::Info)) {
|
||||
nsAutoCString profilePath;
|
||||
#ifdef XP_WIN
|
||||
aProfileDir->GetPersistentDescriptor(profilePath);
|
||||
#else
|
||||
aProfileDir->GetNativePath(profilePath);
|
||||
#endif
|
||||
CACHE_LOG_INFO(("Creating custom offline device, %s, %d",
|
||||
profilePath.BeginReading(), aQuota));
|
||||
}
|
||||
@@ -3097,11 +3093,7 @@ nsCacheService::MoveOrRemoveDiskCache(nsIFile *aOldCacheDir,
|
||||
return;
|
||||
|
||||
nsAutoCString newPath;
|
||||
#ifdef XP_WIN
|
||||
rv = aNewCacheSubdir->GetPersistentDescriptor(newPath);
|
||||
#else
|
||||
rv = aNewCacheSubdir->GetNativePath(newPath);
|
||||
#endif
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
@@ -3113,11 +3105,7 @@ nsCacheService::MoveOrRemoveDiskCache(nsIFile *aOldCacheDir,
|
||||
rv = aNewCacheDir->Create(nsIFile::DIRECTORY_TYPE, 0777);
|
||||
if (NS_SUCCEEDED(rv) || NS_ERROR_FILE_ALREADY_EXISTS == rv) {
|
||||
nsAutoCString oldPath;
|
||||
#ifdef XP_WIN
|
||||
rv = aOldCacheSubdir->GetPersistentDescriptor(oldPath);
|
||||
#else
|
||||
rv = aOldCacheSubdir->GetNativePath(oldPath);
|
||||
#endif
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
if (rename(oldPath.get(), newPath.get()) == 0)
|
||||
|
||||
-4
@@ -287,11 +287,7 @@ nsOfflineCacheEvictionFunction::Apply()
|
||||
for (int32_t i = 0; i < items.Count(); i++) {
|
||||
if (MOZ_LOG_TEST(gCacheLog, LogLevel::Debug)) {
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
items[i]->GetPersistentDescriptor(path);
|
||||
#else
|
||||
items[i]->GetNativePath(path);
|
||||
#endif
|
||||
LOG((" removing %s\n", path.get()));
|
||||
}
|
||||
|
||||
|
||||
@@ -269,11 +269,7 @@ CacheFileContextEvictor::PersistEvictionInfoToDisk(
|
||||
}
|
||||
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
file->GetPersistentDescriptor(path);
|
||||
#else
|
||||
file->GetNativePath(path);
|
||||
#endif
|
||||
|
||||
PRFileDesc *fd;
|
||||
rv = file->OpenNSPRFileDesc(PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE, 0600,
|
||||
@@ -310,11 +306,7 @@ CacheFileContextEvictor::RemoveEvictInfoFromDisk(
|
||||
}
|
||||
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
file->GetPersistentDescriptor(path);
|
||||
#else
|
||||
file->GetNativePath(path);
|
||||
#endif
|
||||
|
||||
rv = file->Remove(false);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
||||
@@ -3096,11 +3096,7 @@ nsresult
|
||||
CacheFileIOManager::TrashDirectory(nsIFile *aFile)
|
||||
{
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
aFile->GetPersistentDescriptor(path);
|
||||
#else
|
||||
aFile->GetNativePath(path);
|
||||
#endif
|
||||
LOG(("CacheFileIOManager::TrashDirectory() [file=%s]", path.get()));
|
||||
|
||||
nsresult rv;
|
||||
@@ -3344,11 +3340,7 @@ CacheFileIOManager::RemoveTrashInternal()
|
||||
"recursively, but this can block IO thread for a while!");
|
||||
if (LOG_ENABLED()) {
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
file->GetPersistentDescriptor(path);
|
||||
#else
|
||||
file->GetNativePath(path);
|
||||
#endif
|
||||
LOG(("CacheFileIOManager::RemoveTrashInternal() - Found a directory in a trash "
|
||||
"directory! It will be removed recursively, but this can block IO "
|
||||
"thread for a while! [file=%s]", path.get()));
|
||||
@@ -3881,11 +3873,7 @@ CacheFileIOManager::SyncRemoveDir(nsIFile *aFile, const char *aDir)
|
||||
|
||||
if (LOG_ENABLED()) {
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
file->GetPersistentDescriptor(path);
|
||||
#else
|
||||
file->GetNativePath(path);
|
||||
#endif
|
||||
LOG(("CacheFileIOManager::SyncRemoveDir() - Removing directory %s",
|
||||
path.get()));
|
||||
}
|
||||
|
||||
@@ -323,8 +323,8 @@ Test(CreateFun create, uint32_t count,
|
||||
|
||||
nsAutoCString inDir;
|
||||
nsAutoCString outDir;
|
||||
(void)inDirSpec->GetPersistentDescriptor(inDir);
|
||||
(void)outDirSpec->GetPersistentDescriptor(outDir);
|
||||
(void)inDirSpec->GetNativePath(inDir);
|
||||
(void)outDirSpec->GetNativePath(outDir);
|
||||
printf("###########\nTest: from %s to %s, bufSize = %d\n",
|
||||
inDir.get(), outDir.get(), bufSize);
|
||||
gTimeSampler.Reset();
|
||||
|
||||
@@ -186,7 +186,7 @@ FileSystemDataSource::Init()
|
||||
NS_NewFileURI(getter_AddRefs(furi), file);
|
||||
NS_ENSURE_TRUE(furi, NS_ERROR_FAILURE);
|
||||
|
||||
file->GetPersistentDescriptor(ieFavoritesDir);
|
||||
file->GetNativePath(ieFavoritesDir);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -193,11 +193,7 @@ CertBlocklist::Init()
|
||||
return rv;
|
||||
}
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
rv = mBackingFile->GetPersistentDescriptor(path);
|
||||
#else
|
||||
rv = mBackingFile->GetNativePath(path);
|
||||
#endif
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -197,11 +197,7 @@ nsresult nsProfileLock::LockWithFcntl(nsIFile *aLockFile)
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsAutoCString lockFilePath;
|
||||
#ifdef XP_WIN
|
||||
rv = aLockFile->GetPersistentDescriptor(lockFilePath);
|
||||
#else
|
||||
rv = aLockFile->GetNativePath(lockFilePath);
|
||||
#endif
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Could not get native path");
|
||||
return rv;
|
||||
@@ -307,11 +303,7 @@ nsresult nsProfileLock::LockWithSymlink(nsIFile *aLockFile, bool aHaveFcntlLock)
|
||||
{
|
||||
nsresult rv;
|
||||
nsAutoCString lockFilePath;
|
||||
#ifdef XP_WIN
|
||||
rv = aLockFile->GetPersistentDescriptor(lockFilePath);
|
||||
#else
|
||||
rv = aLockFile->GetNativePath(lockFilePath);
|
||||
#endif
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Could not get native path");
|
||||
return rv;
|
||||
|
||||
@@ -244,9 +244,6 @@ label[disabled="true"] {
|
||||
|
||||
.tooltip-label {
|
||||
margin: 0;
|
||||
word-wrap: break-word;
|
||||
/* We must specify a min-width, otherwise word-wrap:break-word doesn't work. Bug 630864. */
|
||||
min-width: 1px;
|
||||
}
|
||||
|
||||
.header {
|
||||
|
||||
@@ -254,9 +254,6 @@ label[disabled="true"]:-moz-system-metric(windows-classic) {
|
||||
|
||||
.tooltip-label {
|
||||
margin: 0;
|
||||
word-wrap: break-word;
|
||||
/* We must specify a min-width, otherwise word-wrap:break-word doesn't work. Bug 630864. */
|
||||
min-width: 1px;
|
||||
}
|
||||
|
||||
.header {
|
||||
|
||||
@@ -2031,13 +2031,8 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
|
||||
profile->GetRootDir(getter_AddRefs(prefsJSFile));
|
||||
prefsJSFile->AppendNative(NS_LITERAL_CSTRING("prefs.js"));
|
||||
nsAutoCString pathStr;
|
||||
#ifdef XP_WIN
|
||||
prefsJSFile->GetPersistentDescriptor(pathStr);
|
||||
#else
|
||||
prefsJSFile->GetNativePath(pathStr);
|
||||
#endif
|
||||
PR_fprintf(PR_STDERR, "Success: created profile '%s' at '%s'\n", arg, pathStr.get());
|
||||
|
||||
bool exists;
|
||||
prefsJSFile->Exists(&exists);
|
||||
if (!exists) {
|
||||
@@ -2276,15 +2271,11 @@ CheckCompatibility(nsIFile* aProfileDir, const nsCString& aVersion,
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIFile> lf;
|
||||
rv = NS_NewNativeLocalFile(EmptyCString(), false,
|
||||
rv = NS_NewNativeLocalFile(buf, false,
|
||||
getter_AddRefs(lf));
|
||||
if (NS_FAILED(rv))
|
||||
return false;
|
||||
|
||||
rv = lf->SetPersistentDescriptor(buf);
|
||||
if (NS_FAILED(rv))
|
||||
return false;
|
||||
|
||||
bool eq;
|
||||
rv = lf->Equals(aXULRunnerDir, &eq);
|
||||
if (NS_FAILED(rv) || !eq)
|
||||
@@ -2295,15 +2286,11 @@ CheckCompatibility(nsIFile* aProfileDir, const nsCString& aVersion,
|
||||
if (NS_FAILED(rv))
|
||||
return false;
|
||||
|
||||
rv = NS_NewNativeLocalFile(EmptyCString(), false,
|
||||
rv = NS_NewNativeLocalFile(buf, false,
|
||||
getter_AddRefs(lf));
|
||||
if (NS_FAILED(rv))
|
||||
return false;
|
||||
|
||||
rv = lf->SetPersistentDescriptor(buf);
|
||||
if (NS_FAILED(rv))
|
||||
return false;
|
||||
|
||||
rv = lf->Equals(aAppDir, &eq);
|
||||
if (NS_FAILED(rv) || !eq)
|
||||
return false;
|
||||
@@ -2343,11 +2330,11 @@ WriteVersion(nsIFile* aProfileDir, const nsCString& aVersion,
|
||||
file->AppendNative(FILE_COMPATIBILITY_INFO);
|
||||
|
||||
nsAutoCString platformDir;
|
||||
Unused << aXULRunnerDir->GetPersistentDescriptor(platformDir);
|
||||
aXULRunnerDir->GetNativePath(platformDir);
|
||||
|
||||
nsAutoCString appDir;
|
||||
if (aAppDir)
|
||||
Unused << aAppDir->GetPersistentDescriptor(appDir);
|
||||
aAppDir->GetNativePath(appDir);
|
||||
|
||||
PRFileDesc *fd;
|
||||
nsresult rv =
|
||||
@@ -3686,16 +3673,6 @@ XREMain::XRE_mainRun()
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef XP_WIN
|
||||
nsCOMPtr<nsIFile> profileDir;
|
||||
nsAutoCString path;
|
||||
rv = mDirProvider.GetProfileStartupDir(getter_AddRefs(profileDir));
|
||||
if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(profileDir->GetNativePath(path)) && !IsUTF8(path)) {
|
||||
PR_fprintf(PR_STDERR, "Error: The profile path is not valid UTF-8. Unable to continue.\n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
mDirProvider.DoStartup();
|
||||
|
||||
// As FilePreferences need the profile directory, we must initialize right here.
|
||||
|
||||
@@ -1075,13 +1075,7 @@ nsUpdateProcessor::ProcessUpdate(nsIUpdate* aUpdate)
|
||||
rv = ds->Get(XRE_EXECUTABLE_FILE, NS_GET_IID(nsIFile),
|
||||
getter_AddRefs(binary));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Can't get the binary path");
|
||||
#ifdef XP_WIN
|
||||
nsAutoString binPathW;
|
||||
binary->GetPath(binPathW);
|
||||
NS_ConvertUTF16toUTF8 binPath(binPathW);
|
||||
#else
|
||||
binary->GetNativePath(binPath);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Copy the parameters to the StagedUpdateInfo structure shared with the
|
||||
|
||||
@@ -305,11 +305,7 @@ nsMIMEInfoBase::LaunchWithFile(nsIFile* aFile)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
aFile->GetPersistentDescriptor(path);
|
||||
#else
|
||||
aFile->GetNativePath(path);
|
||||
#endif
|
||||
return LaunchWithIProcess(executable, path);
|
||||
}
|
||||
|
||||
@@ -427,11 +423,7 @@ nsMIMEInfoImpl::LaunchDefaultWithFile(nsIFile* aFile)
|
||||
return NS_ERROR_FILE_NOT_FOUND;
|
||||
|
||||
nsAutoCString nativePath;
|
||||
#ifdef XP_WIN
|
||||
aFile->GetPersistentDescriptor(nativePath);
|
||||
#else
|
||||
aFile->GetNativePath(nativePath);
|
||||
#endif
|
||||
|
||||
return LaunchWithIProcess(mDefaultApplication, nativePath);
|
||||
}
|
||||
|
||||
@@ -169,11 +169,7 @@ nsDeviceContextSpecProxy::CreateUniqueTempPath(nsACString& aFilePath)
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
return recordingFile->GetPersistentDescriptor(aFilePath);
|
||||
#else
|
||||
return recordingFile->GetNativePath(aFilePath);
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* vim: se cin sw=2 ts=2 et : */
|
||||
/* -*- 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
|
||||
@@ -245,7 +246,7 @@ WinTaskbar::GetAppUserModelID(nsAString & aDefaultGroupId) {
|
||||
bool exists = false;
|
||||
if (profileDir && NS_SUCCEEDED(profileDir->Exists(&exists)) && exists) {
|
||||
nsAutoCString path;
|
||||
if (NS_SUCCEEDED(profileDir->GetPersistentDescriptor(path))) {
|
||||
if (NS_SUCCEEDED(profileDir->GetNativePath(path))) {
|
||||
nsAutoString id;
|
||||
id.AppendInt(HashString(path));
|
||||
if (!id.IsEmpty()) {
|
||||
|
||||
@@ -1294,7 +1294,7 @@ nsDataObj :: GetFileContentsInternetShortcut ( FORMATETC& aFE, STGMEDIUM& aSTG )
|
||||
|
||||
rv = mozilla::widget::FaviconHelper::GetOutputIconPath(aUri, icoFile, true);
|
||||
NS_ENSURE_SUCCESS(rv, E_FAIL);
|
||||
rv = icoFile->GetPersistentDescriptor(path);
|
||||
rv = icoFile->GetNativePath(path);
|
||||
NS_ENSURE_SUCCESS(rv, E_FAIL);
|
||||
|
||||
shortcutFormatStr = "[InternetShortcut]\r\nURL=%s\r\n"
|
||||
|
||||
@@ -324,11 +324,7 @@ FifoWatcher::OpenFd()
|
||||
}
|
||||
|
||||
nsAutoCString path;
|
||||
#ifdef XP_WIN
|
||||
rv = file->GetPersistentDescriptor(path);
|
||||
#else
|
||||
rv = file->GetNativePath(path);
|
||||
#endif
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -122,17 +122,10 @@ InitLateWriteChecks()
|
||||
nsCOMPtr<nsIFile> mozFile;
|
||||
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mozFile));
|
||||
if (mozFile) {
|
||||
nsAutoCString writeObserverPath;
|
||||
#ifdef XP_WIN
|
||||
nsAutoString U16Path;
|
||||
nsresult rv = mozFile->GetPath(U16Path);
|
||||
CopyUTF16toUTF8(U16Path, writeObserverPath);
|
||||
#else
|
||||
// On non-Windows just get the native path.
|
||||
nsresult rv = mozFile->GetNativePath(writeObserverPath);
|
||||
#endif
|
||||
if (NS_SUCCEEDED(rv) && writeObserverPath.get()) {
|
||||
sLateWriteObserver = new LateWriteObserver(writeObserverPath.get());
|
||||
nsAutoCString nativePath;
|
||||
nsresult rv = mozFile->GetNativePath(nativePath);
|
||||
if (NS_SUCCEEDED(rv) && nativePath.get()) {
|
||||
sLateWriteObserver = new LateWriteObserver(nativePath.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -688,13 +688,9 @@ NS_InitXPCOM2(nsIServiceManager** aResult,
|
||||
getter_AddRefs(greDir));
|
||||
MOZ_ASSERT(greDir);
|
||||
nsAutoCString nativeGREPath;
|
||||
#ifdef XP_WIN
|
||||
greDir->GetPersistentDescriptor(nativeGREPath);
|
||||
#else
|
||||
greDir->GetNativePath(nativeGREPath);
|
||||
#endif
|
||||
u_setDataDirectory(nativeGREPath.get());
|
||||
#endif // MOZ_ICU_DATA_ARCHIVE
|
||||
#endif
|
||||
|
||||
// Initialize the JS engine.
|
||||
const char* jsInitFailureReason = JS_InitWithFailureDiagnostic();
|
||||
|
||||
@@ -104,13 +104,7 @@ nsNativeModuleLoader::LoadModule(FileLocation& aFile)
|
||||
}
|
||||
|
||||
nsAutoCString filePath;
|
||||
#ifdef XP_WIN
|
||||
nsAutoString filePathW;
|
||||
file->GetPath(filePathW);
|
||||
CopyUTF16toUTF8(filePathW, filePath);
|
||||
#else
|
||||
file->GetNativePath(filePath);
|
||||
#endif
|
||||
|
||||
NativeLoadData data;
|
||||
|
||||
|
||||
@@ -3564,7 +3564,7 @@ nsLocalFile::SetNativeLeafName(const nsACString& aLeafName)
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::GetNativePath(nsACString& aResult)
|
||||
{
|
||||
NS_WARNING("The GetNativePath API is lossy. Use GetPath!");
|
||||
//NS_WARNING("This API is lossy. Use GetPath !");
|
||||
nsAutoString tmp;
|
||||
nsresult rv = GetPath(tmp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
@@ -3578,7 +3578,7 @@ nsLocalFile::GetNativePath(nsACString& aResult)
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::GetNativeCanonicalPath(nsACString& aResult)
|
||||
{
|
||||
NS_WARNING("This method is lossy. Use GetCanonicalPath!");
|
||||
NS_WARNING("This method is lossy. Use GetCanonicalPath !");
|
||||
EnsureShortPath();
|
||||
NS_CopyUnicodeToNative(mShortWorkingPath, aResult);
|
||||
return NS_OK;
|
||||
@@ -3646,7 +3646,7 @@ nsLocalFile::GetNativeTarget(nsACString& aResult)
|
||||
// Check we are correctly initialized.
|
||||
CHECK_mWorkingPath();
|
||||
|
||||
NS_WARNING("This API is lossy. Use GetTarget!");
|
||||
NS_WARNING("This API is lossy. Use GetTarget !");
|
||||
nsAutoString tmp;
|
||||
nsresult rv = GetTarget(tmp);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
||||
@@ -13,10 +13,6 @@ if CONFIG['OS_ARCH'] == 'Darwin':
|
||||
'!xptcstubs_asm_ppc_darwin.s',
|
||||
'xptcinvoke_asm_ppc_rhapsody.s',
|
||||
]
|
||||
if CONFIG['OS_TEST'] == 'x86_64':
|
||||
SOURCES += [
|
||||
'xptcinvoke_asm_x86_64_unix.S',
|
||||
]
|
||||
if '86' in CONFIG['OS_TEST'] and CONFIG['OS_TEST'] != 'x86_64':
|
||||
DEFINES['MOZ_NEED_LEADING_UNDERSCORE'] = True
|
||||
|
||||
@@ -27,11 +23,10 @@ if CONFIG['OS_ARCH'] == 'GNU':
|
||||
'xptcstubs_gcc_x86_unix.cpp'
|
||||
]
|
||||
|
||||
if CONFIG['OS_ARCH'] in ('Linux', 'Bitrig', 'DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD', 'SunOS') or \
|
||||
if CONFIG['OS_ARCH'] in ('Linux', 'Bitrig', 'DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD') or \
|
||||
CONFIG['OS_ARCH'].startswith('GNU_'):
|
||||
if CONFIG['OS_TEST'] == 'x86_64':
|
||||
SOURCES += [
|
||||
'xptcinvoke_asm_x86_64_unix.S',
|
||||
'xptcinvoke_x86_64_unix.cpp',
|
||||
'xptcstubs_x86_64_linux.cpp',
|
||||
]
|
||||
@@ -50,6 +45,22 @@ if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD'):
|
||||
'xptcstubs_ipf64.cpp'
|
||||
]
|
||||
|
||||
# Without the need to accomodate the Sun compiler, Solaris/GCC support is pretty
|
||||
# standard, actually. Not all that different from Linux.
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'SunOS':
|
||||
if CONFIG['OS_TEST'] == 'x86_64':
|
||||
SOURCES += [
|
||||
'xptcinvoke_asm_x86_64_unix.S',
|
||||
'xptcinvoke_x86_64_solaris.cpp',
|
||||
'xptcstubs_x86_64_linux.cpp'
|
||||
]
|
||||
elif '86' in CONFIG['OS_TEST']:
|
||||
SOURCES += [
|
||||
'xptcinvoke_gcc_x86_unix.cpp',
|
||||
'xptcstubs_gcc_x86_unix.cpp'
|
||||
]
|
||||
|
||||
if CONFIG['OS_TEST'] == 'alpha':
|
||||
if CONFIG['OS_ARCH'] in ('Linux', 'FreeBSD', 'NetBSD'):
|
||||
SOURCES += [
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
#include "xptcinvoke_ppc_rhapsody.cpp"
|
||||
#elif defined(__arm__)
|
||||
#include "xptcinvoke_arm.cpp"
|
||||
#elif defined(__aarch64__)
|
||||
#include "xptcinvoke_aarch64.cpp"
|
||||
#else
|
||||
#error unknown cpu architecture
|
||||
#endif
|
||||
@@ -0,0 +1,75 @@
|
||||
/* -*- Mode: C; 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/. */
|
||||
|
||||
// Platform specific code to invoke XPCOM methods on native objects
|
||||
|
||||
#include "xptcprivate.h"
|
||||
|
||||
// 6 integral parameters are passed in registers, but 1 is |this| which isn't
|
||||
// considered here.
|
||||
const uint32_t GPR_COUNT = 5;
|
||||
|
||||
// 8 floating point parameters are passed in SSE registers
|
||||
const uint32_t FPR_COUNT = 8;
|
||||
|
||||
extern "C" void
|
||||
InvokeCopyToStack(uint64_t * gpregs, double * fpregs,
|
||||
uint32_t paramCount, nsXPTCVariant * s,
|
||||
uint64_t* d)
|
||||
{
|
||||
uint32_t nr_gpr = 0u; // skip one GP register for 'that'
|
||||
uint32_t nr_fpr = 0u;
|
||||
uint64_t value = 0u;
|
||||
|
||||
for (uint32_t i = 0; i < paramCount; i++, s++) {
|
||||
if (s->IsPtrData())
|
||||
value = (uint64_t) s->ptr;
|
||||
else {
|
||||
switch (s->type) {
|
||||
case nsXPTType::T_FLOAT: break;
|
||||
case nsXPTType::T_DOUBLE: break;
|
||||
case nsXPTType::T_I8: value = s->val.i8; break;
|
||||
case nsXPTType::T_I16: value = s->val.i16; break;
|
||||
case nsXPTType::T_I32: value = s->val.i32; break;
|
||||
case nsXPTType::T_I64: value = s->val.i64; break;
|
||||
case nsXPTType::T_U8: value = s->val.u8; break;
|
||||
case nsXPTType::T_U16: value = s->val.u16; break;
|
||||
case nsXPTType::T_U32: value = s->val.u32; break;
|
||||
case nsXPTType::T_U64: value = s->val.u64; break;
|
||||
case nsXPTType::T_BOOL: value = s->val.b; break;
|
||||
case nsXPTType::T_CHAR: value = s->val.c; break;
|
||||
case nsXPTType::T_WCHAR: value = s->val.wc; break;
|
||||
default: value = (uint64_t) s->val.p; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!s->IsPtrData() && s->type == nsXPTType::T_DOUBLE) {
|
||||
if (nr_fpr < FPR_COUNT)
|
||||
fpregs[nr_fpr++] = s->val.d;
|
||||
else {
|
||||
*((double *)d) = s->val.d;
|
||||
d++;
|
||||
}
|
||||
}
|
||||
else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) {
|
||||
if (nr_fpr < FPR_COUNT)
|
||||
// The value in %xmm register is already prepared to
|
||||
// be retrieved as a float. Therefore, we pass the
|
||||
// value verbatim, as a double without conversion.
|
||||
fpregs[nr_fpr++] = s->val.d;
|
||||
else {
|
||||
*((float *)d) = s->val.f;
|
||||
d++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (nr_gpr < GPR_COUNT)
|
||||
gpregs[nr_gpr++] = value;
|
||||
else
|
||||
*d++ = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,19 +8,46 @@
|
||||
|
||||
#include "xptcprivate.h"
|
||||
|
||||
// 6 integral parameters are passed in registers, but 1 is |this| which isn't
|
||||
// considered here.
|
||||
const uint32_t GPR_COUNT = 5;
|
||||
// 6 integral parameters are passed in registers
|
||||
const uint32_t GPR_COUNT = 6;
|
||||
|
||||
// 8 floating point parameters are passed in SSE registers
|
||||
const uint32_t FPR_COUNT = 8;
|
||||
|
||||
extern "C" void
|
||||
InvokeCopyToStack(uint64_t * gpregs, double * fpregs,
|
||||
uint32_t paramCount, nsXPTCVariant * s,
|
||||
uint64_t* d)
|
||||
// Remember that these 'words' are 64-bit long
|
||||
static inline void
|
||||
invoke_count_words(uint32_t paramCount, nsXPTCVariant * s,
|
||||
uint32_t & nr_stack)
|
||||
{
|
||||
uint32_t nr_gpr = 0u;
|
||||
uint32_t nr_gpr;
|
||||
uint32_t nr_fpr;
|
||||
nr_gpr = 1; // skip one GP register for 'that'
|
||||
nr_fpr = 0;
|
||||
nr_stack = 0;
|
||||
|
||||
/* Compute number of eightbytes of class MEMORY. */
|
||||
for (uint32_t i = 0; i < paramCount; i++, s++) {
|
||||
if (!s->IsPtrData()
|
||||
&& (s->type == nsXPTType::T_FLOAT || s->type == nsXPTType::T_DOUBLE)) {
|
||||
if (nr_fpr < FPR_COUNT)
|
||||
nr_fpr++;
|
||||
else
|
||||
nr_stack++;
|
||||
}
|
||||
else {
|
||||
if (nr_gpr < GPR_COUNT)
|
||||
nr_gpr++;
|
||||
else
|
||||
nr_stack++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
invoke_copy_to_stack(uint64_t * d, uint32_t paramCount, nsXPTCVariant * s,
|
||||
uint64_t * gpregs, double * fpregs)
|
||||
{
|
||||
uint32_t nr_gpr = 1u; // skip one GP register for 'that'
|
||||
uint32_t nr_fpr = 0u;
|
||||
uint64_t value = 0u;
|
||||
|
||||
@@ -73,3 +100,89 @@ InvokeCopyToStack(uint64_t * gpregs, double * fpregs,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Disable avx for the next function to allow compilation with
|
||||
// -march=native on new machines, or similar hardcoded -march options.
|
||||
// Having avx enabled appears to change the alignment behavior of alloca
|
||||
// (apparently adding an extra 16 bytes) of padding/alignment (and using
|
||||
// 32-byte alignment instead of 16-byte). This seems to be the best
|
||||
// available workaround, given that this code, which should perhaps
|
||||
// better be written in assembly, is written in C++.
|
||||
#ifndef __clang__
|
||||
#pragma GCC push_options
|
||||
#pragma GCC target ("no-avx")
|
||||
#endif
|
||||
|
||||
// Avoid AddressSanitizer instrumentation for the next function because it
|
||||
// depends on __builtin_alloca behavior and alignment that cannot be relied on
|
||||
// once the function is compiled with a version of ASan that has dynamic-alloca
|
||||
// instrumentation enabled.
|
||||
|
||||
MOZ_ASAN_BLACKLIST
|
||||
EXPORT_XPCOM_API(nsresult)
|
||||
NS_InvokeByIndex(nsISupports * that, uint32_t methodIndex,
|
||||
uint32_t paramCount, nsXPTCVariant * params)
|
||||
{
|
||||
uint32_t nr_stack;
|
||||
invoke_count_words(paramCount, params, nr_stack);
|
||||
|
||||
// Stack, if used, must be 16-bytes aligned
|
||||
if (nr_stack)
|
||||
nr_stack = (nr_stack + 1) & ~1;
|
||||
|
||||
// Load parameters to stack, if necessary
|
||||
uint64_t *stack = (uint64_t *) __builtin_alloca(nr_stack * 8);
|
||||
uint64_t gpregs[GPR_COUNT];
|
||||
double fpregs[FPR_COUNT];
|
||||
invoke_copy_to_stack(stack, paramCount, params, gpregs, fpregs);
|
||||
|
||||
// We used to have switches to make sure we would only load the registers
|
||||
// that are needed for this call. That produced larger code that was
|
||||
// not faster in practice. It also caused compiler warnings about the
|
||||
// variables being used uninitialized.
|
||||
// We now just load every every register. There could still be a warning
|
||||
// from a memory analysis tools that we are loading uninitialized stack
|
||||
// positions.
|
||||
|
||||
// FIXME: this function depends on the above __builtin_alloca placing
|
||||
// the array in the correct spot for the ABI.
|
||||
|
||||
// Load FPR registers from fpregs[]
|
||||
double d0, d1, d2, d3, d4, d5, d6, d7;
|
||||
|
||||
d7 = fpregs[7];
|
||||
d6 = fpregs[6];
|
||||
d5 = fpregs[5];
|
||||
d4 = fpregs[4];
|
||||
d3 = fpregs[3];
|
||||
d2 = fpregs[2];
|
||||
d1 = fpregs[1];
|
||||
d0 = fpregs[0];
|
||||
|
||||
// Load GPR registers from gpregs[]
|
||||
uint64_t a0, a1, a2, a3, a4, a5;
|
||||
|
||||
a5 = gpregs[5];
|
||||
a4 = gpregs[4];
|
||||
a3 = gpregs[3];
|
||||
a2 = gpregs[2];
|
||||
a1 = gpregs[1];
|
||||
a0 = (uint64_t) that;
|
||||
|
||||
// Get pointer to method
|
||||
uint64_t methodAddress = *((uint64_t *)that);
|
||||
methodAddress += 8 * methodIndex;
|
||||
methodAddress = *((uint64_t *)methodAddress);
|
||||
|
||||
typedef nsresult (*Method)(uint64_t, uint64_t, uint64_t, uint64_t,
|
||||
uint64_t, uint64_t, double, double, double,
|
||||
double, double, double, double, double);
|
||||
nsresult result = ((Method)methodAddress)(a0, a1, a2, a3, a4, a5,
|
||||
d0, d1, d2, d3, d4, d5,
|
||||
d6, d7);
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifndef __clang__
|
||||
#pragma GCC pop_options
|
||||
#endif
|
||||
Reference in new issue
Block a user