Bug 610078 - Return the value when we found it on a proxy. r=brendan a=blocking betaN

This commit is contained in:
Blake Kaplan 2010-11-05 18:25:37 -07:00
parent 4d18c6aeca
commit 1c6917d3c3

View File

@ -3128,16 +3128,26 @@ LookupResult(JSContext *cx, JSObject *obj, JSObject *obj2, jsid id,
}
/* Peek at the native property's slot value, without doing a Get. */
if (obj2->containsSlot(shape->slot))
if (obj2->containsSlot(shape->slot)) {
*vp = obj2->nativeGetSlot(shape->slot);
else
vp->setBoolean(true);
} else if (obj2->isDenseArray()) {
return js_GetDenseArrayElementValue(cx, obj2, id, vp);
return true;
}
} else {
/* XXX bad API: no way to return "defined but value unknown" */
vp->setBoolean(true);
if (obj2->isDenseArray())
return js_GetDenseArrayElementValue(cx, obj2, id, vp);
if (obj2->isProxy()) {
AutoPropertyDescriptorRooter desc(cx);
if (!JSProxy::getPropertyDescriptor(cx, obj2, id, false, &desc))
return false;
if (!(desc.attrs & JSPROP_SHARED)) {
*vp = desc.value;
return true;
}
}
}
/* XXX bad API: no way to return "defined but value unknown" */
vp->setBoolean(true);
return true;
}