diff options
Diffstat (limited to 'dom/media')
-rw-r--r-- | dom/media/gmp/GMPChild.cpp | 131 | ||||
-rw-r--r-- | dom/media/gmp/GMPChild.h | 4 | ||||
-rw-r--r-- | dom/media/gmp/GMPLoader.cpp | 13 | ||||
-rw-r--r-- | dom/media/gmp/GMPLoader.h | 17 | ||||
-rw-r--r-- | dom/media/gmp/GMPParent.cpp | 11 | ||||
-rw-r--r-- | dom/media/gmp/GMPProcessParent.cpp | 34 | ||||
-rw-r--r-- | dom/media/gmp/GMPService.cpp | 11 | ||||
-rw-r--r-- | dom/media/gmp/GMPServiceParent.cpp | 12 | ||||
-rw-r--r-- | dom/media/gmp/rlz/GMPDeviceBinding.cpp | 8 | ||||
-rw-r--r-- | dom/media/gmp/rlz/moz.build | 7 |
10 files changed, 0 insertions, 248 deletions
diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp index f8e75e299..f83a927ca 100644 --- a/dom/media/gmp/GMPChild.cpp +++ b/dom/media/gmp/GMPChild.cpp @@ -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(), diff --git a/dom/media/gmp/GMPChild.h b/dom/media/gmp/GMPChild.h index d5314cf96..a4f688901 100644 --- a/dom/media/gmp/GMPChild.h +++ b/dom/media/gmp/GMPChild.h @@ -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; diff --git a/dom/media/gmp/GMPLoader.cpp b/dom/media/gmp/GMPLoader.cpp index c10208a49..0bccdd0b1 100644 --- a/dom/media/gmp/GMPLoader.cpp +++ b/dom/media/gmp/GMPLoader.cpp @@ -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 diff --git a/dom/media/gmp/GMPLoader.h b/dom/media/gmp/GMPLoader.h index 60581be2d..8e6b3cfac 100644 --- a/dom/media/gmp/GMPLoader.h +++ b/dom/media/gmp/GMPLoader.h @@ -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. diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index 00bc97777..851634ce7 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -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 diff --git a/dom/media/gmp/GMPProcessParent.cpp b/dom/media/gmp/GMPProcessParent.cpp index 2fe7306a4..ef58175e8 100644 --- a/dom/media/gmp/GMPProcessParent.cpp +++ b/dom/media/gmp/GMPProcessParent.cpp @@ -8,9 +8,6 @@ #include "GMPUtils.h" #include "nsIFile.h" #include "nsIRunnable.h" -#if defined(XP_WIN) && defined(MOZ_SANDBOX) -#include "WinUtils.h" -#endif #include "base/string_util.h" #include "base/process_util.h" @@ -56,38 +53,7 @@ GMPProcessParent::Launch(int32_t aTimeoutMs) vector<string> args; -#if defined(XP_WIN) && defined(MOZ_SANDBOX) - std::wstring wGMPPath = UTF8ToWide(mGMPPath.c_str()); - - // The sandbox doesn't allow file system rules where the paths contain - // symbolic links or junction points. Sometimes the Users folder has been - // moved to another drive using a junction point, so allow for this specific - // case. See bug 1236680 for details. - if (!widget::WinUtils::ResolveJunctionPointsAndSymLinks(wGMPPath)) { - GMP_LOG("ResolveJunctionPointsAndSymLinks failed for GMP path=%S", - wGMPPath.c_str()); - NS_WARNING("ResolveJunctionPointsAndSymLinks failed for GMP path."); - return false; - } - GMP_LOG("GMPProcessParent::Launch() resolved path to %S", wGMPPath.c_str()); - - // If the GMP path is a network path that is not mapped to a drive letter, - // then we need to fix the path format for the sandbox rule. - wchar_t volPath[MAX_PATH]; - if (::GetVolumePathNameW(wGMPPath.c_str(), volPath, MAX_PATH) && - ::GetDriveTypeW(volPath) == DRIVE_REMOTE && - wGMPPath.compare(0, 2, L"\\\\") == 0) { - std::wstring sandboxGMPPath(wGMPPath); - sandboxGMPPath.insert(1, L"??\\UNC"); - mAllowedFilesRead.push_back(sandboxGMPPath + L"\\*"); - } else { - mAllowedFilesRead.push_back(wGMPPath + L"\\*"); - } - - args.push_back(WideToUTF8(wGMPPath)); -#else args.push_back(mGMPPath); -#endif args.push_back(string(voucherPath.BeginReading(), voucherPath.EndReading())); diff --git a/dom/media/gmp/GMPService.cpp b/dom/media/gmp/GMPService.cpp index 65f4037ee..1901210da 100644 --- a/dom/media/gmp/GMPService.cpp +++ b/dom/media/gmp/GMPService.cpp @@ -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); diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp index f25c36811..b58ab8853 100644 --- a/dom/media/gmp/GMPServiceParent.cpp +++ b/dom/media/gmp/GMPServiceParent.cpp @@ -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(); } diff --git a/dom/media/gmp/rlz/GMPDeviceBinding.cpp b/dom/media/gmp/rlz/GMPDeviceBinding.cpp index c8aee2bcd..3525f0462 100644 --- a/dom/media/gmp/rlz/GMPDeviceBinding.cpp +++ b/dom/media/gmp/rlz/GMPDeviceBinding.cpp @@ -12,10 +12,6 @@ #ifdef XP_WIN #include "windows.h" -#ifdef MOZ_SANDBOX -#include <intrin.h> -#include <assert.h> -#endif #endif #if defined(HASH_NODE_ID_WITH_DEVICE_ID) @@ -35,10 +31,6 @@ #ifdef XP_WIN #include "windows.h" -#ifdef MOZ_SANDBOX -#include <intrin.h> -#include <assert.h> -#endif #endif #ifdef XP_MACOSX diff --git a/dom/media/gmp/rlz/moz.build b/dom/media/gmp/rlz/moz.build index f366c2b5d..5e85357f1 100644 --- a/dom/media/gmp/rlz/moz.build +++ b/dom/media/gmp/rlz/moz.build @@ -13,13 +13,6 @@ UNIFIED_SOURCES += [ 'GMPDeviceBinding.cpp', ] -if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_TARGET'] in ['WINNT', 'Darwin']: - DEFINES['HASH_NODE_ID_WITH_DEVICE_ID'] = 1; - UNIFIED_SOURCES += [ - 'lib/string_utils.cc', - 'sha256.c', - ] - if CONFIG['OS_TARGET'] == 'WINNT': UNIFIED_SOURCES += [ 'win/lib/machine_id_win.cc', |