diff --git a/mozilla/content/base/src/nsDOMAttribute.cpp b/mozilla/content/base/src/nsDOMAttribute.cpp index d01023df035..2a2e889d9b1 100644 --- a/mozilla/content/base/src/nsDOMAttribute.cpp +++ b/mozilla/content/base/src/nsDOMAttribute.cpp @@ -99,7 +99,11 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMAttribute) NS_INTERFACE_MAP_ENTRY(nsPIDOMEventTarget) NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference, new nsNodeSupportsWeakRefTearoff(this)) - NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMAttr) + // nsNodeSH::PreCreate() depends on the identity pointer being the + // same as nsINode (which nsIAttribute inherits), so if you change + // the below line, make sure nsNodeSH::PreCreate() still does the + // right thing! + NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAttribute) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Attr) NS_INTERFACE_MAP_END diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index c2fce3d4f5a..bdbaabb218a 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -896,6 +896,7 @@ nsDocument::~nsDocument() NS_IMPL_CYCLE_COLLECTION_CLASS(nsDocument) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDocument) + NS_INTERFACE_MAP_ENTRY(nsINode) NS_INTERFACE_MAP_ENTRY(nsIDocument) NS_INTERFACE_MAP_ENTRY(nsIDOMDocument) NS_INTERFACE_MAP_ENTRY(nsIDOMNSDocument) @@ -917,8 +918,11 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDocument) NS_INTERFACE_MAP_ENTRY(nsIDOM3Document) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_ENTRY(nsIRadioGroupContainer) - NS_INTERFACE_MAP_ENTRY(nsINode) NS_INTERFACE_MAP_ENTRY(nsIMutationObserver) + // nsNodeSH::PreCreate() depends on the identity pointer being the + // same as nsINode (which nsIDocument inherits), so if you change + // the below line, make sure nsNodeSH::PreCreate() still does the + // right thing! NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocument) if (aIID.Equals(NS_GET_IID(nsIDOMXPathEvaluator)) || aIID.Equals(NS_GET_IID(nsIXPathEvaluatorInternal))) { diff --git a/mozilla/content/base/src/nsGenericDOMDataNode.cpp b/mozilla/content/base/src/nsGenericDOMDataNode.cpp index 1eabde52c2b..171d22daf1c 100644 --- a/mozilla/content/base/src/nsGenericDOMDataNode.cpp +++ b/mozilla/content/base/src/nsGenericDOMDataNode.cpp @@ -103,6 +103,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGenericDOMDataNode) NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference, new nsNodeSupportsWeakRefTearoff(this)) NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node, new nsNode3Tearoff(this)) + // nsNodeSH::PreCreate() depends on the identity pointer being the + // same as nsINode (which nsIContent inherits), so if you change the + // below line, make sure nsNodeSH::PreCreate() still does the right + // thing! NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent) NS_INTERFACE_MAP_END diff --git a/mozilla/content/base/src/nsGenericElement.cpp b/mozilla/content/base/src/nsGenericElement.cpp index d676f7b6b00..2ee5b97a36a 100644 --- a/mozilla/content/base/src/nsGenericElement.cpp +++ b/mozilla/content/base/src/nsGenericElement.cpp @@ -3434,6 +3434,10 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGenericElement) nsDOMEventRTTearoff::Create(this)) NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference, new nsNodeSupportsWeakRefTearoff(this)) + // nsNodeSH::PreCreate() depends on the identity pointer being the + // same as nsINode (which nsIContent inherits), so if you change the + // below line, make sure nsNodeSH::PreCreate() still does the right + // thing! NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent) NS_INTERFACE_MAP_END diff --git a/mozilla/content/html/document/src/nsImageDocument.cpp b/mozilla/content/html/document/src/nsImageDocument.cpp index 4c9199e5851..2a450e09e80 100644 --- a/mozilla/content/html/document/src/nsImageDocument.cpp +++ b/mozilla/content/html/document/src/nsImageDocument.cpp @@ -266,13 +266,11 @@ nsImageDocument::~nsImageDocument() NS_IMPL_ADDREF_INHERITED(nsImageDocument, nsMediaDocument) NS_IMPL_RELEASE_INHERITED(nsImageDocument, nsMediaDocument) -NS_INTERFACE_TABLE_HEAD(nsImageDocument) - NS_INTERFACE_TABLE4(nsImageDocument, - nsIImageDocument, - imgIDecoderObserver, - imgIContainerObserver, - nsIDOMEventListener) - NS_INTERFACE_TABLE_TO_MAP_SEGUE +NS_INTERFACE_MAP_BEGIN(nsImageDocument) + NS_INTERFACE_MAP_ENTRY(nsIImageDocument) + NS_INTERFACE_MAP_ENTRY(imgIDecoderObserver) + NS_INTERFACE_MAP_ENTRY(imgIContainerObserver) + NS_INTERFACE_MAP_ENTRY(nsIDOMEventListener) NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(ImageDocument) NS_INTERFACE_MAP_END_INHERITING(nsMediaDocument) diff --git a/mozilla/dom/src/base/nsDOMClassInfo.cpp b/mozilla/dom/src/base/nsDOMClassInfo.cpp index 9ccd04e1507..dc1a4f63353 100644 --- a/mozilla/dom/src/base/nsDOMClassInfo.cpp +++ b/mozilla/dom/src/base/nsDOMClassInfo.cpp @@ -6444,9 +6444,19 @@ NS_IMETHODIMP nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj, JSObject **parentObj) { - nsCOMPtr node(do_QueryInterface(nativeObj)); - NS_ENSURE_TRUE(node, NS_ERROR_UNEXPECTED); + nsINode *node = static_cast(nativeObj); +#ifdef DEBUG + { + nsCOMPtr node_qi(do_QueryInterface(nativeObj)); + + // If this assertion fires the QI implementation for the object in + // question doesn't use the nsINode pointer as the nsISupports + // pointer. That must be fixed, or we'll crash... + NS_ASSERTION(node_qi == node, "Uh, fix QI!"); + } +#endif + // Make sure that we get the owner document of the content node, in case // we're in document teardown. If we are, it's important to *not* use // globalObj as the nodes parent since that would give the node the @@ -6964,8 +6974,18 @@ nsElementSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, nsresult rv = nsNodeSH::PostCreate(wrapper, cx, obj); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr content(do_QueryWrappedNative(wrapper)); - NS_ENSURE_TRUE(content, NS_ERROR_UNEXPECTED); + nsIContent *content = static_cast(wrapper->Native()); + +#ifdef DEBUG + { + nsCOMPtr content_qi(do_QueryWrappedNative(wrapper)); + + // If this assertion fires the QI implementation for the object in + // question doesn't use the nsIContent pointer as the nsISupports + // pointer. That must be fixed, or we'll crash... + NS_ASSERTION(content_qi == content, "Uh, fix QI!"); + } +#endif nsCOMPtr doc; if (content->HasFlag(NODE_FORCE_XBL_BINDINGS)) {