Callback syntax

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.