return NS_OK; }   if (aIID.Equals(kDConnectStubID)) { *aInstancePtr = this; NS_ADDREF_THIS();
DConnectStub::QueryInterface(const nsID &aIID, void **aInstancePtr){  DConnectStub *master = mMaster ? mMaster : this;  // always return the master stub for nsISupports  if (aIID.Equals(NS_GET_IID(nsISupports)))  {    *aInstancePtr = master;    NS_ADDREF(master);    return NS_OK;  }  // it might seem attractive to check this stub first for parent  // interfaces, but we should instead always defer to the master  // since that ensures that the result of QI is independent of  // the stub on which it is called.#if 0  if (SupportsIID(aIID))  {    *aInstancePtr = this;    NS_ADDREF(this);    return NS_OK;  }#endif  // does any existing stub support the requested IID?  DConnectStub *stub = master->FindStubSupportingIID(aIID);  if (stub)  {    *aInstancePtr = stub;    NS_ADDREF(stub);    return NS_OK;  }  // else, we need to query the peer object  LOG(("calling QueryInteface on peer object\n"));  DConnectSetupQueryInterface msg;  msg.opcode_minor = DCON_OP_SETUP_QUERY_INTERFACE;  msg.iid = aIID;  msg.instance = mInstance;  void *result;  nsresult rv = SetupPeerInstance(mPeerID, &msg, sizeof(msg), &result);  if (NS_FAILED(rv))    return rv;  stub = (DConnectStub *) result;  // add stub to the master's list of children, so we can preserve  // symmetry in future QI calls.  each child owns his master, but  // the master only keeps weak references to its children.  the  // children are responsible for removing themselves as they die.  NS_ADDREF(master);  stub->mMaster = master;  master->mChildren.AppendElement(stub);  *aInstancePtr = stub;  NS_ADDREF(stub);  return NS_OK;}