"Marcus G. Daniels" wrote:
>
> >>>>> "JB" == John Bandhauer <[EMAIL PROTECTED]> writes:
>
> MD> is there some way to do a QueryInterface and return
> MD> an unspecified interface?
>
> JB> I don't know what this means.
>
> Ok, QI is declared like this:
>
> void QueryInterface(in nsIIDRef uuid,
> [iid_is(uuid),retval] out nsQIResult result);
>
> Is it true that XPConnect uses the `iid_is(uuid)' so that it knows
> what kind of object is coming back? Are dynamically-typed runtimes
> the (only) reason for this?
>
> Suppose you wanted to have a:
>
> void QuerySomething (out nsQIResult result);
>
> where that method picked from, say, a static list of iids in an array.
> (For the sake of argument, say that there was contract such that the
> returned value would never be used to call a method until that value
> was returned to a place where the interface was once again possible to
> know by other means.)
>
> This is impossible, right?
Correct, this won't work. xpconnect (and probably any other
mapping that relies on typeinfo) needs to know the actual type
when it is passed in order to find or build a wrapper for the
object. This type is known either by statically declaring a
specific type in the idl or by passing the iid (indicated by
iid_is) as part of the param set of the *specific* call where the
dynamically typed object is passed. The method in your example
would not be visible via xpconnect because it uses a 'native'
type that is not dynamically specified using iid_is. xpconnect
intentionally hides those methods from the view of JavaScript -
other mappings can do as they please.
John.