summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-25 18:47:07 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-25 18:47:07 +0000
commitad4703ed344d3987bfc4fa351ee2c44836d60e00 (patch)
treec24b1c1849f94007ed5a60638cbc75d88d14d8aa /webkit
parenta4a16bbc5a15fecf65d04128b55e51298286c15a (diff)
downloadchromium_src-ad4703ed344d3987bfc4fa351ee2c44836d60e00.zip
chromium_src-ad4703ed344d3987bfc4fa351ee2c44836d60e00.tar.gz
chromium_src-ad4703ed344d3987bfc4fa351ee2c44836d60e00.tar.bz2
This CL ensures that plugins always peek in the context of outgoing sync calls.
I will be watching the reliability test runs closely for any crashes which creep in due to reentrancies into plugins caused by this CL. This fixes bug http://code.google.com/p/chromium/issues/detail?id=15985 It is a touch tricky to implement a test case for this. Will add one hopefully in a subsequent CL Bug=15985 Test=Covered by UI test Review URL: http://codereview.chromium.org/173211 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24266 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/plugins/test/plugin_client.cc3
-rw-r--r--webkit/glue/plugins/test/plugin_windowed_test.cc9
-rw-r--r--webkit/tools/npapi_layout_test_plugin/PluginObject.cpp15
3 files changed, 22 insertions, 5 deletions
diff --git a/webkit/glue/plugins/test/plugin_client.cc b/webkit/glue/plugins/test/plugin_client.cc
index bcad2a8..dfa151d 100644
--- a/webkit/glue/plugins/test/plugin_client.cc
+++ b/webkit/glue/plugins/test/plugin_client.cc
@@ -155,7 +155,8 @@ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode,
// TODO(port): plugin_windowed_test.*.
} else if (test_name == "hidden_plugin" ||
test_name == "create_instance_in_paint" ||
- test_name == "alert_in_window_message") {
+ test_name == "alert_in_window_message" ||
+ test_name == "src_plugin_for_outgoing_sync_call") {
new_test = new NPAPIClient::WindowedPluginTest(instance,
NPAPIClient::PluginClient::HostFunctions());
#endif
diff --git a/webkit/glue/plugins/test/plugin_windowed_test.cc b/webkit/glue/plugins/test/plugin_windowed_test.cc
index 3a15ae0..ace8a4a 100644
--- a/webkit/glue/plugins/test/plugin_windowed_test.cc
+++ b/webkit/glue/plugins/test/plugin_windowed_test.cc
@@ -33,7 +33,8 @@ NPError WindowedPluginTest::SetWindow(NPWindow* pNPWindow) {
}
if ((test_name() == "create_instance_in_paint" && test_id() == "1") ||
- test_name() == "alert_in_window_message") {
+ test_name() == "alert_in_window_message" ||
+ test_name() == "src_plugin_for_outgoing_sync_call") {
static ATOM window_class = 0;
if (!window_class) {
WNDCLASSEX wcex;
@@ -96,6 +97,12 @@ LRESULT CALLBACK WindowedPluginTest::WindowProc(
// and verify that we don't hang the browser.
CallJSFunction(this_ptr, "CallAlert");
CallJSFunction(this_ptr, "CallAlert");
+ } else if (this_ptr->test_name() == "src_plugin_for_outgoing_sync_call" &&
+ message == WM_PAINT) {
+ this_ptr->done_ = true;
+ SetFocus(window);
+ CallJSFunction(this_ptr, "SetFocusToPlugin2");
+ this_ptr->SignalTestCompleted();
}
}
diff --git a/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp b/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
index 2bfab8f..26abd8d 100644
--- a/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
+++ b/webkit/tools/npapi_layout_test_plugin/PluginObject.cpp
@@ -72,7 +72,8 @@ static bool identifiersInitialized = false;
#define ID_PROPERTY_LOG_DESTROY 4
#define ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM 5
#define ID_PROPERTY_TEST_OBJECT_COUNT 6
-#define NUM_PROPERTY_IDENTIFIERS 7
+#define ID_PROPERTY_RESET_FOCUS 7
+#define NUM_PROPERTY_IDENTIFIERS 8
static NPIdentifier pluginPropertyIdentifiers[NUM_PROPERTY_IDENTIFIERS];
static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
@@ -83,6 +84,7 @@ static const NPUTF8 *pluginPropertyIdentifierNames[NUM_PROPERTY_IDENTIFIERS] = {
"logDestroy",
"returnErrorFromNewStream",
"testObjectCount",
+ "resetFocus"
};
#define ID_TEST_CALLBACK_METHOD 0
@@ -211,6 +213,13 @@ static bool pluginSetProperty(NPObject* obj, NPIdentifier name, const NPVariant*
} else if (name == pluginPropertyIdentifiers[ID_PROPERTY_RETURN_ERROR_FROM_NEWSTREAM]) {
plugin->returnErrorFromNewStream = NPVARIANT_TO_BOOLEAN(*variant);
return true;
+ } else if (name == pluginPropertyIdentifiers[ID_PROPERTY_RESET_FOCUS]) {
+#ifdef OS_WIN
+ if (NPVARIANT_TO_BOOLEAN(*variant)) {
+ SetFocus(NULL);
+ }
+ return true;
+#endif // OS_WIN
}
return false;
@@ -748,9 +757,9 @@ static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* a
return testCallbackAndGetValue(plugin, args, argCount, result);
} else if (name == pluginMethodIdentifiers[ID_TEST_CONSTRUCT]) {
return testConstruct(plugin, args, argCount, result);
- } else if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM])
+ } else if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM])
return destroyNullStream(plugin, args, argCount, result);
-
+
return false;
}