Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsDOMClassInfo.cpp File Reference
#include "nscore.h"
#include "nsDOMClassInfo.h"
#include "nsCRT.h"
#include "nsIServiceManager.h"
#include "nsICategoryManager.h"
#include "nsIComponentRegistrar.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIXPConnect.h"
#include "nsIJSContextStack.h"
#include "nsIXPCSecurityManager.h"
#include "nsIStringBundle.h"
#include "nsIConsoleService.h"
#include "nsIScriptError.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsUnicharUtils.h"
#include "xptcall.h"
#include "prprf.h"
#include "nsTArray.h"
#include "jsapi.h"
#include "jsnum.h"
#include "jsdbgapi.h"
#include "jscntxt.h"
#include "nsGlobalWindow.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOM3Document.h"
#include "nsIDOMXMLDocument.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMEvent.h"
#include "nsIDOMNSEvent.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMEventListener.h"
#include "nsINodeInfo.h"
#include "nsContentUtils.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
#include "nsIScriptExternalNameSet.h"
#include "nsJSUtils.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsScriptNameSpaceManager.h"
#include "nsIScriptObjectOwner.h"
#include "nsIJSNativeInitializer.h"
#include "nsIDOMPluginArray.h"
#include "nsIDOMPlugin.h"
#include "nsIDOMMimeTypeArray.h"
#include "nsIDOMMimeType.h"
#include "nsIDOMNSLocation.h"
#include "nsIDOMLocation.h"
#include "nsIDOMWindowInternal.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMJSWindow.h"
#include "nsIDOMWindowCollection.h"
#include "nsIDOMHistory.h"
#include "nsIDOMNSHistory.h"
#include "nsIDOMMediaList.h"
#include "nsIDOMChromeWindow.h"
#include "nsIDOMConstructor.h"
#include "nsDOMError.h"
#include "nsIDOMDOMException.h"
#include "nsIDOMNode.h"
#include "nsIDOM3Node.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMNamedNodeMap.h"
#include "nsIDOMDOMStringList.h"
#include "nsIDOMNameList.h"
#include "nsIForm.h"
#include "nsIFormControl.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMNSHTMLFormControlList.h"
#include "nsIDOMHTMLCollection.h"
#include "nsIHTMLDocument.h"
#include "nsIDOMHTMLSelectElement.h"
#include "nsIDOMNSXBLFormControl.h"
#include "nsIPluginInstance.h"
#include "nsIPluginInstanceInternal.h"
#include "nsIObjectFrame.h"
#include "nsIScriptablePlugin.h"
#include "nsIPluginHost.h"
#include "nsPIPluginHost.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMNSHTMLOptionElement.h"
#include "nsIDOMHTMLOptionsCollection.h"
#include "nsIDOMNSHTMLOptionCollectn.h"
#include "nsContentList.h"
#include "nsIEventListenerManager.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMNSEventTarget.h"
#include "nsIDOMStyleSheet.h"
#include "nsIDOMStyleSheetList.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDOMCSSRule.h"
#include "nsIDOMCSSRuleList.h"
#include "nsIDOMRect.h"
#include "nsIDOMRGBColor.h"
#include "nsIXBLService.h"
#include "nsXBLBinding.h"
#include "nsIBindingManager.h"
#include "nsIFrame.h"
#include "nsIPresShell.h"
#include "nsIDOMViewCSS.h"
#include "nsIDOMElement.h"
#include "nsIScriptGlobalObject.h"
#include "nsStyleSet.h"
#include "nsStyleContext.h"
#include "nsAutoPtr.h"
#include "nsIDOMLSProgressEvent.h"
#include "nsIDOMParser.h"
#include "nsIDOMSerializer.h"
#include "nsIXMLHttpRequest.h"
#include "nsIDOMNavigator.h"
#include "nsIDOMBarProp.h"
#include "nsIDOMScreen.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIDOMDocumentFragment.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMAttr.h"
#include "nsIDOMText.h"
#include "nsIDOMComment.h"
#include "nsIDOMCDATASection.h"
#include "nsIDOMProcessingInstruction.h"
#include "nsIDOMEntity.h"
#include "nsIDOMEntityReference.h"
#include "nsIDOMNotation.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMPopupBlockedEvent.h"
#include "nsIDOMBeforeUnloadEvent.h"
#include "nsIDOMMutationEvent.h"
#include "nsIDOMSmartCardEvent.h"
#include "nsIDOMXULCommandEvent.h"
#include "nsIDOMPageTransitionEvent.h"
#include "nsIDOMNSDocumentStyle.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDOMDocumentTraversal.h"
#include "nsIDOMDocumentXBL.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMElementCSSInlineStyle.h"
#include "nsIDOMLinkStyle.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMNSHTMLDocument.h"
#include "nsIDOMNSHTMLElement.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMNSHTMLAnchorElement.h"
#include "nsIDOMHTMLAppletElement.h"
#include "nsIDOMHTMLAreaElement.h"
#include "nsIDOMNSHTMLAreaElement.h"
#include "nsIDOMHTMLBRElement.h"
#include "nsIDOMHTMLBaseElement.h"
#include "nsIDOMHTMLBaseFontElement.h"
#include "nsIDOMHTMLBodyElement.h"
#include "nsIDOMHTMLButtonElement.h"
#include "nsIDOMNSHTMLButtonElement.h"
#include "nsIDOMHTMLCanvasElement.h"
#include "nsIDOMHTMLDListElement.h"
#include "nsIDOMHTMLDirectoryElement.h"
#include "nsIDOMHTMLDivElement.h"
#include "nsIDOMHTMLEmbedElement.h"
#include "nsIDOMHTMLFieldSetElement.h"
#include "nsIDOMHTMLFontElement.h"
#include "nsIDOMNSHTMLFormElement.h"
#include "nsIDOMHTMLFrameElement.h"
#include "nsIDOMHTMLFrameSetElement.h"
#include "nsIDOMNSHTMLFrameElement.h"
#include "nsIDOMHTMLHRElement.h"
#include "nsIDOMNSHTMLHRElement.h"
#include "nsIDOMHTMLHeadElement.h"
#include "nsIDOMHTMLHeadingElement.h"
#include "nsIDOMHTMLHtmlElement.h"
#include "nsIDOMHTMLIFrameElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIDOMNSHTMLImageElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMNSHTMLInputElement.h"
#include "nsIDOMHTMLIsIndexElement.h"
#include "nsIDOMHTMLLIElement.h"
#include "nsIDOMHTMLLabelElement.h"
#include "nsIDOMHTMLLegendElement.h"
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLMapElement.h"
#include "nsIDOMHTMLMenuElement.h"
#include "nsIDOMHTMLMetaElement.h"
#include "nsIDOMHTMLModElement.h"
#include "nsIDOMHTMLOListElement.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLOptGroupElement.h"
#include "nsIDOMHTMLParagraphElement.h"
#include "nsIDOMHTMLParamElement.h"
#include "nsIDOMHTMLPreElement.h"
#include "nsIDOMHTMLQuoteElement.h"
#include "nsIDOMHTMLScriptElement.h"
#include "nsIDOMNSHTMLSelectElement.h"
#include "nsIDOMHTMLStyleElement.h"
#include "nsIDOMHTMLTableCaptionElem.h"
#include "nsIDOMHTMLTableCellElement.h"
#include "nsIDOMHTMLTableColElement.h"
#include "nsIDOMHTMLTableElement.h"
#include "nsIDOMHTMLTableRowElement.h"
#include "nsIDOMHTMLTableSectionElem.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMNSHTMLTextAreaElement.h"
#include "nsIDOMHTMLTitleElement.h"
#include "nsIDOMHTMLUListElement.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIDOMCSS2Properties.h"
#include "nsIDOMCSSCharsetRule.h"
#include "nsIDOMCSSImportRule.h"
#include "nsIDOMCSSMediaRule.h"
#include "nsIDOMCSSMozDocumentRule.h"
#include "nsIDOMCSSPrimitiveValue.h"
#include "nsIDOMCSSStyleRule.h"
#include "nsIDOMCSSStyleSheet.h"
#include "nsIDOMCSSValueList.h"
#include "nsIDOMRange.h"
#include "nsIDOMNSRange.h"
#include "nsIDOMRangeException.h"
#include "nsIDOMTreeWalker.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIDOMCrypto.h"
#include "nsIDOMCRMFObject.h"
#include "nsIDOMPkcs11.h"
#include "nsIControllers.h"
#include "nsISelection.h"
#include "nsIBoxObject.h"
#include "nsIDOMXPathEvaluator.h"
#include "nsIImageDocument.h"
#include "nsIDOMStorage.h"
#include "nsPIDOMStorage.h"
#include "nsIDOMStorageList.h"
#include "nsIDOMStorageItem.h"
#include "nsIDOMStorageEvent.h"
#include "nsIDOMToString.h"

Go to the source code of this file.

Classes

struct  nsContractIDMapData
class  nsDOMConstructor
struct  RootWhenExternallyReferencedEntry
struct  PreservedWrapperEntry
struct  WrapperSCCEntry
struct  MarkAllWrappersData
struct  ExternallyReferencedEntry

Defines

#define GCPARTICIPANT_SCRIPTABLE_FLAGS
#define WINDOW_SCRIPTABLE_FLAGS
#define NODE_SCRIPTABLE_FLAGS
#define ELEMENT_SCRIPTABLE_FLAGS   (NODE_SCRIPTABLE_FLAGS & ~nsIXPCScriptable::CLASSINFO_INTERFACES_ONLY)
#define FRAME_ELEMENT_SCRIPTABLE_FLAGS
#define EXTERNAL_OBJ_SCRIPTABLE_FLAGS
#define DOCUMENT_SCRIPTABLE_FLAGS
#define ARRAY_SCRIPTABLE_FLAGS
#define DOMCLASSINFO_STANDARD_FLAGS   (nsIClassInfo::MAIN_THREAD_ONLY | nsIClassInfo::DOM_OBJECT)
#define NS_DEFINE_CLASSINFO_DATA_DEBUG(_class)
#define NS_DEFINE_CLASSINFO_DATA_WITH_NAME(_class, _name, _helper,_flags)
#define NS_DEFINE_CLASSINFO_DATA(_class, _helper, _flags)   NS_DEFINE_CLASSINFO_DATA_WITH_NAME(_class, _class, _helper, _flags)
#define NS_DEFINE_CONSTRUCTOR_DATA(_class, _contract_id)   { eDOMClassInfo_##_class##_id, _contract_id },
#define SET_JSVAL_TO_STRING(_val, _cx, _str)
#define _DOM_CLASSINFO_MAP_BEGIN(_class, _ifptr, _has_class_if)
#define DOM_CLASSINFO_MAP_BEGIN(_class, _interface)   _DOM_CLASSINFO_MAP_BEGIN(_class, &NS_GET_IID(_interface), PR_TRUE)
#define DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(_class, _interface)   _DOM_CLASSINFO_MAP_BEGIN(_class, &NS_GET_IID(_interface), PR_FALSE)
#define DOM_CLASSINFO_MAP_ENTRY(_if)   &NS_GET_IID(_if),
#define DOM_CLASSINFO_MAP_END
#define DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES
#define DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
#define DOM_CLASSINFO_EVENT_MAP_ENTRIES
#define DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
#define DOM_CLASSINFO_MAP_END_WITH_XPATH
#define WRAPPER_SCC_OPS_OOM_MARKER   ((PLDHashTableOps*)1)

Functions

static NS_DEFINE_CID (kCPluginManagerCID, NS_PLUGINMANAGER_CID)
static NS_DEFINE_CID (kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID)
const JSClassNS_DOMClassInfo_GetXPCNativeWrapperClass ()
void NS_DOMClassInfo_SetXPCNativeWrapperClass (JSClass *aClass)
static void PrintWarningOnConsole (JSContext *cx, const char *stringBundleProperty)
static JSObjectGetGlobalJSObject (JSContext *cx, JSObject *obj)
static jsval GetInternedJSVal (JSContext *cx, const char *str)
static const char * CutPrefix (const char *aName)
void InvalidateContextAndWrapperCache ()
static PRBool needsSecurityCheck (JSContext *cx, nsIXPConnectWrappedNative *wrapper)
static already_AddRefed
< nsIDOMWindow
GetChildFrame (nsGlobalWindow *win, jsval id)
static const char * FindConstructorContractID (PRInt32 aDOMClassInfoID)
static nsresult BaseStubConstructor (nsIWeakReference *aWeakOwner, const nsGlobalNameStruct *name_struct, JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
static nsresult DefineInterfaceConstants (JSContext *cx, JSObject *obj, const nsIID *aIID)
 PreservedWrapperClearEntry (PLDHashTable *table, PLDHashEntryHdr *hdr)
 WrapperSCCsClearEntry (PLDHashTable *table, PLDHashEntryHdr *hdr)
 WrapperSCCsInitEntry (PLDHashTable *table, PLDHashEntryHdr *hdr, const void *key)
static nsIXPConnectJSObjectHolderIdentityKeyToWrapperFunc (void *aKey)
 MarkAllWrappers (PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *arg)
 ClassifyWrapper (PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *arg)
 MarkExternallyReferenced (PLDHashTable *table, PLDHashEntryHdr *hdr, PRUint32 number, void *arg)
nsresult NS_DOMClassInfo_PreserveNodeWrapper (nsIXPConnectWrappedNative *aWrapper)
static JSBool JS_DLL_CALLBACK ContentWindowGetter (JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
static PRBool documentNeedsSecurityCheck (JSContext *cx, nsIXPConnectWrappedNative *wrapper)
static JSObjectGetDocumentAllHelper (JSContext *cx, JSObject *obj)
static PRBool IsObjInProtoChain (JSContext *cx, JSObject *obj, JSObject *proto)

Variables

static const char kDOMStringBundleURL [] = "chrome://global/locale/dom/dom.properties"
static nsDOMClassInfoData sClassInfoData []
static const nsContractIDMapData kConstructorMap []
static PLDHashTable sPreservedWrapperTable
 Every XPConnect wrapper that needs to be preserved (a wrapped native with JS properties set on it or used by XBL or a wrapped JS event handler function) as long as the element it wraps is reachable from script (via JS or via DOM APIs accessible from JS) gets an entry in this table.
static PLDHashTable sExternallyReferencedTable
static PLDHashTable sRootWhenExternallyReferencedTable
static const
nsIXPConnectWrappedNative
cached_win_wrapper
static const JSContextcached_win_cx
static PRBool cached_win_needs_check = PR_TRUE
static const
nsIXPConnectWrappedNative
cached_doc_wrapper
static const JSContextcached_doc_cx
static PRBool cached_doc_needs_check = PR_TRUE
static JSClass sGlobalScopePolluterClass
static const PLDHashTableOps sPreservedWrapperTableOps
static PLDHashTable sWrapperSCCTable
 At the beginning of the mark phase of the GC, we sort all the wrappers into their strongly connected components.
static const PLDHashTableOps sWrapperSCCTableOps
static JSClass sHTMLDocumentAllClass
static JSClass sHTMLDocumentAllHelperClass
static JSClass sHTMLDocumentAllTagsClass

Class Documentation

struct nsContractIDMapData

Definition at line 1111 of file nsDOMClassInfo.cpp.

Class Members
const char * mContractID
PRInt32 mDOMClassInfoID
struct MarkAllWrappersData

Definition at line 5149 of file nsDOMClassInfo.cpp.

Collaboration diagram for MarkAllWrappersData:
Class Members
void * arg
JSContext * cx

Define Documentation

#define _DOM_CLASSINFO_MAP_BEGIN (   _class,
  _ifptr,
  _has_class_if 
)
Value:
{                                                                           \
    nsDOMClassInfoData &d = sClassInfoData[eDOMClassInfo_##_class##_id];      \
    d.mProtoChainInterface = _ifptr;                                          \
    d.mHasClassInterface = _has_class_if;                                     \
    static const nsIID *interface_list[] = {

Definition at line 1640 of file nsDOMClassInfo.cpp.

Value:
(DOM_DEFAULT_SCRIPTABLE_FLAGS       |                                       \
   nsIXPCScriptable::WANT_GETPROPERTY |                                       \
   nsIXPCScriptable::WANT_ENUMERATE)

Definition at line 468 of file nsDOMClassInfo.cpp.

Value:
(NODE_SCRIPTABLE_FLAGS |                                                    \
   nsIXPCScriptable::WANT_ADDPROPERTY |                                       \
   nsIXPCScriptable::WANT_DELPROPERTY |                                       \
   nsIXPCScriptable::WANT_GETPROPERTY |                                       \
   nsIXPCScriptable::WANT_POSTCREATE)

Definition at line 461 of file nsDOMClassInfo.cpp.

Value:
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument)                                 \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent)                              \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentStyle)                              \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocumentStyle)                            \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentView)                               \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentRange)                              \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentTraversal)                          \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL)                                \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)                                \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Document)                                  \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node)

Definition at line 1663 of file nsDOMClassInfo.cpp.

Value:
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent)                                      \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEvent)                                    \

Definition at line 1682 of file nsDOMClassInfo.cpp.

Value:
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLElement_MOZILLA_1_8_BRANCH)           \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMElementCSSInlineStyle)                      \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)                                \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOM3Node)

Definition at line 1676 of file nsDOMClassInfo.cpp.

#define DOM_CLASSINFO_MAP_BEGIN (   _class,
  _interface 
)    _DOM_CLASSINFO_MAP_BEGIN(_class, &NS_GET_IID(_interface), PR_TRUE)

Definition at line 1647 of file nsDOMClassInfo.cpp.

#define DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF (   _class,
  _interface 
)    _DOM_CLASSINFO_MAP_BEGIN(_class, &NS_GET_IID(_interface), PR_FALSE)

Definition at line 1650 of file nsDOMClassInfo.cpp.

Value:
nsnull                                                                  \
    };                                                                        \
                                                                              \
    d.mInterfaces = interface_list;                                           \
  }

Definition at line 1656 of file nsDOMClassInfo.cpp.

Value:
xpathEvaluatorIID,                                                        \
  DOM_CLASSINFO_MAP_END

Definition at line 1691 of file nsDOMClassInfo.cpp.

#define DOM_CLASSINFO_MAP_ENTRY (   _if)    &NS_GET_IID(_if),

Definition at line 1653 of file nsDOMClassInfo.cpp.

Value:
DOM_CLASSINFO_MAP_ENTRY(nsIDOMUIEvent)                                    \
    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSUIEvent)                                  \
    DOM_CLASSINFO_EVENT_MAP_ENTRIES

Definition at line 1686 of file nsDOMClassInfo.cpp.

Definition at line 473 of file nsDOMClassInfo.cpp.

Definition at line 448 of file nsDOMClassInfo.cpp.

Value:
(ELEMENT_SCRIPTABLE_FLAGS & ~nsIXPCScriptable::USE_JSSTUB_FOR_SETPROPERTY | \
   nsIXPCScriptable::WANT_GETPROPERTY |                                       \
   nsIXPCScriptable::WANT_SETPROPERTY |                                       \
   nsIXPCScriptable::WANT_CALL)

Definition at line 455 of file nsDOMClassInfo.cpp.

Value:
(DOM_DEFAULT_SCRIPTABLE_FLAGS |                                              \
  nsIXPCScriptable::WANT_FINALIZE |                                           \
  nsIXPCScriptable::WANT_MARK)

Definition at line 417 of file nsDOMClassInfo.cpp.

Value:
((GCPARTICIPANT_SCRIPTABLE_FLAGS |                                           \
   nsIXPCScriptable::WANT_PRECREATE |                                         \
   nsIXPCScriptable::WANT_ADDPROPERTY |                                       \
   nsIXPCScriptable::WANT_SETPROPERTY) &                                      \
  ~nsIXPCScriptable::USE_JSSTUB_FOR_ADDPROPERTY)

Definition at line 436 of file nsDOMClassInfo.cpp.

#define NS_DEFINE_CLASSINFO_DATA (   _class,
  _helper,
  _flags 
)    NS_DEFINE_CLASSINFO_DATA_WITH_NAME(_class, _class, _helper, _flags)

Definition at line 498 of file nsDOMClassInfo.cpp.

Definition at line 481 of file nsDOMClassInfo.cpp.

#define NS_DEFINE_CLASSINFO_DATA_WITH_NAME (   _class,
  _name,
  _helper,
  _flags 
)
Value:
{ #_name,                                                                   \
    { _helper::doCreate },                                                    \
    nsnull,                                                                   \
    nsnull,                                                                   \
    nsnull,                                                                   \
    _flags,                                                                   \
    PR_TRUE,                                                                  \
    NS_DEFINE_CLASSINFO_DATA_DEBUG(_class)                                    \
  },

Definition at line 486 of file nsDOMClassInfo.cpp.

#define NS_DEFINE_CONSTRUCTOR_DATA (   _class,
  _contract_id 
)    { eDOMClassInfo_##_class##_id, _contract_id },

Definition at line 1117 of file nsDOMClassInfo.cpp.

#define SET_JSVAL_TO_STRING (   _val,
  _cx,
  _str 
)
Value:
_val = GetInternedJSVal(_cx, _str);                                         \
  if (!JSVAL_IS_STRING(_val)) {                                               \
    return NS_ERROR_OUT_OF_MEMORY;                                            \
  }
Value:
(nsIXPCScriptable::WANT_GETPROPERTY |                                        \
  nsIXPCScriptable::WANT_SETPROPERTY |                                        \
  nsIXPCScriptable::WANT_PRECREATE |                                          \
  nsIXPCScriptable::WANT_FINALIZE |                                           \
  nsIXPCScriptable::WANT_ADDPROPERTY |                                        \
  nsIXPCScriptable::WANT_DELPROPERTY |                                        \
  nsIXPCScriptable::WANT_NEWENUMERATE |                                       \
  nsIXPCScriptable::WANT_MARK |                                               \
  nsIXPCScriptable::WANT_EQUALITY |                                           \
  nsIXPCScriptable::WANT_OUTER_OBJECT |                                       \
  nsIXPCScriptable::WANT_INNER_OBJECT |                                       \
  nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE)

Definition at line 422 of file nsDOMClassInfo.cpp.

Definition at line 4999 of file nsDOMClassInfo.cpp.


Function Documentation

static nsresult BaseStubConstructor ( nsIWeakReference aWeakOwner,
const nsGlobalNameStruct name_struct,
JSContext cx,
JSObject obj,
uintN  argc,
jsval argv,
jsval rval 
) [static]

Definition at line 4471 of file nsDOMClassInfo.cpp.

{
  nsresult rv;
  nsCOMPtr<nsISupports> native;
  if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
    const char *contractid =
      FindConstructorContractID(name_struct->mDOMClassInfoID);
    native = do_CreateInstance(contractid, &rv);
  } else if (name_struct->mType == nsGlobalNameStruct::eTypeExternalConstructor) {
    native = do_CreateInstance(name_struct->mCID, &rv);
  } else if (name_struct->mType == nsGlobalNameStruct::eTypeExternalConstructorAlias) {
    native = do_CreateInstance(name_struct->mAlias->mCID, &rv);
  } else {
    native = do_CreateInstance(*name_struct->mData->mConstructorCID, &rv);
  }
  if (NS_FAILED(rv)) {
    NS_ERROR("Failed to create the object");
    return rv;
  }

  nsCOMPtr<nsIJSNativeInitializer_MOZILLA_1_8_BRANCH> initializer18 =
    do_QueryInterface(native);
  if (initializer18) {
    nsCOMPtr<nsPIDOMWindow> owner = do_QueryReferent(aWeakOwner);
    NS_ENSURE_STATE(owner && owner->GetOuterWindow() &&
                    owner->GetOuterWindow()->GetCurrentInnerWindow() == owner);
    rv = initializer18->Initialize(owner, cx, obj, argc, argv);
    if (NS_FAILED(rv)) {
      return NS_ERROR_NOT_INITIALIZED;
    }
  } else {
    nsCOMPtr<nsIJSNativeInitializer> initializer(do_QueryInterface(native));
    if (initializer) {
      rv = initializer->Initialize(cx, obj, argc, argv);
      if (NS_FAILED(rv)) {
        return NS_ERROR_NOT_INITIALIZED;
      }
    }
  }

  nsCOMPtr<nsIScriptObjectOwner> owner(do_QueryInterface(native));
  if (owner) {
    nsIScriptContext *context = nsJSUtils::GetStaticScriptContext(cx, obj);
    if (!context) {
      return NS_ERROR_UNEXPECTED;
    }

    JSObject* new_obj;
    rv = owner->GetScriptObject(context, (void**)&new_obj);

    if (NS_SUCCEEDED(rv)) {
      *rval = OBJECT_TO_JSVAL(new_obj);
    }

    return rv;
  }

  nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
  rv = nsDOMGenericSH::WrapNative(cx, obj, native, NS_GET_IID(nsISupports),
                                  rval, getter_AddRefs(holder));

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ClassifyWrapper ( PLDHashTable table,
PLDHashEntryHdr hdr,
PRUint32  number,
void arg 
)

Definition at line 5290 of file nsDOMClassInfo.cpp.

{
  PreservedWrapperEntry *entry = NS_STATIC_CAST(PreservedWrapperEntry*, hdr);

  WrapperSCCEntry *SCCEntry = NS_STATIC_CAST(WrapperSCCEntry*,
    PL_DHashTableOperate(&sWrapperSCCTable, entry->participant->GetSCCIndex(),
                         PL_DHASH_ADD));
  if (!SCCEntry) {
    *NS_STATIC_CAST(PRBool*, arg) = PR_TRUE;
    return PL_DHASH_STOP;
  }

#ifdef DEBUG_PRESERVE_WRAPPERS
  if (!SCCEntry->first) {
    nsAutoString nodeName;
    nsCOMPtr<nsIDOMNode> node = do_QueryInterface(SCCEntry->key);
    if (node)
      node->GetNodeName(nodeName);
    else
      nodeName.AssignLiteral("##not-node##");
    printf("  new SCC root %p \"%s\"\n",
           NS_STATIC_CAST(void*, SCCEntry->key.get()),
           NS_ConvertUTF16toUTF8(nodeName).get());
  }
#endif

  entry->next = SCCEntry->first;
  SCCEntry->first = entry;

  return PL_DHASH_NEXT;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static JSBool JS_DLL_CALLBACK ContentWindowGetter ( JSContext cx,
JSObject obj,
uintN  argc,
jsval argv,
jsval rval 
) [static]

Definition at line 5820 of file nsDOMClassInfo.cpp.

{
  return ::JS_GetProperty(cx, obj, "content", rval);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* CutPrefix ( const char *  aName) [static]

Definition at line 1504 of file nsDOMClassInfo.cpp.

                             {
  static const char prefix_nsIDOM[] = "nsIDOM";
  static const char prefix_nsI[]    = "nsI";

  if (strncmp(aName, prefix_nsIDOM, sizeof(prefix_nsIDOM) - 1) == 0) {
    return aName + sizeof(prefix_nsIDOM) - 1;
  }

  if (strncmp(aName, prefix_nsI, sizeof(prefix_nsI) - 1) == 0) {
    return aName + sizeof(prefix_nsI) - 1;
  }

  return aName;
}

Here is the caller graph for this function:

static nsresult DefineInterfaceConstants ( JSContext cx,
JSObject obj,
const nsIID aIID 
) [static]

Definition at line 4538 of file nsDOMClassInfo.cpp.

{
  nsCOMPtr<nsIInterfaceInfoManager> iim =
    dont_AddRef(XPTI_GetInterfaceInfoManager());
  NS_ENSURE_TRUE(iim, NS_ERROR_UNEXPECTED);

  nsCOMPtr<nsIInterfaceInfo> if_info;

  nsresult rv = iim->GetInfoForIID(aIID, getter_AddRefs(if_info));
  NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && if_info, rv);

  PRUint16 constant_count;

  if_info->GetConstantCount(&constant_count);

  if (!constant_count) {
    return NS_OK;
  }

  nsCOMPtr<nsIInterfaceInfo> parent_if_info;

  rv = if_info->GetParent(getter_AddRefs(parent_if_info));
  NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && parent_if_info, rv);

  PRUint16 parent_constant_count, i;
  parent_if_info->GetConstantCount(&parent_constant_count);

  for (i = parent_constant_count; i < constant_count; i++) {
    const nsXPTConstant *c = nsnull;

    rv = if_info->GetConstant(i, &c);
    NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && c, rv);

    PRUint16 type = c->GetType().TagPart();

    jsval v;
    switch (type) {
      case nsXPTType::T_I8:
      case nsXPTType::T_U8:
      {
        v = INT_TO_JSVAL(c->GetValue()->val.u8);
        break;
      }
      case nsXPTType::T_I16:
      case nsXPTType::T_U16:
      {
        v = INT_TO_JSVAL(c->GetValue()->val.u16);
        break;
      }
      case nsXPTType::T_I32:
      case nsXPTType::T_U32:
      {
        v = INT_TO_JSVAL(c->GetValue()->val.u32);
        break;
      }
      default:
      {
#ifdef NS_DEBUG
        NS_ERROR("Non-numeric constant found in interface.");
#endif
        continue;
      }
    }

    if (!::JS_DefineProperty(cx, obj, c->GetName(), v, nsnull, nsnull,
                             JSPROP_ENUMERATE)) {
      return NS_ERROR_UNEXPECTED;
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool documentNeedsSecurityCheck ( JSContext cx,
nsIXPConnectWrappedNative wrapper 
) [inline, static]

Definition at line 7384 of file nsDOMClassInfo.cpp.

{
  // We cache a pointer to a wrapper and a context that we've last vetted
  // and cache what the verdict was.

  if (cx == cached_doc_cx && wrapper == cached_doc_wrapper) {
    return cached_doc_needs_check;
  }

  cached_doc_cx = cx;
  cached_doc_wrapper = wrapper;
  
  // Get the JS object from the wrapper
  JSObject *wrapper_obj = nsnull;
  wrapper->GetJSObject(&wrapper_obj);

  JSObject *wrapper_global = GetGlobalJSObject(cx, wrapper_obj);

#ifdef DEBUG
  {
    JSClass *clazz = JS_GET_CLASS(cx, wrapper_obj);

    NS_ASSERTION(clazz && clazz->flags & JSCLASS_HAS_PRIVATE &&
                 clazz->flags & JSCLASS_PRIVATE_IS_NSISUPPORTS,
                 "Bad class for Document object!");
  }
#endif

  // Check if the calling function comes from the same scope that the
  // wrapper comes from. If that's the case, or if there's no JS
  // running at the moment (i.e. someone is using the JS engine API
  // directly to access a property on a JS object) there's no need to
  // do a security check.

  JSObject *function_obj = nsnull;
  JSStackFrame *fp = nsnull;

  // Initialize to false to handle the case where there's no JS running
  // on the current context (e.g., we're getting here from a property
  // access from the JS API).  Since the scope chain is immutable, it's
  // OK to keep skipping the check.

  cached_doc_needs_check = PR_FALSE;

  do {
    fp = ::JS_FrameIterator(cx, &fp);
    if (!fp) {
      // Clear cached_doc_cx so that we don't really cache this return
      // value. If we hit this case, then we didn't really have enough
      // information about the currently running code to make any long-term
      // decisions.

      cached_doc_cx = nsnull;
      return cached_doc_needs_check;
    }

    function_obj = ::JS_GetFrameFunctionObject(cx, fp);

    // Since we're here, we know that there is some JS running. Now, we
    // need to default to being paranoid, and can only skip the security
    // check if we find that the currently-running function is from the
    // same scope.

    cached_doc_needs_check = PR_TRUE;
  } while (!function_obj);

  // Get the global object that the calling function comes from.
  JSObject *function_global = GetGlobalJSObject(cx, function_obj);

  if (function_global != wrapper_global) {
    // The global object we're trying to access a property on is not
    // from the scope that the calling function comes from. Do a
    // security check.

    return PR_TRUE;
  }

  // We're called from the same context as the context in the global
  // object in the scope that wrapper came from, no need to do a
  // security check now.
  cached_doc_needs_check = PR_FALSE;

  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static const char* FindConstructorContractID ( PRInt32  aDOMClassInfoID) [static]

Definition at line 4459 of file nsDOMClassInfo.cpp.

{
  PRUint32 i;
  for (i = 0; i < NS_ARRAY_LENGTH(kConstructorMap); ++i) {
    if (kConstructorMap[i].mDOMClassInfoID == aDOMClassInfoID) {
      return kConstructorMap[i].mContractID;
    }
  }
  return nsnull;
}

Here is the caller graph for this function:

static already_AddRefed<nsIDOMWindow> GetChildFrame ( nsGlobalWindow win,
jsval  id 
) [static]

Definition at line 4084 of file nsDOMClassInfo.cpp.

{
  nsCOMPtr<nsIDOMWindowCollection> frames;
  win->GetFrames(getter_AddRefs(frames));

  nsIDOMWindow *frame = nsnull;

  if (frames) {
    frames->Item(JSVAL_TO_INT(id), &frame);
  }

  return frame;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static JSObject* GetDocumentAllHelper ( JSContext cx,
JSObject obj 
) [inline, static]

Definition at line 8119 of file nsDOMClassInfo.cpp.

{
  while (obj && JS_GET_CLASS(cx, obj) != &sHTMLDocumentAllHelperClass) {
    obj = ::JS_GetPrototype(cx, obj);
  }

  return obj;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static JSObject* GetGlobalJSObject ( JSContext cx,
JSObject obj 
) [inline, static]

Definition at line 1288 of file nsDOMClassInfo.cpp.

{
  JSObject *tmp;

  while ((tmp = ::JS_GetParent(cx, obj))) {
    obj = tmp;
  }

  return obj;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static jsval GetInternedJSVal ( JSContext cx,
const char *  str 
) [static]

Definition at line 1300 of file nsDOMClassInfo.cpp.

{
  JSString *s = ::JS_InternString(cx, str);

  if (!s) {
    return JSVAL_VOID;
  }

  return STRING_TO_JSVAL(s);
}

Here is the call graph for this function:

Definition at line 5111 of file nsDOMClassInfo.cpp.

Here is the caller graph for this function:

static PRBool IsObjInProtoChain ( JSContext cx,
JSObject obj,
JSObject proto 
) [static]

Definition at line 8911 of file nsDOMClassInfo.cpp.

{
  JSObject *o = obj;

  while (o) {
    JSObject *p = ::JS_GetPrototype(cx, o);

    if (p == proto) {
      return PR_TRUE;
    }

    o = p;
  }

  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

MarkAllWrappers ( PLDHashTable table,
PLDHashEntryHdr hdr,
PRUint32  number,
void arg 
)

Definition at line 5155 of file nsDOMClassInfo.cpp.

{
  MarkAllWrappersData *data = NS_STATIC_CAST(MarkAllWrappersData*, arg);
  PreservedWrapperEntry *entry = NS_STATIC_CAST(PreservedWrapperEntry*, hdr);

  nsIXPConnectJSObjectHolder *wrapper;
  JSObject *wrapper_obj;
  if ((wrapper = entry->keyToWrapperFunc(entry->key)) &&
      NS_SUCCEEDED(wrapper->GetJSObject(&wrapper_obj)))
    JS_MarkGCThing(data->cx, wrapper_obj, 
                   "nsDOMClassInfo::sPreservedWrapperTable_OOM", data->arg);

  return PL_DHASH_NEXT;
}

Here is the call graph for this function:

Here is the caller graph for this function:

MarkExternallyReferenced ( PLDHashTable table,
PLDHashEntryHdr hdr,
PRUint32  number,
void arg 
)

Definition at line 5324 of file nsDOMClassInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

static PRBool needsSecurityCheck ( JSContext cx,
nsIXPConnectWrappedNative wrapper 
) [inline, static]

Definition at line 3701 of file nsDOMClassInfo.cpp.

{
  // We cache a pointer to a wrapper and a context that we've last vetted
  // and cache what the verdict was.

  // First, compare the context and wrapper with the cached ones
  if (cx == cached_win_cx && wrapper == cached_win_wrapper) {
    return cached_win_needs_check;
  }

  cached_win_cx = cx;
  cached_win_wrapper = wrapper;
  cached_win_needs_check = PR_TRUE;
  
  nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryWrappedNative(wrapper));

  if (!sgo) {
    NS_ERROR("Huh, global not a nsIScriptGlobalObject?");

    return PR_TRUE;
  }

  nsIScriptContext *otherScriptContext = sgo->GetContext();

  if (!otherScriptContext) {
    return PR_TRUE;
  }

  if (cx != (JSContext *)otherScriptContext->GetNativeContext()) {
    return PR_TRUE;
  }

  // Compare the current context and function object
  // to the ones in the next JS frame
  JSStackFrame *fp = nsnull;
  JSObject *fp_obj = nsnull;

  cached_win_needs_check = PR_FALSE;

  do {
    fp = ::JS_FrameIterator(cx, &fp);

    if (!fp) {
      cached_win_cx = nsnull;
      return cached_win_needs_check;
    }

    fp_obj = ::JS_GetFrameFunctionObject(cx, fp);
    cached_win_needs_check = PR_TRUE;
  } while (!fp_obj);

  JSObject *global = GetGlobalJSObject(cx, fp_obj);

  JSObject *wrapper_obj = nsnull;
  wrapper->GetJSObject(&wrapper_obj);

  if (global != wrapper_obj) {
    return PR_TRUE;
  }

  cached_win_needs_check = PR_FALSE;
  return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static NS_DEFINE_CID ( kCPluginManagerCID  ,
NS_PLUGINMANAGER_CID   
) [static]
static NS_DEFINE_CID ( kDOMSOF_CID  ,
NS_DOM_SCRIPT_OBJECT_FACTORY_CID   
) [static]

Definition at line 1211 of file nsDOMClassInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 5398 of file nsDOMClassInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1217 of file nsDOMClassInfo.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

static void PrintWarningOnConsole ( JSContext cx,
const char *  stringBundleProperty 
) [static]

Definition at line 1223 of file nsDOMClassInfo.cpp.

{
  nsCOMPtr<nsIStringBundleService>
    stringService(do_GetService(NS_STRINGBUNDLE_CONTRACTID));
  if (!stringService) {
    return;
  }

  nsCOMPtr<nsIStringBundle> bundle;
  stringService->CreateBundle(kDOMStringBundleURL, getter_AddRefs(bundle));
  if (!bundle) {
    return;
  }

  nsXPIDLString msg;
  bundle->GetStringFromName(NS_ConvertASCIItoUTF16(stringBundleProperty).get(),
                            getter_Copies(msg));

  if (msg.IsEmpty()) {
    NS_ERROR("Failed to get strings from dom.properties!");
    return;
  }

  nsCOMPtr<nsIConsoleService> consoleService
    (do_GetService("@mozilla.org/consoleservice;1"));
  if (!consoleService) {
    return;
  }

  nsCOMPtr<nsIScriptError> scriptError =
    do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
  if (!scriptError) {
    return;
  }

  JSStackFrame *fp, *iterator = nsnull;
  fp = ::JS_FrameIterator(cx, &iterator);
  PRUint32 lineno = 0;
  nsAutoString sourcefile;
  if (fp) {
    JSScript* script = ::JS_GetFrameScript(cx, fp);
    if (script) {
      const char* filename = ::JS_GetScriptFilename(cx, script);
      if (filename) {
        CopyUTF8toUTF16(nsDependentCString(filename), sourcefile);
      }
      jsbytecode* pc = ::JS_GetFramePC(cx, fp);
      if (pc) {
        lineno = ::JS_PCToLineNumber(cx, script, pc);
      }
    }
  }
  nsresult rv = scriptError->Init(msg.get(),
                                  sourcefile.get(),
                                  EmptyString().get(),
                                  lineno,
                                  0, // column for error is not available
                                  nsIScriptError::warningFlag,
                                  "DOM:HTML");
  if (NS_SUCCEEDED(rv)){
    consoleService->LogMessage(scriptError);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 5017 of file nsDOMClassInfo.cpp.

{
  WrapperSCCEntry *entry = NS_STATIC_CAST(WrapperSCCEntry*, hdr);
  entry->~WrapperSCCEntry();
  memset(hdr, 0, table->entrySize);
}

Here is the call graph for this function:

WrapperSCCsInitEntry ( PLDHashTable table,
PLDHashEntryHdr hdr,
const void key 
)

Variable Documentation

Definition at line 3680 of file nsDOMClassInfo.cpp.

Definition at line 3681 of file nsDOMClassInfo.cpp.

Definition at line 3679 of file nsDOMClassInfo.cpp.

Definition at line 3677 of file nsDOMClassInfo.cpp.

Definition at line 3678 of file nsDOMClassInfo.cpp.

Definition at line 3676 of file nsDOMClassInfo.cpp.

Initial value:
{



}

Definition at line 1120 of file nsDOMClassInfo.cpp.

const char kDOMStringBundleURL[] = "chrome://global/locale/dom/dom.properties" [static]

Definition at line 411 of file nsDOMClassInfo.cpp.

Definition at line 512 of file nsDOMClassInfo.cpp.

Definition at line 3518 of file nsDOMClassInfo.cpp.

Every XPConnect wrapper that needs to be preserved (a wrapped native with JS properties set on it or used by XBL or a wrapped JS event handler function) as long as the element it wraps is reachable from script (via JS or via DOM APIs accessible from JS) gets an entry in this table.

See PreservedWrapperEntry.

Definition at line 3515 of file nsDOMClassInfo.cpp.

Definition at line 3521 of file nsDOMClassInfo.cpp.

At the beginning of the mark phase of the GC, we sort all the wrappers into their strongly connected components.

We maintain this information for the duration of the mark phase, during which time |sWrapperSCCTable| maps the SCC roots to a list of the wrappers in the SCC. This allows the mark callback for any wrapper (preserved or not) to quickly mark all of the preserved wrappers in its SCC.

Many of these roots are documents. We know that a document will be marked if it is still being displayed since the document is reachable by a JS property on the global object.

Definition at line 4995 of file nsDOMClassInfo.cpp.