зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset c0b8f05a48d5 (bug 1246835) for bustage on a CLOSED TREE
This commit is contained in:
Родитель
8c5ad84243
Коммит
c72c544acd
|
@ -65,7 +65,9 @@ GMPChild::~GMPChild()
|
|||
|
||||
static bool
|
||||
GetFileBase(const nsAString& aPluginPath,
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
nsCOMPtr<nsIFile>& aLibDirectory,
|
||||
#endif
|
||||
nsCOMPtr<nsIFile>& aFileBase,
|
||||
nsAutoString& aBaseName)
|
||||
{
|
||||
|
@ -75,9 +77,11 @@ GetFileBase(const nsAString& aPluginPath,
|
|||
return false;
|
||||
}
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
if (NS_FAILED(aFileBase->Clone(getter_AddRefs(aLibDirectory)))) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIFile> parent;
|
||||
rv = aFileBase->GetParent(getter_AddRefs(parent));
|
||||
|
@ -97,22 +101,19 @@ GetFileBase(const nsAString& aPluginPath,
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
GetFileBase(const nsAString& aPluginPath,
|
||||
nsCOMPtr<nsIFile>& aFileBase,
|
||||
nsAutoString& aBaseName)
|
||||
{
|
||||
nsCOMPtr<nsIFile> unusedLibDir;
|
||||
return GetFileBase(aPluginPath, unusedLibDir, aFileBase, aBaseName);
|
||||
}
|
||||
|
||||
static bool
|
||||
GetPluginFile(const nsAString& aPluginPath,
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
nsCOMPtr<nsIFile>& aLibDirectory,
|
||||
#endif
|
||||
nsCOMPtr<nsIFile>& aLibFile)
|
||||
{
|
||||
nsAutoString baseName;
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
GetFileBase(aPluginPath, aLibDirectory, aLibFile, baseName);
|
||||
#else
|
||||
GetFileBase(aPluginPath, aLibFile, baseName);
|
||||
#endif
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
nsAutoString binaryName = NS_LITERAL_STRING("lib") + baseName + NS_LITERAL_STRING(".dylib");
|
||||
|
@ -127,39 +128,22 @@ GetPluginFile(const nsAString& aPluginPath,
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
GetPluginFile(const nsAString& aPluginPath,
|
||||
nsCOMPtr<nsIFile>& aLibFile)
|
||||
{
|
||||
nsCOMPtr<nsIFile> unusedlibDir;
|
||||
return GetPluginFile(aPluginPath, unusedlibDir, aLibFile);
|
||||
}
|
||||
|
||||
static bool
|
||||
GetInfoFile(const nsAString& aPluginPath,
|
||||
nsCOMPtr<nsIFile>& aInfoFile)
|
||||
{
|
||||
nsAutoString baseName;
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
nsCOMPtr<nsIFile> unusedLibDir;
|
||||
GetFileBase(aPluginPath, unusedLibDir, aInfoFile, baseName);
|
||||
#else
|
||||
GetFileBase(aPluginPath, aInfoFile, baseName);
|
||||
#endif
|
||||
nsAutoString infoFileName = baseName + NS_LITERAL_STRING(".info");
|
||||
aInfoFile->AppendRelativePath(infoFileName);
|
||||
return true;
|
||||
}
|
||||
|
||||
static nsCString
|
||||
GetNativeTarget(nsIFile* aFile)
|
||||
{
|
||||
bool isLink;
|
||||
nsCString path;
|
||||
aFile->IsSymlink(&isLink);
|
||||
if (isLink) {
|
||||
aFile->GetNativeTarget(path);
|
||||
} else {
|
||||
aFile->GetNativePath(path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
static bool
|
||||
GetPluginPaths(const nsAString& aPluginPath,
|
||||
|
@ -173,8 +157,19 @@ GetPluginPaths(const nsAString& aPluginPath,
|
|||
|
||||
// Mac sandbox rules expect paths to actual files and directories -- not
|
||||
// soft links.
|
||||
aPluginDirectoryPath = GetNativeTarget(libDirectory);
|
||||
aPluginFilePath = GetNativeTarget(libFile);
|
||||
bool isLink;
|
||||
libDirectory->IsSymlink(&isLink);
|
||||
if (isLink) {
|
||||
libDirectory->GetNativeTarget(aPluginDirectoryPath);
|
||||
} else {
|
||||
libDirectory->GetNativePath(aPluginDirectoryPath);
|
||||
}
|
||||
libFile->IsSymlink(&isLink);
|
||||
if (isLink) {
|
||||
libFile->GetNativeTarget(aPluginFilePath);
|
||||
} else {
|
||||
libFile->GetNativePath(aPluginFilePath);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -210,10 +205,19 @@ GetAppPaths(nsCString &aAppPath, nsCString &aAppBinaryPath)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Mac sandbox rules expect paths to actual files and directories -- not
|
||||
// soft links.
|
||||
aAppPath = GetNativeTarget(app);
|
||||
appBinaryPath = GetNativeTarget(appBinary);
|
||||
bool isLink;
|
||||
app->IsSymlink(&isLink);
|
||||
if (isLink) {
|
||||
app->GetNativeTarget(aAppPath);
|
||||
} else {
|
||||
app->GetNativePath(aAppPath);
|
||||
}
|
||||
appBinary->IsSymlink(&isLink);
|
||||
if (isLink) {
|
||||
appBinary->GetNativeTarget(aAppBinaryPath);
|
||||
} else {
|
||||
appBinary->GetNativePath(aAppBinaryPath);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -584,7 +588,12 @@ GetPluginVoucherFile(const nsAString& aPluginPath,
|
|||
nsCOMPtr<nsIFile>& aOutVoucherFile)
|
||||
{
|
||||
nsAutoString baseName;
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
nsCOMPtr<nsIFile> libDir;
|
||||
GetFileBase(aPluginPath, aOutVoucherFile, libDir, baseName);
|
||||
#else
|
||||
GetFileBase(aPluginPath, aOutVoucherFile, baseName);
|
||||
#endif
|
||||
nsAutoString infoFileName = baseName + NS_LITERAL_STRING(".voucher");
|
||||
aOutVoucherFile->AppendRelativePath(infoFileName);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче