JS_SetDestroyCompartmentCallback

This article covers features introduced in SpiderMonkey 17

Set the callback function for each compartment being destroyed.

Syntax

void
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.

Description

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

See also