JSClass.checkAccess

  • Revision slug: SpiderMonkey/JSAPI_Reference/JSClass.checkAccess
  • Revision title: JSClass.checkAccess
  • Revision id: 87502
  • Created:
  • Creator: Jorend
  • Is current revision? No
  • Comment New page!

Revision Content

{{template.Jsapiref()}}

JSCheckAccessOp is the type of the JSClass.checkAccess callback.

Syntax

typedef JSBool (*JSCheckAccessOp)(JSContext *cx, JSObject *obj, jsval id,
    JSAccessMode mode, jsval *vp);
Name Type Description
cx JSContext * The JS context in which the property access attempt is occurring.
obj JSObject * The object whose properties are being accessed.
id jsval The name or index of the property being accessed.
vp jsval * Out parameter. On success, the callback must store the last-got value of the property in *vp.

Description

Check whether obj{{mediawiki.external('id')}} may be accessed per mode, returning JS_FALSE on error/exception, JS_TRUE on success with obj{{mediawiki.external('id')}}'s last-got value in *vp. As for JSPropertyOp, id is either a string or an int jsval.

See JSCheckAccessIdOp for the JSObjectOps counterpart, which takes a jsid (a tagged int or aligned, unique identifier pointer) rather than a jsval. The native js_ObjectOps.checkAccess simply forwards to the object's clasp->checkAccess, so that both JSClass and JSObjectOps implementors may specialize access checks.

See also

Groups Functions
Documents {{template.LXRSearch("ident", "i", "JSCheckAccessOp")}}
Entries

JSClass, JSObject,

JSPrincipals

Revision Source

<p>
{{template.Jsapiref()}}
</p><p><b><code>JSCheckAccessOp</code></b> is the type of the <code><a href="en/JSClass">JSClass</a>.checkAccess</code> callback.
</p>
<h2 name="Syntax"> Syntax </h2>
<pre class="eval">typedef JSBool (*<b>JSCheckAccessOp</b>)(JSContext *cx, JSObject *obj, jsval id,
    JSAccessMode mode, jsval *vp);
</pre>
<table class="fullwidth-table">
<tbody><tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><code>cx</code></td>
<td><code><a href="en/JSContext">JSContext</a> *</code></td>
<td>The JS context in which the property access attempt is occurring.</td>
</tr>
<tr>
<td><code>obj</code></td>
<td><code><a href="en/JSObject">JSObject</a> *</code></td>
<td>The object whose properties are being accessed.</td>
</tr>
<tr>
<td><code>id</code></td>
<td><code><a href="en/Jsval">jsval</a></code></td>
<td>The name or index of the property being accessed.</td>
</tr>
<tr>
<td><code>vp</code></td>
<td><code><a href="en/Jsval">jsval</a> *</code></td>
<td>Out parameter.  On success, the callback must store the last-got value of the property in <code>*vp</code>.</td>
</tr>
</tbody></table>
<h2 name="Description"> Description </h2>
<p>Check whether <code>obj{{mediawiki.external('id')}}</code> may be accessed per <code>mode</code>, returning <code>JS_FALSE</code> on error/exception, <code>JS_TRUE</code> on success with <code>obj{{mediawiki.external('id')}}</code>'s last-got value in <code>*vp</code>.  As for <code><a href="en/JSPropertyOp">JSPropertyOp</a></code>, <code>id</code> is either a string or an int <code><a href="en/Jsval">jsval</a></code>.
</p><p>See <code><a href="en/JSCheckAccessIdOp">JSCheckAccessIdOp</a></code> for the <code><a href="en/JSObjectOps">JSObjectOps</a></code> counterpart, which takes a <code>jsid</code> (a tagged int or aligned, unique identifier pointer) rather than a <code>jsval</code>.  The native <code>js_ObjectOps.checkAccess</code> simply forwards to the object's <code>clasp-&gt;checkAccess</code>, so that both <code>JSClass</code> and <code>JSObjectOps</code> implementors may specialize access checks.
</p>
<h2 name="See_also"> See also </h2>
<table class="fullwidth-table">
<tbody><tr>
<td>Groups</td>
<td><a href="en/JSAPI_Reference#Functions">Functions</a></td>
</tr>
<tr>
<td>Documents</td>
<td>{{template.LXRSearch("ident", "i", "JSCheckAccessOp")}}</td>
</tr>
<tr>
<td>Entries</td>
<td>
<p><a href="en/JSClass">JSClass</a>,
<a href="en/JSObject">JSObject</a>,
</p>
<a href="en/JSPrincipals">JSPrincipals</a></td>
</tr>
</tbody></table>
Revert to this revision