else if (aIID.Equals(NS_GET_IID(nsIURIContentListener))) { *aInstancePtr = NS_STATIC_CAST(nsIURIContentListener*, this); NS_ADDREF((nsISupports*)*aInstancePtr); return NS_OK; }
nsWebShell::GetInterface(const nsIID &aIID, void** aInstancePtr){   NS_ENSURE_ARG_POINTER(aInstancePtr);   nsresult rv = NS_OK;   if(aIID.Equals(NS_GET_IID(nsILinkHandler)))      {      *aInstancePtr = NS_STATIC_CAST(nsILinkHandler*, this);      NS_ADDREF((nsISupports*)*aInstancePtr);      return NS_OK;      }   else if(aIID.Equals(NS_GET_IID(nsIScriptGlobalObjectOwner)))      {      *aInstancePtr = NS_STATIC_CAST(nsIScriptGlobalObjectOwner*, this);      NS_ADDREF((nsISupports*)*aInstancePtr);      return NS_OK;      }   else if (aIID.Equals(NS_GET_IID(nsIURIContentListener)))   {      *aInstancePtr = NS_STATIC_CAST(nsIURIContentListener*, this);      NS_ADDREF((nsISupports*)*aInstancePtr);      return NS_OK;   }   else if(aIID.Equals(NS_GET_IID(nsIScriptGlobalObject)))      {      NS_ENSURE_SUCCESS(CreateScriptEnvironment(), NS_ERROR_FAILURE);      *aInstancePtr = mScriptGlobal;      NS_ADDREF((nsISupports*)*aInstancePtr);      return NS_OK;      }   else if(mPluginManager) //XXX this seems a little wrong. MMP      rv = mPluginManager->QueryInterface(aIID, aInstancePtr);    if (!*aInstancePtr || NS_FAILED(rv))     return QueryInterface(aIID, aInstancePtr);   else     return rv;}