Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
nsXBLDocumentInfo.cpp File Reference
#include "nsXBLDocumentInfo.h"
#include "nsHashtable.h"
#include "nsIDocument.h"
#include "nsXBLPrototypeBinding.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h"
#include "nsIDOMScriptObjectFactory.h"
#include "jsapi.h"
#include "nsIURI.h"
#include "nsIConsoleService.h"
#include "nsIScriptError.h"
#include "nsIChromeRegistry.h"
#include "nsIPrincipal.h"
#include "nsIScriptSecurityManager.h"
#include "nsContentUtils.h"

Go to the source code of this file.

Classes

class  nsXBLDocGlobalObject

Functions

static NS_DEFINE_CID (kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID)
 nsXBLDocGlobalObject_getProperty (JSContext *cx, JSObject *obj, jsval id, jsval *vp)
 nsXBLDocGlobalObject_setProperty (JSContext *cx, JSObject *obj, jsval id, jsval *vp)
 nsXBLDocGlobalObject_checkAccess (JSContext *cx, JSObject *obj, jsval id, JSAccessMode mode, jsval *vp)
 nsXBLDocGlobalObject_finalize (JSContext *cx, JSObject *obj)
 nsXBLDocGlobalObject_resolve (JSContext *cx, JSObject *obj, jsval id)
void JS_DLL_CALLBACK XBL_ProtoErrorReporter (JSContext *cx, const char *message, JSErrorReport *report)
static PRBool IsChromeURI (nsIURI *aURI)
static PRBool PR_CALLBACK DeletePrototypeBinding (nsHashKey *aKey, void *aData, void *aClosure)
PRBool PR_CALLBACK FlushScopedSkinSheets (nsHashKey *aKey, void *aData, void *aClosure)
nsresult NS_NewXBLDocumentInfo (nsIDocument *aDocument, nsIXBLDocumentInfo **aResult)

Function Documentation

static PRBool PR_CALLBACK DeletePrototypeBinding ( nsHashKey *  aKey,
void aData,
void aClosure 
) [static]

Definition at line 460 of file nsXBLDocumentInfo.cpp.

Here is the caller graph for this function:

PRBool PR_CALLBACK FlushScopedSkinSheets ( nsHashKey *  aKey,
void aData,
void aClosure 
)

Definition at line 480 of file nsXBLDocumentInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool IsChromeURI ( nsIURI aURI) [static]

Definition at line 405 of file nsXBLDocumentInfo.cpp.

{
  PRBool isChrome = PR_FALSE;
  if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &isChrome)))
      return isChrome;
  return PR_FALSE;
}

Here is the caller graph for this function:

static NS_DEFINE_CID ( kDOMScriptObjectFactoryCID  ,
NS_DOM_SCRIPT_OBJECT_FACTORY_CID   
) [static]
nsresult NS_NewXBLDocumentInfo ( nsIDocument aDocument,
nsIXBLDocumentInfo **  aResult 
)

Definition at line 517 of file nsXBLDocumentInfo.cpp.

{
  NS_PRECONDITION(aDocument, "Must have a document!");

  *aResult = new nsXBLDocumentInfo(aDocument);
  if (!*aResult) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  NS_ADDREF(*aResult);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsXBLDocGlobalObject_checkAccess ( JSContext cx,
JSObject obj,
jsval  id,
JSAccessMode  mode,
jsval vp 
)

Definition at line 148 of file nsXBLDocumentInfo.cpp.

{
  PRUint32 translated;
  if (mode & JSACC_WRITE) {
    translated = nsIXPCSecurityManager::ACCESS_SET_PROPERTY;
  } else {
    translated = nsIXPCSecurityManager::ACCESS_GET_PROPERTY;
  }

  return nsXBLDocGlobalObject::
    doCheckAccess(cx, obj, id, translated);
}

Here is the call graph for this function:

Definition at line 163 of file nsXBLDocumentInfo.cpp.

{
  nsISupports *nativeThis = (nsISupports*)JS_GetPrivate(cx, obj);

  nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(nativeThis));

  if (sgo)
      sgo->OnFinalize(obj);

  // The addref was part of JSObject construction
  NS_RELEASE(nativeThis);
}

Here is the call graph for this function:

nsXBLDocGlobalObject_getProperty ( JSContext cx,
JSObject obj,
jsval  id,
jsval vp 
)

Definition at line 132 of file nsXBLDocumentInfo.cpp.

Here is the call graph for this function:

Definition at line 177 of file nsXBLDocumentInfo.cpp.

{
  JSBool did_resolve = JS_FALSE;
  return JS_ResolveStandardClass(cx, obj, id, &did_resolve);
}

Here is the call graph for this function:

nsXBLDocGlobalObject_setProperty ( JSContext cx,
JSObject obj,
jsval  id,
jsval vp 
)

Definition at line 140 of file nsXBLDocumentInfo.cpp.

Here is the call graph for this function:

void JS_DLL_CALLBACK XBL_ProtoErrorReporter ( JSContext cx,
const char *  message,
JSErrorReport report 
)

Definition at line 213 of file nsXBLDocumentInfo.cpp.

{
  // Make an nsIScriptError and populate it with information from
  // this error.
  nsCOMPtr<nsIScriptError>
    errorObject(do_CreateInstance("@mozilla.org/scripterror;1"));
  nsCOMPtr<nsIConsoleService>
    consoleService(do_GetService("@mozilla.org/consoleservice;1"));

  if (errorObject && consoleService) {
    PRUint32 column = report->uctokenptr - report->uclinebuf;

    errorObject->Init
         (NS_REINTERPRET_CAST(const PRUnichar*, report->ucmessage),
          NS_ConvertUTF8toUCS2(report->filename).get(),
          NS_REINTERPRET_CAST(const PRUnichar*, report->uclinebuf),
          report->lineno, column, report->flags,
          "xbl javascript"
          );
    consoleService->LogMessage(errorObject);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function: