Bug 1188439 - Fixed GMPLoader.cpp compilation with sandbox disabled. r=cpearce
authorJacek Caban <jacek@codeweavers.com>
Wed, 29 Jul 2015 12:27:07 +0200
changeset 255118 48085d776a69df23aca47b6bd5cfa6e1df039820
parent 255117 9d68879590cf2b37ed78a539706a4ec74b548332
child 255119 d1c3131176181e6caa840ad40f0de5ee22306510
push id62956
push userjacek@codeweavers.com
push dateWed, 29 Jul 2015 10:27:01 +0000
treeherdermozilla-inbound@d1c313117618 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1188439
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1188439 - Fixed GMPLoader.cpp compilation with sandbox disabled. r=cpearce
dom/media/gmp/GMPLoader.cpp
--- a/dom/media/gmp/GMPLoader.cpp
+++ b/dom/media/gmp/GMPLoader.cpp
@@ -9,22 +9,24 @@
 #include "mozilla/Attributes.h"
 #include "gmp-entrypoints.h"
 #include "prlink.h"
 #include "prenv.h"
 #include "nsAutoPtr.h"
 
 #include <string>
 
-#if defined(XP_WIN) && defined(MOZ_SANDBOX)
+#ifdef XP_WIN
+#include "windows.h"
+#ifdef MOZ_SANDBOX
 #include "mozilla/Scoped.h"
-#include "windows.h"
 #include <intrin.h>
 #include <assert.h>
 #endif
+#endif
 
 #if defined(HASH_NODE_ID_WITH_DEVICE_ID)
 // In order to provide EME plugins with a "device binding" capability,
 // in the parent we generate and store some random bytes as salt for every
 // (origin, urlBarOrigin) pair that uses EME. We store these bytes so
 // that every time we revisit the same origin we get the same salt.
 // We send this salt to the child on startup. The child collects some
 // device specific data and munges that with the salt to create the
@@ -191,37 +193,39 @@ GMPLoaderImpl::Load(const char* aUTF8Lib
       }
     }
   } else
 #endif
   {
     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;
   }
 
   nsAutoArrayPtr<wchar_t> widePath(new wchar_t[pathLen]);
   if (MultiByteToWideChar(CP_UTF8, 0, aUTF8LibPath, -1, widePath, pathLen) == 0) {
     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.
   // This must happen after the node id is bound to the device id, as
   // generating the device id requires privileges.
   if (mSandboxStarter && !mSandboxStarter->Start(aUTF8LibPath)) {
     return false;
   }