JSCheckAccessOp 编辑

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.

JSCheckAccessOp is the type for JSClass.checkAccess. (It is also the type of the callback set by JS_SetCheckObjectAccessCallback.)

Syntax

typedef JSBool
(* JSCheckAccessOp)(JSContext *cx, JSObject *obj, jsval id,
                    JSAccessMode mode, jsval *vp);
NameTypeDescription
cxJSContext *The JS context in which the property access attempt is occurring.
objJSObject *The object whose properties are being accessed.
idjsvalThe name or index of the property being accessed.
modeJSAccessModeThe type of access being checked.
vpjsval *Out parameter. On success, the callback must set *vp to the stored value of the property.

Description

Check whether obj[id] may be accessed per mode, returning JS_FALSE on error/exception, JS_TRUE on success with obj[id]'s stored value in *vp. As for JSPropertyOp, id is either a string or an int jsval.

JSCheckAccessOp implementations generally work by using JSDBGAPI functions such as JS_FrameIterator and 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 checkAccess field NULL, a runtime-wide object access callback is called instead; see JS_SetCheckObjectAccessCallback.

JSClass hooks

JSClass offers the following hook:

  • The JSClass.checkAccess callback is called when a script attempts to access an object property. The callback can deny the script access to the property.

See Also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:116 次

字数:5569

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文