Back to index

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

#include <xpcprivate.h>

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

List of all members.

Public Member Functions

 nsXPCException ()
virtual ~nsXPCException ()
void initialize (in string aMessage, in nsresult aResult, in string aName, in nsIStackFrame aLocation, in nsISupports aData, in nsIException aInner)
string toString ()
string canCreateWrapper (in nsIIDPtr iid)
string canCallMethod (in nsIIDPtr iid, in wstring methodName)
string canGetProperty (in nsIIDPtr iid, in wstring propertyName)
string canSetProperty (in nsIIDPtr iid, in wstring propertyName)

Static Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIEXCEPTION
NS_DECL_NSIXPCEXCEPTION static
NS_DECL_NSISECURITYCHECKEDCOMPONENT
nsresult 
NewException (const char *aMessage, nsresult aResult, nsIStackFrame *aLocation, nsISupports *aData, nsIException **exception)
static JSBool NameAndFormatForNSResult (nsresult rv, const char **name, const char **format)
static voidIterateNSResults (nsresult *rv, const char **name, const char **format, void **iterp)
static PRUint32 GetNSResultCount ()
static void InitStatics ()

Public Attributes

readonly attribute string message
readonly attribute nsresult result
readonly attribute string name
readonly attribute string filename
readonly attribute PRUint32 lineNumber
readonly attribute PRUint32 columnNumber
readonly attribute nsIStackFrame location
readonly attribute nsIException inner
readonly attribute nsISupports data

Protected Member Functions

void Reset ()

Private Attributes

char * mMessage
nsresult mResult
char * mName
nsIStackFramemLocation
nsISupports * mData
char * mFilename
int mLineNumber
nsIExceptionmInner
PRBool mInitialized

Static Private Attributes

static JSBool sEverMadeOneFromFactory = JS_FALSE

Detailed Description

Definition at line 2569 of file xpcprivate.h.


Constructor & Destructor Documentation

Definition at line 136 of file xpcexception.cpp.

Here is the caller graph for this function:

Definition at line 150 of file xpcexception.cpp.

Here is the call graph for this function:


Member Function Documentation

string nsISecurityCheckedComponent::canCallMethod ( in nsIIDPtr  iid,
in wstring  methodName 
) [inherited]
string nsISecurityCheckedComponent::canGetProperty ( in nsIIDPtr  iid,
in wstring  propertyName 
) [inherited]
string nsISecurityCheckedComponent::canSetProperty ( in nsIIDPtr  iid,
in wstring  propertyName 
) [inherited]

Definition at line 114 of file xpcexception.cpp.

{
    return RESULT_COUNT;
}
void nsIXPCException::initialize ( in string  aMessage,
in nsresult  aResult,
in string  aName,
in nsIStackFrame  aLocation,
in nsISupports  aData,
in nsIException  aInner 
) [inherited]
static void nsXPCException::InitStatics ( ) [inline, static]

Definition at line 2605 of file xpcprivate.h.

Here is the caller graph for this function:

void * nsXPCException::IterateNSResults ( nsresult rv,
const char **  name,
const char **  format,
void **  iterp 
) [static]

Definition at line 87 of file xpcexception.cpp.

{
    ResultMap* p = (ResultMap*) *iterp;
    if(!p)
        p = map;
    else
        p++;
    if(!p->name)
        p = nsnull;
    else
    {
        if(rv)
            *rv = p->rv;
        if(name)
            *name = p->name;
        if(format)
            *format = p->format;
    }
    *iterp = p;
    return p;
}
JSBool nsXPCException::NameAndFormatForNSResult ( nsresult  rv,
const char **  name,
const char **  format 
) [static]

Definition at line 68 of file xpcexception.cpp.

{

    for(ResultMap* p = map; p->name; p++)
    {
        if(rv == p->rv)
        {
            if(name) *name = p->name;
            if(format) *format = p->format;
            return JS_TRUE;
        }
    }
    return JS_FALSE;
}

Here is the caller graph for this function:

nsresult nsXPCException::NewException ( const char *  aMessage,
nsresult  aResult,
nsIStackFrame aLocation,
nsISupports *  aData,
nsIException **  exception 
) [static]

Definition at line 402 of file xpcexception.cpp.

{
    // A little hack... The nsIGenericModule nsIClassInfo scheme relies on there
    // having been at least one instance made via the factory. Otherwise, the
    // shared factory/classinsance object never gets created and our QI getter
    // for our instance's pointer to our nsIClassInfo will always return null.
    // This is bad because it means that wrapped exceptions will never have a
    // shared prototype. So... We force one to be created via the factory
    // *once* and then go about our business.
    if(!sEverMadeOneFromFactory)
    {
        nsCOMPtr<nsIXPCException> e =
            do_CreateInstance(XPC_EXCEPTION_CONTRACTID);
        sEverMadeOneFromFactory = JS_TRUE;
    }

    nsresult rv;
    nsXPCException* e = new nsXPCException();
    if(e)
    {
        NS_ADDREF(e);

        nsIStackFrame* location;
        if(aLocation)
        {
            location = aLocation;
            NS_ADDREF(location);
        }
        else
        {
            nsXPConnect* xpc = nsXPConnect::GetXPConnect();
            if(!xpc)
            {
                NS_RELEASE(e);
                return NS_ERROR_FAILURE;
            }
            rv = xpc->GetCurrentJSStack(&location);
            if(NS_FAILED(rv))
            {
                NS_RELEASE(e);
                return NS_ERROR_FAILURE;
            }
            // it is legal for there to be no active JS stack, if C++ code
            // is operating on a JS-implemented interface pointer without
            // having been called in turn by JS.  This happens in the JS
            // component loader, and will become more common as additional
            // components are implemented in JS.
        }
        // We want to trim off any leading native 'dataless' frames
        if(location)
            while(1)
            {
                PRUint32 language;
                PRInt32 lineNumber;
                if(NS_FAILED(location->GetLanguage(&language)) ||
                   language == nsIProgrammingLanguage::JAVASCRIPT ||
                   NS_FAILED(location->GetLineNumber(&lineNumber)) ||
                   lineNumber)
                {
                    break;
                }
                nsCOMPtr<nsIStackFrame> caller;
                if(NS_FAILED(location->GetCaller(getter_AddRefs(caller))) || !caller)
                    break;
                NS_RELEASE(location);
                caller->QueryInterface(NS_GET_IID(nsIStackFrame), (void **)&location);
            }
        // at this point we have non-null location with one extra addref,
        // or no location at all
        rv = e->Initialize(aMessage, aResult, nsnull, location, aData, nsnull);
        NS_IF_RELEASE(location);
        if(NS_FAILED(rv))
            NS_RELEASE(e);
    }

    if(!e)
        return NS_ERROR_FAILURE;

    *exceptn = NS_STATIC_CAST(nsIXPCException*, e);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsXPCException::Reset ( void  ) [protected]

Definition at line 157 of file xpcexception.cpp.

{
    if(mMessage)
    {
        nsMemory::Free(mMessage);
        mMessage = nsnull;
    }
    if(mName)
    {
        nsMemory::Free(mName);
        mName = nsnull;
    }
    if(mFilename)
    {
        nsMemory::Free(mFilename);
        mFilename = nsnull;
    }
    mLineNumber = (PRUint32)-1;
    NS_IF_RELEASE(mLocation);
    NS_IF_RELEASE(mData);
    NS_IF_RELEASE(mInner);
}

Here is the caller graph for this function:

string nsIException::toString ( ) [inherited]

Member Data Documentation

Definition at line 89 of file nsIException.idl.

readonly attribute nsISupports nsIException::data [inherited]

Definition at line 97 of file nsIException.idl.

readonly attribute string nsIException::filename [inherited]

Definition at line 84 of file nsIException.idl.

Definition at line 94 of file nsIException.idl.

Definition at line 86 of file nsIException.idl.

Definition at line 92 of file nsIException.idl.

nsISupports* nsXPCException::mData [private]

Definition at line 2614 of file xpcprivate.h.

readonly attribute string nsIException::message [inherited]

Definition at line 70 of file nsIException.idl.

char* nsXPCException::mFilename [private]

Definition at line 2615 of file xpcprivate.h.

Definition at line 2618 of file xpcprivate.h.

Definition at line 2617 of file xpcprivate.h.

Definition at line 2616 of file xpcprivate.h.

Definition at line 2613 of file xpcprivate.h.

char* nsXPCException::mMessage [private]

Definition at line 2610 of file xpcprivate.h.

char* nsXPCException::mName [private]

Definition at line 2612 of file xpcprivate.h.

Definition at line 2611 of file xpcprivate.h.

readonly attribute string nsIException::name [inherited]

Definition at line 74 of file nsIException.idl.

readonly attribute nsresult nsIException::result [inherited]

Definition at line 72 of file nsIException.idl.

Definition at line 2620 of file xpcprivate.h.


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