Bug 1035394 - Fix dangerous public destructors in accessible - r=surkov
authorBenoit Jacob <bjacob@mozilla.com>
Tue, 08 Jul 2014 17:23:18 -0400
changeset 214928 683e40882500473fc5f39eafc17c1e1380c29b17
parent 214927 cd28b3d3a4bda887166adc0242e9fea16e7d84ca
child 214929 558231b7c91ceff92e0d468c6e5f8e2eda4685a1
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1035394
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1035394 - Fix dangerous public destructors in accessible - r=surkov
accessible/base/nsAccessibilityService.h
accessible/generic/ARIAGridAccessible.h
accessible/generic/ApplicationAccessible.h
accessible/generic/BaseAccessibles.h
accessible/generic/DocAccessible.h
accessible/generic/FormControlAccessible.h
accessible/generic/HyperTextAccessible.h
accessible/generic/ImageAccessible.cpp
accessible/generic/ImageAccessible.h
accessible/generic/OuterDocAccessible.h
accessible/generic/RootAccessible.h
accessible/html/HTMLCanvasAccessible.h
accessible/html/HTMLElementAccessibles.h
accessible/html/HTMLFormControlAccessible.h
accessible/html/HTMLImageMapAccessible.h
accessible/html/HTMLLinkAccessible.h
accessible/html/HTMLListAccessible.h
accessible/html/HTMLTableAccessible.h
accessible/xul/XULAlertAccessible.cpp
accessible/xul/XULAlertAccessible.h
accessible/xul/XULElementAccessibles.cpp
accessible/xul/XULElementAccessibles.h
accessible/xul/XULFormControlAccessible.cpp
accessible/xul/XULFormControlAccessible.h
accessible/xul/XULListboxAccessible.cpp
accessible/xul/XULListboxAccessible.h
accessible/xul/XULTreeAccessible.cpp
accessible/xul/XULTreeAccessible.h
accessible/xul/XULTreeGridAccessible.cpp
accessible/xul/XULTreeGridAccessible.h
--- a/accessible/base/nsAccessibilityService.h
+++ b/accessible/base/nsAccessibilityService.h
@@ -46,18 +46,20 @@ class nsAccessibilityService : public mo
                                public mozilla::a11y::SelectionManager,
                                public nsIAccessibilityService,
                                public nsIObserver
 {
 public:
   typedef mozilla::a11y::Accessible Accessible;
   typedef mozilla::a11y::DocAccessible DocAccessible;
 
+protected:
   virtual ~nsAccessibilityService();
 
+public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLERETRIEVAL
   NS_DECL_NSIOBSERVER
 
   // nsIAccessibilityService
   virtual Accessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
                                                 bool aCanCreate);
   already_AddRefed<Accessible>
--- a/accessible/generic/ARIAGridAccessible.h
+++ b/accessible/generic/ARIAGridAccessible.h
@@ -54,16 +54,17 @@ public:
   virtual void SelectedRowIndices(nsTArray<uint32_t>* aRows);
   virtual void SelectCol(uint32_t aColIdx);
   virtual void SelectRow(uint32_t aRowIdx);
   virtual void UnselectCol(uint32_t aColIdx);
   virtual void UnselectRow(uint32_t aRowIdx);
   virtual Accessible* AsAccessible() { return this; }
 
 protected:
+  virtual ~ARIAGridAccessible() {}
 
   /**
    * Return true if the given row index is valid.
    */
   bool IsValidRow(int32_t aRow);
 
   /**
    * Retrn true if the given column index is valid.
@@ -112,16 +113,17 @@ public:
 
   // Accessible
   virtual TableCellAccessible* AsTableCell() { return this; }
   virtual void Shutdown();
   virtual void ApplyARIAState(uint64_t* aState) const;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
 
 protected:
+  virtual ~ARIAGridCellAccessible() {}
 
   /**
    * Return a containing row.
    */
   Accessible* Row() const
   {
     Accessible* row = Parent();
     return row && row->Role() == roles::ROW ? row : nullptr;
--- a/accessible/generic/ApplicationAccessible.h
+++ b/accessible/generic/ApplicationAccessible.h
@@ -76,16 +76,17 @@ public:
 
   virtual void InvalidateChildren();
 
   // ActionAccessible
   virtual uint8_t ActionCount();
   virtual KeyBinding AccessKey() const;
 
 protected:
+  virtual ~ApplicationAccessible() {}
 
   // Accessible
   virtual void CacheChildren();
   virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
                                          nsresult *aError = nullptr) const;
 
 private:
   nsCOMPtr<nsIXULAppInfo> mAppInfo;
--- a/accessible/generic/BaseAccessibles.h
+++ b/accessible/generic/BaseAccessibles.h
@@ -34,16 +34,17 @@ public:
 
   // Accessible
   virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
                                    EWhichChildAtPoint aWhichChild);
   virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL;
   virtual bool RemoveChild(Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL;
 
 protected:
+  virtual ~LeafAccessible() {}
 
   // Accessible
   virtual void CacheChildren();
 };
 
 /**
  * Used for text or image accessible nodes contained by link accessibles or
  * accessibles for nodes with registered click event handler. It knows how to
@@ -72,16 +73,18 @@ public:
   // ActionAccessible
   virtual uint8_t ActionCount();
   virtual KeyBinding AccessKey() const;
 
   // HyperLinkAccessible
   virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
 
 protected:
+  virtual ~LinkableAccessible() {}
+
   // Accessible
   virtual void BindToParent(Accessible* aParent, uint32_t aIndexInParent);
   virtual void UnbindFromParent();
 
   /**
    * Parent accessible that provides an action for this linkable accessible.
    */
   Accessible* mActionAcc;
@@ -92,24 +95,25 @@ protected:
 /**
  * A simple accessible that gets its enumerated role passed into constructor.
  */
 class EnumRoleAccessible : public AccessibleWrap
 {
 public:
   EnumRoleAccessible(nsIContent* aContent, DocAccessible* aDoc, 
                      a11y::role aRole);
-  virtual ~EnumRoleAccessible() { }
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
   virtual a11y::role NativeRole();
 
 protected:
+  virtual ~EnumRoleAccessible() { }
+
   a11y::role mRole;
 };
 
 
 /**
  * A wrapper accessible around native accessible to connect it with
  * crossplatform accessible tree.
  */
--- a/accessible/generic/DocAccessible.h
+++ b/accessible/generic/DocAccessible.h
@@ -53,17 +53,16 @@ class DocAccessible : public HyperTextAc
   NS_DECL_NSIOBSERVER
 
   NS_DECL_NSIACCESSIBLEPIVOTOBSERVER
 
 public:
 
   DocAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
                 nsIPresShell* aPresShell);
-  virtual ~DocAccessible();
 
   // nsIAccessible
   NS_IMETHOD TakeFocus(void);
 
   // nsIScrollPositionListener
   virtual void ScrollPositionWillChange(nscoord aX, nscoord aY) {}
   virtual void ScrollPositionDidChange(nscoord aX, nscoord aY);
 
@@ -306,16 +305,17 @@ public:
   void UpdateText(nsIContent* aTextNode);
 
   /**
    * Recreate an accessible, results in hide/show events pair.
    */
   void RecreateAccessible(nsIContent* aContent);
 
 protected:
+  virtual ~DocAccessible();
 
   void LastRelease();
 
   // Accessible
   virtual void CacheChildren();
 
   // DocAccessible
   virtual nsresult AddEventListeners();
--- a/accessible/generic/FormControlAccessible.h
+++ b/accessible/generic/FormControlAccessible.h
@@ -38,16 +38,19 @@ public:
   virtual double MaxValue() const MOZ_OVERRIDE;
   virtual double MinValue() const MOZ_OVERRIDE;
   virtual double CurValue() const MOZ_OVERRIDE;
   virtual double Step() const MOZ_OVERRIDE;
   virtual bool SetCurValue(double aValue) MOZ_OVERRIDE;
 
   // Widgets
   virtual bool IsWidget() const;
+
+protected:
+  virtual ~ProgressMeterAccessible() {}
 };
 
 /**
   * Generic class used for radio buttons.
   */
 class RadioButtonAccessible : public LeafAccessible
 {
 
--- a/accessible/generic/HyperTextAccessible.h
+++ b/accessible/generic/HyperTextAccessible.h
@@ -35,17 +35,16 @@ const char16_t kForcedNewLineChar = '\n'
 /**
   * Special Accessible that knows how contain both text and embedded objects
   */
 class HyperTextAccessible : public AccessibleWrap,
                             public xpcAccessibleHyperText
 {
 public:
   HyperTextAccessible(nsIContent* aContent, DocAccessible* aDoc);
-  virtual ~HyperTextAccessible() { }
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
   virtual int32_t GetLevelInternal();
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
   virtual mozilla::a11y::role NativeRole();
   virtual uint64_t NativeState();
@@ -411,16 +410,18 @@ public:
   virtual already_AddRefed<nsIEditor> GetEditor() const;
 
   /**
    * Return DOM selection object for the accessible.
    */
   dom::Selection* DOMSelection() const;
 
 protected:
+  virtual ~HyperTextAccessible() { }
+
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
   virtual void CacheChildren() MOZ_OVERRIDE;
 
   // HyperTextAccessible
 
   /**
    * Transform magic offset into text offset.
--- a/accessible/generic/ImageAccessible.cpp
+++ b/accessible/generic/ImageAccessible.cpp
@@ -30,16 +30,20 @@ using namespace mozilla::a11y;
 
 ImageAccessible::
   ImageAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   LinkableAccessible(aContent, aDoc)
 {
   mType = eImageType;
 }
 
+ImageAccessible::~ImageAccessible()
+{
+}
+
 NS_IMPL_ISUPPORTS_INHERITED(ImageAccessible, Accessible,
                             nsIAccessibleImage)
 
 ////////////////////////////////////////////////////////////////////////////////
 // Accessible public
 
 uint64_t
 ImageAccessible::NativeState()
--- a/accessible/generic/ImageAccessible.h
+++ b/accessible/generic/ImageAccessible.h
@@ -39,16 +39,18 @@ public:
   virtual a11y::role NativeRole();
   virtual uint64_t NativeState();
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount();
 
 protected:
+  virtual ~ImageAccessible();
+
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 
 private:
   /**
    * Return whether the element has a longdesc URI.
    */
   bool HasLongDesc() const
--- a/accessible/generic/OuterDocAccessible.h
+++ b/accessible/generic/OuterDocAccessible.h
@@ -19,17 +19,16 @@ namespace a11y {
  * a something like tags listed above, whereas the inner node corresponds to
  * the inner document root.
  */
 
 class OuterDocAccessible : public AccessibleWrap
 {
 public:
   OuterDocAccessible(nsIContent* aContent, DocAccessible* aDoc);
-  virtual ~OuterDocAccessible();
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName);
   NS_IMETHOD GetActionDescription(uint8_t aIndex, nsAString& aDescription);
   NS_IMETHOD DoAction(uint8_t aIndex);
 
@@ -42,16 +41,18 @@ public:
   virtual void InvalidateChildren();
   virtual bool InsertChildAt(uint32_t aIdx, Accessible* aChild) MOZ_OVERRIDE;
   virtual bool RemoveChild(Accessible* aAccessible);
 
   // ActionAccessible
   virtual uint8_t ActionCount();
 
 protected:
+  virtual ~OuterDocAccessible();
+
   // Accessible
   virtual void CacheChildren();
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif  
--- a/accessible/generic/RootAccessible.h
+++ b/accessible/generic/RootAccessible.h
@@ -19,17 +19,16 @@ namespace a11y {
 class RootAccessible : public DocAccessibleWrap,
                        public nsIDOMEventListener
 {
   NS_DECL_ISUPPORTS_INHERITED
 
 public:
   RootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
                  nsIPresShell* aPresShell);
-  virtual ~RootAccessible();
 
   // nsIDOMEventListener
   NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
 
   // Accessible
   virtual void Shutdown();
   virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
   virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
@@ -39,16 +38,17 @@ public:
   // RootAccessible
 
   /**
    * Notify that the sub document presshell was activated.
    */
   virtual void DocumentActivated(DocAccessible* aDocument);
 
 protected:
+  virtual ~RootAccessible();
 
   /**
    * Add/remove DOM event listeners.
    */
   virtual nsresult AddEventListeners();
   virtual nsresult RemoveEventListeners();
 
   /**
--- a/accessible/html/HTMLCanvasAccessible.h
+++ b/accessible/html/HTMLCanvasAccessible.h
@@ -13,21 +13,23 @@ namespace a11y {
 
 /**
  * HTML canvas accessible (html:canvas).
  */
 class HTMLCanvasAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLCanvasAccessible(nsIContent* aContent, DocAccessible* aDoc);
-  virtual ~HTMLCanvasAccessible() { }
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
   virtual a11y::role NativeRole();
+
+protected:
+  virtual ~HTMLCanvasAccessible() { }
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/html/HTMLElementAccessibles.h
+++ b/accessible/html/HTMLElementAccessibles.h
@@ -59,16 +59,17 @@ public:
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
   virtual a11y::role NativeRole();
   virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
 
 protected:
+  virtual ~HTMLLabelAccessible() {}
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 };
 
 /**
  * Used for HTML output element.
  */
 class HTMLOutputAccessible : public HyperTextAccessibleWrap
 {
@@ -78,14 +79,17 @@ public:
     HyperTextAccessibleWrap(aContent, aDoc) {}
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
   virtual a11y::role NativeRole();
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
   virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
+
+protected:
+  virtual ~HTMLOutputAccessible() {}
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/html/HTMLFormControlAccessible.h
+++ b/accessible/html/HTMLFormControlAccessible.h
@@ -136,16 +136,18 @@ public:
   // ActionAccessible
   virtual uint8_t ActionCount();
 
   // Widgets
   virtual bool IsWidget() const;
   virtual Accessible* ContainerWidget() const;
 
 protected:
+  virtual ~HTMLTextFieldAccessible() {}
+
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 
   /**
    * Return a XUL widget element this input is part of.
    */
   nsIContent* XULWidgetElm() const { return mContent->GetBindingParent(); }
 };
--- a/accessible/html/HTMLImageMapAccessible.h
+++ b/accessible/html/HTMLImageMapAccessible.h
@@ -15,17 +15,16 @@ namespace a11y {
 
 /**
  * Used for HTML image maps.
  */
 class HTMLImageMapAccessible : public ImageAccessibleWrap
 {
 public:
   HTMLImageMapAccessible(nsIContent* aContent, DocAccessible* aDoc);
-  virtual ~HTMLImageMapAccessible() { }
 
   // nsISupports and cycle collector
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
   virtual a11y::role NativeRole();
 
   // HyperLinkAccessible
@@ -39,16 +38,17 @@ public:
   void UpdateChildAreas(bool aDoFireEvents = true);
 
   /**
    * Return accessible of child node.
    */
   Accessible* GetChildAccessibleFor(const nsINode* aNode) const;
 
 protected:
+  virtual ~HTMLImageMapAccessible() { }
 
   // Accessible
   virtual void CacheChildren();
 };
 
 /**
  * Accessible for image map areas - must be child of image.
  */
--- a/accessible/html/HTMLLinkAccessible.h
+++ b/accessible/html/HTMLLinkAccessible.h
@@ -32,16 +32,18 @@ public:
   // ActionAccessible
   virtual uint8_t ActionCount();
 
   // HyperLinkAccessible
   virtual bool IsLink();
   virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
 
 protected:
+  virtual ~HTMLLinkAccessible() {}
+
   enum { eAction_Jump = 0 };
 
   /**
    * Returns true if the link has href attribute.
    */
   bool IsLinked();
 };
 
--- a/accessible/html/HTMLListAccessible.h
+++ b/accessible/html/HTMLListAccessible.h
@@ -18,35 +18,36 @@ class HTMLListBulletAccessible;
 /**
  * Used for HTML list (like HTML ul).
  */
 class HTMLListAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLListAccessible(nsIContent* aContent, DocAccessible* aDoc) :
     HyperTextAccessibleWrap(aContent, aDoc) { mGenericTypes |= eList; }
-  virtual ~HTMLListAccessible() { }
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
   virtual a11y::role NativeRole();
   virtual uint64_t NativeState();
+
+protected:
+  virtual ~HTMLListAccessible() { }
 };
 
 
 /**
  * Used for HTML list item (e.g. HTML li).
  */
 class HTMLLIAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLLIAccessible(nsIContent* aContent, DocAccessible* aDoc);
-  virtual ~HTMLLIAccessible() { }
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetBounds(int32_t* aX, int32_t* aY,
                        int32_t* aWidth, int32_t* aHeight);
 
@@ -55,16 +56,18 @@ public:
   virtual a11y::role NativeRole();
   virtual uint64_t NativeState();
 
   // HTMLLIAccessible
   HTMLListBulletAccessible* Bullet() const { return mBullet; }
   void UpdateBullet(bool aHasBullet);
 
 protected:
+  virtual ~HTMLLIAccessible() { }
+
   // Accessible
   virtual void CacheChildren();
 
 private:
   nsRefPtr<HTMLListBulletAccessible> mBullet;
 };
 
 
--- a/accessible/html/HTMLTableAccessible.h
+++ b/accessible/html/HTMLTableAccessible.h
@@ -50,16 +50,18 @@ public:
   virtual uint32_t RowIdx() const MOZ_OVERRIDE;
   virtual uint32_t ColExtent() const MOZ_OVERRIDE;
   virtual uint32_t RowExtent() const MOZ_OVERRIDE;
   virtual void ColHeaderCells(nsTArray<Accessible*>* aCells) MOZ_OVERRIDE;
   virtual void RowHeaderCells(nsTArray<Accessible*>* aCells) MOZ_OVERRIDE;
   virtual bool Selected() MOZ_OVERRIDE;
 
 protected:
+  virtual ~HTMLTableCellAccessible() {}
+
   /**
    * Return host table accessible.
    */
   already_AddRefed<nsIAccessibleTable> GetTableAccessible();
 
   /**
    * Return nsITableCellLayout of the table cell frame.
    */
@@ -92,22 +94,24 @@ class HTMLTableRowAccessible : public Ac
 {
 public:
   HTMLTableRowAccessible(nsIContent* aContent, DocAccessible* aDoc) :
     AccessibleWrap(aContent, aDoc)
   {
     mType = eHTMLTableRowType;
     mGenericTypes |= eTableRow;
   }
-  virtual ~HTMLTableRowAccessible() { }
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // Accessible
   virtual a11y::role NativeRole();
+
+protected:
+  virtual ~HTMLTableRowAccessible() { }
 };
 
 
 /**
  * HTML table accessible (html:table).
  */
 
 // To turn on table debugging descriptions define SHOW_LAYOUT_HEURISTIC
@@ -168,16 +172,18 @@ public:
   virtual TableAccessible* AsTable() { return this; }
   virtual void Description(nsString& aDescription);
   virtual a11y::role NativeRole();
   virtual uint64_t NativeState();
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
   virtual Relation RelationByType(RelationType aRelationType) MOZ_OVERRIDE;
 
 protected:
+  virtual ~HTMLTableAccessible() {}
+
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
   virtual void CacheChildren();
 
   // HTMLTableAccessible
 
   /**
    * Add row or column to selection.
--- a/accessible/xul/XULAlertAccessible.cpp
+++ b/accessible/xul/XULAlertAccessible.cpp
@@ -16,16 +16,20 @@ using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 
 XULAlertAccessible::
   XULAlertAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   AccessibleWrap(aContent, aDoc)
 {
 }
 
+XULAlertAccessible::~XULAlertAccessible()
+{
+}
+
 NS_IMPL_ISUPPORTS_INHERITED0(XULAlertAccessible, Accessible)
 
 role
 XULAlertAccessible::NativeRole()
 {
   return roles::ALERT;
 }
 
--- a/accessible/xul/XULAlertAccessible.h
+++ b/accessible/xul/XULAlertAccessible.h
@@ -25,14 +25,17 @@ public:
   // Accessible
   virtual mozilla::a11y::ENameValueFlag Name(nsString& aName);
   virtual a11y::role NativeRole();
   virtual uint64_t NativeState();
 
   // Widgets
   virtual bool IsWidget() const;
   virtual Accessible* ContainerWidget() const;
+
+protected:
+  ~XULAlertAccessible();
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/xul/XULElementAccessibles.cpp
+++ b/accessible/xul/XULElementAccessibles.cpp
@@ -179,16 +179,20 @@ XULTooltipAccessible::NativeRole()
 ////////////////////////////////////////////////////////////////////////////////
 
 XULLinkAccessible::
   XULLinkAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   XULLabelAccessible(aContent, aDoc)
 {
 }
 
+XULLinkAccessible::~XULLinkAccessible()
+{
+}
+
 // Expose nsIAccessibleHyperLink unconditionally
 NS_IMPL_ISUPPORTS_INHERITED(XULLinkAccessible, XULLabelAccessible,
                             nsIAccessibleHyperLink)
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULLinkAccessible. nsIAccessible
 
 void
--- a/accessible/xul/XULElementAccessibles.h
+++ b/accessible/xul/XULElementAccessibles.h
@@ -101,16 +101,18 @@ public:
 
   // HyperLinkAccessible
   virtual bool IsLink();
   virtual uint32_t StartOffset();
   virtual uint32_t EndOffset();
   virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
 
 protected:
+  virtual ~XULLinkAccessible();
+
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 
   enum { eAction_Jump = 0 };
 
 };
 
 } // namespace a11y
--- a/accessible/xul/XULFormControlAccessible.cpp
+++ b/accessible/xul/XULFormControlAccessible.cpp
@@ -42,16 +42,20 @@ XULButtonAccessible::
 {
   if (ContainsMenu()) {
     mGenericTypes |= eMenuButton;
   } else {
     mGenericTypes |= eButton;
   }
 }
 
+XULButtonAccessible::~XULButtonAccessible()
+{
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // XULButtonAccessible: nsISupports
 
 NS_IMPL_ISUPPORTS_INHERITED0(XULButtonAccessible, Accessible)
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULButtonAccessible: nsIAccessible
 
--- a/accessible/xul/XULFormControlAccessible.h
+++ b/accessible/xul/XULFormControlAccessible.h
@@ -50,16 +50,18 @@ public:
   virtual bool IsWidget() const;
   virtual bool IsActiveWidget() const;
   virtual bool AreItemsOperable() const;
   virtual Accessible* ContainerWidget() const;
 
   virtual bool IsAcceptableChild(Accessible* aPossibleChild) const MOZ_OVERRIDE;
 
 protected:
+  virtual ~XULButtonAccessible();
+
   // XULButtonAccessible
   bool ContainsMenu();
 };
 
 
 /**
  * Used for XUL checkbox element.
  */
--- a/accessible/xul/XULListboxAccessible.cpp
+++ b/accessible/xul/XULListboxAccessible.cpp
@@ -581,16 +581,20 @@ XULListitemAccessible::
 {
   mIsCheckbox = mContent->AttrValueIs(kNameSpaceID_None,
                                       nsGkAtoms::type,
                                       nsGkAtoms::checkbox,
                                       eCaseMatters);
   mType = eXULListItemType;
 }
 
+XULListitemAccessible::~XULListitemAccessible()
+{
+}
+
 NS_IMPL_ISUPPORTS_INHERITED0(XULListitemAccessible, Accessible)
 
 Accessible*
 XULListitemAccessible::GetListAccessible()
 {
   if (IsDefunct())
     return nullptr;
 
--- a/accessible/xul/XULListboxAccessible.h
+++ b/accessible/xul/XULListboxAccessible.h
@@ -62,17 +62,16 @@ public:
  */
 class XULListboxAccessible : public XULSelectControlAccessible,
                              public xpcAccessibleTable,
                              public nsIAccessibleTable,
                              public TableAccessible
 {
 public:
   XULListboxAccessible(nsIContent* aContent, DocAccessible* aDoc);
-  virtual ~XULListboxAccessible() {}
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessibleTable
   NS_FORWARD_NSIACCESSIBLETABLE(xpcAccessibleTable::)
 
   // TableAccessible
   virtual uint32_t ColCount();
@@ -102,47 +101,50 @@ public:
   // Widgets
   virtual bool IsWidget() const;
   virtual bool IsActiveWidget() const;
   virtual bool AreItemsOperable() const;
 
   virtual Accessible* ContainerWidget() const;
 
 protected:
+  virtual ~XULListboxAccessible() {}
+
   bool IsMulticolumn();
 };
 
 /**
   * Listitems -- used in listboxes
   */
 class XULListitemAccessible : public XULMenuitemAccessible
 {
 public:
   enum { eAction_Click = 0 };
 
   NS_DECL_ISUPPORTS_INHERITED
 
   XULListitemAccessible(nsIContent* aContent, DocAccessible* aDoc);
-  virtual ~XULListitemAccessible() {}
 
   // nsIAccessible
   NS_IMETHOD GetActionName(uint8_t index, nsAString& aName);
   // Don't use XUL menuitems's description attribute
 
   // Accessible
   virtual void Description(nsString& aDesc);
   virtual a11y::role NativeRole();
   virtual uint64_t NativeState();
   virtual uint64_t NativeInteractiveState() const;
   virtual bool CanHaveAnonChildren();
 
   // Widgets
   virtual Accessible* ContainerWidget() const;
 
 protected:
+  virtual ~XULListitemAccessible();
+
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
 
   // XULListitemAccessible
 
   /**
    * Return listbox accessible for the listitem.
    */
@@ -176,14 +178,17 @@ public:
   virtual a11y::role NativeRole();
 
   // TableCellAccessible
   virtual TableAccessible* Table() const MOZ_OVERRIDE;
   virtual uint32_t ColIdx() const MOZ_OVERRIDE;
   virtual uint32_t RowIdx() const MOZ_OVERRIDE;
   virtual void ColHeaderCells(nsTArray<Accessible*>* aHeaderCells) MOZ_OVERRIDE;
   virtual bool Selected() MOZ_OVERRIDE;
+
+protected:
+  virtual ~XULListCellAccessible() {}
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/xul/XULTreeAccessible.cpp
+++ b/accessible/xul/XULTreeAccessible.cpp
@@ -57,16 +57,20 @@ XULTreeAccessible::
   if (parentContent) {
     nsCOMPtr<nsIAutoCompletePopup> autoCompletePopupElm =
       do_QueryInterface(parentContent);
     if (autoCompletePopupElm)
       mGenericTypes |= eAutoCompletePopup;
   }
 }
 
+XULTreeAccessible::~XULTreeAccessible()
+{
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeAccessible: nsISupports and cycle collection implementation
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(XULTreeAccessible, Accessible,
                                    mTree, mAccessibleCache)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(XULTreeAccessible)
 NS_INTERFACE_MAP_END_INHERITING(Accessible)
@@ -698,16 +702,20 @@ XULTreeItemAccessibleBase::
                             nsITreeView* aTreeView, int32_t aRow) :
   AccessibleWrap(aContent, aDoc),
   mTree(aTree), mTreeView(aTreeView), mRow(aRow)
 {
   mParent = aParent;
   mStateFlags |= eSharedNode;
 }
 
+XULTreeItemAccessibleBase::~XULTreeItemAccessibleBase()
+{
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeItemAccessibleBase: nsISupports implementation
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(XULTreeItemAccessibleBase, Accessible,
                                    mTree)
 
 NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(XULTreeItemAccessibleBase)
   NS_INTERFACE_TABLE_INHERITED(XULTreeItemAccessibleBase,
@@ -1098,16 +1106,20 @@ XULTreeItemAccessible::
                         Accessible* aParent, nsITreeBoxObject* aTree,
                         nsITreeView* aTreeView, int32_t aRow) :
   XULTreeItemAccessibleBase(aContent, aDoc, aParent, aTree, aTreeView, aRow)
 {
   mColumn = nsCoreUtils::GetFirstSensibleColumn(mTree);
   GetCellName(mColumn, mCachedName);
 }
 
+XULTreeItemAccessible::~XULTreeItemAccessible()
+{
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeItemAccessible: nsISupports implementation
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(XULTreeItemAccessible,
                                    XULTreeItemAccessibleBase,
                                    mColumn)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(XULTreeItemAccessible)
--- a/accessible/xul/XULTreeAccessible.h
+++ b/accessible/xul/XULTreeAccessible.h
@@ -102,16 +102,18 @@ public:
                            int32_t aStartCol, int32_t aEndCol);
 
   /**
    * Invalidates children created for previous tree view.
    */
   void TreeViewChanged(nsITreeView* aView);
 
 protected:
+  virtual ~XULTreeAccessible();
+
   /**
    * Creates tree item accessible for the given row index.
    */
   virtual already_AddRefed<Accessible>
     CreateTreeItemAccessible(int32_t aRow) const;
 
   nsCOMPtr<nsITreeBoxObject> mTree;
   nsITreeView* mTreeView;
@@ -185,16 +187,18 @@ public:
     { return nullptr; }
 
   /**
    * Proccess row invalidation. Used to fires name change events.
    */
   virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx) = 0;
 
 protected:
+  virtual ~XULTreeItemAccessibleBase();
+
   enum { eAction_Click = 0, eAction_Expand = 1 };
 
   // Accessible
   virtual void DispatchClickEvent(nsIContent *aContent, uint32_t aActionIndex);
   virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
                                          nsresult *aError = nullptr) const;
 
   // XULTreeItemAccessibleBase
@@ -237,16 +241,17 @@ public:
   virtual void Shutdown();
   virtual ENameValueFlag Name(nsString& aName);
   virtual a11y::role NativeRole();
 
   // XULTreeItemAccessibleBase
   virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx);
 
 protected:
+  virtual ~XULTreeItemAccessible();
 
   // Accessible
   virtual void CacheChildren();
 
   // XULTreeItemAccessible
   nsCOMPtr<nsITreeColumn> mColumn;
   nsString mCachedName;
 };
--- a/accessible/xul/XULTreeGridAccessible.cpp
+++ b/accessible/xul/XULTreeGridAccessible.cpp
@@ -17,16 +17,20 @@
 #include "nsIBoxObject.h"
 #include "nsIMutableArray.h"
 #include "nsIPersistentProperties2.h"
 #include "nsITreeSelection.h"
 #include "nsComponentManagerUtils.h"
 
 using namespace mozilla::a11y;
 
+XULTreeGridAccessible::~XULTreeGridAccessible()
+{
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeGridAccessible: nsISupports implementation
 
 NS_IMPL_ISUPPORTS_INHERITED(XULTreeGridAccessible,
                             XULTreeAccessible,
                             nsIAccessibleTable)
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -257,16 +261,20 @@ XULTreeGridRowAccessible::
                            Accessible* aTreeAcc, nsITreeBoxObject* aTree,
                            nsITreeView* aTreeView, int32_t aRow) :
   XULTreeItemAccessibleBase(aContent, aDoc, aTreeAcc, aTree, aTreeView, aRow),
   mAccessibleCache(kDefaultTreeCacheSize)
 {
   mGenericTypes |= eTableRow;
 }
 
+XULTreeGridRowAccessible::~XULTreeGridRowAccessible()
+{
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeGridRowAccessible: nsISupports and cycle collection implementation
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(XULTreeGridRowAccessible,
                                    XULTreeItemAccessibleBase,
                                    mAccessibleCache)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(XULTreeGridRowAccessible)
@@ -445,16 +453,20 @@ XULTreeGridCellAccessible::
   int16_t type = -1;
   mColumn->GetType(&type);
   if (type == nsITreeColumn::TYPE_CHECKBOX)
     mTreeView->GetCellValue(mRow, mColumn, mCachedTextEquiv);
   else
     mTreeView->GetCellText(mRow, mColumn, mCachedTextEquiv);
 }
 
+XULTreeGridCellAccessible::~XULTreeGridCellAccessible()
+{
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeGridCellAccessible: nsISupports implementation
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(XULTreeGridCellAccessible, LeafAccessible,
                                    mTree, mColumn)
 
 NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(XULTreeGridCellAccessible)
   NS_INTERFACE_TABLE_INHERITED(XULTreeGridCellAccessible,
--- a/accessible/xul/XULTreeGridAccessible.h
+++ b/accessible/xul/XULTreeGridAccessible.h
@@ -55,16 +55,17 @@ public:
   virtual Accessible* AsAccessible() { return this; }
 
   // Accessible
   virtual void Shutdown();
   virtual TableAccessible* AsTable() { return this; }
   virtual a11y::role NativeRole();
 
 protected:
+  virtual ~XULTreeGridAccessible();
 
   // XULTreeAccessible
   virtual already_AddRefed<Accessible>
     CreateTreeItemAccessible(int32_t aRow) const MOZ_OVERRIDE;
 };
 
 
 /**
@@ -95,16 +96,17 @@ public:
   virtual Accessible* GetChildAt(uint32_t aIndex) const MOZ_OVERRIDE;
   virtual uint32_t ChildCount() const MOZ_OVERRIDE;
 
   // XULTreeItemAccessibleBase
   virtual Accessible* GetCellAccessible(nsITreeColumn* aColumn) const MOZ_OVERRIDE;
   virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx);
 
 protected:
+  virtual ~XULTreeGridRowAccessible();
 
   // Accessible
   virtual void CacheChildren();
 
   // XULTreeItemAccessibleBase
   mutable AccessibleHashtable mAccessibleCache;
 };
 
@@ -179,16 +181,18 @@ public:
   /**
    * Fire name or state change event if the accessible text or value has been
    * changed.
    * @return true if name has changed
    */
   bool CellInvalidated();
 
 protected:
+  virtual ~XULTreeGridCellAccessible();
+
   // Accessible
   virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
                                          nsresult* aError = nullptr) const;
   virtual void DispatchClickEvent(nsIContent* aContent, uint32_t aActionIndex);
 
   // XULTreeGridCellAccessible
 
   /**