e = (nsIEnumerator*) JSVAL_TO_PRIVATE(*statep);
e = (nsISimpleEnumerator*) JSVAL_TO_PRIVATE(*statep);
nsXPCComponents_Classes::NewEnumerate(nsIXPConnectWrappedNative *wrapper,                                      JSContext * cx, JSObject * obj,                                      PRUint32 enum_op, jsval * statep,                                      jsid * idp, PRBool *_retval){    nsIEnumerator* e;    switch(enum_op)    {        case JSENUMERATE_INIT:        {            nsIComponentManagerObsolete* compMgr;            if(NS_FAILED(NS_GetGlobalComponentManager((nsIComponentManager**)&compMgr)) ||               !compMgr || NS_FAILED(compMgr->EnumerateContractIDs(&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<nsISupportsString> holder(do_QueryInterface(isup));                if(holder)                {                    char* name;                    if(NS_SUCCEEDED(holder->GetData(&name)) && name)                    {                        JSString* idstr = JS_NewStringCopyZ(cx, name);                        nsMemory::Free(name);                        if(idstr &&                           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;    }}