NS_INTERFACE_MAP_BEGIN(nsDOMImplementation) NS_INTERFACE_MAP_ENTRY(nsIDOMDOMImplementation) NS_INTERFACE_MAP_ENTRY(nsIPrivateDOMImplementation) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMDOMImplementation) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DOMImplementation)
NS_INTERFACE_MAP_BEGIN(nsXPathDocumentTearoff) NS_INTERFACE_MAP_ENTRY(nsIDOMXPathEvaluator) NS_INTERFACE_MAP_END_AGGREGATED(mDocument)  NS_IMPL_ADDREF_USING_AGGREGATOR(nsXPathDocumentTearoff, mDocument) NS_IMPL_RELEASE_USING_AGGREGATOR(nsXPathDocumentTearoff, mDocument)          nsDocument::nsDocument() {      mBindingManager = do_CreateInstance("@mozilla.org/xbl/binding-manager;1");  nsCOMPtr<nsIDocumentObserver> observer(do_QueryInterface(mBindingManager)); if (observer) {    mObservers.InsertElementAt(observer, 0); } }  nsDocument::~nsDocument() { mInDestructor = PR_TRUE;         PRInt32 indx; for (indx = mObservers.Count() - 1; indx >= 0; --indx) {  nsIDocumentObserver* observer = NS_STATIC_CAST(nsIDocumentObserver *, mObservers.ElementAt(indx));  observer->DocumentWillBeDestroyed(this); }  mParentDocument = nsnull;    if (mSubDocuments) { PL_DHashTableDestroy(mSubDocuments);  mSubDocuments = nsnull; }  if (mRootContent) { if (mRootContent->GetDocument()) {    PRInt32 count = mChildren.Count(); for (indx = 0; indx < count; ++indx) { mChildren[indx]->SetDocument(nsnull, PR_TRUE, PR_FALSE); } } }  mRootContent = nsnull; mChildren.Clear();   indx = mStyleSheets.Count(); while (--indx >= 0) { mStyleSheets[indx]->SetOwningDocument(nsnull); }  if (mChildNodes) { mChildNodes->DropReference(); }  if (mListenerManager) { mListenerManager->SetListenerTarget(nsnull); }  if (mScriptLoader) { mScriptLoader->DropDocumentReference(); }  if (mCSSLoader) { mCSSLoader->DropDocumentReference(); }  if (mNodeInfoManager) { mNodeInfoManager->DropDocumentReference(); }  if (mAttrStyleSheet) { mAttrStyleSheet->SetOwningDocument(nsnull); }  if (mStyleAttrStyleSheet) { mStyleAttrStyleSheet->SetOwningDocument(nsnull); }  delete mHeaderData; delete mBoxObjectTable; delete mXPathDocument; }  PRBool gCheckedForXPathDOM = PR_FALSE; PRBool gHaveXPathDOM = PR_FALSE;  NS_INTERFACE_MAP_BEGIN(nsDocument) NS_INTERFACE_MAP_ENTRY(nsIDocument) NS_INTERFACE_MAP_ENTRY(nsIDOMDocument) NS_INTERFACE_MAP_ENTRY(nsIDOMNSDocument) NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentEvent) NS_INTERFACE_MAP_ENTRY(nsIDOM3DocumentEvent) NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentStyle) NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentView) NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentRange) NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentTraversal) NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentXBL) NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal) NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver) NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget) NS_INTERFACE_MAP_ENTRY(nsIDOM3EventTarget) NS_INTERFACE_MAP_ENTRY(nsIDOMNode) NS_INTERFACE_MAP_ENTRY(nsIDOM3Node) NS_INTERFACE_MAP_ENTRY(nsIDOM3Document) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_ENTRY(nsIRadioGroupContainer) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocument) if (aIID.Equals(NS_GET_IID(nsIDOMXPathEvaluator)) && (!gCheckedForXPathDOM || gHaveXPathDOM)) { if (!mXPathDocument) { nsCOMPtr<nsIDOMXPathEvaluator> evaluator; nsresult rv; evaluator = do_CreateInstance(NS_XPATH_EVALUATOR_CONTRACTID, &rv); gCheckedForXPathDOM = PR_TRUE; gHaveXPathDOM = (evaluator != nsnull); if (rv == NS_ERROR_FACTORY_NOT_REGISTERED) { return NS_ERROR_NO_INTERFACE; } NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsIXPathEvaluatorInternal> internal = do_QueryInterface(evaluator); if (internal) { internal->SetDocument(this); }  mXPathDocument = new nsXPathDocumentTearoff(evaluator, this); NS_ENSURE_TRUE(mXPathDocument, NS_ERROR_OUT_OF_MEMORY); } foundInterface = mXPathDocument; } else
NS_INTERFACE_MAP_BEGIN(nsDOMImplementation)  NS_INTERFACE_MAP_ENTRY(nsIDOMDOMImplementation)  NS_INTERFACE_MAP_ENTRY(nsIPrivateDOMImplementation)  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMDOMImplementation)  NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DOMImplementation)NS_INTERFACE_MAP_END