diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-20 21:25:46 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-20 21:25:46 +0000 |
commit | 06828b988cdcfcadad4cb2032b768634356ba70e (patch) | |
tree | 5a3b9a1bc2687018398835dbf92d0f4aa6556731 /webkit/glue/plugins/test | |
parent | 73dc4cf402ca37f51291d72572a8d4884ddddb2a (diff) | |
download | chromium_src-06828b988cdcfcadad4cb2032b768634356ba70e.zip chromium_src-06828b988cdcfcadad4cb2032b768634356ba70e.tar.gz chromium_src-06828b988cdcfcadad4cb2032b768634356ba70e.tar.bz2 |
This fixes http://code.google.com/p/chromium/issues/detail?id=205, which was an issue with a windowed flash instance not rendering content at times.The bug occurs as a result of the following:-1. The flash plugin executes a script via GetURLNotify. This script calls window.open with the target as self, which shows up as a new tab in the browser. This causes a new RenderView object to be instantiated (See RenderView::CreateWebView).2. RenderView::CreateWebView sends over the ViewHostMsg_CreateWindow IPC message to the browser. The handler in the browser sends over an ack for this message with the window handle. This is used as the parent window for any plugins instantiated in the page.3. At times, the newly created view starts receiving data which is processed before the ViewMsg_CreatingNew_ACK message is received and processed by the view. This causes the plugin to be instantiated without a parent window thus ending up as a top level window.The fix is to queue up resource messages and process them after we receive the ack for the ViewHostMsg_CreateWindow IPC.
Tests :- Covered by UI tests.
R=jam
Review URL: http://codereview.chromium.org/7514
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3631 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins/test')
-rw-r--r-- | webkit/glue/plugins/test/SConscript | 1 | ||||
-rw-r--r-- | webkit/glue/plugins/test/npapi_test_plugin.vcproj | 8 | ||||
-rw-r--r-- | webkit/glue/plugins/test/plugin_client.cc | 11 | ||||
-rw-r--r-- | webkit/glue/plugins/test/plugin_javascript_open_popup.cc | 52 | ||||
-rw-r--r-- | webkit/glue/plugins/test/plugin_javascript_open_popup.h | 42 |
5 files changed, 113 insertions, 1 deletions
diff --git a/webkit/glue/plugins/test/SConscript b/webkit/glue/plugins/test/SConscript index bfdc821..9068be2 100644 --- a/webkit/glue/plugins/test/SConscript +++ b/webkit/glue/plugins/test/SConscript @@ -16,6 +16,7 @@ input_files = [ 'plugin_geturl_test.cc', 'plugin_new_fails_test.cc', 'plugin_npobject_proxy_test.cc', + 'plugin_javascript_open_popup.cc', 'plugin_test.cc' ] diff --git a/webkit/glue/plugins/test/npapi_test_plugin.vcproj b/webkit/glue/plugins/test/npapi_test_plugin.vcproj index ffcd76c..d52bba8 100644 --- a/webkit/glue/plugins/test/npapi_test_plugin.vcproj +++ b/webkit/glue/plugins/test/npapi_test_plugin.vcproj @@ -207,6 +207,14 @@ > </File> <File + RelativePath=".\plugin_javascript_open_popup.cc" + > + </File> + <File + RelativePath=".\plugin_javascript_open_popup.h" + > + </File> + <File RelativePath=".\plugin_new_fails_test.cc" > </File> diff --git a/webkit/glue/plugins/test/plugin_client.cc b/webkit/glue/plugins/test/plugin_client.cc index a2f5dc6..868810e 100644 --- a/webkit/glue/plugins/test/plugin_client.cc +++ b/webkit/glue/plugins/test/plugin_client.cc @@ -13,6 +13,7 @@ #include "webkit/glue/plugins/test/plugin_npobject_lifetime_test.h" #include "webkit/glue/plugins/test/plugin_npobject_proxy_test.h" #include "webkit/glue/plugins/test/plugin_window_size_test.h" +#include "webkit/glue/plugins/test/plugin_javascript_open_popup.h" #include "third_party/npapi/bindings/npapi.h" #include "third_party/npapi/bindings/npruntime.h" @@ -125,9 +126,17 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, new_test = new NPAPIClient::NewFailsTest(instance, NPAPIClient::PluginClient::HostFunctions()); } else if (base::strcasecmp(argv[name_index], - "npobject_delete_plugin_in_evaluate") == 0) { + "npobject_delete_plugin_in_evaluate") == 0) { new_test = new NPAPIClient::NPObjectDeletePluginInNPN_Evaluate(instance, NPAPIClient::PluginClient::HostFunctions()); + } else if (base::strcasecmp(argv[name_index], + "plugin_javascript_open_popup_with_plugin") == 0) { + new_test = new NPAPIClient::ExecuteJavascriptOpenPopupWithPluginTest( + instance, NPAPIClient::PluginClient::HostFunctions()); + } else if (base::strcasecmp(argv[name_index], + "plugin_popup_with_plugin_target") == 0) { + new_test = new NPAPIClient::ExecuteJavascriptPopupWindowTargetPluginTest( + instance, NPAPIClient::PluginClient::HostFunctions()); } else { // If we don't have a test case for this, create a // generic one which basically never fails. diff --git a/webkit/glue/plugins/test/plugin_javascript_open_popup.cc b/webkit/glue/plugins/test/plugin_javascript_open_popup.cc new file mode 100644 index 0000000..cd9c121 --- /dev/null +++ b/webkit/glue/plugins/test/plugin_javascript_open_popup.cc @@ -0,0 +1,52 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +#include "webkit/glue/plugins/test/plugin_javascript_open_popup.h" + +#include "webkit/glue/plugins/test/plugin_client.h" + +namespace NPAPIClient { + +ExecuteJavascriptOpenPopupWithPluginTest:: + ExecuteJavascriptOpenPopupWithPluginTest(NPP id, + NPNetscapeFuncs *host_functions) + : PluginTest(id, host_functions), + popup_window_test_started_(false) { +} + +int16 ExecuteJavascriptOpenPopupWithPluginTest::SetWindow( + NPWindow* window) { + if (!popup_window_test_started_) { + popup_window_test_started_ = true; + HostFunctions()->geturl( + id(), "popup_window_with_target_plugin.html", "_blank"); + } + return PluginTest::SetWindow(window); +} + +// ExecuteJavascriptPopupWindowTargetPluginTest member defines. +ExecuteJavascriptPopupWindowTargetPluginTest:: + ExecuteJavascriptPopupWindowTargetPluginTest( + NPP id, NPNetscapeFuncs* host_functions) + : PluginTest(id, host_functions), + test_completed_(false) { +} + +int16 ExecuteJavascriptPopupWindowTargetPluginTest::SetWindow( + NPWindow* window) { + if (!test_completed_) { + HWND window_handle = reinterpret_cast<HWND>(window->window); + + if (IsWindow(window_handle)) { + HWND parent_window = GetParent(window_handle); + if (!IsWindow(parent_window) || parent_window == GetDesktopWindow()) { + SetError("Windowed plugin instantiated with NULL parent"); + } + SignalTestCompleted(); + test_completed_ = true; + } + } + return PluginTest::SetWindow(window); +} + +} // namespace NPAPIClient diff --git a/webkit/glue/plugins/test/plugin_javascript_open_popup.h b/webkit/glue/plugins/test/plugin_javascript_open_popup.h new file mode 100644 index 0000000..e2a29a8 --- /dev/null +++ b/webkit/glue/plugins/test/plugin_javascript_open_popup.h @@ -0,0 +1,42 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WEBKIT_GLUE_PLUGINS_TEST_PLUGIN_JAVASCRIPT_OPEN_POPUP_H +#define WEBKIT_GLUE_PLUGINS_TEST_PLUGIN_JAVASCRIPT_OPEN_POPUP_H + +#include "webkit/glue/plugins/test/plugin_test.h" + +namespace NPAPIClient { + +// This class tests the case where a windowed plugin instance is +// instantiated in a popup window. The plugin instance needs to +// have a valid parent window. +class ExecuteJavascriptOpenPopupWithPluginTest : public PluginTest { + public: + // Constructor. + ExecuteJavascriptOpenPopupWithPluginTest( + NPP id, NPNetscapeFuncs *host_functions); + // NPAPI SetWindow handler. + virtual NPError SetWindow(NPWindow* window); + + private: + bool popup_window_test_started_; +}; + +// This class represents a windowed plugin instance instantiated within a +// popup window. It verifies that the plugin instance has a valid parent. +class ExecuteJavascriptPopupWindowTargetPluginTest : public PluginTest { + public: + ExecuteJavascriptPopupWindowTargetPluginTest( + NPP id, NPNetscapeFuncs *host_functions); + // NPAPI SetWindow handler. + virtual NPError SetWindow(NPWindow* window); + + private: + bool test_completed_; +}; + +} // namespace NPAPIClient + +#endif // WEBKIT_GLUE_PLUGINS_TEST_PLUGIN_JAVASCRIPT_OPEN_POPUP_H
\ No newline at end of file |