Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Attributes
nsCryptoRunnable Class Reference
Inheritance diagram for nsCryptoRunnable:
Inheritance graph
[legend]
Collaboration diagram for nsCryptoRunnable:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsCryptoRunnable (nsCryptoRunArgs *args)
virtual ~nsCryptoRunnable ()
NS_IMETHOD Run ()
 Defines an entry point for a newly created thread.
void run ()

Private Attributes

nsCryptoRunArgsm_args

Detailed Description

Definition at line 167 of file nsCrypto.cpp.


Constructor & Destructor Documentation

Definition at line 1760 of file nsCrypto.cpp.

{
  nsNSSShutDownPreventionLock locker;
  NS_ASSERTION(args,"Passed nsnull to nsCryptoRunnable constructor.");
  m_args = args;
  NS_IF_ADDREF(m_args);
  JS_AddNamedRoot(args->m_cx, &args->m_scope,"nsCryptoRunnable::mScope");
}

Here is the call graph for this function:

Definition at line 1769 of file nsCrypto.cpp.

Here is the call graph for this function:


Member Function Documentation

void nsIRunnable::run ( ) [inherited]

Defines an entry point for a newly created thread.

Implements nsIRunnable.

Definition at line 1779 of file nsCrypto.cpp.

{
  nsNSSShutDownPreventionLock locker;
  JSPrincipals *principals;
  JSContext *cx = m_args->m_cx;

  nsresult rv = m_args->m_principals->GetJSPrincipals(cx, &principals);
  if (NS_FAILED(rv))
    return NS_ERROR_FAILURE;

  // make sure the right context is on the stack. must not return w/out popping
  nsCOMPtr<nsIJSContextStack> stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1"));
  if (!stack || NS_FAILED(stack->Push(cx))) {
    return NS_ERROR_FAILURE;
  }

  jsval retval;
  if (JS_EvaluateScriptForPrincipals(cx, m_args->m_scope, principals,
                                     m_args->m_jsCallback, 
                                     strlen(m_args->m_jsCallback),
                                     nsnull, 0,
                                     &retval) != JS_TRUE) {
    rv = NS_ERROR_FAILURE;
  }

  stack->Pop(nsnull);
  return rv;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 175 of file nsCrypto.cpp.


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