AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
Entry:     JSPrincipals (Data Structure)
Summary:     Defines security information for an object or script.
Syntax:
typedef struct JSPrincipals {
char *codebase;
void *(*getPrincipalArray)(JSContext *cx,
struct JSPrincipals *);
JSBool (*globalPrivilegesEnabled)(JSContext *cx,
struct JSPrincipals *);
uintN refcount;
void (*destroy)(JSContext *cx, struct JSPrincipals *);
} JSPrincipals;

     Argument     Type     Description
     *codebase     char     Pointer to the codebase for the principal.
                 
     *getPrincipalArray     void     Pointer to the function that returns an array of principal definitions.
                 
     *globalPrivilegesEnabled     JSBool     Flag indicating whether principals are enabled globally.
                 
     refcount     uintN     Reference count for the principals. Each reference to a principal increments refcount by one. As principals references are dropped, call the destroy method to decrement the reference count and free the principals if they are no longer needed.
                 
     *destroy     void     Pointer to the function that decrements the reference count and possibly frees the principals if they are no longer in use.
                 
Description:
JSPrincipals is a structure that defines the connection to security data for an object or script. Security data is defined independently of the JS engine, but is passed to the engine through the JSPrincipals structure. This structure is passed as an argument to versions of API calls that compile and evaluate scripts and functions that depend on a security model. Some examples of security-enhanced API call are JS_CompileScriptForPrincipalsJS_CompileFunctionForPrincipals, and JS_EvaluateScriptForPrincipals.

codebase points to the common codebase for this object or script. Only objects and scripts that share a common codebase can interact.

getPrincipalArray is a pointer to the function that retrieves the principals for this object or script.

globalPrivilegesEnabled is a flag that indicates whether principals are enabled globally.

refcount is used to maintain active principals. Each time an object is referenced, refcount must be increased by one. Each time an object is dereferenced, refcount must be decremented by one. When refcount is zero, the principals are no longer in use and are destroyed. Use the JSPRINCIPALS_HOLD macro to increment refcount, and use JS_PRINCIPALS_DROP to decrement refcount.


See also:
JSPRINCIPALS_DROP
JSPRINCIPALS_HOLD
JS_CompileFunctionForPrincipals
JS_CompileScriptForPrincipals
JS_CompileUCFunctionForPrincipals
JS_CompileUCScriptForPrincipals
JS_EvaluateScriptForPrincipals

[sh-index] Back to list of manuals