コード例 #1
0
// static
void
XPCWrappedNativeScope::TraverseScopes(XPCCallContext& ccx)
{
    // Hold the lock throughout.
    XPCAutoLock lock(ccx.GetRuntime()->GetMapLock());

    for(XPCWrappedNativeScope* cur = gScopes; cur; cur = cur->mNext)
        if(cur->mGlobalJSObject && cur->mScriptObjectPrincipal)
        {
            ccx.GetXPConnect()->RecordTraversal(cur->mGlobalJSObject,
                                                cur->mScriptObjectPrincipal);
        }
}
コード例 #2
0
ファイル: XPCDispObject.cpp プロジェクト: dimitrianoudi/Jaxer
PRBool
XPCDispObject::WrapIDispatch(IDispatch *pDispatch, XPCCallContext &ccx,
                             JSObject *obj, jsval *rval)
{
    if(!pDispatch)
    {
        return PR_FALSE;
    }

    // Wrap the desired COM object
    nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
    nsresult rv = ccx.GetXPConnect()->WrapNative(
        ccx, obj, reinterpret_cast<nsISupports*>(pDispatch), NSID_IDISPATCH,
        getter_AddRefs(holder));
    if(NS_FAILED(rv) || !holder)
    {
        return PR_FALSE;
    }
    JSObject * jsobj;
    if(NS_FAILED(holder->GetJSObject(&jsobj)))
        return PR_FALSE;
    *rval = OBJECT_TO_JSVAL(jsobj);
    return PR_TRUE;
}