Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
xpcwrappedjsclass.cpp File Reference
#include "xpcprivate.h"

Go to the source code of this file.

Classes

class  WrappedJSIdentity

Defines

#define NS_IXPCONNECT_WRAPPED_JS_IDENTITY_CLASS_IID
#define HANDLE_OUT_CONVERSION_FAILURE   {outConversionFailedIndex = i; break;}

Functions

JSBool xpc_IsReportableErrorCode (nsresult code)
static JSBool GetNamedPropertyAsVariantRaw (XPCCallContext &ccx, JSObject *aJSObj, jsid aName, nsIVariant **aResult, nsresult *pErr)
void JS_DLL_CALLBACK xpcWrappedJSErrorReporter (JSContext *cx, const char *message, JSErrorReport *report)

Variables

static uint32 zero_methods_descriptor

Define Documentation

#define HANDLE_OUT_CONVERSION_FAILURE   {outConversionFailedIndex = i; break;}
Value:
{ 0x5c5c3bb0, 0xa9ba, 0x11d2,                       \
  { 0xba, 0x64, 0x0, 0x80, 0x5f, 0x8a, 0x5d, 0xd7 } }

Definition at line 468 of file xpcwrappedjsclass.cpp.


Function Documentation

static JSBool GetNamedPropertyAsVariantRaw ( XPCCallContext ccx,
JSObject aJSObj,
jsid  aName,
nsIVariant **  aResult,
nsresult pErr 
) [static]

Definition at line 290 of file xpcwrappedjsclass.cpp.

{
    nsXPTType type = nsXPTType((uint8)(TD_INTERFACE_TYPE | XPT_TDP_POINTER));
    jsval val;

    return OBJ_GET_PROPERTY(ccx, aJSObj, aName, &val) &&
           XPCConvert::JSData2Native(ccx, aResult, val, type, JS_FALSE, 
                                     &NS_GET_IID(nsIVariant), pErr);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 113 of file xpcwrappedjsclass.cpp.

{
    if(NS_SUCCEEDED(code))
        return JS_FALSE;

    switch(code)
    {
        // Error codes that we don't want to report as errors...
        // These generally indicate bad interface design AFAIC. 
        case NS_ERROR_FACTORY_REGISTER_AGAIN:
        case NS_BASE_STREAM_WOULD_BLOCK:
            return JS_FALSE;
    }
    return JS_TRUE;
}

Here is the caller graph for this function:

void JS_DLL_CALLBACK xpcWrappedJSErrorReporter ( JSContext cx,
const char *  message,
JSErrorReport report 
)

Definition at line 679 of file xpcwrappedjsclass.cpp.

{
    if(report)
    {
        // If it is an exception report, then we can just deal with the
        // exception later (if not caught in the JS code).
        if(JSREPORT_IS_EXCEPTION(report->flags))
        {
            // XXX We have a problem with error reports from uncaught exceptions.
            //
            // http://bugzilla.mozilla.org/show_bug.cgi?id=66453
            //
            // The issue is...
            //
            // We can't assume that the exception will *stay* uncaught. So, if
            // we build an nsIXPCException here and the underlying exception
            // really is caught before our script is done running then we blow
            // it by returning failure to our caller when the script didn't
            // really fail. However, This report contains error location info
            // that is no longer available after the script is done. So, if the
            // exception really is not caught (and is a non-engine exception)
            // then we've lost the oportunity to capture the script location
            // info that we *could* have captured here.
            //
            // This is expecially an issue with nested evaluations.
            //
            // Perhaps we could capture an expception here and store it as
            // 'provisional' and then later if there is a pending exception
            // when the script is done then we could maybe compare that in some
            // way with the 'provisional' one in which we captured location info.
            // We would not want to assume that the one discovered here is the
            // same one that is later detected. This could cause us to lie.
            //
            // The thing is. we do not currently store the right stuff to compare
            // these two nsIXPCExceptions (triggered by the same exception jsval
            // in the engine). Maybe we should store the jsval and compare that?
            // Maybe without even rooting it since we will not dereference it.
            // This is inexact, but maybe the right thing to do?
            //
            // if(report->errorNumber == JSMSG_UNCAUGHT_EXCEPTION)) ...
            //

            return;
        }

        if(JSREPORT_IS_WARNING(report->flags))
        {
            // XXX printf the warning (#ifdef DEBUG only!).
            // XXX send the warning to the console service.
            return;
        }
    }

    XPCCallContext ccx(NATIVE_CALLER, cx);
    if(!ccx.IsValid())
        return;

    nsCOMPtr<nsIException> e;
    XPCConvert::JSErrorToXPCException(ccx, message, nsnull, nsnull, report,
                                      getter_AddRefs(e));
    if(e)
        ccx.GetXPCContext()->SetException(e);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 49 of file xpcwrappedjsclass.cpp.