This article needs a technical review. How you can help.
This article covers features introduced in SpiderMonkey 17
Return the global object for the specified compartment.
JSObject * JS_GetGlobalForCompartmentOrNull(JSContext *cx, JSCompartment *c);
||The context for which to return the global object. Requires request. In a
||The compartment for which to return the global object.|
JS_GetGlobalForCompartmentOrNull() returns the global object for the context and the compartment. This may return
c never had a global (e.g., the atoms compartment), or if
c's global has been collected.