Back to index

lightning-sunbird  0.9+nobinonly
Static Public Member Functions
nsWWJSUtils Class Reference

#include <nsWWJSUtils.h>

List of all members.

Static Public Member Functions

static nsIScriptGlobalObjectGetStaticScriptGlobal (JSContext *aContext, JSObject *aObj)
static nsIScriptContextGetStaticScriptContext (JSContext *aContext, JSObject *aObj)
static nsIScriptGlobalObjectGetDynamicScriptGlobal (JSContext *aContext)
static nsIScriptContextGetDynamicScriptContext (JSContext *aContext)

Detailed Description

Definition at line 51 of file nsWWJSUtils.h.


Member Function Documentation

Definition at line 86 of file nsWWJSUtils.cpp.

{
  return GetScriptContextFromJSContext(aContext);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 92 of file nsWWJSUtils.cpp.

{
  nsIScriptContext *scriptCX = GetDynamicScriptContext(aContext);
  if (!scriptCX)
    return nsnull;
  return scriptCX->GetGlobalObject();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 101 of file nsWWJSUtils.cpp.

{
  nsIScriptGlobalObject *nativeGlobal = GetStaticScriptGlobal(aContext, aObj);
  if (!nativeGlobal)    
    return nsnull;
  return nativeGlobal->GetContext();
}  

Here is the call graph for this function:

Definition at line 49 of file nsWWJSUtils.cpp.

{
  nsISupports* supports;
  JSClass* clazz;
  JSObject* parent;
  JSObject* glob = aObj; // starting point for search

  if (!glob)
    return nsnull;

  while (nsnull != (parent = JS_GetParent(aContext, glob)))
    glob = parent;

#ifdef JS_THREADSAFE
  clazz = JS_GetClass(aContext, glob);
#else
  clazz = JS_GetClass(glob);
#endif

  if (!clazz ||
      !(clazz->flags & JSCLASS_HAS_PRIVATE) ||
      !(clazz->flags & JSCLASS_PRIVATE_IS_NSISUPPORTS) ||
      !(supports = (nsISupports*) JS_GetPrivate(aContext, glob))) {
    return nsnull;
  }
 
  nsCOMPtr<nsIXPConnectWrappedNative> wrapper(do_QueryInterface(supports));
  NS_ENSURE_TRUE(wrapper, nsnull);

  nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryWrappedNative(wrapper));

  // This will return a pointer to something we're about to release,
  // but that's ok here.
  return sgo;
}

Here is the call graph for this function:

Here is the caller graph for this function:


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