typedef JSPrincipals * (*JSObjectPrincipalsFinder)(JSContext *cx, JSObject *obj);
| || ||The context in which to find principals.|
| || ||The object whose principals are needed.|
For example, when a watchpoint triggers, the engine calls the callback, passing the watchpoint handler, to ensure that watchpoint handlers are invoked only when the watcher is permitted to watch the currently executing script.
Another example: when the
The two debugger functions
JS_EvalFramePrincipals also use this callback. Since it is very common for
JSClass.checkAccess hooks to call these functions, the object principals finder callback is a key security feature.
The callback returns a pointer to the principals associated with
obj, possibly via the immutable parent chain leading from
obj to a top-level container (such as a
window object in the DOM). If there are no principals associated with
NULL does not mean an error was reported; in no event should an error be reported or an exception be thrown by this callback's implementation.
The callback should not call