rv = mSearchOperation->Init (mConnection, this);
nsCOMPtr<nsIProxyObjectManager> proxyMgr = do_GetService(NS_XPCOMPROXY_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsILDAPMessageListener> proxyListener; rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID(nsILDAPMessageListener), this, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs(proxyListener)); NS_ENSURE_SUCCESS(rv, rv);  rv = mSearchOperation->Init (mConnection, proxyListener);
nsresult nsAbQueryLDAPMessageListener::OnLDAPMessageBind (nsILDAPMessage *aMessage){    if (mBound == PR_TRUE)        return NS_OK;    nsresult rv;    mSearchOperation = do_CreateInstance(NS_LDAPOPERATION_CONTRACTID, &rv);    NS_ENSURE_SUCCESS(rv, rv);    rv = mSearchOperation->Init (mConnection, this);    NS_ENSURE_SUCCESS(rv, rv);    nsXPIDLCString dn;    rv = mUrl->GetDn (getter_Copies (dn));    NS_ENSURE_SUCCESS(rv, rv);    PRInt32 scope;    rv = mUrl->GetScope (&scope);    NS_ENSURE_SUCCESS(rv, rv);    nsXPIDLCString filter;    rv = mUrl->GetFilter (getter_Copies (filter));    NS_ENSURE_SUCCESS(rv, rv);    CharPtrArrayGuard attributes;    rv = mUrl->GetAttributes (attributes.GetSizeAddr (), attributes.GetArrayAddr ());    NS_ENSURE_SUCCESS(rv, rv);    rv = mSearchOperation->SearchExt (NS_ConvertASCIItoUCS2(dn).get(), scope,            NS_ConvertASCIItoUCS2(filter).get(),            attributes.GetSize (), attributes.GetArray (),            mTimeOut, mResultLimit);    NS_ENSURE_SUCCESS(rv, rv);    mBound = PR_TRUE;    return rv;}