Bug 473075 - TM: HasProperty can call into exotic lookupProperty hooks. r=brendan.
This commit is contained in:
@@ -328,16 +328,17 @@ js_AddProperty(JSContext* cx, JSObject* obj, JSScopeProperty* sprop)
|
||||
static JSBool
|
||||
HasProperty(JSContext* cx, JSObject* obj, jsid id)
|
||||
{
|
||||
// check whether we know how the resolve op will behave
|
||||
// Check that we know how the lookup op will behave.
|
||||
if (obj->map->ops->lookupProperty != js_LookupProperty)
|
||||
return JSVAL_TO_PSEUDO_BOOLEAN(JSVAL_VOID);
|
||||
JSClass* clasp = OBJ_GET_CLASS(cx, obj);
|
||||
if (clasp->resolve != JS_ResolveStub && clasp != &js_StringClass)
|
||||
return JSVAL_TO_BOOLEAN(JSVAL_VOID);
|
||||
return JSVAL_TO_PSEUDO_BOOLEAN(JSVAL_VOID);
|
||||
|
||||
JSAutoResolveFlags rf(cx, JSRESOLVE_QUALIFIED);
|
||||
JSObject* obj2;
|
||||
JSProperty* prop;
|
||||
if (!OBJ_LOOKUP_PROPERTY(cx, obj, id, &obj2, &prop))
|
||||
return JSVAL_TO_BOOLEAN(JSVAL_VOID);
|
||||
if (!js_LookupPropertyWithFlags(cx, obj, id, JSRESOLVE_QUALIFIED, &obj2, &prop))
|
||||
return JSVAL_TO_PSEUDO_BOOLEAN(JSVAL_VOID);
|
||||
if (prop)
|
||||
OBJ_DROP_PROPERTY(cx, obj2, prop);
|
||||
return prop != NULL;
|
||||
|
||||
Reference in New Issue
Block a user