mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 10:57:34 +09:00
Remove GMP sandbox code.
This commit is contained in:
parent
369378d566
commit
aa9ae963f6
15 changed files with 0 additions and 497 deletions
|
|
@ -36,12 +36,6 @@ static const int MAX_VOUCHER_LENGTH = 500000;
|
|||
#include <unistd.h> // for _exit()
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_GMP_SANDBOX)
|
||||
#if defined(XP_MACOSX)
|
||||
#include "mozilla/Sandbox.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
#undef LOG
|
||||
|
|
@ -131,7 +125,6 @@ GetPluginFile(const nsAString& aPluginPath,
|
|||
return true;
|
||||
}
|
||||
|
||||
#if !defined(XP_MACOSX) || !defined(MOZ_GMP_SANDBOX)
|
||||
static bool
|
||||
GetPluginFile(const nsAString& aPluginPath,
|
||||
nsCOMPtr<nsIFile>& aLibFile)
|
||||
|
|
@ -139,110 +132,6 @@ GetPluginFile(const nsAString& aPluginPath,
|
|||
nsCOMPtr<nsIFile> unusedlibDir;
|
||||
return GetPluginFile(aPluginPath, unusedlibDir, aLibFile);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
static nsCString
|
||||
GetNativeTarget(nsIFile* aFile)
|
||||
{
|
||||
bool isLink;
|
||||
nsCString path;
|
||||
aFile->IsSymlink(&isLink);
|
||||
if (isLink) {
|
||||
aFile->GetNativeTarget(path);
|
||||
} else {
|
||||
aFile->GetNativePath(path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
static bool
|
||||
GetPluginPaths(const nsAString& aPluginPath,
|
||||
nsCString &aPluginDirectoryPath,
|
||||
nsCString &aPluginFilePath)
|
||||
{
|
||||
nsCOMPtr<nsIFile> libDirectory, libFile;
|
||||
if (!GetPluginFile(aPluginPath, libDirectory, libFile)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mac sandbox rules expect paths to actual files and directories -- not
|
||||
// soft links.
|
||||
libDirectory->Normalize();
|
||||
aPluginDirectoryPath = GetNativeTarget(libDirectory);
|
||||
|
||||
libFile->Normalize();
|
||||
aPluginFilePath = GetNativeTarget(libFile);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
GetAppPaths(nsCString &aAppPath, nsCString &aAppBinaryPath)
|
||||
{
|
||||
nsAutoCString appPath;
|
||||
nsAutoCString appBinaryPath(
|
||||
(CommandLine::ForCurrentProcess()->argv()[0]).c_str());
|
||||
|
||||
nsAutoCString::const_iterator start, end;
|
||||
appBinaryPath.BeginReading(start);
|
||||
appBinaryPath.EndReading(end);
|
||||
if (RFindInReadable(NS_LITERAL_CSTRING(".app/Contents/MacOS/"), start, end)) {
|
||||
end = start;
|
||||
++end; ++end; ++end; ++end;
|
||||
appBinaryPath.BeginReading(start);
|
||||
appPath.Assign(Substring(start, end));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> app, appBinary;
|
||||
nsresult rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(appPath),
|
||||
true, getter_AddRefs(app));
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(appBinaryPath),
|
||||
true, getter_AddRefs(appBinary));
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Mac sandbox rules expect paths to actual files and directories -- not
|
||||
// soft links.
|
||||
aAppPath = GetNativeTarget(app);
|
||||
appBinaryPath = GetNativeTarget(appBinary);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
GMPChild::SetMacSandboxInfo(MacSandboxPluginType aPluginType)
|
||||
{
|
||||
if (!mGMPLoader) {
|
||||
return false;
|
||||
}
|
||||
nsAutoCString pluginDirectoryPath, pluginFilePath;
|
||||
if (!GetPluginPaths(mPluginPath, pluginDirectoryPath, pluginFilePath)) {
|
||||
return false;
|
||||
}
|
||||
nsAutoCString appPath, appBinaryPath;
|
||||
if (!GetAppPaths(appPath, appBinaryPath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MacSandboxInfo info;
|
||||
info.type = MacSandboxType_Plugin;
|
||||
info.pluginInfo.type = aPluginType;
|
||||
info.pluginInfo.pluginPath.assign(pluginDirectoryPath.get());
|
||||
info.pluginInfo.pluginBinaryPath.assign(pluginFilePath.get());
|
||||
info.appPath.assign(appPath.get());
|
||||
info.appBinaryPath.assign(appBinaryPath.get());
|
||||
|
||||
mGMPLoader->SetSandboxInfo(&info);
|
||||
return true;
|
||||
}
|
||||
#endif // XP_MACOSX && MOZ_GMP_SANDBOX
|
||||
|
||||
bool
|
||||
GMPChild::Init(const nsAString& aPluginPath,
|
||||
|
|
@ -324,14 +213,6 @@ GMPChild::RecvPreloadLibs(const nsCString& aLibs)
|
|||
bool
|
||||
GMPChild::GetUTF8LibPath(nsACString& aOutLibPath)
|
||||
{
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
nsAutoCString pluginDirectoryPath, pluginFilePath;
|
||||
if (!GetPluginPaths(mPluginPath, pluginDirectoryPath, pluginFilePath)) {
|
||||
MOZ_CRASH("Error scanning plugin path");
|
||||
}
|
||||
aOutLibPath.Assign(pluginFilePath);
|
||||
return true;
|
||||
#else
|
||||
nsCOMPtr<nsIFile> libFile;
|
||||
if (!GetPluginFile(mPluginPath, libFile)) {
|
||||
return false;
|
||||
|
|
@ -347,7 +228,6 @@ GMPChild::GetUTF8LibPath(nsACString& aOutLibPath)
|
|||
aOutLibPath = NS_ConvertUTF16toUTF8(path);
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -377,17 +257,6 @@ GMPChild::AnswerStartPlugin(const nsString& aAdapter)
|
|||
}
|
||||
|
||||
bool isWidevine = aAdapter.EqualsLiteral("widevine");
|
||||
#if defined(MOZ_GMP_SANDBOX) && defined(XP_MACOSX)
|
||||
MacSandboxPluginType pluginType = MacSandboxPluginType_GMPlugin_Default;
|
||||
if (isWidevine) {
|
||||
pluginType = MacSandboxPluginType_GMPlugin_EME_Widevine;
|
||||
}
|
||||
if (!SetMacSandboxInfo(pluginType)) {
|
||||
NS_WARNING("Failed to set Mac GMP sandbox info");
|
||||
delete platformAPI;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
GMPAdapter* adapter = (isWidevine) ? new WidevineAdapter() : nullptr;
|
||||
if (!mGMPLoader->Load(libPath.get(),
|
||||
|
|
|
|||
|
|
@ -40,10 +40,6 @@ public:
|
|||
// GMPAsyncShutdownHost
|
||||
void ShutdownComplete() override;
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
bool SetMacSandboxInfo(MacSandboxPluginType aPluginType);
|
||||
#endif
|
||||
|
||||
private:
|
||||
friend class GMPContentChild;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,10 +44,6 @@ public:
|
|||
|
||||
void Shutdown() override;
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
void SetSandboxInfo(MacSandboxInfo* aSandboxInfo) override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
SandboxStarter* mSandboxStarter;
|
||||
UniquePtr<GMPAdapter> mAdapter;
|
||||
|
|
@ -208,15 +204,6 @@ GMPLoaderImpl::Shutdown()
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
void
|
||||
GMPLoaderImpl::SetSandboxInfo(MacSandboxInfo* aSandboxInfo)
|
||||
{
|
||||
if (mSandboxStarter) {
|
||||
mSandboxStarter->SetSandboxInfo(aSandboxInfo);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} // namespace gmp
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,6 @@
|
|||
#include "gmp-entrypoints.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
#include "mozilla/Sandbox.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace gmp {
|
||||
|
||||
|
|
@ -23,12 +19,6 @@ class SandboxStarter {
|
|||
public:
|
||||
virtual ~SandboxStarter() {}
|
||||
virtual bool Start(const char* aLibPath) = 0;
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
// On OS X we need to set Mac-specific sandbox info just before we start the
|
||||
// sandbox, which we don't yet know when the GMPLoader and SandboxStarter
|
||||
// objects are created.
|
||||
virtual void SetSandboxInfo(MacSandboxInfo* aSandboxInfo) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
// Interface that adapts a plugin to the GMP API.
|
||||
|
|
@ -94,13 +84,6 @@ public:
|
|||
// Calls the GMPShutdown function exported by the GMP lib, and unloads the
|
||||
// plugin library.
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
|
||||
// On OS X we need to set Mac-specific sandbox info just before we start the
|
||||
// sandbox, which we don't yet know when the GMPLoader and SandboxStarter
|
||||
// objects are created.
|
||||
virtual void SetSandboxInfo(MacSandboxInfo* aSandboxInfo) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
// On Desktop, this function resides in plugin-container.
|
||||
|
|
|
|||
|
|
@ -18,9 +18,6 @@
|
|||
#include "nsIObserverService.h"
|
||||
#include "GMPTimerParent.h"
|
||||
#include "runnable_utils.h"
|
||||
#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
|
||||
#include "mozilla/SandboxInfo.h"
|
||||
#endif
|
||||
#include "GMPContentParent.h"
|
||||
#include "MediaPrefs.h"
|
||||
#include "VideoUtils.h"
|
||||
|
|
@ -749,14 +746,6 @@ GMPParent::ReadGMPInfoFile(nsIFile* aFile)
|
|||
if (cap.mAPIName.EqualsLiteral(GMP_API_DECRYPTOR)) {
|
||||
mCanDecrypt = true;
|
||||
|
||||
#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
|
||||
if (!mozilla::SandboxInfo::Get().CanSandboxMedia()) {
|
||||
printf_stderr("GMPParent::ReadGMPMetaData: Plugin \"%s\" is an EME CDM"
|
||||
" but this system can't sandbox it; not loading.\n",
|
||||
mDisplayName.get());
|
||||
return GenericPromise::CreateAndReject(NS_ERROR_FAILURE, __func__);
|
||||
}
|
||||
#endif
|
||||
#ifdef XP_WIN
|
||||
// Adobe GMP doesn't work without SSE2. Check the tags to see if
|
||||
// the decryptor is for the Adobe GMP, and refuse to load it if
|
||||
|
|
|
|||
|
|
@ -25,9 +25,6 @@
|
|||
#include "nsComponentManagerUtils.h"
|
||||
#include "runnable_utils.h"
|
||||
#include "VideoUtils.h"
|
||||
#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
|
||||
#include "mozilla/SandboxInfo.h"
|
||||
#endif
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
|
|
@ -485,14 +482,6 @@ GeckoMediaPluginService::GetGMPDecryptor(GMPCrashHelper* aHelper,
|
|||
const nsACString& aNodeId,
|
||||
UniquePtr<GetGMPDecryptorCallback>&& aCallback)
|
||||
{
|
||||
#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
|
||||
if (!SandboxInfo::Get().CanSandboxMedia()) {
|
||||
NS_WARNING("GeckoMediaPluginService::GetGMPDecryptor: "
|
||||
"EME decryption not available without sandboxing support.");
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
#endif
|
||||
|
||||
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
|
||||
NS_ENSURE_ARG(aTags && aTags->Length() > 0);
|
||||
NS_ENSURE_ARG(aCallback);
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@
|
|||
#include "nsComponentManagerUtils.h"
|
||||
#include "runnable_utils.h"
|
||||
#include "VideoUtils.h"
|
||||
#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
|
||||
#include "mozilla/SandboxInfo.h"
|
||||
#endif
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
|
|
@ -960,15 +957,6 @@ GeckoMediaPluginServiceParent::SelectPluginForAPI(const nsACString& aNodeId,
|
|||
RefPtr<GMPParent>
|
||||
CreateGMPParent()
|
||||
{
|
||||
#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
|
||||
if (!SandboxInfo::Get().CanSandboxMedia()) {
|
||||
if (!MediaPrefs::GMPAllowInsecure()) {
|
||||
NS_WARNING("Denying media plugin load due to lack of sandboxing.");
|
||||
return nullptr;
|
||||
}
|
||||
NS_WARNING("Loading media plugin despite lack of sandboxing.");
|
||||
}
|
||||
#endif
|
||||
return new GMPParent();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue