> 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
> ----------

Notice that you're handling a property get on sample, not a call to a 
callable object stored as the _value_ of that property.

> 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?

After the get returns a value, the poke method if you will, that new 
value is called.  This entails converting it to an object and trying to 
invoke it with an internal [[Call]] hook of some sort (ECMA 
pseudo-syntax), in the case of SpiderMonkey and nsIXPCScriptable, the 
Call method.

> 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.

That's because two different objects are involved: the one denoted by 
sample in your code above, which contains a poke property whose value 
should be a callable object, and the other that very same callable 
object (poke method) returned by the get on sample for property id 'poke'.

So what value is your getter returning when asked for id 'poke'?

/be


Reply via email to