summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authornsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-22 20:05:46 +0000
committernsylvain@chromium.org <nsylvain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-22 20:05:46 +0000
commit46a6b528816b1c9c540f976998864891874b2a40 (patch)
tree4eba7fb9976672bbf9a4df5db8a469f163c6ccbe /webkit/glue
parentf760515c64d3ac5183156f795d2d2daade452a7c (diff)
downloadchromium_src-46a6b528816b1c9c540f976998864891874b2a40.zip
chromium_src-46a6b528816b1c9c540f976998864891874b2a40.tar.gz
chromium_src-46a6b528816b1c9c540f976998864891874b2a40.tar.bz2
This is a patch for bug 1385045: Adobe Acrobat 9.0 crash.
Adobe Acrobat 9.0 loads a dll called bib.dll. Usually it unloads it 30 seconds after the last instance of the plugin goes away, or when the browser process goes away. To know if the browser process goes away, it subclasses the main browser window. It seems to work fine in firefox, but it does not work in chrome. Also the 30 seconds delay does not work because we close the plugin process too fast (10 seconds) after the last instance of the plugin is closed. bib.dll is then unloaded by ExitProcess, which causes a crash in bib.dll. We could wait ~35 seconds after the last instance before closing the process, but it might be problematic with upgrades and could result in plugin process outliving the brower process. This current patch just kills the process before ExitProcess, so it does not cause a crash and display an error message to the user. This is not a fix, this is just a usuability improvement. As far as I know we are still waiting for help from the Adobe team on this issue. They would need to find a way to unload bib.dll cleanly in chrome. BUG: 1385045 Review URL: http://codereview.chromium.org/8015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3753 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl.cc18
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl.h1
-rw-r--r--webkit/glue/webkit_glue.cc16
-rw-r--r--webkit/glue/webkit_glue.h8
4 files changed, 43 insertions, 0 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc
index e0c74ed..fd97706 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl.cc
+++ b/webkit/glue/plugins/webplugin_delegate_impl.cc
@@ -4,11 +4,15 @@
#include "webkit/glue/plugins/webplugin_delegate_impl.h"
+#include <string>
+#include <vector>
+
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/gfx/gdi_util.h"
#include "base/gfx/point.h"
#include "base/stats_counters.h"
+#include "base/string_util.h"
#include "webkit/default_plugin/plugin_impl.h"
#include "webkit/glue/glue_util.h"
#include "webkit/glue/webplugin.h"
@@ -16,6 +20,7 @@
#include "webkit/glue/plugins/plugin_lib.h"
#include "webkit/glue/plugins/plugin_list.h"
#include "webkit/glue/plugins/plugin_stream_url.h"
+#include "webkit/glue/webkit_glue.h"
static StatsCounter windowless_queue(L"Plugin.ThrottleQueue");
@@ -146,6 +151,16 @@ WebPluginDelegateImpl::WebPluginDelegateImpl(
// agent.
instance_->set_use_mozilla_user_agent();
quirks_ |= PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE;
+ } else if (filename == L"nppdf32.dll") {
+ // Check for the version number above or equal 9.
+ std::vector<std::wstring> version;
+ SplitString(plugin_info.version, L'.', &version);
+ if (version.size() > 0) {
+ int major = static_cast<int>(StringToInt64(version[0]));
+ if (major >= 9) {
+ quirks_ |= PLUGIN_QUIRK_DIE_AFTER_UNLOAD;
+ }
+ }
} else if (plugin_info.name.find(L"Windows Media Player") !=
std::wstring::npos) {
// Windows Media Player needs two NPP_SetWindow calls.
@@ -201,6 +216,9 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url,
}
}
+ if (quirks_ & PLUGIN_QUIRK_DIE_AFTER_UNLOAD)
+ webkit_glue::SetForcefullyTerminatePluginProcess(true);
+
bool start_result = instance_->Start(url, argn, argv, argc, load_manually);
NPAPI::PluginInstance::SetInitializingInstance(old_instance);
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h
index f3131f1..6240934 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl.h
+++ b/webkit/glue/plugins/webplugin_delegate_impl.h
@@ -88,6 +88,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4,
PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8,
PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16,
+ PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32,
};
int quirks() { return quirks_; }
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc
index 9331f74..e59bd68 100644
--- a/webkit/glue/webkit_glue.cc
+++ b/webkit/glue/webkit_glue.cc
@@ -48,6 +48,9 @@ MSVC_POP_WARNING();
namespace webkit_glue {
+// Global variable used by the plugin quirk "die after unload".
+bool g_forcefully_terminate_plugin_process = false;
+
void SetJavaScriptFlags(const std::wstring& str) {
#if USE(V8)
std::string utf8_str = WideToUTF8(str);
@@ -441,4 +444,17 @@ void NotifyJSOutOfMemory(WebCore::Frame* frame) {
delegate->JSOutOfMemory();
}
+void SetForcefullyTerminatePluginProcess(bool value) {
+ if (IsPluginRunningInRendererProcess()) {
+ // Ignore this quirk when the plugins are not running in their own process.
+ return;
+ }
+
+ g_forcefully_terminate_plugin_process = value;
+}
+
+bool ShouldForcefullyTerminatePluginProcess() {
+ return g_forcefully_terminate_plugin_process;
+}
+
} // namespace webkit_glue
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index 3424ee6..f44649b 100644
--- a/webkit/glue/webkit_glue.h
+++ b/webkit/glue/webkit_glue.h
@@ -275,6 +275,14 @@ std::wstring GetWebKitLocale();
// Notifies the browser that the current page runs out of JS memory.
void NotifyJSOutOfMemory(WebCore::Frame* frame);
+// Tells the plugin thread to terminate the process forcefully instead of
+// exiting cleanly.
+void SetForcefullyTerminatePluginProcess(bool value);
+
+// Returns true if the plugin thread should terminate the process forcefully
+// instead of exiting cleanly.
+bool ShouldForcefullyTerminatePluginProcess();
+
} // namespace webkit_glue
#endif // WEBKIT_GLUE_H__