John Bandhauer wrote:


 > In general wrappedJS wrappers are going to give you a different  pointer
 >  for every interface you QI it for - even if those  interfaces
 > share an inheritance relationship. The exception is  nsISupports
 > which *sometimes* shares a wrapper with another  interface. Any
 > xpcom object might also do this - so your code  should be ready for
 >  this - but wrapped JS objects do it more.

Just FYI, Python is very similar to js in this regard.

 > You should *never* be expecting equality of pointers that have  not
 > been QI'd to the same interface.

I thought the rules specifically state nsISupports?  (I can't find a 
reference!)  I don't believe there are guarantees the same pointer will 
be returned for any other interface than nsISupports?  Whenever I 
compare pointers I am very careful to QI for nsISupports on both - even 
when they are the same IID.  Is this unnecessary?

Actually, I should re-phrase the question - I am almost certain it is 
currently unnecessary for all implemented components.  But is it legal?

Thanks,

Mark.


Reply via email to