if(NS_FAILED(mContextStack->Peek(&current)) || current == cx || NS_FAILED(mContextStack->Push(cx)))
nsCOMPtr<nsIScriptSecurityManager> secMan( do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &mPushResult));  if (NS_FAILED(mPushResult)) return;  nsCOMPtr<nsIPrincipal> principal; if (aSecuritySupports) mPushResult = CreatePrincipal(aSecuritySupports, secMan, getter_AddRefs(principal)); else mPushResult = secMan->GetPrincipalFromContext(cx, getter_AddRefs(principal));  if (NS_FAILED(mPushResult)) { JS_ReportError(cx, "failed to get a principal"); return; }   PRBool jsEnabled = PR_FALSE; mPushResult = secMan->CanExecuteScripts(cx, principal, &jsEnabled); if (!jsEnabled) mPushResult = NS_ERROR_FAILURE;  memset(&mFrame, 0, sizeof(mFrame));  if (NS_SUCCEEDED(mPushResult)) {    PRBool hasScript = PR_FALSE; JSStackFrame* tempFP = cx->fp; while (tempFP)
AutoPushJSContext::AutoPushJSContext(JSContext *cx, nsXPConnect* xpc /*= nsnull*/){    NS_ASSERTION(cx, "pushing null cx");#ifdef DEBUG    mDebugCX = cx;#endif    mContextStack = nsXPConnect::GetContextStack(xpc);    if(mContextStack)    {        JSContext* current;        if(NS_FAILED(mContextStack->Peek(&current)) ||           current == cx ||           NS_FAILED(mContextStack->Push(cx)))        {            NS_RELEASE(mContextStack);        }    }}