I just looked at nsIScriptcontext, and I really like the idea of putting
this there.. I guess it's up to jst, if he wants to put varargs stuff
into nsIScriptContext.

I've explored this issue a fair amount though, trying to get around
using varargs - the problem is really that there's no way to call
JS_PushArguments or JS_PushArgumentsVA with a list of arguments
generated at runtime.. this means that we don't have any way to
implement a method like

NS_IMETHOD CallNativeWithArgs(nsJSCallerCallback *aCallback, void
*aClosure, PRInt32 aArgc, void **aArgv)
or perhaps
NS_IMETHOD CallNativeWithArgs(nsJSCallerCallback *aCallback, void
*aClosure, const char * aFormatStr, void **aArgv)

where aArgv is an array of arguments, and have it processed
appropriately by JS_PushArguments[VA].

It's also a tremendous amount of work to simulate what
JS_PushArguments[VA] does .. our one other option might be to factor out
the argument formatting from JS_PushArguments[VA] and create a new
function:
JS_PushArgumentsList(const char *formatString, void *argv)

or something...

                            Alec


John Bandhauer wrote:

> John Bandhauer wrote:
> > I'm not too concerned about where it goes. Is appshell a general
> > enough place? Putting it in xpconnect is ok with some cleanup and
> > changes to conform to the local traditions.
>
> Then again, maybe this should just be a new method on
> nsIScriptContext/nsJSContext? Then you wouldn't even need to add
> any new files. Would we want to saddle it with this varargs
> method? It is already plenty ugly :)
>
> John.

Reply via email to