JSPrincipalsTranscoder

JSPrincipalsTranscoder is the type of a security callback that can be configured using JS_SetPrincipalsTranscoderJSAPI 1.8 and earlier or JS_SetRuntimeSecurityCallbacksAdded in SpiderMonkey 1.8.1.

Callback syntax

typedef JSBool (*JSPrincipalsTranscoder)(JSXDRState *xdr,
                                         JSPrincipals **principalsp);
Name Type Description
xdr JSXDRState * The XDR reader/writer.
principalsp JSPrincipals ** If xdr->mode == JSXDR_DECODE, this is an out parameter: on success, *principalsp receives the deserialized principals. Otherwise xdr->mode == JSXDR_ENCODE, and *principalsp points to the JSPrincipals object to be serialized.

Description

The JavaScript engine uses this callback 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.

The callback XDR-encodes or -decodes a principals instance, based on whether xdr->mode is JSXDR_ENCODE, in which case *principalsp should be encoded; or JSXDR_DECODE, in which case implementations must return a held (via JSPRINCIPALS_HOLD), non-null *principalsp out parameter. Return JS_TRUE on success, JS_FALSE on any error, which the implementation must have reported.

MXR ID Search for JSPrincipalsTranscoder

Document Tags and Contributors

 Contributors to this page: fscholz, Jorend
 Last updated by: fscholz,