From 5fd5d03c6cfad79ea403b4921dd84da5e01f4939 Mon Sep 17 00:00:00 2001 From: "stuartmorgan@chromium.org" Date: Tue, 30 Nov 2010 01:01:01 +0000 Subject: Don't call NPP_SetWindow on plugins that return an error from NPP_New BUG=64234 TEST=None Review URL: http://codereview.chromium.org/5258005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67635 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/plugins/webplugin_delegate_impl.cc | 7 ++++--- webkit/glue/plugins/webplugin_delegate_impl.h | 3 +++ webkit/glue/plugins/webplugin_delegate_impl_gtk.cc | 3 ++- webkit/glue/plugins/webplugin_delegate_impl_mac.mm | 3 ++- webkit/glue/plugins/webplugin_delegate_impl_win.cc | 3 ++- 5 files changed, 13 insertions(+), 6 deletions(-) (limited to 'webkit') diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index 6907c6f..e3e4f9d 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -86,9 +86,9 @@ bool WebPluginDelegateImpl::Initialize( argc++; } - bool start_result = instance_->Start( + creation_succeeded_ = instance_->Start( url, argn.get(), argv.get(), argc, load_manually); - if (!start_result) + if (!creation_succeeded_) return false; windowless_ = instance_->windowless(); @@ -120,7 +120,8 @@ void WebPluginDelegateImpl::DestroyInstance() { instance_->CloseStreams(); window_.window = NULL; - if (!(quirks_ & PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY)) { + if (creation_succeeded_ && + !(quirks_ & PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY)) { instance_->NPP_SetWindow(&window_); } diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index 30a4a58..4046c95 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -502,6 +502,9 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { // https://bugs.webkit.org/show_bug.cgi?id=46013 for details. bool containing_view_has_focus_; + // True if NPP_New did not return an error. + bool creation_succeeded_; + DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateImpl); }; diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc index bceda0e..609b41e 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc @@ -55,7 +55,8 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( first_set_window_call_(true), plugin_has_focus_(false), has_webkit_focus_(false), - containing_view_has_focus_(true) { + containing_view_has_focus_(true), + creation_succeeded_(false) { memset(&window_, 0, sizeof(window_)); if (instance_->mime_type() == "application/x-shockwave-flash") { // Flash is tied to Firefox's whacky behavior with windowless plugins. See diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index 7b0cb7a..552484a 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -270,7 +270,8 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( first_set_window_call_(true), plugin_has_focus_(false), has_webkit_focus_(false), - containing_view_has_focus_(true) { + containing_view_has_focus_(true), + creation_succeeded_(false) { memset(&window_, 0, sizeof(window_)); #ifndef NP_NO_CARBON memset(&np_cg_context_, 0, sizeof(np_cg_context_)); diff --git a/webkit/glue/plugins/webplugin_delegate_impl_win.cc b/webkit/glue/plugins/webplugin_delegate_impl_win.cc index da7a68f..e1acba1 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_win.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_win.cc @@ -270,7 +270,8 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( first_set_window_call_(true), plugin_has_focus_(false), has_webkit_focus_(false), - containing_view_has_focus_(true) { + containing_view_has_focus_(true), + creation_succeeded_(false) { memset(&window_, 0, sizeof(window_)); const WebPluginInfo& plugin_info = instance_->plugin_lib()->plugin_info(); -- cgit v1.1