summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/zygote_main_linux.cc14
-rw-r--r--chrome/renderer/render_process_impl.cc9
-rw-r--r--webkit/glue/plugins/plugin_lib.cc4
-rw-r--r--webkit/glue/plugins/plugin_lib.h2
4 files changed, 23 insertions, 6 deletions
diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc
index fc2d441..6b6a8f9 100644
--- a/chrome/browser/zygote_main_linux.cc
+++ b/chrome/browser/zygote_main_linux.cc
@@ -21,6 +21,7 @@
#include "base/basictypes.h"
#include "base/command_line.h"
#include "base/eintr_wrapper.h"
+#include "base/file_util.h"
#include "base/global_descriptors_posix.h"
#include "base/hash_tables.h"
#include "base/linux_util.h"
@@ -34,6 +35,7 @@
#include "chrome/browser/zygote_host_linux.h"
#include "chrome/common/chrome_descriptors.h"
+#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/main_function_params.h"
#include "chrome/common/process_watcher.h"
@@ -47,6 +49,8 @@
#include "unicode/timezone.h"
+#include "webkit/glue/plugins/plugin_lib.h"
+
#if defined(ARCH_CPU_X86_FAMILY) && !defined(CHROMIUM_SELINUX)
// The seccomp sandbox is enabled on all ia32 and x86-64 processor as long as
// we aren't using SELinux.
@@ -528,6 +532,16 @@ static void PreSandboxInit() {
FilePath module_path;
if (PathService::Get(base::DIR_MODULE, &module_path))
media::InitializeMediaLibrary(module_path);
+
+ // Load the PDF plugin before the sandbox is turned on.
+ FilePath pdf;
+ if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) &&
+ file_util::PathExists(pdf)) {
+ static scoped_refptr<NPAPI::PluginLib> pdf_lib =
+ NPAPI::PluginLib::CreatePluginLib(pdf);
+ bool rv = pdf_lib->EnsureAlwaysLoaded();
+ DCHECK(rv) << "Couldn't load PDF plugin";
+ }
}
#if !defined(CHROMIUM_SELINUX)
diff --git a/chrome/renderer/render_process_impl.cc b/chrome/renderer/render_process_impl.cc
index 71786e2..ff64177 100644
--- a/chrome/renderer/render_process_impl.cc
+++ b/chrome/renderer/render_process_impl.cc
@@ -182,14 +182,16 @@ RenderProcessImpl::RenderProcessImpl()
}
#endif
- // Load the pdf plugin before the sandbox is turned on.
+#if defined(OS_WIN) or defined(OS_MACOSX)
+ // Load the pdf plugin before the sandbox is turned on. This is for Mac and
+ // Windows. On Linux, this needs to be done in the zygote process.
FilePath pdf;
if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) &&
file_util::PathExists(pdf)) {
static scoped_refptr<NPAPI::PluginLib> pdf_lib =
NPAPI::PluginLib::CreatePluginLib(pdf);
- // Load the plugin now before the sandbox engages and keep it always loaded.
- pdf_lib->EnsureAlwaysLoaded();
+ bool rv = pdf_lib->EnsureAlwaysLoaded();
+ DCHECK(rv) << "Couldn't load PDF plugin";
#if defined(OS_WIN)
g_iat_patch_createdca.Patch(
@@ -200,6 +202,7 @@ RenderProcessImpl::RenderProcessImpl()
"gdi32.dll", "GetFontData", GetFontDataPatch);
#endif
}
+#endif
}
RenderProcessImpl::~RenderProcessImpl() {
diff --git a/webkit/glue/plugins/plugin_lib.cc b/webkit/glue/plugins/plugin_lib.cc
index d3ae50e..dfc6345 100644
--- a/webkit/glue/plugins/plugin_lib.cc
+++ b/webkit/glue/plugins/plugin_lib.cc
@@ -139,9 +139,9 @@ void PluginLib::PreventLibraryUnload() {
skip_unload_ = true;
}
-void PluginLib::EnsureAlwaysLoaded() {
+bool PluginLib::EnsureAlwaysLoaded() {
always_loaded_ = true;
- Load();
+ return Load();
}
PluginInstance* PluginLib::CreateInstance(const std::string& mime_type) {
diff --git a/webkit/glue/plugins/plugin_lib.h b/webkit/glue/plugins/plugin_lib.h
index 3888eec..32d8a14 100644
--- a/webkit/glue/plugins/plugin_lib.h
+++ b/webkit/glue/plugins/plugin_lib.h
@@ -79,7 +79,7 @@ class PluginLib : public base::RefCounted<PluginLib> {
void PreventLibraryUnload();
// Loads the library now and ensures it's never unloaded.
- void EnsureAlwaysLoaded();
+ bool EnsureAlwaysLoaded();
// protected for testability.
protected: