mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 15:58:39 +09:00
Issue #1751 -- Remove XP_MACOSX conditionals from the rest of the tree.
This also removes some PP abuse and takes file entries out of PP when no longer needed without XP_MACOSX conditionals.
This commit is contained in:
parent
02c59100a8
commit
a4b0f333ba
153 changed files with 173 additions and 4556 deletions
|
|
@ -13,11 +13,6 @@
|
|||
#include "nsAutoPtr.h"
|
||||
#endif
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
|
@ -426,10 +421,7 @@ nsresult nsProfileLock::GetReplacedLockTime(PRTime *aResult) {
|
|||
nsresult nsProfileLock::Lock(nsIFile* aProfileDir,
|
||||
nsIProfileUnlocker* *aUnlocker)
|
||||
{
|
||||
#if defined (XP_MACOSX)
|
||||
NS_NAMED_LITERAL_STRING(LOCKFILE_NAME, ".parentlock");
|
||||
NS_NAMED_LITERAL_STRING(OLD_LOCKFILE_NAME, "parent.lock");
|
||||
#elif defined (XP_UNIX)
|
||||
#if defined (XP_UNIX)
|
||||
NS_NAMED_LITERAL_STRING(OLD_LOCKFILE_NAME, "lock");
|
||||
NS_NAMED_LITERAL_STRING(LOCKFILE_NAME, ".parentlock");
|
||||
#else
|
||||
|
|
@ -458,67 +450,7 @@ nsresult nsProfileLock::Lock(nsIFile* aProfileDir,
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
// First, try locking using fcntl. It is more reliable on
|
||||
// a local machine, but may not be supported by an NFS server.
|
||||
|
||||
rv = LockWithFcntl(lockFile);
|
||||
if (NS_FAILED(rv) && (rv != NS_ERROR_FILE_ACCESS_DENIED))
|
||||
{
|
||||
// If that failed for any reason other than NS_ERROR_FILE_ACCESS_DENIED,
|
||||
// assume we tried an NFS that does not support it. Now, try with symlink.
|
||||
rv = LockWithSymlink(lockFile, false);
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// Check for the old-style lock used by pre-mozilla 1.3 builds.
|
||||
// Those builds used an earlier check to prevent the application
|
||||
// from launching if another instance was already running. Because
|
||||
// of that, we don't need to create an old-style lock as well.
|
||||
struct LockProcessInfo
|
||||
{
|
||||
ProcessSerialNumber psn;
|
||||
unsigned long launchDate;
|
||||
};
|
||||
|
||||
PRFileDesc *fd = nullptr;
|
||||
int32_t ioBytes;
|
||||
ProcessInfoRec processInfo;
|
||||
LockProcessInfo lockProcessInfo;
|
||||
|
||||
rv = lockFile->SetLeafName(OLD_LOCKFILE_NAME);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = lockFile->OpenNSPRFileDesc(PR_RDONLY, 0, &fd);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
ioBytes = PR_Read(fd, &lockProcessInfo, sizeof(LockProcessInfo));
|
||||
PR_Close(fd);
|
||||
|
||||
if (ioBytes == sizeof(LockProcessInfo))
|
||||
{
|
||||
#ifdef __LP64__
|
||||
processInfo.processAppRef = nullptr;
|
||||
#else
|
||||
processInfo.processAppSpec = nullptr;
|
||||
#endif
|
||||
processInfo.processName = nullptr;
|
||||
processInfo.processInfoLength = sizeof(ProcessInfoRec);
|
||||
if (::GetProcessInformation(&lockProcessInfo.psn, &processInfo) == noErr &&
|
||||
processInfo.processLaunchDate == lockProcessInfo.launchDate)
|
||||
{
|
||||
return NS_ERROR_FILE_ACCESS_DENIED;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_WARNING("Could not read lock file - ignoring lock");
|
||||
}
|
||||
}
|
||||
rv = NS_OK; // Don't propagate error from OpenNSPRFileDesc.
|
||||
}
|
||||
#elif defined(XP_UNIX)
|
||||
#if defined(XP_UNIX)
|
||||
// Get the old lockfile name
|
||||
nsCOMPtr<nsIFile> oldLockFile;
|
||||
rv = aProfileDir->Clone(getter_AddRefs(oldLockFile));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue