}  if (dom_class != &nsDOMClassInfo::sDOMJSClass) { return JS_TRUE;
DOMJSClass_HasInstance(JSContext *cx, JSObject *obj, jsval v,                       JSBool *bp){  JSObject *dom_obj;  if (!::JS_ValueToObject(cx, v, &dom_obj)) {    NS_ERROR("DOMJSClass_HasInstance called on non-object");    nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_DOM_NOT_SUPPORTED_ERR);    return JS_FALSE;  }  if (!dom_obj) {    return JS_TRUE;  }  JSClass* dom_class = JS_GET_CLASS(cx, dom_obj);  if (!dom_class) {    NS_ERROR("DOMJSClass_HasInstance can't get class.");    nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_UNEXPECTED);    return JS_FALSE;  }  if (dom_class != &nsDOMClassInfo::sDOMJSClass) {    return JS_TRUE;  }  const nsGlobalNameStruct *name_struct = nsnull;  extern nsScriptNameSpaceManager *gNameSpaceManager;  if (!gNameSpaceManager) {    NS_ERROR("DOMJSClass_HasInstance can't get namespace manager.");    nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_UNEXPECTED);    return JS_FALSE;  }  gNameSpaceManager->LookupName(NS_ConvertASCIItoUCS2(dom_class->name),                                &name_struct);  if (!name_struct) {    NS_ERROR("Name isn't in hash.");    nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_UNEXPECTED);    return JS_FALSE;  }  NS_ASSERTION(name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor ||               name_struct->mType == nsGlobalNameStruct::eTypeExternalClassInfo ||               name_struct->mType == nsGlobalNameStruct::eTypeExternalConstructorAlias,               "The constructor was set up with a struct of the wrong type.");  const PRUnichar* class_name =      NS_CONST_CAST(const PRUnichar*,                    NS_STATIC_CAST(PRUnichar*,                                    ::JS_GetPrivate(cx, obj)));  if (!class_name) {    NS_ERROR("DOMJSClass_HasInstance can't get name.");    nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_UNEXPECTED);    return JS_FALSE;  }  const nsGlobalNameStruct *class_name_struct = nsnull;  gNameSpaceManager->LookupName(nsDependentString(class_name),                                &class_name_struct);  if (!class_name_struct) {    NS_ERROR("Name isn't in hash.");    nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_UNEXPECTED);    return JS_FALSE;  }  if (class_name_struct->mType != nsGlobalNameStruct::eTypeClassProto &&      class_name_struct->mType != nsGlobalNameStruct::eTypeInterface) {    *bp = (name_struct == class_name_struct);    return JS_TRUE;  }  if (name_struct->mType == nsGlobalNameStruct::eTypeExternalConstructorAlias) {    name_struct = gNameSpaceManager->GetConstructorProto(name_struct);    if (!name_struct) {      NS_ERROR("Couldn't get constructor prototype.");      nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_UNEXPECTED);      return JS_FALSE;    }  }  NS_ASSERTION(name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor ||               name_struct->mType == nsGlobalNameStruct::eTypeExternalClassInfo,               "The constructor was set up with a struct of the wrong type.");  const nsDOMClassInfoData *ci_data = nsnull;  if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor &&      name_struct->mDOMClassInfoID >= 0) {    ci_data = &sClassInfoData[name_struct->mDOMClassInfoID];  } else if (name_struct->mType == nsGlobalNameStruct::eTypeExternalClassInfo) {    ci_data = name_struct->mData;  }  nsCOMPtr<nsIInterfaceInfoManager> iim =    dont_AddRef(XPTI_GetInterfaceInfoManager());  if (!iim) {    NS_ERROR("DOMJSClass_HasInstance can't get interface info mgr.");    nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_UNEXPECTED);    return JS_FALSE;  }  nsCOMPtr<nsIInterfaceInfo> if_info;  PRUint32 count = 0;  const nsIID* class_interface;  while ((class_interface = ci_data->mInterfaces[count++])) {    if (class_name_struct->mIID.Equals(*class_interface)) {      *bp = JS_TRUE;      return JS_TRUE;    }    iim->GetInfoForIID(class_interface, getter_AddRefs(if_info));    if (!if_info) {      NS_ERROR("DOMJSClass_HasInstance can't get interface info.");      nsDOMClassInfo::ThrowJSException(cx, NS_ERROR_UNEXPECTED);      return JS_FALSE;    }    if_info->HasAncestor(&class_name_struct->mIID, bp);    if (*bp) {      return JS_TRUE;    }  }  return JS_TRUE;}