Bug 1436902 part 3. Replace usage of NS_IMPL_ISUPPORTS_INHERITED0 with NS_INLINE_DECL_REFCOUNTING_INHERITED when possible. r=mccr8
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 12 Feb 2018 15:44:40 -0500
changeset 754314 91d647c847e56cb0db2be19647507cec207b1d08
parent 754313 606c47199b309415485694446b5ccf99d6ee0350
child 754315 f9e3ae4647ac24614cd7086ac05de1e15a26dfc2
push id98819
push userxquan@mozilla.com
push dateTue, 13 Feb 2018 06:24:37 +0000
reviewersmccr8
bugs1436902, 741707
milestone60.0a1
Bug 1436902 part 3. Replace usage of NS_IMPL_ISUPPORTS_INHERITED0 with NS_INLINE_DECL_REFCOUNTING_INHERITED when possible. r=mccr8 The change to RootAccessible.cpp fixes an obvious bug introduced in bug 741707. The visibility changes in gfx/thebes are because NS_DECL_ISUPPORTS has a trailing "public:" that those classes were relying on to have public constructors. MozReview-Commit-ID: IeB8KIJCGhU
accessible/generic/ARIAGridAccessible.cpp
accessible/generic/ARIAGridAccessible.h
accessible/generic/ApplicationAccessible.cpp
accessible/generic/ApplicationAccessible.h
accessible/generic/BaseAccessibles.cpp
accessible/generic/BaseAccessibles.h
accessible/generic/HyperTextAccessible.cpp
accessible/generic/HyperTextAccessible.h
accessible/generic/OuterDocAccessible.cpp
accessible/generic/OuterDocAccessible.h
accessible/generic/RootAccessible.cpp
accessible/html/HTMLCanvasAccessible.cpp
accessible/html/HTMLCanvasAccessible.h
accessible/html/HTMLElementAccessibles.cpp
accessible/html/HTMLElementAccessibles.h
accessible/html/HTMLFormControlAccessible.cpp
accessible/html/HTMLFormControlAccessible.h
accessible/html/HTMLImageMapAccessible.cpp
accessible/html/HTMLImageMapAccessible.h
accessible/html/HTMLLinkAccessible.cpp
accessible/html/HTMLLinkAccessible.h
accessible/html/HTMLListAccessible.cpp
accessible/html/HTMLListAccessible.h
accessible/html/HTMLTableAccessible.cpp
accessible/html/HTMLTableAccessible.h
accessible/windows/msaa/ARIAGridAccessibleWrap.h
accessible/xul/XULAlertAccessible.cpp
accessible/xul/XULAlertAccessible.h
accessible/xul/XULFormControlAccessible.cpp
accessible/xul/XULFormControlAccessible.h
accessible/xul/XULListboxAccessible.cpp
accessible/xul/XULListboxAccessible.h
dom/asmjscache/AsmJSCache.cpp
dom/base/IDTracker.h
dom/base/ImageEncoder.cpp
dom/file/EmptyBlobImpl.cpp
dom/file/EmptyBlobImpl.h
dom/file/FileBlobImpl.cpp
dom/file/FileBlobImpl.h
dom/file/MemoryBlobImpl.cpp
dom/file/MemoryBlobImpl.h
dom/file/MultipartBlobImpl.cpp
dom/file/MultipartBlobImpl.h
dom/file/MutableBlobStorage.cpp
dom/html/HTMLBodyElement.cpp
dom/html/HTMLBodyElement.h
dom/html/HTMLFrameElement.cpp
dom/html/HTMLFrameElement.h
dom/html/HTMLFrameSetElement.cpp
dom/html/HTMLFrameSetElement.h
dom/html/HTMLHRElement.cpp
dom/html/HTMLHRElement.h
dom/html/HTMLIFrameElement.cpp
dom/html/HTMLIFrameElement.h
dom/html/HTMLLIElement.cpp
dom/html/HTMLLIElement.h
dom/html/HTMLLabelElement.cpp
dom/html/HTMLLabelElement.h
dom/html/HTMLMenuElement.cpp
dom/html/HTMLMenuElement.h
dom/html/HTMLMenuItemElement.cpp
dom/html/HTMLMenuItemElement.h
dom/html/HTMLMetaElement.cpp
dom/html/HTMLMetaElement.h
dom/html/HTMLOptGroupElement.cpp
dom/html/HTMLOptGroupElement.h
dom/html/HTMLOptionElement.cpp
dom/html/HTMLOptionElement.h
dom/html/HTMLParagraphElement.cpp
dom/html/HTMLParagraphElement.h
dom/html/HTMLPictureElement.cpp
dom/html/HTMLPictureElement.h
dom/html/HTMLPreElement.cpp
dom/html/HTMLPreElement.h
dom/html/HTMLTableCellElement.cpp
dom/html/HTMLTableCellElement.h
dom/indexedDB/ActorsParent.cpp
dom/indexedDB/FileInfo.cpp
dom/indexedDB/FileSnapshot.cpp
dom/indexedDB/IDBKeyRange.cpp
dom/indexedDB/IDBKeyRange.h
dom/media/MediaRecorder.cpp
dom/media/webaudio/AnalyserNode.cpp
dom/media/webaudio/AnalyserNode.h
dom/media/webaudio/ChannelMergerNode.cpp
dom/media/webaudio/ChannelMergerNode.h
dom/media/webaudio/ChannelSplitterNode.cpp
dom/media/webaudio/ChannelSplitterNode.h
dom/media/webaudio/IIRFilterNode.cpp
dom/media/webaudio/IIRFilterNode.h
dom/media/webaudio/ScriptProcessorNode.cpp
dom/media/webaudio/ScriptProcessorNode.h
dom/notification/Notification.cpp
dom/presentation/PresentationCallbacks.cpp
dom/presentation/PresentationCallbacks.h
dom/presentation/PresentationTransportBuilderConstructor.cpp
dom/presentation/PresentationTransportBuilderConstructor.h
dom/quota/ActorsParent.cpp
dom/quota/FileStreams.cpp
dom/quota/FileStreams.h
dom/workers/RuntimeService.cpp
dom/workers/WorkerLoadInfo.cpp
dom/workers/WorkerPrivate.cpp
dom/workers/WorkerRunnable.cpp
dom/workers/WorkerRunnable.h
dom/workers/WorkerThread.cpp
dom/workers/WorkerThread.h
editor/composer/nsComposerCommands.cpp
editor/composer/nsComposerCommands.h
gfx/thebes/gfxFontInfoLoader.cpp
gfx/thebes/gfxPlatform.cpp
image/ClippedImage.cpp
image/ClippedImage.h
image/FrozenImage.cpp
image/FrozenImage.h
image/MultipartImage.h
image/OrientedImage.cpp
image/OrientedImage.h
netwerk/cache2/AppCacheStorage.cpp
netwerk/cache2/AppCacheStorage.h
netwerk/protocol/file/nsFileChannel.cpp
toolkit/components/places/Shutdown.cpp
toolkit/components/places/Shutdown.h
widget/android/AndroidUiThread.cpp
widget/android/nsIdleServiceAndroid.cpp
widget/android/nsIdleServiceAndroid.h
widget/android/nsWindow.cpp
widget/android/nsWindow.h
widget/cocoa/nsIdleServiceX.h
widget/cocoa/nsIdleServiceX.mm
widget/gtk/nsIdleServiceGTK.cpp
widget/gtk/nsIdleServiceGTK.h
widget/gtk/nsWindow.cpp
widget/gtk/nsWindow.h
widget/headless/HeadlessWidget.cpp
widget/headless/HeadlessWidget.h
widget/nsDragServiceProxy.cpp
widget/nsDragServiceProxy.h
widget/uikit/nsWindow.h
widget/uikit/nsWindow.mm
widget/windows/nsIdleServiceWin.cpp
widget/windows/nsIdleServiceWin.h
widget/windows/nsWindow.cpp
widget/windows/nsWindow.h
xpcom/base/nsISupportsImpl.h
--- a/accessible/generic/ARIAGridAccessible.cpp
+++ b/accessible/generic/ARIAGridAccessible.cpp
@@ -27,18 +27,16 @@ using namespace mozilla::a11y;
 // Constructor
 
 ARIAGridAccessible::
   ARIAGridAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   AccessibleWrap(aContent, aDoc)
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(ARIAGridAccessible, Accessible)
-
 ////////////////////////////////////////////////////////////////////////////////
 // Table
 
 uint32_t
 ARIAGridAccessible::ColCount()
 {
   AccIterator rowIter(this, filters::GetRow);
   Accessible* row = rowIter.Next();
@@ -538,18 +536,16 @@ ARIAGridAccessible::SetARIASelected(Acce
 
 ARIARowAccessible::
   ARIARowAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   AccessibleWrap(aContent, aDoc)
 {
   mGenericTypes |= eTableRow;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(ARIARowAccessible, Accessible)
-
 GroupPos
 ARIARowAccessible::GroupPosition()
 {
   int32_t count = 0, index = 0;
   Accessible* table = nsAccUtils::TableFor(this);
   if (table && nsCoreUtils::GetUIntAttr(table->GetContent(),
                                         nsGkAtoms::aria_rowcount, &count) &&
       nsCoreUtils::GetUIntAttr(mContent, nsGkAtoms::aria_rowindex, &index)) {
@@ -570,18 +566,16 @@ ARIARowAccessible::GroupPosition()
 
 ARIAGridCellAccessible::
   ARIAGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   HyperTextAccessibleWrap(aContent, aDoc)
 {
   mGenericTypes |= eTableCell;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(ARIAGridCellAccessible, HyperTextAccessible)
-
 ////////////////////////////////////////////////////////////////////////////////
 // TableCell
 
 TableAccessible*
 ARIAGridCellAccessible::Table() const
 {
   Accessible* table = nsAccUtils::TableFor(Row());
   return table ? table->AsTable() : nullptr;
--- a/accessible/generic/ARIAGridAccessible.h
+++ b/accessible/generic/ARIAGridAccessible.h
@@ -17,17 +17,17 @@ namespace a11y {
  * Accessible for ARIA grid and treegrid.
  */
 class ARIAGridAccessible : public AccessibleWrap,
                            public TableAccessible
 {
 public:
   ARIAGridAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(ARIAGridAccessible, AccessibleWrap)
 
   // Accessible
   virtual TableAccessible* AsTable() override { return this; }
 
   // TableAccessible
   virtual uint32_t ColCount() override;
   virtual uint32_t RowCount() override;
   virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex) override;
@@ -76,17 +76,17 @@ protected:
 /**
  * Accessible for ARIA row.
  */
 class ARIARowAccessible : public AccessibleWrap
 {
 public:
   ARIARowAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(ARIARowAccessible, AccessibleWrap)
 
   // Accessible
   virtual mozilla::a11y::GroupPos GroupPosition() override;
 
 protected:
   virtual ~ARIARowAccessible() {}
 };
 
@@ -95,17 +95,18 @@ protected:
  * Accessible for ARIA gridcell and rowheader/columnheader.
  */
 class ARIAGridCellAccessible : public HyperTextAccessibleWrap,
                                public TableCellAccessible
 {
 public:
   ARIAGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(ARIAGridCellAccessible,
+                                       HyperTextAccessibleWrap)
 
   // Accessible
   virtual TableCellAccessible* AsTableCell() override { return this; }
   virtual void ApplyARIAState(uint64_t* aState) const override;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
   virtual mozilla::a11y::GroupPos GroupPosition() override;
 
 protected:
--- a/accessible/generic/ApplicationAccessible.cpp
+++ b/accessible/generic/ApplicationAccessible.cpp
@@ -26,18 +26,16 @@ using namespace mozilla::a11y;
 ApplicationAccessible::ApplicationAccessible() :
   AccessibleWrap(nullptr, nullptr)
 {
   mType = eApplicationType;
   mAppInfo = do_GetService("@mozilla.org/xre/app-info;1");
   MOZ_ASSERT(mAppInfo, "no application info");
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(ApplicationAccessible, Accessible)
-
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
 ENameValueFlag
 ApplicationAccessible::Name(nsString& aName)
 {
   aName.Truncate();
 
--- a/accessible/generic/ApplicationAccessible.h
+++ b/accessible/generic/ApplicationAccessible.h
@@ -27,17 +27,17 @@ namespace a11y {
  */
 
 class ApplicationAccessible : public AccessibleWrap
 {
 public:
 
   ApplicationAccessible();
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(ApplicationAccessible, AccessibleWrap)
 
   // Accessible
   virtual void Shutdown() override;
   virtual nsIntRect Bounds() const override;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
   virtual GroupPos GroupPosition() override;
   virtual ENameValueFlag Name(nsString& aName) override;
   virtual void ApplyARIAState(uint64_t* aState) const override;
--- a/accessible/generic/BaseAccessibles.cpp
+++ b/accessible/generic/BaseAccessibles.cpp
@@ -22,18 +22,16 @@ using namespace mozilla::a11y;
 
 LeafAccessible::
   LeafAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   AccessibleWrap(aContent, aDoc)
 {
   mStateFlags |= eNoKidsFromDOM;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(LeafAccessible, Accessible)
-
 ////////////////////////////////////////////////////////////////////////////////
 // LeafAccessible: Accessible public
 
 Accessible*
 LeafAccessible::ChildAtPoint(int32_t aX, int32_t aY,
                              EWhichChildAtPoint aWhichChild)
 {
   // Don't walk into leaf accessibles.
@@ -61,18 +59,16 @@ LeafAccessible::IsAcceptableChild(nsICon
   return false;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // LinkableAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED0(LinkableAccessible, AccessibleWrap)
-
 ////////////////////////////////////////////////////////////////////////////////
 // LinkableAccessible. nsIAccessible
 
 void
 LinkableAccessible::TakeFocus()
 {
   if (Accessible* actionAcc = ActionWalk()) {
     actionAcc->TakeFocus();
--- a/accessible/generic/BaseAccessibles.h
+++ b/accessible/generic/BaseAccessibles.h
@@ -25,17 +25,17 @@ namespace a11y {
   */
 class LeafAccessible : public AccessibleWrap
 {
 public:
 
   LeafAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(LeafAccessible, AccessibleWrap)
 
   // Accessible
   virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
                                    EWhichChildAtPoint aWhichChild) override;
   virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild) override final;
   virtual bool RemoveChild(Accessible* aChild) override final;
 
   virtual bool IsAcceptableChild(nsIContent* aEl) const override;
@@ -55,17 +55,17 @@ class LinkableAccessible : public Access
 public:
   enum { eAction_Jump = 0 };
 
   LinkableAccessible(nsIContent* aContent, DocAccessible* aDoc) :
     AccessibleWrap(aContent, aDoc)
   {
   }
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(LinkableAccessible, AccessibleWrap)
 
   // Accessible
   virtual void Value(nsString& aValue) override;
   virtual uint64_t NativeLinkState() const override;
   virtual void TakeFocus() override;
 
   // ActionAccessible
   virtual uint8_t ActionCount() override;
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -51,18 +51,16 @@ using namespace mozilla::a11y;
 HyperTextAccessible::
   HyperTextAccessible(nsIContent* aNode, DocAccessible* aDoc) :
   AccessibleWrap(aNode, aDoc)
 {
   mType = eHyperTextType;
   mGenericTypes |= eHyperText;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HyperTextAccessible, Accessible)
-
 role
 HyperTextAccessible::NativeRole()
 {
   a11y::role r = GetAccService()->MarkupRole(mContent);
   if (r != roles::NOTHING)
     return r;
 
   nsIFrame* frame = GetFrame();
--- a/accessible/generic/HyperTextAccessible.h
+++ b/accessible/generic/HyperTextAccessible.h
@@ -46,17 +46,17 @@ const char16_t kForcedNewLineChar = '\n'
 /**
   * Special Accessible that knows how contain both text and embedded objects
   */
 class HyperTextAccessible : public AccessibleWrap
 {
 public:
   HyperTextAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HyperTextAccessible, AccessibleWrap)
 
   // Accessible
   virtual nsAtom* LandmarkRole() const override;
   virtual int32_t GetLevelInternal() override;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
   virtual mozilla::a11y::role NativeRole() override;
   virtual uint64_t NativeState() override;
 
--- a/accessible/generic/OuterDocAccessible.cpp
+++ b/accessible/generic/OuterDocAccessible.cpp
@@ -46,22 +46,16 @@ OuterDocAccessible::
   }
 }
 
 OuterDocAccessible::~OuterDocAccessible()
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsISupports
-
-NS_IMPL_ISUPPORTS_INHERITED0(OuterDocAccessible,
-                             Accessible)
-
-////////////////////////////////////////////////////////////////////////////////
 // Accessible public (DON'T add methods here)
 
 role
 OuterDocAccessible::NativeRole()
 {
   return roles::INTERNAL_FRAME;
 }
 
--- a/accessible/generic/OuterDocAccessible.h
+++ b/accessible/generic/OuterDocAccessible.h
@@ -21,17 +21,17 @@ class DocAccessibleParent;
  * the inner document root.
  */
 
 class OuterDocAccessible final : public AccessibleWrap
 {
 public:
   OuterDocAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(OuterDocAccessible, AccessibleWrap)
 
   DocAccessibleParent* RemoteChildDoc() const;
 
   // Accessible
   virtual void Shutdown() override;
   virtual mozilla::a11y::role NativeRole() override;
   virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
                                    EWhichChildAtPoint aWhichChild) override;
--- a/accessible/generic/RootAccessible.cpp
+++ b/accessible/generic/RootAccessible.cpp
@@ -47,17 +47,17 @@
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 using namespace mozilla::dom;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupports
 
-NS_IMPL_ISUPPORTS_INHERITED0(RootAccessible, DocAccessible)
+NS_IMPL_ISUPPORTS_INHERITED(RootAccessible, DocAccessible, nsIDOMEventListener)
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor/destructor
 
 RootAccessible::
   RootAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell) :
   DocAccessibleWrap(aDocument, aPresShell)
 {
--- a/accessible/html/HTMLCanvasAccessible.cpp
+++ b/accessible/html/HTMLCanvasAccessible.cpp
@@ -10,15 +10,13 @@
 using namespace mozilla::a11y;
 
 HTMLCanvasAccessible::
   HTMLCanvasAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   HyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLCanvasAccessible, HyperTextAccessible)
-
 role
 HTMLCanvasAccessible::NativeRole()
 {
   return roles::CANVAS;
 }
--- a/accessible/html/HTMLCanvasAccessible.h
+++ b/accessible/html/HTMLCanvasAccessible.h
@@ -15,17 +15,18 @@ namespace a11y {
  * HTML canvas accessible (html:canvas).
  */
 class HTMLCanvasAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLCanvasAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLCanvasAccessible,
+                                       HyperTextAccessibleWrap)
 
   // Accessible
   virtual a11y::role NativeRole() override;
 
 protected:
   virtual ~HTMLCanvasAccessible() { }
 };
 
--- a/accessible/html/HTMLElementAccessibles.cpp
+++ b/accessible/html/HTMLElementAccessibles.cpp
@@ -51,18 +51,16 @@ HTMLBRAccessible::NativeName(nsString& a
   aName = static_cast<char16_t>('\n');    // Newline char
   return eNameOK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLLabelAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLLabelAccessible, HyperTextAccessible)
-
 ENameValueFlag
 HTMLLabelAccessible::NativeName(nsString& aName)
 {
   nsTextEquivUtils::GetNameFromSubtree(this, aName);
   return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
 }
 
 Relation
@@ -102,18 +100,16 @@ HTMLLabelAccessible::DoAction(uint8_t aI
   return true;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLOuputAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLOutputAccessible, HyperTextAccessible)
-
 Relation
 HTMLOutputAccessible::RelationByType(RelationType aType)
 {
   Relation rel = AccessibleWrap::RelationByType(aType);
   if (aType == RelationType::CONTROLLED_BY)
     rel.AppendIter(new IDRefsIterator(mDoc, mContent, nsGkAtoms::_for));
 
   return rel;
@@ -203,18 +199,16 @@ HTMLSummaryAccessible::IsWidget() const
   return true;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLHeaderOrFooterAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLHeaderOrFooterAccessible, HyperTextAccessible)
-
 role
 HTMLHeaderOrFooterAccessible::NativeRole()
 {
   // Only map header and footer if they are direct descendants of the body tag.
   // If other sectioning or sectioning root elements, they become sections.
   nsIContent* parent = mContent->GetParent();
   while (parent) {
     if (parent->IsAnyOfHTMLElements(nsGkAtoms::article, nsGkAtoms::aside,
--- a/accessible/html/HTMLElementAccessibles.h
+++ b/accessible/html/HTMLElementAccessibles.h
@@ -52,17 +52,18 @@ protected:
  */
 class HTMLLabelAccessible : public HyperTextAccessibleWrap
 {
 public:
 
   HTMLLabelAccessible(nsIContent* aContent, DocAccessible* aDoc) :
     HyperTextAccessibleWrap(aContent, aDoc) {}
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLLabelAccessible,
+                                       HyperTextAccessibleWrap)
 
   // Accessible
   virtual Relation RelationByType(RelationType aType) override;
 
   // ActionAccessible
   virtual uint8_t ActionCount() override;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
   virtual bool DoAction(uint8_t aIndex) override;
@@ -77,17 +78,18 @@ protected:
  */
 class HTMLOutputAccessible : public HyperTextAccessibleWrap
 {
 public:
 
   HTMLOutputAccessible(nsIContent* aContent, DocAccessible* aDoc) :
     HyperTextAccessibleWrap(aContent, aDoc) {}
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLOutputAccessible,
+                                       HyperTextAccessibleWrap)
 
   // Accessible
   virtual Relation RelationByType(RelationType aType) override;
 
 protected:
   virtual ~HTMLOutputAccessible() {}
 };
 
@@ -119,17 +121,18 @@ public:
  */
 class HTMLHeaderOrFooterAccessible : public HyperTextAccessibleWrap
 {
 public:
 
   HTMLHeaderOrFooterAccessible(nsIContent* aContent, DocAccessible* aDoc) :
     HyperTextAccessibleWrap(aContent, aDoc) {}
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLHeaderOrFooterAccessible,
+                                       HyperTextAccessibleWrap)
 
   // Accessible
   virtual nsAtom* LandmarkRole() const override;
   virtual a11y::role NativeRole() override;
 
 protected:
   virtual ~HTMLHeaderOrFooterAccessible() {}
 };
--- a/accessible/html/HTMLFormControlAccessible.cpp
+++ b/accessible/html/HTMLFormControlAccessible.cpp
@@ -280,19 +280,16 @@ HTMLButtonAccessible::IsWidget() const
 
 HTMLTextFieldAccessible::
   HTMLTextFieldAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   HyperTextAccessibleWrap(aContent, aDoc)
 {
   mType = eHTMLTextFieldType;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLTextFieldAccessible,
-                             HyperTextAccessible)
-
 role
 HTMLTextFieldAccessible::NativeRole()
 {
   if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                                          nsGkAtoms::password, eIgnoreCase)) {
     return roles::PASSWORD_TEXT;
   }
 
--- a/accessible/html/HTMLFormControlAccessible.h
+++ b/accessible/html/HTMLFormControlAccessible.h
@@ -109,17 +109,18 @@ protected:
 class HTMLTextFieldAccessible final : public HyperTextAccessibleWrap
 {
 
 public:
   enum { eAction_Click = 0 };
 
   HTMLTextFieldAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLTextFieldAccessible,
+                                       HyperTextAccessibleWrap)
 
   // HyperTextAccessible
   virtual already_AddRefed<TextEditor> GetEditor() const override;
 
   // Accessible
   virtual void Value(nsString& aValue) override;
   virtual void ApplyARIAState(uint64_t* aState) const override;
   virtual mozilla::a11y::role NativeRole() override;
--- a/accessible/html/HTMLImageMapAccessible.cpp
+++ b/accessible/html/HTMLImageMapAccessible.cpp
@@ -29,21 +29,16 @@ HTMLImageMapAccessible::
   ImageAccessibleWrap(aContent, aDoc)
 {
   mType = eImageMapType;
 
   UpdateChildAreas(false);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-// HTMLImageMapAccessible: nsISupports
-
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLImageMapAccessible, ImageAccessible)
-
-////////////////////////////////////////////////////////////////////////////////
 // HTMLImageMapAccessible: Accessible public
 
 role
 HTMLImageMapAccessible::NativeRole()
 {
   return roles::IMAGE_MAP;
 }
 
--- a/accessible/html/HTMLImageMapAccessible.h
+++ b/accessible/html/HTMLImageMapAccessible.h
@@ -16,17 +16,18 @@ namespace a11y {
  * Used for HTML image maps.
  */
 class HTMLImageMapAccessible final : public ImageAccessibleWrap
 {
 public:
   HTMLImageMapAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports and cycle collector
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLImageMapAccessible,
+                                       ImageAccessibleWrap)
 
   // Accessible
   virtual a11y::role NativeRole() override;
 
   // HyperLinkAccessible
   virtual uint32_t AnchorCount() override;
   virtual Accessible* AnchorAt(uint32_t aAnchorIndex) override;
   virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex) override;
--- a/accessible/html/HTMLLinkAccessible.cpp
+++ b/accessible/html/HTMLLinkAccessible.cpp
@@ -22,18 +22,16 @@ using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLLinkAccessible::
   HTMLLinkAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   HyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLLinkAccessible, HyperTextAccessible)
-
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
 role
 HTMLLinkAccessible::NativeRole()
 {
   return roles::LINK;
 }
--- a/accessible/html/HTMLLinkAccessible.h
+++ b/accessible/html/HTMLLinkAccessible.h
@@ -11,17 +11,18 @@
 namespace mozilla {
 namespace a11y {
 
 class HTMLLinkAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLLinkAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLLinkAccessible,
+                                       HyperTextAccessibleWrap)
 
   // Accessible
   virtual void Value(nsString& aValue) override;
   virtual a11y::role NativeRole() override;
   virtual uint64_t NativeState() override;
   virtual uint64_t NativeLinkState() const override;
   virtual uint64_t NativeInteractiveState() const override;
 
--- a/accessible/html/HTMLListAccessible.cpp
+++ b/accessible/html/HTMLListAccessible.cpp
@@ -16,18 +16,16 @@
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLListAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLListAccessible, HyperTextAccessible)
-
 role
 HTMLListAccessible::NativeRole()
 {
   a11y::role r = GetAccService()->MarkupRole(mContent);
   return r != roles::NOTHING ? r : roles::LIST;
 }
 
 uint64_t
@@ -50,18 +48,16 @@ HTMLLIAccessible::
   nsBlockFrame* blockFrame = do_QueryFrame(GetFrame());
   if (blockFrame && blockFrame->HasBullet()) {
     mBullet = new HTMLListBulletAccessible(mContent, mDoc);
     Document()->BindToDocument(mBullet, nullptr);
     AppendChild(mBullet);
   }
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLLIAccessible, HyperTextAccessible)
-
 void
 HTMLLIAccessible::Shutdown()
 {
   mBullet = nullptr;
 
   HyperTextAccessibleWrap::Shutdown();
 }
 
--- a/accessible/html/HTMLListAccessible.h
+++ b/accessible/html/HTMLListAccessible.h
@@ -20,17 +20,18 @@ class HTMLListBulletAccessible;
  */
 class HTMLListAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLListAccessible(nsIContent* aContent, DocAccessible* aDoc) :
     HyperTextAccessibleWrap(aContent, aDoc) { mGenericTypes |= eList; }
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLListAccessible,
+                                       HyperTextAccessibleWrap)
 
   // Accessible
   virtual a11y::role NativeRole() override;
   virtual uint64_t NativeState() override;
 
 protected:
   virtual ~HTMLListAccessible() { }
 };
@@ -40,17 +41,18 @@ protected:
  * Used for HTML list item (e.g. HTML li).
  */
 class HTMLLIAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLLIAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLLIAccessible,
+                                       HyperTextAccessibleWrap)
 
   // Accessible
   virtual void Shutdown() override;
   virtual nsIntRect Bounds() const override;
   virtual a11y::role NativeRole() override;
   virtual uint64_t NativeState() override;
 
   virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild) override;
--- a/accessible/html/HTMLTableAccessible.cpp
+++ b/accessible/html/HTMLTableAccessible.cpp
@@ -47,18 +47,16 @@ using namespace mozilla::a11y;
 HTMLTableCellAccessible::
   HTMLTableCellAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   HyperTextAccessibleWrap(aContent, aDoc)
 {
   mType = eHTMLTableCellType;
   mGenericTypes |= eTableCell;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLTableCellAccessible, HyperTextAccessible)
-
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLTableCellAccessible: Accessible implementation
 
 role
 HTMLTableCellAccessible::NativeRole()
 {
   if (mContent->IsMathMLElement(nsGkAtoms::mtd_)) {
     return roles::MATHML_CELL;
@@ -352,18 +350,16 @@ HTMLTableHeaderCellAccessible::NativeRol
   return rowExtent > 1 ? roles::ROWHEADER : roles::COLUMNHEADER;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLTableRowAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLTableRowAccessible, Accessible)
-
 role
 HTMLTableRowAccessible::NativeRole()
 {
   if (mContent->IsMathMLElement(nsGkAtoms::mtr_)) {
     return roles::MATHML_TABLE_ROW;
   } else if (mContent->IsMathMLElement(nsGkAtoms::mlabeledtr_)) {
     return roles::MATHML_LABELED_ROW;
   }
@@ -383,18 +379,16 @@ HTMLTableRowAccessible::GroupPosition()
 
   return AccessibleWrap::GroupPosition();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLTableAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLTableAccessible, Accessible)
-
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLTableAccessible: Accessible
 
 bool
 HTMLTableAccessible::InsertChildAt(uint32_t aIndex, Accessible* aChild)
 {
   // Move caption accessible so that it's the first child. Check for the first
   // caption only, because nsAccessibilityService ensures we don't create
--- a/accessible/html/HTMLTableAccessible.h
+++ b/accessible/html/HTMLTableAccessible.h
@@ -21,17 +21,18 @@ namespace a11y {
  */
 class HTMLTableCellAccessible : public HyperTextAccessibleWrap,
                                 public TableCellAccessible
 {
 public:
   HTMLTableCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLTableCellAccessible,
+                                       HyperTextAccessibleWrap)
 
   // Accessible
   virtual TableCellAccessible* AsTableCell() override { return this; }
   virtual a11y::role NativeRole() override;
   virtual uint64_t NativeState() override;
   virtual uint64_t NativeInteractiveState() const override;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
   virtual mozilla::a11y::GroupPos GroupPosition() override;
@@ -87,17 +88,17 @@ class HTMLTableRowAccessible : public Ac
 public:
   HTMLTableRowAccessible(nsIContent* aContent, DocAccessible* aDoc) :
     AccessibleWrap(aContent, aDoc)
   {
     mType = eHTMLTableRowType;
     mGenericTypes |= eTableRow;
   }
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLTableRowAccessible, AccessibleWrap)
 
   // Accessible
   virtual a11y::role NativeRole() override;
   virtual mozilla::a11y::GroupPos GroupPosition() override;
 
 protected:
   virtual ~HTMLTableRowAccessible() { }
 };
@@ -118,17 +119,17 @@ class HTMLTableAccessible : public Acces
 public:
   HTMLTableAccessible(nsIContent* aContent, DocAccessible* aDoc) :
     AccessibleWrap(aContent, aDoc)
   {
     mType = eHTMLTableType;
     mGenericTypes |= eTable;
   }
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLTableAccessible, AccessibleWrap)
 
   // TableAccessible
   virtual Accessible* Caption() const override;
   virtual void Summary(nsString& aSummary) override;
   virtual uint32_t ColCount() override;
   virtual uint32_t RowCount() override;
   virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex) override;
   virtual int32_t CellIndexAt(uint32_t aRowIdx, uint32_t aColIdx) override;
--- a/accessible/windows/msaa/ARIAGridAccessibleWrap.h
+++ b/accessible/windows/msaa/ARIAGridAccessibleWrap.h
@@ -27,16 +27,18 @@ class ARIAGridAccessibleWrap : public AR
 public:
   ARIAGridAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
     ARIAGridAccessible(aContent, aDoc), ia2AccessibleTable(this) {}
 
   // IUnknown
   DECL_IUNKNOWN_INHERITED
 
   // nsISupports
+  // Need to declare addref/release here unconditionally, because
+  // ia2AccessibleTable has pure-virtual refcounting.
   NS_DECL_ISUPPORTS_INHERITED
 
   virtual void Shutdown() override;
 };
 
 /**
  * IA2 wrapper class for ARIAGridCellAccessible implementing
  * IAccessibleTableCell interface.
@@ -49,16 +51,18 @@ class ARIAGridCellAccessibleWrap : publi
 public:
   ARIAGridCellAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
     ARIAGridCellAccessible(aContent, aDoc), ia2AccessibleTableCell(this) {}
 
   // IUnknown
   DECL_IUNKNOWN_INHERITED
 
   // nsISupports
+  // Need to declare addref/release here unconditionally, because
+  // ia2AccessibleTable has pure-virtual refcounting.
   NS_DECL_ISUPPORTS_INHERITED
 
   virtual void Shutdown() override;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
--- a/accessible/xul/XULAlertAccessible.cpp
+++ b/accessible/xul/XULAlertAccessible.cpp
@@ -21,18 +21,16 @@ XULAlertAccessible::
 {
   mGenericTypes |= eAlert;
 }
 
 XULAlertAccessible::~XULAlertAccessible()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(XULAlertAccessible, Accessible)
-
 role
 XULAlertAccessible::NativeRole()
 {
   return roles::ALERT;
 }
 
 uint64_t
 XULAlertAccessible::NativeState()
--- a/accessible/xul/XULAlertAccessible.h
+++ b/accessible/xul/XULAlertAccessible.h
@@ -15,17 +15,17 @@ namespace a11y {
  * Accessible for supporting XUL alerts.
  */
 
 class XULAlertAccessible : public AccessibleWrap
 {
 public:
   XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(XULAlertAccessible, AccessibleWrap)
 
   // Accessible
   virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) override;
   virtual a11y::role NativeRole() override;
   virtual uint64_t NativeState() override;
 
   // Widgets
   virtual bool IsWidget() const override;
--- a/accessible/xul/XULFormControlAccessible.cpp
+++ b/accessible/xul/XULFormControlAccessible.cpp
@@ -49,18 +49,16 @@ XULButtonAccessible::
 
 XULButtonAccessible::~XULButtonAccessible()
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULButtonAccessible: nsISupports
 
-NS_IMPL_ISUPPORTS_INHERITED0(XULButtonAccessible, Accessible)
-
 ////////////////////////////////////////////////////////////////////////////////
 // XULButtonAccessible: nsIAccessible
 
 uint8_t
 XULButtonAccessible::ActionCount()
 {
   return 1;
 }
--- a/accessible/xul/XULFormControlAccessible.h
+++ b/accessible/xul/XULFormControlAccessible.h
@@ -28,17 +28,17 @@ typedef ProgressMeterAccessible<100> XUL
  */
 class XULButtonAccessible : public AccessibleWrap
 {
 public:
   enum { eAction_Click = 0 };
   XULButtonAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(XULButtonAccessible, AccessibleWrap)
 
   // Accessible
   virtual mozilla::a11y::role NativeRole() override;
   virtual uint64_t NativeState() override;
 
   // ActionAccessible
   virtual uint8_t ActionCount() override;
   virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override;
--- a/accessible/xul/XULListboxAccessible.cpp
+++ b/accessible/xul/XULListboxAccessible.cpp
@@ -546,18 +546,16 @@ XULListitemAccessible::
   // base XULMenuitemAccessible class.
   mStateFlags &= ~eNoXBLKids;
 }
 
 XULListitemAccessible::~XULListitemAccessible()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(XULListitemAccessible, Accessible)
-
 Accessible*
 XULListitemAccessible::GetListAccessible() const
 {
   if (IsDefunct())
     return nullptr;
 
   nsCOMPtr<nsIDOMXULSelectControlItemElement> listItem =
     do_QueryInterface(mContent);
@@ -688,19 +686,16 @@ XULListCellAccessible::
   HyperTextAccessibleWrap(aContent, aDoc)
 {
   mGenericTypes |= eTableCell;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupports
 
-NS_IMPL_ISUPPORTS_INHERITED0(XULListCellAccessible,
-                             HyperTextAccessible)
-
 ////////////////////////////////////////////////////////////////////////////////
 // XULListCellAccessible: TableCell
 
 TableAccessible*
 XULListCellAccessible::Table() const
 {
   Accessible* thisRow = Parent();
   if (!thisRow || thisRow->Role() != roles::ROW)
--- a/accessible/xul/XULListboxAccessible.h
+++ b/accessible/xul/XULListboxAccessible.h
@@ -101,17 +101,18 @@ protected:
 /**
   * Listitems -- used in listboxes
   */
 class XULListitemAccessible : public XULMenuitemAccessible
 {
 public:
   enum { eAction_Click = 0 };
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(XULListitemAccessible,
+                                       XULMenuitemAccessible)
 
   XULListitemAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // Accessible
   virtual void Description(nsString& aDesc) override;
   virtual a11y::role NativeRole() override;
   virtual uint64_t NativeState() override;
   virtual uint64_t NativeInteractiveState() const override;
@@ -144,17 +145,18 @@ private:
  */
 class XULListCellAccessible : public HyperTextAccessibleWrap,
                               public TableCellAccessible
 {
 public:
   XULListCellAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(XULListCellAccessible,
+                                       HyperTextAccessibleWrap)
 
   // Accessible
   virtual TableCellAccessible* AsTableCell() override { return this; }
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
   virtual a11y::role NativeRole() override;
 
   // TableCellAccessible
   virtual TableAccessible* Table() const override;
--- a/dom/asmjscache/AsmJSCache.cpp
+++ b/dom/asmjscache/AsmJSCache.cpp
@@ -428,16 +428,18 @@ protected:
 // This runnable gets registered as an IPDL subprotocol actor so that it
 // can communicate with the corresponding ChildRunnable.
 class ParentRunnable final
   : public FileDescriptorHolder
   , public quota::OpenDirectoryListener
   , public PAsmJSCacheEntryParent
 {
 public:
+  // We need to always declare refcounting because
+  // OpenDirectoryListener has pure-virtual refcounting.
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIRUNNABLE
 
   ParentRunnable(const PrincipalInfo& aPrincipalInfo,
                  OpenMode aOpenMode,
                  const WriteParams& aWriteParams)
   : mOwningEventTarget(GetCurrentThreadEventTarget()),
     mPrincipalInfo(aPrincipalInfo),
--- a/dom/base/IDTracker.h
+++ b/dom/base/IDTracker.h
@@ -135,16 +135,18 @@ private:
                        Element* aFrom,
                        Element* aTo)
       : mozilla::Runnable("IDTracker::ChangeNotification")
       , Notification(aTarget)
       , mFrom(aFrom)
       , mTo(aTo)
     {}
 
+    // We need to actually declare all of nsISupports, because
+    // Notification inherits from it but doesn't declare it.
     NS_DECL_ISUPPORTS_INHERITED
     NS_IMETHOD Run() override {
       if (mTarget) {
         mTarget->mPendingNotification = nullptr;
         mTarget->ElementChanged(mFrom, mTo);
       }
       return NS_OK;
     }
--- a/dom/base/ImageEncoder.cpp
+++ b/dom/base/ImageEncoder.cpp
@@ -140,17 +140,17 @@ private:
   bool mFailed;
 };
 
 class EncodingRunnable : public Runnable
 {
   virtual ~EncodingRunnable() {}
 
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(EncodingRunnable, Runnable)
 
   EncodingRunnable(const nsAString& aType,
                    const nsAString& aOptions,
                    UniquePtr<uint8_t[]> aImageBuffer,
                    layers::Image* aImage,
                    imgIEncoder* aEncoder,
                    EncodingCompleteEvent* aEncodingCompleteEvent,
                    int32_t aFormat,
@@ -238,18 +238,16 @@ private:
   nsCOMPtr<imgIEncoder> mEncoder;
   RefPtr<EncodingCompleteEvent> mEncodingCompleteEvent;
   int32_t mFormat;
   const nsIntSize mSize;
   bool mUsePlaceholder;
   bool mUsingCustomOptions;
 };
 
-NS_IMPL_ISUPPORTS_INHERITED0(EncodingRunnable, Runnable);
-
 StaticRefPtr<nsIThreadPool> ImageEncoder::sThreadPool;
 
 /* static */
 nsresult
 ImageEncoder::ExtractData(nsAString& aType,
                           const nsAString& aOptions,
                           const nsIntSize aSize,
                           bool aUsePlaceholder,
--- a/dom/file/EmptyBlobImpl.cpp
+++ b/dom/file/EmptyBlobImpl.cpp
@@ -5,18 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "EmptyBlobImpl.h"
 #include "nsStringStream.h"
 
 namespace mozilla {
 namespace dom {
 
-NS_IMPL_ISUPPORTS_INHERITED0(EmptyBlobImpl, BlobImpl)
-
 already_AddRefed<BlobImpl>
 EmptyBlobImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
                            const nsAString& aContentType,
                            ErrorResult& aRv)
 {
   MOZ_ASSERT(!aStart && !aLength);
   RefPtr<BlobImpl> impl = new EmptyBlobImpl(aContentType);
 
--- a/dom/file/EmptyBlobImpl.h
+++ b/dom/file/EmptyBlobImpl.h
@@ -10,17 +10,17 @@
 #include "BaseBlobImpl.h"
 
 namespace mozilla {
 namespace dom {
 
 class EmptyBlobImpl final : public BaseBlobImpl
 {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(EmptyBlobImpl, BaseBlobImpl)
 
   explicit EmptyBlobImpl(const nsAString& aContentType)
     : BaseBlobImpl(aContentType, 0 /* aLength */)
   {
     mImmutable = true;
   }
 
   EmptyBlobImpl(const nsAString& aName,
--- a/dom/file/FileBlobImpl.cpp
+++ b/dom/file/FileBlobImpl.cpp
@@ -13,18 +13,16 @@
 #include "nsIFileStreams.h"
 #include "nsIMIMEService.h"
 #include "nsNetUtil.h"
 #include "nsStreamUtils.h"
 
 namespace mozilla {
 namespace dom {
 
-NS_IMPL_ISUPPORTS_INHERITED0(FileBlobImpl, BlobImpl)
-
 FileBlobImpl::FileBlobImpl(nsIFile* aFile)
   : BaseBlobImpl(EmptyString(), EmptyString(), UINT64_MAX, INT64_MAX)
   , mFile(aFile)
   , mWholeFile(true)
   , mFileId(-1)
 {
   MOZ_ASSERT(mFile, "must have file");
   MOZ_ASSERT(XRE_IsParentProcess());
--- a/dom/file/FileBlobImpl.h
+++ b/dom/file/FileBlobImpl.h
@@ -12,17 +12,17 @@
 class nsIFile;
 
 namespace mozilla {
 namespace dom {
 
 class FileBlobImpl : public BaseBlobImpl
 {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(FileBlobImpl, BaseBlobImpl)
 
   // Create as a file
   explicit FileBlobImpl(nsIFile* aFile);
 
   // Create as a file
   FileBlobImpl(const nsAString& aName, const nsAString& aContentType,
                uint64_t aLength, nsIFile* aFile);
 
--- a/dom/file/MemoryBlobImpl.cpp
+++ b/dom/file/MemoryBlobImpl.cpp
@@ -42,18 +42,16 @@ nsresult MemoryBlobImpl::DataOwnerAdapte
   NS_ENSURE_SUCCESS(rv, rv);
 
   NS_ADDREF(*_retval =
               new MemoryBlobImpl::DataOwnerAdapter(aDataOwner, stream));
 
   return NS_OK;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(MemoryBlobImpl, BlobImpl)
-
 already_AddRefed<BlobImpl>
 MemoryBlobImpl::CreateSlice(uint64_t aStart, uint64_t aLength,
                             const nsAString& aContentType,
                             ErrorResult& aRv)
 {
   RefPtr<BlobImpl> impl =
     new MemoryBlobImpl(this, aStart, aLength, aContentType);
   return impl.forget();
--- a/dom/file/MemoryBlobImpl.h
+++ b/dom/file/MemoryBlobImpl.h
@@ -18,17 +18,17 @@
 #include "nsISeekableStream.h"
 
 namespace mozilla {
 namespace dom {
 
 class MemoryBlobImpl final : public BaseBlobImpl
 {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(MemoryBlobImpl, BaseBlobImpl)
 
   MemoryBlobImpl(void* aMemoryBuffer, uint64_t aLength, const nsAString& aName,
                  const nsAString& aContentType, int64_t aLastModifiedDate)
     : BaseBlobImpl(aName, aContentType, aLength, aLastModifiedDate)
     , mDataOwner(new DataOwner(aMemoryBuffer, aLength))
   {
     MOZ_ASSERT(mDataOwner && mDataOwner->mData, "must have data");
   }
--- a/dom/file/MultipartBlobImpl.cpp
+++ b/dom/file/MultipartBlobImpl.cpp
@@ -18,18 +18,16 @@
 #include "nsContentUtils.h"
 #include "nsIScriptError.h"
 #include "nsIXPConnect.h"
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
-NS_IMPL_ISUPPORTS_INHERITED0(MultipartBlobImpl, BlobImpl)
-
 /* static */ already_AddRefed<MultipartBlobImpl>
 MultipartBlobImpl::Create(nsTArray<RefPtr<BlobImpl>>&& aBlobImpls,
                           const nsAString& aName,
                           const nsAString& aContentType,
                           ErrorResult& aRv)
 {
   RefPtr<MultipartBlobImpl> blobImpl =
     new MultipartBlobImpl(Move(aBlobImpls), aName, aContentType);
--- a/dom/file/MultipartBlobImpl.h
+++ b/dom/file/MultipartBlobImpl.h
@@ -13,17 +13,17 @@
 #include "mozilla/dom/BaseBlobImpl.h"
 
 namespace mozilla {
 namespace dom {
 
 class MultipartBlobImpl final : public BaseBlobImpl
 {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(MultipartBlobImpl, BaseBlobImpl)
 
   // Create as a file
   static already_AddRefed<MultipartBlobImpl>
   Create(nsTArray<RefPtr<BlobImpl>>&& aBlobImpls,
          const nsAString& aName,
          const nsAString& aContentType,
          ErrorResult& aRv);
 
--- a/dom/file/MutableBlobStorage.cpp
+++ b/dom/file/MutableBlobStorage.cpp
@@ -208,16 +208,18 @@ private:
 };
 
 // This runnable is dispatched to the main-thread from the IO thread and its
 // task is to create the blob and inform the callback.
 class CreateBlobRunnable final : public Runnable
                                , public TemporaryIPCBlobChildCallback
 {
 public:
+  // We need to always declare refcounting because
+  // TemporaryIPCBlobChildCallback has pure-virtual refcounting.
   NS_DECL_ISUPPORTS_INHERITED
 
   CreateBlobRunnable(MutableBlobStorage* aBlobStorage,
                      already_AddRefed<nsISupports> aParent,
                      const nsACString& aContentType,
                      already_AddRefed<MutableBlobStorageCallback> aCallback)
     : Runnable("dom::CreateBlobRunnable")
     , mBlobStorage(aBlobStorage)
--- a/dom/html/HTMLBodyElement.cpp
+++ b/dom/html/HTMLBodyElement.cpp
@@ -36,18 +36,16 @@ HTMLBodyElement::~HTMLBodyElement()
 }
 
 JSObject*
 HTMLBodyElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return HTMLBodyElementBinding::Wrap(aCx, this, aGivenProto);
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLBodyElement, nsGenericHTMLElement)
-
 NS_IMPL_ELEMENT_CLONE(HTMLBodyElement)
 
 bool
 HTMLBodyElement::ParseAttribute(int32_t aNamespaceID,
                                 nsAtom* aAttribute,
                                 const nsAString& aValue,
                                 nsIPrincipal* aMaybeScriptedPrincipal,
                                 nsAttrValue& aResult)
--- a/dom/html/HTMLBodyElement.h
+++ b/dom/html/HTMLBodyElement.h
@@ -27,17 +27,17 @@ public:
   using Element::SetText;
 
   explicit HTMLBodyElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
     : nsGenericHTMLElement(aNodeInfo)
   {
   }
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLBodyElement, nsGenericHTMLElement)
 
   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLBodyElement, body);
 
   // Event listener stuff; we need to declare only the ones we need to
   // forward to window that don't come from nsIDOMHTMLBodyElement.
 #define EVENT(name_, id_, type_, struct_) /* nothing; handled by the shim */
 #define WINDOW_EVENT_HELPER(name_, type_)                               \
   type_* GetOn##name_();                                                \
--- a/dom/html/HTMLFrameElement.cpp
+++ b/dom/html/HTMLFrameElement.cpp
@@ -20,18 +20,16 @@ HTMLFrameElement::HTMLFrameElement(alrea
 {
 }
 
 HTMLFrameElement::~HTMLFrameElement()
 {
 }
 
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLFrameElement, nsGenericHTMLFrameElement)
-
 NS_IMPL_ELEMENT_CLONE(HTMLFrameElement)
 
 bool
 HTMLFrameElement::ParseAttribute(int32_t aNamespaceID,
                                  nsAtom* aAttribute,
                                  const nsAString& aValue,
                                  nsIPrincipal* aMaybeScriptedPrincipal,
                                  nsAttrValue& aResult)
--- a/dom/html/HTMLFrameElement.h
+++ b/dom/html/HTMLFrameElement.h
@@ -18,17 +18,18 @@ class HTMLFrameElement final : public ns
 {
 public:
   using nsGenericHTMLFrameElement::SwapFrameLoaders;
 
   explicit HTMLFrameElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                             FromParser aFromParser = NOT_FROM_PARSER);
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLFrameElement,
+                                       nsGenericHTMLFrameElement)
 
   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLFrameElement, frame)
 
   // nsIContent
   virtual bool ParseAttribute(int32_t aNamespaceID,
                               nsAtom* aAttribute,
                               const nsAString& aValue,
                               nsIPrincipal* aMaybeScriptedPrincipal,
--- a/dom/html/HTMLFrameSetElement.cpp
+++ b/dom/html/HTMLFrameSetElement.cpp
@@ -21,18 +21,16 @@ HTMLFrameSetElement::~HTMLFrameSetElemen
 }
 
 JSObject*
 HTMLFrameSetElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return HTMLFrameSetElementBinding::Wrap(aCx, this, aGivenProto);
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLFrameSetElement, nsGenericHTMLElement)
-
 NS_IMPL_ELEMENT_CLONE(HTMLFrameSetElement)
 
 nsresult
 HTMLFrameSetElement::BeforeSetAttr(int32_t aNamespaceID, nsAtom* aName,
                                    const nsAttrValueOrString* aValue,
                                    bool aNotify)
 {
   /* The main goal here is to see whether the _number_ of rows or
--- a/dom/html/HTMLFrameSetElement.h
+++ b/dom/html/HTMLFrameSetElement.h
@@ -53,17 +53,18 @@ public:
       mCurrentRowColHint(NS_STYLE_HINT_REFLOW)
   {
     SetHasWeirdParserInsertionMode();
   }
 
   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLFrameSetElement, frameset)
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLFrameSetElement,
+                                       nsGenericHTMLElement)
 
   void GetCols(DOMString& aCols)
   {
     GetHTMLAttr(nsGkAtoms::cols, aCols);
   }
   void SetCols(const nsAString& aCols, ErrorResult& aError)
   {
     SetHTMLAttr(nsGkAtoms::cols, aCols, aError);
--- a/dom/html/HTMLHRElement.cpp
+++ b/dom/html/HTMLHRElement.cpp
@@ -16,18 +16,16 @@ HTMLHRElement::HTMLHRElement(already_Add
   : nsGenericHTMLElement(aNodeInfo)
 {
 }
 
 HTMLHRElement::~HTMLHRElement()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLHRElement, nsGenericHTMLElement)
-
 NS_IMPL_ELEMENT_CLONE(HTMLHRElement)
 
 
 bool
 HTMLHRElement::ParseAttribute(int32_t aNamespaceID,
                               nsAtom* aAttribute,
                               const nsAString& aValue,
                               nsIPrincipal* aMaybeScriptedPrincipal,
--- a/dom/html/HTMLHRElement.h
+++ b/dom/html/HTMLHRElement.h
@@ -19,17 +19,17 @@ namespace mozilla {
 namespace dom {
 
 class HTMLHRElement final : public nsGenericHTMLElement
 {
 public:
   explicit HTMLHRElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLHRElement, nsGenericHTMLElement)
 
   virtual bool ParseAttribute(int32_t aNamespaceID,
                               nsAtom* aAttribute,
                               const nsAString& aValue,
                               nsIPrincipal* aMaybeScriptedPrincipal,
                               nsAttrValue& aResult) override;
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
--- a/dom/html/HTMLIFrameElement.cpp
+++ b/dom/html/HTMLIFrameElement.cpp
@@ -32,18 +32,16 @@ HTMLIFrameElement::HTMLIFrameElement(alr
   : nsGenericHTMLFrameElement(aNodeInfo, aFromParser)
 {
 }
 
 HTMLIFrameElement::~HTMLIFrameElement()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLIFrameElement, nsGenericHTMLFrameElement)
-
 NS_IMPL_ELEMENT_CLONE(HTMLIFrameElement)
 
 bool
 HTMLIFrameElement::ParseAttribute(int32_t aNamespaceID,
                                   nsAtom* aAttribute,
                                   const nsAString& aValue,
                                   nsIPrincipal* aMaybeScriptedPrincipal,
                                   nsAttrValue& aResult)
--- a/dom/html/HTMLIFrameElement.h
+++ b/dom/html/HTMLIFrameElement.h
@@ -18,17 +18,18 @@ class HTMLIFrameElement final : public n
 {
 public:
   explicit HTMLIFrameElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                              FromParser aFromParser = NOT_FROM_PARSER);
 
   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLIFrameElement, iframe)
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLIFrameElement,
+                                       nsGenericHTMLFrameElement)
 
   // Element
   virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override
   {
     return true;
   }
 
   // nsIContent
--- a/dom/html/HTMLLIElement.cpp
+++ b/dom/html/HTMLLIElement.cpp
@@ -17,18 +17,16 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(LI)
 
 namespace mozilla {
 namespace dom {
 
 HTMLLIElement::~HTMLLIElement()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLLIElement, nsGenericHTMLElement)
-
 NS_IMPL_ELEMENT_CLONE(HTMLLIElement)
 
 // values that are handled case-insensitively
 static const nsAttrValue::EnumTable kUnorderedListItemTypeTable[] = {
   { "disc", NS_STYLE_LIST_STYLE_DISC },
   { "circle", NS_STYLE_LIST_STYLE_CIRCLE },
   { "round", NS_STYLE_LIST_STYLE_CIRCLE },
   { "square", NS_STYLE_LIST_STYLE_SQUARE },
--- a/dom/html/HTMLLIElement.h
+++ b/dom/html/HTMLLIElement.h
@@ -18,17 +18,17 @@ class HTMLLIElement final : public nsGen
 {
 public:
   explicit HTMLLIElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
     : nsGenericHTMLElement(aNodeInfo)
   {
   }
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLLIElement, nsGenericHTMLElement)
 
   virtual bool ParseAttribute(int32_t aNamespaceID,
                                 nsAtom* aAttribute,
                                 const nsAString& aValue,
                                 nsIPrincipal* aMaybeScriptedPrincipal,
                                 nsAttrValue& aResult) override;
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
--- a/dom/html/HTMLLabelElement.cpp
+++ b/dom/html/HTMLLabelElement.cpp
@@ -29,20 +29,16 @@ HTMLLabelElement::~HTMLLabelElement()
 }
 
 JSObject*
 HTMLLabelElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return HTMLLabelElementBinding::Wrap(aCx, this, aGivenProto);
 }
 
-// nsISupports
-
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLLabelElement, nsGenericHTMLElement)
-
 // nsIDOMHTMLLabelElement
 
 NS_IMPL_ELEMENT_CLONE(HTMLLabelElement)
 
 HTMLFormElement*
 HTMLLabelElement::GetForm() const
 {
   nsGenericHTMLElement* control = GetControl();
--- a/dom/html/HTMLLabelElement.h
+++ b/dom/html/HTMLLabelElement.h
@@ -24,17 +24,17 @@ public:
     : nsGenericHTMLElement(aNodeInfo),
       mHandlingEvent(false)
   {
   }
 
   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLLabelElement, label)
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLLabelElement, nsGenericHTMLElement)
 
   // Element
   virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override
   {
     return true;
   }
 
   HTMLFormElement* GetForm() const;
--- a/dom/html/HTMLMenuElement.cpp
+++ b/dom/html/HTMLMenuElement.cpp
@@ -50,18 +50,16 @@ HTMLMenuElement::HTMLMenuElement(already
   : nsGenericHTMLElement(aNodeInfo), mType(MENU_TYPE_TOOLBAR)
 {
 }
 
 HTMLMenuElement::~HTMLMenuElement()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLMenuElement, nsGenericHTMLElement)
-
 NS_IMPL_ELEMENT_CLONE(HTMLMenuElement)
 
 
 void
 HTMLMenuElement::SendShowEvent()
 {
   nsCOMPtr<nsIDocument> document = GetComposedDoc();
   if (!document) {
--- a/dom/html/HTMLMenuElement.h
+++ b/dom/html/HTMLMenuElement.h
@@ -18,17 +18,17 @@ namespace dom {
 class HTMLMenuElement final : public nsGenericHTMLElement
 {
 public:
   explicit HTMLMenuElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
 
   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLMenuElement, menu)
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLMenuElement, nsGenericHTMLElement)
 
   virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
                                 const nsAttrValue* aValue,
                                 const nsAttrValue* aOldValue,
                                 nsIPrincipal* aSubjectPrincipal,
                                 bool aNotify) override;
   virtual bool ParseAttribute(int32_t aNamespaceID,
                                 nsAtom* aAttribute,
--- a/dom/html/HTMLMenuItemElement.cpp
+++ b/dom/html/HTMLMenuItemElement.cpp
@@ -168,18 +168,16 @@ HTMLMenuItemElement::HTMLMenuItemElement
   mParserCreating = aFromParser;
 }
 
 HTMLMenuItemElement::~HTMLMenuItemElement()
 {
 }
 
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLMenuItemElement, nsGenericHTMLElement)
-
 //NS_IMPL_ELEMENT_CLONE(HTMLMenuItemElement)
 
 nsresult
 HTMLMenuItemElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
                            bool aPreallocateArrays) const
 {
   *aResult = nullptr;
   already_AddRefed<mozilla::dom::NodeInfo> ni = RefPtr<mozilla::dom::NodeInfo>(aNodeInfo).forget();
--- a/dom/html/HTMLMenuItemElement.h
+++ b/dom/html/HTMLMenuItemElement.h
@@ -24,17 +24,18 @@ public:
   using mozilla::dom::Element::GetText;
 
   HTMLMenuItemElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                       mozilla::dom::FromParser aFromParser);
 
   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLMenuItemElement, menuitem)
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLMenuItemElement,
+                                       nsGenericHTMLElement)
 
   virtual nsresult GetEventTargetParent(
                      EventChainPreVisitor& aVisitor) override;
   virtual nsresult PostHandleEvent(
                      EventChainPostVisitor& aVisitor) override;
 
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
--- a/dom/html/HTMLMetaElement.cpp
+++ b/dom/html/HTMLMetaElement.cpp
@@ -27,18 +27,16 @@ HTMLMetaElement::HTMLMetaElement(already
 {
 }
 
 HTMLMetaElement::~HTMLMetaElement()
 {
 }
 
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLMetaElement, nsGenericHTMLElement)
-
 NS_IMPL_ELEMENT_CLONE(HTMLMetaElement)
 
 
 nsresult
 HTMLMetaElement::SetMetaReferrer(nsIDocument* aDocument)
 {
   if (!aDocument ||
       !AttrValueIs(kNameSpaceID_None, nsGkAtoms::name, nsGkAtoms::referrer, eIgnoreCase)) {
--- a/dom/html/HTMLMetaElement.h
+++ b/dom/html/HTMLMetaElement.h
@@ -14,17 +14,17 @@ namespace mozilla {
 namespace dom {
 
 class HTMLMetaElement final : public nsGenericHTMLElement
 {
 public:
   explicit HTMLMetaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLMetaElement, nsGenericHTMLElement)
 
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                               nsIContent* aBindingParent,
                               bool aCompileEventHandlers) override;
   virtual void UnbindFromTree(bool aDeep = true,
                               bool aNullParent = true) override;
 
   virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
--- a/dom/html/HTMLOptGroupElement.cpp
+++ b/dom/html/HTMLOptGroupElement.cpp
@@ -32,18 +32,16 @@ HTMLOptGroupElement::HTMLOptGroupElement
   AddStatesSilently(NS_EVENT_STATE_ENABLED);
 }
 
 HTMLOptGroupElement::~HTMLOptGroupElement()
 {
 }
 
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLOptGroupElement, nsGenericHTMLElement)
-
 NS_IMPL_ELEMENT_CLONE(HTMLOptGroupElement)
 
 
 nsresult
 HTMLOptGroupElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
 {
   aVisitor.mCanHandle = false;
   // Do not process any DOM events if the element is disabled
--- a/dom/html/HTMLOptGroupElement.h
+++ b/dom/html/HTMLOptGroupElement.h
@@ -17,17 +17,18 @@ namespace dom {
 class HTMLOptGroupElement final : public nsGenericHTMLElement
 {
 public:
   explicit HTMLOptGroupElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
 
   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLOptGroupElement, optgroup)
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLOptGroupElement,
+                                       nsGenericHTMLElement)
 
   // nsINode
   virtual nsresult InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
                                      bool aNotify) override;
   virtual nsresult InsertChildAt_Deprecated(nsIContent* aKid, uint32_t aIndex,
                                             bool aNotify) override;
   virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
   virtual void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
--- a/dom/html/HTMLOptionElement.cpp
+++ b/dom/html/HTMLOptionElement.cpp
@@ -43,18 +43,16 @@ HTMLOptionElement::HTMLOptionElement(alr
   // We start off enabled
   AddStatesSilently(NS_EVENT_STATE_ENABLED);
 }
 
 HTMLOptionElement::~HTMLOptionElement()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLOptionElement, nsGenericHTMLElement)
-
 NS_IMPL_ELEMENT_CLONE(HTMLOptionElement)
 
 mozilla::dom::HTMLFormElement*
 HTMLOptionElement::GetForm()
 {
   HTMLSelectElement* selectControl = GetSelect();
   return selectControl ? selectControl->GetForm() : nullptr;
 }
--- a/dom/html/HTMLOptionElement.h
+++ b/dom/html/HTMLOptionElement.h
@@ -27,17 +27,17 @@ public:
            const Optional<nsAString>& aValue,
            bool aDefaultSelected,
            bool aSelected,
            ErrorResult& aError);
 
   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLOptionElement, option)
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLOptionElement, nsGenericHTMLElement)
 
   using mozilla::dom::Element::SetText;
   using mozilla::dom::Element::GetText;
 
   bool Selected() const
   {
     return mIsSelected;
   }
--- a/dom/html/HTMLParagraphElement.cpp
+++ b/dom/html/HTMLParagraphElement.cpp
@@ -16,18 +16,16 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(Paragraph)
 
 namespace mozilla {
 namespace dom {
 
 HTMLParagraphElement::~HTMLParagraphElement()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLParagraphElement, nsGenericHTMLElement)
-
 NS_IMPL_ELEMENT_CLONE(HTMLParagraphElement)
 
 bool
 HTMLParagraphElement::ParseAttribute(int32_t aNamespaceID,
                                      nsAtom* aAttribute,
                                      const nsAString& aValue,
                                      nsIPrincipal* aMaybeScriptedPrincipal,
                                      nsAttrValue& aResult)
--- a/dom/html/HTMLParagraphElement.h
+++ b/dom/html/HTMLParagraphElement.h
@@ -18,17 +18,18 @@ class HTMLParagraphElement final : publi
 {
 public:
   explicit HTMLParagraphElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
     : nsGenericHTMLElement(aNodeInfo)
   {
   }
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLParagraphElement,
+                                       nsGenericHTMLElement)
 
   virtual bool ParseAttribute(int32_t aNamespaceID,
                                 nsAtom* aAttribute,
                                 const nsAString& aValue,
                                 nsIPrincipal* aMaybeScriptedPrincipal,
                                 nsAttrValue& aResult) override;
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
--- a/dom/html/HTMLPictureElement.cpp
+++ b/dom/html/HTMLPictureElement.cpp
@@ -23,18 +23,16 @@ HTMLPictureElement::HTMLPictureElement(a
   : nsGenericHTMLElement(aNodeInfo)
 {
 }
 
 HTMLPictureElement::~HTMLPictureElement()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLPictureElement, nsGenericHTMLElement)
-
 NS_IMPL_ELEMENT_CLONE(HTMLPictureElement)
 
 void
 HTMLPictureElement::RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify)
 {
   nsCOMPtr<nsIContent> child = GetChildAt_Deprecated(aIndex);
 
   if (child && child->IsHTMLElement(nsGkAtoms::img)) {
--- a/dom/html/HTMLPictureElement.h
+++ b/dom/html/HTMLPictureElement.h
@@ -14,17 +14,17 @@ namespace mozilla {
 namespace dom {
 
 class HTMLPictureElement final : public nsGenericHTMLElement
 {
 public:
   explicit HTMLPictureElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLPictureElement, nsGenericHTMLElement)
 
   virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
                          bool aPreallocateChildren) const override;
   virtual void RemoveChildAt_Deprecated(uint32_t aIndex, bool aNotify) override;
   virtual void RemoveChildNode(nsIContent* aKid, bool aNotify) override;
   virtual nsresult InsertChildBefore(nsIContent* aKid, nsIContent* aBeforeThis,
                                      bool aNotify) override;
   virtual nsresult InsertChildAt_Deprecated(nsIContent* aKid, uint32_t aIndex,
--- a/dom/html/HTMLPreElement.cpp
+++ b/dom/html/HTMLPreElement.cpp
@@ -17,18 +17,16 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(Pre)
 
 namespace mozilla {
 namespace dom {
 
 HTMLPreElement::~HTMLPreElement()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLPreElement, nsGenericHTMLElement)
-
 NS_IMPL_ELEMENT_CLONE(HTMLPreElement)
 
 bool
 HTMLPreElement::ParseAttribute(int32_t aNamespaceID,
                                nsAtom* aAttribute,
                                const nsAString& aValue,
                                nsIPrincipal* aMaybeScriptedPrincipal,
                                nsAttrValue& aResult)
--- a/dom/html/HTMLPreElement.h
+++ b/dom/html/HTMLPreElement.h
@@ -18,17 +18,17 @@ class HTMLPreElement final : public nsGe
 {
 public:
   explicit HTMLPreElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
     : nsGenericHTMLElement(aNodeInfo)
   {
   }
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLPreElement, nsGenericHTMLElement)
 
   virtual bool ParseAttribute(int32_t aNamespaceID,
                                 nsAtom* aAttribute,
                                 const nsAString& aValue,
                                 nsIPrincipal* aMaybeScriptedPrincipal,
                                 nsAttrValue& aResult) override;
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
--- a/dom/html/HTMLTableCellElement.cpp
+++ b/dom/html/HTMLTableCellElement.cpp
@@ -26,18 +26,16 @@ HTMLTableCellElement::~HTMLTableCellElem
 }
 
 JSObject*
 HTMLTableCellElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return HTMLTableCellElementBinding::Wrap(aCx, this, aGivenProto);
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HTMLTableCellElement, nsGenericHTMLElement)
-
 NS_IMPL_ELEMENT_CLONE(HTMLTableCellElement)
 
 
 // protected method
 HTMLTableRowElement*
 HTMLTableCellElement::GetRow() const
 {
   return HTMLTableRowElement::FromContentOrNull(GetParent());
--- a/dom/html/HTMLTableCellElement.h
+++ b/dom/html/HTMLTableCellElement.h
@@ -19,17 +19,18 @@ class HTMLTableCellElement final : publi
 public:
   explicit HTMLTableCellElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
     : nsGenericHTMLElement(aNodeInfo)
   {
     SetHasWeirdParserInsertionMode();
   }
 
   // nsISupports
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLTableCellElement,
+                                       nsGenericHTMLElement)
 
   uint32_t ColSpan() const
   {
     return GetIntAttr(nsGkAtoms::colspan, 1);
   }
   void SetColSpan(uint32_t aColSpan, ErrorResult& aError)
   {
     SetUnsignedIntAttr(nsGkAtoms::colspan, aColSpan, 1, aError);
--- a/dom/indexedDB/ActorsParent.cpp
+++ b/dom/indexedDB/ActorsParent.cpp
@@ -5511,34 +5511,34 @@ class ConnectionPool::IdleConnectionRunn
   bool mNeedsCheckpoint;
 
 public:
   IdleConnectionRunnable(DatabaseInfo* aDatabaseInfo, bool aNeedsCheckpoint)
     : ConnectionRunnable(aDatabaseInfo)
     , mNeedsCheckpoint(aNeedsCheckpoint)
   { }
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(IdleConnectionRunnable, ConnectionRunnable)
 
 private:
   ~IdleConnectionRunnable() override = default;
 
   NS_DECL_NSIRUNNABLE
 };
 
 class ConnectionPool::CloseConnectionRunnable final
   : public ConnectionRunnable
 {
 public:
   explicit
   CloseConnectionRunnable(DatabaseInfo* aDatabaseInfo)
     : ConnectionRunnable(aDatabaseInfo)
   { }
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(CloseConnectionRunnable, ConnectionRunnable)
 
 private:
   ~CloseConnectionRunnable() override = default;
 
   NS_DECL_NSIRUNNABLE
 };
 
 struct ConnectionPool::ThreadInfo
@@ -5644,17 +5644,17 @@ class ConnectionPool::FinishCallbackWrap
   uint64_t mTransactionId;
   bool mHasRunOnce;
 
 public:
   FinishCallbackWrapper(ConnectionPool* aConnectionPool,
                         uint64_t aTransactionId,
                         FinishCallback* aCallback);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(FinishCallbackWrapper, Runnable)
 
 private:
   ~FinishCallbackWrapper() override;
 
   NS_DECL_NSIRUNNABLE
 };
 
 struct ConnectionPool::IdleResource
@@ -5739,17 +5739,17 @@ class ConnectionPool::ThreadRunnable fin
 
   // These two values are only modified on the connection thread.
   bool mFirstRun;
   bool mContinueRunning;
 
 public:
   ThreadRunnable();
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(ThreadRunnable, Runnable)
 
   uint32_t
   SerialNumber() const
   {
     return mSerialNumber;
   }
 
   nsCString GetThreadName() const
@@ -6286,17 +6286,17 @@ public:
     AssertIsOnBackgroundThread();
     MOZ_ASSERT(!aDatabaseId.IsEmpty());
     MOZ_ASSERT(aCallback);
   }
 
   void
   WaitForTransactions();
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(WaitForTransactionsHelper, Runnable)
 
 private:
   ~WaitForTransactionsHelper() override
   {
     MOZ_ASSERT(!mCallback);
     MOZ_ASSERT(mState == State::Complete);
   }
 
@@ -7129,16 +7129,18 @@ private:
 
   void
   TransactionFinishedBeforeUnblock() override;
 
   void
   TransactionFinishedAfterUnblock() override;
 
 public:
+  // We need to declare all of nsISupports, because FinishCallback has
+  // a pure-virtual nsISupports declaration.
   NS_DECL_ISUPPORTS_INHERITED
 };
 
 class NormalTransaction final
   : public TransactionBase
   , public PBackgroundIDBTransactionParent
 {
   friend class Database;
@@ -7541,16 +7543,18 @@ protected:
 
   virtual nsresult
   DispatchToWorkThread() = 0;
 
   // Should only be called by Run().
   virtual void
   SendResults() = 0;
 
+  // We need to declare refcounting unconditionally, because
+  // OpenDirectoryListener has pure-virtual refcounting.
   NS_DECL_ISUPPORTS_INHERITED
 
   // Common nsIRunnable implementation that subclasses may not override.
   NS_IMETHOD
   Run() final override;
 
   // OpenDirectoryListener overrides.
   void
@@ -9298,16 +9302,18 @@ private:
   nsresult
   BeginDatabaseMaintenance();
 
   // Runs on the PBackground thread. Called when the maintenance is finished or
   // if any of above methods fails.
   void
   Finish();
 
+  // We need to declare refcounting unconditionally, because
+  // OpenDirectoryListener has pure-virtual refcounting.
   NS_DECL_ISUPPORTS_INHERITED
 
   NS_DECL_NSIRUNNABLE
 
   // OpenDirectoryListener overrides.
   void
   DirectoryLockAcquired(DirectoryLock* aLock) override;
 
@@ -12929,19 +12935,16 @@ ConnectionRunnable::ConnectionRunnable(D
 {
   AssertIsOnBackgroundThread();
   MOZ_ASSERT(aDatabaseInfo);
   MOZ_ASSERT(aDatabaseInfo->mConnectionPool);
   aDatabaseInfo->mConnectionPool->AssertIsOnOwningThread();
   MOZ_ASSERT(mOwningEventTarget);
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(ConnectionPool::IdleConnectionRunnable,
-                             ConnectionPool::ConnectionRunnable)
-
 NS_IMETHODIMP
 ConnectionPool::
 IdleConnectionRunnable::Run()
 {
   MOZ_ASSERT(mDatabaseInfo);
   MOZ_ASSERT(!mDatabaseInfo->mIdle);
 
   nsCOMPtr<nsIEventTarget> owningThread;
@@ -12973,19 +12976,16 @@ IdleConnectionRunnable::Run()
         mDatabasesPerformingIdleMaintenance.RemoveElement(mDatabaseInfo));
 
     connectionPool->NoteIdleDatabase(mDatabaseInfo);
   }
 
   return NS_OK;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(ConnectionPool::CloseConnectionRunnable,
-                             ConnectionPool::ConnectionRunnable)
-
 NS_IMETHODIMP
 ConnectionPool::
 CloseConnectionRunnable::Run()
 {
   MOZ_ASSERT(mDatabaseInfo);
 
   AUTO_PROFILER_LABEL("ConnectionPool::CloseConnectionRunnable::Run", STORAGE);
 
@@ -13103,18 +13103,16 @@ ConnectionPool::FinishCallbackWrapper::F
 
 ConnectionPool::
 FinishCallbackWrapper::~FinishCallbackWrapper()
 {
   MOZ_ASSERT(!mConnectionPool);
   MOZ_ASSERT(!mCallback);
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(ConnectionPool::FinishCallbackWrapper, Runnable)
-
 nsresult
 ConnectionPool::
 FinishCallbackWrapper::Run()
 {
   MOZ_ASSERT(mConnectionPool);
   MOZ_ASSERT(mCallback);
   MOZ_ASSERT(mOwningEventTarget);
 
@@ -13161,18 +13159,16 @@ ConnectionPool::ThreadRunnable::ThreadRu
 
 ConnectionPool::
 ThreadRunnable::~ThreadRunnable()
 {
   MOZ_ASSERT(!mFirstRun);
   MOZ_ASSERT(!mContinueRunning);
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(ConnectionPool::ThreadRunnable, Runnable)
-
 nsresult
 ConnectionPool::
 ThreadRunnable::Run()
 {
   MOZ_ASSERT(!IsOnBackgroundThread());
   MOZ_ASSERT(mContinueRunning);
 
   if (!mFirstRun) {
@@ -13802,18 +13798,16 @@ WaitForTransactionsHelper::CallCallback(
   nsCOMPtr<nsIRunnable> callback;
   mCallback.swap(callback);
 
   callback->Run();
 
   mState = State::Complete;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(WaitForTransactionsHelper, Runnable)
-
 NS_IMETHODIMP
 WaitForTransactionsHelper::Run()
 {
   MOZ_ASSERT(mState != State::Complete);
   MOZ_ASSERT(mCallback);
 
   switch (mState) {
     case State::Initial:
--- a/dom/indexedDB/FileInfo.cpp
+++ b/dom/indexedDB/FileInfo.cpp
@@ -63,17 +63,17 @@ public:
     : Runnable("dom::indexedDB::CleanupFileRunnable")
     , mFileManager(aFileManager)
     , mFileId(aFileId)
   {
     MOZ_ASSERT(aFileManager);
     MOZ_ASSERT(aFileId > 0);
   }
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(CleanupFileRunnable, Runnable);
 
 private:
   ~CleanupFileRunnable()
   { }
 
   NS_DECL_NSIRUNNABLE
 };
 
@@ -239,18 +239,16 @@ CleanupFileRunnable::DoCleanup(FileManag
   RefPtr<IndexedDatabaseManager> mgr = IndexedDatabaseManager::Get();
   MOZ_ASSERT(mgr);
 
   if (NS_FAILED(mgr->AsyncDeleteFile(aFileManager, aFileId))) {
     NS_WARNING("Failed to delete file asynchronously!");
   }
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(CleanupFileRunnable, Runnable)
-
 NS_IMETHODIMP
 CleanupFileRunnable::Run()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   DoCleanup(mFileManager, mFileId);
 
   return NS_OK;
--- a/dom/indexedDB/FileSnapshot.cpp
+++ b/dom/indexedDB/FileSnapshot.cpp
@@ -138,17 +138,17 @@ private:
 class StreamWrapper::CloseRunnable final
   : public Runnable
 {
   friend class StreamWrapper;
 
   RefPtr<StreamWrapper> mStreamWrapper;
 
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(CloseRunnable, Runnable)
 
 private:
   explicit
   CloseRunnable(StreamWrapper* aStreamWrapper)
     : Runnable("StreamWrapper::CloseRunnable")
     , mStreamWrapper(aStreamWrapper)
   { }
 
@@ -409,19 +409,16 @@ StreamWrapper::Clone(nsIInputStream** aR
   nsCOMPtr<nsICloneableInputStream> stream = do_QueryInterface(mInputStream);
   if (!stream) {
     return NS_ERROR_NO_INTERFACE;
   }
 
   return stream->Clone(aResult);
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(StreamWrapper::CloseRunnable,
-                             Runnable)
-
 NS_IMETHODIMP
 StreamWrapper::
 CloseRunnable::Run()
 {
   mStreamWrapper->Finish();
 
   return NS_OK;
 }
--- a/dom/indexedDB/IDBKeyRange.cpp
+++ b/dom/indexedDB/IDBKeyRange.cpp
@@ -226,18 +226,16 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IDBKeyRange)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(IDBKeyRange)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(IDBKeyRange)
 
-NS_IMPL_ISUPPORTS_INHERITED0(IDBLocaleAwareKeyRange, IDBKeyRange)
-
 void
 IDBKeyRange::DropJSObjects()
 {
   if (!mRooted) {
     return;
   }
   mCachedLowerVal.setUndefined();
   mCachedUpperVal.setUndefined();
--- a/dom/indexedDB/IDBKeyRange.h
+++ b/dom/indexedDB/IDBKeyRange.h
@@ -193,17 +193,17 @@ public:
   static already_AddRefed<IDBLocaleAwareKeyRange>
   Bound(const GlobalObject& aGlobal,
         JS::Handle<JS::Value> aLower,
         JS::Handle<JS::Value> aUpper,
         bool aLowerOpen,
         bool aUpperOpen,
         ErrorResult& aRv);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(IDBLocaleAwareKeyRange, IDBKeyRange)
 
   // WebIDL
   bool
   WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
 };
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/media/MediaRecorder.cpp
+++ b/dom/media/MediaRecorder.cpp
@@ -215,16 +215,18 @@ class MediaRecorder::Session: public Pri
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Session)
 
   // Main thread task.
   // Create a blob event and send back to client.
   class PushBlobRunnable : public Runnable
                          , public MutableBlobStorageCallback
   {
   public:
+    // We need to always declare refcounting because
+    // MutableBlobStorageCallback has pure-virtual refcounting.
     NS_DECL_ISUPPORTS_INHERITED
 
     // aDestroyRunnable can be null. If it's not, it will be dispatched after
     // the PushBlobRunnable::Run().
     PushBlobRunnable(Session* aSession, Runnable* aDestroyRunnable)
       : Runnable("dom::MediaRecorder::Session::PushBlobRunnable")
       , mSession(aSession)
       , mDestroyRunnable(aDestroyRunnable)
--- a/dom/media/webaudio/AnalyserNode.cpp
+++ b/dom/media/webaudio/AnalyserNode.cpp
@@ -17,18 +17,16 @@ static const uint32_t MAX_FFT_SIZE = 327
 static const size_t CHUNK_COUNT = MAX_FFT_SIZE >> WEBAUDIO_BLOCK_SIZE_BITS;
 static_assert(MAX_FFT_SIZE == CHUNK_COUNT * WEBAUDIO_BLOCK_SIZE,
               "MAX_FFT_SIZE must be a multiple of WEBAUDIO_BLOCK_SIZE");
 static_assert((CHUNK_COUNT & (CHUNK_COUNT - 1)) == 0,
               "CHUNK_COUNT must be power of 2 for remainder behavior");
 
 namespace dom {
 
-NS_IMPL_ISUPPORTS_INHERITED0(AnalyserNode, AudioNode)
-
 class AnalyserNodeEngine final : public AudioNodeEngine
 {
   class TransferBuffer final : public Runnable
   {
   public:
     TransferBuffer(AudioNodeStream* aStream, const AudioChunk& aChunk)
       : Runnable("dom::AnalyserNodeEngine::TransferBuffer")
       , mStream(aStream)
--- a/dom/media/webaudio/AnalyserNode.h
+++ b/dom/media/webaudio/AnalyserNode.h
@@ -19,17 +19,17 @@ struct AnalyserOptions;
 
 class AnalyserNode final : public AudioNode
 {
 public:
   static already_AddRefed<AnalyserNode>
   Create(AudioContext& aAudioContext, const AnalyserOptions& aOptions,
          ErrorResult& aRv);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(AnalyserNode, AudioNode)
 
   virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   static already_AddRefed<AnalyserNode>
   Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext,
               const AnalyserOptions& aOptions, ErrorResult& aRv)
   {
     return Create(aAudioContext, aOptions, aRv);
--- a/dom/media/webaudio/ChannelMergerNode.cpp
+++ b/dom/media/webaudio/ChannelMergerNode.cpp
@@ -7,18 +7,16 @@
 #include "mozilla/dom/ChannelMergerNode.h"
 #include "mozilla/dom/ChannelMergerNodeBinding.h"
 #include "AudioNodeEngine.h"
 #include "AudioNodeStream.h"
 
 namespace mozilla {
 namespace dom {
 
-NS_IMPL_ISUPPORTS_INHERITED0(ChannelMergerNode, AudioNode)
-
 class ChannelMergerNodeEngine final : public AudioNodeEngine
 {
 public:
   explicit ChannelMergerNodeEngine(ChannelMergerNode* aNode)
     : AudioNodeEngine(aNode)
   {
     MOZ_ASSERT(NS_IsMainThread());
   }
--- a/dom/media/webaudio/ChannelMergerNode.h
+++ b/dom/media/webaudio/ChannelMergerNode.h
@@ -17,17 +17,17 @@ struct ChannelMergerOptions;
 
 class ChannelMergerNode final : public AudioNode
 {
 public:
   static already_AddRefed<ChannelMergerNode>
   Create(AudioContext& aAudioContext, const ChannelMergerOptions& aOptions,
          ErrorResult& aRv);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(ChannelMergerNode, AudioNode)
 
   static already_AddRefed<ChannelMergerNode>
   Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext,
               const ChannelMergerOptions& aOptions, ErrorResult& aRv)
   {
     return Create(aAudioContext, aOptions, aRv);
   }
 
--- a/dom/media/webaudio/ChannelSplitterNode.cpp
+++ b/dom/media/webaudio/ChannelSplitterNode.cpp
@@ -7,18 +7,16 @@
 #include "mozilla/dom/ChannelSplitterNode.h"
 #include "mozilla/dom/ChannelSplitterNodeBinding.h"
 #include "AudioNodeEngine.h"
 #include "AudioNodeStream.h"
 
 namespace mozilla {
 namespace dom {
 
-NS_IMPL_ISUPPORTS_INHERITED0(ChannelSplitterNode, AudioNode)
-
 class ChannelSplitterNodeEngine final : public AudioNodeEngine
 {
 public:
   explicit ChannelSplitterNodeEngine(ChannelSplitterNode* aNode)
     : AudioNodeEngine(aNode)
   {
     MOZ_ASSERT(NS_IsMainThread());
   }
--- a/dom/media/webaudio/ChannelSplitterNode.h
+++ b/dom/media/webaudio/ChannelSplitterNode.h
@@ -17,17 +17,17 @@ struct ChannelSplitterOptions;
 
 class ChannelSplitterNode final : public AudioNode
 {
 public:
   static already_AddRefed<ChannelSplitterNode>
   Create(AudioContext& aAudioContext, const ChannelSplitterOptions& aOptions,
          ErrorResult& aRv);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(ChannelSplitterNode, AudioNode)
 
   static already_AddRefed<ChannelSplitterNode>
   Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext,
               const ChannelSplitterOptions& aOptions, ErrorResult& aRv)
   {
     return Create(aAudioContext, aOptions, aRv);
   }
 
--- a/dom/media/webaudio/IIRFilterNode.cpp
+++ b/dom/media/webaudio/IIRFilterNode.cpp
@@ -11,18 +11,16 @@
 #include "PlayingRefChangeHandler.h"
 #include "AlignmentUtils.h"
 
 #include "nsGkAtoms.h"
 
 namespace mozilla {
 namespace dom {
 
-NS_IMPL_ISUPPORTS_INHERITED0(IIRFilterNode, AudioNode)
-
 class IIRFilterNodeEngine final : public AudioNodeEngine
 {
 public:
   IIRFilterNodeEngine(AudioNode* aNode, AudioDestinationNode* aDestination,
                       const AudioDoubleArray &aFeedforward,
                       const AudioDoubleArray &aFeedback,
                       uint64_t aWindowID)
     : AudioNodeEngine(aNode)
--- a/dom/media/webaudio/IIRFilterNode.h
+++ b/dom/media/webaudio/IIRFilterNode.h
@@ -19,17 +19,17 @@ struct IIRFilterOptions;
 
 class IIRFilterNode final : public AudioNode
 {
 public:
   static already_AddRefed<IIRFilterNode>
   Create(AudioContext& aAudioContext, const IIRFilterOptions& aOptions,
          ErrorResult& aRv);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(IIRFilterNode, AudioNode)
 
   static already_AddRefed<IIRFilterNode>
   Constructor(const GlobalObject& aGlobal, AudioContext& aAudioContext,
               const IIRFilterOptions& aOptions, ErrorResult& aRv)
   {
     return Create(aAudioContext, aOptions, aRv);
   }
 
--- a/dom/media/webaudio/ScriptProcessorNode.cpp
+++ b/dom/media/webaudio/ScriptProcessorNode.cpp
@@ -20,18 +20,16 @@
 
 namespace mozilla {
 namespace dom {
 
 // The maximum latency, in seconds, that we can live with before dropping
 // buffers.
 static const float MAX_LATENCY_S = 0.5;
 
-NS_IMPL_ISUPPORTS_INHERITED0(ScriptProcessorNode, AudioNode)
-
 // This class manages a queue of output buffers shared between
 // the main thread and the Media Stream Graph thread.
 class SharedBuffers final
 {
 private:
   class OutputQueue final
   {
   public:
--- a/dom/media/webaudio/ScriptProcessorNode.h
+++ b/dom/media/webaudio/ScriptProcessorNode.h
@@ -18,17 +18,17 @@ class SharedBuffers;
 class ScriptProcessorNode final : public AudioNode
 {
 public:
   ScriptProcessorNode(AudioContext* aContext,
                       uint32_t aBufferSize,
                       uint32_t aNumberOfInputChannels,
                       uint32_t aNumberOfOutputChannels);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(ScriptProcessorNode, AudioNode)
 
   IMPL_EVENT_HANDLER(audioprocess)
 
   using EventTarget::EventListenerAdded;
   void EventListenerAdded(nsAtom* aType) override;
 
   using EventTarget::EventListenerRemoved;
   void EventListenerRemoved(nsAtom* aType) override;
--- a/dom/notification/Notification.cpp
+++ b/dom/notification/Notification.cpp
@@ -1197,17 +1197,18 @@ Notification::GetPrincipal()
     NS_ENSURE_TRUE(sop, nullptr);
     return sop->GetPrincipal();
   }
 }
 
 class WorkerNotificationObserver final : public MainThreadNotificationObserver
 {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(WorkerNotificationObserver,
+                                       MainThreadNotificationObserver)
   NS_DECL_NSIOBSERVER
 
   explicit WorkerNotificationObserver(UniquePtr<NotificationRef> aRef)
     : MainThreadNotificationObserver(Move(aRef))
   {
     AssertIsOnMainThread();
     MOZ_ASSERT(mNotificationRef->GetNotification()->mWorkerPrivate);
   }
@@ -1227,18 +1228,16 @@ protected:
     MOZ_ASSERT(mNotificationRef);
     Notification* notification = mNotificationRef->GetNotification();
     if (notification) {
       notification->mObserver = nullptr;
     }
   }
 };
 
-NS_IMPL_ISUPPORTS_INHERITED0(WorkerNotificationObserver, MainThreadNotificationObserver)
-
 class ServiceWorkerNotificationObserver final : public nsIObserver
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
 
   ServiceWorkerNotificationObserver(const nsAString& aScope,
                                     nsIPrincipal* aPrincipal,
--- a/dom/presentation/PresentationCallbacks.cpp
+++ b/dom/presentation/PresentationCallbacks.cpp
@@ -73,19 +73,16 @@ PresentationRequesterCallback::NotifyErr
   mPromise->MaybeReject(aError);
   return NS_OK;
 }
 
 /*
  * Implementation of PresentationRequesterCallback
  */
 
-NS_IMPL_ISUPPORTS_INHERITED0(PresentationReconnectCallback,
-                             PresentationRequesterCallback)
-
 PresentationReconnectCallback::PresentationReconnectCallback(
                                            PresentationRequest* aRequest,
                                            const nsAString& aSessionId,
                                            Promise* aPromise,
                                            PresentationConnection* aConnection)
   : PresentationRequesterCallback(aRequest, aSessionId, aPromise)
   , mConnection(aConnection)
 {
--- a/dom/presentation/PresentationCallbacks.h
+++ b/dom/presentation/PresentationCallbacks.h
@@ -40,17 +40,18 @@ protected:
   RefPtr<PresentationRequest> mRequest;
   nsString mSessionId;
   RefPtr<Promise> mPromise;
 };
 
 class PresentationReconnectCallback final : public PresentationRequesterCallback
 {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(PresentationReconnectCallback,
+                                       PresentationRequesterCallback)
   NS_DECL_NSIPRESENTATIONSERVICECALLBACK
 
   PresentationReconnectCallback(PresentationRequest* aRequest,
                                 const nsAString& aSessionId,
                                 Promise* aPromise,
                                 PresentationConnection* aConnection);
 
 private:
--- a/dom/presentation/PresentationTransportBuilderConstructor.cpp
+++ b/dom/presentation/PresentationTransportBuilderConstructor.cpp
@@ -21,19 +21,16 @@ NS_IMETHODIMP
 DummyPresentationTransportBuilderConstructor::CreateTransportBuilder(
                               uint8_t aType,
                               nsIPresentationSessionTransportBuilder** aRetval)
 {
   MOZ_ASSERT(false, "Unexpected to be invoked.");
   return NS_OK;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(PresentationTransportBuilderConstructor,
-                             DummyPresentationTransportBuilderConstructor)
-
 /* static */ already_AddRefed<nsIPresentationTransportBuilderConstructor>
 PresentationTransportBuilderConstructor::Create()
 {
   nsCOMPtr<nsIPresentationTransportBuilderConstructor> constructor;
   if (XRE_IsContentProcess()) {
     constructor = new DummyPresentationTransportBuilderConstructor();
   } else {
     constructor = new PresentationTransportBuilderConstructor();
--- a/dom/presentation/PresentationTransportBuilderConstructor.h
+++ b/dom/presentation/PresentationTransportBuilderConstructor.h
@@ -26,17 +26,18 @@ public:
 protected:
   virtual ~DummyPresentationTransportBuilderConstructor() = default;
 };
 
 class PresentationTransportBuilderConstructor final :
   public DummyPresentationTransportBuilderConstructor
 {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(PresentationTransportBuilderConstructor,
+                                       DummyPresentationTransportBuilderConstructor)
   NS_DECL_NSIPRESENTATIONTRANSPORTBUILDERCONSTRUCTOR
 
   static already_AddRefed<nsIPresentationTransportBuilderConstructor>
   Create();
 
 private:
   PresentationTransportBuilderConstructor() = default;
   virtual ~PresentationTransportBuilderConstructor() = default;
--- a/dom/quota/ActorsParent.cpp
+++ b/dom/quota/ActorsParent.cpp
@@ -965,16 +965,18 @@ protected:
   {
     AssertIsOnOwningThread();
   }
 
   ~NormalOriginOperationBase()
   { }
 
 private:
+  // Need to declare refcounting unconditionally, because
+  // OpenDirectoryListener has pure-virtual refcounting.
   NS_DECL_ISUPPORTS_INHERITED
 
   virtual void
   Open() override;
 
   virtual void
   UnblockOpen() override;
 
--- a/dom/quota/FileStreams.cpp
+++ b/dom/quota/FileStreams.cpp
@@ -85,48 +85,42 @@ FileQuotaStreamWithWrite<FileStreamBase>
   }
 
   rv = FileStreamBase::Write(aBuf, aCount, _retval);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(FileInputStream, nsFileInputStream)
-
 already_AddRefed<FileInputStream>
 FileInputStream::Create(PersistenceType aPersistenceType,
                         const nsACString& aGroup, const nsACString& aOrigin,
                         nsIFile* aFile, int32_t aIOFlags, int32_t aPerm,
                         int32_t aBehaviorFlags)
 {
   RefPtr<FileInputStream> stream =
     new FileInputStream(aPersistenceType, aGroup, aOrigin);
   nsresult rv = stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags);
   NS_ENSURE_SUCCESS(rv, nullptr);
   return stream.forget();
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(FileOutputStream, nsFileOutputStream)
-
 already_AddRefed<FileOutputStream>
 FileOutputStream::Create(PersistenceType aPersistenceType,
                          const nsACString& aGroup, const nsACString& aOrigin,
                          nsIFile* aFile, int32_t aIOFlags, int32_t aPerm,
                          int32_t aBehaviorFlags)
 {
   RefPtr<FileOutputStream> stream =
     new FileOutputStream(aPersistenceType, aGroup, aOrigin);
   nsresult rv = stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags);
   NS_ENSURE_SUCCESS(rv, nullptr);
   return stream.forget();
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(FileStream, nsFileStream)
-
 already_AddRefed<FileStream>
 FileStream::Create(PersistenceType aPersistenceType, const nsACString& aGroup,
                    const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags,
                    int32_t aPerm, int32_t aBehaviorFlags)
 {
   RefPtr<FileStream> stream =
     new FileStream(aPersistenceType, aGroup, aOrigin);
   nsresult rv = stream->Init(aFile, aIOFlags, aPerm, aBehaviorFlags);
--- a/dom/quota/FileStreams.h
+++ b/dom/quota/FileStreams.h
@@ -56,17 +56,18 @@ protected:
                            const nsACString& aGroup, const nsACString& aOrigin)
   : FileQuotaStream<FileStreamBase>(aPersistenceType, aGroup, aOrigin)
   { }
 };
 
 class FileInputStream : public FileQuotaStream<nsFileInputStream>
 {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(FileInputStream,
+                                       FileQuotaStream<nsFileInputStream>)
 
   static already_AddRefed<FileInputStream>
   Create(PersistenceType aPersistenceType, const nsACString& aGroup,
          const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags = -1,
          int32_t aPerm = -1, int32_t aBehaviorFlags = 0);
 
 private:
   FileInputStream(PersistenceType aPersistenceType, const nsACString& aGroup,
@@ -77,17 +78,18 @@ private:
   virtual ~FileInputStream() {
     Close();
   }
 };
 
 class FileOutputStream : public FileQuotaStreamWithWrite<nsFileOutputStream>
 {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(FileOutputStream,
+                                       FileQuotaStreamWithWrite<nsFileOutputStream>);
 
   static already_AddRefed<FileOutputStream>
   Create(PersistenceType aPersistenceType, const nsACString& aGroup,
          const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags = -1,
          int32_t aPerm = -1, int32_t aBehaviorFlags = 0);
 
 private:
   FileOutputStream(PersistenceType aPersistenceType, const nsACString& aGroup,
@@ -99,17 +101,18 @@ private:
   virtual ~FileOutputStream() {
     Close();
   }
 };
 
 class FileStream : public FileQuotaStreamWithWrite<nsFileStream>
 {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(FileStream,
+                                       FileQuotaStreamWithWrite<nsFileStream>)
 
   static already_AddRefed<FileStream>
   Create(PersistenceType aPersistenceType, const nsACString& aGroup,
          const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags = -1,
          int32_t aPerm = -1, int32_t aBehaviorFlags = 0);
 
 private:
   FileStream(PersistenceType aPersistenceType, const nsACString& aGroup,
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -1165,17 +1165,17 @@ class WorkerThreadPrimaryRunnable final 
   public:
     explicit FinishedRunnable(already_AddRefed<WorkerThread> aThread)
     : Runnable("WorkerThreadPrimaryRunnable::FinishedRunnable")
     , mThread(aThread)
     {
       MOZ_ASSERT(mThread);
     }
 
-    NS_DECL_ISUPPORTS_INHERITED
+    NS_INLINE_DECL_REFCOUNTING_INHERITED(FinishedRunnable, Runnable)
 
   private:
     ~FinishedRunnable()
     { }
 
     NS_DECL_NSIRUNNABLE
   };
 
@@ -1187,17 +1187,17 @@ public:
     , mWorkerPrivate(aWorkerPrivate)
     , mThread(aThread)
     , mParentRuntime(aParentRuntime)
   {
     MOZ_ASSERT(aWorkerPrivate);
     MOZ_ASSERT(aThread);
   }
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(WorkerThreadPrimaryRunnable, Runnable)
 
 private:
   ~WorkerThreadPrimaryRunnable()
   { }
 
   NS_DECL_NSIRUNNABLE
 };
 
@@ -2657,18 +2657,16 @@ LogViolationDetailsRunnable::MainThreadR
                                mFileName, scriptSample, mLineNum,
                                EmptyString(), EmptyString());
     }
   }
 
   return true;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(WorkerThreadPrimaryRunnable, Runnable)
-
 NS_IMETHODIMP
 WorkerThreadPrimaryRunnable::Run()
 {
   AUTO_PROFILER_LABEL_DYNAMIC_LOSSY_NSSTRING(
     "WorkerThreadPrimaryRunnable::Run", OTHER, mWorkerPrivate->ScriptURL());
 
   using mozilla::ipc::BackgroundChild;
 
@@ -2787,19 +2785,16 @@ WorkerThreadPrimaryRunnable::Run()
   RefPtr<FinishedRunnable> finishedRunnable =
     new FinishedRunnable(mThread.forget());
   MOZ_ALWAYS_SUCCEEDS(mainTarget->Dispatch(finishedRunnable,
                                            NS_DISPATCH_NORMAL));
 
   return NS_OK;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(WorkerThreadPrimaryRunnable::FinishedRunnable,
-                             Runnable)
-
 NS_IMETHODIMP
 WorkerThreadPrimaryRunnable::FinishedRunnable::Run()
 {
   AssertIsOnMainThread();
 
   RefPtr<WorkerThread> thread;
   mThread.swap(thread);
 
--- a/dom/workers/WorkerLoadInfo.cpp
+++ b/dom/workers/WorkerLoadInfo.cpp
@@ -35,17 +35,17 @@ public:
   MainThreadReleaseRunnable(nsTArray<nsCOMPtr<nsISupports>>& aDoomed,
                             nsCOMPtr<nsILoadGroup>& aLoadGroupToCancel)
     : mozilla::Runnable("MainThreadReleaseRunnable")
   {
     mDoomed.SwapElements(aDoomed);
     mLoadGroupToCancel.swap(aLoadGroupToCancel);
   }
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(MainThreadReleaseRunnable, Runnable)
 
   NS_IMETHOD
   Run() override
   {
     if (mLoadGroupToCancel) {
       mLoadGroupToCancel->Cancel(NS_BINDING_ABORTED);
       mLoadGroupToCancel = nullptr;
     }
@@ -78,18 +78,16 @@ SwapToISupportsArray(SmartPtr<T>& aSrc,
 
   nsISupports* rawSupports =
     static_cast<typename ISupportsBaseInfo<T>::ISupportsBase*>(raw);
   dest->swap(rawSupports);
 }
 
 } // anonymous
 
-NS_IMPL_ISUPPORTS_INHERITED0(MainThreadReleaseRunnable, Runnable)
-
 WorkerLoadInfo::WorkerLoadInfo()
   : mLoadFlags(nsIRequest::LOAD_NORMAL)
   , mWindowID(UINT64_MAX)
   , mReferrerPolicy(net::RP_Unset)
   , mFromWindow(false)
   , mEvalAllowed(false)
   , mReportCSPViolations(false)
   , mXHRParamsAllowed(false)
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -144,17 +144,17 @@ public:
                           nsIRunnable* aWrappedRunnable)
   : WorkerRunnable(aWorkerPrivate, WorkerThreadUnchangedBusyCount),
     mWrappedRunnable(aWrappedRunnable)
   {
     MOZ_ASSERT(aWorkerPrivate);
     MOZ_ASSERT(aWrappedRunnable);
   }
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(ExternalRunnableWrapper, WorkerRunnable)
 
 private:
   ~ExternalRunnableWrapper()
   { }
 
   virtual bool
   PreDispatch(WorkerPrivate* aWorkerPrivate) override
   {
@@ -261,17 +261,17 @@ class TopLevelWorkerFinishedRunnable fin
 public:
   explicit TopLevelWorkerFinishedRunnable(WorkerPrivate* aFinishedWorker)
     : mozilla::Runnable("TopLevelWorkerFinishedRunnable")
     , mFinishedWorker(aFinishedWorker)
   {
     aFinishedWorker->AssertIsOnWorkerThread();
   }
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(TopLevelWorkerFinishedRunnable, Runnable)
 
 private:
   ~TopLevelWorkerFinishedRunnable() {}
 
   NS_IMETHOD
   Run() override
   {
     AssertIsOnMainThread();
@@ -956,19 +956,16 @@ public:
     : WorkerHolder("SimpleWorkerHolder")
   {}
 
   virtual bool Notify(WorkerStatus aStatus) override { return true; }
 };
 
 } /* anonymous namespace */
 
-NS_IMPL_ISUPPORTS_INHERITED0(TopLevelWorkerFinishedRunnable, Runnable)
-
-
 class WorkerPrivate::EventTarget final : public nsISerialEventTarget
 {
   // This mutex protects mWorkerPrivate and must be acquired *before* the
   // WorkerPrivate's mutex whenever they must both be held.
   mozilla::Mutex mMutex;
   WorkerPrivate* mWorkerPrivate;
   nsIEventTarget* mWeakNestedEventTarget;
   nsCOMPtr<nsIEventTarget> mNestedEventTarget;
@@ -5244,18 +5241,16 @@ WorkerPrivate::GetPerformanceStorage()
 
   if (!mPerformanceStorage) {
     mPerformanceStorage = PerformanceStorageWorker::Create(this);
   }
 
   return mPerformanceStorage;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(ExternalRunnableWrapper, WorkerRunnable)
-
 NS_IMPL_ADDREF(WorkerPrivate::EventTarget)
 NS_IMPL_RELEASE(WorkerPrivate::EventTarget)
 
 NS_INTERFACE_MAP_BEGIN(WorkerPrivate::EventTarget)
   NS_INTERFACE_MAP_ENTRY(nsISerialEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsIEventTarget)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
 #ifdef DEBUG
--- a/dom/workers/WorkerRunnable.cpp
+++ b/dom/workers/WorkerRunnable.cpp
@@ -558,18 +558,16 @@ WorkerControlRunnable::DispatchInternal(
 
   if (WorkerPrivate* parent = mWorkerPrivate->GetParent()) {
     return NS_SUCCEEDED(parent->DispatchControlRunnable(runnable.forget()));
   }
 
   return NS_SUCCEEDED(mWorkerPrivate->DispatchToMainThread(runnable.forget()));
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(WorkerControlRunnable, WorkerRunnable)
-
 WorkerMainThreadRunnable::WorkerMainThreadRunnable(
   WorkerPrivate* aWorkerPrivate,
   const nsACString& aTelemetryKey)
   : mozilla::Runnable("dom::WorkerMainThreadRunnable")
   , mWorkerPrivate(aWorkerPrivate)
   , mTelemetryKey(aTelemetryKey)
 {
   mWorkerPrivate->AssertIsOnWorkerThread();
--- a/dom/workers/WorkerRunnable.h
+++ b/dom/workers/WorkerRunnable.h
@@ -291,17 +291,17 @@ protected:
 
   virtual ~WorkerControlRunnable()
   { }
 
   nsresult
   Cancel() override;
 
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(WorkerControlRunnable, WorkerRunnable)
 
 private:
   virtual bool
   DispatchInternal() override;
 
   // Should only be called by WorkerPrivate::DoRunLoop.
   using WorkerRunnable::Cancel;
 };
--- a/dom/workers/WorkerThread.cpp
+++ b/dom/workers/WorkerThread.cpp
@@ -202,18 +202,16 @@ WorkerThread::DispatchAnyThread(const Wo
 
   // We don't need to notify the worker's condition variable here because we're
   // being called from worker-controlled code and it will make sure to wake up
   // the worker thread if needed.
 
   return NS_OK;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(WorkerThread, nsThread)
-
 NS_IMETHODIMP
 WorkerThread::DispatchFromScript(nsIRunnable* aRunnable, uint32_t aFlags)
 {
   nsCOMPtr<nsIRunnable> runnable(aRunnable);
   return Dispatch(runnable.forget(), aFlags);
 }
 
 NS_IMETHODIMP
--- a/dom/workers/WorkerThread.h
+++ b/dom/workers/WorkerThread.h
@@ -76,17 +76,17 @@ public:
 
   nsresult
   DispatchAnyThread(const WorkerThreadFriendKey& aKey,
            already_AddRefed<WorkerRunnable> aWorkerRunnable);
 
   uint32_t
   RecursionDepth(const WorkerThreadFriendKey& aKey) const;
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(WorkerThread, nsThread)
 
 private:
   WorkerThread();
   ~WorkerThread();
 
   // This should only be called by consumers that have an
   // nsIEventTarget/nsIThread pointer.
   NS_IMETHOD
--- a/editor/composer/nsComposerCommands.cpp
+++ b/editor/composer/nsComposerCommands.cpp
@@ -70,18 +70,16 @@ nsBaseStateUpdatingCommand::nsBaseStateU
 {
   MOZ_ASSERT(mTagName);
 }
 
 nsBaseStateUpdatingCommand::~nsBaseStateUpdatingCommand()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsBaseStateUpdatingCommand, nsBaseComposerCommand)
-
 NS_IMETHODIMP
 nsBaseStateUpdatingCommand::IsCommandEnabled(const char *aCommandName,
                                              nsISupports *refCon,
                                              bool *outCmdEnabled)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     *outCmdEnabled = false;
@@ -580,18 +578,16 @@ nsMultiStateCommand::nsMultiStateCommand
 : nsBaseComposerCommand()
 {
 }
 
 nsMultiStateCommand::~nsMultiStateCommand()
 {
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsMultiStateCommand, nsBaseComposerCommand)
-
 NS_IMETHODIMP
 nsMultiStateCommand::IsCommandEnabled(const char * aCommandName,
                                       nsISupports *refCon,
                                       bool *outCmdEnabled)
 {
   nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
   if (!editor) {
     *outCmdEnabled = false;
@@ -1411,18 +1407,16 @@ nsInsertHTMLCommand::GetCommandStatePara
   NS_ENSURE_ARG_POINTER(aParams);
   NS_ENSURE_ARG_POINTER(refCon);
 
   bool outCmdEnabled = false;
   IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
   return aParams->SetBooleanValue(STATE_ENABLED, outCmdEnabled);
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsInsertTagCommand, nsBaseComposerCommand)
-
 nsInsertTagCommand::nsInsertTagCommand(nsAtom* aTagName)
 : nsBaseComposerCommand()
 , mTagName(aTagName)
 {
   MOZ_ASSERT(mTagName);
 }
 
 nsInsertTagCommand::~nsInsertTagCommand()
--- a/editor/composer/nsComposerCommands.h
+++ b/editor/composer/nsComposerCommands.h
@@ -55,17 +55,18 @@ public:                                 
 };
 
 // virtual base class for commands that need to save and update Boolean state (like styles etc)
 class nsBaseStateUpdatingCommand : public nsBaseComposerCommand
 {
 public:
   explicit nsBaseStateUpdatingCommand(nsAtom* aTagName);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsBaseStateUpdatingCommand,
+                                       nsBaseComposerCommand)
 
   NS_DECL_NSICONTROLLERCOMMAND
 
 protected:
   virtual ~nsBaseStateUpdatingCommand();
 
   // get the current state (on or off) for this style or block format
   virtual nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
@@ -97,17 +98,17 @@ protected:
 };
 
 
 class nsInsertTagCommand : public nsBaseComposerCommand
 {
 public:
   explicit nsInsertTagCommand(nsAtom* aTagName);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsInsertTagCommand, nsBaseComposerCommand)
 
   NS_DECL_NSICONTROLLERCOMMAND
 
 protected:
   virtual ~nsInsertTagCommand();
 
   nsAtom* mTagName;
 };
@@ -145,17 +146,17 @@ protected:
 
 // Base class for commands whose state consists of a string (e.g. para format)
 class nsMultiStateCommand : public nsBaseComposerCommand
 {
 public:
 
   nsMultiStateCommand();
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsMultiStateCommand, nsBaseComposerCommand)
   NS_DECL_NSICONTROLLERCOMMAND
 
 protected:
   virtual ~nsMultiStateCommand();
 
   virtual nsresult GetCurrentState(mozilla::HTMLEditor* aHTMLEditor,
                                    nsICommandParams* aParams) = 0;
   virtual nsresult SetState(mozilla::HTMLEditor* aHTMLEditor,
--- a/gfx/thebes/gfxFontInfoLoader.cpp
+++ b/gfx/thebes/gfxFontInfoLoader.cpp
@@ -37,94 +37,95 @@ FontInfoData::Load()
     }
 
     mLoadTime = TimeStamp::Now() - start;
 }
 
 class FontInfoLoadCompleteEvent : public Runnable {
     virtual ~FontInfoLoadCompleteEvent() {}
 
-    NS_DECL_ISUPPORTS_INHERITED
+public:
+    NS_INLINE_DECL_REFCOUNTING_INHERITED(FontInfoLoadCompleteEvent, Runnable)
 
     explicit FontInfoLoadCompleteEvent(FontInfoData* aFontInfo)
       : mozilla::Runnable("FontInfoLoadCompleteEvent")
       , mFontInfo(aFontInfo)
     {}
 
     NS_IMETHOD Run() override;
 
+private:
     RefPtr<FontInfoData> mFontInfo;
 };
 
 class AsyncFontInfoLoader : public Runnable {
     virtual ~AsyncFontInfoLoader() {}
 
-    NS_DECL_ISUPPORTS_INHERITED
+public:
+    NS_INLINE_DECL_REFCOUNTING_INHERITED(AsyncFontInfoLoader, Runnable)
 
     explicit AsyncFontInfoLoader(FontInfoData* aFontInfo)
       : mozilla::Runnable("AsyncFontInfoLoader")
       , mFontInfo(aFontInfo)
     {
         mCompleteEvent = new FontInfoLoadCompleteEvent(aFontInfo);
     }
 
     NS_IMETHOD Run() override;
 
+private:
     RefPtr<FontInfoData> mFontInfo;
     RefPtr<FontInfoLoadCompleteEvent> mCompleteEvent;
 };
 
 class ShutdownThreadEvent : public Runnable {
     virtual ~ShutdownThreadEvent() {}
 
-    NS_DECL_ISUPPORTS_INHERITED
+public:
+    NS_INLINE_DECL_REFCOUNTING_INHERITED(ShutdownThreadEvent, Runnable)
 
     explicit ShutdownThreadEvent(nsIThread* aThread)
       : mozilla::Runnable("ShutdownThreadEvent")
       , mThread(aThread)
     {
     }
     NS_IMETHOD Run() override {
         mThread->Shutdown();
         return NS_OK;
     }
+
+private:
     nsCOMPtr<nsIThread> mThread;
 };
 
-NS_IMPL_ISUPPORTS_INHERITED0(ShutdownThreadEvent, Runnable);
-
 // runs on main thread after async font info loading is done
 nsresult
 FontInfoLoadCompleteEvent::Run()
 {
     gfxFontInfoLoader *loader =
         static_cast<gfxFontInfoLoader*>(gfxPlatformFontList::PlatformFontList());
 
     loader->FinalizeLoader(mFontInfo);
 
     return NS_OK;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(FontInfoLoadCompleteEvent, Runnable);
-
 // runs on separate thread
 nsresult
 AsyncFontInfoLoader::Run()
 {
     // load platform-specific font info
     mFontInfo->Load();
 
     // post a completion event that transfer the data to the fontlist
     NS_DispatchToMainThread(mCompleteEvent);
 
     return NS_OK;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(AsyncFontInfoLoader, Runnable);
-
 NS_IMPL_ISUPPORTS(gfxFontInfoLoader::ShutdownObserver, nsIObserver)
 
 NS_IMETHODIMP
 gfxFontInfoLoader::ShutdownObserver::Observe(nsISupports *aSubject,
                                              const char *aTopic,
                                              const char16_t *someData)
 {
     if (!nsCRT::strcmp(aTopic, "quit-application")) {
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -300,17 +300,18 @@ void CrashStatsLogForwarder::UpdateCrash
            mCrashCriticalKey.get(), message.str().c_str());
   }
 }
 
 class LogForwarderEvent : public Runnable
 {
   ~LogForwarderEvent() override = default;
 
-  NS_DECL_ISUPPORTS_INHERITED
+public:
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(LogForwarderEvent, Runnable)
 
   explicit LogForwarderEvent(const nsCString& aMessage)
     : mozilla::Runnable("LogForwarderEvent")
     , mMessage(aMessage)
   {
   }
 
   NS_IMETHOD Run() override {
@@ -326,18 +327,16 @@ class LogForwarderEvent : public Runnabl
 
     return NS_OK;
   }
 
 protected:
   nsCString mMessage;
 };
 
-NS_IMPL_ISUPPORTS_INHERITED0(LogForwarderEvent, Runnable);
-
 void CrashStatsLogForwarder::Log(const std::string& aString)
 {
   MutexAutoLock lock(mMutex);
 
   if (UpdateStringsVector(aString)) {
     UpdateCrashReport();
   }
 
@@ -358,17 +357,18 @@ void CrashStatsLogForwarder::Log(const s
     }
   }
 }
 
 class CrashTelemetryEvent : public Runnable
 {
   ~CrashTelemetryEvent() override = default;
 
-  NS_DECL_ISUPPORTS_INHERITED
+public:
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(CrashTelemetryEvent, Runnable)
 
   explicit CrashTelemetryEvent(uint32_t aReason)
     : mozilla::Runnable("CrashTelemetryEvent")
     , mReason(aReason)
   {
   }
 
   NS_IMETHOD Run() override {
@@ -376,18 +376,16 @@ class CrashTelemetryEvent : public Runna
     Telemetry::Accumulate(Telemetry::GFX_CRASH, mReason);
     return NS_OK;
   }
 
 protected:
   uint32_t mReason;
 };
 
-NS_IMPL_ISUPPORTS_INHERITED0(CrashTelemetryEvent, Runnable);
-
 void
 CrashStatsLogForwarder::CrashAction(LogReason aReason)
 {
 #ifndef RELEASE_OR_BETA
   // Non-release builds crash by default, but will use telemetry
   // if this environment variable is present.
   static bool useTelemetry = gfxEnv::GfxDevCrashTelemetry();
 #else
--- a/image/ClippedImage.cpp
+++ b/image/ClippedImage.cpp
@@ -205,18 +205,16 @@ ClippedImage::ShouldClip()
       mShouldClip.emplace(false);
     }
   }
 
   MOZ_ASSERT(mShouldClip.isSome(), "Should have computed a result");
   return *mShouldClip;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(ClippedImage, ImageWrapper)
-
 NS_IMETHODIMP
 ClippedImage::GetWidth(int32_t* aWidth)
 {
   if (!ShouldClip()) {
     return InnerImage()->GetWidth(aWidth);
   }
 
   *aWidth = mClip.Width();
--- a/image/ClippedImage.h
+++ b/image/ClippedImage.h
@@ -25,17 +25,17 @@ class DrawSingleTileCallback;
  * XXX(seth): There a known (performance, not correctness) issue with
  * GetImageContainer. See the comments for that method for more information.
  */
 class ClippedImage : public ImageWrapper
 {
   typedef gfx::SourceSurface SourceSurface;
 
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(ClippedImage, ImageWrapper)
 
   NS_IMETHOD GetWidth(int32_t* aWidth) override;
   NS_IMETHOD GetHeight(int32_t* aHeight) override;
   NS_IMETHOD GetIntrinsicSize(nsSize* aSize) override;
   NS_IMETHOD GetIntrinsicRatio(nsSize* aRatio) override;
   NS_IMETHOD_(already_AddRefed<SourceSurface>)
     GetFrame(uint32_t aWhichFrame, uint32_t aFlags) override;
   NS_IMETHOD_(already_AddRefed<SourceSurface>)
--- a/image/FrozenImage.cpp
+++ b/image/FrozenImage.cpp
@@ -8,18 +8,16 @@
 namespace mozilla {
 
 using namespace gfx;
 using layers::ImageContainer;
 using layers::LayerManager;
 
 namespace image {
 
-NS_IMPL_ISUPPORTS_INHERITED0(FrozenImage, ImageWrapper)
-
 void
 FrozenImage::IncrementAnimationConsumers()
 {
   // Do nothing. This will prevent animation from starting if there are no other
   // instances of this image.
 }
 
 void
--- a/image/FrozenImage.h
+++ b/image/FrozenImage.h
@@ -24,17 +24,17 @@ namespace image {
  * XXX(seth): There a known (performance, not correctness) issue with
  * GetImageContainer. See the comments for that method for more information.
  */
 class FrozenImage : public ImageWrapper
 {
   typedef gfx::SourceSurface SourceSurface;
 
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(FrozenImage, ImageWrapper)
 
   virtual void IncrementAnimationConsumers() override;
   virtual void DecrementAnimationConsumers() override;
 
   NS_IMETHOD GetAnimated(bool* aAnimated) override;
   NS_IMETHOD_(already_AddRefed<SourceSurface>)
     GetFrame(uint32_t aWhichFrame, uint32_t aFlags) override;
   NS_IMETHOD_(already_AddRefed<SourceSurface>)
--- a/image/MultipartImage.h
+++ b/image/MultipartImage.h
@@ -20,16 +20,18 @@ class NextPartObserver;
  * images.
  */
 class MultipartImage
   : public ImageWrapper
   , public IProgressObserver
 {
 public:
   MOZ_DECLARE_REFCOUNTED_TYPENAME(MultipartImage)
+  // We need to always declare refcounting here, because
+  // IProgressObserver has pure-virtual refcounting.
   NS_DECL_ISUPPORTS_INHERITED
 
   void BeginTransitionToPart(Image* aNextPart);
 
   // Overridden ImageWrapper methods:
   virtual already_AddRefed<imgIContainer> Unwrap() override;
   virtual already_AddRefed<ProgressTracker> GetProgressTracker() override;
   virtual void SetProgressTracker(ProgressTracker* aTracker) override;
--- a/image/OrientedImage.cpp
+++ b/image/OrientedImage.cpp
@@ -19,18 +19,16 @@ using std::swap;
 namespace mozilla {
 
 using namespace gfx;
 using layers::LayerManager;
 using layers::ImageContainer;
 
 namespace image {
 
-NS_IMPL_ISUPPORTS_INHERITED0(OrientedImage, ImageWrapper)
-
 NS_IMETHODIMP
 OrientedImage::GetWidth(int32_t* aWidth)
 {
   if (mOrientation.SwapsWidthAndHeight()) {
     return InnerImage()->GetHeight(aWidth);
   } else {
     return InnerImage()->GetWidth(aWidth);
   }
--- a/image/OrientedImage.h
+++ b/image/OrientedImage.h
@@ -21,17 +21,17 @@ namespace image {
  * XXX(seth): There a known (performance, not correctness) issue with
  * GetImageContainer. See the comments for that method for more information.
  */
 class OrientedImage : public ImageWrapper
 {
   typedef gfx::SourceSurface SourceSurface;
 
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(OrientedImage, ImageWrapper)
 
   NS_IMETHOD GetWidth(int32_t* aWidth) override;
   NS_IMETHOD GetHeight(int32_t* aHeight) override;
   nsresult GetNativeSizes(nsTArray<gfx::IntSize>& aNativeSizes) const override;
   NS_IMETHOD GetIntrinsicSize(nsSize* aSize) override;
   NS_IMETHOD GetIntrinsicRatio(nsSize* aRatio) override;
   NS_IMETHOD_(already_AddRefed<SourceSurface>)
     GetFrame(uint32_t aWhichFrame, uint32_t aFlags) override;
--- a/netwerk/cache2/AppCacheStorage.cpp
+++ b/netwerk/cache2/AppCacheStorage.cpp
@@ -16,18 +16,16 @@
 #include "nsIURI.h"
 #include "nsNetCID.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 
 namespace mozilla {
 namespace net {
 
-NS_IMPL_ISUPPORTS_INHERITED0(AppCacheStorage, CacheStorage)
-
 AppCacheStorage::AppCacheStorage(nsILoadContextInfo* aInfo,
                                  nsIApplicationCache* aAppCache)
 : CacheStorage(aInfo, true /* disk */, false /* lookup app cache */, false /* skip size check */, false /* pin */)
 , mAppCache(aAppCache)
 {
 }
 
 AppCacheStorage::~AppCacheStorage()
--- a/netwerk/cache2/AppCacheStorage.h
+++ b/netwerk/cache2/AppCacheStorage.h
@@ -13,17 +13,17 @@
 
 class nsIApplicationCache;
 
 namespace mozilla {
 namespace net {
 
 class AppCacheStorage : public CacheStorage
 {
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(AppCacheStorage, CacheStorage)
   NS_DECL_NSICACHESTORAGE
 
 public:
   AppCacheStorage(nsILoadContextInfo* aInfo,
                   nsIApplicationCache* aAppCache);
 
 private:
   virtual ~AppCacheStorage();
--- a/netwerk/protocol/file/nsFileChannel.cpp
+++ b/netwerk/protocol/file/nsFileChannel.cpp
@@ -163,17 +163,18 @@ nsFileCopyEvent::Dispatch(nsIRunnable *c
 
 //-----------------------------------------------------------------------------
 
 // This is a dummy input stream that when read, performs the file copy.  The
 // copy happens on a background thread via mCopyEvent.
 
 class nsFileUploadContentStream : public nsBaseContentStream {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsFileUploadContentStream,
+                                       nsBaseContentStream)
 
   nsFileUploadContentStream(bool nonBlocking,
                             nsIOutputStream *dest,
                             nsIInputStream *source,
                             int64_t len,
                             nsITransportEventSink *sink)
     : nsBaseContentStream(nonBlocking)
     , mCopyEvent(new nsFileCopyEvent(dest, source, len))
@@ -193,19 +194,16 @@ private:
   virtual ~nsFileUploadContentStream() {}
 
   void OnCopyComplete();
 
   RefPtr<nsFileCopyEvent> mCopyEvent;
   nsCOMPtr<nsITransportEventSink> mSink;
 };
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsFileUploadContentStream,
-                             nsBaseContentStream)
-
 NS_IMETHODIMP
 nsFileUploadContentStream::ReadSegments(nsWriteSegmentFun fun, void *closure,
                                         uint32_t count, uint32_t *result)
 {
   *result = 0;  // nothing is ever actually read from this stream
 
   if (IsClosed())
     return NS_OK;
--- a/toolkit/components/places/Shutdown.cpp
+++ b/toolkit/components/places/Shutdown.cpp
@@ -149,21 +149,16 @@ ClientsShutdownBlocker::Done()
     nsresult rv = mParentClient->RemoveBlocker(this);
     if (NS_WARN_IF(NS_FAILED(rv))) return rv;
     mParentClient = nullptr;
   }
   mBarrier = nullptr;
   return NS_OK;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(
-  ClientsShutdownBlocker,
-  PlacesShutdownBlocker
-)
-
 ////////////////////////////////////////////////////////////////////////////////
 
 ConnectionShutdownBlocker::ConnectionShutdownBlocker(Database* aDatabase)
   : PlacesShutdownBlocker(NS_LITERAL_STRING("Places Connection shutdown"))
   , mDatabase(aDatabase)
 {
   // Do nothing.
 }
--- a/toolkit/components/places/Shutdown.h
+++ b/toolkit/components/places/Shutdown.h
@@ -123,17 +123,18 @@ protected:
 };
 
 /**
  * Blocker also used to wait for clients, through an owned barrier.
  */
 class ClientsShutdownBlocker final : public PlacesShutdownBlocker
 {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(ClientsShutdownBlocker,
+				       PlacesShutdownBlocker)
 
   explicit ClientsShutdownBlocker();
 
   NS_IMETHOD Done() override;
 private:
   ~ClientsShutdownBlocker() {}
 };
 
--- a/widget/android/AndroidUiThread.cpp
+++ b/widget/android/AndroidUiThread.cpp
@@ -47,34 +47,32 @@ void EnqueueTask(already_AddRefed<nsIRun
  * nsThread nsIRunnable queue. This is due to the fact that Android controls the
  * event loop in the Android UI thread and has no knowledge of when the nsThread
  * needs to be drained.
 */
 
 class AndroidUiThread : public nsThread
 {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(AndroidUiThread, nsThread)
   AndroidUiThread()
     : nsThread(MakeNotNull<ThreadEventQueue<mozilla::EventQueue>*>(
                  MakeUnique<mozilla::EventQueue>()),
                nsThread::NOT_MAIN_THREAD,
                0)
   {}
 
   nsresult Dispatch(already_AddRefed<nsIRunnable> aEvent, uint32_t aFlags) override;
   nsresult DelayedDispatch(already_AddRefed<nsIRunnable> aEvent, uint32_t aDelayMs) override;
 
 private:
   ~AndroidUiThread()
   {}
 };
 
-NS_IMPL_ISUPPORTS_INHERITED0(AndroidUiThread, nsThread)
-
 NS_IMETHODIMP
 AndroidUiThread::Dispatch(already_AddRefed<nsIRunnable> aEvent, uint32_t aFlags)
 {
   if (aFlags & NS_DISPATCH_SYNC) {
     return nsThread::Dispatch(Move(aEvent), aFlags);
   } else {
     EnqueueTask(Move(aEvent), 0);
     return NS_OK;
--- a/widget/android/nsIdleServiceAndroid.cpp
+++ b/widget/android/nsIdleServiceAndroid.cpp
@@ -3,18 +3,16 @@
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIdleServiceAndroid.h"
 #include "nsIServiceManager.h"
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsIdleServiceAndroid, nsIdleService)
-
 bool
 nsIdleServiceAndroid::PollIdleTime(uint32_t *aIdleTime)
 {
     return false;
 }
 
 bool
 nsIdleServiceAndroid::UsePollMode()
--- a/widget/android/nsIdleServiceAndroid.h
+++ b/widget/android/nsIdleServiceAndroid.h
@@ -8,17 +8,17 @@
 #ifndef nsIdleServiceAndroid_h__
 #define nsIdleServiceAndroid_h__
 
 #include "nsIdleService.h"
 
 class nsIdleServiceAndroid : public nsIdleService
 {
 public:
-    NS_DECL_ISUPPORTS_INHERITED
+    NS_INLINE_DECL_REFCOUNTING_INHERITED(nsIdleServiceAndroid, nsIdleService)
 
     bool PollIdleTime(uint32_t* aIdleTime) override;
 
     static already_AddRefed<nsIdleServiceAndroid> GetInstance() 
     {
         RefPtr<nsIdleService> idleService = nsIdleService::GetInstance();
         if (!idleService) {
             idleService = new nsIdleServiceAndroid();
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -87,18 +87,16 @@ using mozilla::Unused;
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::layers;
 using namespace mozilla::java;
 using namespace mozilla::widget;
 using namespace mozilla::ipc;
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, nsBaseWidget)
-
 #include "mozilla/layers/CompositorBridgeChild.h"
 #include "mozilla/layers/CompositorSession.h"
 #include "mozilla/layers/LayerTransactionParent.h"
 #include "mozilla/layers/UiCompositorControllerChild.h"
 #include "mozilla/Services.h"
 #include "nsThreadUtils.h"
 
 // All the toplevel windows that have been created; these are in
--- a/widget/android/nsWindow.h
+++ b/widget/android/nsWindow.h
@@ -45,17 +45,17 @@ class nsWindow final : public nsBaseWidg
 private:
     virtual ~nsWindow();
 
 public:
     using nsBaseWidget::GetLayerManager;
 
     nsWindow();
 
-    NS_DECL_ISUPPORTS_INHERITED
+    NS_INLINE_DECL_REFCOUNTING_INHERITED(nsWindow, nsBaseWidget)
 
     static void InitNatives();
     void SetScreenId(uint32_t aScreenId) { mScreenId = aScreenId; }
     void EnableEventDispatcher();
 
 private:
     uint32_t mScreenId;
 
--- a/widget/cocoa/nsIdleServiceX.h
+++ b/widget/cocoa/nsIdleServiceX.h
@@ -5,17 +5,17 @@
 #ifndef nsIdleServiceX_h_
 #define nsIdleServiceX_h_
 
 #include "nsIdleService.h"
 
 class nsIdleServiceX : public nsIdleService
 {
 public:
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsIdleServiceX, nsIdleService)
 
   bool PollIdleTime(uint32_t* aIdleTime) override;
 
   static already_AddRefed<nsIdleServiceX> GetInstance() 
   {
     RefPtr<nsIdleService> idleService = nsIdleService::GetInstance();
     if (!idleService) {
       idleService = new nsIdleServiceX();
--- a/widget/cocoa/nsIdleServiceX.mm
+++ b/widget/cocoa/nsIdleServiceX.mm
@@ -2,18 +2,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIdleServiceX.h"
 #include "nsObjCExceptions.h"
 #include "nsIServiceManager.h"
 #import <Foundation/Foundation.h>
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsIdleServiceX, nsIdleService)
-
 bool
 nsIdleServiceX::PollIdleTime(uint32_t *aIdleTime)
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
 
   kern_return_t rval;
   mach_port_t masterPort;
 
--- a/widget/gtk/nsIdleServiceGTK.cpp
+++ b/widget/gtk/nsIdleServiceGTK.cpp
@@ -25,18 +25,16 @@ typedef XScreenSaverInfo* (*_XScreenSave
 typedef void (*_XScreenSaverQueryInfo_fn)(Display* dpy, Drawable drw,
                                           XScreenSaverInfo *info);
 
 static bool sInitialized = false;
 static _XScreenSaverQueryExtension_fn _XSSQueryExtension = nullptr;
 static _XScreenSaverAllocInfo_fn _XSSAllocInfo = nullptr;
 static _XScreenSaverQueryInfo_fn _XSSQueryInfo = nullptr;
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsIdleServiceGTK, nsIdleService)
-
 static void Initialize()
 {
     if (!GDK_IS_X11_DISPLAY(gdk_display_get_default()))
         return;
 
     // This will leak - See comments in ~nsIdleServiceGTK().
     PRLibrary* xsslib = PR_LoadLibrary("libXss.so.1");
     if (!xsslib) // ouch.
--- a/widget/gtk/nsIdleServiceGTK.h
+++ b/widget/gtk/nsIdleServiceGTK.h
@@ -20,17 +20,17 @@ typedef struct {
     unsigned long til_or_since; // milliseconds since/til screensaver kicks in
     unsigned long idle;         // milliseconds idle
     unsigned long event_mask;   // event stuff
 } XScreenSaverInfo;
 
 class nsIdleServiceGTK : public nsIdleService
 {
 public:
-    NS_DECL_ISUPPORTS_INHERITED
+    NS_INLINE_DECL_REFCOUNTING_INHERITED(nsIdleServiceGTK, nsIdleService)
 
     virtual bool PollIdleTime(uint32_t* aIdleTime) override;
 
     static already_AddRefed<nsIdleServiceGTK> GetInstance()
     {
         RefPtr<nsIdleServiceGTK> idleService =
             nsIdleService::GetInstance().downcast<nsIdleServiceGTK>();
         if (!idleService) {
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -404,18 +404,16 @@ UpdateLastInputEventTime(void *aGdkEvent
 
     guint timestamp = gdk_event_get_time(static_cast<GdkEvent*>(aGdkEvent));
     if (timestamp == GDK_CURRENT_TIME)
         return;
 
     sLastUserInputTime = timestamp;
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, nsBaseWidget)
-
 nsWindow::nsWindow()
 {
     mIsTopLevel          = false;
     mIsDestroyed         = false;
     mListenForResizes    = false;
     mNeedsDispatchResized = false;
     mIsShown             = false;
     mNeedsShow           = false;
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -79,17 +79,17 @@ public:
     typedef mozilla::gfx::DrawTarget DrawTarget;
     typedef mozilla::WidgetEventTime WidgetEventTime;
     typedef mozilla::widget::PlatformCompositorWidgetDelegate PlatformCompositorWidgetDelegate;
 
     nsWindow();
 
     static void ReleaseGlobals();
 
-    NS_DECL_ISUPPORTS_INHERITED
+    NS_INLINE_DECL_REFCOUNTING_INHERITED(nsWindow, nsBaseWidget)
 
     void CommonCreate(nsIWidget *aParent, bool aListenForResizes);
 
     virtual nsresult DispatchEvent(mozilla::WidgetGUIEvent* aEvent,
                                    nsEventStatus& aStatus) override;
 
     // called when we are destroyed
     virtual void OnDestroy(void) override;
--- a/widget/headless/HeadlessWidget.cpp
+++ b/widget/headless/HeadlessWidget.cpp
@@ -49,18 +49,16 @@ CreateDefaultTarget(IntSize aSize)
   // Always use at least a 1x1 draw target to avoid gfx issues
   // with 0x0 targets.
   IntSize size = (aSize.width <= 0 || aSize.height <= 0) ? gfx::IntSize(1, 1) : aSize;
   RefPtr<DrawTarget> target = Factory::CreateDrawTarget(gfxVars::ContentBackend(), size, SurfaceFormat::B8G8R8A8);
   RefPtr<gfxContext> ctx = gfxContext::CreatePreservingTransformOrNull(target);
   return ctx.forget();
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(HeadlessWidget, nsBaseWidget)
-
 StaticAutoPtr<nsTArray<HeadlessWidget*>> HeadlessWidget::sActiveWindows;
 
 already_AddRefed<HeadlessWidget>
 HeadlessWidget::GetActiveWindow()
 {
   if (!sActiveWindows) {
     return nullptr;
   }
--- a/widget/headless/HeadlessWidget.h
+++ b/widget/headless/HeadlessWidget.h
@@ -48,17 +48,17 @@
 namespace mozilla {
 namespace widget {
 
 class HeadlessWidget : public nsBaseWidget
 {
 public:
   HeadlessWidget();
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HeadlessWidget, nsBaseWidget)
 
   void* GetNativeData(uint32_t aDataType) override
   {
     // Headless widgets have no native data.
     return nullptr;
   }
 
   virtual nsresult Create(nsIWidget* aParent,
--- a/widget/nsDragServiceProxy.cpp
+++ b/widget/nsDragServiceProxy.cpp
@@ -14,18 +14,16 @@
 #include "nsContentUtils.h"
 
 using mozilla::ipc::Shmem;
 using mozilla::dom::TabChild;
 using mozilla::dom::OptionalShmem;
 using mozilla::LayoutDeviceIntRect;
 using mozilla::Maybe;
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsDragServiceProxy, nsBaseDragService)
-
 nsDragServiceProxy::nsDragServiceProxy()
 {
 }
 
 nsDragServiceProxy::~nsDragServiceProxy()
 {
 }
 
--- a/widget/nsDragServiceProxy.h
+++ b/widget/nsDragServiceProxy.h
@@ -8,17 +8,17 @@
 
 #include "nsBaseDragService.h"
 
 class nsDragServiceProxy : public nsBaseDragService
 {
 public:
   nsDragServiceProxy();
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsDragServiceProxy, nsBaseDragService)
 
   // nsBaseDragService
   virtual nsresult InvokeDragSessionImpl(nsIArray* anArrayTransferables,
                                          nsIScriptableRegion* aRegion,
                                          uint32_t aActionType) override;
 private:
   virtual ~nsDragServiceProxy();
 };
--- a/widget/uikit/nsWindow.h
+++ b/widget/uikit/nsWindow.h
@@ -18,17 +18,17 @@
 class nsWindow final :
     public nsBaseWidget
 {
     typedef nsBaseWidget Inherited;
 
 public:
     nsWindow();
 
-    NS_DECL_ISUPPORTS_INHERITED
+    NS_INLINE_DECL_REFCOUNTING_INHERITED(nsWindow, Inherited)
 
     //
     // nsIWidget
     //
 
     virtual MOZ_MUST_USE nsresult Create(nsIWidget* aParent,
                                          nsNativeWidget aNativeParent,
                                          const LayoutDeviceIntRect& aRect,
--- a/widget/uikit/nsWindow.mm
+++ b/widget/uikit/nsWindow.mm
@@ -415,18 +415,16 @@ private:
 #endif
   CGContextSetRGBStrokeColor(aContext, 1, 0, 0, 0.8);
   CGContextSetLineWidth(aContext, 4.0);
   CGContextStrokeRect(aContext, aRect);
 #endif
 }
 @end
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, Inherited)
-
 nsWindow::nsWindow()
 : mNativeView(nullptr),
   mVisible(false),
   mParent(nullptr)
 {
 }
 
 nsWindow::~nsWindow()
--- a/widget/windows/nsIdleServiceWin.cpp
+++ b/widget/windows/nsIdleServiceWin.cpp
@@ -3,18 +3,16 @@
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIdleServiceWin.h"
 #include <windows.h>
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsIdleServiceWin, nsIdleService)
-
 bool
 nsIdleServiceWin::PollIdleTime(uint32_t *aIdleTime)
 {
     LASTINPUTINFO inputInfo;
     inputInfo.cbSize = sizeof(inputInfo);
     if (!::GetLastInputInfo(&inputInfo))
         return false;
 
--- a/widget/windows/nsIdleServiceWin.h
+++ b/widget/windows/nsIdleServiceWin.h
@@ -17,17 +17,17 @@
 #ifndef SAFE_COMPARE_EVEN_WITH_WRAPPING
 #define SAFE_COMPARE_EVEN_WITH_WRAPPING(A, B) (((int)((long)A - (long)B) & 0xFFFFFFFF))
 #endif
 
 
 class nsIdleServiceWin : public nsIdleService
 {
 public:
-    NS_DECL_ISUPPORTS_INHERITED
+    NS_INLINE_DECL_REFCOUNTING_INHERITED(nsIdleServiceWin, nsIdleService)
 
     bool PollIdleTime(uint32_t* aIdleTime) override;
 
     static already_AddRefed<nsIdleServiceWin> GetInstance()
     {
         RefPtr<nsIdleServiceWin> idleService =
             nsIdleService::GetInstance().downcast<nsIdleServiceWin>();
         if (!idleService) {
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -711,18 +711,16 @@ nsWindow::~nsWindow()
       ::OleUninitialize();
       sIsOleInitialized = FALSE;
     }
   }
 
   NS_IF_RELEASE(mNativeDragTarget);
 }
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsWindow, nsBaseWidget)
-
 /**************************************************************
  *
  * SECTION: nsIWidget::Create, nsIWidget::Destroy
  *
  * Creating and destroying windows for this widget.
  *
  **************************************************************/
 
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -79,17 +79,17 @@ class nsWindow final : public nsWindowBa
   typedef mozilla::widget::NativeKey NativeKey;
   typedef mozilla::widget::MSGResult MSGResult;
   typedef mozilla::widget::IMEContext IMEContext;
   typedef mozilla::widget::PlatformCompositorWidgetDelegate PlatformCompositorWidgetDelegate;
 
 public:
   explicit nsWindow(bool aIsChildWindow = false);
 
-  NS_DECL_ISUPPORTS_INHERITED
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(nsWindow, nsWindowBase)
 
   friend class nsWindowGfx;
 
   // nsWindowBase
   virtual void InitEvent(mozilla::WidgetGUIEvent& aEvent,
                          LayoutDeviceIntPoint* aPoint = nullptr) override;
   virtual WidgetEventTime CurrentMessageWidgetEventTime() const override;
   virtual bool DispatchWindowEvent(mozilla::WidgetGUIEvent* aEvent) override;
--- a/xpcom/base/nsISupportsImpl.h
+++ b/xpcom/base/nsISupportsImpl.h
@@ -1199,16 +1199,18 @@ NS_IMETHODIMP_(MozExternalRefCountType) 
   NS_IMPL_RELEASE(_class)                                                     \
   NS_IMPL_QUERY_INTERFACE0(_class)
 
 #define NS_IMPL_ISUPPORTS(aClass, ...)                                        \
   NS_IMPL_ADDREF(aClass)                                                      \
   NS_IMPL_RELEASE(aClass)                                                     \
   NS_IMPL_QUERY_INTERFACE(aClass, __VA_ARGS__)
 
+// When possible, prefer NS_INLINE_DECL_REFCOUNTING_INHERITED to
+// NS_IMPL_ISUPPORTS_INHERITED0.
 #define NS_IMPL_ISUPPORTS_INHERITED0(aClass, aSuper)                          \
     NS_INTERFACE_TABLE_HEAD(aClass)                                           \
     NS_INTERFACE_TABLE_TAIL_INHERITING(aSuper)                                \
     NS_IMPL_ADDREF_INHERITED(aClass, aSuper)                                  \
     NS_IMPL_RELEASE_INHERITED(aClass, aSuper)                                 \
 
 #define NS_IMPL_ISUPPORTS_INHERITED(aClass, aSuper, ...)                      \
   NS_IMPL_QUERY_INTERFACE_INHERITED(aClass, aSuper, __VA_ARGS__)              \