Bug 1074561 - Allow media plugins to run on Linuxes without sandboxing support. r=jesup
authorJed Davis <jld@mozilla.com>
Tue, 30 Sep 2014 13:35:08 -0700
changeset 208057 6da176806a99e9b4a8dc53e21be500a9ba1ea40b
parent 208056 baafb688f138f9087f83b8db68c9208b1260b589
child 208058 1cdfd98387703844aeaeef33e91a3286a8563f4b
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersjesup
bugs1074561
milestone35.0a1
Bug 1074561 - Allow media plugins to run on Linuxes without sandboxing support. r=jesup
content/media/gmp/GMPChild.cpp
content/media/gmp/GMPService.cpp
--- a/content/media/gmp/GMPChild.cpp
+++ b/content/media/gmp/GMPChild.cpp
@@ -258,18 +258,22 @@ GMPChild::LoadPluginLibrary(const std::s
     return false;
   }
 #if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
   nsAutoCString nativePath;
   libFile->GetNativePath(nativePath);
 
   // Enable sandboxing here -- we know the plugin file's path, but
   // this process's execution hasn't been affected by its content yet.
-  MOZ_ASSERT(mozilla::CanSandboxMediaPlugin());
-  mozilla::SetMediaPluginSandbox(nativePath.get());
+  if (mozilla::CanSandboxMediaPlugin()) {
+    mozilla::SetMediaPluginSandbox(nativePath.get());
+  } else {
+    printf_stderr("GMPChild::LoadPluginLibrary: Loading media plugin %s unsandboxed.\n",
+                  nativePath.get());
+  }
 #endif // XP_LINUX && MOZ_GMP_SANDBOX
 
   libFile->Load(&mLib);
 #endif // XP_MACOSX && MOZ_GMP_SANDBOX
 
   if (!mLib) {
     NS_WARNING("Failed to link Gecko Media Plugin library.");
     return false;
--- a/content/media/gmp/GMPService.cpp
+++ b/content/media/gmp/GMPService.cpp
@@ -17,19 +17,16 @@
 #include "nsNativeCharsetUtils.h"
 #include "nsIConsoleService.h"
 #include "mozilla/unused.h"
 #include "GMPDecryptorParent.h"
 #include "GMPAudioDecoderParent.h"
 #include "nsComponentManagerUtils.h"
 #include "mozilla/Preferences.h"
 #include "runnable_utils.h"
-#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
-#include "mozilla/Sandbox.h"
-#endif
 
 namespace mozilla {
 
 #ifdef LOG
 #undef LOG
 #endif
 
 #ifdef PR_LOGGING
@@ -620,21 +617,16 @@ GeckoMediaPluginService::PathRunnable::R
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 GeckoMediaPluginService::AddPluginDirectory(const nsAString& aDirectory)
 {
   MOZ_ASSERT(NS_IsMainThread());
-#if defined(XP_LINUX) && defined(MOZ_GMP_SANDBOX)
-  if (!mozilla::CanSandboxMediaPlugin()) {
-    return NS_ERROR_NOT_AVAILABLE;
-  }
-#endif
   nsCOMPtr<nsIThread> thread;
   nsresult rv = GetThread(getter_AddRefs(thread));
   if (NS_FAILED(rv)) {
     return rv;
   }
   nsCOMPtr<nsIRunnable> r = new PathRunnable(this, aDirectory, true);
   thread->Dispatch(r, NS_DISPATCH_NORMAL);
   return NS_OK;