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

Unified Diff: webkit/glue/plugins/test/plugin_test.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 side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698