Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: webkit/glue/plugins/test/plugin_client.cc

Issue 258026: Fix scripting during NPP_Destroy. Note that if the plugin is making a call t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/string_util.h" 5 #include "base/string_util.h"
6 #include "webkit/glue/plugins/test/plugin_client.h" 6 #include "webkit/glue/plugins/test/plugin_client.h"
7 #include "webkit/glue/plugins/test/plugin_arguments_test.h" 7 #include "webkit/glue/plugins/test/plugin_arguments_test.h"
8 #include "webkit/glue/plugins/test/plugin_delete_plugin_in_stream_test.h" 8 #include "webkit/glue/plugins/test/plugin_delete_plugin_in_stream_test.h"
9 #include "webkit/glue/plugins/test/plugin_get_javascript_url_test.h" 9 #include "webkit/glue/plugins/test/plugin_get_javascript_url_test.h"
10 #include "webkit/glue/plugins/test/plugin_get_javascript_url2_test.h" 10 #include "webkit/glue/plugins/test/plugin_get_javascript_url2_test.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } else if (test_name == "plugin_popup_with_plugin_target") { 153 } else if (test_name == "plugin_popup_with_plugin_target") {
154 new_test = new NPAPIClient::ExecuteJavascriptPopupWindowTargetPluginTest( 154 new_test = new NPAPIClient::ExecuteJavascriptPopupWindowTargetPluginTest(
155 instance, NPAPIClient::PluginClient::HostFunctions()); 155 instance, NPAPIClient::PluginClient::HostFunctions());
156 } else if (test_name == "private") { 156 } else if (test_name == "private") {
157 new_test = new NPAPIClient::PrivateTest(instance, 157 new_test = new NPAPIClient::PrivateTest(instance,
158 NPAPIClient::PluginClient::HostFunctions()); 158 NPAPIClient::PluginClient::HostFunctions());
159 #if defined(OS_WIN) 159 #if defined(OS_WIN)
160 // TODO(port): plugin_windowed_test.*. 160 // TODO(port): plugin_windowed_test.*.
161 } else if (test_name == "hidden_plugin" || 161 } else if (test_name == "hidden_plugin" ||
162 test_name == "create_instance_in_paint" || 162 test_name == "create_instance_in_paint" ||
163 test_name == "alert_in_window_message") { 163 test_name == "alert_in_window_message" ||
164 test_name == "ensure_scripting_works_in_destroy") {
164 new_test = new NPAPIClient::WindowedPluginTest(instance, 165 new_test = new NPAPIClient::WindowedPluginTest(instance,
165 NPAPIClient::PluginClient::HostFunctions()); 166 NPAPIClient::PluginClient::HostFunctions());
166 #endif 167 #endif
167 } else { 168 } else {
168 // If we don't have a test case for this, create a 169 // If we don't have a test case for this, create a
169 // generic one which basically never fails. 170 // generic one which basically never fails.
170 LOG(WARNING) << "Unknown test name '" << test_name 171 LOG(WARNING) << "Unknown test name '" << test_name
171 << "'; using default test."; 172 << "'; using default test.";
172 new_test = new NPAPIClient::PluginTest(instance, 173 new_test = new NPAPIClient::PluginTest(instance,
173 NPAPIClient::PluginClient::HostFunctions()); 174 NPAPIClient::PluginClient::HostFunctions());
(...skipping 10 matching lines...) Expand all
184 185
185 return ret; 186 return ret;
186 } 187 }
187 188
188 NPError NPP_Destroy(NPP instance, NPSavedData** save) { 189 NPError NPP_Destroy(NPP instance, NPSavedData** save) {
189 if (instance == NULL) 190 if (instance == NULL)
190 return NPERR_INVALID_INSTANCE_ERROR; 191 return NPERR_INVALID_INSTANCE_ERROR;
191 192
192 NPAPIClient::PluginTest *plugin = 193 NPAPIClient::PluginTest *plugin =
193 (NPAPIClient::PluginTest*)instance->pdata; 194 (NPAPIClient::PluginTest*)instance->pdata;
195
196 NPError rv = plugin->Destroy();
194 delete plugin; 197 delete plugin;
195 198 return rv;
196 // XXXMB - do work here.
197 return NPERR_GENERIC_ERROR;
198 } 199 }
199 200
200 NPError NPP_SetWindow(NPP instance, NPWindow* pNPWindow) { 201 NPError NPP_SetWindow(NPP instance, NPWindow* pNPWindow) {
201 if (instance == NULL) 202 if (instance == NULL)
202 return NPERR_INVALID_INSTANCE_ERROR; 203 return NPERR_INVALID_INSTANCE_ERROR;
203 204
204 if (pNPWindow->window == NULL) { 205 if (pNPWindow->window == NULL) {
205 return NPERR_NO_ERROR; 206 return NPERR_NO_ERROR;
206 } 207 }
207 208
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 (NPAPIClient::PluginTest*)instance->pdata; 306 (NPAPIClient::PluginTest*)instance->pdata;
306 307
307 return plugin->HandleEvent(event); 308 return plugin->HandleEvent(event);
308 } 309 }
309 310
310 void* NPP_GetJavaClass(void) { 311 void* NPP_GetJavaClass(void) {
311 // XXXMB - do work here. 312 // XXXMB - do work here.
312 return NULL; 313 return NULL;
313 } 314 }
314 } // extern "C" 315 } // extern "C"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698