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.

JS_GetGlobalForCompartmentOrNull

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.

Syntax

JSObject *
JS_GetGlobalForCompartmentOrNull(JSContext *cx, JSCompartment *c);
Name Type Description
cx JSContext * The context for which to return the global object. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext.
c JSCompartment * The compartment for which to return the global object.

Description

JS_GetGlobalForCompartmentOrNull() returns the global object for the context and the compartment. This may return NULL if c never had a global (e.g., the atoms compartment), or if c's global has been collected.

See also

Document Tags and Contributors

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