John Bandhauer wrote:
>
> "Marcus G. Daniels" wrote:
> >
> > >>>>> "JB" == John Bandhauer <[EMAIL PROTECTED]> writes:
> >
> > JB> It should be of type nsQIResult - or some '[ptr] native' type that
> > JB> you make up (see the nsQIResult declaration in nsrootidl.idl). The
> > JB> issue is that by declaring it nsISupports you are saying that it
> > JB> has a specific type - nsISupports - yet you also declare that its
> > JB> type will be told at runtime by using iid_is. This confuses the
> > JB> system.
> >
> > This reminds me of something I bumped into recently.
> >
> > Is there a way to return an iid to JavaScript?
Ah, you said "to JavaScript". Then you'd be passing an iid
(presumably from C++). In C++ you need to make a copy of the iid
using nsMemory if this an 'out' param. FOr 'in' params you just
pass a reference to the iid. On the JS side it becomes an object
that implements the nsIJSID interface. You can use its 'equals'
method to compare it to members of Components.interfaces or any
id you create using Components.ID.
John.
>
> Declare an interface with an 'out' param of type nsIDPtr (or any
> of the [nsid] types - see nsrootidl.idl). At runtime use
> Components.interfaces.yourInterfaceName as the value to return.
> If you need to return an iid that does not correspond to one of
> the declared interfaces then use 'new Components.ID('{-numbers
> here-}').
>
> See: http://mozilla.org/scriptable/components_object.html#_ID
>
> > Alternatively, is there
> > some way to do a QueryInterface and return an unspecified interface?
>
> I don't know what this means.
>
> John.