Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Static Private Attributes
jsdContext Class Reference

#include <jsd_xpc.h>

Inheritance diagram for jsdContext:
Inheritance graph
[legend]
Collaboration diagram for jsdContext:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_JSDICONTEXT
NS_DECL_JSDIEPHEMERAL 
jsdContext (JSDContext *aJSDCx, JSContext *aJSCx, nsISupports *aISCx)
virtual ~jsdContext ()
void invalidate ()
 Mark this instance as invalid.

Static Public Member Functions

static void InvalidateAll ()
static jsdIContextFromPtr (JSDContext *aJSDCx, JSContext *aJSCx)

Public Attributes

readonly attribute JSContext JSContext
const long OPT_STRICT = 0x01
 OPT_* values must be kept in sync with JSOPTION_* #defines in jsapi.h.
const long OPT_WERR = 0x02
 Warnings reported as errors.
const long OPT_VAROBJFIX = 0x04
 Makes eval() use the last object on its 'obj' param's scope chain as the ECMA 'variables object'.
const long OPT_ISUPPORTS = 0x08
 Private data for this object is an nsISupports object.
attribute unsigned long options
 OPT_* values above, OR'd together.
attribute long version
 Last version set on this context.
readonly attribute unsigned long tag
 Unique tag among all valid jsdIContext objects, useful as a hash key.
readonly attribute nsISupports privateData
 Private data for this context, if it is an nsISupports, |null| otherwise.
readonly attribute nsISupports wrappedContext
 Retrieve the underlying context wrapped by this jsdIContext.
readonly attribute jsdIValue globalObject
 Top of the scope chain for this context.
attribute boolean scriptsEnabled
 |true| if this context should be allowed to run scripts, |false| otherwise.
readonly attribute boolean isValid
 |true| if this object is still valid.

Private Member Functions

 jsdContext ()
 jsdContext (const jsdContext &)

Private Attributes

PRBool mValid
LiveEphemeral mLiveListEntry
PRUint32 mTag
JSDContextmJSDCx
JSContextmJSCx
nsCOMPtr< nsISupports > mISCx

Static Private Attributes

static PRUint32 LastTag = 0

Detailed Description

Definition at line 190 of file jsd_xpc.h.


Constructor & Destructor Documentation

jsdContext::jsdContext ( JSDContext aJSDCx,
JSContext aJSCx,
nsISupports *  aISCx 
)

Definition at line 1489 of file jsd_xpc.cpp.

                                            : mValid(PR_TRUE), mTag(0),
                                              mJSDCx(aJSDCx),
                                              mJSCx(aJSCx), mISCx(aISCx)
{
    DEBUG_CREATE ("jsdContext", gContextCount);
    mLiveListEntry.value = this;
    mLiveListEntry.key   = NS_STATIC_CAST (void *, aJSCx);
    jsds_InsertEphemeral (&gLiveContexts, &mLiveListEntry);
}

Here is the call graph for this function:

jsdContext::~jsdContext ( ) [virtual]

Definition at line 1500 of file jsd_xpc.cpp.

{
    DEBUG_DESTROY ("jsdContext", gContextCount);
    if (mValid)
    {
        /* call Invalidate() to take ourselves out of the live list */
        Invalidate();
    }
}
jsdContext::jsdContext ( ) [private]

Member Function Documentation

jsdIContext * jsdContext::FromPtr ( JSDContext aJSDCx,
JSContext aJSCx 
) [static]

Definition at line 1459 of file jsd_xpc.cpp.

{
    if (!aJSDCx || !aJSCx ||
        !(JS_GetOptions(aJSCx) & JSOPTION_PRIVATE_IS_NSISUPPORTS))
    {
        return nsnull;
    }
    
    nsCOMPtr<jsdIContext> jsdicx;
    nsCOMPtr<jsdIEphemeral> eph = 
        jsds_FindEphemeral (&gLiveContexts, NS_STATIC_CAST(void *, aJSCx));
    if (eph)
    {
        jsdicx = do_QueryInterface(eph);
    }
    else
    {
        nsCOMPtr<nsISupports> iscx = 
            NS_STATIC_CAST(nsISupports *, JS_GetContextPrivate(aJSCx));
        if (!iscx)
            return nsnull;
        
        jsdicx = new jsdContext (aJSDCx, aJSCx, iscx);
    }

    jsdIContext *rv = jsdicx;
    NS_IF_ADDREF(rv);
    return rv;
}

Here is the call graph for this function:

Mark this instance as invalid.

Definition at line 1527 of file jsd_xpc.cpp.

Here is the call graph for this function:


Member Data Documentation

Top of the scope chain for this context.

Definition at line 762 of file jsdIDebuggerService.idl.

|true| if this object is still valid.

If not, many or all of the methods and/or properties of the inheritor may no longer be callable.

Definition at line 691 of file jsdIDebuggerService.idl.

Definition at line 708 of file jsdIDebuggerService.idl.

PRUint32 jsdContext::LastTag = 0 [static, private]

Definition at line 203 of file jsd_xpc.h.

nsCOMPtr<nsISupports> jsdContext::mISCx [private]

Definition at line 213 of file jsd_xpc.h.

Definition at line 212 of file jsd_xpc.h.

Definition at line 211 of file jsd_xpc.h.

Definition at line 209 of file jsd_xpc.h.

Definition at line 210 of file jsd_xpc.h.

Definition at line 208 of file jsd_xpc.h.

Private data for this object is an nsISupports object.

Attempting to alter this bit will result in an NS_ERROR_ILLEGAL_VALUE.

Definition at line 731 of file jsdIDebuggerService.idl.

const long jsdIContext::OPT_STRICT = 0x01 [inherited]

OPT_* values must be kept in sync with JSOPTION_* #defines in jsapi.h.

Strict mode is on.

Definition at line 717 of file jsdIDebuggerService.idl.

Makes eval() use the last object on its 'obj' param's scope chain as the ECMA 'variables object'.

Definition at line 726 of file jsdIDebuggerService.idl.

const long jsdIContext::OPT_WERR = 0x02 [inherited]

Warnings reported as errors.

Definition at line 721 of file jsdIDebuggerService.idl.

attribute unsigned long jsdIContext::options [inherited]

OPT_* values above, OR'd together.

Definition at line 735 of file jsdIDebuggerService.idl.

readonly attribute nsISupports jsdIContext::privateData [inherited]

Private data for this context, if it is an nsISupports, |null| otherwise.

Definition at line 752 of file jsdIDebuggerService.idl.

|true| if this context should be allowed to run scripts, |false| otherwise.

This attribute is only valid for contexts which implement nsIScriptContext. Setting or getting this attribute on any other context will throw a NS_ERROR_NO_INTERFACE exception.

Definition at line 770 of file jsdIDebuggerService.idl.

readonly attribute unsigned long jsdIContext::tag [inherited]

Unique tag among all valid jsdIContext objects, useful as a hash key.

Definition at line 747 of file jsdIDebuggerService.idl.

Last version set on this context.

Scripts typically select this with the "language" attribute. See the VERSION_* consts on jsdIDebuggerService.

Definition at line 742 of file jsdIDebuggerService.idl.

readonly attribute nsISupports jsdIContext::wrappedContext [inherited]

Retrieve the underlying context wrapped by this jsdIContext.

Definition at line 757 of file jsdIDebuggerService.idl.


The documentation for this class was generated from the following files: