Bug 887558 (part 1) - Introduce ProxyObject and some sub-classes. r=jorendorff.

This commit is contained in:
Nicholas Nethercote
2013-06-20 21:27:28 -07:00
parent d02d6680d0
commit 1a13de61a4
33 changed files with 194 additions and 117 deletions

View File

@@ -106,7 +106,7 @@ Enumerate(JSContext *cx, HandleObject pobj, jsid id,
if (JS_UNLIKELY(!pobj->getTaggedProto().isObject() && JSID_IS_ATOM(id, cx->names().proto)))
return true;
if (!(flags & JSITER_OWNONLY) || pobj->isProxy() || pobj->getOps()->enumerate) {
if (!(flags & JSITER_OWNONLY) || pobj->is<ProxyObject>() || pobj->getOps()->enumerate) {
/* If we've already seen this, we definitely won't add it. */
IdSet::AddPtr p = ht.lookupForAdd(id);
if (JS_UNLIKELY(!!p))
@@ -117,7 +117,7 @@ Enumerate(JSContext *cx, HandleObject pobj, jsid id,
* the prototype chain, but custom enumeration behaviors might return
* duplicated properties, so always add in such cases.
*/
if ((pobj->isProxy() || pobj->getProto() || pobj->getOps()->enumerate) && !ht.add(p, id))
if ((pobj->is<ProxyObject>() || pobj->getProto() || pobj->getOps()->enumerate) && !ht.add(p, id))
return false;
}
@@ -206,7 +206,7 @@ Snapshot(JSContext *cx, JSObject *pobj_, unsigned flags, AutoIdVector *props)
if (!EnumerateNativeProperties(cx, pobj, flags, ht, props))
return false;
} else {
if (pobj->isProxy()) {
if (pobj->is<ProxyObject>()) {
AutoIdVector proxyProps(cx);
if (flags & JSITER_OWNONLY) {
if (flags & JSITER_HIDDEN) {
@@ -682,7 +682,7 @@ js::GetIterator(JSContext *cx, HandleObject obj, unsigned flags, MutableHandleVa
}
miss:
if (obj->isProxy()) {
if (obj->is<ProxyObject>()) {
types::MarkIteratorUnknown(cx);
return Proxy::iterate(cx, obj, flags, vp);
}