Bill Phillips wrote:
> 
> I'm trying to use XPTC_InvokeByIndex().  At the point where I want to do
> this call, all I have is an unknown interface cast as nsISupports, a string
> containing the name of the interface, and a string containing the method I
> want to call.  I was hoping to use nsIInterfaceInfoManager and
> GetInfoForName() with the interface name to get the nsInterfaceInfo and
> then use GetMethodInfoForName() with the method name to get the index.
> However, the nsIInterfaceInfo always shows that nsIDOMDocument only has
> three methods (QueryInterface, AddRef, and Release).  Does anyone know why
> this interface works this way yet other interfaces such as nsIInputStream
> work fine?
> 
> Thanks for any help,
> 
> Bill Phillips

You've hit the ugliness that is the interface between idlc-based
DOM code and xpidl-based interfaces used by xpconnect et al.

The problem is that nsIDOMDocument is not *really* declared in
xpidl. Its real declaration is in...
http://lxr.mozilla.org/seamonkey/source/dom/public/coreDom/nsIDOMDocument.h

The (incomplete) xpidl declaration for it (and some other DOM
interfaces) is in...
http://lxr.mozilla.org/seamonkey/source/dom/public/domstubs.idl

What is going on here is that the DOM system does its own
reflection of DOM objects into JavaScript. This system predates
xpidl and xpconnect. In order to allow those JavaScript
reflections of the DOM objects to interact (fairly) well with
xpconnect reflected native objects there are these empty xpidl
declarations and some special code in xpconnect. However, the
lack of full interface declarations of these interfaces in xpidl
means that the they are not fully described in typelibs or
callable via XPTC_InvokeByIndex.

We have long intended to convert these DOM objects to use xpidl
and xpconnect. This is expected to be a big code savings and will
pave the way to supporting DOM scripting in content from
languages other than JavaScript (e.g Python and Perl). We put
this off for a long time while all were busily working on other
stuff, but we are starting in on working out the details now and
developing a plan.

John.

Reply via email to