Bug 1444231 - Fix QI implementation for FragmentOrElement. r=mccr8 a=jcristau
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 13 Mar 2018 00:59:23 -0400
changeset 462623 925d5693c5a1a73806062947b18c98ed13efc6c3
parent 462622 5733f4d3acbfd0a62c7643809fed71e7b598de2f
child 462624 5b5c5f82c6d8e49d310687de369649aac6b67c69
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8, jcristau
bugs1444231
milestone60.0
Bug 1444231 - Fix QI implementation for FragmentOrElement. r=mccr8 a=jcristau MozReview-Commit-ID: 9mPO2ezk2Y7
dom/base/Element.cpp
dom/base/FragmentOrElement.cpp
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -209,16 +209,22 @@ Element::GetSVGAnimatedClass() const
 {
   MOZ_ASSERT(MayHaveClass() && IsSVGElement(), "Unexpected call");
   return static_cast<const nsSVGElement*>(this)->GetAnimatedClassName();
 }
 
 NS_IMETHODIMP
 Element::QueryInterface(REFNSIID aIID, void** aInstancePtr)
 {
+  if (aIID.Equals(NS_GET_IID(Element))) {
+    NS_ADDREF_THIS();
+    *aInstancePtr = this;
+    return NS_OK;
+  }
+
   NS_ASSERTION(aInstancePtr,
                "QueryInterface requires a non-NULL destination!");
   nsresult rv = FragmentOrElement::QueryInterface(aIID, aInstancePtr);
   if (NS_SUCCEEDED(rv)) {
     return NS_OK;
   }
 
   // Give the binding manager a chance to get an interface for this element.
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -2088,17 +2088,16 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_
     }
   }
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 
 NS_INTERFACE_MAP_BEGIN(FragmentOrElement)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(FragmentOrElement)
-  NS_INTERFACE_MAP_ENTRY(Element)
   NS_INTERFACE_MAP_ENTRY(nsIContent)
   NS_INTERFACE_MAP_ENTRY(nsINode)
   NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
   NS_INTERFACE_MAP_ENTRY(mozilla::dom::EventTarget)
   NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
                                  new nsNodeSupportsWeakRefTearoff(this))
   // DOM bindings depend on the identity pointer being the
   // same as nsINode (which nsIContent inherits).