Bug 1074561 - Allow media plugins to run on Linuxes without sandboxing support. r=jesup a=sledru
authorJed Davis <jld@mozilla.com>
Wed, 01 Oct 2014 10:56:37 -0700
changeset 216892 583cc1307044
parent 216891 8dfb2430db1c
child 216893 145ef3fe7204
push id3958
push userjedavis@mozilla.com
push date2014-10-01 17:57 +0000
treeherdermozilla-beta@583cc1307044 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, sledru
bugs1074561
milestone33.0
Bug 1074561 - Allow media plugins to run on Linuxes without sandboxing support. r=jesup a=sledru
content/media/gmp/GMPChild.cpp
content/media/gmp/GMPService.cpp
--- a/content/media/gmp/GMPChild.cpp
+++ b/content/media/gmp/GMPChild.cpp
@@ -253,18 +253,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) {
     return false;
   }
--- a/content/media/gmp/GMPService.cpp
+++ b/content/media/gmp/GMPService.cpp
@@ -13,19 +13,16 @@
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/SyncRunnable.h"
 #include "nsXPCOMPrivate.h"
 #include "mozilla/Services.h"
 #include "nsNativeCharsetUtils.h"
 #include "nsIConsoleService.h"
 #include "mozilla/unused.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
@@ -382,21 +379,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;