Out parameter. On success, the resolve hook must set *objp to the object in which the property has been defined, or NULL if it was not defined.

Description

Like JSResolveOp, but flags provide contextual information about the property access.

On success, the callback must set the *objp out parameter to null if id was not resolved; or non-null, referring to obj or one of its prototypes, if id was resolved; and return JS_TRUE. On failure, it must return JS_FALSE.

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. Thus a resolve hook implementation may define the property id being resolved in the object in which the id was first sought, rather than in a prototype object whose class led to the resolve hook being called.

When using JSCLASS_NEW_RESOLVE_GETS_START, the resolve hook must therefore null *objp to signify "not resolved". With only JSCLASS_NEW_RESOLVE and no JSCLASS_NEW_RESOLVE_GETS_START, the hook can assume *objp is null on entry. This is not good practice, but enough existing hook implementations count on it that we can't break compatibility by passing the starting object in *objp without a new JSClass flag.

Flags

The flags argument is the logical OR of zero or more of the following flags. The flags describe what kind of property access triggered the resolve callback. (The same flags are used in JS_LookupPropertyWithFlags.)

JSRESOLVE_QUALIFIED Obsolete since JSAPI 20

The property access uses the . or [] operator: obj.id or obj[id], not id.

JSRESOLVE_ASSIGNINGObsolete since JSAPI 31

The property appears on the left-hand side of an assignment.

JSRESOLVE_DETECTING Obsolete since JSAPI 20

The property is being used in code like "if (o.p)...", or a similar idiom where the apparent purpose of the property access is to detect whether the property exists. (This flag has been replaced with the JSCLASS_EMULATES_UNDEFINED mechanism.)

JSRESOLVE_DECLARINGObsolete since JSAPI 15

The property is being declared in a var, const, or function declaration.