From 403c5158681158af52697c80fbc5c38b2f088cd6 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 29 Jul 2015 12:27:07 +0200 Subject: [PATCH] Bug 1188439 - Fixed GMPLoader.cpp compilation with sandbox disabled. r=cpearce --- dom/media/gmp/GMPLoader.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/dom/media/gmp/GMPLoader.cpp b/dom/media/gmp/GMPLoader.cpp index 471537b6f5d9..e7de6635e60e 100644 --- a/dom/media/gmp/GMPLoader.cpp +++ b/dom/media/gmp/GMPLoader.cpp @@ -14,12 +14,14 @@ #include -#if defined(XP_WIN) && defined(MOZ_SANDBOX) -#include "mozilla/Scoped.h" +#ifdef XP_WIN #include "windows.h" +#ifdef MOZ_SANDBOX +#include "mozilla/Scoped.h" #include #include #endif +#endif #if defined(HASH_NODE_ID_WITH_DEVICE_ID) // In order to provide EME plugins with a "device binding" capability, @@ -196,11 +198,7 @@ GMPLoaderImpl::Load(const char* aUTF8LibPath, nodeId = std::string(aOriginSalt, aOriginSalt + aOriginSaltLen); } -#if defined(XP_WIN) && defined(MOZ_SANDBOX) - // If the GMP DLL is a side-by-side assembly with static imports then the DLL - // loader will attempt to create an activation context which will fail because - // of the sandbox. If we create an activation context before we start the - // sandbox then this one will get picked up by the DLL loader. +#ifdef XP_WIN int pathLen = MultiByteToWideChar(CP_UTF8, 0, aUTF8LibPath, -1, nullptr, 0); if (pathLen == 0) { return false; @@ -211,11 +209,17 @@ GMPLoaderImpl::Load(const char* aUTF8LibPath, return false; } +#ifdef MOZ_SANDBOX + // If the GMP DLL is a side-by-side assembly with static imports then the DLL + // loader will attempt to create an activation context which will fail because + // of the sandbox. If we create an activation context before we start the + // sandbox then this one will get picked up by the DLL loader. ACTCTX actCtx = { sizeof(actCtx) }; actCtx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID; actCtx.lpSource = widePath; actCtx.lpResourceName = ISOLATIONAWARE_MANIFEST_RESOURCE_ID; ScopedActCtxHandle actCtxHandle(CreateActCtx(&actCtx)); +#endif #endif // Start the sandbox now that we've generated the device bound node id.