Subj : Re: Question on js_LookupPropertyWithFlags To : netscape.public.mozilla.jseng From : Brendan Eich Date : Wed Sep 21 2005 05:51 pm Alfred wrote: > I feel confused about the flag of JSCLASS_NEW_RESOLVE_GETS_START. > In file "jspubtd.h", there is a comment for JSNewResolveOp which is: > "Setting JSCLASS_NEW_RESOLVE and JSCLASS_NEW_RESOLVE_GETS_START further > extends this hook by passing in the starting object on the prototype > chain via *objp." So when there is a call to lookupproperty and the > flag of JSCLASS_NEW_RESOLVE_GETS_START has been set, the lookup > operation should start from *objp. No, that's not what the code does, and not what the comment says. *objp is an out parameter unless JSCLASS_NEW_RESOLVE_GETS_START is set, in which case it is an in/out parameter, and then the "in" value is the starting object passed to js_LookupPropertyWithFlags (the object directly accessed by a get or set operation). This JSCLASS_NEW_RESOLVE_GETS_START flag helps JSNewResolveOp implementations figure out the relationship of their |obj| parameter to the starting object passed in via *objp. What you write seems to suggest that a JSNewResolveOp could somehow start the lookup at a different object from the one directly accessed by the higher-level get or set operation that triggers the lookup. That can't work, given that lookup calls resolve, not the other way around, and that you have to start somewhere to call resolve once, so you can't call resolve to get the starting object. Hope this helps, /be .