Hi
I'm trying to write an XPCOM component which will forward various
javascript (spidermonkey) method and property requests to a custom DLL.
Basically, I'm trying to use XPCOM as a hook, between javascript and my
custom DLL. I would like to use methods and properties in javascript
which have not been specified in the XPCOM IDL file (dynamic
properties?). I will resolve the names and parameters inside the XPCOM
component and forward them to the custom DLL.
In Javascript, I wrote:
--------------------
var sample = Components.classes["@mozilla.org/TESTDLL;1"];
sample = sample.createInstance();
sample.poke("pokestring");
--------------------
When I run the javascript code, the engine calls my XPCOM components
"GetProperty" method (I support the nsIXPCScriptable interface),
and I can determine the method name by using
----------
JS_IdToValue(cx, id, &jval);
JSString *jstr = JS_ValueToString(cx, jval);
jstr->chars <<<---- method name
----------
but I can't seem to find/determine what the parameters for the "poke"
call are ("pokestring" in the above example). How can I find the
parameters specified in the javascript code?
I noticed the nsIXPCScriptable::Call method has argc and argv to
specifiy the parameters, but my javascript code never calls the "Call"
method... only the GetProperty method.
Am I missing something simple, or is there a better way of doing this?
Scott