Chromium Code Reviews| Index: webkit/glue/plugins/test/plugin_test.cc |
| =================================================================== |
| --- webkit/glue/plugins/test/plugin_test.cc (revision 28004) |
| +++ webkit/glue/plugins/test/plugin_test.cc (working copy) |
| @@ -23,6 +23,10 @@ |
| return NPERR_NO_ERROR; |
| } |
| +NPError PluginTest::Destroy() { |
| + return NPERR_NO_ERROR; |
| +} |
| + |
| NPError PluginTest::SetWindow(NPWindow* pNPWindow) { |
| return NPERR_NO_ERROR; |
| } |
| @@ -66,27 +70,34 @@ |
| // which hosts this plugin: |
| // onSuccess(test_name, test_id) |
| // onFailure(test_name, test_id, error_message) |
| - std::string script_result; |
| - std::string script_url; |
| + std::string script("javascript:"); |
| if (Succeeded()) { |
| - script_url.append("onSuccess(\""); |
| - script_url.append(test_name_); |
| - script_url.append("\",\""); |
| - script_url.append(test_id_); |
| - script_url.append("\");"); |
| + script.append("onSuccess(\""); |
| + script.append(test_name_); |
| + script.append("\",\""); |
| + script.append(test_id_); |
| + script.append("\");"); |
| } else { |
| - script_url.append("onFailure(\""); |
| - script_url.append(test_name_); |
| - script_url.append("\",\""); |
| - script_url.append(test_id_); |
| - script_url.append("\",\""); |
| - script_url.append(test_status_); |
| - script_url.append("\");"); |
| + script.append("onFailure(\""); |
| + script.append(test_name_); |
| + script.append("\",\""); |
| + script.append(test_id_); |
| + script.append("\",\""); |
| + script.append(test_status_); |
| + script.append("\");"); |
| } |
| - script_url = URLEncode(script_url); |
| - script_result.append("javascript:"); |
| - script_result.append(script_url); |
| - host_functions_->geturl(id_, script_result.c_str(), "_self"); |
| + |
| + NPObject *window_obj = NULL; |
| + host_functions_->getvalue(id_, NPNVWindowNPObject,&window_obj); |
| + if (!window_obj) |
|
ananta
2009/10/06 18:18:24
Nit: maybe we should do this at the top of this fu
jam
2009/10/06 19:12:40
Done.
|
| + return; |
| + |
| + NPString script_string; |
| + script_string.UTF8Characters = script.c_str(); |
| + script_string.UTF8Length = static_cast<unsigned int>(script.length()); |
| + |
| + NPVariant result_var; |
| + host_functions_->evaluate(id_, window_obj, &script_string, &result_var); |
| } |
| const char *PluginTest::GetArgValue(const char *name, const int16 argc, |