JS_SetPrincipalsTranscoder

  • Revision slug: SpiderMonkey/JSAPI_Reference/JS_SetPrincipalsTranscoder
  • Revision title: JS_SetPrincipalsTranscoder
  • Revision id: 138856
  • Created:
  • Creator: Jorend
  • Is current revision? No
  • Comment first cut, not much here

Revision Content

{{template.Jsapi_ref_header("JS_SetPrincipalsTranscoder")}}

Set the runtime-wide principals transcoder callback.

Syntax

JSPrincipalsTranscoder JS_SetPrincipalsTranscoder(
    JSRuntime *rt, JSPrincipalsTranscoder px);
Name Type Description
rt JSRuntime * The runtime to configure.
px JSPrincipalsTranscoder The new principals transcoder.

Callback syntax

typedef JSBool (* JS_DLL_CALLBACK JSPrincipalsTranscoder)(
    JSXDRState *xdr, JSPrincipals **principalsp);
Name Type Description
xdr JSXDRState * The XDR reader/writer.
principalsp JSPrincipals ** If xdr is a reader, this is an out parameter: on success, *principalsp receives the deserialized principals. If xdr is a writer, *principalsp points to the JSPrincipals object to be serialized.

Description

JS_SetPrincipalsTranscoder sets a runtime-wide callback which the JavaScript engine uses to serialize and deserialize principals.

Each script function is associated with principals, which poses a problem for XDR. The application provides the JSPrincipals objects, so it must also provide a JSPrincipalsTranscoder if it intends to serialize or deserialize principals.

JS_SetPrincipalsTranscoder returns the previous principals transcoder.

{{template.LXRSearch("ident", "i", "JS_SetPrincipalsTranscoder")}}

Revision Source

<p>{{template.Jsapi_ref_header("JS_SetPrincipalsTranscoder")}}
</p><p>Set the runtime-wide principals transcoder callback.
</p>
<h2 name="Syntax"> Syntax </h2>
<pre class="eval">JSPrincipalsTranscoder <b>JS_SetPrincipalsTranscoder</b>(
    <a href="en/JSRuntime">JSRuntime</a> *rt, JSPrincipalsTranscoder px);
</pre>
<table class="fullwidth-table">
<tbody><tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><code>rt</code></td>
<td><code><a href="en/JSRuntime">JSRuntime</a> *</code></td>
<td>The runtime to configure.</td>
</tr>
<tr>
<td><code>px</code></td>
<td><code>JSPrincipalsTranscoder</code></td>
<td>The new principals transcoder.</td>
</tr>
</tbody></table>
<h2 name="Callback_syntax"> Callback syntax </h2>
<pre class="eval">typedef <a href="en/JSBool">JSBool</a> (* JS_DLL_CALLBACK <b>JSPrincipalsTranscoder</b>)(
    <a href="en/JSXDRState">JSXDRState</a> *xdr, <a href="en/JSPrincipals">JSPrincipals</a> **principalsp);
</pre>
<table class="fullwidth-table">
<tbody><tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td><code>xdr</code></td>
<td><code><a href="en/JSXDRState">JSXDRState</a> *</code></td>
<td>The XDR reader/writer.</td>
</tr>
<tr>
<td><code>principalsp</code></td>
<td><code><a href="en/JSPrincipals">JSPrincipals</a> **</code></td>
<td>If <code>xdr</code> is a reader, this is an out parameter: on success, <code>*principalsp</code> receives the deserialized principals.  If <code>xdr</code> is a writer, <code>*principalsp</code> points to the <code>JSPrincipals</code> object to be serialized.</td>
</tr>
</tbody></table>
<h2 name="Description"> Description </h2>
<p><code>JS_SetPrincipalsTranscoder</code> sets a runtime-wide callback which the JavaScript engine uses to serialize and deserialize principals.
</p><p>Each script function is associated with principals, which poses a problem for <a href="en/XDR">XDR</a>.  The application provides the <code>JSPrincipals</code> objects, so it must also provide a <code>JSPrincipalsTranscoder</code> if it intends to serialize or deserialize principals.
</p><p><code>JS_SetPrincipalsTranscoder</code> returns the previous principals transcoder.
</p><p>{{template.LXRSearch("ident", "i", "JS_SetPrincipalsTranscoder")}}
</p>
Revert to this revision