diff --git a/js/src/jsproxy.cpp b/js/src/jsproxy.cpp index 49ce22d42db5..dedb9db4b8f4 100644 --- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -377,6 +377,13 @@ ParsePropertyDescriptorObject(JSContext *cx, JSObject *obj, jsid id, const Value return true; } +static bool +IndicatePropertyNotFound(JSContext *cx, PropertyDescriptor *desc) +{ + desc->obj = NULL; + return true; +} + static bool MakePropertyDescriptorObject(JSContext *cx, jsid id, PropertyDescriptor *desc, Value *vp) { @@ -496,8 +503,9 @@ JSScriptedProxyHandler::getPropertyDescriptor(JSContext *cx, JSObject *proxy, js AutoValueRooter tvr(cx); return GetFundamentalTrap(cx, handler, ATOM(getPropertyDescriptor), tvr.addr()) && Trap1(cx, handler, tvr.value(), id, tvr.addr()) && - ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(getPropertyDescriptor), tvr.value()) && - ParsePropertyDescriptorObject(cx, proxy, id, tvr.value(), desc); + ((tvr.value().isUndefined() && IndicatePropertyNotFound(cx, desc)) || + ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(getPropertyDescriptor), tvr.value()) && + ParsePropertyDescriptorObject(cx, proxy, id, tvr.value(), desc)); } bool @@ -508,8 +516,9 @@ JSScriptedProxyHandler::getOwnPropertyDescriptor(JSContext *cx, JSObject *proxy, AutoValueRooter tvr(cx); return GetFundamentalTrap(cx, handler, ATOM(getOwnPropertyDescriptor), tvr.addr()) && Trap1(cx, handler, tvr.value(), id, tvr.addr()) && - ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(getPropertyDescriptor), tvr.value()) && - ParsePropertyDescriptorObject(cx, proxy, id, tvr.value(), desc); + ((tvr.value().isUndefined() && IndicatePropertyNotFound(cx, desc)) || + ReturnedValueMustNotBePrimitive(cx, proxy, ATOM(getPropertyDescriptor), tvr.value()) && + ParsePropertyDescriptorObject(cx, proxy, id, tvr.value(), desc)); } bool