Please note, this is a STATIC archive of website from 03 Nov 2016, does not collect or store any user information, there is no "phishing" involved.


This article needs a technical review. How you can help.

This article covers features introduced in SpiderMonkey 17

Set the callback function for each compartment being destroyed.


JS_SetDestroyCompartmentCallback(JSRuntime *rt, JSDestroyCompartmentCallback callback);
Name Type Description
cx JSRuntime * The runtime to set the callback function.
callback JSDestroyCompartmentCallback Callback function which will be called for each compartment being destroyed (see below).

Callback function

typedef void
(* JSDestroyCompartmentCallback)(JSFreeOp *fop, JSCompartment *compartment);
Name Type Description
cx JSRuntime * The runtime of the compartments.
compartmentCallback JSCompartment * The pointer to the compartment which is to be destroyed.


JS_SetDestroyCompartmentCallback sets callback function which will be called when sweeping each compartment of the runtime, before deleting the compartment.

See also

Document Tags and Contributors

 Contributors to this page: kscarfone, arai
 Last updated by: kscarfone,