mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 05:45:37 +00:00
In Proxy get(own)PropertyDescriptor return undefined if property doesn't exist (bug 582967, r=brendan/jorendorff).
This commit is contained in:
parent
4dcb309477
commit
53bf5744ef
@ -377,6 +377,13 @@ ParsePropertyDescriptorObject(JSContext *cx, JSObject *obj, jsid id, const Value
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
IndicatePropertyNotFound(JSContext *cx, PropertyDescriptor *desc)
|
||||||
|
{
|
||||||
|
desc->obj = NULL;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
MakePropertyDescriptorObject(JSContext *cx, jsid id, PropertyDescriptor *desc, Value *vp)
|
MakePropertyDescriptorObject(JSContext *cx, jsid id, PropertyDescriptor *desc, Value *vp)
|
||||||
{
|
{
|
||||||
@ -496,8 +503,9 @@ JSScriptedProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy, js
|
|||||||
AutoValueRooter tvr(cx);
|
AutoValueRooter tvr(cx);
|
||||||
return GetFundamentalTrap(cx, handler, ATOM(getPropertyDescriptor), tvr.addr()) &&
|
return GetFundamentalTrap(cx, handler, ATOM(getPropertyDescriptor), tvr.addr()) &&
|
||||||
Trap1(cx, handler, tvr.value(), id, tvr.addr()) &&
|
Trap1(cx, handler, tvr.value(), id, tvr.addr()) &&
|
||||||
ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(getPropertyDescriptor), tvr.value()) &&
|
((tvr.value().isUndefined() && IndicatePropertyNotFound(cx, desc)) ||
|
||||||
ParsePropertyDescriptorObject(cx, proxy, id, tvr.value(), desc);
|
ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(getPropertyDescriptor), tvr.value()) &&
|
||||||
|
ParsePropertyDescriptorObject(cx, proxy, id, tvr.value(), desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -508,8 +516,9 @@ JSScriptedProxyHandler::getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy,
|
|||||||
AutoValueRooter tvr(cx);
|
AutoValueRooter tvr(cx);
|
||||||
return GetFundamentalTrap(cx, handler, ATOM(getOwnPropertyDescriptor), tvr.addr()) &&
|
return GetFundamentalTrap(cx, handler, ATOM(getOwnPropertyDescriptor), tvr.addr()) &&
|
||||||
Trap1(cx, handler, tvr.value(), id, tvr.addr()) &&
|
Trap1(cx, handler, tvr.value(), id, tvr.addr()) &&
|
||||||
ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(getPropertyDescriptor), tvr.value()) &&
|
((tvr.value().isUndefined() && IndicatePropertyNotFound(cx, desc)) ||
|
||||||
ParsePropertyDescriptorObject(cx, proxy, id, tvr.value(), desc);
|
ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(getPropertyDescriptor), tvr.value()) &&
|
||||||
|
ParsePropertyDescriptorObject(cx, proxy, id, tvr.value(), desc));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
Loading…
Reference in New Issue
Block a user