MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla
Your Search Results

    JS_GetGlobalForScopeChain

    Obsolete since JSAPI 25
    This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

    This article covers features introduced in SpiderMonkey 1.8.5

    Returns the global object for the active function on the context. Renamed to JS::CurrentGlobalOrNull.

    Syntax

    JSObject *
    JS_GetGlobalForScopeChain(JSContext *cx);
    
    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.

    Description

    JS_GetGlobalForScopeChain() returns the global object for whatever function is currently running on the context. In other words, it returns the global object on the current scope chain.

    If there is no JavaScript running on the context, this returns the context's global, i.e., JS_GetGlobalObject(cx). Note that JS_GetGlobalObject() and context globals are becoming obsolete.

    See also

    Document Tags and Contributors

    Contributors to this page: Sheppy, Dmandelin, markg, arai
    Last updated by: arai,
    Hide Sidebar