Bug 888685 - Remove nsISupports from remaining SVG DOM classes draft
authorlongsonr <longsonr@gmail.com>
Sat, 25 Jul 2020 23:11:15 +0100
changeset 3100959 0ac198394fcda887e0a46166e82049d575b340bd
parent 3100905 4b6ce69368c336a1d0fba758fb9d6c89650840b4
child 3281437 ab0fa1564feefe8b8a275fa5dc3b1b877d9959ba
push id577952
push userlongsonr@gmail.com
push dateSun, 02 Aug 2020 08:42:37 +0000
treeherdertry@99dcb27a0bba [default view] [failures only]
bugs888685
milestone81.0a1
Bug 888685 - Remove nsISupports from remaining SVG DOM classes Reviewers: jwatt Tags: #secure-revision Bug #: 888685 Differential Revision: https://phabricator.services.mozilla.com/D84915
dom/svg/DOMSVGAnimatedEnumeration.cpp
dom/svg/DOMSVGAnimatedEnumeration.h
dom/svg/DOMSVGAnimatedInteger.cpp
dom/svg/DOMSVGAnimatedInteger.h
dom/svg/DOMSVGAnimatedNumber.cpp
dom/svg/DOMSVGAnimatedNumber.h
dom/svg/DOMSVGLength.cpp
dom/svg/DOMSVGLength.h
dom/svg/DOMSVGLengthList.cpp
dom/svg/DOMSVGNumber.cpp
dom/svg/DOMSVGNumber.h
dom/svg/SVGAnimatedPreserveAspectRatio.cpp
dom/svg/SVGAnimatedPreserveAspectRatio.h
dom/svg/SVGPreserveAspectRatio.cpp
dom/svg/SVGPreserveAspectRatio.h
--- a/dom/svg/DOMSVGAnimatedEnumeration.cpp
+++ b/dom/svg/DOMSVGAnimatedEnumeration.cpp
@@ -9,23 +9,18 @@
 #include "mozilla/dom/SVGAnimatedEnumerationBinding.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGAnimatedEnumeration,
                                                mSVGElement)
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGAnimatedEnumeration)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGAnimatedEnumeration)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGAnimatedEnumeration)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
+NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGAnimatedEnumeration, AddRef)
+NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGAnimatedEnumeration, Release)
 
 JSObject* DOMSVGAnimatedEnumeration::WrapObject(
     JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
   return SVGAnimatedEnumeration_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/svg/DOMSVGAnimatedEnumeration.h
+++ b/dom/svg/DOMSVGAnimatedEnumeration.h
@@ -9,20 +9,20 @@
 
 #include "nsWrapperCache.h"
 
 #include "SVGElement.h"
 
 namespace mozilla {
 namespace dom {
 
-class DOMSVGAnimatedEnumeration : public nsISupports, public nsWrapperCache {
+class DOMSVGAnimatedEnumeration : public nsWrapperCache {
  public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGAnimatedEnumeration)
+  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGAnimatedEnumeration)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGAnimatedEnumeration)
 
   SVGElement* GetParentObject() const { return mSVGElement; }
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
 
   virtual uint16_t BaseVal() = 0;
   virtual void SetBaseVal(uint16_t aBaseVal, ErrorResult& aRv) = 0;
   virtual uint16_t AnimVal() = 0;
--- a/dom/svg/DOMSVGAnimatedInteger.cpp
+++ b/dom/svg/DOMSVGAnimatedInteger.cpp
@@ -9,23 +9,18 @@
 #include "mozilla/dom/SVGAnimatedIntegerBinding.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGAnimatedInteger,
                                                mSVGElement)
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGAnimatedInteger)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGAnimatedInteger)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGAnimatedInteger)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
+NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGAnimatedInteger, AddRef)
+NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGAnimatedInteger, Release)
 
 JSObject* DOMSVGAnimatedInteger::WrapObject(JSContext* aCx,
                                             JS::Handle<JSObject*> aGivenProto) {
   return SVGAnimatedInteger_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/svg/DOMSVGAnimatedInteger.h
+++ b/dom/svg/DOMSVGAnimatedInteger.h
@@ -9,20 +9,20 @@
 
 #include "nsWrapperCache.h"
 
 #include "SVGElement.h"
 
 namespace mozilla {
 namespace dom {
 
-class DOMSVGAnimatedInteger : public nsISupports, public nsWrapperCache {
+class DOMSVGAnimatedInteger : public nsWrapperCache {
  public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGAnimatedInteger)
+  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGAnimatedInteger)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGAnimatedInteger)
 
   SVGElement* GetParentObject() const { return mSVGElement; }
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
 
   virtual int32_t BaseVal() = 0;
   virtual void SetBaseVal(int32_t aBaseVal) = 0;
   virtual int32_t AnimVal() = 0;
--- a/dom/svg/DOMSVGAnimatedNumber.cpp
+++ b/dom/svg/DOMSVGAnimatedNumber.cpp
@@ -9,23 +9,18 @@
 #include "mozilla/dom/SVGAnimatedNumberBinding.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGAnimatedNumber,
                                                mSVGElement)
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGAnimatedNumber)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGAnimatedNumber)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGAnimatedNumber)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
+NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGAnimatedNumber, AddRef)
+NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGAnimatedNumber, Release)
 
 JSObject* DOMSVGAnimatedNumber::WrapObject(JSContext* aCx,
                                            JS::Handle<JSObject*> aGivenProto) {
   return SVGAnimatedNumber_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/svg/DOMSVGAnimatedNumber.h
+++ b/dom/svg/DOMSVGAnimatedNumber.h
@@ -10,20 +10,20 @@
 #include "nsISupports.h"
 #include "nsWrapperCache.h"
 
 #include "SVGElement.h"
 
 namespace mozilla {
 namespace dom {
 
-class DOMSVGAnimatedNumber : public nsISupports, public nsWrapperCache {
+class DOMSVGAnimatedNumber : public nsWrapperCache {
  public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGAnimatedNumber)
+  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGAnimatedNumber)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGAnimatedNumber)
 
   SVGElement* GetParentObject() const { return mSVGElement; }
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
 
   virtual float BaseVal() = 0;
   virtual void SetBaseVal(float aBaseVal) = 0;
   virtual float AnimVal() = 0;
--- a/dom/svg/DOMSVGLength.cpp
+++ b/dom/svg/DOMSVGLength.cpp
@@ -46,24 +46,18 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mList)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSVGElement)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(DOMSVGLength)
   NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGLength)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGLength)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGLength)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(DOMSVGLength)  // pseudo-interface
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
+NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGLength, AddRef)
+NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGLength, Release)
 
 //----------------------------------------------------------------------
 // Helper class: AutoChangeLengthNotifier
 // Stack-based helper class to pair calls to WillChangeLengthList and
 // DidChangeLengthList.
 class MOZ_RAII AutoChangeLengthNotifier : public mozAutoDocUpdate {
  public:
   explicit AutoChangeLengthNotifier(DOMSVGLength* aLength)
--- a/dom/svg/DOMSVGLength.h
+++ b/dom/svg/DOMSVGLength.h
@@ -10,28 +10,16 @@
 #include "DOMSVGLengthList.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsDebug.h"
 #include "nsTArray.h"
 #include "SVGLength.h"
 #include "mozilla/Attributes.h"
 #include "nsWrapperCache.h"
 
-// We make DOMSVGLength a pseudo-interface to allow us to QI to it in order to
-// check that the objects that scripts pass to DOMSVGLengthList methods are our
-// *native* length objects.
-//
-// {A8468350-7F7B-4976-9A7E-3765A1DADF9A}
-#define MOZILLA_DOMSVGLENGTH_IID                     \
-  {                                                  \
-    0xA8468350, 0x7F7B, 0x4976, {                    \
-      0x9A, 0x7E, 0x37, 0x65, 0xA1, 0xDA, 0xDF, 0x9A \
-    }                                                \
-  }
-
 #define MOZ_SVG_LIST_INDEX_BIT_COUNT 22  // supports > 4 million list items
 
 namespace mozilla {
 
 class ErrorResult;
 
 namespace dom {
 class SVGElement;
@@ -73,32 +61,31 @@ class SVGElement;
  * type can find their corresponding internal SVGLength.
  *
  * To use these classes for <length> attributes as well as <list-of-length>
  * attributes, we would need to take a bit from mListIndex and use that to
  * indicate whether the object belongs to a list or non-list attribute, then
  * if-else as appropriate. The bug for doing that work is:
  * https://bugzilla.mozilla.org/show_bug.cgi?id=571734
  */
-class DOMSVGLength final : public nsISupports, public nsWrapperCache {
+class DOMSVGLength final : public nsWrapperCache {
   friend class AutoChangeLengthNotifier;
 
   /**
    * Ctor for creating the object returned by
    * SVGAnimatedLength::ToDOMBaseVal/ToDOMAnimVal
    */
   DOMSVGLength(SVGAnimatedLength* aVal, dom::SVGElement* aSVGElement,
                bool aAnimVal);
 
   ~DOMSVGLength();
 
  public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOMSVGLENGTH_IID)
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGLength)
+  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGLength)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGLength)
 
   /**
    * Generic ctor for DOMSVGLength objects that are created for an attribute.
    */
   DOMSVGLength(DOMSVGLengthList* aList, uint8_t aAttrEnum, uint32_t aListIndex,
                bool aIsAnimValItem);
 
   /**
@@ -228,16 +215,14 @@ class DOMSVGLength final : public nsISup
                        // vh, wm, calc + future additions)
   float mValue;
 
   // The following members are only used when we have an SVGAnimatedLength
   SVGAnimatedLength* mVal;  // kept alive because it belongs to mSVGElement
   RefPtr<dom::SVGElement> mSVGElement;
 };
 
-NS_DEFINE_STATIC_IID_ACCESSOR(DOMSVGLength, MOZILLA_DOMSVGLENGTH_IID)
-
 }  // namespace dom
 }  // namespace mozilla
 
 #undef MOZ_SVG_LIST_INDEX_BIT_COUNT
 
 #endif  // DOM_SVG_DOMSVGLENGTH_H_
--- a/dom/svg/DOMSVGLengthList.cpp
+++ b/dom/svg/DOMSVGLengthList.cpp
@@ -6,17 +6,16 @@
 
 #include "DOMSVGLengthList.h"
 
 #include "SVGElement.h"
 #include "DOMSVGLength.h"
 #include "mozAutoDocUpdate.h"
 #include "nsError.h"
 #include "SVGAnimatedLengthList.h"
-#include "nsCOMPtr.h"
 #include "mozilla/dom/SVGLengthListBinding.h"
 #include <algorithm>
 
 // See the comment in this file's header.
 
 // local helper functions
 namespace {
 
@@ -316,17 +315,17 @@ already_AddRefed<DOMSVGLength> DOMSVGLen
 
   AutoChangeLengthListNotifier notifier(this);
   // Now that we know we're removing, keep animVal list in sync as necessary.
   // Do this *before* touching InternalList() so the removed item can get its
   // internal value.
   MaybeRemoveItemFromAnimValListAt(index);
 
   // We have to return the removed item, so get it, creating it if necessary:
-  nsCOMPtr<DOMSVGLength> result = GetItemAt(index);
+  RefPtr<DOMSVGLength> result = GetItemAt(index);
 
   // Notify the DOM item of removal *before* modifying the lists so that the
   // DOM item can copy its *old* value:
   mItems[index]->RemovingFromList();
 
   InternalList().RemoveItem(index);
   mItems.RemoveElementAt(index);
 
--- a/dom/svg/DOMSVGNumber.cpp
+++ b/dom/svg/DOMSVGNumber.cpp
@@ -38,23 +38,18 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(DOMSVGNumber)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mList)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mParent)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(DOMSVGNumber)
   NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
 NS_IMPL_CYCLE_COLLECTION_TRACE_END
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGNumber)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGNumber)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGNumber)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
+NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGNumber, AddRef)
+NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGNumber, Release)
 
 //----------------------------------------------------------------------
 // Helper class: AutoChangeNumberNotifier
 // Stack-based helper class to pair calls to WillChangeNumberList and
 // DidChangeNumberList.
 class MOZ_RAII AutoChangeNumberNotifier : public mozAutoDocUpdate {
  public:
   explicit AutoChangeNumberNotifier(DOMSVGNumber* aNumber)
--- a/dom/svg/DOMSVGNumber.h
+++ b/dom/svg/DOMSVGNumber.h
@@ -32,31 +32,31 @@ class SVGSVGElement;
  * SVGSVGElement.createSVGNumber().
  *
  * For the DOM wrapper classes for non-list SVGNumber, see SVGAnimatedNumber.h.
  *
  * See the architecture comment in DOMSVGAnimatedNumberList.h.
  *
  * See the comment in DOMSVGLength.h (yes, LENGTH), which applies here too.
  */
-class DOMSVGNumber final : public nsISupports, public nsWrapperCache {
+class DOMSVGNumber final : public nsWrapperCache {
   friend class AutoChangeNumberNotifier;
 
   ~DOMSVGNumber() {
     // Our mList's weak ref to us must be nulled out when we die. If GC has
     // unlinked us using the cycle collector code, then that has already
     // happened, and mList is null.
     if (mList) {
       mList->mItems[mListIndex] = nullptr;
     }
   }
 
  public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGNumber)
+  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGNumber)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGNumber)
 
   /**
    * Generic ctor for DOMSVGNumber objects that are created for an attribute.
    */
   DOMSVGNumber(DOMSVGNumberList* aList, uint8_t aAttrEnum, uint32_t aListIndex,
                bool aIsAnimValItem);
 
   /**
--- a/dom/svg/SVGAnimatedPreserveAspectRatio.cpp
+++ b/dom/svg/SVGAnimatedPreserveAspectRatio.cpp
@@ -19,23 +19,19 @@ using namespace mozilla::dom;
 
 namespace mozilla {
 
 ////////////////////////////////////////////////////////////////////////
 // SVGAnimatedPreserveAspectRatio class
 NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(
     DOMSVGAnimatedPreserveAspectRatio, mSVGElement)
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGAnimatedPreserveAspectRatio)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGAnimatedPreserveAspectRatio)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGAnimatedPreserveAspectRatio)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
+NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGAnimatedPreserveAspectRatio, AddRef)
+NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGAnimatedPreserveAspectRatio,
+                                       Release)
 
 JSObject* DOMSVGAnimatedPreserveAspectRatio::WrapObject(
     JSContext* aCx, JS::Handle<JSObject*> aGivenProto) {
   return SVGAnimatedPreserveAspectRatio_Binding::Wrap(aCx, this, aGivenProto);
 }
 
 /* Implementation */
 
--- a/dom/svg/SVGAnimatedPreserveAspectRatio.h
+++ b/dom/svg/SVGAnimatedPreserveAspectRatio.h
@@ -98,22 +98,22 @@ class SVGAnimatedPreserveAspectRatio fin
         SMILValue& aValue, bool& aPreventCachingOfSandwich) const override;
     virtual SMILValue GetBaseValue() const override;
     virtual void ClearAnimValue() override;
     virtual nsresult SetAnimValue(const SMILValue& aValue) override;
   };
 };
 
 namespace dom {
-class DOMSVGAnimatedPreserveAspectRatio final : public nsISupports,
-                                                public nsWrapperCache {
+class DOMSVGAnimatedPreserveAspectRatio final : public nsWrapperCache {
   ~DOMSVGAnimatedPreserveAspectRatio();
 
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(
+  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(
+      DOMSVGAnimatedPreserveAspectRatio)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(
       DOMSVGAnimatedPreserveAspectRatio)
 
   DOMSVGAnimatedPreserveAspectRatio(SVGAnimatedPreserveAspectRatio* aVal,
                                     dom::SVGElement* aSVGElement)
       : mVal(aVal), mSVGElement(aSVGElement) {}
 
   // WebIDL
   dom::SVGElement* GetParentObject() const { return mSVGElement; }
--- a/dom/svg/SVGPreserveAspectRatio.cpp
+++ b/dom/svg/SVGPreserveAspectRatio.cpp
@@ -14,23 +14,18 @@
 using namespace mozilla::dom;
 using namespace mozilla::dom::SVGPreserveAspectRatio_Binding;
 
 namespace mozilla {
 
 NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGPreserveAspectRatio,
                                                mSVGElement)
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(DOMSVGPreserveAspectRatio)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(DOMSVGPreserveAspectRatio)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMSVGPreserveAspectRatio)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
+NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(DOMSVGPreserveAspectRatio, AddRef)
+NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(DOMSVGPreserveAspectRatio, Release)
 
 static const char* sAlignStrings[] = {
     "none",     "xMinYMin", "xMidYMin", "xMaxYMin", "xMinYMid",
     "xMidYMid", "xMaxYMid", "xMinYMax", "xMidYMax", "xMaxYMax"};
 
 static const char* sMeetOrSliceStrings[] = {"meet", "slice"};
 
 static uint16_t GetAlignForString(const nsAString& aAlignString) {
--- a/dom/svg/SVGPreserveAspectRatio.h
+++ b/dom/svg/SVGPreserveAspectRatio.h
@@ -76,21 +76,20 @@ class SVGPreserveAspectRatio final {
  private:
   // We can't use enum types here because some compilers fail to pack them.
   uint8_t mAlign;
   uint8_t mMeetOrSlice;
 };
 
 namespace dom {
 
-class DOMSVGPreserveAspectRatio final : public nsISupports,
-                                        public nsWrapperCache {
+class DOMSVGPreserveAspectRatio final : public nsWrapperCache {
  public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGPreserveAspectRatio)
+  NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGPreserveAspectRatio)
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGPreserveAspectRatio)
 
   DOMSVGPreserveAspectRatio(SVGAnimatedPreserveAspectRatio* aVal,
                             SVGElement* aSVGElement, bool aIsBaseValue)
       : mVal(aVal), mSVGElement(aSVGElement), mIsBaseValue(aIsBaseValue) {}
 
   // WebIDL
   SVGElement* GetParentObject() const { return mSVGElement; }
   virtual JSObject* WrapObject(JSContext* aCx,