Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.
Pointer to a JSContext which the callback may use to call into JSAPI functions. This is the context which was just created, or is about to be destroyed. For example, the callback my call JS_GetContextPrivate(cx) in order to free up resources previously allocated by JS_SetContextPrivate.
contextOp
unsigned
See JSContextOp. For future compatibility the callback must do nothing and return true if any other value is passed.
data
void *
data specified in JS_SetContextCallback. Added in SpiderMonkey 31
JS_NewContext successfully created a new JSContext instance. The callback can initialize the instance as required. If the callback returns JS_FALSE, the instance will be destroyed and JS_NewContext returns NULL. In this case the callback is not called again.
JSCONTEXT_DESTROY
One of JS_DestroyContext, JS_DestroyContextNoGC, or JS_DestroyContextMaybeGC was called. The callback may perform its own cleanup and must always return true. In a DEBUG build, if the callback returns false, the JS engine will halt with an assertion.
Description
JS_SetContextCallback specifies a callback function that is automatically called when JSContexts are created or destroyed. Only one callback function may be specified per JS runtime. This function returns the previous context callback, if any, else NULL.