Bug 1256688 - Change BPH::has to follow [[HasProperty]] for ordinary objects. r=jorendorff

This commit is contained in:
Tom Schuster
2016-03-19 01:30:03 +01:00
parent 40cf37f27b
commit e02e8c9f95
3 changed files with 25 additions and 34 deletions

View File

@@ -259,35 +259,6 @@ BaseDOMProxyHandler::getOwnEnumerablePropertyKeys(JSContext* cx,
return ownPropNames(cx, proxy, JSITER_OWNONLY, props);
}
bool
DOMProxyHandler::has(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id, bool* bp) const
{
if (!hasOwn(cx, proxy, id, bp)) {
return false;
}
if (*bp) {
// We have the property ourselves; no need to worry about our prototype
// chain.
return true;
}
// OK, now we have to look at the proto
JS::Rooted<JSObject*> proto(cx);
if (!js::GetObjectProto(cx, proxy, &proto)) {
return false;
}
if (!proto) {
return true;
}
bool protoHasProp;
bool ok = JS_HasPropertyById(cx, proto, id, &protoHasProp);
if (ok) {
*bp = protoHasProp;
}
return ok;
}
bool
DOMProxyHandler::setCustom(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id,
JS::Handle<JS::Value> v, bool *done) const