[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, master, updated. ec3bc9210945726e5c02
From: |
Rob Savoye |
Subject: |
[Gnash-commit] [SCM] Gnash branch, master, updated. ec3bc9210945726e5c026afd27e062e253192c7a |
Date: |
Sat, 18 Dec 2010 21:57:25 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".
The branch, master has been updated
via ec3bc9210945726e5c026afd27e062e253192c7a (commit)
from d19817edf130b13aed856618bfb0c6035c9d6e26 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=ec3bc9210945726e5c026afd27e062e253192c7a
commit ec3bc9210945726e5c026afd27e062e253192c7a
Author: Alessandro Pignotti <address@hidden>
Date: Fri Dec 17 19:03:27 2010 +0100
Fix NPN_Invoke usage when executing Javascript from the plugin
diff --git a/plugin/npapi/plugin.cpp b/plugin/npapi/plugin.cpp
index a4f3b5c..42c2859 100644
--- a/plugin/npapi/plugin.cpp
+++ b/plugin/npapi/plugin.cpp
@@ -850,20 +850,34 @@ nsPluginInstance::processPlayerRequest(gchar* buf, gsize
linelen)
this->getScriptObject()->AddMethod(id, remoteCallback);
return true;
}
- NPVariant *result = 0;
+ NPVariant result;
+ VOID_TO_NPVARIANT(result);
+ bool invokeResult=false;
// This is the player invoking a method in Javascript
- uint32_t count = 0;
- NPVariant args;
if (!invoke->name.empty()) {
- NPIdentifier id = NPN_GetStringIdentifier(invoke->name.c_str());
- gnash::log_debug("Invoking JavaScript method %s", invoke->name);
- NPN_Invoke(_instance, _scriptObject, id, &args, count, result);
+ //Convert the as_value argument to NPVariant
+ uint32_t count = invoke->args.size();
+ if(count!=0) //The first argument should exists and be the method
name
+ {
+ count--;
+ NPVariant* args = new NPVariant[count];
+ //Skip the first argument
+ for(uint32_t i=0;i<count;i++)
+ invoke->args[i+1].copy(args[i]);
+ NPIdentifier id =
NPN_GetStringIdentifier(invoke->name.c_str());
+ gnash::log_debug("Invoking JavaScript method %s",
invoke->name);
+ NPObject* windowObject;
+ NPN_GetValue(_instance, NPNVWindowNPObject, &windowObject);
+ invokeResult=NPN_Invoke(_instance, windowObject, id, args,
count, &result);
+ NPN_ReleaseObject(windowObject);
+ delete[] args;
+ }
}
// We got a result from invoking the Javascript method
std::stringstream ss;
- if (result) {
- NPN_ReleaseVariantValue(result);
- ss << ExternalInterface::convertNPVariant(result);
+ if (invokeResult) {
+ ss << ExternalInterface::convertNPVariant(&result);
+ NPN_ReleaseVariantValue(&result);
} else {
// Send response
// FIXME: "securityError" also possible, check domain
-----------------------------------------------------------------------
Summary of changes:
plugin/npapi/plugin.cpp | 32 +++++++++++++++++++++++---------
1 files changed, 23 insertions(+), 9 deletions(-)
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, master, updated. ec3bc9210945726e5c026afd27e062e253192c7a,
Rob Savoye <=