JSString* idstr; const char* name; if(NS_SUCCEEDED(iface->GetNameShared(&name)) && name && nsnull != (idstr = JS_NewStringCopyZ(cx, name)) && JS_ValueToId(cx, STRING_TO_JSVAL(idstr), idp))
e->Next(); nsCOMPtr<nsIInterfaceInfo> iface(do_QueryInterface(isup)); if(iface)
nsXPCComponents_Interfaces::NewEnumerate(nsIXPConnectWrappedNative *wrapper,                                         JSContext * cx, JSObject * obj,                                         PRUint32 enum_op, jsval * statep,                                         jsid * idp, PRBool *_retval){    nsIEnumerator* e;    switch(enum_op)    {        case JSENUMERATE_INIT:        {            nsCOMPtr<nsIInterfaceInfoManager>                iim(dont_AddRef(XPTI_GetInterfaceInfoManager()));            if(!iim || NS_FAILED(iim->EnumerateInterfaces(&e)) || !e ||               NS_FAILED(e->First()))            {                *statep = JSVAL_NULL;                return NS_ERROR_UNEXPECTED;            }            *statep = PRIVATE_TO_JSVAL(e);            if(idp)                *idp = JSVAL_ZERO; // indicate that we don't know the count            return NS_OK;        }        case JSENUMERATE_NEXT:        {            nsCOMPtr<nsISupports> isup;            e = (nsIEnumerator*) JSVAL_TO_PRIVATE(*statep);            if(NS_COMFALSE == e->IsDone() &&               NS_SUCCEEDED(e->CurrentItem(getter_AddRefs(isup))) && isup)            {                e->Next();                nsCOMPtr<nsIInterfaceInfo> iface(do_QueryInterface(isup));                if(iface)                {                    JSString* idstr;                    const char* name;                    if(NS_SUCCEEDED(iface->GetNameShared(&name)) && name &&                       nsnull != (idstr = JS_NewStringCopyZ(cx, name)) &&                       JS_ValueToId(cx, STRING_TO_JSVAL(idstr), idp))                    {                        return NS_OK;                    }                }            }            // else... FALL THROUGH        }        case JSENUMERATE_DESTROY:        default:            e = (nsIEnumerator*) JSVAL_TO_PRIVATE(*statep);            NS_IF_RELEASE(e);            *statep = JSVAL_NULL;            return NS_OK;    }}