Agreed.  Hard to think of a name that isn't ambiguous with 
ObjectProxyClass/FunctionProxyClass.  Perhaps ProxySingletonClass?

----- Original Message -----
> It looks like ProxyClass is only used for the "Proxy" object that we
> add to the global (i.e., the thing that allows you to do
> Proxy.create). That object isn't actually a proxy at all. It
> probably would make sense to rename ProxyClass to something less
> confusing.
> 
> -Bill
> 
> ----- Original Message -----
> > From: "Nicholas Nethercote" <[email protected]>
> > To: "JS Internals list"
> > <[email protected]>
> > Sent: Wednesday, June 19, 2013 11:33:12 PM
> > Subject: [JS-internals] Proxy question
> > 
> > Hi,
> > 
> > Here's some code from jsproxy.h:
> > 
> > 
> > inline bool IsObjectProxyClass(const Class *clasp)
> > {
> >     return clasp == &js::ObjectProxyClass || clasp ==
> > &js::OuterWindowProxyClass;
> > }
> > 
> > inline bool IsFunctionProxyClass(const Class *clasp)
> > {
> >     return clasp == &js::FunctionProxyClass;
> > }
> > 
> > inline bool IsProxy(JSObject *obj)
> > {
> >     Class *clasp = GetObjectClass(obj);
> >     return IsObjectProxyClass(clasp) ||
> >     IsFunctionProxyClass(clasp);
> > }
> > 
> > 
> > So... IsProxy() succeeds if an object has one of the following
> > classes:  FunctionProxyClass, ObjectProxyClass,
> > OuterWindowProxyClass.
> >  However, it fails if the object's class is ProxyClass.  This is...
> > surprising.  Is it a bug?
> > If I try changing IsProxy() to allow ProxyClass I get assertion
> > failures.
> > 
> > There's a similar case in jsfriendapi.h where ProxyClass is
> > ignored:
> > 
> > inline bool
> > GetObjectProto(JSContext *cx, JS::Handle<JSObject*> obj,
> > JS::MutableHandle<JSObject*> proto)
> > {
> >     // njn: hmm
> >     js::Class *clasp = GetObjectClass(obj);
> >     if (clasp == &js::ObjectProxyClass ||
> >         clasp == &js::OuterWindowProxyClass ||
> >         clasp == &js::FunctionProxyClass)
> >     {
> >         return JS_GetPrototype(cx, obj, proto.address());
> >     }
> > 
> > 
> > 
> > Nick
> > _______________________________________________
> > dev-tech-js-engine-internals mailing list
> > [email protected]
> > https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals
> > 
> _______________________________________________
> dev-tech-js-engine-internals mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals
> 
_______________________________________________
dev-tech-js-engine-internals mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to