diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-06 16:03:08 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-06 16:03:08 +0000 |
commit | 34110609a7d7c495251af8499b8c7e5f02c24945 (patch) | |
tree | 6d229f61b25c1148486490079d06de97a24b904e /webkit/glue/plugins | |
parent | 66d30508be18969ae4b398d2c319808edb34a750 (diff) | |
download | chromium_src-34110609a7d7c495251af8499b8c7e5f02c24945.zip chromium_src-34110609a7d7c495251af8499b8c7e5f02c24945.tar.gz chromium_src-34110609a7d7c495251af8499b8c7e5f02c24945.tar.bz2 |
Enforce valid Mac plugin event and drawing model pairings
Refuse to load plugins that violate the specs.
BUG=38341
TEST=none
Review URL: http://codereview.chromium.org/1558020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43718 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins')
5 files changed, 17 insertions, 7 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index 3511eee..55db8bd 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -105,11 +105,11 @@ bool WebPluginDelegateImpl::Initialize( instance_->set_window_handle(parent_); } - PlatformInitialize(); + bool should_load = PlatformInitialize(); plugin_url_ = url.spec(); - return true; + return should_load; } void WebPluginDelegateImpl::DestroyInstance() { diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index 3295a08..82ef74c 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -192,7 +192,8 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { ~WebPluginDelegateImpl(); // Called by Initialize() for platform-specific initialization. - void PlatformInitialize(); + // If this returns false, the plugin shouldn't be started--see Initialize(). + bool PlatformInitialize(); // Called by DestroyInstance(), used for platform-specific destruction. void PlatformDestroyInstance(); diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc index 2501b01..776f613 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc @@ -85,10 +85,11 @@ WebPluginDelegateImpl::~WebPluginDelegateImpl() { } } -void WebPluginDelegateImpl::PlatformInitialize() { +bool WebPluginDelegateImpl::PlatformInitialize() { gfx::PluginWindowHandle handle = windowless_ ? 0 : gtk_plug_get_id(GTK_PLUG(plug_)); plugin_->SetWindow(handle); + return true; } void WebPluginDelegateImpl::PlatformDestroyInstance() { diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index 74631fe..1051e09 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -232,7 +232,7 @@ WebPluginDelegateImpl::~WebPluginDelegateImpl() { #endif } -void WebPluginDelegateImpl::PlatformInitialize() { +bool WebPluginDelegateImpl::PlatformInitialize() { // Don't set a NULL window handle on destroy for Mac plugins. This matches // Safari and other Mac browsers (see PluginView::stop() in PluginView.cpp, // where code to do so is surrounded by an #ifdef that excludes Mac OS X, or @@ -284,6 +284,8 @@ void WebPluginDelegateImpl::PlatformInitialize() { switch (instance()->drawing_model()) { #ifndef NP_NO_QUICKDRAW case NPDrawingModelQuickDraw: + if (instance()->event_model() != NPEventModelCarbon) + return false; window_.window = &qd_port_; window_.type = NPWindowTypeDrawable; break; @@ -295,7 +297,9 @@ void WebPluginDelegateImpl::PlatformInitialize() { #endif window_.type = NPWindowTypeDrawable; break; - case NPDrawingModelCoreAnimation: { // Assumes Cocoa event model. + case NPDrawingModelCoreAnimation: { + if (instance()->event_model() != NPEventModelCocoa) + return false; window_.type = NPWindowTypeDrawable; // Ask the plug-in for the CALayer it created for rendering content. Have // the renderer tell the browser to create a "windowed plugin" to host @@ -351,6 +355,8 @@ void WebPluginDelegateImpl::PlatformInitialize() { WindowlessSetWindow(true); } #endif + + return true; } void WebPluginDelegateImpl::PlatformDestroyInstance() { diff --git a/webkit/glue/plugins/webplugin_delegate_impl_win.cc b/webkit/glue/plugins/webplugin_delegate_impl_win.cc index 1c83565..ad31021 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_win.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_win.cc @@ -323,7 +323,7 @@ WebPluginDelegateImpl::~WebPluginDelegateImpl() { } } -void WebPluginDelegateImpl::PlatformInitialize() { +bool WebPluginDelegateImpl::PlatformInitialize() { plugin_->SetWindow(windowed_handle_); if (windowless_ && !instance_->plugin_lib()->internal()) { @@ -373,6 +373,8 @@ void WebPluginDelegateImpl::PlatformInitialize() { L"wmpdxm.dll", "advapi32.dll", "RegEnumKeyExW", WebPluginDelegateImpl::RegEnumKeyExWPatch); } + + return true; } void WebPluginDelegateImpl::PlatformDestroyInstance() { |