if(scriptableInfo && scriptableInfo->GetFlags().DontEnumQueryInterface() && idval == rt->GetStringJSVal(XPCJSRuntime::IDX_QUERY_INTERFACE))
if(idval == rt->GetStringJSVal(XPCJSRuntime::IDX_TO_STRING) || idval == rt->GetStringJSVal(XPCJSRuntime::IDX_TO_SOURCE) || (scriptableInfo && scriptableInfo->GetFlags().DontEnumQueryInterface() && idval == rt->GetStringJSVal(XPCJSRuntime::IDX_QUERY_INTERFACE)))
DefinePropertyIfFound(XPCCallContext& ccx,                      JSObject *obj, jsval idval,                      XPCNativeSet* set,                      XPCNativeInterface* iface,                      XPCNativeMember* member,                      XPCWrappedNativeScope* scope,                      JSBool reflectToStringAndToSource,                      XPCWrappedNative* wrapperToReflectInterfaceNames,                      XPCWrappedNative* wrapperToReflectDoubleWrap,                      XPCNativeScriptableInfo* scriptableInfo,                      uintN propFlags,                      JSBool* resolved){    XPCJSRuntime* rt = ccx.GetRuntime();    JSBool found;    const char* name;    jsid id;    if(set)    {        if(iface)            found = JS_TRUE;        else            found = set->FindMember(idval, &member, &iface);    }    else        found = (nsnull != (member = iface->FindMember(idval)));    if(!found)    {        HANDLE_POSSIBLE_NAME_CASE_ERROR(ccx, set, iface, idval);        if(reflectToStringAndToSource)        {            JSNative call;            if(idval == rt->GetStringJSVal(XPCJSRuntime::IDX_TO_STRING))            {                call = XPC_WN_Shared_ToString;                name = rt->GetStringName(XPCJSRuntime::IDX_TO_STRING);                id   = rt->GetStringID(XPCJSRuntime::IDX_TO_STRING);            }            else if(idval == rt->GetStringJSVal(XPCJSRuntime::IDX_TO_SOURCE))            {                call = XPC_WN_Shared_ToSource;                name = rt->GetStringName(XPCJSRuntime::IDX_TO_SOURCE);                id   = rt->GetStringID(XPCJSRuntime::IDX_TO_SOURCE);            }            else                call = nsnull;            if(call)            {                JSFunction* fun = JS_NewFunction(ccx, call, 0, 0, obj, name);                if(!fun)                {                    JS_ReportOutOfMemory(ccx);                    return JS_FALSE;                }                AutoResolveName arn(ccx, idval);                if(resolved)                    *resolved = JS_TRUE;                return OBJ_DEFINE_PROPERTY(ccx, obj, id,                                           OBJECT_TO_JSVAL(JS_GetFunctionObject(fun)),                                           nsnull, nsnull,                                           propFlags & ~JSPROP_ENUMERATE,                                           nsnull);            }        }        // This *might* be a tearoff name that is not yet part of our        // set. Let's lookup the name and see if it is the name of an        // interface. Then we'll see if the object actually *does* this        // interface and add a tearoff as necessary.        if(wrapperToReflectInterfaceNames)        {            AutoMarkingNativeInterfacePtr iface2(ccx);            XPCWrappedNativeTearOff* to;            JSObject* jso;            if(JSVAL_IS_STRING(idval) &&               nsnull != (name = JS_GetStringBytes(JSVAL_TO_STRING(idval))) &&               (iface2 = XPCNativeInterface::GetNewOrUsed(ccx, name), iface2) &&               nsnull != (to = wrapperToReflectInterfaceNames->                                    FindTearOff(ccx, iface2, JS_TRUE)) &&               nsnull != (jso = to->GetJSObject()))            {                AutoResolveName arn(ccx, idval);                if(resolved)                    *resolved = JS_TRUE;                return JS_ValueToId(ccx, idval, &id) &&                       OBJ_DEFINE_PROPERTY(ccx, obj, id, OBJECT_TO_JSVAL(jso),                                           nsnull, nsnull,                                           propFlags & ~JSPROP_ENUMERATE,                                           nsnull);            }        }        // This *might* be a double wrapped JSObject        if(wrapperToReflectDoubleWrap &&           idval == rt->GetStringJSVal(XPCJSRuntime::IDX_WRAPPED_JSOBJECT) &&           GetDoubleWrappedJSObject(ccx, wrapperToReflectDoubleWrap))        {            // We build and add a getter function.            // A security check is done on a per-get basis.            JSFunction* fun;            id = rt->GetStringID(XPCJSRuntime::IDX_WRAPPED_JSOBJECT);            name = rt->GetStringName(XPCJSRuntime::IDX_WRAPPED_JSOBJECT);            fun = JS_NewFunction(ccx, XPC_WN_DoubleWrappedGetter,                                 0, JSFUN_GETTER, obj, name);            if(!fun)                return JS_FALSE;            JSObject* funobj = JS_GetFunctionObject(fun);            if(!funobj)                return JS_FALSE;            propFlags |= JSPROP_GETTER;            propFlags &= ~JSPROP_ENUMERATE;            AutoResolveName arn(ccx, idval);            if(resolved)                *resolved = JS_TRUE;            return OBJ_DEFINE_PROPERTY(ccx, obj, id, JSVAL_VOID,                                       (JSPropertyOp) funobj, nsnull,                                       propFlags, nsnull);        }#ifdef XPC_IDISPATCH_SUPPORT        // Check to see if there's an IDispatch tearoff             if(wrapperToReflectInterfaceNames &&            XPCIDispatchExtension::DefineProperty(ccx, obj,                 idval, wrapperToReflectInterfaceNames, propFlags, resolved))            return JS_TRUE;#endif                if(resolved)            *resolved = JS_FALSE;        return JS_TRUE;    }    if(!member)    {        if(wrapperToReflectInterfaceNames)        {            XPCWrappedNativeTearOff* to =              wrapperToReflectInterfaceNames->FindTearOff(ccx, iface, JS_TRUE);            if(!to)                return JS_FALSE;            JSObject* jso = to->GetJSObject();            if(!jso)                return JS_FALSE;            AutoResolveName arn(ccx, idval);            if(resolved)                *resolved = JS_TRUE;            return JS_ValueToId(ccx, idval, &id) &&                   OBJ_DEFINE_PROPERTY(ccx, obj, id, OBJECT_TO_JSVAL(jso),                                       nsnull, nsnull,                                       propFlags & ~JSPROP_ENUMERATE,                                       nsnull);        }        if(resolved)            *resolved = JS_FALSE;        return JS_TRUE;    }    if(member->IsConstant())    {        jsval val;        AutoResolveName arn(ccx, idval);        if(resolved)            *resolved = JS_TRUE;        return member->GetValue(ccx, iface, &val) &&               JS_ValueToId(ccx, idval, &id) &&               OBJ_DEFINE_PROPERTY(ccx, obj, id, val, nsnull, nsnull,                                   propFlags, nsnull);    }    if(scriptableInfo &&       scriptableInfo->GetFlags().DontEnumQueryInterface() &&       idval == rt->GetStringJSVal(XPCJSRuntime::IDX_QUERY_INTERFACE))        propFlags &= ~JSPROP_ENUMERATE;    JSObject* funobj;        {        // scoped gc protection of funval        jsval funval;        if(!member->GetValue(ccx, iface, &funval))            return JS_FALSE;            AUTO_MARK_JSVAL(ccx, funval);        funobj = xpc_CloneJSFunction(ccx, JSVAL_TO_OBJECT(funval), obj);        if(!funobj)            return JS_FALSE;    }    // protect funobj until it is actually attached    AUTO_MARK_JSVAL(ccx, OBJECT_TO_JSVAL(funobj));#ifdef off_DEBUG_jband    {        static int cloneCount = 0;        if(!(++cloneCount%10))            printf("<><><> %d cloned functions created\n", cloneCount);    }#endif    if(member->IsMethod())    {        AutoResolveName arn(ccx, idval);        if(resolved)            *resolved = JS_TRUE;        return JS_ValueToId(ccx, idval, &id) &&               OBJ_DEFINE_PROPERTY(ccx, obj, id, OBJECT_TO_JSVAL(funobj),                                   nsnull, nsnull, propFlags, nsnull);    }    // else...    NS_ASSERTION(member->IsAttribute(), "way broken!");    propFlags |= JSPROP_GETTER | JSPROP_SHARED;    if(member->IsWritableAttribute())    {        propFlags |= JSPROP_SETTER;        propFlags &= ~JSPROP_READONLY;    }    AutoResolveName arn(ccx, idval);    if(resolved)        *resolved = JS_TRUE;    return JS_ValueToId(ccx, idval, &id) &&           OBJ_DEFINE_PROPERTY(ccx, obj, id, JSVAL_VOID,                               (JSPropertyOp) funobj,                               (JSPropertyOp) funobj,                               propFlags, nsnull);}