Bug 1035394 - Fix dangerous public destructors in accessible - r=surkov

This commit is contained in:
Benoit Jacob 2014-07-08 17:23:18 -04:00
parent ae77343c7f
commit 868f55ca76
30 changed files with 112 additions and 12 deletions

View File

@ -51,8 +51,10 @@ 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

View File

@ -59,6 +59,7 @@ public:
virtual Accessible* AsAccessible() { return this; }
protected:
virtual ~ARIAGridAccessible() {}
/**
* Return true if the given row index is valid.
@ -117,6 +118,7 @@ public:
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
protected:
virtual ~ARIAGridCellAccessible() {}
/**
* Return a containing row.

View File

@ -81,6 +81,7 @@ public:
virtual KeyBinding AccessKey() const;
protected:
virtual ~ApplicationAccessible() {}
// Accessible
virtual void CacheChildren();

View File

@ -39,6 +39,7 @@ public:
virtual bool RemoveChild(Accessible* aChild) MOZ_OVERRIDE MOZ_FINAL;
protected:
virtual ~LeafAccessible() {}
// Accessible
virtual void CacheChildren();
@ -77,6 +78,8 @@ public:
virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
protected:
virtual ~LinkableAccessible() {}
// Accessible
virtual void BindToParent(Accessible* aParent, uint32_t aIndexInParent);
virtual void UnbindFromParent();
@ -97,7 +100,6 @@ class EnumRoleAccessible : public AccessibleWrap
public:
EnumRoleAccessible(nsIContent* aContent, DocAccessible* aDoc,
a11y::role aRole);
virtual ~EnumRoleAccessible() { }
NS_DECL_ISUPPORTS_INHERITED
@ -105,6 +107,8 @@ public:
virtual a11y::role NativeRole();
protected:
virtual ~EnumRoleAccessible() { }
a11y::role mRole;
};

View File

@ -58,7 +58,6 @@ public:
DocAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
virtual ~DocAccessible();
// nsIAccessible
NS_IMETHOD TakeFocus(void);
@ -311,6 +310,7 @@ public:
void RecreateAccessible(nsIContent* aContent);
protected:
virtual ~DocAccessible();
void LastRelease();

View File

@ -43,6 +43,9 @@ public:
// Widgets
virtual bool IsWidget() const;
protected:
virtual ~ProgressMeterAccessible() {}
};
/**

View File

@ -40,7 +40,6 @@ class HyperTextAccessible : public AccessibleWrap,
{
public:
HyperTextAccessible(nsIContent* aContent, DocAccessible* aDoc);
virtual ~HyperTextAccessible() { }
NS_DECL_ISUPPORTS_INHERITED
@ -416,6 +415,8 @@ public:
dom::Selection* DOMSelection() const;
protected:
virtual ~HyperTextAccessible() { }
// Accessible
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
virtual void CacheChildren() MOZ_OVERRIDE;

View File

@ -35,6 +35,10 @@ ImageAccessible::
mType = eImageType;
}
ImageAccessible::~ImageAccessible()
{
}
NS_IMPL_ISUPPORTS_INHERITED(ImageAccessible, Accessible,
nsIAccessibleImage)

View File

@ -44,6 +44,8 @@ public:
virtual uint8_t ActionCount();
protected:
virtual ~ImageAccessible();
// Accessible
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;

View File

@ -24,7 +24,6 @@ class OuterDocAccessible : public AccessibleWrap
{
public:
OuterDocAccessible(nsIContent* aContent, DocAccessible* aDoc);
virtual ~OuterDocAccessible();
NS_DECL_ISUPPORTS_INHERITED
@ -47,6 +46,8 @@ public:
virtual uint8_t ActionCount();
protected:
virtual ~OuterDocAccessible();
// Accessible
virtual void CacheChildren();
};

View File

@ -24,7 +24,6 @@ class RootAccessible : public DocAccessibleWrap,
public:
RootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell);
virtual ~RootAccessible();
// nsIDOMEventListener
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
@ -44,6 +43,7 @@ public:
virtual void DocumentActivated(DocAccessible* aDocument);
protected:
virtual ~RootAccessible();
/**
* Add/remove DOM event listeners.

View File

@ -18,13 +18,15 @@ 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

View File

@ -64,6 +64,7 @@ public:
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
protected:
virtual ~HTMLLabelAccessible() {}
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
};
@ -83,6 +84,9 @@ public:
virtual a11y::role NativeRole();
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE;
protected:
virtual ~HTMLOutputAccessible() {}
};
} // namespace a11y

View File

@ -141,6 +141,8 @@ public:
virtual Accessible* ContainerWidget() const;
protected:
virtual ~HTMLTextFieldAccessible() {}
// Accessible
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;

View File

@ -20,7 +20,6 @@ class HTMLImageMapAccessible : public ImageAccessibleWrap
{
public:
HTMLImageMapAccessible(nsIContent* aContent, DocAccessible* aDoc);
virtual ~HTMLImageMapAccessible() { }
// nsISupports and cycle collector
NS_DECL_ISUPPORTS_INHERITED
@ -44,6 +43,7 @@ public:
Accessible* GetChildAccessibleFor(const nsINode* aNode) const;
protected:
virtual ~HTMLImageMapAccessible() { }
// Accessible
virtual void CacheChildren();

View File

@ -37,6 +37,8 @@ public:
virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
protected:
virtual ~HTMLLinkAccessible() {}
enum { eAction_Jump = 0 };
/**

View File

@ -23,7 +23,6 @@ class HTMLListAccessible : public HyperTextAccessibleWrap
public:
HTMLListAccessible(nsIContent* aContent, DocAccessible* aDoc) :
HyperTextAccessibleWrap(aContent, aDoc) { mGenericTypes |= eList; }
virtual ~HTMLListAccessible() { }
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
@ -31,6 +30,9 @@ public:
// Accessible
virtual a11y::role NativeRole();
virtual uint64_t NativeState();
protected:
virtual ~HTMLListAccessible() { }
};
@ -41,7 +43,6 @@ class HTMLLIAccessible : public HyperTextAccessibleWrap
{
public:
HTMLLIAccessible(nsIContent* aContent, DocAccessible* aDoc);
virtual ~HTMLLIAccessible() { }
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
@ -60,6 +61,8 @@ public:
void UpdateBullet(bool aHasBullet);
protected:
virtual ~HTMLLIAccessible() { }
// Accessible
virtual void CacheChildren();

View File

@ -55,6 +55,8 @@ public:
virtual bool Selected() MOZ_OVERRIDE;
protected:
virtual ~HTMLTableCellAccessible() {}
/**
* Return host table accessible.
*/
@ -97,12 +99,14 @@ public:
mType = eHTMLTableRowType;
mGenericTypes |= eTableRow;
}
virtual ~HTMLTableRowAccessible() { }
NS_DECL_ISUPPORTS_INHERITED
// Accessible
virtual a11y::role NativeRole();
protected:
virtual ~HTMLTableRowAccessible() { }
};
@ -173,6 +177,8 @@ public:
virtual Relation RelationByType(RelationType aRelationType) MOZ_OVERRIDE;
protected:
virtual ~HTMLTableAccessible() {}
// Accessible
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
virtual void CacheChildren();

View File

@ -21,6 +21,10 @@ XULAlertAccessible::
{
}
XULAlertAccessible::~XULAlertAccessible()
{
}
NS_IMPL_ISUPPORTS_INHERITED0(XULAlertAccessible, Accessible)
role

View File

@ -30,6 +30,9 @@ public:
// Widgets
virtual bool IsWidget() const;
virtual Accessible* ContainerWidget() const;
protected:
~XULAlertAccessible();
};
} // namespace a11y

View File

@ -184,6 +184,10 @@ XULLinkAccessible::
{
}
XULLinkAccessible::~XULLinkAccessible()
{
}
// Expose nsIAccessibleHyperLink unconditionally
NS_IMPL_ISUPPORTS_INHERITED(XULLinkAccessible, XULLabelAccessible,
nsIAccessibleHyperLink)

View File

@ -106,6 +106,8 @@ public:
virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex);
protected:
virtual ~XULLinkAccessible();
// Accessible
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;

View File

@ -47,6 +47,10 @@ XULButtonAccessible::
}
}
XULButtonAccessible::~XULButtonAccessible()
{
}
////////////////////////////////////////////////////////////////////////////////
// XULButtonAccessible: nsISupports

View File

@ -55,6 +55,8 @@ public:
virtual bool IsAcceptableChild(Accessible* aPossibleChild) const MOZ_OVERRIDE;
protected:
virtual ~XULButtonAccessible();
// XULButtonAccessible
bool ContainsMenu();
};

View File

@ -586,6 +586,10 @@ XULListitemAccessible::
mType = eXULListItemType;
}
XULListitemAccessible::~XULListitemAccessible()
{
}
NS_IMPL_ISUPPORTS_INHERITED0(XULListitemAccessible, Accessible)
Accessible*

View File

@ -67,7 +67,6 @@ class XULListboxAccessible : public XULSelectControlAccessible,
{
public:
XULListboxAccessible(nsIContent* aContent, DocAccessible* aDoc);
virtual ~XULListboxAccessible() {}
NS_DECL_ISUPPORTS_INHERITED
@ -107,6 +106,8 @@ public:
virtual Accessible* ContainerWidget() const;
protected:
virtual ~XULListboxAccessible() {}
bool IsMulticolumn();
};
@ -121,7 +122,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED
XULListitemAccessible(nsIContent* aContent, DocAccessible* aDoc);
virtual ~XULListitemAccessible() {}
// nsIAccessible
NS_IMETHOD GetActionName(uint8_t index, nsAString& aName);
@ -138,6 +138,8 @@ public:
virtual Accessible* ContainerWidget() const;
protected:
virtual ~XULListitemAccessible();
// Accessible
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
@ -181,6 +183,9 @@ public:
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

View File

@ -62,6 +62,10 @@ XULTreeAccessible::
}
}
XULTreeAccessible::~XULTreeAccessible()
{
}
////////////////////////////////////////////////////////////////////////////////
// XULTreeAccessible: nsISupports and cycle collection implementation
@ -703,6 +707,10 @@ XULTreeItemAccessibleBase::
mStateFlags |= eSharedNode;
}
XULTreeItemAccessibleBase::~XULTreeItemAccessibleBase()
{
}
////////////////////////////////////////////////////////////////////////////////
// XULTreeItemAccessibleBase: nsISupports implementation
@ -1103,6 +1111,10 @@ XULTreeItemAccessible::
GetCellName(mColumn, mCachedName);
}
XULTreeItemAccessible::~XULTreeItemAccessible()
{
}
////////////////////////////////////////////////////////////////////////////////
// XULTreeItemAccessible: nsISupports implementation

View File

@ -107,6 +107,8 @@ public:
void TreeViewChanged(nsITreeView* aView);
protected:
virtual ~XULTreeAccessible();
/**
* Creates tree item accessible for the given row index.
*/
@ -190,6 +192,8 @@ public:
virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx) = 0;
protected:
virtual ~XULTreeItemAccessibleBase();
enum { eAction_Click = 0, eAction_Expand = 1 };
// Accessible
@ -242,6 +246,7 @@ public:
virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx);
protected:
virtual ~XULTreeItemAccessible();
// Accessible
virtual void CacheChildren();

View File

@ -22,6 +22,10 @@
using namespace mozilla::a11y;
XULTreeGridAccessible::~XULTreeGridAccessible()
{
}
////////////////////////////////////////////////////////////////////////////////
// XULTreeGridAccessible: nsISupports implementation
@ -262,6 +266,10 @@ XULTreeGridRowAccessible::
mGenericTypes |= eTableRow;
}
XULTreeGridRowAccessible::~XULTreeGridRowAccessible()
{
}
////////////////////////////////////////////////////////////////////////////////
// XULTreeGridRowAccessible: nsISupports and cycle collection implementation
@ -450,6 +458,10 @@ XULTreeGridCellAccessible::
mTreeView->GetCellText(mRow, mColumn, mCachedTextEquiv);
}
XULTreeGridCellAccessible::~XULTreeGridCellAccessible()
{
}
////////////////////////////////////////////////////////////////////////////////
// XULTreeGridCellAccessible: nsISupports implementation

View File

@ -60,6 +60,7 @@ public:
virtual a11y::role NativeRole();
protected:
virtual ~XULTreeGridAccessible();
// XULTreeAccessible
virtual already_AddRefed<Accessible>
@ -100,6 +101,7 @@ public:
virtual void RowInvalidated(int32_t aStartColIdx, int32_t aEndColIdx);
protected:
virtual ~XULTreeGridRowAccessible();
// Accessible
virtual void CacheChildren();
@ -184,6 +186,8 @@ public:
bool CellInvalidated();
protected:
virtual ~XULTreeGridCellAccessible();
// Accessible
virtual Accessible* GetSiblingAtOffset(int32_t aOffset,
nsresult* aError = nullptr) const;