Obsolete since JSAPI 29
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
typedef JSBool (* JSCheckAccessOp)(JSContext *cx, JSObject *obj, jsval id, JSAccessMode mode, jsval *vp);
||The JS context in which the property access attempt is occurring.|
||The object whose properties are being accessed.|
||The name or index of the property being accessed.|
||The type of access being checked.|
||Out parameter. On success, the callback must set
obj[id] may be accessed per
JS_FALSE on error/exception,
JS_TRUE on success with
obj[id]'s stored value in
*vp. As for
id is either a string or an int
JSCheckAccessOp implementations generally work by using JSDBGAPI functions such as
JS_StackFramePrincipals to obtain the principals of the code attempting the checked operation, then examining those principals and comparing them with the system's security policy. The nature of principals and the security policy are entirely up to the application.
If a class leaves the
NULL, a runtime-wide object access callback is called instead; see
JSClass offers the following hook:
JSClass.checkAccesscallback is called when a script attempts to access an object property. The callback can deny the script access to the property.