Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Attributes
JSContextAutoPopper Class Reference
Collaboration diagram for JSContextAutoPopper:
Collaboration graph

List of all members.

Public Member Functions

 JSContextAutoPopper ()
 ~JSContextAutoPopper ()
nsresult Push (JSContext *cx=nsnull)
JSContextget ()

Protected Attributes

nsCOMPtr< nsIThreadJSContextStackmService

Detailed Description

Definition at line 353 of file nsWindowWatcher.cpp.

Constructor & Destructor Documentation

Definition at line 366 of file nsWindowWatcher.cpp.

                                         : mContext(nsnull)

Definition at line 370 of file nsWindowWatcher.cpp.

  JSContext *cx;
  nsresult   rv;

  if(mContext) {
    rv = mService->Pop(&cx);
    NS_ASSERTION(NS_SUCCEEDED(rv) && cx == mContext, "JSContext push/pop mismatch");

Member Function Documentation

Definition at line 359 of file nsWindowWatcher.cpp.

{ return mContext; }

Here is the caller graph for this function:

Definition at line 381 of file nsWindowWatcher.cpp.

  if (mContext) // only once
    return NS_ERROR_FAILURE;

  mService = do_GetService(sJSStackContractID);
  if(mService) {
    // Get the safe context if we're not provided one.
    if (!cx && NS_FAILED(mService->GetSafeJSContext(&cx))) {
      cx = nsnull;

    // Save cx in mContext to indicate need to pop.
    if (cx && NS_SUCCEEDED(mService->Push(cx))) {
      mContext = cx;
  return mContext ? NS_OK : NS_ERROR_FAILURE;

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Definition at line 363 of file nsWindowWatcher.cpp.

Definition at line 362 of file nsWindowWatcher.cpp.

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