JSPrincipalsTranscoder
is the type of a security callback that can be configured using JS_SetPrincipalsTranscoder
JSAPI 1.8 and earlier or JS_SetRuntimeSecurityCallbacks
Added in SpiderMonkey 1.8.1.
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. |
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.